From c89c6f95a6aba17b06ed3b3ff84c115e43d579f2 Mon Sep 17 00:00:00 2001 From: User Date: Mon, 16 Mar 2026 02:26:57 +0100 Subject: [PATCH] cleanup (subfolder removed, npm packages removed, etc.); added y-websocket-server code --- .gitignore | 1 + README.md | 29 +- yjs-poll/backend.js => backend.js | 59 +- yjs-poll/frontend.html => frontend.html | 387 +- .../package-lock.json => package-lock.json | 109 +- yjs-poll/package.json => package.json | 4 +- utils.js | 291 + .../node_modules/.bin/0ecdsa-generate-keypair | 16 - .../.bin/0ecdsa-generate-keypair.cmd | 17 - .../.bin/0ecdsa-generate-keypair.ps1 | 28 - yjs-poll/node_modules/.bin/0gentesthtml | 16 - yjs-poll/node_modules/.bin/0gentesthtml.cmd | 17 - yjs-poll/node_modules/.bin/0gentesthtml.ps1 | 28 - yjs-poll/node_modules/.bin/0serve | 16 - yjs-poll/node_modules/.bin/0serve.cmd | 17 - yjs-poll/node_modules/.bin/0serve.ps1 | 28 - yjs-poll/node_modules/.package-lock.json | 118 - yjs-poll/node_modules/isomorphic.js/LICENSE | 21 - yjs-poll/node_modules/isomorphic.js/README.md | 3 - .../node_modules/isomorphic.js/browser.js | 28 - .../node_modules/isomorphic.js/browser.mjs | 25 - yjs-poll/node_modules/isomorphic.js/iso.js | 18 - yjs-poll/node_modules/isomorphic.js/node.mjs | 5 - .../node_modules/isomorphic.js/package.json | 66 - .../lib0/.github/workflows/node.js.yml | 24 - yjs-poll/node_modules/lib0/.jsdoc.json | 18 - .../node_modules/lib0/.vscode/launch.json | 17 - yjs-poll/node_modules/lib0/LICENSE | 21 - yjs-poll/node_modules/lib0/README.md | 1414 --- yjs-poll/node_modules/lib0/array.d.ts | 30 - yjs-poll/node_modules/lib0/array.d.ts.map | 1 - yjs-poll/node_modules/lib0/array.js | 219 - yjs-poll/node_modules/lib0/array.test.d.ts | 13 - .../node_modules/lib0/array.test.d.ts.map | 1 - .../lib0/bin/0ecdsa-generate-keypair.d.ts | 3 - .../lib0/bin/0ecdsa-generate-keypair.d.ts.map | 1 - .../lib0/bin/0ecdsa-generate-keypair.js | 15 - yjs-poll/node_modules/lib0/bin/0serve.d.ts | 3 - .../node_modules/lib0/bin/0serve.d.ts.map | 1 - yjs-poll/node_modules/lib0/bin/0serve.js | 97 - yjs-poll/node_modules/lib0/bin/gendocs.d.ts | 3 - .../node_modules/lib0/bin/gendocs.d.ts.map | 1 - yjs-poll/node_modules/lib0/bin/gendocs.js | 117 - .../node_modules/lib0/bin/gentesthtml.d.ts | 3 - .../lib0/bin/gentesthtml.d.ts.map | 1 - yjs-poll/node_modules/lib0/bin/gentesthtml.js | 89 - yjs-poll/node_modules/lib0/binary.d.ts | 87 - yjs-poll/node_modules/lib0/binary.d.ts.map | 1 - yjs-poll/node_modules/lib0/binary.js | 90 - yjs-poll/node_modules/lib0/binary.test.d.ts | 4 - .../node_modules/lib0/binary.test.d.ts.map | 1 - .../node_modules/lib0/broadcastchannel.d.ts | 8 - .../lib0/broadcastchannel.d.ts.map | 1 - .../node_modules/lib0/broadcastchannel.js | 130 - .../lib0/broadcastchannel.test.d.ts | 3 - .../lib0/broadcastchannel.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/buffer.d.ts | 22 - yjs-poll/node_modules/lib0/buffer.d.ts.map | 1 - yjs-poll/node_modules/lib0/buffer.js | 163 - yjs-poll/node_modules/lib0/buffer.test.d.ts | 6 - .../node_modules/lib0/buffer.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/cache.d.ts | 52 - yjs-poll/node_modules/lib0/cache.d.ts.map | 1 - yjs-poll/node_modules/lib0/cache.js | 206 - yjs-poll/node_modules/lib0/cache.test.d.ts | 3 - .../node_modules/lib0/cache.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/component.d.ts | 86 - yjs-poll/node_modules/lib0/component.d.ts.map | 1 - yjs-poll/node_modules/lib0/component.js | 414 - yjs-poll/node_modules/lib0/conditions.d.ts | 2 - .../node_modules/lib0/conditions.d.ts.map | 1 - yjs-poll/node_modules/lib0/conditions.js | 13 - .../tmp/coverage-70359-1766561372098-0.json | 1 - yjs-poll/node_modules/lib0/crypto.test.d.ts | 9 - .../node_modules/lib0/crypto.test.d.ts.map | 1 - .../node_modules/lib0/crypto/aes-gcm.d.ts | 17 - .../node_modules/lib0/crypto/aes-gcm.d.ts.map | 1 - yjs-poll/node_modules/lib0/crypto/aes-gcm.js | 132 - yjs-poll/node_modules/lib0/crypto/common.d.ts | 3 - .../node_modules/lib0/crypto/common.d.ts.map | 1 - yjs-poll/node_modules/lib0/crypto/common.js | 19 - yjs-poll/node_modules/lib0/crypto/ecdsa.d.ts | 17 - .../node_modules/lib0/crypto/ecdsa.d.ts.map | 1 - yjs-poll/node_modules/lib0/crypto/ecdsa.js | 97 - yjs-poll/node_modules/lib0/crypto/jwt.d.ts | 10 - .../node_modules/lib0/crypto/jwt.d.ts.map | 1 - yjs-poll/node_modules/lib0/crypto/jwt.js | 70 - .../node_modules/lib0/crypto/rsa-oaep.d.ts | 13 - .../lib0/crypto/rsa-oaep.d.ts.map | 1 - yjs-poll/node_modules/lib0/crypto/rsa-oaep.js | 81 - yjs-poll/node_modules/lib0/decoding.d.ts | 165 - yjs-poll/node_modules/lib0/decoding.d.ts.map | 1 - yjs-poll/node_modules/lib0/decoding.js | 710 -- yjs-poll/node_modules/lib0/delta/binding.d.ts | 107 - .../node_modules/lib0/delta/binding.d.ts.map | 1 - yjs-poll/node_modules/lib0/delta/binding.js | 372 - .../node_modules/lib0/delta/binding.test.d.ts | 5 - .../lib0/delta/binding.test.d.ts.map | 1 - .../lib0/delta/delta-pitch.test.d.ts | 5 - .../lib0/delta/delta-pitch.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/delta/delta.d.ts | 1008 -- .../node_modules/lib0/delta/delta.d.ts.map | 1 - yjs-poll/node_modules/lib0/delta/delta.js | 2362 ---- .../node_modules/lib0/delta/delta.test.d.ts | 29 - .../lib0/delta/delta.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/delta/readme.md | 129 - yjs-poll/node_modules/lib0/delta/t3.test.d.ts | 19 - .../node_modules/lib0/delta/t3.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/deno.json | 12 - yjs-poll/node_modules/lib0/deno.lock | 122 - yjs-poll/node_modules/lib0/diff.d.ts | 36 - yjs-poll/node_modules/lib0/diff.d.ts.map | 1 - yjs-poll/node_modules/lib0/diff.js | 145 - yjs-poll/node_modules/lib0/diff.test.d.ts | 6 - yjs-poll/node_modules/lib0/diff.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/diff/patience.d.ts | 16 - .../node_modules/lib0/diff/patience.d.ts.map | 1 - yjs-poll/node_modules/lib0/diff/patience.js | 226 - .../node_modules/lib0/diff/patience.test.d.ts | 4 - .../lib0/diff/patience.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/aes-gcm.cjs | 171 - .../node_modules/lib0/dist/aes-gcm.cjs.map | 1 - .../node_modules/lib0/dist/array-78849c95.cjs | 260 - .../lib0/dist/array-78849c95.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/array.cjs | 26 - yjs-poll/node_modules/lib0/dist/array.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/array.d.ts | 30 - .../node_modules/lib0/dist/array.d.ts.map | 1 - .../node_modules/lib0/dist/array.test.d.ts | 13 - .../lib0/dist/array.test.d.ts.map | 1 - .../dist/bin/0ecdsa-generate-keypair.d.ts | 3 - .../dist/bin/0ecdsa-generate-keypair.d.ts.map | 1 - .../node_modules/lib0/dist/bin/0serve.d.ts | 3 - .../lib0/dist/bin/0serve.d.ts.map | 1 - .../node_modules/lib0/dist/bin/gendocs.d.ts | 3 - .../lib0/dist/bin/gendocs.d.ts.map | 1 - .../lib0/dist/bin/gentesthtml.d.ts | 3 - .../lib0/dist/bin/gentesthtml.d.ts.map | 1 - .../lib0/dist/binary-ac8e39e2.cjs | 229 - .../lib0/dist/binary-ac8e39e2.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/binary.cjs | 74 - .../node_modules/lib0/dist/binary.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/binary.d.ts | 87 - .../node_modules/lib0/dist/binary.d.ts.map | 1 - .../node_modules/lib0/dist/binary.test.d.ts | 4 - .../lib0/dist/binary.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/binding.cjs | 484 - .../node_modules/lib0/dist/binding.cjs.map | 1 - .../lib0/dist/broadcastchannel-aca4f606.cjs | 128 - .../dist/broadcastchannel-aca4f606.cjs.map | 1 - .../lib0/dist/broadcastchannel.cjs | 29 - .../lib0/dist/broadcastchannel.cjs.map | 1 - .../lib0/dist/broadcastchannel.d.ts | 8 - .../lib0/dist/broadcastchannel.d.ts.map | 1 - .../lib0/dist/broadcastchannel.test.d.ts | 3 - .../lib0/dist/broadcastchannel.test.d.ts.map | 1 - .../lib0/dist/buffer-3e750729.cjs | 198 - .../lib0/dist/buffer-3e750729.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/buffer.cjs | 38 - .../node_modules/lib0/dist/buffer.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/buffer.d.ts | 22 - .../node_modules/lib0/dist/buffer.d.ts.map | 1 - .../node_modules/lib0/dist/buffer.test.d.ts | 6 - .../lib0/dist/buffer.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/cache.cjs | 223 - yjs-poll/node_modules/lib0/dist/cache.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/cache.d.ts | 52 - .../node_modules/lib0/dist/cache.d.ts.map | 1 - .../node_modules/lib0/dist/cache.test.d.ts | 3 - .../lib0/dist/cache.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/common.cjs | 47 - .../node_modules/lib0/dist/common.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/component.cjs | 437 - .../node_modules/lib0/dist/component.cjs.map | 1 - .../node_modules/lib0/dist/component.d.ts | 86 - .../node_modules/lib0/dist/component.d.ts.map | 1 - .../lib0/dist/conditions-f5c0c102.cjs | 24 - .../lib0/dist/conditions-f5c0c102.cjs.map | 1 - .../node_modules/lib0/dist/conditions.cjs | 10 - .../node_modules/lib0/dist/conditions.cjs.map | 1 - .../node_modules/lib0/dist/conditions.d.ts | 2 - .../lib0/dist/conditions.d.ts.map | 1 - .../node_modules/lib0/dist/crypto.test.d.ts | 9 - .../lib0/dist/crypto.test.d.ts.map | 1 - .../lib0/dist/crypto/aes-gcm.d.ts | 17 - .../lib0/dist/crypto/aes-gcm.d.ts.map | 1 - .../node_modules/lib0/dist/crypto/common.d.ts | 3 - .../lib0/dist/crypto/common.d.ts.map | 1 - .../node_modules/lib0/dist/crypto/ecdsa.d.ts | 17 - .../lib0/dist/crypto/ecdsa.d.ts.map | 1 - .../node_modules/lib0/dist/crypto/jwt.d.ts | 10 - .../lib0/dist/crypto/jwt.d.ts.map | 1 - .../lib0/dist/crypto/rsa-oaep.d.ts | 13 - .../lib0/dist/crypto/rsa-oaep.d.ts.map | 1 - .../lib0/dist/decoding-76e75827.cjs | 795 -- .../lib0/dist/decoding-76e75827.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/decoding.cjs | 55 - .../node_modules/lib0/dist/decoding.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/decoding.d.ts | 165 - .../node_modules/lib0/dist/decoding.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/delta.cjs | 2412 ---- yjs-poll/node_modules/lib0/dist/delta.cjs.map | 1 - .../node_modules/lib0/dist/delta/binding.d.ts | 107 - .../lib0/dist/delta/binding.d.ts.map | 1 - .../lib0/dist/delta/binding.test.d.ts | 5 - .../lib0/dist/delta/binding.test.d.ts.map | 1 - .../lib0/dist/delta/delta-pitch.test.d.ts | 5 - .../lib0/dist/delta/delta-pitch.test.d.ts.map | 1 - .../node_modules/lib0/dist/delta/delta.d.ts | 1008 -- .../lib0/dist/delta/delta.d.ts.map | 1 - .../lib0/dist/delta/delta.test.d.ts | 29 - .../lib0/dist/delta/delta.test.d.ts.map | 1 - .../node_modules/lib0/dist/delta/t3.test.d.ts | 19 - .../lib0/dist/delta/t3.test.d.ts.map | 1 - .../node_modules/lib0/dist/diff-9d236524.cjs | 162 - .../lib0/dist/diff-9d236524.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/diff.cjs | 18 - yjs-poll/node_modules/lib0/dist/diff.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/diff.d.ts | 36 - yjs-poll/node_modules/lib0/dist/diff.d.ts.map | 1 - .../node_modules/lib0/dist/diff.test.d.ts | 6 - .../node_modules/lib0/dist/diff.test.d.ts.map | 1 - .../node_modules/lib0/dist/diff/patience.d.ts | 16 - .../lib0/dist/diff/patience.d.ts.map | 1 - .../lib0/dist/diff/patience.test.d.ts | 4 - .../lib0/dist/diff/patience.test.d.ts.map | 1 - .../node_modules/lib0/dist/dom-7e625b09.cjs | 371 - .../lib0/dist/dom-7e625b09.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/dom.cjs | 71 - yjs-poll/node_modules/lib0/dist/dom.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/dom.d.ts | 60 - yjs-poll/node_modules/lib0/dist/dom.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/ecdsa.cjs | 130 - yjs-poll/node_modules/lib0/dist/ecdsa.cjs.map | 1 - .../lib0/dist/encoding-1a745c43.cjs | 1025 -- .../lib0/dist/encoding-1a745c43.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/encoding.cjs | 54 - .../node_modules/lib0/dist/encoding.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/encoding.d.ts | 235 - .../node_modules/lib0/dist/encoding.d.ts.map | 1 - .../node_modules/lib0/dist/encoding.test.d.ts | 50 - .../lib0/dist/encoding.test.d.ts.map | 1 - .../lib0/dist/environment-1c97264d.cjs | 180 - .../lib0/dist/environment-1c97264d.cjs.map | 1 - .../node_modules/lib0/dist/environment.cjs | 29 - .../lib0/dist/environment.cjs.map | 1 - .../node_modules/lib0/dist/environment.d.ts | 19 - .../lib0/dist/environment.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/equality.cjs | 34 - .../node_modules/lib0/dist/equality.cjs.map | 1 - .../node_modules/lib0/dist/error-0c1f634f.cjs | 53 - .../lib0/dist/error-0c1f634f.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/error.cjs | 13 - yjs-poll/node_modules/lib0/dist/error.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/error.d.ts | 5 - .../node_modules/lib0/dist/error.d.ts.map | 1 - .../lib0/dist/eventloop-a0168106.cjs | 151 - .../lib0/dist/eventloop-a0168106.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/eventloop.cjs | 19 - .../node_modules/lib0/dist/eventloop.cjs.map | 1 - .../node_modules/lib0/dist/eventloop.d.ts | 16 - .../node_modules/lib0/dist/eventloop.d.ts.map | 1 - .../lib0/dist/eventloop.test.d.ts | 10 - .../lib0/dist/eventloop.test.d.ts.map | 1 - .../node_modules/lib0/dist/fingerprint.cjs | 44 - .../lib0/dist/fingerprint.cjs.map | 1 - .../lib0/dist/function-314580f7.cjs | 223 - .../lib0/dist/function-314580f7.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/function.cjs | 26 - .../node_modules/lib0/dist/function.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/function.d.ts | 19 - .../node_modules/lib0/dist/function.d.ts.map | 1 - .../node_modules/lib0/dist/function.test.d.ts | 5 - .../lib0/dist/function.test.d.ts.map | 1 - .../lib0/dist/hash/rabin-gf2-polynomial.d.ts | 45 - .../dist/hash/rabin-gf2-polynomial.d.ts.map | 1 - .../lib0/dist/hash/rabin-uncached.d.ts | 29 - .../lib0/dist/hash/rabin-uncached.d.ts.map | 1 - .../node_modules/lib0/dist/hash/rabin.d.ts | 27 - .../lib0/dist/hash/rabin.d.ts.map | 1 - .../lib0/dist/hash/rabin.test.d.ts | 8 - .../lib0/dist/hash/rabin.test.d.ts.map | 1 - .../node_modules/lib0/dist/hash/sha256.d.ts | 2 - .../lib0/dist/hash/sha256.d.ts.map | 1 - .../lib0/dist/hash/sha256.node.d.ts | 2 - .../lib0/dist/hash/sha256.node.d.ts.map | 1 - .../lib0/dist/hash/sha256.test.d.ts | 7 - .../lib0/dist/hash/sha256.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/index.cjs | 99 - yjs-poll/node_modules/lib0/dist/index.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/index.d.ts | 35 - .../node_modules/lib0/dist/index.d.ts.map | 1 - .../lib0/dist/indexeddb-46d1e737.cjs | 311 - .../lib0/dist/indexeddb-46d1e737.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/indexeddb.cjs | 37 - .../node_modules/lib0/dist/indexeddb.cjs.map | 1 - .../node_modules/lib0/dist/indexeddb.d.ts | 34 - .../node_modules/lib0/dist/indexeddb.d.ts.map | 1 - .../lib0/dist/indexeddb.test.d.ts | 3 - .../lib0/dist/indexeddb.test.d.ts.map | 1 - .../node_modules/lib0/dist/indexeddbV2.cjs | 288 - .../lib0/dist/indexeddbV2.cjs.map | 1 - .../node_modules/lib0/dist/indexeddbV2.d.ts | 35 - .../lib0/dist/indexeddbV2.d.ts.map | 1 - .../lib0/dist/indexeddbV2.test.d.ts | 3 - .../lib0/dist/indexeddbV2.test.d.ts.map | 1 - .../node_modules/lib0/dist/isomorphic.cjs | 17 - .../node_modules/lib0/dist/isomorphic.cjs.map | 1 - .../lib0/dist/iterator-9fc627c1.cjs | 78 - .../lib0/dist/iterator-9fc627c1.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/iterator.cjs | 13 - .../node_modules/lib0/dist/iterator.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/iterator.d.ts | 5 - .../node_modules/lib0/dist/iterator.d.ts.map | 1 - .../node_modules/lib0/dist/json-092190a1.cjs | 34 - .../lib0/dist/json-092190a1.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/json.cjs | 11 - yjs-poll/node_modules/lib0/dist/json.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/json.d.ts | 23 - yjs-poll/node_modules/lib0/dist/json.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/jwt.cjs | 96 - yjs-poll/node_modules/lib0/dist/jwt.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/list.cjs | 266 - yjs-poll/node_modules/lib0/dist/list.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/list.d.ts | 55 - yjs-poll/node_modules/lib0/dist/list.d.ts.map | 1 - .../node_modules/lib0/dist/list.test.d.ts | 6 - .../node_modules/lib0/dist/list.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/logging.cjs | 428 - .../node_modules/lib0/dist/logging.cjs.map | 1 - .../node_modules/lib0/dist/logging.common.cjs | 132 - .../lib0/dist/logging.common.cjs.map | 1 - .../lib0/dist/logging.common.d.ts | 12 - .../lib0/dist/logging.common.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/logging.d.ts | 55 - .../node_modules/lib0/dist/logging.d.ts.map | 1 - .../node_modules/lib0/dist/logging.node.cjs | 203 - .../lib0/dist/logging.node.cjs.map | 1 - .../node_modules/lib0/dist/logging.node.d.ts | 14 - .../lib0/dist/logging.node.d.ts.map | 1 - .../node_modules/lib0/dist/logging.test.d.ts | 3 - .../lib0/dist/logging.test.d.ts.map | 1 - .../node_modules/lib0/dist/map-24d263c0.cjs | 139 - .../lib0/dist/map-24d263c0.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/map.cjs | 15 - yjs-poll/node_modules/lib0/dist/map.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/map.d.ts | 8 - yjs-poll/node_modules/lib0/dist/map.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/map.test.d.ts | 4 - .../node_modules/lib0/dist/map.test.d.ts.map | 1 - .../node_modules/lib0/dist/math-96d5e8c4.cjs | 103 - .../lib0/dist/math-96d5e8c4.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/math.cjs | 26 - yjs-poll/node_modules/lib0/dist/math.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/math.d.ts | 23 - yjs-poll/node_modules/lib0/dist/math.d.ts.map | 1 - .../node_modules/lib0/dist/math.test.d.ts | 3 - .../node_modules/lib0/dist/math.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/metric.cjs | 83 - .../node_modules/lib0/dist/metric.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/metric.d.ts | 25 - .../node_modules/lib0/dist/metric.d.ts.map | 1 - .../node_modules/lib0/dist/metric.test.d.ts | 3 - .../lib0/dist/metric.test.d.ts.map | 1 - .../node_modules/lib0/dist/mutex-63f09c81.cjs | 54 - .../lib0/dist/mutex-63f09c81.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/mutex.cjs | 10 - yjs-poll/node_modules/lib0/dist/mutex.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/mutex.d.ts | 3 - .../node_modules/lib0/dist/mutex.d.ts.map | 1 - .../node_modules/lib0/dist/mutex.test.d.ts | 3 - .../lib0/dist/mutex.test.d.ts.map | 1 - .../lib0/dist/number-1fb57bba.cjs | 64 - .../lib0/dist/number-1fb57bba.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/number.cjs | 20 - .../node_modules/lib0/dist/number.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/number.d.ts | 10 - .../node_modules/lib0/dist/number.d.ts.map | 1 - .../node_modules/lib0/dist/number.test.d.ts | 4 - .../lib0/dist/number.test.d.ts.map | 1 - .../lib0/dist/object-c0c9435b.cjs | 212 - .../lib0/dist/object-c0c9435b.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/object.cjs | 27 - .../node_modules/lib0/dist/object.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/object.d.ts | 72 - .../node_modules/lib0/dist/object.d.ts.map | 1 - .../node_modules/lib0/dist/object.test.d.ts | 6 - .../lib0/dist/object.test.d.ts.map | 1 - .../node_modules/lib0/dist/observable.cjs | 169 - .../node_modules/lib0/dist/observable.cjs.map | 1 - .../node_modules/lib0/dist/observable.d.ts | 86 - .../lib0/dist/observable.d.ts.map | 1 - .../lib0/dist/observable.test.d.ts | 3 - .../lib0/dist/observable.test.d.ts.map | 1 - .../node_modules/lib0/dist/pair-ab022bc3.cjs | 69 - .../lib0/dist/pair-ab022bc3.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/pair.cjs | 14 - yjs-poll/node_modules/lib0/dist/pair.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/pair.d.ts | 22 - yjs-poll/node_modules/lib0/dist/pair.d.ts.map | 1 - .../node_modules/lib0/dist/pair.test.d.ts | 3 - .../node_modules/lib0/dist/pair.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/patience.cjs | 236 - .../node_modules/lib0/dist/patience.cjs.map | 1 - .../node_modules/lib0/dist/performance.cjs | 14 - .../lib0/dist/performance.cjs.map | 1 - .../node_modules/lib0/dist/performance.d.ts | 4 - .../lib0/dist/performance.d.ts.map | 1 - .../lib0/dist/performance.node.cjs | 36 - .../lib0/dist/performance.node.cjs.map | 1 - .../lib0/dist/performance.node.d.ts | 14 - .../lib0/dist/performance.node.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/pledge.cjs | 308 - .../node_modules/lib0/dist/pledge.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/pledge.d.ts | 68 - .../node_modules/lib0/dist/pledge.d.ts.map | 1 - .../node_modules/lib0/dist/pledge.test.d.ts | 6 - .../lib0/dist/pledge.test.d.ts.map | 1 - .../node_modules/lib0/dist/prng-37d48618.cjs | 387 - .../lib0/dist/prng-37d48618.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/prng.cjs | 44 - yjs-poll/node_modules/lib0/dist/prng.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/prng.d.ts | 44 - yjs-poll/node_modules/lib0/dist/prng.d.ts.map | 1 - .../node_modules/lib0/dist/prng.test.d.ts | 6 - .../node_modules/lib0/dist/prng.test.d.ts.map | 1 - .../node_modules/lib0/dist/prng/Mt19937.d.ts | 29 - .../lib0/dist/prng/Mt19937.d.ts.map | 1 - .../lib0/dist/prng/Xoroshiro128plus.d.ts | 27 - .../lib0/dist/prng/Xoroshiro128plus.d.ts.map | 1 - .../lib0/dist/prng/Xorshift32.d.ts | 21 - .../lib0/dist/prng/Xorshift32.d.ts.map | 1 - .../lib0/dist/promise-cda7b9bb.cjs | 145 - .../lib0/dist/promise-cda7b9bb.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/promise.cjs | 22 - .../node_modules/lib0/dist/promise.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/promise.d.ts | 22 - .../node_modules/lib0/dist/promise.d.ts.map | 1 - .../node_modules/lib0/dist/promise.test.d.ts | 5 - .../lib0/dist/promise.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/queue.cjs | 97 - yjs-poll/node_modules/lib0/dist/queue.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/queue.d.ts | 34 - .../node_modules/lib0/dist/queue.d.ts.map | 1 - .../node_modules/lib0/dist/queue.test.d.ts | 3 - .../lib0/dist/queue.test.d.ts.map | 1 - .../lib0/dist/rabin-gf2-polynomial.cjs | 440 - .../lib0/dist/rabin-gf2-polynomial.cjs.map | 1 - .../node_modules/lib0/dist/rabin-uncached.cjs | 90 - .../lib0/dist/rabin-uncached.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/rabin.cjs | 128 - yjs-poll/node_modules/lib0/dist/rabin.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/random.cjs | 48 - .../node_modules/lib0/dist/random.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/random.d.ts | 6 - .../node_modules/lib0/dist/random.d.ts.map | 1 - .../node_modules/lib0/dist/random.test.d.ts | 7 - .../lib0/dist/random.test.d.ts.map | 1 - .../node_modules/lib0/dist/rollup.config.d.ts | 13 - .../lib0/dist/rollup.config.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/rsa-oaep.cjs | 112 - .../node_modules/lib0/dist/rsa-oaep.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/schema.cjs | 1223 -- .../node_modules/lib0/dist/schema.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/schema.d.ts | 595 - .../node_modules/lib0/dist/schema.d.ts.map | 1 - .../node_modules/lib0/dist/schema.test.d.ts | 15 - .../lib0/dist/schema.test.d.ts.map | 1 - .../node_modules/lib0/dist/set-5b47859e.cjs | 45 - .../lib0/dist/set-5b47859e.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/set.cjs | 13 - yjs-poll/node_modules/lib0/dist/set.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/set.d.ts | 5 - yjs-poll/node_modules/lib0/dist/set.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/set.test.d.ts | 3 - .../node_modules/lib0/dist/set.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/sha256.cjs | 183 - .../node_modules/lib0/dist/sha256.cjs.map | 1 - .../node_modules/lib0/dist/sha256.node.cjs | 17 - .../lib0/dist/sha256.node.cjs.map | 1 - .../node_modules/lib0/dist/sort-812cc211.cjs | 103 - .../lib0/dist/sort-812cc211.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/sort.cjs | 13 - yjs-poll/node_modules/lib0/dist/sort.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/sort.d.ts | 4 - yjs-poll/node_modules/lib0/dist/sort.d.ts.map | 1 - .../node_modules/lib0/dist/sort.test.d.ts | 7 - .../node_modules/lib0/dist/sort.test.d.ts.map | 1 - .../lib0/dist/statistics-65f6114b.cjs | 32 - .../lib0/dist/statistics-65f6114b.cjs.map | 1 - .../node_modules/lib0/dist/statistics.cjs | 12 - .../node_modules/lib0/dist/statistics.cjs.map | 1 - .../node_modules/lib0/dist/statistics.d.ts | 3 - .../lib0/dist/statistics.d.ts.map | 1 - .../lib0/dist/statistics.test.d.ts | 3 - .../lib0/dist/statistics.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/storage.cjs | 81 - .../node_modules/lib0/dist/storage.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/storage.d.ts | 15 - .../node_modules/lib0/dist/storage.d.ts.map | 1 - .../node_modules/lib0/dist/storage.test.d.ts | 3 - .../lib0/dist/storage.test.d.ts.map | 1 - .../lib0/dist/string-fddc5f8b.cjs | 209 - .../lib0/dist/string-fddc5f8b.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/string.cjs | 32 - .../node_modules/lib0/dist/string.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/string.d.ts | 28 - .../node_modules/lib0/dist/string.d.ts.map | 1 - .../node_modules/lib0/dist/string.test.d.ts | 9 - .../lib0/dist/string.test.d.ts.map | 1 - .../lib0/dist/symbol-9c439012.cjs | 29 - .../lib0/dist/symbol-9c439012.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/symbol.cjs | 11 - .../node_modules/lib0/dist/symbol.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/symbol.d.ts | 11 - .../node_modules/lib0/dist/symbol.d.ts.map | 1 - .../node_modules/lib0/dist/symbol.test.d.ts | 3 - .../lib0/dist/symbol.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/testing.cjs | 709 -- .../node_modules/lib0/dist/testing.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/testing.d.ts | 64 - .../node_modules/lib0/dist/testing.d.ts.map | 1 - .../node_modules/lib0/dist/testing.test.d.ts | 9 - .../lib0/dist/testing.test.d.ts.map | 1 - .../node_modules/lib0/dist/time-d8438852.cjs | 63 - .../lib0/dist/time-d8438852.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/time.cjs | 14 - yjs-poll/node_modules/lib0/dist/time.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/time.d.ts | 9 - yjs-poll/node_modules/lib0/dist/time.d.ts.map | 1 - .../node_modules/lib0/dist/time.test.d.ts | 4 - .../node_modules/lib0/dist/time.test.d.ts.map | 1 - .../lib0/dist/trait/equality.d.ts | 6 - .../lib0/dist/trait/equality.d.ts.map | 1 - .../lib0/dist/trait/fingerprint.d.ts | 13 - .../lib0/dist/trait/fingerprint.d.ts.map | 1 - .../node_modules/lib0/dist/trait/traits.d.ts | 3 - .../lib0/dist/trait/traits.d.ts.map | 1 - .../lib0/dist/trait/traits.test.d.ts | 5 - .../lib0/dist/trait/traits.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/traits.cjs | 31 - .../node_modules/lib0/dist/traits.cjs.map | 1 - .../node_modules/lib0/dist/tree-9f3c8837.cjs | 557 - .../lib0/dist/tree-9f3c8837.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/tree.cjs | 10 - yjs-poll/node_modules/lib0/dist/tree.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/tree.d.ts | 96 - yjs-poll/node_modules/lib0/dist/tree.d.ts.map | 1 - .../node_modules/lib0/dist/tree.test.d.ts | 2 - .../node_modules/lib0/dist/tree.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/url.cjs | 46 - yjs-poll/node_modules/lib0/dist/url.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/url.d.ts | 7 - yjs-poll/node_modules/lib0/dist/url.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/url.test.d.ts | 3 - .../node_modules/lib0/dist/url.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/dist/webcrypto.cjs | 12 - .../node_modules/lib0/dist/webcrypto.cjs.map | 1 - .../node_modules/lib0/dist/webcrypto.d.ts | 3 - .../node_modules/lib0/dist/webcrypto.d.ts.map | 1 - .../node_modules/lib0/dist/webcrypto.deno.cjs | 12 - .../lib0/dist/webcrypto.deno.cjs.map | 1 - .../lib0/dist/webcrypto.deno.d.ts | 3 - .../lib0/dist/webcrypto.deno.d.ts.map | 1 - .../node_modules/lib0/dist/webcrypto.node.cjs | 12 - .../lib0/dist/webcrypto.node.cjs.map | 1 - .../lib0/dist/webcrypto.node.d.ts | 3 - .../lib0/dist/webcrypto.node.d.ts.map | 1 - .../lib0/dist/webcrypto.react-native.cjs | 20 - .../lib0/dist/webcrypto.react-native.cjs.map | 1 - .../lib0/dist/webcrypto.react-native.d.ts | 3 - .../lib0/dist/webcrypto.react-native.d.ts.map | 1 - .../lib0/dist/websocket-b073d0fc.cjs | 157 - .../lib0/dist/websocket-b073d0fc.cjs.map | 1 - yjs-poll/node_modules/lib0/dist/websocket.cjs | 17 - .../node_modules/lib0/dist/websocket.cjs.map | 1 - .../node_modules/lib0/dist/websocket.d.ts | 38 - .../node_modules/lib0/dist/websocket.d.ts.map | 1 - yjs-poll/node_modules/lib0/dom.d.ts | 60 - yjs-poll/node_modules/lib0/dom.d.ts.map | 1 - yjs-poll/node_modules/lib0/dom.js | 284 - yjs-poll/node_modules/lib0/encoding.d.ts | 235 - yjs-poll/node_modules/lib0/encoding.d.ts.map | 1 - yjs-poll/node_modules/lib0/encoding.js | 938 -- yjs-poll/node_modules/lib0/encoding.test.d.ts | 50 - .../node_modules/lib0/encoding.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/environment.d.ts | 19 - .../node_modules/lib0/environment.d.ts.map | 1 - yjs-poll/node_modules/lib0/environment.js | 152 - yjs-poll/node_modules/lib0/error.d.ts | 5 - yjs-poll/node_modules/lib0/error.d.ts.map | 1 - yjs-poll/node_modules/lib0/error.js | 36 - yjs-poll/node_modules/lib0/eventloop.d.ts | 16 - yjs-poll/node_modules/lib0/eventloop.d.ts.map | 1 - yjs-poll/node_modules/lib0/eventloop.js | 128 - .../node_modules/lib0/eventloop.test.d.ts | 10 - .../node_modules/lib0/eventloop.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/function.d.ts | 19 - yjs-poll/node_modules/lib0/function.d.ts.map | 1 - yjs-poll/node_modules/lib0/function.js | 188 - yjs-poll/node_modules/lib0/function.test.d.ts | 5 - .../node_modules/lib0/function.test.d.ts.map | 1 - .../lib0/hash/rabin-gf2-polynomial.d.ts | 45 - .../lib0/hash/rabin-gf2-polynomial.d.ts.map | 1 - .../lib0/hash/rabin-gf2-polynomial.js | 379 - .../lib0/hash/rabin-uncached.d.ts | 29 - .../lib0/hash/rabin-uncached.d.ts.map | 1 - .../node_modules/lib0/hash/rabin-uncached.js | 68 - yjs-poll/node_modules/lib0/hash/rabin.d.ts | 27 - .../node_modules/lib0/hash/rabin.d.ts.map | 1 - yjs-poll/node_modules/lib0/hash/rabin.js | 100 - .../node_modules/lib0/hash/rabin.test.d.ts | 8 - .../lib0/hash/rabin.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/hash/sha256.d.ts | 2 - .../node_modules/lib0/hash/sha256.d.ts.map | 1 - yjs-poll/node_modules/lib0/hash/sha256.js | 176 - .../node_modules/lib0/hash/sha256.node.d.ts | 2 - .../lib0/hash/sha256.node.d.ts.map | 1 - .../node_modules/lib0/hash/sha256.node.js | 10 - .../node_modules/lib0/hash/sha256.test.d.ts | 7 - .../lib0/hash/sha256.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/index.d.ts | 35 - yjs-poll/node_modules/lib0/index.d.ts.map | 1 - yjs-poll/node_modules/lib0/index.js | 82 - yjs-poll/node_modules/lib0/indexeddb.d.ts | 34 - yjs-poll/node_modules/lib0/indexeddb.d.ts.map | 1 - yjs-poll/node_modules/lib0/indexeddb.js | 262 - .../node_modules/lib0/indexeddb.test.d.ts | 3 - .../node_modules/lib0/indexeddb.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/indexeddbV2.d.ts | 35 - .../node_modules/lib0/indexeddbV2.d.ts.map | 1 - yjs-poll/node_modules/lib0/indexeddbV2.js | 265 - .../node_modules/lib0/indexeddbV2.test.d.ts | 3 - .../lib0/indexeddbV2.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/isomorphic.js | 10 - yjs-poll/node_modules/lib0/iterator.d.ts | 5 - yjs-poll/node_modules/lib0/iterator.d.ts.map | 1 - yjs-poll/node_modules/lib0/iterator.js | 61 - yjs-poll/node_modules/lib0/json.d.ts | 23 - yjs-poll/node_modules/lib0/json.d.ts.map | 1 - yjs-poll/node_modules/lib0/json.js | 21 - yjs-poll/node_modules/lib0/list.d.ts | 55 - yjs-poll/node_modules/lib0/list.d.ts.map | 1 - yjs-poll/node_modules/lib0/list.js | 243 - yjs-poll/node_modules/lib0/list.test.d.ts | 6 - yjs-poll/node_modules/lib0/list.test.d.ts.map | 1 - .../node_modules/lib0/logging.common.d.ts | 12 - .../node_modules/lib0/logging.common.d.ts.map | 1 - yjs-poll/node_modules/lib0/logging.common.js | 105 - yjs-poll/node_modules/lib0/logging.d.ts | 55 - yjs-poll/node_modules/lib0/logging.d.ts.map | 1 - yjs-poll/node_modules/lib0/logging.js | 383 - yjs-poll/node_modules/lib0/logging.node.d.ts | 14 - .../node_modules/lib0/logging.node.d.ts.map | 1 - yjs-poll/node_modules/lib0/logging.node.js | 164 - yjs-poll/node_modules/lib0/logging.test.d.ts | 3 - .../node_modules/lib0/logging.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/map.d.ts | 8 - yjs-poll/node_modules/lib0/map.d.ts.map | 1 - yjs-poll/node_modules/lib0/map.js | 118 - yjs-poll/node_modules/lib0/map.test.d.ts | 4 - yjs-poll/node_modules/lib0/map.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/math.d.ts | 23 - yjs-poll/node_modules/lib0/math.d.ts.map | 1 - yjs-poll/node_modules/lib0/math.js | 60 - yjs-poll/node_modules/lib0/math.test.d.ts | 3 - yjs-poll/node_modules/lib0/math.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/metric.d.ts | 25 - yjs-poll/node_modules/lib0/metric.d.ts.map | 1 - yjs-poll/node_modules/lib0/metric.js | 56 - yjs-poll/node_modules/lib0/metric.test.d.ts | 3 - .../node_modules/lib0/metric.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/mutex.d.ts | 3 - yjs-poll/node_modules/lib0/mutex.d.ts.map | 1 - yjs-poll/node_modules/lib0/mutex.js | 43 - yjs-poll/node_modules/lib0/mutex.test.d.ts | 3 - .../node_modules/lib0/mutex.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/number.d.ts | 10 - yjs-poll/node_modules/lib0/number.d.ts.map | 1 - yjs-poll/node_modules/lib0/number.js | 37 - yjs-poll/node_modules/lib0/number.test.d.ts | 4 - .../node_modules/lib0/number.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/object.d.ts | 72 - yjs-poll/node_modules/lib0/object.d.ts.map | 1 - yjs-poll/node_modules/lib0/object.js | 169 - yjs-poll/node_modules/lib0/object.test.d.ts | 6 - .../node_modules/lib0/object.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/observable.d.ts | 86 - .../node_modules/lib0/observable.d.ts.map | 1 - yjs-poll/node_modules/lib0/observable.js | 161 - .../node_modules/lib0/observable.test.d.ts | 3 - .../lib0/observable.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/package.json | 556 - yjs-poll/node_modules/lib0/pair.d.ts | 22 - yjs-poll/node_modules/lib0/pair.d.ts.map | 1 - yjs-poll/node_modules/lib0/pair.js | 50 - yjs-poll/node_modules/lib0/pair.test.d.ts | 3 - yjs-poll/node_modules/lib0/pair.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/performance.d.ts | 4 - .../node_modules/lib0/performance.d.ts.map | 1 - yjs-poll/node_modules/lib0/performance.js | 5 - .../node_modules/lib0/performance.node.d.ts | 14 - .../lib0/performance.node.d.ts.map | 1 - .../node_modules/lib0/performance.node.js | 21 - yjs-poll/node_modules/lib0/pledge.d.ts | 68 - yjs-poll/node_modules/lib0/pledge.d.ts.map | 1 - yjs-poll/node_modules/lib0/pledge.js | 292 - yjs-poll/node_modules/lib0/pledge.test.d.ts | 6 - .../node_modules/lib0/pledge.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/prng.d.ts | 44 - yjs-poll/node_modules/lib0/prng.d.ts.map | 1 - yjs-poll/node_modules/lib0/prng.js | 200 - yjs-poll/node_modules/lib0/prng.test.d.ts | 6 - yjs-poll/node_modules/lib0/prng.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/prng/Mt19937.d.ts | 29 - .../node_modules/lib0/prng/Mt19937.d.ts.map | 1 - yjs-poll/node_modules/lib0/prng/Mt19937.js | 78 - .../lib0/prng/Xoroshiro128plus.d.ts | 27 - .../lib0/prng/Xoroshiro128plus.d.ts.map | 1 - .../lib0/prng/Xoroshiro128plus.js | 111 - .../node_modules/lib0/prng/Xorshift32.d.ts | 21 - .../lib0/prng/Xorshift32.d.ts.map | 1 - yjs-poll/node_modules/lib0/prng/Xorshift32.js | 35 - yjs-poll/node_modules/lib0/promise.d.ts | 22 - yjs-poll/node_modules/lib0/promise.d.ts.map | 1 - yjs-poll/node_modules/lib0/promise.js | 116 - yjs-poll/node_modules/lib0/promise.test.d.ts | 5 - .../node_modules/lib0/promise.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/queue.d.ts | 34 - yjs-poll/node_modules/lib0/queue.d.ts.map | 1 - yjs-poll/node_modules/lib0/queue.js | 84 - yjs-poll/node_modules/lib0/queue.test.d.ts | 3 - .../node_modules/lib0/queue.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/random.d.ts | 6 - yjs-poll/node_modules/lib0/random.d.ts.map | 1 - yjs-poll/node_modules/lib0/random.js | 37 - yjs-poll/node_modules/lib0/random.test.d.ts | 7 - .../node_modules/lib0/random.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/rollup.config.d.ts | 13 - .../node_modules/lib0/rollup.config.d.ts.map | 1 - yjs-poll/node_modules/lib0/schema.d.ts | 595 - yjs-poll/node_modules/lib0/schema.d.ts.map | 1 - yjs-poll/node_modules/lib0/schema.js | 1136 -- yjs-poll/node_modules/lib0/schema.test.d.ts | 15 - .../node_modules/lib0/schema.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/set.d.ts | 5 - yjs-poll/node_modules/lib0/set.d.ts.map | 1 - yjs-poll/node_modules/lib0/set.js | 28 - yjs-poll/node_modules/lib0/set.test.d.ts | 3 - yjs-poll/node_modules/lib0/set.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/sort.d.ts | 4 - yjs-poll/node_modules/lib0/sort.d.ts.map | 1 - yjs-poll/node_modules/lib0/sort.js | 88 - yjs-poll/node_modules/lib0/sort.test.d.ts | 7 - yjs-poll/node_modules/lib0/sort.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/statistics.d.ts | 3 - .../node_modules/lib0/statistics.d.ts.map | 1 - yjs-poll/node_modules/lib0/statistics.js | 19 - .../node_modules/lib0/statistics.test.d.ts | 3 - .../lib0/statistics.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/storage.d.ts | 15 - yjs-poll/node_modules/lib0/storage.d.ts.map | 1 - yjs-poll/node_modules/lib0/storage.js | 72 - yjs-poll/node_modules/lib0/storage.test.d.ts | 3 - .../node_modules/lib0/storage.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/string.d.ts | 28 - yjs-poll/node_modules/lib0/string.d.ts.map | 1 - yjs-poll/node_modules/lib0/string.js | 165 - yjs-poll/node_modules/lib0/string.test.d.ts | 9 - .../node_modules/lib0/string.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/symbol.d.ts | 11 - yjs-poll/node_modules/lib0/symbol.d.ts.map | 1 - yjs-poll/node_modules/lib0/symbol.js | 16 - yjs-poll/node_modules/lib0/symbol.test.d.ts | 3 - .../node_modules/lib0/symbol.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/test.d.ts | 2 - yjs-poll/node_modules/lib0/test.d.ts.map | 1 - yjs-poll/node_modules/lib0/test.html | 168 - yjs-poll/node_modules/lib0/test.js | 104 - yjs-poll/node_modules/lib0/testing.d.ts | 64 - yjs-poll/node_modules/lib0/testing.d.ts.map | 1 - yjs-poll/node_modules/lib0/testing.js | 646 - yjs-poll/node_modules/lib0/testing.test.d.ts | 9 - .../node_modules/lib0/testing.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/time.d.ts | 9 - yjs-poll/node_modules/lib0/time.d.ts.map | 1 - yjs-poll/node_modules/lib0/time.js | 48 - yjs-poll/node_modules/lib0/time.test.d.ts | 4 - yjs-poll/node_modules/lib0/time.test.d.ts.map | 1 - .../node_modules/lib0/trait/equality.d.ts | 6 - .../node_modules/lib0/trait/equality.d.ts.map | 1 - yjs-poll/node_modules/lib0/trait/equality.js | 26 - .../node_modules/lib0/trait/fingerprint.d.ts | 13 - .../lib0/trait/fingerprint.d.ts.map | 1 - .../node_modules/lib0/trait/fingerprint.js | 21 - yjs-poll/node_modules/lib0/trait/traits.d.ts | 3 - .../node_modules/lib0/trait/traits.d.ts.map | 1 - yjs-poll/node_modules/lib0/trait/traits.js | 2 - .../node_modules/lib0/trait/traits.test.d.ts | 5 - .../lib0/trait/traits.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/tree.d.ts | 96 - yjs-poll/node_modules/lib0/tree.d.ts.map | 1 - yjs-poll/node_modules/lib0/tree.js | 546 - yjs-poll/node_modules/lib0/tree.test.d.ts | 2 - yjs-poll/node_modules/lib0/tree.test.d.ts.map | 1 - .../types/bin/0ecdsa-generate-keypair.d.ts | 3 - .../bin/0ecdsa-generate-keypair.d.ts.map | 1 - .../node_modules/lib0/types/bin/0serve.d.ts | 3 - .../lib0/types/bin/0serve.d.ts.map | 1 - .../node_modules/lib0/types/bin/gendocs.d.ts | 3 - .../lib0/types/bin/gendocs.d.ts.map | 1 - .../lib0/types/bin/gentesthtml.d.ts | 3 - .../lib0/types/bin/gentesthtml.d.ts.map | 1 - .../lib0/types/crypto/aes-gcm.d.ts | 17 - .../lib0/types/crypto/aes-gcm.d.ts.map | 1 - .../lib0/types/crypto/common.d.ts | 3 - .../lib0/types/crypto/common.d.ts.map | 1 - .../node_modules/lib0/types/crypto/ecdsa.d.ts | 17 - .../lib0/types/crypto/ecdsa.d.ts.map | 1 - .../node_modules/lib0/types/crypto/jwt.d.ts | 10 - .../lib0/types/crypto/jwt.d.ts.map | 1 - .../lib0/types/crypto/rsa-oaep.d.ts | 13 - .../lib0/types/crypto/rsa-oaep.d.ts.map | 1 - .../lib0/types/delta/binding.d.ts | 107 - .../lib0/types/delta/binding.d.ts.map | 1 - .../node_modules/lib0/types/delta/delta.d.ts | 1074 -- .../lib0/types/delta/delta.d.ts.map | 1 - .../lib0/types/delta/t3.test.d.ts | 19 - .../lib0/types/delta/t3.test.d.ts.map | 1 - .../lib0/types/diff/patience.d.ts | 16 - .../lib0/types/diff/patience.d.ts.map | 1 - .../lib0/types/hash/rabin-gf2-polynomial.d.ts | 45 - .../types/hash/rabin-gf2-polynomial.d.ts.map | 1 - .../lib0/types/hash/rabin-uncached.d.ts | 29 - .../lib0/types/hash/rabin-uncached.d.ts.map | 1 - .../node_modules/lib0/types/hash/rabin.d.ts | 27 - .../lib0/types/hash/rabin.d.ts.map | 1 - .../node_modules/lib0/types/hash/sha256.d.ts | 2 - .../lib0/types/hash/sha256.d.ts.map | 1 - .../lib0/types/hash/sha256.node.d.ts | 2 - .../lib0/types/hash/sha256.node.d.ts.map | 1 - .../node_modules/lib0/types/prng/Mt19937.d.ts | 29 - .../lib0/types/prng/Mt19937.d.ts.map | 1 - .../lib0/types/prng/Xoroshiro128plus.d.ts | 27 - .../lib0/types/prng/Xoroshiro128plus.d.ts.map | 1 - .../lib0/types/prng/Xorshift32.d.ts | 21 - .../lib0/types/prng/Xorshift32.d.ts.map | 1 - .../lib0/types/trait/equality.d.ts | 6 - .../lib0/types/trait/equality.d.ts.map | 1 - .../lib0/types/trait/fingerprint.d.ts | 13 - .../lib0/types/trait/fingerprint.d.ts.map | 1 - .../node_modules/lib0/types/trait/traits.d.ts | 3 - .../lib0/types/trait/traits.d.ts.map | 1 - yjs-poll/node_modules/lib0/url.d.ts | 7 - yjs-poll/node_modules/lib0/url.d.ts.map | 1 - yjs-poll/node_modules/lib0/url.js | 37 - yjs-poll/node_modules/lib0/url.test.d.ts | 3 - yjs-poll/node_modules/lib0/url.test.d.ts.map | 1 - yjs-poll/node_modules/lib0/webcrypto.d.ts | 3 - yjs-poll/node_modules/lib0/webcrypto.d.ts.map | 1 - .../node_modules/lib0/webcrypto.deno.d.ts | 3 - .../node_modules/lib0/webcrypto.deno.d.ts.map | 1 - yjs-poll/node_modules/lib0/webcrypto.deno.js | 4 - yjs-poll/node_modules/lib0/webcrypto.js | 4 - .../node_modules/lib0/webcrypto.node.d.ts | 3 - .../node_modules/lib0/webcrypto.node.d.ts.map | 1 - yjs-poll/node_modules/lib0/webcrypto.node.js | 4 - .../lib0/webcrypto.react-native.d.ts | 3 - .../lib0/webcrypto.react-native.d.ts.map | 1 - .../lib0/webcrypto.react-native.js | 7 - yjs-poll/node_modules/lib0/websocket.d.ts | 38 - yjs-poll/node_modules/lib0/websocket.d.ts.map | 1 - yjs-poll/node_modules/lib0/websocket.js | 154 - yjs-poll/node_modules/ws/LICENSE | 20 - yjs-poll/node_modules/ws/README.md | 548 - yjs-poll/node_modules/ws/browser.js | 8 - yjs-poll/node_modules/ws/index.js | 13 - yjs-poll/node_modules/ws/lib/buffer-util.js | 131 - yjs-poll/node_modules/ws/lib/constants.js | 19 - yjs-poll/node_modules/ws/lib/event-target.js | 292 - yjs-poll/node_modules/ws/lib/extension.js | 203 - yjs-poll/node_modules/ws/lib/limiter.js | 55 - .../node_modules/ws/lib/permessage-deflate.js | 528 - yjs-poll/node_modules/ws/lib/receiver.js | 706 -- yjs-poll/node_modules/ws/lib/sender.js | 602 - yjs-poll/node_modules/ws/lib/stream.js | 161 - yjs-poll/node_modules/ws/lib/subprotocol.js | 62 - yjs-poll/node_modules/ws/lib/validation.js | 152 - .../node_modules/ws/lib/websocket-server.js | 554 - yjs-poll/node_modules/ws/lib/websocket.js | 1393 --- yjs-poll/node_modules/ws/package.json | 69 - yjs-poll/node_modules/ws/wrapper.mjs | 8 - yjs-poll/node_modules/y-protocols/LICENSE | 21 - yjs-poll/node_modules/y-protocols/README.md | 78 - yjs-poll/node_modules/y-protocols/auth.d.ts | 8 - .../node_modules/y-protocols/auth.d.ts.map | 1 - yjs-poll/node_modules/y-protocols/auth.js | 33 - .../node_modules/y-protocols/awareness.d.ts | 86 - .../y-protocols/awareness.d.ts.map | 1 - .../node_modules/y-protocols/awareness.js | 295 - .../y-protocols/awareness.test.d.ts | 3 - .../y-protocols/awareness.test.d.ts.map | 1 - .../y-protocols/awareness.test.js | 53 - .../node_modules/y-protocols/dist/auth.cjs | 59 - .../y-protocols/dist/auth.cjs.map | 1 - .../y-protocols/dist/awareness.cjs | 329 - .../y-protocols/dist/awareness.cjs.map | 1 - .../node_modules/y-protocols/dist/sync.cjs | 170 - .../y-protocols/dist/sync.cjs.map | 1 - .../node_modules/y-protocols/dist/test.cjs | 103 - .../y-protocols/dist/test.cjs.map | 1 - .../node_modules/y-protocols/dist/test.js | 9921 --------------- .../node_modules/y-protocols/dist/test.js.map | 1 - .../node_modules/y-protocols/package.json | 92 - yjs-poll/node_modules/y-protocols/sync.d.ts | 42 - .../node_modules/y-protocols/sync.d.ts.map | 1 - yjs-poll/node_modules/y-protocols/sync.js | 134 - yjs-poll/node_modules/y-websocket/LICENSE | 21 - yjs-poll/node_modules/y-websocket/README.md | 142 - .../y-websocket/dist/src/y-websocket.d.ts | 139 - .../y-websocket/dist/y-websocket.cjs | 550 - .../y-websocket/dist/y-websocket.cjs.map | 1 - .../node_modules/y-websocket/package.json | 71 - .../y-websocket/src/y-websocket.js | 514 - yjs-poll/node_modules/yjs/LICENSE | 23 - yjs-poll/node_modules/yjs/README.md | 1394 --- yjs-poll/node_modules/yjs/dist/src/index.d.ts | 2 - .../node_modules/yjs/dist/src/index.d.ts.map | 1 - .../node_modules/yjs/dist/src/internals.d.ts | 41 - .../yjs/dist/src/internals.d.ts.map | 1 - .../yjs/dist/src/structs/AbstractStruct.d.ts | 37 - .../dist/src/structs/AbstractStruct.d.ts.map | 1 - .../yjs/dist/src/structs/ContentAny.d.ts | 67 - .../yjs/dist/src/structs/ContentAny.d.ts.map | 1 - .../yjs/dist/src/structs/ContentBinary.d.ts | 64 - .../dist/src/structs/ContentBinary.d.ts.map | 1 - .../yjs/dist/src/structs/ContentDeleted.d.ts | 64 - .../dist/src/structs/ContentDeleted.d.ts.map | 1 - .../yjs/dist/src/structs/ContentDoc.d.ts | 72 - .../yjs/dist/src/structs/ContentDoc.d.ts.map | 1 - .../yjs/dist/src/structs/ContentEmbed.d.ts | 67 - .../dist/src/structs/ContentEmbed.d.ts.map | 1 - .../yjs/dist/src/structs/ContentFormat.d.ts | 69 - .../dist/src/structs/ContentFormat.d.ts.map | 1 - .../yjs/dist/src/structs/ContentJSON.d.ts | 70 - .../yjs/dist/src/structs/ContentJSON.d.ts.map | 1 - .../yjs/dist/src/structs/ContentString.d.ts | 70 - .../dist/src/structs/ContentString.d.ts.map | 1 - .../yjs/dist/src/structs/ContentType.d.ts | 83 - .../yjs/dist/src/structs/ContentType.d.ts.map | 1 - .../node_modules/yjs/dist/src/structs/GC.d.ts | 29 - .../yjs/dist/src/structs/GC.d.ts.map | 1 - .../yjs/dist/src/structs/Item.d.ts | 218 - .../yjs/dist/src/structs/Item.d.ts.map | 1 - .../yjs/dist/src/structs/Skip.d.ts | 29 - .../yjs/dist/src/structs/Skip.d.ts.map | 1 - .../yjs/dist/src/types/AbstractType.d.ts | 173 - .../yjs/dist/src/types/AbstractType.d.ts.map | 1 - .../yjs/dist/src/types/YArray.d.ts | 154 - .../yjs/dist/src/types/YArray.d.ts.map | 1 - .../node_modules/yjs/dist/src/types/YMap.d.ts | 142 - .../yjs/dist/src/types/YMap.d.ts.map | 1 - .../yjs/dist/src/types/YText.d.ts | 261 - .../yjs/dist/src/types/YText.d.ts.map | 1 - .../yjs/dist/src/types/YXmlElement.d.ts | 108 - .../yjs/dist/src/types/YXmlElement.d.ts.map | 1 - .../yjs/dist/src/types/YXmlEvent.d.ts | 33 - .../yjs/dist/src/types/YXmlEvent.d.ts.map | 1 - .../yjs/dist/src/types/YXmlFragment.d.ts | 253 - .../yjs/dist/src/types/YXmlFragment.d.ts.map | 1 - .../yjs/dist/src/types/YXmlHook.d.ts | 50 - .../yjs/dist/src/types/YXmlHook.d.ts.map | 1 - .../yjs/dist/src/types/YXmlText.d.ts | 52 - .../yjs/dist/src/types/YXmlText.d.ts.map | 1 - .../yjs/dist/src/utils/AbstractConnector.d.ts | 20 - .../dist/src/utils/AbstractConnector.d.ts.map | 1 - .../yjs/dist/src/utils/DeleteSet.d.ts | 50 - .../yjs/dist/src/utils/DeleteSet.d.ts.map | 1 - .../node_modules/yjs/dist/src/utils/Doc.d.ts | 250 - .../yjs/dist/src/utils/Doc.d.ts.map | 1 - .../yjs/dist/src/utils/EventHandler.d.ts | 19 - .../yjs/dist/src/utils/EventHandler.d.ts.map | 1 - .../node_modules/yjs/dist/src/utils/ID.d.ts | 26 - .../yjs/dist/src/utils/ID.d.ts.map | 1 - .../yjs/dist/src/utils/PermanentUserData.d.ts | 42 - .../dist/src/utils/PermanentUserData.d.ts.map | 1 - .../yjs/dist/src/utils/RelativePosition.d.ts | 91 - .../dist/src/utils/RelativePosition.d.ts.map | 1 - .../yjs/dist/src/utils/Snapshot.d.ts | 40 - .../yjs/dist/src/utils/Snapshot.d.ts.map | 1 - .../yjs/dist/src/utils/StructStore.d.ts | 34 - .../yjs/dist/src/utils/StructStore.d.ts.map | 1 - .../yjs/dist/src/utils/Transaction.d.ts | 115 - .../yjs/dist/src/utils/Transaction.d.ts.map | 1 - .../yjs/dist/src/utils/UndoManager.d.ts | 189 - .../yjs/dist/src/utils/UndoManager.d.ts.map | 1 - .../yjs/dist/src/utils/UpdateDecoder.d.ts | 167 - .../yjs/dist/src/utils/UpdateDecoder.d.ts.map | 1 - .../yjs/dist/src/utils/UpdateEncoder.d.ts | 164 - .../yjs/dist/src/utils/UpdateEncoder.d.ts.map | 1 - .../yjs/dist/src/utils/YEvent.d.ts | 133 - .../yjs/dist/src/utils/YEvent.d.ts.map | 1 - .../yjs/dist/src/utils/encoding.d.ts | 34 - .../yjs/dist/src/utils/encoding.d.ts.map | 1 - .../yjs/dist/src/utils/isParentOf.d.ts | 4 - .../yjs/dist/src/utils/isParentOf.d.ts.map | 1 - .../yjs/dist/src/utils/logging.d.ts | 3 - .../yjs/dist/src/utils/logging.d.ts.map | 1 - .../yjs/dist/src/utils/updates.d.ts | 89 - .../yjs/dist/src/utils/updates.d.ts.map | 1 - yjs-poll/node_modules/yjs/dist/testHelper.mjs | 457 - yjs-poll/node_modules/yjs/dist/yjs.cjs | 10434 ---------------- yjs-poll/node_modules/yjs/dist/yjs.cjs.map | 1 - yjs-poll/node_modules/yjs/dist/yjs.mjs | 10295 --------------- yjs-poll/node_modules/yjs/dist/yjs.mjs.map | 1 - yjs-poll/node_modules/yjs/package.json | 99 - yjs-poll/node_modules/yjs/src/index.js | 135 - yjs-poll/node_modules/yjs/src/internals.js | 42 - .../yjs/src/structs/AbstractStruct.js | 51 - .../yjs/src/structs/ContentAny.js | 114 - .../yjs/src/structs/ContentBinary.js | 92 - .../yjs/src/structs/ContentDeleted.js | 100 - .../yjs/src/structs/ContentDoc.js | 140 - .../yjs/src/structs/ContentEmbed.js | 97 - .../yjs/src/structs/ContentFormat.js | 104 - .../yjs/src/structs/ContentJSON.js | 118 - .../yjs/src/structs/ContentString.js | 112 - .../yjs/src/structs/ContentType.js | 171 - yjs-poll/node_modules/yjs/src/structs/GC.js | 60 - yjs-poll/node_modules/yjs/src/structs/Item.js | 812 -- yjs-poll/node_modules/yjs/src/structs/Skip.js | 59 - .../yjs/src/types/AbstractType.js | 985 -- yjs-poll/node_modules/yjs/src/types/YArray.js | 274 - yjs-poll/node_modules/yjs/src/types/YMap.js | 281 - yjs-poll/node_modules/yjs/src/types/YText.js | 1298 -- .../node_modules/yjs/src/types/YXmlElement.js | 260 - .../node_modules/yjs/src/types/YXmlEvent.js | 39 - .../yjs/src/types/YXmlFragment.js | 449 - .../node_modules/yjs/src/types/YXmlHook.js | 98 - .../node_modules/yjs/src/types/YXmlText.js | 124 - .../yjs/src/utils/AbstractConnector.js | 25 - .../node_modules/yjs/src/utils/DeleteSet.js | 352 - yjs-poll/node_modules/yjs/src/utils/Doc.js | 347 - .../yjs/src/utils/EventHandler.js | 87 - yjs-poll/node_modules/yjs/src/utils/ID.js | 89 - .../yjs/src/utils/PermanentUserData.js | 141 - .../yjs/src/utils/RelativePosition.js | 353 - .../node_modules/yjs/src/utils/Snapshot.js | 236 - .../node_modules/yjs/src/utils/StructStore.js | 261 - .../node_modules/yjs/src/utils/Transaction.js | 448 - .../node_modules/yjs/src/utils/UndoManager.js | 400 - .../yjs/src/utils/UpdateDecoder.js | 281 - .../yjs/src/utils/UpdateEncoder.js | 320 - yjs-poll/node_modules/yjs/src/utils/YEvent.js | 277 - .../node_modules/yjs/src/utils/encoding.js | 644 - .../node_modules/yjs/src/utils/isParentOf.js | 21 - .../node_modules/yjs/src/utils/logging.js | 21 - .../node_modules/yjs/src/utils/updates.js | 722 -- yjs-poll/node_modules/yjs/tests/testHelper.js | 454 - yjs-poll/run_yjs_server.sh | 3 - 1060 files changed, 610 insertions(+), 101426 deletions(-) create mode 100644 .gitignore rename yjs-poll/backend.js => backend.js (88%) rename yjs-poll/frontend.html => frontend.html (94%) rename yjs-poll/package-lock.json => package-lock.json (64%) rename yjs-poll/package.json => package.json (80%) create mode 100644 utils.js delete mode 100644 yjs-poll/node_modules/.bin/0ecdsa-generate-keypair delete mode 100644 yjs-poll/node_modules/.bin/0ecdsa-generate-keypair.cmd delete mode 100644 yjs-poll/node_modules/.bin/0ecdsa-generate-keypair.ps1 delete mode 100644 yjs-poll/node_modules/.bin/0gentesthtml delete mode 100644 yjs-poll/node_modules/.bin/0gentesthtml.cmd delete mode 100644 yjs-poll/node_modules/.bin/0gentesthtml.ps1 delete mode 100644 yjs-poll/node_modules/.bin/0serve delete mode 100644 yjs-poll/node_modules/.bin/0serve.cmd delete mode 100644 yjs-poll/node_modules/.bin/0serve.ps1 delete mode 100644 yjs-poll/node_modules/.package-lock.json delete mode 100644 yjs-poll/node_modules/isomorphic.js/LICENSE delete mode 100644 yjs-poll/node_modules/isomorphic.js/README.md delete mode 100644 yjs-poll/node_modules/isomorphic.js/browser.js delete mode 100644 yjs-poll/node_modules/isomorphic.js/browser.mjs delete mode 100644 yjs-poll/node_modules/isomorphic.js/iso.js delete mode 100644 yjs-poll/node_modules/isomorphic.js/node.mjs delete mode 100644 yjs-poll/node_modules/isomorphic.js/package.json delete mode 100644 yjs-poll/node_modules/lib0/.github/workflows/node.js.yml delete mode 100644 yjs-poll/node_modules/lib0/.jsdoc.json delete mode 100644 yjs-poll/node_modules/lib0/.vscode/launch.json delete mode 100644 yjs-poll/node_modules/lib0/LICENSE delete mode 100644 yjs-poll/node_modules/lib0/README.md delete mode 100644 yjs-poll/node_modules/lib0/array.d.ts delete mode 100644 yjs-poll/node_modules/lib0/array.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/array.js delete mode 100644 yjs-poll/node_modules/lib0/array.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/array.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/bin/0ecdsa-generate-keypair.d.ts delete mode 100644 yjs-poll/node_modules/lib0/bin/0ecdsa-generate-keypair.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/bin/0ecdsa-generate-keypair.js delete mode 100644 yjs-poll/node_modules/lib0/bin/0serve.d.ts delete mode 100644 yjs-poll/node_modules/lib0/bin/0serve.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/bin/0serve.js delete mode 100644 yjs-poll/node_modules/lib0/bin/gendocs.d.ts delete mode 100644 yjs-poll/node_modules/lib0/bin/gendocs.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/bin/gendocs.js delete mode 100644 yjs-poll/node_modules/lib0/bin/gentesthtml.d.ts delete mode 100644 yjs-poll/node_modules/lib0/bin/gentesthtml.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/bin/gentesthtml.js delete mode 100644 yjs-poll/node_modules/lib0/binary.d.ts delete mode 100644 yjs-poll/node_modules/lib0/binary.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/binary.js delete mode 100644 yjs-poll/node_modules/lib0/binary.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/binary.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/broadcastchannel.d.ts delete mode 100644 yjs-poll/node_modules/lib0/broadcastchannel.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/broadcastchannel.js delete mode 100644 yjs-poll/node_modules/lib0/broadcastchannel.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/broadcastchannel.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/buffer.d.ts delete mode 100644 yjs-poll/node_modules/lib0/buffer.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/buffer.js delete mode 100644 yjs-poll/node_modules/lib0/buffer.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/buffer.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/cache.d.ts delete mode 100644 yjs-poll/node_modules/lib0/cache.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/cache.js delete mode 100644 yjs-poll/node_modules/lib0/cache.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/cache.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/component.d.ts delete mode 100644 yjs-poll/node_modules/lib0/component.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/component.js delete mode 100644 yjs-poll/node_modules/lib0/conditions.d.ts delete mode 100644 yjs-poll/node_modules/lib0/conditions.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/conditions.js delete mode 100644 yjs-poll/node_modules/lib0/coverage/tmp/coverage-70359-1766561372098-0.json delete mode 100644 yjs-poll/node_modules/lib0/crypto.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/crypto.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/crypto/aes-gcm.d.ts delete mode 100644 yjs-poll/node_modules/lib0/crypto/aes-gcm.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/crypto/aes-gcm.js delete mode 100644 yjs-poll/node_modules/lib0/crypto/common.d.ts delete mode 100644 yjs-poll/node_modules/lib0/crypto/common.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/crypto/common.js delete mode 100644 yjs-poll/node_modules/lib0/crypto/ecdsa.d.ts delete mode 100644 yjs-poll/node_modules/lib0/crypto/ecdsa.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/crypto/ecdsa.js delete mode 100644 yjs-poll/node_modules/lib0/crypto/jwt.d.ts delete mode 100644 yjs-poll/node_modules/lib0/crypto/jwt.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/crypto/jwt.js delete mode 100644 yjs-poll/node_modules/lib0/crypto/rsa-oaep.d.ts delete mode 100644 yjs-poll/node_modules/lib0/crypto/rsa-oaep.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/crypto/rsa-oaep.js delete mode 100644 yjs-poll/node_modules/lib0/decoding.d.ts delete mode 100644 yjs-poll/node_modules/lib0/decoding.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/decoding.js delete mode 100644 yjs-poll/node_modules/lib0/delta/binding.d.ts delete mode 100644 yjs-poll/node_modules/lib0/delta/binding.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/delta/binding.js delete mode 100644 yjs-poll/node_modules/lib0/delta/binding.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/delta/binding.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/delta/delta-pitch.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/delta/delta-pitch.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/delta/delta.d.ts delete mode 100644 yjs-poll/node_modules/lib0/delta/delta.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/delta/delta.js delete mode 100644 yjs-poll/node_modules/lib0/delta/delta.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/delta/delta.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/delta/readme.md delete mode 100644 yjs-poll/node_modules/lib0/delta/t3.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/delta/t3.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/deno.json delete mode 100644 yjs-poll/node_modules/lib0/deno.lock delete mode 100644 yjs-poll/node_modules/lib0/diff.d.ts delete mode 100644 yjs-poll/node_modules/lib0/diff.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/diff.js delete mode 100644 yjs-poll/node_modules/lib0/diff.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/diff.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/diff/patience.d.ts delete mode 100644 yjs-poll/node_modules/lib0/diff/patience.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/diff/patience.js delete mode 100644 yjs-poll/node_modules/lib0/diff/patience.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/diff/patience.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/aes-gcm.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/aes-gcm.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/array-78849c95.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/array-78849c95.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/array.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/array.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/array.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/array.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/array.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/array.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/bin/0ecdsa-generate-keypair.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/bin/0ecdsa-generate-keypair.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/bin/0serve.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/bin/0serve.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/bin/gendocs.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/bin/gendocs.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/bin/gentesthtml.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/bin/gentesthtml.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/binary-ac8e39e2.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/binary-ac8e39e2.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/binary.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/binary.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/binary.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/binary.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/binary.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/binary.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/binding.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/binding.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/broadcastchannel-aca4f606.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/broadcastchannel-aca4f606.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/broadcastchannel.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/broadcastchannel.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/broadcastchannel.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/broadcastchannel.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/broadcastchannel.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/broadcastchannel.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/buffer-3e750729.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/buffer-3e750729.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/buffer.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/buffer.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/buffer.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/buffer.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/buffer.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/buffer.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/cache.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/cache.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/cache.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/cache.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/cache.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/cache.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/common.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/common.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/component.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/component.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/component.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/component.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/conditions-f5c0c102.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/conditions-f5c0c102.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/conditions.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/conditions.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/conditions.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/conditions.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/crypto.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/crypto.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/crypto/aes-gcm.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/crypto/aes-gcm.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/crypto/common.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/crypto/common.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/crypto/ecdsa.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/crypto/ecdsa.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/crypto/jwt.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/crypto/jwt.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/crypto/rsa-oaep.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/crypto/rsa-oaep.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/decoding-76e75827.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/decoding-76e75827.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/decoding.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/decoding.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/decoding.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/decoding.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/delta.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/delta.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/delta/binding.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/delta/binding.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/delta/binding.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/delta/binding.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/delta/delta-pitch.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/delta/delta-pitch.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/delta/delta.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/delta/delta.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/delta/delta.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/delta/delta.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/delta/t3.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/delta/t3.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/diff-9d236524.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/diff-9d236524.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/diff.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/diff.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/diff.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/diff.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/diff.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/diff.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/diff/patience.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/diff/patience.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/diff/patience.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/diff/patience.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/dom-7e625b09.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/dom-7e625b09.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/dom.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/dom.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/dom.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/dom.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/ecdsa.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/ecdsa.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/encoding-1a745c43.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/encoding-1a745c43.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/encoding.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/encoding.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/encoding.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/encoding.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/encoding.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/encoding.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/environment-1c97264d.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/environment-1c97264d.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/environment.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/environment.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/environment.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/environment.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/equality.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/equality.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/error-0c1f634f.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/error-0c1f634f.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/error.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/error.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/error.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/error.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/eventloop-a0168106.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/eventloop-a0168106.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/eventloop.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/eventloop.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/eventloop.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/eventloop.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/eventloop.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/eventloop.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/fingerprint.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/fingerprint.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/function-314580f7.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/function-314580f7.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/function.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/function.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/function.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/function.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/function.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/function.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/hash/rabin-gf2-polynomial.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/hash/rabin-gf2-polynomial.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/hash/rabin-uncached.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/hash/rabin-uncached.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/hash/rabin.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/hash/rabin.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/hash/rabin.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/hash/rabin.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/hash/sha256.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/hash/sha256.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/hash/sha256.node.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/hash/sha256.node.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/hash/sha256.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/hash/sha256.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/index.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/index.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/index.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/index.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/indexeddb-46d1e737.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/indexeddb-46d1e737.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/indexeddb.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/indexeddb.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/indexeddb.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/indexeddb.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/indexeddb.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/indexeddb.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/indexeddbV2.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/indexeddbV2.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/indexeddbV2.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/indexeddbV2.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/indexeddbV2.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/indexeddbV2.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/isomorphic.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/isomorphic.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/iterator-9fc627c1.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/iterator-9fc627c1.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/iterator.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/iterator.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/iterator.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/iterator.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/json-092190a1.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/json-092190a1.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/json.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/json.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/json.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/json.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/jwt.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/jwt.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/list.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/list.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/list.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/list.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/list.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/list.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/logging.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/logging.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/logging.common.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/logging.common.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/logging.common.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/logging.common.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/logging.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/logging.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/logging.node.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/logging.node.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/logging.node.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/logging.node.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/logging.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/logging.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/map-24d263c0.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/map-24d263c0.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/map.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/map.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/map.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/map.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/map.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/map.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/math-96d5e8c4.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/math-96d5e8c4.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/math.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/math.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/math.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/math.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/math.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/math.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/metric.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/metric.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/metric.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/metric.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/metric.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/metric.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/mutex-63f09c81.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/mutex-63f09c81.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/mutex.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/mutex.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/mutex.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/mutex.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/mutex.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/mutex.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/number-1fb57bba.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/number-1fb57bba.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/number.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/number.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/number.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/number.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/number.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/number.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/object-c0c9435b.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/object-c0c9435b.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/object.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/object.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/object.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/object.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/object.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/object.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/observable.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/observable.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/observable.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/observable.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/observable.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/observable.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/pair-ab022bc3.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/pair-ab022bc3.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/pair.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/pair.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/pair.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/pair.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/pair.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/pair.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/patience.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/patience.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/performance.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/performance.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/performance.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/performance.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/performance.node.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/performance.node.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/performance.node.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/performance.node.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/pledge.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/pledge.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/pledge.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/pledge.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/pledge.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/pledge.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/prng-37d48618.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/prng-37d48618.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/prng.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/prng.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/prng.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/prng.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/prng.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/prng.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/prng/Mt19937.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/prng/Mt19937.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/prng/Xoroshiro128plus.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/prng/Xoroshiro128plus.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/prng/Xorshift32.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/prng/Xorshift32.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/promise-cda7b9bb.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/promise-cda7b9bb.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/promise.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/promise.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/promise.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/promise.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/promise.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/promise.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/queue.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/queue.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/queue.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/queue.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/queue.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/queue.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/rabin-gf2-polynomial.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/rabin-gf2-polynomial.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/rabin-uncached.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/rabin-uncached.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/rabin.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/rabin.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/random.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/random.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/random.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/random.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/random.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/random.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/rollup.config.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/rollup.config.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/rsa-oaep.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/rsa-oaep.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/schema.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/schema.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/schema.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/schema.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/schema.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/schema.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/set-5b47859e.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/set-5b47859e.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/set.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/set.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/set.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/set.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/set.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/set.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/sha256.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/sha256.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/sha256.node.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/sha256.node.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/sort-812cc211.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/sort-812cc211.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/sort.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/sort.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/sort.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/sort.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/sort.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/sort.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/statistics-65f6114b.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/statistics-65f6114b.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/statistics.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/statistics.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/statistics.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/statistics.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/statistics.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/statistics.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/storage.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/storage.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/storage.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/storage.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/storage.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/storage.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/string-fddc5f8b.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/string-fddc5f8b.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/string.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/string.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/string.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/string.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/string.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/string.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/symbol-9c439012.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/symbol-9c439012.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/symbol.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/symbol.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/symbol.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/symbol.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/symbol.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/symbol.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/testing.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/testing.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/testing.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/testing.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/testing.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/testing.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/time-d8438852.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/time-d8438852.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/time.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/time.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/time.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/time.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/time.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/time.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/trait/equality.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/trait/equality.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/trait/fingerprint.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/trait/fingerprint.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/trait/traits.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/trait/traits.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/trait/traits.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/trait/traits.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/traits.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/traits.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/tree-9f3c8837.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/tree-9f3c8837.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/tree.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/tree.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/tree.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/tree.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/tree.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/tree.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/url.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/url.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/url.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/url.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/url.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/url.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/webcrypto.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/webcrypto.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/webcrypto.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/webcrypto.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/webcrypto.deno.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/webcrypto.deno.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/webcrypto.deno.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/webcrypto.deno.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/webcrypto.node.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/webcrypto.node.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/webcrypto.node.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/webcrypto.node.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/webcrypto.react-native.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/webcrypto.react-native.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/webcrypto.react-native.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/webcrypto.react-native.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dist/websocket-b073d0fc.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/websocket-b073d0fc.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/websocket.cjs delete mode 100644 yjs-poll/node_modules/lib0/dist/websocket.cjs.map delete mode 100644 yjs-poll/node_modules/lib0/dist/websocket.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dist/websocket.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dom.d.ts delete mode 100644 yjs-poll/node_modules/lib0/dom.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/dom.js delete mode 100644 yjs-poll/node_modules/lib0/encoding.d.ts delete mode 100644 yjs-poll/node_modules/lib0/encoding.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/encoding.js delete mode 100644 yjs-poll/node_modules/lib0/encoding.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/encoding.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/environment.d.ts delete mode 100644 yjs-poll/node_modules/lib0/environment.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/environment.js delete mode 100644 yjs-poll/node_modules/lib0/error.d.ts delete mode 100644 yjs-poll/node_modules/lib0/error.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/error.js delete mode 100644 yjs-poll/node_modules/lib0/eventloop.d.ts delete mode 100644 yjs-poll/node_modules/lib0/eventloop.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/eventloop.js delete mode 100644 yjs-poll/node_modules/lib0/eventloop.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/eventloop.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/function.d.ts delete mode 100644 yjs-poll/node_modules/lib0/function.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/function.js delete mode 100644 yjs-poll/node_modules/lib0/function.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/function.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/hash/rabin-gf2-polynomial.d.ts delete mode 100644 yjs-poll/node_modules/lib0/hash/rabin-gf2-polynomial.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/hash/rabin-gf2-polynomial.js delete mode 100644 yjs-poll/node_modules/lib0/hash/rabin-uncached.d.ts delete mode 100644 yjs-poll/node_modules/lib0/hash/rabin-uncached.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/hash/rabin-uncached.js delete mode 100644 yjs-poll/node_modules/lib0/hash/rabin.d.ts delete mode 100644 yjs-poll/node_modules/lib0/hash/rabin.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/hash/rabin.js delete mode 100644 yjs-poll/node_modules/lib0/hash/rabin.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/hash/rabin.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/hash/sha256.d.ts delete mode 100644 yjs-poll/node_modules/lib0/hash/sha256.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/hash/sha256.js delete mode 100644 yjs-poll/node_modules/lib0/hash/sha256.node.d.ts delete mode 100644 yjs-poll/node_modules/lib0/hash/sha256.node.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/hash/sha256.node.js delete mode 100644 yjs-poll/node_modules/lib0/hash/sha256.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/hash/sha256.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/index.d.ts delete mode 100644 yjs-poll/node_modules/lib0/index.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/index.js delete mode 100644 yjs-poll/node_modules/lib0/indexeddb.d.ts delete mode 100644 yjs-poll/node_modules/lib0/indexeddb.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/indexeddb.js delete mode 100644 yjs-poll/node_modules/lib0/indexeddb.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/indexeddb.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/indexeddbV2.d.ts delete mode 100644 yjs-poll/node_modules/lib0/indexeddbV2.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/indexeddbV2.js delete mode 100644 yjs-poll/node_modules/lib0/indexeddbV2.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/indexeddbV2.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/isomorphic.js delete mode 100644 yjs-poll/node_modules/lib0/iterator.d.ts delete mode 100644 yjs-poll/node_modules/lib0/iterator.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/iterator.js delete mode 100644 yjs-poll/node_modules/lib0/json.d.ts delete mode 100644 yjs-poll/node_modules/lib0/json.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/json.js delete mode 100644 yjs-poll/node_modules/lib0/list.d.ts delete mode 100644 yjs-poll/node_modules/lib0/list.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/list.js delete mode 100644 yjs-poll/node_modules/lib0/list.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/list.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/logging.common.d.ts delete mode 100644 yjs-poll/node_modules/lib0/logging.common.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/logging.common.js delete mode 100644 yjs-poll/node_modules/lib0/logging.d.ts delete mode 100644 yjs-poll/node_modules/lib0/logging.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/logging.js delete mode 100644 yjs-poll/node_modules/lib0/logging.node.d.ts delete mode 100644 yjs-poll/node_modules/lib0/logging.node.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/logging.node.js delete mode 100644 yjs-poll/node_modules/lib0/logging.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/logging.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/map.d.ts delete mode 100644 yjs-poll/node_modules/lib0/map.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/map.js delete mode 100644 yjs-poll/node_modules/lib0/map.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/map.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/math.d.ts delete mode 100644 yjs-poll/node_modules/lib0/math.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/math.js delete mode 100644 yjs-poll/node_modules/lib0/math.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/math.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/metric.d.ts delete mode 100644 yjs-poll/node_modules/lib0/metric.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/metric.js delete mode 100644 yjs-poll/node_modules/lib0/metric.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/metric.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/mutex.d.ts delete mode 100644 yjs-poll/node_modules/lib0/mutex.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/mutex.js delete mode 100644 yjs-poll/node_modules/lib0/mutex.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/mutex.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/number.d.ts delete mode 100644 yjs-poll/node_modules/lib0/number.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/number.js delete mode 100644 yjs-poll/node_modules/lib0/number.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/number.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/object.d.ts delete mode 100644 yjs-poll/node_modules/lib0/object.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/object.js delete mode 100644 yjs-poll/node_modules/lib0/object.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/object.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/observable.d.ts delete mode 100644 yjs-poll/node_modules/lib0/observable.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/observable.js delete mode 100644 yjs-poll/node_modules/lib0/observable.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/observable.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/package.json delete mode 100644 yjs-poll/node_modules/lib0/pair.d.ts delete mode 100644 yjs-poll/node_modules/lib0/pair.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/pair.js delete mode 100644 yjs-poll/node_modules/lib0/pair.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/pair.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/performance.d.ts delete mode 100644 yjs-poll/node_modules/lib0/performance.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/performance.js delete mode 100644 yjs-poll/node_modules/lib0/performance.node.d.ts delete mode 100644 yjs-poll/node_modules/lib0/performance.node.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/performance.node.js delete mode 100644 yjs-poll/node_modules/lib0/pledge.d.ts delete mode 100644 yjs-poll/node_modules/lib0/pledge.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/pledge.js delete mode 100644 yjs-poll/node_modules/lib0/pledge.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/pledge.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/prng.d.ts delete mode 100644 yjs-poll/node_modules/lib0/prng.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/prng.js delete mode 100644 yjs-poll/node_modules/lib0/prng.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/prng.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/prng/Mt19937.d.ts delete mode 100644 yjs-poll/node_modules/lib0/prng/Mt19937.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/prng/Mt19937.js delete mode 100644 yjs-poll/node_modules/lib0/prng/Xoroshiro128plus.d.ts delete mode 100644 yjs-poll/node_modules/lib0/prng/Xoroshiro128plus.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/prng/Xoroshiro128plus.js delete mode 100644 yjs-poll/node_modules/lib0/prng/Xorshift32.d.ts delete mode 100644 yjs-poll/node_modules/lib0/prng/Xorshift32.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/prng/Xorshift32.js delete mode 100644 yjs-poll/node_modules/lib0/promise.d.ts delete mode 100644 yjs-poll/node_modules/lib0/promise.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/promise.js delete mode 100644 yjs-poll/node_modules/lib0/promise.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/promise.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/queue.d.ts delete mode 100644 yjs-poll/node_modules/lib0/queue.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/queue.js delete mode 100644 yjs-poll/node_modules/lib0/queue.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/queue.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/random.d.ts delete mode 100644 yjs-poll/node_modules/lib0/random.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/random.js delete mode 100644 yjs-poll/node_modules/lib0/random.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/random.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/rollup.config.d.ts delete mode 100644 yjs-poll/node_modules/lib0/rollup.config.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/schema.d.ts delete mode 100644 yjs-poll/node_modules/lib0/schema.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/schema.js delete mode 100644 yjs-poll/node_modules/lib0/schema.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/schema.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/set.d.ts delete mode 100644 yjs-poll/node_modules/lib0/set.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/set.js delete mode 100644 yjs-poll/node_modules/lib0/set.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/set.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/sort.d.ts delete mode 100644 yjs-poll/node_modules/lib0/sort.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/sort.js delete mode 100644 yjs-poll/node_modules/lib0/sort.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/sort.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/statistics.d.ts delete mode 100644 yjs-poll/node_modules/lib0/statistics.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/statistics.js delete mode 100644 yjs-poll/node_modules/lib0/statistics.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/statistics.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/storage.d.ts delete mode 100644 yjs-poll/node_modules/lib0/storage.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/storage.js delete mode 100644 yjs-poll/node_modules/lib0/storage.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/storage.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/string.d.ts delete mode 100644 yjs-poll/node_modules/lib0/string.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/string.js delete mode 100644 yjs-poll/node_modules/lib0/string.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/string.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/symbol.d.ts delete mode 100644 yjs-poll/node_modules/lib0/symbol.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/symbol.js delete mode 100644 yjs-poll/node_modules/lib0/symbol.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/symbol.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/test.html delete mode 100644 yjs-poll/node_modules/lib0/test.js delete mode 100644 yjs-poll/node_modules/lib0/testing.d.ts delete mode 100644 yjs-poll/node_modules/lib0/testing.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/testing.js delete mode 100644 yjs-poll/node_modules/lib0/testing.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/testing.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/time.d.ts delete mode 100644 yjs-poll/node_modules/lib0/time.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/time.js delete mode 100644 yjs-poll/node_modules/lib0/time.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/time.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/trait/equality.d.ts delete mode 100644 yjs-poll/node_modules/lib0/trait/equality.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/trait/equality.js delete mode 100644 yjs-poll/node_modules/lib0/trait/fingerprint.d.ts delete mode 100644 yjs-poll/node_modules/lib0/trait/fingerprint.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/trait/fingerprint.js delete mode 100644 yjs-poll/node_modules/lib0/trait/traits.d.ts delete mode 100644 yjs-poll/node_modules/lib0/trait/traits.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/trait/traits.js delete mode 100644 yjs-poll/node_modules/lib0/trait/traits.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/trait/traits.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/tree.d.ts delete mode 100644 yjs-poll/node_modules/lib0/tree.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/tree.js delete mode 100644 yjs-poll/node_modules/lib0/tree.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/tree.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/bin/0ecdsa-generate-keypair.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/bin/0ecdsa-generate-keypair.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/bin/0serve.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/bin/0serve.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/bin/gendocs.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/bin/gendocs.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/bin/gentesthtml.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/bin/gentesthtml.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/crypto/aes-gcm.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/crypto/aes-gcm.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/crypto/common.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/crypto/common.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/crypto/ecdsa.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/crypto/ecdsa.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/crypto/jwt.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/crypto/jwt.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/crypto/rsa-oaep.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/crypto/rsa-oaep.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/delta/binding.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/delta/binding.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/delta/delta.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/delta/delta.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/delta/t3.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/delta/t3.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/diff/patience.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/diff/patience.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/hash/rabin-gf2-polynomial.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/hash/rabin-gf2-polynomial.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/hash/rabin-uncached.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/hash/rabin-uncached.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/hash/rabin.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/hash/rabin.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/hash/sha256.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/hash/sha256.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/hash/sha256.node.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/hash/sha256.node.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/prng/Mt19937.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/prng/Mt19937.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/prng/Xoroshiro128plus.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/prng/Xoroshiro128plus.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/prng/Xorshift32.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/prng/Xorshift32.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/trait/equality.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/trait/equality.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/trait/fingerprint.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/trait/fingerprint.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/types/trait/traits.d.ts delete mode 100644 yjs-poll/node_modules/lib0/types/trait/traits.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/url.d.ts delete mode 100644 yjs-poll/node_modules/lib0/url.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/url.js delete mode 100644 yjs-poll/node_modules/lib0/url.test.d.ts delete mode 100644 yjs-poll/node_modules/lib0/url.test.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/webcrypto.d.ts delete mode 100644 yjs-poll/node_modules/lib0/webcrypto.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/webcrypto.deno.d.ts delete mode 100644 yjs-poll/node_modules/lib0/webcrypto.deno.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/webcrypto.deno.js delete mode 100644 yjs-poll/node_modules/lib0/webcrypto.js delete mode 100644 yjs-poll/node_modules/lib0/webcrypto.node.d.ts delete mode 100644 yjs-poll/node_modules/lib0/webcrypto.node.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/webcrypto.node.js delete mode 100644 yjs-poll/node_modules/lib0/webcrypto.react-native.d.ts delete mode 100644 yjs-poll/node_modules/lib0/webcrypto.react-native.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/webcrypto.react-native.js delete mode 100644 yjs-poll/node_modules/lib0/websocket.d.ts delete mode 100644 yjs-poll/node_modules/lib0/websocket.d.ts.map delete mode 100644 yjs-poll/node_modules/lib0/websocket.js delete mode 100644 yjs-poll/node_modules/ws/LICENSE delete mode 100644 yjs-poll/node_modules/ws/README.md delete mode 100644 yjs-poll/node_modules/ws/browser.js delete mode 100644 yjs-poll/node_modules/ws/index.js delete mode 100644 yjs-poll/node_modules/ws/lib/buffer-util.js delete mode 100644 yjs-poll/node_modules/ws/lib/constants.js delete mode 100644 yjs-poll/node_modules/ws/lib/event-target.js delete mode 100644 yjs-poll/node_modules/ws/lib/extension.js delete mode 100644 yjs-poll/node_modules/ws/lib/limiter.js delete mode 100644 yjs-poll/node_modules/ws/lib/permessage-deflate.js delete mode 100644 yjs-poll/node_modules/ws/lib/receiver.js delete mode 100644 yjs-poll/node_modules/ws/lib/sender.js delete mode 100644 yjs-poll/node_modules/ws/lib/stream.js delete mode 100644 yjs-poll/node_modules/ws/lib/subprotocol.js delete mode 100644 yjs-poll/node_modules/ws/lib/validation.js delete mode 100644 yjs-poll/node_modules/ws/lib/websocket-server.js delete mode 100644 yjs-poll/node_modules/ws/lib/websocket.js delete mode 100644 yjs-poll/node_modules/ws/package.json delete mode 100644 yjs-poll/node_modules/ws/wrapper.mjs delete mode 100644 yjs-poll/node_modules/y-protocols/LICENSE delete mode 100644 yjs-poll/node_modules/y-protocols/README.md delete mode 100644 yjs-poll/node_modules/y-protocols/auth.d.ts delete mode 100644 yjs-poll/node_modules/y-protocols/auth.d.ts.map delete mode 100644 yjs-poll/node_modules/y-protocols/auth.js delete mode 100644 yjs-poll/node_modules/y-protocols/awareness.d.ts delete mode 100644 yjs-poll/node_modules/y-protocols/awareness.d.ts.map delete mode 100644 yjs-poll/node_modules/y-protocols/awareness.js delete mode 100644 yjs-poll/node_modules/y-protocols/awareness.test.d.ts delete mode 100644 yjs-poll/node_modules/y-protocols/awareness.test.d.ts.map delete mode 100644 yjs-poll/node_modules/y-protocols/awareness.test.js delete mode 100644 yjs-poll/node_modules/y-protocols/dist/auth.cjs delete mode 100644 yjs-poll/node_modules/y-protocols/dist/auth.cjs.map delete mode 100644 yjs-poll/node_modules/y-protocols/dist/awareness.cjs delete mode 100644 yjs-poll/node_modules/y-protocols/dist/awareness.cjs.map delete mode 100644 yjs-poll/node_modules/y-protocols/dist/sync.cjs delete mode 100644 yjs-poll/node_modules/y-protocols/dist/sync.cjs.map delete mode 100644 yjs-poll/node_modules/y-protocols/dist/test.cjs delete mode 100644 yjs-poll/node_modules/y-protocols/dist/test.cjs.map delete mode 100644 yjs-poll/node_modules/y-protocols/dist/test.js delete mode 100644 yjs-poll/node_modules/y-protocols/dist/test.js.map delete mode 100644 yjs-poll/node_modules/y-protocols/package.json delete mode 100644 yjs-poll/node_modules/y-protocols/sync.d.ts delete mode 100644 yjs-poll/node_modules/y-protocols/sync.d.ts.map delete mode 100644 yjs-poll/node_modules/y-protocols/sync.js delete mode 100644 yjs-poll/node_modules/y-websocket/LICENSE delete mode 100644 yjs-poll/node_modules/y-websocket/README.md delete mode 100644 yjs-poll/node_modules/y-websocket/dist/src/y-websocket.d.ts delete mode 100644 yjs-poll/node_modules/y-websocket/dist/y-websocket.cjs delete mode 100644 yjs-poll/node_modules/y-websocket/dist/y-websocket.cjs.map delete mode 100644 yjs-poll/node_modules/y-websocket/package.json delete mode 100644 yjs-poll/node_modules/y-websocket/src/y-websocket.js delete mode 100644 yjs-poll/node_modules/yjs/LICENSE delete mode 100644 yjs-poll/node_modules/yjs/README.md delete mode 100644 yjs-poll/node_modules/yjs/dist/src/index.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/index.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/internals.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/internals.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/AbstractStruct.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/AbstractStruct.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/ContentAny.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/ContentAny.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/ContentBinary.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/ContentBinary.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/ContentDeleted.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/ContentDeleted.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/ContentDoc.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/ContentDoc.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/ContentEmbed.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/ContentEmbed.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/ContentFormat.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/ContentFormat.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/ContentJSON.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/ContentJSON.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/ContentString.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/ContentString.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/ContentType.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/ContentType.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/GC.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/GC.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/Item.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/Item.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/Skip.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/structs/Skip.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/types/AbstractType.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/types/AbstractType.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/types/YArray.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/types/YArray.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/types/YMap.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/types/YMap.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/types/YText.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/types/YText.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/types/YXmlElement.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/types/YXmlElement.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/types/YXmlEvent.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/types/YXmlEvent.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/types/YXmlFragment.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/types/YXmlFragment.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/types/YXmlHook.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/types/YXmlHook.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/types/YXmlText.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/types/YXmlText.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/AbstractConnector.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/AbstractConnector.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/DeleteSet.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/DeleteSet.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/Doc.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/Doc.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/EventHandler.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/EventHandler.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/ID.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/ID.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/PermanentUserData.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/PermanentUserData.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/RelativePosition.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/RelativePosition.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/Snapshot.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/Snapshot.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/StructStore.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/StructStore.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/Transaction.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/Transaction.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/UndoManager.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/UndoManager.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/UpdateDecoder.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/UpdateDecoder.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/UpdateEncoder.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/UpdateEncoder.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/YEvent.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/YEvent.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/encoding.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/encoding.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/isParentOf.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/isParentOf.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/logging.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/logging.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/updates.d.ts delete mode 100644 yjs-poll/node_modules/yjs/dist/src/utils/updates.d.ts.map delete mode 100644 yjs-poll/node_modules/yjs/dist/testHelper.mjs delete mode 100644 yjs-poll/node_modules/yjs/dist/yjs.cjs delete mode 100644 yjs-poll/node_modules/yjs/dist/yjs.cjs.map delete mode 100644 yjs-poll/node_modules/yjs/dist/yjs.mjs delete mode 100644 yjs-poll/node_modules/yjs/dist/yjs.mjs.map delete mode 100644 yjs-poll/node_modules/yjs/package.json delete mode 100644 yjs-poll/node_modules/yjs/src/index.js delete mode 100644 yjs-poll/node_modules/yjs/src/internals.js delete mode 100644 yjs-poll/node_modules/yjs/src/structs/AbstractStruct.js delete mode 100644 yjs-poll/node_modules/yjs/src/structs/ContentAny.js delete mode 100644 yjs-poll/node_modules/yjs/src/structs/ContentBinary.js delete mode 100644 yjs-poll/node_modules/yjs/src/structs/ContentDeleted.js delete mode 100644 yjs-poll/node_modules/yjs/src/structs/ContentDoc.js delete mode 100644 yjs-poll/node_modules/yjs/src/structs/ContentEmbed.js delete mode 100644 yjs-poll/node_modules/yjs/src/structs/ContentFormat.js delete mode 100644 yjs-poll/node_modules/yjs/src/structs/ContentJSON.js delete mode 100644 yjs-poll/node_modules/yjs/src/structs/ContentString.js delete mode 100644 yjs-poll/node_modules/yjs/src/structs/ContentType.js delete mode 100644 yjs-poll/node_modules/yjs/src/structs/GC.js delete mode 100644 yjs-poll/node_modules/yjs/src/structs/Item.js delete mode 100644 yjs-poll/node_modules/yjs/src/structs/Skip.js delete mode 100644 yjs-poll/node_modules/yjs/src/types/AbstractType.js delete mode 100644 yjs-poll/node_modules/yjs/src/types/YArray.js delete mode 100644 yjs-poll/node_modules/yjs/src/types/YMap.js delete mode 100644 yjs-poll/node_modules/yjs/src/types/YText.js delete mode 100644 yjs-poll/node_modules/yjs/src/types/YXmlElement.js delete mode 100644 yjs-poll/node_modules/yjs/src/types/YXmlEvent.js delete mode 100644 yjs-poll/node_modules/yjs/src/types/YXmlFragment.js delete mode 100644 yjs-poll/node_modules/yjs/src/types/YXmlHook.js delete mode 100644 yjs-poll/node_modules/yjs/src/types/YXmlText.js delete mode 100644 yjs-poll/node_modules/yjs/src/utils/AbstractConnector.js delete mode 100644 yjs-poll/node_modules/yjs/src/utils/DeleteSet.js delete mode 100644 yjs-poll/node_modules/yjs/src/utils/Doc.js delete mode 100644 yjs-poll/node_modules/yjs/src/utils/EventHandler.js delete mode 100644 yjs-poll/node_modules/yjs/src/utils/ID.js delete mode 100644 yjs-poll/node_modules/yjs/src/utils/PermanentUserData.js delete mode 100644 yjs-poll/node_modules/yjs/src/utils/RelativePosition.js delete mode 100644 yjs-poll/node_modules/yjs/src/utils/Snapshot.js delete mode 100644 yjs-poll/node_modules/yjs/src/utils/StructStore.js delete mode 100644 yjs-poll/node_modules/yjs/src/utils/Transaction.js delete mode 100644 yjs-poll/node_modules/yjs/src/utils/UndoManager.js delete mode 100644 yjs-poll/node_modules/yjs/src/utils/UpdateDecoder.js delete mode 100644 yjs-poll/node_modules/yjs/src/utils/UpdateEncoder.js delete mode 100644 yjs-poll/node_modules/yjs/src/utils/YEvent.js delete mode 100644 yjs-poll/node_modules/yjs/src/utils/encoding.js delete mode 100644 yjs-poll/node_modules/yjs/src/utils/isParentOf.js delete mode 100644 yjs-poll/node_modules/yjs/src/utils/logging.js delete mode 100644 yjs-poll/node_modules/yjs/src/utils/updates.js delete mode 100644 yjs-poll/node_modules/yjs/tests/testHelper.js delete mode 100644 yjs-poll/run_yjs_server.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..40b878d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ \ No newline at end of file diff --git a/README.md b/README.md index 3354ea0..39313c4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,28 @@ # P2P Poll App -## Setup -mkdir yjs-poll -cd yjs-poll +## Install npm packages +``` npm init -y -npm install y-websocket ws +npm install +``` + +Note: the frontend obtains the packages `yjs` and `y-websocket` dynamically. + +## Run backend +``` +node backend.js +``` + +### Note on Yjs suggestion +Note that the following server setup is suggested in the Yjs docs (https://docs.yjs.dev/ecosystem/connection-provider/y-websocket): +``` +npm install y-websocket-server +HOST=localhost PORT=1000 npx y-websocket +``` + +However, across a range of npm versions, this does not work. +Nevertheless, the essential code from the `y-websocket-server` package is used here as provided in `utils.js`. + +## Run frontend +Open "frontend.html" in browser. + diff --git a/yjs-poll/backend.js b/backend.js similarity index 88% rename from yjs-poll/backend.js rename to backend.js index 5dc95cd..6d8f4ee 100644 --- a/yjs-poll/backend.js +++ b/backend.js @@ -1,28 +1,31 @@ -import { WebSocketServer } from 'ws'; - -// Create a WebSocket server -const WS_PORT = 8080; -const wss = new WebSocketServer({ port: WS_PORT }); - -console.log('WebSocket server is running on ws://localhost:' + String(WS_PORT)); - -// Connection event handler -wss.on('connection', (ws) => { - console.log('Client connected'); - - // Message event handler - ws.on('message', (message) => { - let msg_str = String(message); - console.log("Received: " + msg_str); - - // If this is a text or state message (no Yjs logic) - echo the message back to the client - if (msg_str.startsWith("TEXT_MESSAGE") | msg_str.startsWith("STATE_MESSAGE")) { - ws.send(msg_str); - } - }); - - // Close event handler - ws.on('close', () => { - console.log('Client disconnected'); - }); -}); +import { WebSocketServer } from 'ws'; +import { setupWSConnection } from './utils.js' + +// Create a WebSocket server +const WS_PORT = 8080; +const wss = new WebSocketServer({ port: WS_PORT }); + +console.log('WebSocket server is running on ws://localhost:' + String(WS_PORT)); + +// Connection event handler +wss.on('connection', setupWSConnection); +/* +wss.on('connection', (ws) => { + console.log('Client connected'); + + // Message event handler + ws.on('message', (message) => { + let msg_str = String(message); + console.log("Received: " + msg_str); + + // If this is a text or state message (no Yjs logic) - echo the message back to the client + if (msg_str.startsWith("TEXT_MESSAGE") | msg_str.startsWith("STATE_MESSAGE")) { + ws.send(msg_str); + } + }); + + // Close event handler + ws.on('close', () => { + console.log('Client disconnected'); + }); +});*/ diff --git a/yjs-poll/frontend.html b/frontend.html similarity index 94% rename from yjs-poll/frontend.html rename to frontend.html index 09f04b5..d623fca 100644 --- a/yjs-poll/frontend.html +++ b/frontend.html @@ -1,191 +1,196 @@ - - - - Poll Client - - - -

Poll Client

-
Connecting to server...
-
Connecting to server...
-
-
- - - - - - -
- - - - + + + + Poll Client + + + +

Poll Client

+
Connecting to server...
+
Connecting to server...
+
+
+ + + + + + +
+ + + + diff --git a/yjs-poll/package-lock.json b/package-lock.json similarity index 64% rename from yjs-poll/package-lock.json rename to package-lock.json index 1f7dd90..4b7f9fa 100644 --- a/yjs-poll/package-lock.json +++ b/package-lock.json @@ -9,8 +9,66 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "@y/protocols": "^1.0.6-1", + "lib0": "^0.2.102", "ws": "^8.19.0", - "y-websocket": "^3.0.0" + "yjs": "^14.0.0-7" + } + }, + "node_modules/@y/protocols": { + "version": "1.0.6-rc.1", + "resolved": "https://registry.npmjs.org/@y/protocols/-/protocols-1.0.6-rc.1.tgz", + "integrity": "sha512-e/qs7hXcLk/SeNitxMXv2ymozyWFTULwbJEi7cAf/K/iXw9nGwGXHrR5TNluQ/bMwOX1cwuUT0hjEojkfH0gsA==", + "license": "MIT", + "dependencies": { + "lib0": "^1.0.0-rc.1" + }, + "engines": { + "node": ">=16.0.0", + "npm": ">=8.0.0" + }, + "funding": { + "type": "GitHub Sponsors ❤", + "url": "https://github.com/sponsors/dmonad" + }, + "peerDependencies": { + "@y/y": "*" + } + }, + "node_modules/@y/protocols/node_modules/lib0": { + "version": "1.0.0-rc.4", + "resolved": "https://registry.npmjs.org/lib0/-/lib0-1.0.0-rc.4.tgz", + "integrity": "sha512-mESL4089ji2HbS19DwAsYJRrtxZDjzMjEzjNR5kpzFBqlhvV0b7F9+SlA2SHOQU1Puu2A9xejKXtElK77swxLA==", + "license": "MIT", + "bin": { + "0ecdsa-generate-keypair": "src/bin/0ecdsa-generate-keypair.js", + "0gentesthtml": "src/bin/gentesthtml.js", + "0serve": "src/bin/0serve.js" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "type": "GitHub Sponsors ❤", + "url": "https://github.com/sponsors/dmonad" + } + }, + "node_modules/@y/y": { + "version": "14.0.0-16", + "resolved": "https://registry.npmjs.org/@y/y/-/y-14.0.0-16.tgz", + "integrity": "sha512-4zwbLnLannzUiEdJn9r3IS2FCVdHqADZHLqAivzAuKeoCGZ55JUFebp/YUtrYuTE2ZaBgctxpzulqAAHaahtIA==", + "license": "MIT", + "peer": true, + "dependencies": { + "lib0": "^0.2.115-6" + }, + "engines": { + "node": ">=16.0.0", + "npm": ">=8.0.0" + }, + "funding": { + "type": "GitHub Sponsors ❤", + "url": "https://github.com/sponsors/dmonad" } }, "node_modules/isomorphic.js": { @@ -65,54 +123,13 @@ } } }, - "node_modules/y-protocols": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/y-protocols/-/y-protocols-1.0.7.tgz", - "integrity": "sha512-YSVsLoXxO67J6eE/nV4AtFtT3QEotZf5sK5BHxFBXso7VDUT3Tx07IfA6hsu5Q5OmBdMkQVmFZ9QOA7fikWvnw==", - "license": "MIT", - "dependencies": { - "lib0": "^0.2.85" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=8.0.0" - }, - "funding": { - "type": "GitHub Sponsors ❤", - "url": "https://github.com/sponsors/dmonad" - }, - "peerDependencies": { - "yjs": "^13.0.0" - } - }, - "node_modules/y-websocket": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/y-websocket/-/y-websocket-3.0.0.tgz", - "integrity": "sha512-mUHy7AzkOZ834T/7piqtlA8Yk6AchqKqcrCXjKW8J1w2lPtRDjz8W5/CvXz9higKAHgKRKqpI3T33YkRFLkPtg==", - "dependencies": { - "lib0": "^0.2.102", - "y-protocols": "^1.0.5" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=8.0.0" - }, - "funding": { - "type": "GitHub Sponsors ❤", - "url": "https://github.com/sponsors/dmonad" - }, - "peerDependencies": { - "yjs": "^13.5.6" - } - }, "node_modules/yjs": { - "version": "13.6.29", - "resolved": "https://registry.npmjs.org/yjs/-/yjs-13.6.29.tgz", - "integrity": "sha512-kHqDPdltoXH+X4w1lVmMtddE3Oeqq48nM40FD5ojTd8xYhQpzIDcfE2keMSU5bAgRPJBe225WTUdyUgj1DtbiQ==", + "version": "14.0.0-16", + "resolved": "https://registry.npmjs.org/yjs/-/yjs-14.0.0-16.tgz", + "integrity": "sha512-n7jMrQz4pgU/NFnf4qY53K2adR/fu6ViQ79qVIw6Og+BtuDs1hx3DjOi3iREVnA6tsxQXXVG3gvG0I2kpmAwoQ==", "license": "MIT", - "peer": true, "dependencies": { - "lib0": "^0.2.99" + "lib0": "^0.2.115-6" }, "engines": { "node": ">=16.0.0", diff --git a/yjs-poll/package.json b/package.json similarity index 80% rename from yjs-poll/package.json rename to package.json index e3c9df2..2fdde9b 100644 --- a/yjs-poll/package.json +++ b/package.json @@ -13,6 +13,8 @@ "description": "", "dependencies": { "ws": "^8.19.0", - "y-websocket": "^3.0.0" + "@y/protocols": "^1.0.6-1", + "lib0": "^0.2.102", + "yjs": "^14.0.0-7" } } diff --git a/utils.js b/utils.js new file mode 100644 index 0000000..f56ff93 --- /dev/null +++ b/utils.js @@ -0,0 +1,291 @@ +/* Adapted from https://github.com/yjs/y-websocket-server/blob/main/src/server.js, version of 2025-04-02 + (author: dmonad/Kevin Jahns, MIT license) */ + +import * as Y from 'yjs' +import * as syncProtocol from '@y/protocols/sync' +import * as awarenessProtocol from '@y/protocols/awareness' + +import * as encoding from 'lib0/encoding' +import * as decoding from 'lib0/decoding' +import * as map from 'lib0/map' + +import * as eventloop from 'lib0/eventloop' + +/*import { callbackHandler, isCallbackSet } from './callback.js' + +const CALLBACK_DEBOUNCE_WAIT = parseInt(process.env.CALLBACK_DEBOUNCE_WAIT || '2000') +const CALLBACK_DEBOUNCE_MAXWAIT = parseInt(process.env.CALLBACK_DEBOUNCE_MAXWAIT || '10000') + +const debouncer = eventloop.createDebouncer(CALLBACK_DEBOUNCE_WAIT, CALLBACK_DEBOUNCE_MAXWAIT)*/ + +const wsReadyStateConnecting = 0 +const wsReadyStateOpen = 1 +const wsReadyStateClosing = 2 // eslint-disable-line +const wsReadyStateClosed = 3 // eslint-disable-line + +// disable gc when using snapshots! +const gcEnabled = process.env.GC !== 'false' && process.env.GC !== '0' +// const persistenceDir = process.env.YPERSISTENCE +/** + * @type {{bindState: function(string,WSSharedDoc):void, writeState:function(string,WSSharedDoc):Promise, provider: any}|null} + */ +let persistence = null + +/** + * @param {{bindState: function(string,WSSharedDoc):void, + * writeState:function(string,WSSharedDoc):Promise,provider:any}|null} persistence_ + */ +export const setPersistence = persistence_ => { + persistence = persistence_ +} + +/** + * @return {null|{bindState: function(string,WSSharedDoc):void, + * writeState:function(string,WSSharedDoc):Promise}|null} used persistence layer + */ +export const getPersistence = () => persistence + +/** + * @type {Map} + */ +export const docs = new Map() + +const messageSync = 0 +const messageAwareness = 1 +// const messageAuth = 2 +//const messageTextMessage = 3 +//const messageStateMessage = 4 + +/** + * @param {Uint8Array} update + * @param {any} _origin + * @param {WSSharedDoc} doc + * @param {any} _tr + */ +const updateHandler = (update, _origin, doc, _tr) => { + const encoder = encoding.createEncoder() + encoding.writeVarUint(encoder, messageSync) + syncProtocol.writeUpdate(encoder, update) + const message = encoding.toUint8Array(encoder) + doc.conns.forEach((_, conn) => send(doc, conn, message)) +} + +/** + * @type {(ydoc: Y.Doc) => Promise} + */ +let contentInitializor = _ydoc => Promise.resolve() + +/** + * This function is called once every time a Yjs document is created. You can + * use it to pull data from an external source or initialize content. + * + * @param {(ydoc: Y.Doc) => Promise} f + */ +export const setContentInitializor = (f) => { + contentInitializor = f +} + +export class WSSharedDoc extends Y.Doc { + /** + * @param {string} name + */ + constructor (name) { + super({ gc: gcEnabled }) + this.name = name + /** + * Maps from conn to set of controlled user ids. Delete all user ids from awareness when this conn is closed + * @type {Map>} + */ + this.conns = new Map() + /** + * @type {awarenessProtocol.Awareness} + */ + this.awareness = new awarenessProtocol.Awareness(this) + this.awareness.setLocalState(null) + /** + * @param {{ added: Array, updated: Array, removed: Array }} changes + * @param {Object | null} conn Origin is the connection that made the change + */ + const awarenessChangeHandler = ({ added, updated, removed }, conn) => { + const changedClients = added.concat(updated, removed) + if (conn !== null) { + const connControlledIDs = /** @type {Set} */ (this.conns.get(conn)) + if (connControlledIDs !== undefined) { + added.forEach(clientID => { connControlledIDs.add(clientID) }) + removed.forEach(clientID => { connControlledIDs.delete(clientID) }) + } + } + // broadcast awareness update + const encoder = encoding.createEncoder() + encoding.writeVarUint(encoder, messageAwareness) + encoding.writeVarUint8Array(encoder, awarenessProtocol.encodeAwarenessUpdate(this.awareness, changedClients)) + const buff = encoding.toUint8Array(encoder) + this.conns.forEach((_, c) => { + send(this, c, buff) + }) + } + this.awareness.on('update', awarenessChangeHandler) + this.on('update', /** @type {any} */ (updateHandler)) + //if (isCallbackSet) { + // this.on('update', (_update, _origin, doc) => { + // debouncer(() => callbackHandler(/** @type {WSSharedDoc} */ (doc))) + // }) + //} + this.whenInitialized = contentInitializor(this) + } +} + +/** + * Gets a Y.Doc by name, whether in memory or on disk + * + * @param {string} docname - the name of the Y.Doc to find or create + * @param {boolean} gc - whether to allow gc on the doc (applies only when created) + * @return {WSSharedDoc} + */ +export const getYDoc = (docname, gc = true) => map.setIfUndefined(docs, docname, () => { + const doc = new WSSharedDoc(docname) + doc.gc = gc + if (persistence !== null) { + persistence.bindState(docname, doc) + } + docs.set(docname, doc) + return doc +}) + +/** + * @param {any} conn + * @param {WSSharedDoc} doc + * @param {Uint8Array} message + */ +const messageListener = (conn, doc, message) => { + try { + const encoder = encoding.createEncoder() + const decoder = decoding.createDecoder(new Uint8Array(message)) + const messageType = decoding.readVarUint(decoder) + switch (messageType) { + case messageSync: + encoding.writeVarUint(encoder, messageSync) + syncProtocol.readSyncMessage(decoder, encoder, doc, conn) + + // If the `encoder` only contains the type of reply message and no + // message, there is no need to send the message. When `encoder` only + // contains the type of reply, its length is 1. + if (encoding.length(encoder) > 1) { + send(doc, conn, encoding.toUint8Array(encoder)) + } + break + case messageAwareness: { + awarenessProtocol.applyAwarenessUpdate(doc.awareness, decoding.readVarUint8Array(decoder), conn) + break + } + // If this is a text or a message (no Yjs logic) - echo the message back to the client + default: { + conn.send(String(message)) + console.log(String(message)) + break + } + } + } catch (err) { + console.error(err) + // @ts-ignore + doc.emit('error', [err]) + } +} + +/** + * @param {WSSharedDoc} doc + * @param {any} conn + */ +const closeConn = (doc, conn) => { + if (doc.conns.has(conn)) { + /** + * @type {Set} + */ + // @ts-ignore + const controlledIds = doc.conns.get(conn) + doc.conns.delete(conn) + awarenessProtocol.removeAwarenessStates(doc.awareness, Array.from(controlledIds), null) + if (doc.conns.size === 0 && persistence !== null) { + // if persisted, we store state and destroy ydocument + persistence.writeState(doc.name, doc).then(() => { + doc.destroy() + }) + docs.delete(doc.name) + } + } + conn.close() +} + +/** + * @param {WSSharedDoc} doc + * @param {import('ws').WebSocket} conn + * @param {Uint8Array} m + */ +const send = (doc, conn, m) => { + if (conn.readyState !== wsReadyStateConnecting && conn.readyState !== wsReadyStateOpen) { + closeConn(doc, conn) + } + try { + conn.send(m, {}, err => { err != null && closeConn(doc, conn) }) + } catch (e) { + closeConn(doc, conn) + } +} + +const pingTimeout = 30000 + +/** + * @param {import('ws').WebSocket} conn + * @param {import('http').IncomingMessage} req + * @param {any} opts + */ +export const setupWSConnection = (conn, req, { docName = (req.url || '').slice(1).split('?')[0], gc = true } = {}) => { + conn.binaryType = 'arraybuffer' + // get doc, initialize if it does not exist yet + const doc = getYDoc(docName, gc) + doc.conns.set(conn, new Set()) + // listen and reply to events + conn.on('message', /** @param {ArrayBuffer} message */ message => messageListener(conn, doc, message)) + + // Check if connection is still alive + let pongReceived = true + const pingInterval = setInterval(() => { + if (!pongReceived) { + if (doc.conns.has(conn)) { + closeConn(doc, conn) + } + clearInterval(pingInterval) + } else if (doc.conns.has(conn)) { + pongReceived = false + try { + conn.ping() + } catch (e) { + closeConn(doc, conn) + clearInterval(pingInterval) + } + } + }, pingTimeout) + conn.on('close', () => { + closeConn(doc, conn) + clearInterval(pingInterval) + }) + conn.on('pong', () => { + pongReceived = true + }) + // put the following in a variables in a block so the interval handlers don't keep in in + // scope + { + // send sync step 1 + const encoder = encoding.createEncoder() + encoding.writeVarUint(encoder, messageSync) + syncProtocol.writeSyncStep1(encoder, doc) + send(doc, conn, encoding.toUint8Array(encoder)) + const awarenessStates = doc.awareness.getStates() + if (awarenessStates.size > 0) { + const encoder = encoding.createEncoder() + encoding.writeVarUint(encoder, messageAwareness) + encoding.writeVarUint8Array(encoder, awarenessProtocol.encodeAwarenessUpdate(doc.awareness, Array.from(awarenessStates.keys()))) + send(doc, conn, encoding.toUint8Array(encoder)) + } + } +} diff --git a/yjs-poll/node_modules/.bin/0ecdsa-generate-keypair b/yjs-poll/node_modules/.bin/0ecdsa-generate-keypair deleted file mode 100644 index 5868a1c..0000000 --- a/yjs-poll/node_modules/.bin/0ecdsa-generate-keypair +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) - if command -v cygpath > /dev/null 2>&1; then - basedir=`cygpath -w "$basedir"` - fi - ;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../lib0/bin/0ecdsa-generate-keypair.js" "$@" -else - exec node "$basedir/../lib0/bin/0ecdsa-generate-keypair.js" "$@" -fi diff --git a/yjs-poll/node_modules/.bin/0ecdsa-generate-keypair.cmd b/yjs-poll/node_modules/.bin/0ecdsa-generate-keypair.cmd deleted file mode 100644 index 4044006..0000000 --- a/yjs-poll/node_modules/.bin/0ecdsa-generate-keypair.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\lib0\bin\0ecdsa-generate-keypair.js" %* diff --git a/yjs-poll/node_modules/.bin/0ecdsa-generate-keypair.ps1 b/yjs-poll/node_modules/.bin/0ecdsa-generate-keypair.ps1 deleted file mode 100644 index 2479126..0000000 --- a/yjs-poll/node_modules/.bin/0ecdsa-generate-keypair.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../lib0/bin/0ecdsa-generate-keypair.js" $args - } else { - & "$basedir/node$exe" "$basedir/../lib0/bin/0ecdsa-generate-keypair.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../lib0/bin/0ecdsa-generate-keypair.js" $args - } else { - & "node$exe" "$basedir/../lib0/bin/0ecdsa-generate-keypair.js" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/yjs-poll/node_modules/.bin/0gentesthtml b/yjs-poll/node_modules/.bin/0gentesthtml deleted file mode 100644 index a84ab49..0000000 --- a/yjs-poll/node_modules/.bin/0gentesthtml +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) - if command -v cygpath > /dev/null 2>&1; then - basedir=`cygpath -w "$basedir"` - fi - ;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../lib0/bin/gentesthtml.js" "$@" -else - exec node "$basedir/../lib0/bin/gentesthtml.js" "$@" -fi diff --git a/yjs-poll/node_modules/.bin/0gentesthtml.cmd b/yjs-poll/node_modules/.bin/0gentesthtml.cmd deleted file mode 100644 index fafb8e2..0000000 --- a/yjs-poll/node_modules/.bin/0gentesthtml.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\lib0\bin\gentesthtml.js" %* diff --git a/yjs-poll/node_modules/.bin/0gentesthtml.ps1 b/yjs-poll/node_modules/.bin/0gentesthtml.ps1 deleted file mode 100644 index 4c2b8d5..0000000 --- a/yjs-poll/node_modules/.bin/0gentesthtml.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../lib0/bin/gentesthtml.js" $args - } else { - & "$basedir/node$exe" "$basedir/../lib0/bin/gentesthtml.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../lib0/bin/gentesthtml.js" $args - } else { - & "node$exe" "$basedir/../lib0/bin/gentesthtml.js" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/yjs-poll/node_modules/.bin/0serve b/yjs-poll/node_modules/.bin/0serve deleted file mode 100644 index 9b1e176..0000000 --- a/yjs-poll/node_modules/.bin/0serve +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) - if command -v cygpath > /dev/null 2>&1; then - basedir=`cygpath -w "$basedir"` - fi - ;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../lib0/bin/0serve.js" "$@" -else - exec node "$basedir/../lib0/bin/0serve.js" "$@" -fi diff --git a/yjs-poll/node_modules/.bin/0serve.cmd b/yjs-poll/node_modules/.bin/0serve.cmd deleted file mode 100644 index c791e67..0000000 --- a/yjs-poll/node_modules/.bin/0serve.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\lib0\bin\0serve.js" %* diff --git a/yjs-poll/node_modules/.bin/0serve.ps1 b/yjs-poll/node_modules/.bin/0serve.ps1 deleted file mode 100644 index 7789eb3..0000000 --- a/yjs-poll/node_modules/.bin/0serve.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../lib0/bin/0serve.js" $args - } else { - & "$basedir/node$exe" "$basedir/../lib0/bin/0serve.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../lib0/bin/0serve.js" $args - } else { - & "node$exe" "$basedir/../lib0/bin/0serve.js" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/yjs-poll/node_modules/.package-lock.json b/yjs-poll/node_modules/.package-lock.json deleted file mode 100644 index 2195e00..0000000 --- a/yjs-poll/node_modules/.package-lock.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "name": "yjs-poll", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "node_modules/isomorphic.js": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/isomorphic.js/-/isomorphic.js-0.2.5.tgz", - "integrity": "sha512-PIeMbHqMt4DnUP3MA/Flc0HElYjMXArsw1qwJZcm9sqR8mq3l8NYizFMty0pWwE/tzIGH3EKK5+jes5mAr85yw==", - "license": "MIT", - "funding": { - "type": "GitHub Sponsors ❤", - "url": "https://github.com/sponsors/dmonad" - } - }, - "node_modules/lib0": { - "version": "0.2.117", - "resolved": "https://registry.npmjs.org/lib0/-/lib0-0.2.117.tgz", - "integrity": "sha512-DeXj9X5xDCjgKLU/7RR+/HQEVzuuEUiwldwOGsHK/sfAfELGWEyTcf0x+uOvCvK3O2zPmZePXWL85vtia6GyZw==", - "license": "MIT", - "dependencies": { - "isomorphic.js": "^0.2.4" - }, - "bin": { - "0ecdsa-generate-keypair": "bin/0ecdsa-generate-keypair.js", - "0gentesthtml": "bin/gentesthtml.js", - "0serve": "bin/0serve.js" - }, - "engines": { - "node": ">=16" - }, - "funding": { - "type": "GitHub Sponsors ❤", - "url": "https://github.com/sponsors/dmonad" - } - }, - "node_modules/ws": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz", - "integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==", - "license": "MIT", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/y-protocols": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/y-protocols/-/y-protocols-1.0.7.tgz", - "integrity": "sha512-YSVsLoXxO67J6eE/nV4AtFtT3QEotZf5sK5BHxFBXso7VDUT3Tx07IfA6hsu5Q5OmBdMkQVmFZ9QOA7fikWvnw==", - "license": "MIT", - "dependencies": { - "lib0": "^0.2.85" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=8.0.0" - }, - "funding": { - "type": "GitHub Sponsors ❤", - "url": "https://github.com/sponsors/dmonad" - }, - "peerDependencies": { - "yjs": "^13.0.0" - } - }, - "node_modules/y-websocket": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/y-websocket/-/y-websocket-3.0.0.tgz", - "integrity": "sha512-mUHy7AzkOZ834T/7piqtlA8Yk6AchqKqcrCXjKW8J1w2lPtRDjz8W5/CvXz9higKAHgKRKqpI3T33YkRFLkPtg==", - "dependencies": { - "lib0": "^0.2.102", - "y-protocols": "^1.0.5" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=8.0.0" - }, - "funding": { - "type": "GitHub Sponsors ❤", - "url": "https://github.com/sponsors/dmonad" - }, - "peerDependencies": { - "yjs": "^13.5.6" - } - }, - "node_modules/yjs": { - "version": "13.6.29", - "resolved": "https://registry.npmjs.org/yjs/-/yjs-13.6.29.tgz", - "integrity": "sha512-kHqDPdltoXH+X4w1lVmMtddE3Oeqq48nM40FD5ojTd8xYhQpzIDcfE2keMSU5bAgRPJBe225WTUdyUgj1DtbiQ==", - "license": "MIT", - "peer": true, - "dependencies": { - "lib0": "^0.2.99" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=8.0.0" - }, - "funding": { - "type": "GitHub Sponsors ❤", - "url": "https://github.com/sponsors/dmonad" - } - } - } -} diff --git a/yjs-poll/node_modules/isomorphic.js/LICENSE b/yjs-poll/node_modules/isomorphic.js/LICENSE deleted file mode 100644 index fa92d45..0000000 --- a/yjs-poll/node_modules/isomorphic.js/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2020 Kevin Jahns . - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/yjs-poll/node_modules/isomorphic.js/README.md b/yjs-poll/node_modules/isomorphic.js/README.md deleted file mode 100644 index 4561a05..0000000 --- a/yjs-poll/node_modules/isomorphic.js/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Isomorphic.js - -This module provides platform-specific features as a common API. This module is mainly about providing crypto features to node, browser, and non-supported platforms using a polyfill. \ No newline at end of file diff --git a/yjs-poll/node_modules/isomorphic.js/browser.js b/yjs-poll/node_modules/isomorphic.js/browser.js deleted file mode 100644 index b41af93..0000000 --- a/yjs-poll/node_modules/isomorphic.js/browser.js +++ /dev/null @@ -1,28 +0,0 @@ -/* eslint-env browser */ -const perf = typeof performance === 'undefined' ? null : performance - -const isoCrypto = typeof crypto === 'undefined' ? null : crypto - -/** - * @type {function(number):ArrayBuffer} - */ -const cryptoRandomBuffer = isoCrypto !== null - ? len => { - // browser - const buf = new ArrayBuffer(len) - const arr = new Uint8Array(buf) - isoCrypto.getRandomValues(arr) - return buf - } - : len => { - // polyfill - const buf = new ArrayBuffer(len) - const arr = new Uint8Array(buf) - for (let i = 0; i < len; i++) { - arr[i] = Math.ceil((Math.random() * 0xFFFFFFFF) >>> 0) - } - return buf - } - -exports.performance = perf -exports.cryptoRandomBuffer = cryptoRandomBuffer diff --git a/yjs-poll/node_modules/isomorphic.js/browser.mjs b/yjs-poll/node_modules/isomorphic.js/browser.mjs deleted file mode 100644 index 3a9d168..0000000 --- a/yjs-poll/node_modules/isomorphic.js/browser.mjs +++ /dev/null @@ -1,25 +0,0 @@ -/* eslint-env browser */ -export const performance = typeof window === 'undefined' ? null : (typeof window.performance !== 'undefined' && window.performance) || null - -const isoCrypto = typeof crypto === 'undefined' ? null : crypto - -/** - * @type {function(number):ArrayBuffer} - */ -export const cryptoRandomBuffer = isoCrypto !== null - ? len => { - // browser - const buf = new ArrayBuffer(len) - const arr = new Uint8Array(buf) - isoCrypto.getRandomValues(arr) - return buf - } - : len => { - // polyfill - const buf = new ArrayBuffer(len) - const arr = new Uint8Array(buf) - for (let i = 0; i < len; i++) { - arr[i] = Math.ceil((Math.random() * 0xFFFFFFFF) >>> 0) - } - return buf - } diff --git a/yjs-poll/node_modules/isomorphic.js/iso.js b/yjs-poll/node_modules/isomorphic.js/iso.js deleted file mode 100644 index 3d3f2b2..0000000 --- a/yjs-poll/node_modules/isomorphic.js/iso.js +++ /dev/null @@ -1,18 +0,0 @@ - -const isNode = typeof process !== 'undefined' && process.release && /node|io\.js/.test(process.release.name) - -const isoBrowser = require('./browser.js') - -const perf = isNode ? require('perf_hooks').performance : isoBrowser.performance -const nodeCrypto = isNode ? require('crypto') : null - -/** - * @type {function(number):ArrayBuffer} - */ -const cryptoRandomBuffer = nodeCrypto - // node - ? len => nodeCrypto.randomBytes(len).buffer - : isoBrowser.cryptoRandomBuffer - -exports.performance = perf -exports.cryptoRandomBuffer = cryptoRandomBuffer diff --git a/yjs-poll/node_modules/isomorphic.js/node.mjs b/yjs-poll/node_modules/isomorphic.js/node.mjs deleted file mode 100644 index d726a2e..0000000 --- a/yjs-poll/node_modules/isomorphic.js/node.mjs +++ /dev/null @@ -1,5 +0,0 @@ -import perfHooks from 'perf_hooks' -import crypto from 'crypto' - -export const performance = perfHooks.performance -export const cryptoRandomBuffer = len => crypto.randomBytes(len).buffer diff --git a/yjs-poll/node_modules/isomorphic.js/package.json b/yjs-poll/node_modules/isomorphic.js/package.json deleted file mode 100644 index a4faf44..0000000 --- a/yjs-poll/node_modules/isomorphic.js/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "isomorphic.js", - "version": "0.2.5", - "description": "Isomorphic JavaScript helper functions (performance, crpyto, ..)", - "sideEffects": false, - "main": "./iso.js", - "browser": "./browser.mjs", - "unpkg": "./browser.mjs", - "module": "./browser.mjs", - "exports": { - ".": { - "node": { - "import": "./node.mjs", - "require": "./iso.js" - }, - "browser": { - "import": "./browser.mjs", - "require": "./browser.js" - }, - "default": { - "import": "./browser.mjs", - "require": "./iso.js" - } - }, - "./package.json": "./package.json" - }, - "dependencies": {}, - "funding": { - "type": "GitHub Sponsors ❤", - "url": "https://github.com/sponsors/dmonad" - }, - "devDependencies": { - "@types/node": "^13.13.9", - "standard": "^14.3.4", - "typescript": "^3.9.3" - }, - "scripts": { - "test": "npm run lint", - "lint": "standard && tsc", - "preversion": "npm run test" - }, - "files": [ - "browser.js", - "browser.mjs", - "iso.js", - "node.js", - "node.mjs" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/dmonad/isomorphic.js.git" - }, - "author": "Kevin Jahns ", - "license": "MIT", - "bugs": { - "url": "https://github.com/dmonad/isomorphic.js/issues" - }, - "homepage": "https://github.com/dmonad/isomorphic.js#readme", - "standard": { - "ignore": [ - "/dist", - "/node_modules", - "/docs" - ] - } -} diff --git a/yjs-poll/node_modules/lib0/.github/workflows/node.js.yml b/yjs-poll/node_modules/lib0/.github/workflows/node.js.yml deleted file mode 100644 index 22254fa..0000000 --- a/yjs-poll/node_modules/lib0/.github/workflows/node.js.yml +++ /dev/null @@ -1,24 +0,0 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Testing Lib0 -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [16.x, 18.x] - - steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - run: npm ci - - run: npm test diff --git a/yjs-poll/node_modules/lib0/.jsdoc.json b/yjs-poll/node_modules/lib0/.jsdoc.json deleted file mode 100644 index ff0a61b..0000000 --- a/yjs-poll/node_modules/lib0/.jsdoc.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "plugins": [ - "plugins/markdown", - "jsdoc-plugin-typescript" - ], - "recurseDepth": 10, - "source": { - "excludePattern": "/\\.test\\.js/" - }, - "sourceType": "module", - "tags": { - "allowUnknownTags": true, - "dictionaries": ["jsdoc", "closure"] - }, - "typescript": { - "moduleRoot": "./" - } -} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/.vscode/launch.json b/yjs-poll/node_modules/lib0/.vscode/launch.json deleted file mode 100644 index d7b645a..0000000 --- a/yjs-poll/node_modules/lib0/.vscode/launch.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "node", - "request": "launch", - "name": "Gen Docs", - "program": "${workspaceFolder}/bin/gendocs.js", - "skipFiles": [ - "/**" - ], - } - ] -} diff --git a/yjs-poll/node_modules/lib0/LICENSE b/yjs-poll/node_modules/lib0/LICENSE deleted file mode 100644 index ac0e51d..0000000 --- a/yjs-poll/node_modules/lib0/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2019 Kevin Jahns . - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/yjs-poll/node_modules/lib0/README.md b/yjs-poll/node_modules/lib0/README.md deleted file mode 100644 index b360944..0000000 --- a/yjs-poll/node_modules/lib0/README.md +++ /dev/null @@ -1,1414 +0,0 @@ - -# Lib0 -> Monorepo of isomorphic utility functions - -This library is meant to replace all global JavaScript functions with isomorphic module imports. Additionally, it implements several performance-oriented utility modules. Most noteworthy are the binary encoding/decoding modules **[lib0/encoding]** / **[lib0/decoding]**, the randomized testing framework **[lib0/testing]**, the fast Pseudo Random Number Generator **[lib0/PRNG]**, the small socket.io alternative **[lib0/websocket]**, and the logging module **[lib0/logging]** that allows colorized logging in all environments. Lib0 has only one dependency, which is also from the author of lib0. If lib0 is transpiled with rollup or webpack, very little code is produced because of the way that it is written. All exports are pure and are removed by transpilers that support dead code elimination. Here is an example of how dead code elemination and mangling optimizes code from lib0: - -```js -// How the code is optimized by transpilers: - -// lib0/json.js -export const stringify = JSON.stringify -export const parse = JSON.parse - -// index.js -import * as json from 'lib0/json' -export const f = (arg1, arg2) => json.stringify(arg1) + json.stringify(arg2) - -// compiled with rollup and uglifyjs: -const s=JSON.stringify,f=(a,b)=>s(a)+s(b) -export {f} -``` - -## Performance resources - -Each function in this library is tested thoroughly and is not deoptimized by v8 (except some logging and comparison functions that can't be implemented without deoptimizations). This library implements its own test suite that is designed for randomized testing and inspecting performance issues. - -* `node --trace-deopt` and `node --trace-opt` -* https://youtu.be/IFWulQnM5E0 Good intro video -* https://github.com/thlorenz/v8-perf -* https://github.com/thlorenz/deoptigate - A great tool for investigating deoptimizations -* https://github.com/vhf/v8-bailout-reasons - Description of some deopt messages - -## Code style - -The code style might be a bit different from what you are used to. Stay open. Most of the design choices have been thought through. The purpose of this code style is to create code that is optimized by the compiler and that results in small code bundles when used with common module bundlers. Keep that in mind when reading the library. - -* No polymorphism! -* Modules should only export pure functions and constants. This way the module bundler can eliminate dead code. The statement `const x = someCondition ? A : B` cannot be eleminated, because it is tied to a condition. -* Use Classes for structuring data. Classes are well supported by jsdoc and are immediately optimized by the compiler. I.e. prefer `class Coord { constructor (x, y) { this.x = x; this.y = y} }` instead of `{ x: x, y: y }`, because the compiler needs to be assured that the order of properties does not change. `{ y: y, x: x }` has a different hidden class than `{ x: x, y: y }`, which will lead to code deoptimizations if their use is alternated. -* The user of your module should never create data objects with the `new` keyword. Prefer exporting factory functions like `const createCoordinate = (x, y) => new Coord(x, y)`. -* The use of class methods is discouraged, because method names can't be mangled or removed by dead code elimination. -* The only acceptable use of methods is when two objects implement functionality differently. - E.g. `class Duck { eat () { swallow() } }` and `class Cow { eat () { chew() } }` have the - same signature, but implement it differently. -* Prefer `const` variable declarations. Use `let` only in loops. `const` always leads to easier code. -* Keep the potential execution stack small and compartmentalized. Nobody wants to debug spaghetti code. -* Give proper names to your functions and ask yourself if you would know what the function does if you saw it in the execution stack. -* Avoid recursion. There is a stack limit in most browsers and not every recursive function is optimized by the compiler. -* Semicolons are superfluous. Lint with https://standardjs.com/ - -## Using lib0 - -`lib0` contains isomorphic modules that work in nodejs, the browser, and other environments. It exports modules as the `commonjs` and the new `esm module` format. - -If possible, - -**ESM module** -```js -import module from 'lib0/[module]' // automatically resolves to lib0/[module].js -``` - -**CommonJS** -```js -require('lib0/[module]') // automatically resolves to lib0/dist/[module].cjs -``` - -**Manual** - -Automatically resolving to `commonjs` and `esm modules` is implemented using *conditional exports* which is available in `node>=v12`. If support for older versions is required, then it is recommended to define the location of the module manually: - -```js -import module from 'lib0/[module].js' -// require('lib0/dist/[module].cjs') -``` - -## Modules - -
[lib0/array] Utility module to work with Arrays. -
import * as array from 'lib0/array'
-
-array.last(arr: ArrayLike<L>): L
-

Return the last element of an array. The element must exist

-array.create(): Array<C>
-array.copy(a: Array<D>): Array<D>
-array.appendTo(dest: Array<M>, src: Array<M>)
-

Append elements from src to dest

-array.from(arraylike: ArrayLike<T>|Iterable<T>): T
-

Transforms something array-like to an actual Array.

-array.every(arr: ARR, f: function(ITEM, number, ARR):boolean): boolean
-

True iff condition holds on every element in the Array.

-array.some(arr: ARR, f: function(S, number, ARR):boolean): boolean
-

True iff condition holds on some element in the Array.

-array.equalFlat(a: ArrayLike<ELEM>, b: ArrayLike<ELEM>): boolean
-array.flatten(arr: Array<Array<ELEM>>): Array<ELEM>
-array.isArray
-array.unique(arr: Array<T>): Array<T>
-array.uniqueBy(arr: ArrayLike<T>, mapper: function(T):M): Array<T>
-
-
-
[lib0/binary] Binary data constants. -
import * as binary from 'lib0/binary'
-
-binary.BIT1: number
-

n-th bit activated.

-binary.BIT2
-binary.BIT3
-binary.BIT4
-binary.BIT5
-binary.BIT6
-binary.BIT7
-binary.BIT8
-binary.BIT9
-binary.BIT10
-binary.BIT11
-binary.BIT12
-binary.BIT13
-binary.BIT14
-binary.BIT15
-binary.BIT16
-binary.BIT17
-binary.BIT18
-binary.BIT19
-binary.BIT20
-binary.BIT21
-binary.BIT22
-binary.BIT23
-binary.BIT24
-binary.BIT25
-binary.BIT26
-binary.BIT27
-binary.BIT28
-binary.BIT29
-binary.BIT30
-binary.BIT31
-binary.BIT32
-binary.BITS0: number
-

First n bits activated.

-binary.BITS1
-binary.BITS2
-binary.BITS3
-binary.BITS4
-binary.BITS5
-binary.BITS6
-binary.BITS7
-binary.BITS8
-binary.BITS9
-binary.BITS10
-binary.BITS11
-binary.BITS12
-binary.BITS13
-binary.BITS14
-binary.BITS15
-binary.BITS16
-binary.BITS17
-binary.BITS18
-binary.BITS19
-binary.BITS20
-binary.BITS21
-binary.BITS22
-binary.BITS23
-binary.BITS24
-binary.BITS25
-binary.BITS26
-binary.BITS27
-binary.BITS28
-binary.BITS29
-binary.BITS30
-binary.BITS31: number
-binary.BITS32: number
-
-
-
[lib0/broadcastchannel] Helpers for cross-tab communication using broadcastchannel with LocalStorage fallback. -
import * as broadcastchannel from 'lib0/broadcastchannel'
- -
// In browser window A:
-broadcastchannel.subscribe('my events', data => console.log(data))
-broadcastchannel.publish('my events', 'Hello world!') // => A: 'Hello world!' fires synchronously in same tab
-
-// In browser window B:
-broadcastchannel.publish('my events', 'hello from tab B') // => A: 'hello from tab B'
-
-
-broadcastchannel.subscribe(room: string, f: function(any, any):any)
-

Subscribe to global publish events.

-broadcastchannel.unsubscribe(room: string, f: function(any, any):any)
-

Unsubscribe from publish global events.

-broadcastchannel.publish(room: string, data: any, origin: any)
-

Publish data to all subscribers (including subscribers on this tab)

-
-
-
[lib0/buffer] Utility functions to work with buffers (Uint8Array). -
import * as buffer from 'lib0/buffer'
-
-buffer.createUint8ArrayFromLen(len: number)
-buffer.createUint8ArrayViewFromArrayBuffer(buffer: ArrayBuffer, byteOffset: number, length: number)
-

Create Uint8Array with initial content from buffer

-buffer.createUint8ArrayFromArrayBuffer(buffer: ArrayBuffer)
-

Create Uint8Array with initial content from buffer

-buffer.toBase64
-buffer.fromBase64
-buffer.copyUint8Array(uint8Array: Uint8Array): Uint8Array
-

Copy the content of an Uint8Array view to a new ArrayBuffer.

-buffer.encodeAny(data: any): Uint8Array
-

Encode anything as a UInt8Array. It's a pun on typescripts's any type. -See encoding.writeAny for more information.

-buffer.decodeAny(buf: Uint8Array): any
-

Decode an any-encoded value.

-
-
-
[lib0/cache] An implementation of a map which has keys that expire. -
import * as cache from 'lib0/cache'
-
-new cache.Cache(timeout: number)
-cache.removeStale(cache: module:cache.Cache<K, V>): number
-cache.set(cache: module:cache.Cache<K, V>, key: K, value: V)
-cache.get(cache: module:cache.Cache<K, V>, key: K): V | undefined
-cache.refreshTimeout(cache: module:cache.Cache<K, V>, key: K)
-cache.getAsync(cache: module:cache.Cache<K, V>, key: K): V | Promise<V> | undefined
-

Works well in conjunktion with setIfUndefined which has an async init function. -Using getAsync & setIfUndefined ensures that the init function is only called once.

-cache.remove(cache: module:cache.Cache<K, V>, key: K)
-cache.setIfUndefined(cache: module:cache.Cache<K, V>, key: K, init: function():Promise<V>, removeNull: boolean): Promise<V> | V
-cache.create(timeout: number)
-
-
-
[lib0/component] Web components. -
import * as component from 'lib0/component'
-
-component.registry: CustomElementRegistry
-component.define(name: string, constr: any, opts: ElementDefinitionOptions)
-component.whenDefined(name: string): Promise<CustomElementConstructor>
-new component.Lib0Component(state: S)
-component.Lib0Component#state: S|null
-component.Lib0Component#setState(state: S, forceStateUpdate: boolean)
-component.Lib0Component#updateState(stateUpdate: any)
-component.createComponent(name: string, cnf: module:component~CONF<T>): Class<module:component.Lib0Component>
-component.createComponentDefiner(definer: function)
-component.defineListComponent
-component.defineLazyLoadingComponent
-
-
-
[lib0/conditions] Often used conditions. -
import * as conditions from 'lib0/conditions'
-
-conditions.undefinedToNull
-
-
-
[lib0/crypto] -
import * as crypto from 'lib0/crypto'
-
-y(data: string | Uint8Array): Uint8Array
-ymmetricKey(secret: string | Uint8Array, salt: string | Uint8Array, opts: Object, opts.extractable: boolean, opts.usages: Array<'sign'|'verify'|'encrypt'|'decrypt'>): PromiseLike<CryptoKey>
-ymmetricKey()
-eAsymmetricKey(opts: Object, opts.extractable: boolean, opts.usages: Array<'sign'|'verify'|'encrypt'|'decrypt'>)
-eAsymmetricKey()
-ey(key: CryptoKey)
-ey()
-ymmetricKey(jwk: any, opts: Object, opts.extractable: boolean, opts.usages: Array<'sign'|'verify'|'encrypt'|'decrypt'>)
-ymmetricKey()
-symmetricKey(jwk: any, opts: Object, opts.extractable: boolean, opts.usages: Array<'sign'|'verify'|'encrypt'|'decrypt'>)
-symmetricKey()
-(data: Uint8Array, key: CryptoKey): PromiseLike<Uint8Array>
-()
-(data: Uint8Array, key: CryptoKey): PromiseLike<Uint8Array>
-()
-(data: Uint8Array, privateKey: CryptoKey): PromiseLike<Uint8Array>
-()
-(signature: Uint8Array, data: Uint8Array, publicKey: CryptoKey): PromiseLike<boolean>
-()
-
-
-
[lib0/decoding] Efficient schema-less binary decoding with support for variable length encoding. -
import * as decoding from 'lib0/decoding'
- -

Use [lib0/decoding] with [lib0/encoding]. Every encoding function has a corresponding decoding function.

-

Encodes numbers in little-endian order (least to most significant byte order) -and is compatible with Golang's binary encoding (https://golang.org/pkg/encoding/binary/) -which is also used in Protocol Buffers.

-
// encoding step
-const encoder = encoding.createEncoder()
-encoding.writeVarUint(encoder, 256)
-encoding.writeVarString(encoder, 'Hello world!')
-const buf = encoding.toUint8Array(encoder)
-
-
// decoding step
-const decoder = decoding.createDecoder(buf)
-decoding.readVarUint(decoder) // => 256
-decoding.readVarString(decoder) // => 'Hello world!'
-decoding.hasContent(decoder) // => false - all data is read
-
-
-new decoding.Decoder(uint8Array: Uint8Array)
-

A Decoder handles the decoding of an Uint8Array.

-decoding.Decoder#arr: Uint8Array
-

Decoding target.

-decoding.Decoder#pos: number
-

Current decoding position.

-decoding.createDecoder(uint8Array: Uint8Array): module:decoding.Decoder
-decoding.hasContent(decoder: module:decoding.Decoder): boolean
-decoding.clone(decoder: module:decoding.Decoder, newPos: number): module:decoding.Decoder
-

Clone a decoder instance. -Optionally set a new position parameter.

-decoding.readUint8Array(decoder: module:decoding.Decoder, len: number): Uint8Array
-

Create an Uint8Array view of the next len bytes and advance the position by len.

-

Important: The Uint8Array still points to the underlying ArrayBuffer. Make sure to discard the result as soon as possible to prevent any memory leaks. -Use buffer.copyUint8Array to copy the result into a new Uint8Array.

-decoding.readVarUint8Array(decoder: module:decoding.Decoder): Uint8Array
-

Read variable length Uint8Array.

-

Important: The Uint8Array still points to the underlying ArrayBuffer. Make sure to discard the result as soon as possible to prevent any memory leaks. -Use buffer.copyUint8Array to copy the result into a new Uint8Array.

-decoding.readTailAsUint8Array(decoder: module:decoding.Decoder): Uint8Array
-

Read the rest of the content as an ArrayBuffer

-decoding.skip8(decoder: module:decoding.Decoder): number
-

Skip one byte, jump to the next position.

-decoding.readUint8(decoder: module:decoding.Decoder): number
-

Read one byte as unsigned integer.

-decoding.readUint16(decoder: module:decoding.Decoder): number
-

Read 2 bytes as unsigned integer.

-decoding.readUint32(decoder: module:decoding.Decoder): number
-

Read 4 bytes as unsigned integer.

-decoding.readUint32BigEndian(decoder: module:decoding.Decoder): number
-

Read 4 bytes as unsigned integer in big endian order. -(most significant byte first)

-decoding.peekUint8(decoder: module:decoding.Decoder): number
-

Look ahead without incrementing the position -to the next byte and read it as unsigned integer.

-decoding.peekUint16(decoder: module:decoding.Decoder): number
-

Look ahead without incrementing the position -to the next byte and read it as unsigned integer.

-decoding.peekUint32(decoder: module:decoding.Decoder): number
-

Look ahead without incrementing the position -to the next byte and read it as unsigned integer.

-decoding.readVarUint(decoder: module:decoding.Decoder): number
-

Read unsigned integer (32bit) with variable length. -1/8th of the storage is used as encoding overhead.

-
    -
  • numbers < 2^7 is stored in one bytlength
  • -
  • numbers < 2^14 is stored in two bylength
  • -
-decoding.readVarInt(decoder: module:decoding.Decoder): number
-

Read signed integer (32bit) with variable length. -1/8th of the storage is used as encoding overhead.

-
    -
  • numbers < 2^7 is stored in one bytlength
  • -
  • numbers < 2^14 is stored in two bylength
  • -
-decoding.peekVarUint(decoder: module:decoding.Decoder): number
-

Look ahead and read varUint without incrementing position

-decoding.peekVarInt(decoder: module:decoding.Decoder): number
-

Look ahead and read varUint without incrementing position

-decoding.readVarString
-decoding.peekVarString(decoder: module:decoding.Decoder): string
-

Look ahead and read varString without incrementing position

-decoding.readFromDataView(decoder: module:decoding.Decoder, len: number): DataView
-decoding.readFloat32(decoder: module:decoding.Decoder)
-decoding.readFloat64(decoder: module:decoding.Decoder)
-decoding.readBigInt64(decoder: module:decoding.Decoder)
-decoding.readBigUint64(decoder: module:decoding.Decoder)
-decoding.readAny(decoder: module:decoding.Decoder)
-new decoding.RleDecoder(uint8Array: Uint8Array, reader: function(module:decoding.Decoder):T)
-

T must not be null.

-decoding.RleDecoder#s: T|null
-

Current state

-decoding.RleDecoder#read()
-decoding.RleDecoder#s: T
-new decoding.IntDiffDecoder(uint8Array: Uint8Array, start: number)
-decoding.IntDiffDecoder#s: number
-

Current state

-decoding.IntDiffDecoder#read(): number
-new decoding.RleIntDiffDecoder(uint8Array: Uint8Array, start: number)
-decoding.RleIntDiffDecoder#s: number
-

Current state

-decoding.RleIntDiffDecoder#read(): number
-decoding.RleIntDiffDecoder#s: number
-new decoding.UintOptRleDecoder(uint8Array: Uint8Array)
-decoding.UintOptRleDecoder#s: number
-decoding.UintOptRleDecoder#read()
-decoding.UintOptRleDecoder#s: number
-new decoding.IncUintOptRleDecoder(uint8Array: Uint8Array)
-decoding.IncUintOptRleDecoder#s: number
-decoding.IncUintOptRleDecoder#read()
-new decoding.IntDiffOptRleDecoder(uint8Array: Uint8Array)
-decoding.IntDiffOptRleDecoder#s: number
-decoding.IntDiffOptRleDecoder#read(): number
-new decoding.StringDecoder(uint8Array: Uint8Array)
-decoding.StringDecoder#spos: number
-decoding.StringDecoder#read(): string
-decoding.RleDecoder#arr: Uint8Array
-

Decoding target.

-decoding.RleDecoder#pos: number
-

Current decoding position.

-decoding.IntDiffDecoder#arr: Uint8Array
-

Decoding target.

-decoding.IntDiffDecoder#pos: number
-

Current decoding position.

-decoding.RleIntDiffDecoder#arr: Uint8Array
-

Decoding target.

-decoding.RleIntDiffDecoder#pos: number
-

Current decoding position.

-decoding.UintOptRleDecoder#arr: Uint8Array
-

Decoding target.

-decoding.UintOptRleDecoder#pos: number
-

Current decoding position.

-decoding.IncUintOptRleDecoder#arr: Uint8Array
-

Decoding target.

-decoding.IncUintOptRleDecoder#pos: number
-

Current decoding position.

-decoding.IntDiffOptRleDecoder#arr: Uint8Array
-

Decoding target.

-decoding.IntDiffOptRleDecoder#pos: number
-

Current decoding position.

-
-
-
[lib0/diff] Efficient diffs. -
import * as diff from 'lib0/diff'
-
-diff.simpleDiffString(a: string, b: string): module:diff~SimpleDiff<string>
-

Create a diff between two strings. This diff implementation is highly -efficient, but not very sophisticated.

-diff.simpleDiff
-diff.simpleDiffArray(a: Array<T>, b: Array<T>, compare: function(T, T):boolean): module:diff~SimpleDiff<Array<T>>
-

Create a diff between two arrays. This diff implementation is highly -efficient, but not very sophisticated.

-

Note: This is basically the same function as above. Another function was created so that the runtime -can better optimize these function calls.

-diff.simpleDiffStringWithCursor(a: string, b: string, cursor: number)
-

Diff text and try to diff at the current cursor position.

-
-
-
[lib0/dom] Utility module to work with the DOM. -
import * as dom from 'lib0/dom'
-
-dom.doc: Document
-dom.createElement
-dom.createDocumentFragment
-dom.createTextNode
-dom.domParser
-dom.emitCustomEvent
-dom.setAttributes
-dom.setAttributesMap
-dom.fragment
-dom.append
-dom.remove
-dom.addEventListener
-dom.removeEventListener
-dom.addEventListeners
-dom.removeEventListeners
-dom.element
-dom.canvas
-dom.text
-dom.pairToStyleString
-dom.pairsToStyleString
-dom.mapToStyleString
-dom.querySelector
-dom.querySelectorAll
-dom.getElementById
-dom.parseFragment
-dom.childNodes: any
-dom.parseElement
-dom.replaceWith
-dom.insertBefore
-dom.appendChild
-dom.ELEMENT_NODE
-dom.TEXT_NODE
-dom.CDATA_SECTION_NODE
-dom.COMMENT_NODE
-dom.DOCUMENT_NODE
-dom.DOCUMENT_TYPE_NODE
-dom.DOCUMENT_FRAGMENT_NODE
-dom.checkNodeType(node: any, type: number)
-dom.isParentOf(parent: Node, child: HTMLElement)
-
-
-
[lib0/encoding] Efficient schema-less binary encoding with support for variable length encoding. -
import * as encoding from 'lib0/encoding'
- -

Use [lib0/encoding] with [lib0/decoding]. Every encoding function has a corresponding decoding function.

-

Encodes numbers in little-endian order (least to most significant byte order) -and is compatible with Golang's binary encoding (https://golang.org/pkg/encoding/binary/) -which is also used in Protocol Buffers.

-
// encoding step
-const encoder = encoding.createEncoder()
-encoding.writeVarUint(encoder, 256)
-encoding.writeVarString(encoder, 'Hello world!')
-const buf = encoding.toUint8Array(encoder)
-
-
// decoding step
-const decoder = decoding.createDecoder(buf)
-decoding.readVarUint(decoder) // => 256
-decoding.readVarString(decoder) // => 'Hello world!'
-decoding.hasContent(decoder) // => false - all data is read
-
-
-new encoding.Encoder()
-

A BinaryEncoder handles the encoding to an Uint8Array.

-encoding.Encoder#bufs: Array<Uint8Array>
-encoding.createEncoder(): module:encoding.Encoder
-encoding.length(encoder: module:encoding.Encoder): number
-

The current length of the encoded data.

-encoding.toUint8Array(encoder: module:encoding.Encoder): Uint8Array
-

Transform to Uint8Array.

-encoding.verifyLen(encoder: module:encoding.Encoder, len: number)
-

Verify that it is possible to write len bytes wtihout checking. If -necessary, a new Buffer with the required length is attached.

-encoding.write(encoder: module:encoding.Encoder, num: number)
-

Write one byte to the encoder.

-encoding.set(encoder: module:encoding.Encoder, pos: number, num: number)
-

Write one byte at a specific position. -Position must already be written (i.e. encoder.length > pos)

-encoding.writeUint8(encoder: module:encoding.Encoder, num: number)
-

Write one byte as an unsigned integer.

-encoding.setUint8(encoder: module:encoding.Encoder, pos: number, num: number)
-

Write one byte as an unsigned Integer at a specific location.

-encoding.writeUint16(encoder: module:encoding.Encoder, num: number)
-

Write two bytes as an unsigned integer.

-encoding.setUint16(encoder: module:encoding.Encoder, pos: number, num: number)
-

Write two bytes as an unsigned integer at a specific location.

-encoding.writeUint32(encoder: module:encoding.Encoder, num: number)
-

Write two bytes as an unsigned integer

-encoding.writeUint32BigEndian(encoder: module:encoding.Encoder, num: number)
-

Write two bytes as an unsigned integer in big endian order. -(most significant byte first)

-encoding.setUint32(encoder: module:encoding.Encoder, pos: number, num: number)
-

Write two bytes as an unsigned integer at a specific location.

-encoding.writeVarUint(encoder: module:encoding.Encoder, num: number)
-

Write a variable length unsigned integer. Max encodable integer is 2^53.

-encoding.writeVarInt(encoder: module:encoding.Encoder, num: number)
-

Write a variable length integer.

-

We use the 7th bit instead for signaling that this is a negative number.

-encoding.writeVarString
-encoding.writeBinaryEncoder(encoder: module:encoding.Encoder, append: module:encoding.Encoder)
-

Write the content of another Encoder.

-encoding.writeUint8Array(encoder: module:encoding.Encoder, uint8Array: Uint8Array)
-

Append fixed-length Uint8Array to the encoder.

-encoding.writeVarUint8Array(encoder: module:encoding.Encoder, uint8Array: Uint8Array)
-

Append an Uint8Array to Encoder.

-encoding.writeOnDataView(encoder: module:encoding.Encoder, len: number): DataView
-

Create an DataView of the next len bytes. Use it to write data after -calling this function.

-
// write float32 using DataView
-const dv = writeOnDataView(encoder, 4)
-dv.setFloat32(0, 1.1)
-// read float32 using DataView
-const dv = readFromDataView(encoder, 4)
-dv.getFloat32(0) // => 1.100000023841858 (leaving it to the reader to find out why this is the correct result)
-
-encoding.writeFloat32(encoder: module:encoding.Encoder, num: number)
-encoding.writeFloat64(encoder: module:encoding.Encoder, num: number)
-encoding.writeBigInt64(encoder: module:encoding.Encoder, num: bigint)
-encoding.writeBigUint64(encoder: module:encoding.Encoder, num: bigint)
-encoding.writeAny(encoder: module:encoding.Encoder, data: undefined|null|number|bigint|boolean|string|Object<string,any>|Array<any>|Uint8Array)
-

Encode data with efficient binary format.

-

Differences to JSON: -• Transforms data to a binary format (not to a string) -• Encodes undefined, NaN, and ArrayBuffer (these can't be represented in JSON) -• Numbers are efficiently encoded either as a variable length integer, as a -32 bit float, as a 64 bit float, or as a 64 bit bigint.

-

Encoding table:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Data TypePrefixEncoding MethodComment
undefined127Functions, symbol, and everything that cannot be identified is encoded as undefined
null126
integer125writeVarIntOnly encodes 32 bit signed integers
float32124writeFloat32
float64123writeFloat64
bigint122writeBigInt64
boolean (false)121True and false are different data types so we save the following byte
boolean (true)120- 0b01111000 so the last bit determines whether true or false
string119writeVarString
object<string,any>118customWrites {length} then {length} key-value pairs
array117customWrites {length} then {length} json values
Uint8Array116writeVarUint8ArrayWe use Uint8Array for any kind of binary data
-

Reasons for the decreasing prefix: -We need the first bit for extendability (later we may want to encode the -prefix with writeVarUint). The remaining 7 bits are divided as follows: -[0-30] the beginning of the data range is used for custom purposes -(defined by the function that uses this library) -[31-127] the end of the data range is used for data encoding by -lib0/encoding.js

-new encoding.RleEncoder(writer: function(module:encoding.Encoder, T):void)
-

Now come a few stateful encoder that have their own classes.

-encoding.RleEncoder#s: T|null
-

Current state

-encoding.RleEncoder#write(v: T)
-new encoding.IntDiffEncoder(start: number)
-

Basic diff decoder using variable length encoding.

-

Encodes the values [3, 1100, 1101, 1050, 0] to [3, 1097, 1, -51, -1050] using writeVarInt.

-encoding.IntDiffEncoder#s: number
-

Current state

-encoding.IntDiffEncoder#write(v: number)
-new encoding.RleIntDiffEncoder(start: number)
-

A combination of IntDiffEncoder and RleEncoder.

-

Basically first writes the IntDiffEncoder and then counts duplicate diffs using RleEncoding.

-

Encodes the values [1,1,1,2,3,4,5,6] as [1,1,0,2,1,5] (RLE([1,0,0,1,1,1,1,1]) ⇒ RleIntDiff[1,1,0,2,1,5])

-encoding.RleIntDiffEncoder#s: number
-

Current state

-encoding.RleIntDiffEncoder#write(v: number)
-new encoding.UintOptRleEncoder()
-

Optimized Rle encoder that does not suffer from the mentioned problem of the basic Rle encoder.

-

Internally uses VarInt encoder to write unsigned integers. If the input occurs multiple times, we write -write it as a negative number. The UintOptRleDecoder then understands that it needs to read a count.

-

Encodes [1,2,3,3,3] as [1,2,-3,3] (once 1, once 2, three times 3)

-encoding.UintOptRleEncoder#s: number
-encoding.UintOptRleEncoder#write(v: number)
-encoding.UintOptRleEncoder#toUint8Array()
-new encoding.IncUintOptRleEncoder()
-

Increasing Uint Optimized RLE Encoder

-

The RLE encoder counts the number of same occurences of the same value. -The IncUintOptRle encoder counts if the value increases. -I.e. 7, 8, 9, 10 will be encoded as [-7, 4]. 1, 3, 5 will be encoded -as [1, 3, 5].

-encoding.IncUintOptRleEncoder#s: number
-encoding.IncUintOptRleEncoder#write(v: number)
-encoding.IncUintOptRleEncoder#toUint8Array()
-new encoding.IntDiffOptRleEncoder()
-

A combination of the IntDiffEncoder and the UintOptRleEncoder.

-

The count approach is similar to the UintDiffOptRleEncoder, but instead of using the negative bitflag, it encodes -in the LSB whether a count is to be read. Therefore this Encoder only supports 31 bit integers!

-

Encodes [1, 2, 3, 2] as [3, 1, 6, -1] (more specifically [(1 << 1) | 1, (3 << 0) | 0, -1])

-

Internally uses variable length encoding. Contrary to normal UintVar encoding, the first byte contains:

-
    -
  • 1 bit that denotes whether the next value is a count (LSB)
  • -
  • 1 bit that denotes whether this value is negative (MSB - 1)
  • -
  • 1 bit that denotes whether to continue reading the variable length integer (MSB)
  • -
-

Therefore, only five bits remain to encode diff ranges.

-

Use this Encoder only when appropriate. In most cases, this is probably a bad idea.

-encoding.IntDiffOptRleEncoder#s: number
-encoding.IntDiffOptRleEncoder#write(v: number)
-encoding.IntDiffOptRleEncoder#toUint8Array()
-new encoding.StringEncoder()
-

Optimized String Encoder.

-

Encoding many small strings in a simple Encoder is not very efficient. The function call to decode a string takes some time and creates references that must be eventually deleted. -In practice, when decoding several million small strings, the GC will kick in more and more often to collect orphaned string objects (or maybe there is another reason?).

-

This string encoder solves the above problem. All strings are concatenated and written as a single string using a single encoding call.

-

The lengths are encoded using a UintOptRleEncoder.

-encoding.StringEncoder#sarr: Array<string>
-encoding.StringEncoder#write(string: string)
-encoding.StringEncoder#toUint8Array()
-encoding.RleEncoder#bufs: Array<Uint8Array>
-encoding.IntDiffEncoder#bufs: Array<Uint8Array>
-encoding.RleIntDiffEncoder#bufs: Array<Uint8Array>
-
-
-
[lib0/environment] Isomorphic module to work access the environment (query params, env variables). -
import * as env from 'lib0/environment'
-
-env.isNode
-env.isBrowser
-env.isMac
-env.hasParam
-env.getParam
-env.getVariable
-env.getConf(name: string): string|null
-env.hasConf
-env.production
-env.supportsColor
-
-
-
[lib0/error] Error helpers. -
import * as error from 'lib0/error'
-
-error.create(s: string): Error
-error.methodUnimplemented(): never
-error.unexpectedCase(): never
-
-
-
[lib0/eventloop] Utility module to work with EcmaScript's event loop. -
import * as eventloop from 'lib0/eventloop'
-
-eventloop.enqueue(f: function():void)
-eventloop#destroy()
-eventloop.timeout(timeout: number, callback: function): module:eventloop~TimeoutObject
-eventloop.interval(timeout: number, callback: function): module:eventloop~TimeoutObject
-eventloop.Animation
-eventloop.animationFrame(cb: function(number):void): module:eventloop~TimeoutObject
-eventloop.idleCallback(cb: function): module:eventloop~TimeoutObject
-

Note: this is experimental and is probably only useful in browsers.

-eventloop.createDebouncer(timeout: number): function(function():void):void
-
-
-
[lib0/function] Common functions and function call helpers. -
import * as function from 'lib0/function'
-
-function.callAll(fs: Array<function>, args: Array<any>)
-

Calls all functions in fs with args. Only throws after all functions were called.

-function.nop
-function.apply(f: function():T): T
-function.id(a: A): A
-function.equalityStrict(a: T, b: T): boolean
-function.equalityFlat(a: Array<T>|object, b: Array<T>|object): boolean
-function.equalityDeep(a: any, b: any): boolean
-function.isOneOf(value: V, options: Array<OPTS>)
-
-
-
[lib0/lib0] Experimental method to import lib0. -
import * as lib0 from 'lib0/index'
- -

Not recommended if the module bundler doesn't support dead code elimination.

-
-
-
-
[lib0/indexeddb] Helpers to work with IndexedDB. -
import * as indexeddb from 'lib0/indexeddb'
-
-indexeddb.rtop(request: IDBRequest): Promise<any>
-

IDB Request to Promise transformer

-indexeddb.openDB(name: string, initDB: function(IDBDatabase):any): Promise<IDBDatabase>
-indexeddb.deleteDB(name: string)
-indexeddb.createStores(db: IDBDatabase, definitions: Array<Array<string>|Array<string|IDBObjectStoreParameters|undefined>>)
-indexeddb.transact(db: IDBDatabase, stores: Array<string>, access: "readwrite"|"readonly"): Array<IDBObjectStore>
-indexeddb.count(store: IDBObjectStore, range: IDBKeyRange): Promise<number>
-indexeddb.get(store: IDBObjectStore, key: String | number | ArrayBuffer | Date | Array<any> ): Promise<String | number | ArrayBuffer | Date | Array<any>>
-indexeddb.del(store: IDBObjectStore, key: String | number | ArrayBuffer | Date | IDBKeyRange | Array<any> )
-indexeddb.put(store: IDBObjectStore, item: String | number | ArrayBuffer | Date | boolean, key: String | number | ArrayBuffer | Date | Array<any>)
-indexeddb.add(store: IDBObjectStore, item: String|number|ArrayBuffer|Date|boolean, key: String|number|ArrayBuffer|Date|Array.<any>): Promise<any>
-indexeddb.addAutoKey(store: IDBObjectStore, item: String|number|ArrayBuffer|Date): Promise<number>
-indexeddb.getAll(store: IDBObjectStore, range: IDBKeyRange, limit: number): Promise<Array<any>>
-indexeddb.getAllKeys(store: IDBObjectStore, range: IDBKeyRange, limit: number): Promise<Array<any>>
-indexeddb.queryFirst(store: IDBObjectStore, query: IDBKeyRange|null, direction: 'next'|'prev'|'nextunique'|'prevunique'): Promise<any>
-indexeddb.getLastKey(store: IDBObjectStore, range: IDBKeyRange?): Promise<any>
-indexeddb.getFirstKey(store: IDBObjectStore, range: IDBKeyRange?): Promise<any>
-indexeddb.getAllKeysValues(store: IDBObjectStore, range: IDBKeyRange, limit: number): Promise<Array<KeyValuePair>>
-indexeddb.iterate(store: IDBObjectStore, keyrange: IDBKeyRange|null, f: function(any,any):void|boolean|Promise<void|boolean>, direction: 'next'|'prev'|'nextunique'|'prevunique')
-

Iterate on keys and values

-indexeddb.iterateKeys(store: IDBObjectStore, keyrange: IDBKeyRange|null, f: function(any):void|boolean|Promise<void|boolean>, direction: 'next'|'prev'|'nextunique'|'prevunique')
-

Iterate on the keys (no values)

-indexeddb.getStore(t: IDBTransaction, store: String)IDBObjectStore
-

Open store from transaction

-indexeddb.createIDBKeyRangeBound(lower: any, upper: any, lowerOpen: boolean, upperOpen: boolean)
-indexeddb.createIDBKeyRangeUpperBound(upper: any, upperOpen: boolean)
-indexeddb.createIDBKeyRangeLowerBound(lower: any, lowerOpen: boolean)
-
-
-
[lib0/isomorphic] Isomorphic library exports from isomorphic.js. -
import * as isomorphic from 'lib0/isomorphic'
-
-
-
-
[lib0/iterator] Utility module to create and manipulate Iterators. -
import * as iterator from 'lib0/iterator'
-
-iterator.mapIterator(iterator: Iterator<T>, f: function(T):R): IterableIterator<R>
-iterator.createIterator(next: function():IteratorResult<T>): IterableIterator<T>
-iterator.iteratorFilter(iterator: Iterator<T>, filter: function(T):boolean)
-iterator.iteratorMap(iterator: Iterator<T>, fmap: function(T):M)
-
-
-
[lib0/json] JSON utility functions. -
import * as json from 'lib0/json'
-
-json.stringify(object: any): string
-

Transform JavaScript object to JSON.

-json.parse(json: string): any
-

Parse JSON object.

-
-
-
[lib0/list] -
import * as list from 'lib0/list'
-
-new e#ListNode()
-e#next: this|null
-e#prev: this|null
-new st()
-art: N | null
-d: N | null
-(): module:list.List<N>
-()
-(queue: module:list.List<N>)
-()
-(queue: module:list.List<N>, node: N)
-

Remove a single node from the queue. Only works with Queues that operate on Doubly-linked lists of nodes.

-()
-ode
-ode()
-etween(queue: module:list.List<N>, left: N| null, right: N| null, node: N)
-etween()
-(queue: module:list.List<N>, node: N, newNode: N)
-

Remove a single node from the queue. Only works with Queues that operate on Doubly-linked lists of nodes.

-()
-(queue: module:list.List<N>, n: N)
-()
-nt(queue: module:list.List<N>, n: N)
-nt()
-t(list: module:list.List<N>): N| null
-t()
-(list: module:list.List<N>): N| null
-()
-(list: module:list.List<N>, f: function(N):M): Array<M>
-()
-(list: module:list.List<N>)
-()
-(list: module:list.List<N>, f: function(N):M)
-()
-
-
-
[lib0/logging] Isomorphic logging module with support for colors! -
import * as logging from 'lib0/logging'
-
-logging.BOLD
-logging.UNBOLD
-logging.BLUE
-logging.GREY
-logging.GREEN
-logging.RED
-logging.PURPLE
-logging.ORANGE
-logging.UNCOLOR
-logging.print(args: Array<string|Symbol|Object|number>)
-logging.warn(args: Array<string|Symbol|Object|number>)
-logging.printError(err: Error)
-logging.printImg(url: string, height: number)
-logging.printImgBase64(base64: string, height: number)
-logging.group(args: Array<string|Symbol|Object|number>)
-logging.groupCollapsed(args: Array<string|Symbol|Object|number>)
-logging.groupEnd
-logging.printDom(createNode: function():Node)
-logging.printCanvas(canvas: HTMLCanvasElement, height: number)
-logging.vconsoles
-new logging.VConsole(dom: Element)
-logging.VConsole#ccontainer: Element
-logging.VConsole#group(args: Array<string|Symbol|Object|number>, collapsed: boolean)
-logging.VConsole#groupCollapsed(args: Array<string|Symbol|Object|number>)
-logging.VConsole#groupEnd()
-logging.VConsole#print(args: Array<string|Symbol|Object|number>)
-logging.VConsole#printError(err: Error)
-logging.VConsole#printImg(url: string, height: number)
-logging.VConsole#printDom(node: Node)
-logging.VConsole#destroy()
-logging.createVConsole(dom: Element)
-logging.createModuleLogger(moduleName: string): function(...any):void
-
-
-
[lib0/map] Utility module to work with key-value stores. -
import * as map from 'lib0/map'
-
-map.create(): Map<any, any>
-

Creates a new Map instance.

-map.copy(m: Map<X,Y>): Map<X,Y>
-

Copy a Map object into a fresh Map object.

-map.setIfUndefined(map: Map<K, T>, key: K, createT: function():T): T
-

Get map property. Create T if property is undefined and set T on map.

-
const listeners = map.setIfUndefined(events, 'eventName', set.create)
-listeners.add(listener)
-
-map.map(m: Map<K,V>, f: function(V,K):R): Array<R>
-

Creates an Array and populates it with the content of all key-value pairs using the f(value, key) function.

-map.any(m: Map<K,V>, f: function(V,K):boolean): boolean
-

Tests whether any key-value pairs pass the test implemented by f(value, key).

-map.all(m: Map<K,V>, f: function(V,K):boolean): boolean
-

Tests whether all key-value pairs pass the test implemented by f(value, key).

-
-
-
[lib0/math] Common Math expressions. -
import * as math from 'lib0/math'
-
-math.floor
-math.ceil
-math.abs
-math.imul
-math.round
-math.log10
-math.log2
-math.log
-math.sqrt
-math.add(a: number, b: number): number
-math.min(a: number, b: number): number
-math.max(a: number, b: number): number
-math.isNaN
-math.pow
-math.exp10(exp: number): number
-

Base 10 exponential function. Returns the value of 10 raised to the power of pow.

-math.sign
-math.isNegativeZero(n: number): boolean
-
-
-
[lib0/metric] Utility module to convert metric values. -
import * as metric from 'lib0/metric'
-
-metric.yotta
-metric.zetta
-metric.exa
-metric.peta
-metric.tera
-metric.giga
-metric.mega
-metric.kilo
-metric.hecto
-metric.deca
-metric.deci
-metric.centi
-metric.milli
-metric.micro
-metric.nano
-metric.pico
-metric.femto
-metric.atto
-metric.zepto
-metric.yocto
-metric.prefix(n: number, baseMultiplier: number): {n:number,prefix:string}
-

Calculate the metric prefix for a number. Assumes E.g. prefix(1000) = { n: 1, prefix: 'k' }

-
-
-
[lib0/mutex] Mutual exclude for JavaScript. -
import * as mutex from 'lib0/mutex'
-
-mutex.createMutex(): mutex
-

Creates a mutual exclude function with the following property:

-
const mutex = createMutex()
-mutex(() => {
-  // This function is immediately executed
-  mutex(() => {
-    // This function is not executed, as the mutex is already active.
-  })
-})
-
-
-
-
[lib0/number] -
import * as number from 'lib0/number'
-
-number.MAX_SAFE_INTEGER
-number.MIN_SAFE_INTEGER
-number.LOWEST_INT32
-number.HIGHEST_INT32: number
-number.isInteger
-number.isNaN
-number.parseInt
-
-
-
[lib0/object] Utility functions for working with EcmaScript objects. -
import * as object from 'lib0/object'
-
-object.create(): Object<string,any>
-object.assign
-

Object.assign

-object.keys(obj: Object<string,any>)
-object.forEach(obj: Object<string,any>, f: function(any,string):any)
-object.map(obj: Object<string,any>, f: function(any,string):R): Array<R>
-object.length(obj: Object<string,any>): number
-object.some(obj: Object<string,any>, f: function(any,string):boolean): boolean
-object.isEmpty(obj: Object|undefined)
-object.every(obj: Object<string,any>, f: function(any,string):boolean): boolean
-object.hasProperty(obj: any, key: string|symbol): boolean
-

Calls Object.prototype.hasOwnProperty.

-object.equalFlat(a: Object<string,any>, b: Object<string,any>): boolean
-
-
-
[lib0/observable] Observable class prototype. -
import * as observable from 'lib0/observable'
-
-new observable.Observable()
-

Handles named events.

-observable.Observable#on(name: N, f: function)
-observable.Observable#once(name: N, f: function)
-observable.Observable#off(name: N, f: function)
-observable.Observable#emit(name: N, args: Array<any>)
-

Emit a named event. All registered event listeners that listen to the -specified name will receive the event.

-observable.Observable#destroy()
-websocket.WebsocketClient#on(name: N, f: function)
-websocket.WebsocketClient#once(name: N, f: function)
-websocket.WebsocketClient#off(name: N, f: function)
-websocket.WebsocketClient#emit(name: N, args: Array<any>)
-

Emit a named event. All registered event listeners that listen to the -specified name will receive the event.

-
-
-
[lib0/pair] Working with value pairs. -
import * as pair from 'lib0/pair'
-
-new pair.Pair(left: L, right: R)
-pair.create(left: L, right: R): module:pair.Pair<L,R>
-pair.createReversed(right: R, left: L): module:pair.Pair<L,R>
-pair.forEach(arr: Array<module:pair.Pair<L,R>>, f: function(L, R):any)
-pair.map(arr: Array<module:pair.Pair<L,R>>, f: function(L, R):X): Array<X>
-
-
-
[lib0/prng] Fast Pseudo Random Number Generators. -
import * as prng from 'lib0/prng'
- -

Given a seed a PRNG generates a sequence of numbers that cannot be reasonably predicted. -Two PRNGs must generate the same random sequence of numbers if given the same seed.

-
-prng.DefaultPRNG
-prng.create(seed: number): module:prng~PRNG
-

Create a Xoroshiro128plus Pseudo-Random-Number-Generator. -This is the fastest full-period generator passing BigCrush without systematic failures. -But there are more PRNGs available in ./PRNG/.

-prng.bool(gen: module:prng~PRNG): Boolean
-

Generates a single random bool.

-prng.int53(gen: module:prng~PRNG, min: Number, max: Number): Number
-

Generates a random integer with 53 bit resolution.

-prng.uint53(gen: module:prng~PRNG, min: Number, max: Number): Number
-

Generates a random integer with 53 bit resolution.

-prng.int32(gen: module:prng~PRNG, min: Number, max: Number): Number
-

Generates a random integer with 32 bit resolution.

-prng.uint32(gen: module:prng~PRNG, min: Number, max: Number): Number
-

Generates a random integer with 53 bit resolution.

-prng.int31(gen: module:prng~PRNG, min: Number, max: Number): Number
-prng.real53(gen: module:prng~PRNG): Number
-

Generates a random real on [0, 1) with 53 bit resolution.

-prng.char(gen: module:prng~PRNG): string
-

Generates a random character from char code 32 - 126. I.e. Characters, Numbers, special characters, and Space:

-prng.letter(gen: module:prng~PRNG): string
-prng.word(gen: module:prng~PRNG, minLen: number, maxLen: number): string
-prng.utf16Rune(gen: module:prng~PRNG): string
-

TODO: this function produces invalid runes. Does not cover all of utf16!!

-prng.utf16String(gen: module:prng~PRNG, maxlen: number)
-prng.oneOf(gen: module:prng~PRNG, array: Array<T>): T
-

Returns one element of a given array.

-prng.uint8Array(gen: module:prng~PRNG, len: number): Uint8Array
-prng.uint16Array(gen: module:prng~PRNG, len: number): Uint16Array
-prng.uint32Array(gen: module:prng~PRNG, len: number): Uint32Array
-
-
-
[lib0/promise] Utility helpers to work with promises. -
import * as promise from 'lib0/promise'
-
-promise.create(f: function(PromiseResolve<T>,function(Error):void):any): Promise<T>
-promise.createEmpty(f: function(function():void,function(Error):void):void): Promise<void>
-promise.all(arrp: Array<Promise<T>>): Promise<Array<T>>
-

Promise.all wait for all promises in the array to resolve and return the result

-promise.reject(reason: Error): Promise<never>
-promise.resolve(res: T|void): Promise<T|void>
-promise.resolveWith(res: T): Promise<T>
-promise.until(timeout: number, check: function():boolean, intervalResolution: number): Promise<void>
-promise.wait(timeout: number): Promise<undefined>
-promise.isPromise(p: any): boolean
-

Checks if an object is a promise using ducktyping.

-

Promises are often polyfilled, so it makes sense to add some additional guarantees if the user of this -library has some insane environment where global Promise objects are overwritten.

-
-
-
[lib0/queue] -
import * as queue from 'lib0/queue'
-
-new de#QueueNode()
-de#next: module:queue.QueueNode|null
-new ueue()
-tart: module:queue.QueueNode | null
-nd: module:queue.QueueNode | null
-(): module:queue.Queue
-()
-(queue: module:queue.Queue)
-()
-(queue: module:queue.Queue, n: module:queue.QueueNode)
-()
-(queue: module:queue.Queue): module:queue.QueueNode | null
-()
-
-
-
[lib0/random] Isomorphic module for true random numbers / buffers / uuids. -
import * as random from 'lib0/random'
- -

Attention: falls back to Math.random if the browser does not support crypto.

-
-random.rand
-random.uint32
-random.uint53
-random.oneOf(arr: Array<T>): T
-random.uuidv4
-
-
-
[lib0/set] Utility module to work with sets. -
import * as set from 'lib0/set'
-
-set.create
-set.toArray(set: Set<T>): Array<T>
-set.first(set: Set<T>): T
-set.from(entries: Iterable<T>): Set<T>
-
-
-
[lib0/sort] Efficient sort implementations. -
import * as sort from 'lib0/sort'
- -

Note: These sort implementations were created to compare different sorting algorithms in JavaScript. -Don't use them if you don't know what you are doing. Native Array.sort is almost always a better choice.

-
-sort.insertionSort(arr: Array<T>, compare: function(T,T):number): void
-sort.quicksort(arr: Array<T>, compare: function(T,T):number): void
-

This algorithm beats Array.prototype.sort in Chrome only with arrays with 10 million entries. -In most cases [].sort will do just fine. Make sure to performance test your use-case before you -integrate this algorithm.

-

Note that Chrome's sort is now a stable algorithm (Timsort). Quicksort is not stable.

-
-
-
[lib0/statistics] Utility helpers for generating statistics. -
import * as statistics from 'lib0/statistics'
-
-statistics.median(arr: Array<number>): number
-statistics.average(arr: Array<number>): number
-
-
-
[lib0/storage] Isomorphic variable storage. -
import * as storage from 'lib0/storage'
- -

Uses LocalStorage in the browser and falls back to in-memory storage.

-
-storage.varStorage
-

This is basically localStorage in browser, or a polyfill in nodejs

-storage.onChange(eventHandler: function({ key: string, newValue: string, oldValue: string }): void)
-

A polyfill for addEventListener('storage', event => {..}) that does nothing if the polyfill is being used.

-
-
-
[lib0/string] Utility module to work with strings. -
import * as string from 'lib0/string'
-
-string.fromCharCode
-string.fromCodePoint
-string.trimLeft(s: string): string
-string.fromCamelCase(s: string, separator: string): string
-string.utf8ByteLength(str: string): number
-

Compute the utf8ByteLength

-string.utf8TextEncoder
-string.encodeUtf8
-string.decodeUtf8
-string.splice(str: string, index: number, remove: number, insert: string)
-
-
-
[lib0/symbol] Utility module to work with EcmaScript Symbols. -
import * as symbol from 'lib0/symbol'
-
-symbol.create(): Symbol
-

Return fresh symbol.

-symbol.isSymbol(s: any): boolean
-
-
-
[lib0/testing] Testing framework with support for generating tests. -
import * as testing from 'lib0/testing'
- -
// test.js template for creating a test executable
-import { runTests } from 'lib0/testing'
-import * as log from 'lib0/logging'
-import * as mod1 from './mod1.test.js'
-import * as mod2 from './mod2.test.js'
-import { isBrowser, isNode } from 'lib0/environment.js'
-
-if (isBrowser) {
-  // optional: if this is ran in the browser, attach a virtual console to the dom
-  log.createVConsole(document.body)
-}
-
-runTests({
- mod1,
- mod2,
-}).then(success => {
-  if (isNode) {
-    process.exit(success ? 0 : 1)
-  }
-})
-
-
// mod1.test.js
-/**
- * runTests automatically tests all exported functions that start with "test".
- * The name of the function should be in camelCase and is used for the logging output.
- *
- * @param {t.TestCase} tc
- *\/
-export const testMyFirstTest = tc => {
-  t.compare({ a: 4 }, { a: 4 }, 'objects are equal')
-}
-
-

Now you can simply run node test.js to run your test or run test.js in the browser.

-
-testing.extensive
-testing.envSeed
-new testing.TestCase(moduleName: string, testName: string)
-testing.TestCase#moduleName: string
-testing.TestCase#testName: string
-testing.TestCase#resetSeed()
-testing.TestCase#prng: prng.PRNG
-

A PRNG for this test case. Use only this PRNG for randomness to make the test case reproducible.

-testing.repetitionTime
-testing.run(moduleName: string, name: string, f: function(module:testing.TestCase):void|Promise<any>, i: number, numberOfTests: number)
-testing.describe(description: string, info: string)
-

Describe what you are currently testing. The message will be logged.

-
export const testMyFirstTest = tc => {
-  t.describe('crunching numbers', 'already crunched 4 numbers!') // the optional second argument can describe the state.
-}
-
-testing.info(info: string)
-

Describe the state of the current computation.

-
export const testMyFirstTest = tc => {
-  t.info(already crunched 4 numbers!') // the optional second argument can describe the state.
-}
-
-testing.printDom
-testing.printCanvas
-testing.group(description: string, f: function(void):void)
-

Group outputs in a collapsible category.

-
export const testMyFirstTest = tc => {
-  t.group('subtest 1', () => {
-    t.describe('this message is part of a collapsible section')
-  })
-  await t.groupAsync('subtest async 2', async () => {
-    await someaction()
-    t.describe('this message is part of a collapsible section')
-  })
-}
-
-testing.groupAsync(description: string, f: function(void):Promise<any>)
-

Group outputs in a collapsible category.

-
export const testMyFirstTest = async tc => {
-  t.group('subtest 1', () => {
-    t.describe('this message is part of a collapsible section')
-  })
-  await t.groupAsync('subtest async 2', async () => {
-    await someaction()
-    t.describe('this message is part of a collapsible section')
-  })
-}
-
-testing.measureTime(message: string, f: function():void): number
-

Measure the time that it takes to calculate something.

-
export const testMyFirstTest = async tc => {
-  t.measureTime('measurement', () => {
-    heavyCalculation()
-  })
-  await t.groupAsync('async measurement', async () => {
-    await heavyAsyncCalculation()
-  })
-}
-
-testing.measureTimeAsync(message: string, f: function():Promise<any>): Promise<number>
-

Measure the time that it takes to calculate something.

-
export const testMyFirstTest = async tc => {
-  t.measureTimeAsync('measurement', async () => {
-    await heavyCalculation()
-  })
-  await t.groupAsync('async measurement', async () => {
-    await heavyAsyncCalculation()
-  })
-}
-
-testing.compareArrays(as: Array<T>, bs: Array<T>, m: string): boolean
-testing.compareStrings(a: string, b: string, m: string)
-testing.compareObjects(a: Object<K,V>, b: Object<K,V>, m: string)
-testing.compare(a: T, b: T, message: string?, customCompare: function(any,T,T,string,any):boolean)
-testing.assert(condition: boolean, message: string?)
-testing.promiseRejected(f: function():Promise<any>)
-testing.fails(f: function():void)
-testing.runTests(tests: Object<string, Object<string, function(module:testing.TestCase):void|Promise<any>>>)
-testing.fail(reason: string)
-testing.skip(cond: boolean)
-
-
-
[lib0/time] Utility module to work with time. -
import * as time from 'lib0/time'
-
-time.getDate(): Date
-

Return current time.

-time.getUnixTime(): number
-

Return current unix time.

-time.humanizeDuration(d: number): string
-

Transform time (in ms) to a human readable format. E.g. 1100 => 1.1s. 60s => 1min. .001 => 10μs.

-
-
-
[lib0/tree] Red-black-tree implementation. -
import * as tree from 'lib0/tree'
-
-new tree.Tree()
-

This is a Red Black Tree implementation

-tree.Tree#findNext(id: K)
-tree.Tree#findPrev(id: K)
-tree.Tree#findNodeWithLowerBound(from: K)
-tree.Tree#findNodeWithUpperBound(to: K)
-tree.Tree#findSmallestNode(): V
-tree.Tree#findWithLowerBound(from: K): V
-tree.Tree#findWithUpperBound(to: K): V
-tree.Tree#iterate(from: K, from: K, f: K)
-tree.Tree#find(id: K): V|null
-tree.Tree#findNode(id: K): module:tree~N<V>|null
-tree.Tree#delete(id: K)
-tree.Tree#put()
-
-
-
[lib0/url] Utility module to work with urls. -
import * as url from 'lib0/url'
-
-url.decodeQueryParams(url: string): Object<string,string>
-

Parse query parameters from an url.

-url.encodeQueryParams(params: Object<string,string>): string
-
-
-
[lib0/webcrypto.browser] -
import * as webcrypto.browser from 'lib0/webcrypto.browser'
-
-
-()
-omValues
-omValues()
-
-
-
[lib0/webcrypto.node] -
import * as webcrypto.node from 'lib0/webcrypto.node'
-
-
-()
-to.subtle: any
-omValues
-omValues()
-
-
-
[lib0/websocket] Tiny websocket connection handler. -
import * as websocket from 'lib0/websocket'
- -

Implements exponential backoff reconnects, ping/pong, and a nice event system using [lib0/observable].

-
-new websocket.WebsocketClient(url: string, opts: object, opts.binaryType: 'arraybuffer' | 'blob' | null)
-websocket.WebsocketClient#ws: WebSocket?
-websocket.WebsocketClient#shouldConnect: boolean
-

Whether to connect to other peers or not

-websocket.WebsocketClient#send(message: any)
-websocket.WebsocketClient#destroy()
-websocket.WebsocketClient#disconnect()
-websocket.WebsocketClient#connect()
-
-
- -### React-Native support - -React-native apps should be able to use lib0. You need to install a polyfill for -webcrypto and enable package-exports support in react-native: - -```sh -# install polyfill -npm i isomorphic-webcrypto@^2.3.8 # last known working version was 2.3.8 -``` - -Add this to `metro.config.js` [(see docs)](https://reactnative.dev/blog/2023/06/21/package-exports-support): - -```js -const config = { - // ... - resolver: { - unstable_enablePackageExports: true - } -} -``` - -### License - -[The MIT License](./LICENSE) © Kevin Jahns diff --git a/yjs-poll/node_modules/lib0/array.d.ts b/yjs-poll/node_modules/lib0/array.d.ts deleted file mode 100644 index 4b2730c..0000000 --- a/yjs-poll/node_modules/lib0/array.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -export function last(arr: ArrayLike): L; -export function create(): Array; -export function copy(a: Array): Array; -export function appendTo(dest: Array, src: Array): void; -/** - * Transforms something array-like to an actual Array. - * - * @function - * @template T - * @param {ArrayLike|Iterable} arraylike - * @return {T} - */ -export const from: { - (arrayLike: ArrayLike): T_1[]; - (arrayLike: ArrayLike, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[]; - (iterable: Iterable | ArrayLike): T_1[]; - (iterable: Iterable | ArrayLike, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[]; -}; -export function every>(arr: ARR, f: ARR extends ArrayLike ? ((value: S, index: number, arr: ARR) => boolean) : any): boolean; -export function some>(arr: ARR, f: ARR extends ArrayLike ? ((value: S, index: number, arr: ARR) => boolean) : never): boolean; -export function equalFlat(a: ArrayLike, b: ArrayLike): boolean; -export function flatten(arr: Array>): Array; -export function unfold(len: number, f: (arg0: number, arg1: Array) => T_1): Array; -export function fold(arr: Array, seed: RESULT, folder: (arg0: RESULT, arg1: T_1, arg2: number) => RESULT): RESULT; -export const isArray: (arg: any) => arg is any[]; -export function unique(arr: Array): Array; -export function uniqueBy(arr: ArrayLike, mapper: (arg0: T_1) => M): Array; -export function map, MAPPER extends (arg0: ARR extends ArrayLike ? T_1 : never, arg1: number, arg2: ARR) => any>(arr: ARR, mapper: MAPPER): Array infer M ? M : never>; -export function bubblesortItem(arr: Array, i: number, compareFn: (a: T_1, b: T_1) => number): number; -//# sourceMappingURL=array.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/array.d.ts.map b/yjs-poll/node_modules/lib0/array.d.ts.map deleted file mode 100644 index 4fbdf26..0000000 --- a/yjs-poll/node_modules/lib0/array.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["array.js"],"names":[],"mappings":"AAeO,qBAJM,CAAC,OACH,SAAS,CAAC,CAAC,CAAC,GACX,CAAC,CAEiC;AAMvC,uBAHM,CAAC,KACF,KAAK,CAAC,CAAC,CAAC,CAEoC;AAOjD,qBAJM,CAAC,KACH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AAC,CAAC,CAE4B;AASzC,8BALM,CAAC,OACH,SAAS,CAAC,GAAC,CAAC,UACZ,CAAS,IAAC,EAAD,GAAC,KAAE,CAAC,GACZ,KAAK,CAAC,GAAC,CAAC,CAoBnB;AASM,oBANuB,GAAG,SAAnB,SAAS,CAAC,GAAG,CAAE,EACwD,MAAM,SAA9E,CAAU,IAA0C,EAA1C,GAAG,SAAS,SAAS,CAAC,MAAM,GAAC,CAAC,GAAG,GAAC,GAAG,KAAK,EAAE,IAAM,EAAN,MAAM,EAAE,IAAG,EAAH,GAAG,KAAE,GAAI,OACzE,GAAG,UACH,MAAM,GACL,KAAK,CAAC,MAAM,SAAS,IAAS,IAAM,EAAH,GAAG,EAAA,KAAG,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAWtE;AAoBM,yCAJI,KAAK,CAAC,GAAC,CAAC,KACR,MAAM,aACN,CAAC,CAAC,EAAC,GAAC,EAAC,CAAC,EAAC,GAAC,KAAK,MAAM,UAkB7B"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/array.js b/yjs-poll/node_modules/lib0/array.js deleted file mode 100644 index 5d9f2f2..0000000 --- a/yjs-poll/node_modules/lib0/array.js +++ /dev/null @@ -1,219 +0,0 @@ -/** - * Utility module to work with Arrays. - * - * @module array - */ - -import * as set from './set.js' - -/** - * Return the last element of an array. The element must exist - * - * @template L - * @param {ArrayLike} arr - * @return {L} - */ -export const last = arr => arr[arr.length - 1] - -/** - * @template C - * @return {Array} - */ -export const create = () => /** @type {Array} */ ([]) - -/** - * @template D - * @param {Array} a - * @return {Array} - */ -export const copy = a => /** @type {Array} */ (a.slice()) - -/** - * Append elements from src to dest - * - * @template M - * @param {Array} dest - * @param {Array} src - */ -export const appendTo = (dest, src) => { - for (let i = 0; i < src.length; i++) { - dest.push(src[i]) - } -} - -/** - * Transforms something array-like to an actual Array. - * - * @function - * @template T - * @param {ArrayLike|Iterable} arraylike - * @return {T} - */ -export const from = Array.from - -/** - * True iff condition holds on every element in the Array. - * - * @function - * @template {ArrayLike} ARR - * - * @param {ARR} arr - * @param {ARR extends ArrayLike ? ((value:S, index:number, arr:ARR) => boolean) : any} f - * @return {boolean} - */ -export const every = (arr, f) => { - for (let i = 0; i < arr.length; i++) { - if (!f(arr[i], i, arr)) { - return false - } - } - return true -} - -/** - * True iff condition holds on some element in the Array. - * - * @function - * @template {ArrayLike} ARR - * - * @param {ARR} arr - * @param {ARR extends ArrayLike ? ((value:S, index:number, arr:ARR) => boolean) : never} f - * @return {boolean} - */ -export const some = (arr, f) => { - for (let i = 0; i < arr.length; i++) { - if (f(arr[i], i, arr)) { - return true - } - } - return false -} - -/** - * @template ELEM - * - * @param {ArrayLike} a - * @param {ArrayLike} b - * @return {boolean} - */ -export const equalFlat = (a, b) => a.length === b.length && every(a, (item, index) => item === b[index]) - -/** - * @template ELEM - * @param {Array>} arr - * @return {Array} - */ -export const flatten = arr => fold(arr, /** @type {Array} */ ([]), (acc, val) => acc.concat(val)) - -/** - * @template T - * @param {number} len - * @param {function(number, Array):T} f - * @return {Array} - */ -export const unfold = (len, f) => { - const array = new Array(len) - for (let i = 0; i < len; i++) { - array[i] = f(i, array) - } - return array -} - -/** - * @template T - * @template RESULT - * @param {Array} arr - * @param {RESULT} seed - * @param {function(RESULT, T, number):RESULT} folder - */ -export const fold = (arr, seed, folder) => arr.reduce(folder, seed) - -export const isArray = Array.isArray - -/** - * @template T - * @param {Array} arr - * @return {Array} - */ -export const unique = arr => from(set.from(arr)) - -/** - * @template T - * @template M - * @param {ArrayLike} arr - * @param {function(T):M} mapper - * @return {Array} - */ -export const uniqueBy = (arr, mapper) => { - /** - * @type {Set} - */ - const happened = set.create() - /** - * @type {Array} - */ - const result = [] - for (let i = 0; i < arr.length; i++) { - const el = arr[i] - const mapped = mapper(el) - if (!happened.has(mapped)) { - happened.add(mapped) - result.push(el) - } - } - return result -} - -/** - * @template {ArrayLike} ARR - * @template {function(ARR extends ArrayLike ? T : never, number, ARR):any} MAPPER - * @param {ARR} arr - * @param {MAPPER} mapper - * @return {Array} - */ -export const map = (arr, mapper) => { - /** - * @type {Array} - */ - const res = Array(arr.length) - for (let i = 0; i < arr.length; i++) { - res[i] = mapper(/** @type {any} */ (arr[i]), i, /** @type {any} */ (arr)) - } - return /** @type {any} */ (res) -} - -/** - * This function bubble-sorts a single item to the correct position. The sort happens in-place and - * might be useful to ensure that a single item is at the correct position in an otherwise sorted - * array. - * - * @example - * const arr = [3, 2, 5] - * arr.sort((a, b) => a - b) - * arr // => [2, 3, 5] - * arr.splice(1, 0, 7) - * array.bubbleSortItem(arr, 1, (a, b) => a - b) - * arr // => [2, 3, 5, 7] - * - * @template T - * @param {Array} arr - * @param {number} i - * @param {(a:T,b:T) => number} compareFn - */ -export const bubblesortItem = (arr, i, compareFn) => { - const n = arr[i] - let j = i - // try to sort to the right - while (j + 1 < arr.length && compareFn(n, arr[j + 1]) > 0) { - arr[j] = arr[j + 1] - arr[++j] = n - } - if (i === j && j > 0) { // no change yet - // sort to the left - while (j > 0 && compareFn(arr[j - 1], n) > 0) { - arr[j] = arr[j - 1] - arr[--j] = n - } - } - return j -} diff --git a/yjs-poll/node_modules/lib0/array.test.d.ts b/yjs-poll/node_modules/lib0/array.test.d.ts deleted file mode 100644 index 4776afd..0000000 --- a/yjs-poll/node_modules/lib0/array.test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export function testIsarrayPerformance(_tc: t.TestCase): void; -export function testAppend(_tc: t.TestCase): void; -export function testBasic(_tc: t.TestCase): void; -export function testflatten(_tc: t.TestCase): void; -export function testFolding(_tc: t.TestCase): void; -export function testEvery(_tc: t.TestCase): void; -export function testIsArray(_tc: t.TestCase): void; -export function testUnique(_tc: t.TestCase): void; -export function testBubblesortItemEdgeCases(tc: t.TestCase): void; -export function testRepeatBubblesortItem(tc: t.TestCase): void; -export function testRepeatBubblesort(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=array.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/array.test.d.ts.map b/yjs-poll/node_modules/lib0/array.test.d.ts.map deleted file mode 100644 index ce900d0..0000000 --- a/yjs-poll/node_modules/lib0/array.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"array.test.d.ts","sourceRoot":"","sources":["array.test.js"],"names":[],"mappings":"AAOO,4CAFI,CAAC,CAAC,QAAQ,QAkCpB;AAKM,gCAFI,CAAC,CAAC,QAAQ,QAMpB;AAKM,+BAFI,CAAC,CAAC,QAAQ,QAMpB;AAKM,iCAFI,CAAC,CAAC,QAAQ,QAKpB;AAKM,iCAFI,CAAC,CAAC,QAAQ,QAkBpB;AAKM,+BAFI,CAAC,CAAC,QAAQ,QAQpB;AAKM,iCAFI,CAAC,CAAC,QAAQ,QASpB;AAKM,gCAFI,CAAC,CAAC,QAAQ,QAOpB;AAKM,gDAFI,CAAC,CAAC,QAAQ,QAOpB;AAKM,6CAFI,CAAC,CAAC,QAAQ,QAWpB;AAKM,yCAFI,CAAC,CAAC,QAAQ,QASpB;mBA1JkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/bin/0ecdsa-generate-keypair.d.ts b/yjs-poll/node_modules/lib0/bin/0ecdsa-generate-keypair.d.ts deleted file mode 100644 index 71a08e3..0000000 --- a/yjs-poll/node_modules/lib0/bin/0ecdsa-generate-keypair.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -export {}; -//# sourceMappingURL=0ecdsa-generate-keypair.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/bin/0ecdsa-generate-keypair.d.ts.map b/yjs-poll/node_modules/lib0/bin/0ecdsa-generate-keypair.d.ts.map deleted file mode 100644 index 4db84e1..0000000 --- a/yjs-poll/node_modules/lib0/bin/0ecdsa-generate-keypair.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"0ecdsa-generate-keypair.d.ts","sourceRoot":"","sources":["0ecdsa-generate-keypair.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/bin/0ecdsa-generate-keypair.js b/yjs-poll/node_modules/lib0/bin/0ecdsa-generate-keypair.js deleted file mode 100644 index d973ae9..0000000 --- a/yjs-poll/node_modules/lib0/bin/0ecdsa-generate-keypair.js +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env node -import * as ecdsa from 'lib0/crypto/ecdsa' -import * as json from 'lib0/json' -import * as env from 'lib0/environment' - -const prefix = env.getConf('name') - -const keypair = await ecdsa.generateKeyPair({ extractable: true }) -const privateJwk = json.stringify(await ecdsa.exportKeyJwk(keypair.privateKey)) -const publicJwk = json.stringify(await ecdsa.exportKeyJwk(keypair.publicKey)) - -console.log(` -${prefix ? prefix.toUpperCase() + '_' : ''}PUBLIC_KEY=${publicJwk} -${prefix ? prefix.toUpperCase() + '_' : ''}PRIVATE_KEY=${privateJwk} -`) diff --git a/yjs-poll/node_modules/lib0/bin/0serve.d.ts b/yjs-poll/node_modules/lib0/bin/0serve.d.ts deleted file mode 100644 index 97bafa4..0000000 --- a/yjs-poll/node_modules/lib0/bin/0serve.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -export {}; -//# sourceMappingURL=0serve.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/bin/0serve.d.ts.map b/yjs-poll/node_modules/lib0/bin/0serve.d.ts.map deleted file mode 100644 index 1d0eeab..0000000 --- a/yjs-poll/node_modules/lib0/bin/0serve.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"0serve.d.ts","sourceRoot":"","sources":["0serve.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/bin/0serve.js b/yjs-poll/node_modules/lib0/bin/0serve.js deleted file mode 100644 index a69d09b..0000000 --- a/yjs-poll/node_modules/lib0/bin/0serve.js +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env node - -/** - * Simple http server implementation. - * Optionally, you may set `DEBUG_BROWSER` environment variable to use a different browser to debug - * web apps. - */ - -import * as http from 'http' -import * as path from 'path' -import * as fs from 'fs' -import * as env from '../environment.js' -import * as number from '../number.js' -import * as logging from 'lib0/logging' - -const host = env.getParam('--host', 'localhost') -const port = number.parseInt(env.getParam('--port', '8000')) -const paramOpenFile = env.getParam('-o', '') -const debugBrowser = env.getConf('DEBUG_BROWSER') - -/** - * @type {Object} - */ -const types = { - html: 'text/html', - css: 'text/css', - js: 'application/javascript', - mjs: 'application/javascript', - png: 'image/png', - jpg: 'image/jpeg', - jpeg: 'image/jpeg', - gif: 'image/gif', - json: 'application/json', - xml: 'application/xml', - wasm: 'application/wasm' -} - -const root = path.normalize(path.resolve('./')) - -const server = http.createServer((req, res) => { - const url = (req.url || '/index.html').split('?')[0] - logging.print(logging.ORANGE, logging.BOLD, req.method || '', ' ', logging.GREY, logging.UNBOLD, url) - const extension = path.extname(url).slice(1) - /** - * @type {string} - */ - const type = (extension && types[extension]) || types.html - const supportedExtension = Boolean(type) - if (!supportedExtension) { - res.writeHead(404, { 'Content-Type': 'text/html' }) - res.end('404: File not found') - return - } - let fileName = url - if (url === '/') fileName = 'index.html' - else if (!extension) { - try { - fs.accessSync(path.join(root, url + '.html'), fs.constants.F_OK) - fileName = url + '.html' - } catch (e) { - fileName = path.join(url, 'index.html') - } - } - - const filePath = path.join(root, fileName) - const isPathUnderRoot = path - .normalize(path.resolve(filePath)) - .startsWith(root) - - if (!isPathUnderRoot) { - res.writeHead(404, { 'Content-Type': 'text/html' }) - res.end('404: File not found') - logging.print(logging.RED, logging.BOLD, 'Not Found: ', logging.GREY, logging.UNBOLD, url) - return - } - - fs.readFile(filePath, (err, data) => { - if (err) { - logging.print(logging.RED, logging.BOLD, 'Cannot read file: ', logging.GREY, logging.UNBOLD, url) - res.writeHead(404, { 'Content-Type': 'text/html' }) - res.end('404: File not found') - } else { - res.writeHead(200, { 'Content-Type': type }) - res.end(data) - } - }) -}) - -server.listen(port, host, () => { - logging.print(logging.BOLD, logging.ORANGE, `Server is running on http://${host}:${port}`) - if (paramOpenFile) { - const start = debugBrowser || (process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open') - import('child_process').then(cp => { - cp.exec(`${start} http://${host}:${port}/${paramOpenFile}`) - }) - } -}) diff --git a/yjs-poll/node_modules/lib0/bin/gendocs.d.ts b/yjs-poll/node_modules/lib0/bin/gendocs.d.ts deleted file mode 100644 index 422e119..0000000 --- a/yjs-poll/node_modules/lib0/bin/gendocs.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -export {}; -//# sourceMappingURL=gendocs.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/bin/gendocs.d.ts.map b/yjs-poll/node_modules/lib0/bin/gendocs.d.ts.map deleted file mode 100644 index 55ab940..0000000 --- a/yjs-poll/node_modules/lib0/bin/gendocs.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gendocs.d.ts","sourceRoot":"","sources":["gendocs.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/bin/gendocs.js b/yjs-poll/node_modules/lib0/bin/gendocs.js deleted file mode 100644 index ea9b624..0000000 --- a/yjs-poll/node_modules/lib0/bin/gendocs.js +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/env node -// @ts-ignore -import jsdoc from 'jsdoc-api' -import * as fs from 'fs' - -const firstTagContentRegex = /<\w>([^<]+)<\/\w>([^]*)/ -const jsdocReturnRegex = /\* @return {(.*)}/ -const jsdocTypeRegex = /\* @type {(.*)}/ - -const files = fs.readdirSync('./').filter(file => /(?/g -/** - * @param {string} s - */ -const toSafeHtml = s => s.replace(_ltregex, '<').replace(_rtregex, '>') - -const READMEcontent = fs.readFileSync('./README.md', 'utf8') - -jsdoc.explain({ - files, - configure: '.jsdoc.json' -}).then(/** @param {Array} json */ json => { - const strBuilder = [] - /** - * @type {Object, name: string, description: string }>} - */ - const modules = {} - json.forEach(item => { - if (item.meta && item.meta.filename) { - const mod = modules[item.meta.filename] || (modules[item.meta.filename] = { items: [], name: item.meta.filename.slice(0, -3), description: '' }) - if (item.kind === 'module') { - mod.name = item.name - mod.description = item.description || '' - } else { - mod.items.push(item) - } - } - }) - /** - * @type {Object} - */ - const classDescriptions = {} - for (const fileName in modules) { - const mod = modules[fileName] - const items = mod.items - const desc = firstTagContentRegex.exec(mod.description) - const descHead = desc ? desc[1] : '' - const descRest = desc ? desc[2] : '' - strBuilder.push(`
[lib0/${mod.name}] ${descHead}`) - strBuilder.push(`
import * as ${mod.name} from 'lib0/${fileName.slice(0, -3)}'
`) - if (descRest.length > 0) { - strBuilder.push(descRest) - } - strBuilder.push('
') - for (let i = 0; i < items.length; i++) { - const item = items[i] - if (!item.ignore && item.scope !== 'inner' && item.name[0] !== '_' && item.longname.indexOf('~') < 0) { - // strBuilder.push(JSON.stringify(item)) // output json for debugging - switch (item.kind) { - case 'class': { - if (item.params == null) { - classDescriptions[item.longname] = item.classdesc - break - } - } - // eslint-disable-next-line - case 'constant': { - if (item.params == null && item.returns == null) { - const typeEval = jsdocTypeRegex.exec(item.comment) - strBuilder.push(`${item.longname.slice(7)}${typeEval ? (': ' + toSafeHtml(typeEval[1])) : ''}
`) - if (item.description) { - strBuilder.push(`
${item.description}
`) - } - break - } - } - // eslint-disable-next-line - case 'function': { - /** - * @param {string} name - */ - const getOriginalParamTypeDecl = name => { - const regval = new RegExp('@param {(.*)} \\[?' + name + '\\]?[^\\w]*').exec(item.comment) - return regval ? regval[1] : null - } - if (item.params == null && item.returns == null) { - break - } - const paramVal = (item.params || []).map(/** @param {any} ret */ ret => `${ret.name}: ${getOriginalParamTypeDecl(ret.name) || ret.type.names.join('|')}`).join(', ') - const evalReturnRegex = jsdocReturnRegex.exec(item.comment) - const returnVal = evalReturnRegex ? `: ${evalReturnRegex[1]}` : (item.returns ? item.returns.map(/** @param {any} r */ r => r.type.names.join('|')).join('|') : '') - strBuilder.push(`${item.kind === 'class' ? 'new ' : ''}${item.longname.slice(7)}(${toSafeHtml(paramVal)})${toSafeHtml(returnVal)}
`) - const desc = item.description || item.classdesc || classDescriptions[item.longname] || null - if (desc) { - strBuilder.push(`
${desc}
`) - } - break - } - case 'member': { - if (item.type) { - strBuilder.push(`${item.longname.slice(7)}: ${toSafeHtml(/** @type {RegExpExecArray} */ (jsdocTypeRegex.exec(item.comment))[1])}
`) - if (item.description) { - strBuilder.push(`
${item.description}
`) - } - } - } - } - } - } - strBuilder.push('
') - strBuilder.push('
') - } - const replaceReadme = READMEcontent.replace(/
[^]*<\/details>/, strBuilder.join('\n')) - fs.writeFileSync('./README.md', replaceReadme) -}) diff --git a/yjs-poll/node_modules/lib0/bin/gentesthtml.d.ts b/yjs-poll/node_modules/lib0/bin/gentesthtml.d.ts deleted file mode 100644 index 39f067b..0000000 --- a/yjs-poll/node_modules/lib0/bin/gentesthtml.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -export {}; -//# sourceMappingURL=gentesthtml.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/bin/gentesthtml.d.ts.map b/yjs-poll/node_modules/lib0/bin/gentesthtml.d.ts.map deleted file mode 100644 index 95d65b1..0000000 --- a/yjs-poll/node_modules/lib0/bin/gentesthtml.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gentesthtml.d.ts","sourceRoot":"","sources":["gentesthtml.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/bin/gentesthtml.js b/yjs-poll/node_modules/lib0/bin/gentesthtml.js deleted file mode 100644 index 3c4a085..0000000 --- a/yjs-poll/node_modules/lib0/bin/gentesthtml.js +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env node -import * as fs from 'fs' -import * as object from '../object.js' -import * as env from '../environment.js' - -const script = env.getParam('--script', './test.js') -const includeDeps = env.getParam('--include-dependencies', '').split(',').filter(d => d.length) -const customImportsPath = env.getParam('--custom-imports', '') - -/** - * @type {Object} - */ -const exports = {} -/** - * @type {Object>} - */ -const scopes = {} - -/** - * @param {any} v - * @param {string} k - * @param {string} pkgName - * @param {string} pathPrefix - * @param {Object} importMap - */ -const extractModMap = (v, k, pkgName, pathPrefix, importMap) => { - if (k[0] !== '.') return - if (typeof v === 'object') { - extractModMap(v.browser || v.import || v.module || v.default, k, pkgName, pathPrefix, importMap) - } else if (v && v[0] === '.') { - importMap[pkgName + k.slice(1)] = pathPrefix + v.slice(1) - } -} - -/** - * @param {string} s - */ -const _maybeAddRelPrefix = s => (s[0] !== '.' ? './' : '') + s - -/** - * @param {any} pkgJson - * @param {string} pathPrefix - * @param {Object} importMap - */ -const readPkg = (pkgJson, pathPrefix, importMap) => { - if (pkgJson.exports == null && pkgJson.main != null) { - importMap[pkgJson.name] = pathPrefix + _maybeAddRelPrefix(pkgJson.main).slice(1) - } - object.forEach(pkgJson.exports, (v, k) => extractModMap(v, k, pkgJson.name, pathPrefix, importMap)) - object.forEach(pkgJson.dependencies, (_v, depName) => { - const nextImportMap = pathPrefix === '.' ? exports : (scopes[pathPrefix + '/'] || (scopes[pathPrefix + '/'] = {})) - const prefix = `./node_modules/${depName}` - const depPkgJson = JSON.parse(fs.readFileSync(prefix + '/package.json', { encoding: 'utf8' })) - readPkg(depPkgJson, prefix, nextImportMap) - }) -} - -const rootPkgJson = JSON.parse(fs.readFileSync('./package.json', { encoding: 'utf8' })) -readPkg(rootPkgJson, '.', exports) -includeDeps.forEach(depName => { - const prefix = `./node_modules/${depName}` - const depPkgJson = JSON.parse(fs.readFileSync(`${prefix}/package.json`, { encoding: 'utf8' })) - readPkg(depPkgJson, prefix, exports) -}) - -const customImports = {} -if (customImportsPath !== '') { - object.assign(customImports, JSON.parse(fs.readFileSync(customImportsPath, { encoding: 'utf8' }))) -} - -const testHtml = ` - - - - Testing ${rootPkgJson.name} - - - - - - -` - -console.log(testHtml) diff --git a/yjs-poll/node_modules/lib0/binary.d.ts b/yjs-poll/node_modules/lib0/binary.d.ts deleted file mode 100644 index 890f0c4..0000000 --- a/yjs-poll/node_modules/lib0/binary.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Binary data constants. - * - * @module binary - */ -/** - * n-th bit activated. - * - * @type {number} - */ -export const BIT1: number; -export const BIT2: 2; -export const BIT3: 4; -export const BIT4: 8; -export const BIT5: 16; -export const BIT6: 32; -export const BIT7: 64; -export const BIT8: 128; -export const BIT9: 256; -export const BIT10: 512; -export const BIT11: 1024; -export const BIT12: 2048; -export const BIT13: 4096; -export const BIT14: 8192; -export const BIT15: 16384; -export const BIT16: 32768; -export const BIT17: 65536; -export const BIT18: number; -export const BIT19: number; -export const BIT20: number; -export const BIT21: number; -export const BIT22: number; -export const BIT23: number; -export const BIT24: number; -export const BIT25: number; -export const BIT26: number; -export const BIT27: number; -export const BIT28: number; -export const BIT29: number; -export const BIT30: number; -export const BIT31: number; -export const BIT32: number; -/** - * First n bits activated. - * - * @type {number} - */ -export const BITS0: number; -export const BITS1: 1; -export const BITS2: 3; -export const BITS3: 7; -export const BITS4: 15; -export const BITS5: 31; -export const BITS6: 63; -export const BITS7: 127; -export const BITS8: 255; -export const BITS9: 511; -export const BITS10: 1023; -export const BITS11: 2047; -export const BITS12: 4095; -export const BITS13: 8191; -export const BITS14: 16383; -export const BITS15: 32767; -export const BITS16: 65535; -export const BITS17: number; -export const BITS18: number; -export const BITS19: number; -export const BITS20: number; -export const BITS21: number; -export const BITS22: number; -export const BITS23: number; -export const BITS24: number; -export const BITS25: number; -export const BITS26: number; -export const BITS27: number; -export const BITS28: number; -export const BITS29: number; -export const BITS30: number; -/** - * @type {number} - */ -export const BITS31: number; -/** - * @type {number} - */ -export const BITS32: number; -//# sourceMappingURL=binary.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/binary.d.ts.map b/yjs-poll/node_modules/lib0/binary.d.ts.map deleted file mode 100644 index 678cb8f..0000000 --- a/yjs-poll/node_modules/lib0/binary.d.ts.map +++ /dev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CAAA;AAC3B,qBAAsB,KAAK,CAAA;AAC3B,4BAA+B;AAC/B,4BAA+B;AAC/B,4BAA+B;AAC/B,4BAA+B;AAC/B,4BAA+B;AAC/B,4BAA+B;AAC/B,4BAA+B;AAC/B,4BAA+B;AAC/B,4BAA+B;AAC/B,4BAA+B;AAC/B,4BAA+B;AAC/B,4BAA+B;AAC/B,4BAA+B;AAC/B,4BAA+B;AAC/B;;GAEG;AACH,qBAFU,MAAM,CAEgB;AAChC;;GAEG;AACH,qBAFU,MAAM,CAEgB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/binary.js b/yjs-poll/node_modules/lib0/binary.js deleted file mode 100644 index babab55..0000000 --- a/yjs-poll/node_modules/lib0/binary.js +++ /dev/null @@ -1,90 +0,0 @@ -/* eslint-env browser */ - -/** - * Binary data constants. - * - * @module binary - */ - -/** - * n-th bit activated. - * - * @type {number} - */ -export const BIT1 = 1 -export const BIT2 = 2 -export const BIT3 = 4 -export const BIT4 = 8 -export const BIT5 = 16 -export const BIT6 = 32 -export const BIT7 = 64 -export const BIT8 = 128 -export const BIT9 = 256 -export const BIT10 = 512 -export const BIT11 = 1024 -export const BIT12 = 2048 -export const BIT13 = 4096 -export const BIT14 = 8192 -export const BIT15 = 16384 -export const BIT16 = 32768 -export const BIT17 = 65536 -export const BIT18 = 1 << 17 -export const BIT19 = 1 << 18 -export const BIT20 = 1 << 19 -export const BIT21 = 1 << 20 -export const BIT22 = 1 << 21 -export const BIT23 = 1 << 22 -export const BIT24 = 1 << 23 -export const BIT25 = 1 << 24 -export const BIT26 = 1 << 25 -export const BIT27 = 1 << 26 -export const BIT28 = 1 << 27 -export const BIT29 = 1 << 28 -export const BIT30 = 1 << 29 -export const BIT31 = 1 << 30 -export const BIT32 = 1 << 31 - -/** - * First n bits activated. - * - * @type {number} - */ -export const BITS0 = 0 -export const BITS1 = 1 -export const BITS2 = 3 -export const BITS3 = 7 -export const BITS4 = 15 -export const BITS5 = 31 -export const BITS6 = 63 -export const BITS7 = 127 -export const BITS8 = 255 -export const BITS9 = 511 -export const BITS10 = 1023 -export const BITS11 = 2047 -export const BITS12 = 4095 -export const BITS13 = 8191 -export const BITS14 = 16383 -export const BITS15 = 32767 -export const BITS16 = 65535 -export const BITS17 = BIT18 - 1 -export const BITS18 = BIT19 - 1 -export const BITS19 = BIT20 - 1 -export const BITS20 = BIT21 - 1 -export const BITS21 = BIT22 - 1 -export const BITS22 = BIT23 - 1 -export const BITS23 = BIT24 - 1 -export const BITS24 = BIT25 - 1 -export const BITS25 = BIT26 - 1 -export const BITS26 = BIT27 - 1 -export const BITS27 = BIT28 - 1 -export const BITS28 = BIT29 - 1 -export const BITS29 = BIT30 - 1 -export const BITS30 = BIT31 - 1 -/** - * @type {number} - */ -export const BITS31 = 0x7FFFFFFF -/** - * @type {number} - */ -export const BITS32 = 0xFFFFFFFF diff --git a/yjs-poll/node_modules/lib0/binary.test.d.ts b/yjs-poll/node_modules/lib0/binary.test.d.ts deleted file mode 100644 index 1c2e586..0000000 --- a/yjs-poll/node_modules/lib0/binary.test.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function testBitx(tc: t.TestCase): void; -export function testBitsx(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=binary.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/binary.test.d.ts.map b/yjs-poll/node_modules/lib0/binary.test.d.ts.map deleted file mode 100644 index cebb86f..0000000 --- a/yjs-poll/node_modules/lib0/binary.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"binary.test.d.ts","sourceRoot":"","sources":["binary.test.js"],"names":[],"mappings":"AAMO,6BAFI,CAAC,CAAC,QAAQ,QAOpB;AAKM,8BAFI,CAAC,CAAC,QAAQ,QAWpB;mBAxBkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/broadcastchannel.d.ts b/yjs-poll/node_modules/lib0/broadcastchannel.d.ts deleted file mode 100644 index d8f048e..0000000 --- a/yjs-poll/node_modules/lib0/broadcastchannel.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export function subscribe(room: string, f: (arg0: any, arg1: any) => any): (arg0: any, arg1: any) => any; -export function unsubscribe(room: string, f: (arg0: any, arg1: any) => any): boolean; -export function publish(room: string, data: any, origin?: any): void; -export type Channel = { - subs: Set<(arg0: any, arg1: any) => any>; - bc: any; -}; -//# sourceMappingURL=broadcastchannel.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/broadcastchannel.d.ts.map b/yjs-poll/node_modules/lib0/broadcastchannel.d.ts.map deleted file mode 100644 index 6508b47..0000000 --- a/yjs-poll/node_modules/lib0/broadcastchannel.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"broadcastchannel.d.ts","sourceRoot":"","sources":["broadcastchannel.js"],"names":[],"mappings":"AA+FO,gCAHI,MAAM,KACN,CAAS,IAAG,EAAH,GAAG,EAAE,IAAG,EAAH,GAAG,KAAE,GAAG,UAAb,GAAG,QAAE,GAAG,KAAE,GAAG,CAKhC;AASM,kCAHI,MAAM,KACN,CAAS,IAAG,EAAH,GAAG,EAAE,IAAG,EAAH,GAAG,KAAE,GAAG,WAUhC;AAUM,8BAJI,MAAM,QACN,GAAG,WACH,GAAG,QAMb;;UAvGa,GAAG,CAAC,CAAS,IAAG,EAAH,GAAG,EAAE,IAAG,EAAH,GAAG,KAAE,GAAG,CAAC;QAC3B,GAAG"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/broadcastchannel.js b/yjs-poll/node_modules/lib0/broadcastchannel.js deleted file mode 100644 index 327f2d1..0000000 --- a/yjs-poll/node_modules/lib0/broadcastchannel.js +++ /dev/null @@ -1,130 +0,0 @@ -/* eslint-env browser */ - -/** - * Helpers for cross-tab communication using broadcastchannel with LocalStorage fallback. - * - * ```js - * // In browser window A: - * broadcastchannel.subscribe('my events', data => console.log(data)) - * broadcastchannel.publish('my events', 'Hello world!') // => A: 'Hello world!' fires synchronously in same tab - * - * // In browser window B: - * broadcastchannel.publish('my events', 'hello from tab B') // => A: 'hello from tab B' - * ``` - * - * @module broadcastchannel - */ - -// @todo before next major: use Uint8Array instead as buffer object - -import * as map from './map.js' -import * as set from './set.js' -import * as buffer from './buffer.js' -import * as storage from './storage.js' - -/** - * @typedef {Object} Channel - * @property {Set} Channel.subs - * @property {any} Channel.bc - */ - -/** - * @type {Map} - */ -const channels = new Map() - -/* c8 ignore start */ -class LocalStoragePolyfill { - /** - * @param {string} room - */ - constructor (room) { - this.room = room - /** - * @type {null|function({data:Uint8Array}):void} - */ - this.onmessage = null - /** - * @param {any} e - */ - this._onChange = e => e.key === room && this.onmessage !== null && this.onmessage({ data: buffer.fromBase64(e.newValue || '') }) - storage.onChange(this._onChange) - } - - /** - * @param {ArrayBuffer} buf - */ - postMessage (buf) { - storage.varStorage.setItem(this.room, buffer.toBase64(buffer.createUint8ArrayFromArrayBuffer(buf))) - } - - close () { - storage.offChange(this._onChange) - } -} -/* c8 ignore stop */ - -// Use BroadcastChannel or Polyfill -/* c8 ignore next */ -const BC = typeof BroadcastChannel === 'undefined' ? LocalStoragePolyfill : BroadcastChannel - -/** - * @param {string} room - * @return {Channel} - */ -const getChannel = room => - map.setIfUndefined(channels, room, () => { - const subs = set.create() - const bc = new BC(room) - /** - * @param {{data:ArrayBuffer}} e - */ - /* c8 ignore next */ - bc.onmessage = e => subs.forEach(sub => sub(e.data, 'broadcastchannel')) - return { - bc, subs - } - }) - -/** - * Subscribe to global `publish` events. - * - * @function - * @param {string} room - * @param {function(any, any):any} f - */ -export const subscribe = (room, f) => { - getChannel(room).subs.add(f) - return f -} - -/** - * Unsubscribe from `publish` global events. - * - * @function - * @param {string} room - * @param {function(any, any):any} f - */ -export const unsubscribe = (room, f) => { - const channel = getChannel(room) - const unsubscribed = channel.subs.delete(f) - if (unsubscribed && channel.subs.size === 0) { - channel.bc.close() - channels.delete(room) - } - return unsubscribed -} - -/** - * Publish data to all subscribers (including subscribers on this tab) - * - * @function - * @param {string} room - * @param {any} data - * @param {any} [origin] - */ -export const publish = (room, data, origin = null) => { - const c = getChannel(room) - c.bc.postMessage(data) - c.subs.forEach(sub => sub(data, origin)) -} diff --git a/yjs-poll/node_modules/lib0/broadcastchannel.test.d.ts b/yjs-poll/node_modules/lib0/broadcastchannel.test.d.ts deleted file mode 100644 index a746c1d..0000000 --- a/yjs-poll/node_modules/lib0/broadcastchannel.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testBroadcastChannel(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=broadcastchannel.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/broadcastchannel.test.d.ts.map b/yjs-poll/node_modules/lib0/broadcastchannel.test.d.ts.map deleted file mode 100644 index 50ebd67..0000000 --- a/yjs-poll/node_modules/lib0/broadcastchannel.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"broadcastchannel.test.d.ts","sourceRoot":"","sources":["broadcastchannel.test.js"],"names":[],"mappings":"AAMO,yCAFI,CAAC,CAAC,QAAQ,QAkBpB;mBAtBkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/buffer.d.ts b/yjs-poll/node_modules/lib0/buffer.d.ts deleted file mode 100644 index 2f27c30..0000000 --- a/yjs-poll/node_modules/lib0/buffer.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -export function createUint8ArrayFromLen(len: number): Uint8Array; -export function createUint8ArrayViewFromArrayBuffer(buffer: ArrayBuffer, byteOffset: number, length: number): Uint8Array; -export function createUint8ArrayFromArrayBuffer(buffer: ArrayBuffer): Uint8Array; -/** - * @param {Uint8Array} bytes - * @return {string} - */ -export function toBase64(bytes: Uint8Array): string; -/** - * @param {string} s - * @return {Uint8Array} - */ -export function fromBase64(s: string): Uint8Array; -export function toBase64UrlEncoded(buf: Uint8Array): string; -export function fromBase64UrlEncoded(base64: string): Uint8Array; -export function toHexString(buf: Uint8Array): string; -export function fromHexString(hex: string): Uint8Array; -export function copyUint8Array(uint8Array: Uint8Array): Uint8Array; -export function encodeAny(data: any): Uint8Array; -export function decodeAny(buf: Uint8Array): any; -export function shiftNBitsLeft(bs: Uint8Array, N: number): Uint8Array; -//# sourceMappingURL=buffer.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/buffer.d.ts.map b/yjs-poll/node_modules/lib0/buffer.d.ts.map deleted file mode 100644 index efa7de2..0000000 --- a/yjs-poll/node_modules/lib0/buffer.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["buffer.js"],"names":[],"mappings":"AAgBO,6CAFI,MAAM,2BAEgD;AAS1D,4DAJI,WAAW,cACX,MAAM,UACN,MAAM,2BAE4G;AAOtH,wDAFI,WAAW,2BAEyD;AAG/E;;;GAGG;AACH,gCAHW,UAAU,GACT,MAAM,CASjB;AAUD;;;GAGG;AACH,8BAHW,MAAM,GACL,UAAU,CAAC,WAAW,CAAC,CAUlC;AAqBM,wCAFI,UAAU,UAE+F;AAK7G,6CAFI,MAAM,2BAEyF;AAOnG,iCAFI,UAAU,UAE0E;AAOxF,mCAFI,MAAM,2BAShB;AAQM,2CAHI,UAAU,GACT,UAAU,CAMrB;AASM,gCAHI,GAAG,GACF,UAAU,CAGwC;AAQvD,+BAHI,UAAU,GACT,GAAG,CAE8D;AAQtE,mCAHI,UAAU,KACV,MAAM,+BAWhB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/buffer.js b/yjs-poll/node_modules/lib0/buffer.js deleted file mode 100644 index 375fe7c..0000000 --- a/yjs-poll/node_modules/lib0/buffer.js +++ /dev/null @@ -1,163 +0,0 @@ -/** - * Utility functions to work with buffers (Uint8Array). - * - * @module buffer - */ - -import * as string from './string.js' -import * as env from './environment.js' -import * as array from './array.js' -import * as math from './math.js' -import * as encoding from './encoding.js' -import * as decoding from './decoding.js' - -/** - * @param {number} len - */ -export const createUint8ArrayFromLen = len => new Uint8Array(len) - -/** - * Create Uint8Array with initial content from buffer - * - * @param {ArrayBuffer} buffer - * @param {number} byteOffset - * @param {number} length - */ -export const createUint8ArrayViewFromArrayBuffer = (buffer, byteOffset, length) => new Uint8Array(buffer, byteOffset, length) - -/** - * Create Uint8Array with initial content from buffer - * - * @param {ArrayBuffer} buffer - */ -export const createUint8ArrayFromArrayBuffer = buffer => new Uint8Array(buffer) - -/* c8 ignore start */ -/** - * @param {Uint8Array} bytes - * @return {string} - */ -const toBase64Browser = bytes => { - let s = '' - for (let i = 0; i < bytes.byteLength; i++) { - s += string.fromCharCode(bytes[i]) - } - // eslint-disable-next-line no-undef - return btoa(s) -} -/* c8 ignore stop */ - -/** - * @param {Uint8Array} bytes - * @return {string} - */ -const toBase64Node = bytes => Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString('base64') - -/* c8 ignore start */ -/** - * @param {string} s - * @return {Uint8Array} - */ -const fromBase64Browser = s => { - // eslint-disable-next-line no-undef - const a = atob(s) - const bytes = createUint8ArrayFromLen(a.length) - for (let i = 0; i < a.length; i++) { - bytes[i] = a.charCodeAt(i) - } - return bytes -} -/* c8 ignore stop */ - -/** - * @param {string} s - */ -const fromBase64Node = s => { - const buf = Buffer.from(s, 'base64') - return createUint8ArrayViewFromArrayBuffer(buf.buffer, buf.byteOffset, buf.byteLength) -} - -/* c8 ignore next */ -export const toBase64 = env.isBrowser ? toBase64Browser : toBase64Node - -/* c8 ignore next */ -export const fromBase64 = env.isBrowser ? fromBase64Browser : fromBase64Node - -/** - * Implements base64url - see https://datatracker.ietf.org/doc/html/rfc4648#section-5 - * @param {Uint8Array} buf - */ -export const toBase64UrlEncoded = buf => toBase64(buf).replaceAll('+', '-').replaceAll('/', '_').replaceAll('=', '') - -/** - * @param {string} base64 - */ -export const fromBase64UrlEncoded = base64 => fromBase64(base64.replaceAll('-', '+').replaceAll('_', '/')) - -/** - * Base64 is always a more efficient choice. This exists for utility purposes only. - * - * @param {Uint8Array} buf - */ -export const toHexString = buf => array.map(buf, b => b.toString(16).padStart(2, '0')).join('') - -/** - * Note: This function expects that the hex doesn't start with 0x.. - * - * @param {string} hex - */ -export const fromHexString = hex => { - const hlen = hex.length - const buf = new Uint8Array(math.ceil(hlen / 2)) - for (let i = 0; i < hlen; i += 2) { - buf[buf.length - i / 2 - 1] = Number.parseInt(hex.slice(hlen - i - 2, hlen - i), 16) - } - return buf -} - -/** - * Copy the content of an Uint8Array view to a new ArrayBuffer. - * - * @param {Uint8Array} uint8Array - * @return {Uint8Array} - */ -export const copyUint8Array = uint8Array => { - const newBuf = createUint8ArrayFromLen(uint8Array.byteLength) - newBuf.set(uint8Array) - return newBuf -} - -/** - * Encode anything as a UInt8Array. It's a pun on typescripts's `any` type. - * See encoding.writeAny for more information. - * - * @param {any} data - * @return {Uint8Array} - */ -export const encodeAny = data => - encoding.encode(encoder => encoding.writeAny(encoder, data)) - -/** - * Decode an any-encoded value. - * - * @param {Uint8Array} buf - * @return {any} - */ -export const decodeAny = buf => decoding.readAny(decoding.createDecoder(buf)) - -/** - * Shift Byte Array {N} bits to the left. Does not expand byte array. - * - * @param {Uint8Array} bs - * @param {number} N should be in the range of [0-7] - */ -export const shiftNBitsLeft = (bs, N) => { - if (N === 0) return bs - bs = new Uint8Array(bs) - bs[0] <<= N - for (let i = 1; i < bs.length; i++) { - bs[i - 1] |= bs[i] >>> (8 - N) - bs[i] <<= N - } - return bs -} diff --git a/yjs-poll/node_modules/lib0/buffer.test.d.ts b/yjs-poll/node_modules/lib0/buffer.test.d.ts deleted file mode 100644 index 0bd7014..0000000 --- a/yjs-poll/node_modules/lib0/buffer.test.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export function testRepeatBase64urlEncoding(tc: t.TestCase): void; -export function testRepeatBase64Encoding(tc: t.TestCase): void; -export function testRepeatHexEncoding(tc: t.TestCase): void; -export function testAnyEncoding(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=buffer.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/buffer.test.d.ts.map b/yjs-poll/node_modules/lib0/buffer.test.d.ts.map deleted file mode 100644 index 5305916..0000000 --- a/yjs-poll/node_modules/lib0/buffer.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"buffer.test.d.ts","sourceRoot":"","sources":["buffer.test.js"],"names":[],"mappings":"AA2BO,gDAFI,CAAC,CAAC,QAAQ,QAIpB;AAKM,6CAFI,CAAC,CAAC,QAAQ,QAIpB;AAKM,0CAFI,CAAC,CAAC,QAAQ,QAIpB;AAKM,qCAFI,CAAC,CAAC,QAAQ,QAMpB;mBApDkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/cache.d.ts b/yjs-poll/node_modules/lib0/cache.d.ts deleted file mode 100644 index 3317bc2..0000000 --- a/yjs-poll/node_modules/lib0/cache.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @template K, V - */ -export class Cache { - /** - * @param {number} timeout - */ - constructor(timeout: number); - timeout: number; - /** - * @type list.List> - */ - _q: list.List>; - /** - * @type {Map>} - */ - _map: Map>; -} -export function removeStale(cache: Cache): number; -export function set(cache: Cache, key: K, value: V): void; -export function get(cache: Cache, key: K): V | undefined; -export function refreshTimeout(cache: Cache, key: K): void; -export function getAsync(cache: Cache, key: K): V | Promise | undefined; -export function remove(cache: Cache, key: K): NonNullable | undefined; -export function setIfUndefined(cache: Cache, key: K, init: () => Promise, removeNull?: boolean): Promise | V; -export function create(timeout: number): Cache; -import * as list from './list.js'; -/** - * @template K, V - * - * @implements {list.ListNode} - */ -declare class Entry implements list.ListNode { - /** - * @param {K} key - * @param {V | Promise} val - */ - constructor(key: K, val: V | Promise); - /** - * @type {this | null} - */ - prev: this | null; - /** - * @type {this | null} - */ - next: this | null; - created: number; - val: V | Promise; - key: K; -} -export {}; -//# sourceMappingURL=cache.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/cache.d.ts.map b/yjs-poll/node_modules/lib0/cache.d.ts.map deleted file mode 100644 index 527a9dd..0000000 --- a/yjs-poll/node_modules/lib0/cache.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["cache.js"],"names":[],"mappings":"AAqCA;;GAEG;AACH,mBAFa,CAAC,EAAE,CAAC;IAGf;;OAEG;IACH,qBAFW,MAAM,EAYhB;IATC,gBAAsB;IACtB;;OAEG;IACH,IAFS,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAER;IACvB;;OAEG;IACH,MAFU,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAEL;CAE3B;AAQM,4BALM,CAAC,EAAE,CAAC,SAEN,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GACV,MAAM,CAUjB;AASM,oBANM,CAAC,EAAE,CAAC,SAEN,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,OACX,CAAC,SACD,CAAC,QAgBX;AAwBM,oBANM,CAAC,EAAE,CAAC,SAEN,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,OACX,CAAC,GACA,CAAC,GAAG,SAAS,CAKxB;AAQM,+BALM,CAAC,EAAE,CAAC,SAEN,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,OACX,CAAC,QAWX;AAYM,yBANM,CAAC,EAAE,CAAC,SAEN,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,OACX,CAAC,GACA,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,CAKrC;AAQM,uBALM,CAAC,EAAE,CAAC,SAEN,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,OACX,CAAC,8BASX;AAWM,+BARM,CAAC,EAAE,CAAC,SAEN,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,OACX,CAAC,QACD,MAAW,OAAO,CAAC,CAAC,CAAC,eACrB,OAAO,GACN,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAuBzB;AAKM,gCAFI,MAAM,mBAEkC;sBArM7B,WAAW;AAIjC;;;;GAIG;AACH,oBAJa,CAAC,EAAE,CAAC,aAED,IAAI,CAAC,QAAQ;IAG3B;;;OAGG;IACH,iBAHW,CAAC,OACD,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAcxB;IAXC;;OAEG;IACH,MAFU,IAAI,GAAG,IAAI,CAEL;IAChB;;OAEG;IACH,MAFU,IAAI,GAAG,IAAI,CAEL;IAChB,gBAAiC;IACjC,oBAAc;IACd,OAAc;CAEjB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/cache.js b/yjs-poll/node_modules/lib0/cache.js deleted file mode 100644 index 6bb716a..0000000 --- a/yjs-poll/node_modules/lib0/cache.js +++ /dev/null @@ -1,206 +0,0 @@ -/* eslint-env browser */ - -/** - * An implementation of a map which has keys that expire. - * - * @module cache - */ - -import * as list from './list.js' -import * as map from './map.js' -import * as time from './time.js' - -/** - * @template K, V - * - * @implements {list.ListNode} - */ -class Entry { - /** - * @param {K} key - * @param {V | Promise} val - */ - constructor (key, val) { - /** - * @type {this | null} - */ - this.prev = null - /** - * @type {this | null} - */ - this.next = null - this.created = time.getUnixTime() - this.val = val - this.key = key - } -} - -/** - * @template K, V - */ -export class Cache { - /** - * @param {number} timeout - */ - constructor (timeout) { - this.timeout = timeout - /** - * @type list.List> - */ - this._q = list.create() - /** - * @type {Map>} - */ - this._map = map.create() - } -} - -/** - * @template K, V - * - * @param {Cache} cache - * @return {number} Returns the current timestamp - */ -export const removeStale = cache => { - const now = time.getUnixTime() - const q = cache._q - while (q.start && now - q.start.created > cache.timeout) { - cache._map.delete(q.start.key) - list.popFront(q) - } - return now -} - -/** - * @template K, V - * - * @param {Cache} cache - * @param {K} key - * @param {V} value - */ -export const set = (cache, key, value) => { - const now = removeStale(cache) - const q = cache._q - const n = cache._map.get(key) - if (n) { - list.removeNode(q, n) - list.pushEnd(q, n) - n.created = now - n.val = value - } else { - const node = new Entry(key, value) - list.pushEnd(q, node) - cache._map.set(key, node) - } -} - -/** - * @template K, V - * - * @param {Cache} cache - * @param {K} key - * @return {Entry | undefined} - */ -const getNode = (cache, key) => { - removeStale(cache) - const n = cache._map.get(key) - if (n) { - return n - } -} - -/** - * @template K, V - * - * @param {Cache} cache - * @param {K} key - * @return {V | undefined} - */ -export const get = (cache, key) => { - const n = getNode(cache, key) - return n && !(n.val instanceof Promise) ? n.val : undefined -} - -/** - * @template K, V - * - * @param {Cache} cache - * @param {K} key - */ -export const refreshTimeout = (cache, key) => { - const now = time.getUnixTime() - const q = cache._q - const n = cache._map.get(key) - if (n) { - list.removeNode(q, n) - list.pushEnd(q, n) - n.created = now - } -} - -/** - * Works well in conjunktion with setIfUndefined which has an async init function. - * Using getAsync & setIfUndefined ensures that the init function is only called once. - * - * @template K, V - * - * @param {Cache} cache - * @param {K} key - * @return {V | Promise | undefined} - */ -export const getAsync = (cache, key) => { - const n = getNode(cache, key) - return n ? n.val : undefined -} - -/** - * @template K, V - * - * @param {Cache} cache - * @param {K} key - */ -export const remove = (cache, key) => { - const n = cache._map.get(key) - if (n) { - list.removeNode(cache._q, n) - cache._map.delete(key) - return n.val && !(n.val instanceof Promise) ? n.val : undefined - } -} - -/** - * @template K, V - * - * @param {Cache} cache - * @param {K} key - * @param {function():Promise} init - * @param {boolean} removeNull Optional argument that automatically removes values that resolve to null/undefined from the cache. - * @return {Promise | V} - */ -export const setIfUndefined = (cache, key, init, removeNull = false) => { - removeStale(cache) - const q = cache._q - const n = cache._map.get(key) - if (n) { - return n.val - } else { - const p = init() - const node = new Entry(key, p) - list.pushEnd(q, node) - cache._map.set(key, node) - p.then(v => { - if (p === node.val) { - node.val = v - } - if (removeNull && v == null) { - remove(cache, key) - } - }) - return p - } -} - -/** - * @param {number} timeout - */ -export const create = timeout => new Cache(timeout) diff --git a/yjs-poll/node_modules/lib0/cache.test.d.ts b/yjs-poll/node_modules/lib0/cache.test.d.ts deleted file mode 100644 index 693e0d4..0000000 --- a/yjs-poll/node_modules/lib0/cache.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testCache(tc: t.TestCase): Promise; -import * as t from './testing.js'; -//# sourceMappingURL=cache.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/cache.test.d.ts.map b/yjs-poll/node_modules/lib0/cache.test.d.ts.map deleted file mode 100644 index 62478d6..0000000 --- a/yjs-poll/node_modules/lib0/cache.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cache.test.d.ts","sourceRoot":"","sources":["cache.test.js"],"names":[],"mappings":"AAOO,8BAFI,CAAC,CAAC,QAAQ,iBA6EpB;mBAlFkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/component.d.ts b/yjs-poll/node_modules/lib0/component.d.ts deleted file mode 100644 index 8108665..0000000 --- a/yjs-poll/node_modules/lib0/component.d.ts +++ /dev/null @@ -1,86 +0,0 @@ -/** - * @type {CustomElementRegistry} - */ -export const registry: CustomElementRegistry; -export function define(name: string, constr: any, opts?: ElementDefinitionOptions): void; -export function whenDefined(name: string): Promise; -/** - * @template S - */ -export class Lib0Component extends HTMLElement { - /** - * @param {S} [state] - */ - constructor(state?: S); - /** - * @type {S|null} - */ - state: S | null; - /** - * @type {any} - */ - _internal: any; - /** - * @param {S} _state - * @param {boolean} [_forceStateUpdate] Force that the state is rerendered even if state didn't change - */ - setState(_state: S, _forceStateUpdate?: boolean): void; - /** - * @param {any} _stateUpdate - */ - updateState(_stateUpdate: any): void; -} -export function createComponent(name: string, { template, style, state: defaultState, onStateChange, childStates, attrs, listeners, slots }: CONF): typeof Lib0Component; -export function createComponentDefiner(definer: Function): () => any; -export function defineListComponent(): any; -export function defineLazyLoadingComponent(): any; -export type CONF = { - /** - * Template for the shadow dom. - */ - template?: string | null | undefined; - /** - * shadow dom style. Is only used when - * `CONF.template` is defined - */ - style?: string | undefined; - /** - * Initial component state. - */ - state?: S | undefined; - /** - * Called when - * the state changes. - */ - onStateChange?: ((arg0: S, arg1: S | null, arg2: Lib0Component) => void) | undefined; - /** - * maps from - * CSS-selector to transformer function. The first element that matches the - * CSS-selector receives state updates via the transformer function. - */ - childStates?: { - [x: string]: (arg0: any, arg1: any) => Object; - } | undefined; - /** - * attrs-keys and state-keys should be camelCase, but the DOM uses kebap-case. I.e. - * `attrs = { myAttr: 4 }` is represeted as `` in the DOM - */ - attrs?: { - [x: string]: "string" | "number" | "json" | "bool"; - } | undefined; - /** - * Maps from dom-event-name - * to event listener. - */ - listeners?: { - [x: string]: (arg0: CustomEvent, arg1: Lib0Component) => boolean | void; - } | undefined; - /** - * Fill slots - * automatically when state changes. Maps from slot-name to slot-html. - */ - slots?: ((arg0: S, arg1: S, arg2: Lib0Component) => { - [x: string]: string; - }) | undefined; -}; -//# sourceMappingURL=component.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/component.d.ts.map b/yjs-poll/node_modules/lib0/component.d.ts.map deleted file mode 100644 index 88f5a5d..0000000 --- a/yjs-poll/node_modules/lib0/component.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["component.js"],"names":[],"mappings":"AAiBA;;GAEG;AACH,uBAFU,qBAAqB,CAEO;AAO/B,6BAJI,MAAM,UACN,GAAG,SACH,wBAAwB,QAE8C;AAM1E,kCAHI,MAAM,GACL,OAAO,CAAC,wBAAwB,CAAC,CAEgB;AAM7D;;GAEG;AACH,2BAFa,CAAC;IAGZ;;OAEG;IACH,oBAFW,CAAC,EAYX;IARC;;OAEG;IACH,OAFU,CAAC,GAAC,IAAI,CAEuB;IACvC;;OAEG;IACH,WAFU,GAAG,CAEM;IAGrB;;;OAGG;IACH,iBAHW,CAAC,sBACD,OAAO,QAE4B;IAE9C;;QAEI;IACJ,0BAFY,GAAG,QAEe;CAC/B;AA6DM,gCALM,CAAC,QACH,MAAM,iGACN,IAAI,CAAC,CAAC,CAAC,GACN,OAAO,aAAa,CAuM/B;AAKM,qEAWN;AANQ,2CAKN;AALM,kDAKN;iBA9OU,CAAC;;;;;;;;;;;;;;;;;;4BAMS,CAAC,QAAC,CAAC,GAAC,IAAI,QAAC,aAAa,CAAC,CAAC,CAAC,KAAE,IAAI;;;;;;;4BAEjB,GAAG,QAAE,GAAG,KAAE,MAAM;;;;;;;;;;;;;;4BAMf,WAAW,QAAE,aAAa,CAAC,GAAG,CAAC,KAAE,OAAO,GAAC,IAAI;;;;;;oBAE5D,CAAC,QAAE,CAAC,QAAE,aAAa,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/component.js b/yjs-poll/node_modules/lib0/component.js deleted file mode 100644 index 1f851f2..0000000 --- a/yjs-poll/node_modules/lib0/component.js +++ /dev/null @@ -1,414 +0,0 @@ -/* eslint-env browser */ - -/** - * Web components. - * - * @module component - */ - -import * as dom from './dom.js' -import * as diff from './diff.js' -import * as object from './object.js' -import * as json from './json.js' -import * as string from './string.js' -import * as array from './array.js' -import * as number from './number.js' -import * as func from './function.js' - -/** - * @type {CustomElementRegistry} - */ -export const registry = customElements - -/** - * @param {string} name - * @param {any} constr - * @param {ElementDefinitionOptions} [opts] - */ -export const define = (name, constr, opts) => registry.define(name, constr, opts) - -/** - * @param {string} name - * @return {Promise} - */ -export const whenDefined = name => registry.whenDefined(name) - -const upgradedEventName = 'upgraded' -const connectedEventName = 'connected' -const disconnectedEventName = 'disconnected' - -/** - * @template S - */ -export class Lib0Component extends HTMLElement { - /** - * @param {S} [state] - */ - constructor (state) { - super() - /** - * @type {S|null} - */ - this.state = /** @type {any} */ (state) - /** - * @type {any} - */ - this._internal = {} - } - - /** - * @param {S} _state - * @param {boolean} [_forceStateUpdate] Force that the state is rerendered even if state didn't change - */ - setState (_state, _forceStateUpdate = true) {} - - /** - * @param {any} _stateUpdate - */ - updateState (_stateUpdate) { } -} - -/** - * @param {any} val - * @param {"json"|"string"|"number"} type - * @return {string} - */ -const encodeAttrVal = (val, type) => { - if (type === 'json') { - val = json.stringify(val) - } - return val + '' -} - -/** - * @param {any} val - * @param {"json"|"string"|"number"|"bool"} type - * @return {any} - */ -const parseAttrVal = (val, type) => { - switch (type) { - case 'json': - return json.parse(val) - case 'number': - return Number.parseFloat(val) - case 'string': - return val - case 'bool': - return val != null - default: - return null - } -} - -/** - * @template S - * @typedef {Object} CONF - * @property {string?} [CONF.template] Template for the shadow dom. - * @property {string} [CONF.style] shadow dom style. Is only used when - * `CONF.template` is defined - * @property {S} [CONF.state] Initial component state. - * @property {function(S,S|null,Lib0Component):void} [CONF.onStateChange] Called when - * the state changes. - * @property {Object} [CONF.childStates] maps from - * CSS-selector to transformer function. The first element that matches the - * CSS-selector receives state updates via the transformer function. - * @property {Object} [CONF.attrs] - * attrs-keys and state-keys should be camelCase, but the DOM uses kebap-case. I.e. - * `attrs = { myAttr: 4 }` is represeted as `` in the DOM - * @property {Object):boolean|void>} [CONF.listeners] Maps from dom-event-name - * to event listener. - * @property {function(S, S, Lib0Component):Object} [CONF.slots] Fill slots - * automatically when state changes. Maps from slot-name to slot-html. - */ - -/** - * @template T - * @param {string} name - * @param {CONF} cnf - * @return {typeof Lib0Component} - */ -export const createComponent = (name, { template, style = '', state: defaultState, onStateChange = () => {}, childStates = { }, attrs = {}, listeners = {}, slots = () => ({}) }) => { - /** - * Maps from camelCase attribute name to kebap-case attribute name. - * @type {Object} - */ - const normalizedAttrs = {} - for (const key in attrs) { - normalizedAttrs[string.fromCamelCase(key, '-')] = key - } - const templateElement = template - ? /** @type {HTMLTemplateElement} */ (dom.parseElement(` - - `)) - : null - - class _Lib0Component extends HTMLElement { - /** - * @param {T} [state] - */ - constructor (state) { - super() - /** - * @type {Array<{d:Lib0Component, s:function(any, any):Object}>} - */ - this._childStates = [] - /** - * @type {Object} - */ - this._slots = {} - this._init = false - /** - * @type {any} - */ - this._internal = {} - /** - * @type {any} - */ - this.state = state || null - this.connected = false - // init shadow dom - if (templateElement) { - const shadow = /** @type {ShadowRoot} */ (this.attachShadow({ mode: 'open' })) - shadow.appendChild(templateElement.content.cloneNode(true)) - // fill child states - for (const key in childStates) { - this._childStates.push({ - d: /** @type {Lib0Component} */ (dom.querySelector(/** @type {any} */ (shadow), key)), - s: childStates[key] - }) - } - } - dom.emitCustomEvent(this, upgradedEventName, { bubbles: true }) - } - - connectedCallback () { - this.connected = true - if (!this._init) { - this._init = true - const shadow = this.shadowRoot - if (shadow) { - dom.addEventListener(shadow, upgradedEventName, event => { - this.setState(this.state, true) - event.stopPropagation() - }) - } - /** - * @type {Object} - */ - const startState = this.state || object.assign({}, defaultState) - if (attrs) { - for (const key in attrs) { - const normalizedKey = string.fromCamelCase(key, '-') - const val = parseAttrVal(this.getAttribute(normalizedKey), attrs[key]) - if (val) { - startState[key] = val - } - } - } - // add event listeners - for (const key in listeners) { - dom.addEventListener(shadow || this, key, event => { - if (listeners[key](/** @type {CustomEvent} */ (event), this) !== false) { - event.stopPropagation() - event.preventDefault() - return false - } - }) - } - // first setState call - this.state = null - this.setState(startState) - } - dom.emitCustomEvent(/** @type {any} */ (this.shadowRoot || this), connectedEventName, { bubbles: true }) - } - - disconnectedCallback () { - this.connected = false - dom.emitCustomEvent(/** @type {any} */ (this.shadowRoot || this), disconnectedEventName, { bubbles: true }) - this.setState(null) - } - - static get observedAttributes () { - return object.keys(normalizedAttrs) - } - - /** - * @param {string} name - * @param {string} oldVal - * @param {string} newVal - * - * @private - */ - attributeChangedCallback (name, oldVal, newVal) { - const curState = /** @type {any} */ (this.state) - const camelAttrName = normalizedAttrs[name] - const type = attrs[camelAttrName] - const parsedVal = parseAttrVal(newVal, type) - if (curState && (type !== 'json' || json.stringify(curState[camelAttrName]) !== newVal) && curState[camelAttrName] !== parsedVal && !number.isNaN(parsedVal)) { - this.updateState({ [camelAttrName]: parsedVal }) - } - } - - /** - * @param {any} stateUpdate - */ - updateState (stateUpdate) { - this.setState(object.assign({}, this.state, stateUpdate)) - } - - /** - * @param {any} state - */ - setState (state, forceStateUpdates = false) { - const prevState = this.state - this.state = state - if (this._init && (!func.equalityFlat(state, prevState) || forceStateUpdates)) { - // fill slots - if (state) { - const slotElems = slots(state, prevState, this) - for (const key in slotElems) { - const slotContent = slotElems[key] - if (this._slots[key] !== slotContent) { - this._slots[key] = slotContent - const currentSlots = /** @type {Array} */ (key !== 'default' ? array.from(dom.querySelectorAll(this, `[slot="${key}"]`)) : array.from(this.childNodes).filter(/** @param {any} child */ child => !dom.checkNodeType(child, dom.ELEMENT_NODE) || !child.hasAttribute('slot'))) - currentSlots.slice(1).map(dom.remove) - const nextSlot = dom.parseFragment(slotContent) - if (key !== 'default') { - array.from(nextSlot.children).forEach(c => c.setAttribute('slot', key)) - } - if (currentSlots.length > 0) { - dom.replaceWith(currentSlots[0], nextSlot) - } else { - dom.appendChild(this, nextSlot) - } - } - } - } - onStateChange(state, prevState, this) - if (state != null) { - this._childStates.forEach(cnf => { - const d = cnf.d - if (d.updateState) { - d.updateState(cnf.s(state, this)) - } - }) - } - for (const key in attrs) { - const normalizedKey = string.fromCamelCase(key, '-') - if (state == null) { - this.removeAttribute(normalizedKey) - } else { - const stateVal = state[key] - const attrsType = attrs[key] - if (!prevState || prevState[key] !== stateVal) { - if (attrsType === 'bool') { - if (stateVal) { - this.setAttribute(normalizedKey, '') - } else { - this.removeAttribute(normalizedKey) - } - } else if (stateVal == null && (attrsType === 'string' || attrsType === 'number')) { - this.removeAttribute(normalizedKey) - } else { - this.setAttribute(normalizedKey, encodeAttrVal(stateVal, attrsType)) - } - } - } - } - } - } - } - define(name, _Lib0Component) - // @ts-ignore - return _Lib0Component -} - -/** - * @param {function} definer function that defines a component when executed - */ -export const createComponentDefiner = definer => { - /** - * @type {any} - */ - let defined = null - return () => { - if (!defined) { - defined = definer() - } - return defined - } -} - -export const defineListComponent = createComponentDefiner(() => { - const ListItem = createComponent('lib0-list-item', { - template: '', - slots: state => ({ - content: `
${state}
` - }) - }) - return createComponent('lib0-list', { - state: { list: /** @type {Array} */ ([]), Item: ListItem }, - onStateChange: (state, prevState, component) => { - if (state == null) { - return - } - const { list = /** @type {Array} */ ([]), Item = ListItem } = state - // @todo deep compare here by providing another parameter to simpleDiffArray - let { index, remove, insert } = diff.simpleDiffArray(prevState ? prevState.list : [], list, func.equalityFlat) - if (remove === 0 && insert.length === 0) { - return - } - let child = /** @type {Lib0Component} */ (component.firstChild) - while (index-- > 0) { - child = /** @type {Lib0Component} */ (child.nextElementSibling) - } - let insertStart = 0 - while (insertStart < insert.length && remove-- > 0) { - // update existing state - child.setState(insert[insertStart++]) - child = /** @type {Lib0Component} */ (child.nextElementSibling) - } - while (remove-- > 0) { - // remove remaining - const prevChild = child - child = /** @type {Lib0Component} */ (child.nextElementSibling) - component.removeChild(prevChild) - } - // insert remaining - component.insertBefore(dom.fragment(insert.slice(insertStart).map(/** @param {any} insState */ insState => { - const el = new Item() - el.setState(insState) - return el - })), child) - } - }) -}) - -export const defineLazyLoadingComponent = createComponentDefiner(() => createComponent('lib0-lazy', { - state: /** @type {{component:null|String,import:null|function():Promise,state:null|object}} */ ({ - component: null, import: null, state: null - }), - attrs: { - component: 'string' - }, - onStateChange: ({ component, state, import: getImport }, prevState, componentEl) => { - if (component !== null) { - if (getImport) { - getImport() - } - if (!prevState || component !== prevState.component) { - const el = /** @type {any} */ (dom.createElement(component)) - componentEl.innerHTML = '' - componentEl.insertBefore(el, null) - } - const el = /** @type {any} */ (componentEl.firstElementChild) - // @todo generalize setting state and check if setState is defined - if (el.setState) { - el.setState(state) - } - } - } -})) diff --git a/yjs-poll/node_modules/lib0/conditions.d.ts b/yjs-poll/node_modules/lib0/conditions.d.ts deleted file mode 100644 index 0ed4306..0000000 --- a/yjs-poll/node_modules/lib0/conditions.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export function undefinedToNull(v: T | null | undefined): T | null; -//# sourceMappingURL=conditions.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/conditions.d.ts.map b/yjs-poll/node_modules/lib0/conditions.d.ts.map deleted file mode 100644 index 0f764ef..0000000 --- a/yjs-poll/node_modules/lib0/conditions.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"conditions.d.ts","sourceRoot":"","sources":["conditions.js"],"names":[],"mappings":"AAYO,gCALM,CAAC,KACH,CAAC,GAAC,IAAI,GAAC,SAAS,GACf,CAAC,GAAC,IAAI,CAG4C"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/conditions.js b/yjs-poll/node_modules/lib0/conditions.js deleted file mode 100644 index f348e8a..0000000 --- a/yjs-poll/node_modules/lib0/conditions.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Often used conditions. - * - * @module conditions - */ - -/** - * @template T - * @param {T|null|undefined} v - * @return {T|null} - */ -/* c8 ignore next */ -export const undefinedToNull = v => v === undefined ? null : v diff --git a/yjs-poll/node_modules/lib0/coverage/tmp/coverage-70359-1766561372098-0.json b/yjs-poll/node_modules/lib0/coverage/tmp/coverage-70359-1766561372098-0.json deleted file mode 100644 index 925f2ae..0000000 --- a/yjs-poll/node_modules/lib0/coverage/tmp/coverage-70359-1766561372098-0.json +++ /dev/null @@ -1 +0,0 @@ -{"result":[{"scriptId":"3","url":"node:internal/per_context/primordials","functions":[{"functionName":"SafeIterator","ranges":[{"startOffset":9162,"endOffset":9233,"count":3}],"isBlockCoverage":false},{"functionName":"next","ranges":[{"startOffset":9238,"endOffset":9287,"count":77}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":9292,"endOffset":9337,"count":2}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":10902,"endOffset":10969,"count":1}],"isBlockCoverage":false},{"functionName":"SafeMap","ranges":[{"startOffset":11627,"endOffset":11655,"count":2}],"isBlockCoverage":false},{"functionName":"SafeSet","ranges":[{"startOffset":11956,"endOffset":11984,"count":3}],"isBlockCoverage":false},{"functionName":"SafeFinalizationRegistry","ranges":[{"startOffset":12408,"endOffset":12464,"count":3}],"isBlockCoverage":false},{"functionName":"SafeWeakRef","ranges":[{"startOffset":12617,"endOffset":12655,"count":10}],"isBlockCoverage":false}]},{"scriptId":"6","url":"node:internal/bootstrap/realm","functions":[{"functionName":"internalBinding","ranges":[{"startOffset":6003,"endOffset":6265,"count":17}],"isBlockCoverage":false},{"functionName":"allowRequireByUsers","ranges":[{"startOffset":8452,"endOffset":8813,"count":1}],"isBlockCoverage":false},{"functionName":"canBeRequiredByUsers","ranges":[{"startOffset":9498,"endOffset":9573,"count":2}],"isBlockCoverage":false},{"functionName":"canBeRequiredWithoutScheme","ranges":[{"startOffset":9584,"endOffset":9678,"count":2}],"isBlockCoverage":false},{"functionName":"normalizeRequirableId","ranges":[{"startOffset":9689,"endOffset":10034,"count":1}],"isBlockCoverage":false},{"functionName":"getCanBeRequiredByUsersWithoutSchemeList","ranges":[{"startOffset":10297,"endOffset":10406,"count":1}],"isBlockCoverage":false},{"functionName":"compileForPublicLoader","ranges":[{"startOffset":10564,"endOffset":11227,"count":1}],"isBlockCoverage":false},{"functionName":"compileForInternalLoader","ranges":[{"startOffset":12509,"endOffset":13331,"count":162}],"isBlockCoverage":false},{"functionName":"requireBuiltin","ranges":[{"startOffset":13526,"endOffset":13891,"count":162}],"isBlockCoverage":false}]},{"scriptId":"7","url":"node:internal/errors","functions":[{"functionName":"defaultPrepareStackTrace","ranges":[{"startOffset":2323,"endOffset":2790,"count":1}],"isBlockCoverage":false},{"functionName":"setInternalPrepareStackTrace","ranges":[{"startOffset":2792,"endOffset":2883,"count":1}],"isBlockCoverage":false},{"functionName":"prepareStackTraceCallback","ranges":[{"startOffset":3709,"endOffset":4840,"count":1}],"isBlockCoverage":false},{"functionName":"ErrorPrepareStackTrace","ranges":[{"startOffset":4905,"endOffset":5004,"count":1}],"isBlockCoverage":false},{"functionName":"lazyInternalUtilInspect","ranges":[{"startOffset":6520,"endOffset":6648,"count":1}],"isBlockCoverage":false},{"functionName":"lazyUtilColors","ranges":[{"startOffset":6666,"endOffset":6766,"count":1}],"isBlockCoverage":false},{"functionName":"wrappedFn","ranges":[{"startOffset":14711,"endOffset":14917,"count":26}],"isBlockCoverage":false},{"functionName":"beforeInspector","ranges":[{"startOffset":24308,"endOffset":24699,"count":1}],"isBlockCoverage":false},{"functionName":"afterInspector","ranges":[{"startOffset":24703,"endOffset":25986,"count":1}],"isBlockCoverage":false}]},{"scriptId":"8","url":"node:internal/assert","functions":[{"functionName":"assert","ranges":[{"startOffset":128,"endOffset":278,"count":4}],"isBlockCoverage":false}]},{"scriptId":"9","url":"node:internal/bootstrap/node","functions":[{"functionName":"get","ranges":[{"startOffset":3830,"endOffset":3880,"count":1}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":3886,"endOffset":3944,"count":2}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":4128,"endOffset":4547,"count":2}],"isBlockCoverage":false}]},{"scriptId":"11","url":"node:internal/async_hooks","functions":[{"functionName":"clearDefaultTriggerAsyncId","ranges":[{"startOffset":15287,"endOffset":15376,"count":1}],"isBlockCoverage":false}]},{"scriptId":"12","url":"node:internal/validators","functions":[{"functionName":"","ranges":[{"startOffset":2438,"endOffset":2819,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":4381,"endOffset":4493,"count":20}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":5898,"endOffset":6012,"count":3}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":6594,"endOffset":7613,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":13109,"endOffset":13225,"count":1}],"isBlockCoverage":false}]},{"scriptId":"13","url":"node:internal/util","functions":[{"functionName":"isError","ranges":[{"startOffset":2012,"endOffset":2262,"count":1}],"isBlockCoverage":false},{"functionName":"exposeInterface","ranges":[{"startOffset":16386,"endOffset":16606,"count":1}],"isBlockCoverage":false},{"functionName":"defineLazyProperties","ranges":[{"startOffset":17105,"endOffset":18038,"count":2}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":17324,"endOffset":17467,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":17570,"endOffset":17766,"count":0}],"isBlockCoverage":false},{"functionName":"defineReplaceableLazyAttribute","ranges":[{"startOffset":18040,"endOffset":18940,"count":2}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":18252,"endOffset":18488,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":18593,"endOffset":18664,"count":0}],"isBlockCoverage":false},{"functionName":"exposeLazyInterfaces","ranges":[{"startOffset":18942,"endOffset":19042,"count":2}],"isBlockCoverage":false},{"functionName":"setOwnProperty","ranges":[{"startOffset":20237,"endOffset":20427,"count":3}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":22375,"endOffset":22503,"count":2}],"isBlockCoverage":false},{"functionName":"setupCoverageHooks","ranges":[{"startOffset":22631,"endOffset":23308,"count":1}],"isBlockCoverage":false},{"functionName":"guessHandleType","ranges":[{"startOffset":23381,"endOffset":23478,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":23500,"endOffset":24086,"count":10}],"isBlockCoverage":false},{"functionName":"WeakReference","ranges":[{"startOffset":23617,"endOffset":23684,"count":10}],"isBlockCoverage":false},{"functionName":"incRef","ranges":[{"startOffset":23688,"endOffset":23906,"count":0}],"isBlockCoverage":false},{"functionName":"decRef","ranges":[{"startOffset":23910,"endOffset":24038,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":24042,"endOffset":24084,"count":0}],"isBlockCoverage":false}]},{"scriptId":"14","url":"node:internal/options","functions":[{"functionName":"getCLIOptionsFromBinding","ranges":[{"startOffset":495,"endOffset":582,"count":63}],"isBlockCoverage":false},{"functionName":"getEmbedderOptions","ranges":[{"startOffset":671,"endOffset":766,"count":6}],"isBlockCoverage":false},{"functionName":"refreshOptions","ranges":[{"startOffset":768,"endOffset":824,"count":1}],"isBlockCoverage":false},{"functionName":"getOptionValue","ranges":[{"startOffset":826,"endOffset":914,"count":63}],"isBlockCoverage":false}]},{"scriptId":"18","url":"node:internal/util/inspect","functions":[{"functionName":"inspect","ranges":[{"startOffset":9465,"endOffset":11491,"count":1}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":11602,"endOffset":11647,"count":1}],"isBlockCoverage":false},{"functionName":"isInstanceof","ranges":[{"startOffset":17811,"endOffset":17929,"count":1}],"isBlockCoverage":false},{"functionName":"getConstructorName","ranges":[{"startOffset":18668,"endOffset":20421,"count":1}],"isBlockCoverage":false},{"functionName":"getKeys","ranges":[{"startOffset":22960,"endOffset":23951,"count":1}],"isBlockCoverage":false},{"functionName":"filter","ranges":[{"startOffset":23791,"endOffset":23847,"count":0}],"isBlockCoverage":false},{"functionName":"formatValue","ranges":[{"startOffset":24850,"endOffset":27650,"count":1}],"isBlockCoverage":false},{"functionName":"formatRaw","ranges":[{"startOffset":27652,"endOffset":38746,"count":1}],"isBlockCoverage":false},{"functionName":"getStackString","ranges":[{"startOffset":42648,"endOffset":42869,"count":1}],"isBlockCoverage":false},{"functionName":"getStackFrames","ranges":[{"startOffset":42871,"endOffset":43767,"count":1}],"isBlockCoverage":false},{"functionName":"improveStack","ranges":[{"startOffset":43866,"endOffset":45254,"count":1}],"isBlockCoverage":false},{"functionName":"removeDuplicateErrorKeys","ranges":[{"startOffset":45256,"endOffset":45730,"count":1}],"isBlockCoverage":false},{"functionName":"formatError","ranges":[{"startOffset":47335,"endOffset":49727,"count":1}],"isBlockCoverage":false}]},{"scriptId":"19","url":"node:internal/util/debuglog","functions":[{"functionName":"initializeDebugEnv","ranges":[{"startOffset":832,"endOffset":1305,"count":1}],"isBlockCoverage":false},{"functionName":"testEnabled","ranges":[{"startOffset":1199,"endOffset":1256,"count":0}],"isBlockCoverage":false},{"functionName":"testEnabled","ranges":[{"startOffset":1287,"endOffset":1298,"count":3}],"isBlockCoverage":false},{"functionName":"emitWarningIfNeeded","ranges":[{"startOffset":1379,"endOffset":1718,"count":1}],"isBlockCoverage":false},{"functionName":"noop","ranges":[{"startOffset":1733,"endOffset":1741,"count":2}],"isBlockCoverage":false},{"functionName":"debuglogImpl","ranges":[{"startOffset":1862,"endOffset":2426,"count":2}],"isBlockCoverage":false},{"functionName":"debug","ranges":[{"startOffset":2051,"endOffset":2344,"count":0}],"isBlockCoverage":false},{"functionName":"debuglog","ranges":[{"startOffset":2646,"endOffset":3672,"count":1}],"isBlockCoverage":false},{"functionName":"init","ranges":[{"startOffset":2677,"endOffset":2773,"count":2}],"isBlockCoverage":false},{"functionName":"debug","ranges":[{"startOffset":2788,"endOffset":3182,"count":2}],"isBlockCoverage":false},{"functionName":"test","ranges":[{"startOffset":3212,"endOffset":3281,"count":0}],"isBlockCoverage":false},{"functionName":"logger","ranges":[{"startOffset":3300,"endOffset":3495,"count":2}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":3566,"endOffset":3600,"count":0}],"isBlockCoverage":false},{"functionName":"ensureTimerFlagsAreUpdated","ranges":[{"startOffset":9664,"endOffset":9817,"count":1}],"isBlockCoverage":false},{"functionName":"internalEndTimer","ranges":[{"startOffset":10204,"endOffset":10532,"count":1}],"isBlockCoverage":false},{"functionName":"init","ranges":[{"startOffset":10920,"endOffset":11418,"count":1}],"isBlockCoverage":false},{"functionName":"startTimer","ranges":[{"startOffset":11477,"endOffset":11627,"count":1}],"isBlockCoverage":false}]},{"scriptId":"22","url":"node:events","functions":[{"functionName":"EventEmitter","ranges":[{"startOffset":6589,"endOffset":6658,"count":1}],"isBlockCoverage":false},{"functionName":"checkListener","ranges":[{"startOffset":8109,"endOffset":8187,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":9985,"endOffset":10633,"count":1}],"isBlockCoverage":false},{"functionName":"emit","ranges":[{"startOffset":13430,"endOffset":15722,"count":4}],"isBlockCoverage":false},{"functionName":"_addListener","ranges":[{"startOffset":15725,"endOffset":17641,"count":1}],"isBlockCoverage":false},{"functionName":"addListener","ranges":[{"startOffset":17819,"endOffset":17911,"count":1}],"isBlockCoverage":false},{"functionName":"arrayClone","ranges":[{"startOffset":25312,"endOffset":25785,"count":1}],"isBlockCoverage":false}]},{"scriptId":"24","url":"node:buffer","functions":[{"functionName":"get","ranges":[{"startOffset":8399,"endOffset":8427,"count":1}],"isBlockCoverage":false}]},{"scriptId":"25","url":"node:internal/buffer","functions":[{"functionName":"reconnectZeroFillToggle","ranges":[{"startOffset":31899,"endOffset":31971,"count":1}],"isBlockCoverage":false}]},{"scriptId":"26","url":"node:internal/worker/js_transferable","functions":[{"functionName":"markTransferMode","ranges":[{"startOffset":2750,"endOffset":3148,"count":1}],"isBlockCoverage":false}]},{"scriptId":"28","url":"node:internal/process/per_thread","functions":[{"functionName":"toggleTraceCategoryState","ranges":[{"startOffset":12288,"endOffset":12571,"count":1}],"isBlockCoverage":false}]},{"scriptId":"30","url":"node:internal/process/promises","functions":[{"functionName":"","ranges":[{"startOffset":1335,"endOffset":1447,"count":1}],"isBlockCoverage":false}]},{"scriptId":"34","url":"node:internal/process/execution","functions":[{"functionName":"tryGetCwd","ranges":[{"startOffset":1136,"endOffset":1466,"count":2}],"isBlockCoverage":false},{"functionName":"evalScript","ranges":[{"startOffset":2178,"endOffset":3231,"count":1}],"isBlockCoverage":false},{"functionName":"evalFunction","ranges":[{"startOffset":2657,"endOffset":3092,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":4938,"endOffset":6489,"count":1}],"isBlockCoverage":false},{"functionName":"compileScript","ranges":[{"startOffset":13914,"endOffset":14707,"count":1}],"isBlockCoverage":false},{"functionName":"importModuleDynamically","ranges":[{"startOffset":14006,"endOffset":14253,"count":0}],"isBlockCoverage":false},{"functionName":"shouldUseModuleEntryPoint","ranges":[{"startOffset":14907,"endOffset":15181,"count":1}],"isBlockCoverage":false},{"functionName":"createModule","ranges":[{"startOffset":15330,"endOffset":15602,"count":1}],"isBlockCoverage":false},{"functionName":"runScriptInContext","ranges":[{"startOffset":16115,"endOffset":17042,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":16648,"endOffset":16836,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":16934,"endOffset":16966,"count":0}],"isBlockCoverage":false}]},{"scriptId":"35","url":"node:path","functions":[{"functionName":"isPosixPathSeparator","ranges":[{"startOffset":2070,"endOffset":2147,"count":293}],"isBlockCoverage":false},{"functionName":"normalizeString","ranges":[{"startOffset":2382,"endOffset":4330,"count":8}],"isBlockCoverage":false},{"functionName":"resolve","ranges":[{"startOffset":36644,"endOffset":37748,"count":7}],"isBlockCoverage":false},{"functionName":"normalize","ranges":[{"startOffset":37814,"endOffset":38427,"count":1}],"isBlockCoverage":false},{"functionName":"join","ranges":[{"startOffset":38719,"endOffset":39083,"count":1}],"isBlockCoverage":false},{"functionName":"dirname","ranges":[{"startOffset":41741,"endOffset":42417,"count":3}],"isBlockCoverage":false}]},{"scriptId":"36","url":"node:internal/url","functions":[{"functionName":"","ranges":[{"startOffset":3563,"endOffset":4335,"count":1}],"isBlockCoverage":false},{"functionName":"get hasPort","ranges":[{"startOffset":4114,"endOffset":4179,"count":0}],"isBlockCoverage":false},{"functionName":"get hasSearch","ranges":[{"startOffset":4183,"endOffset":4258,"count":0}],"isBlockCoverage":false},{"functionName":"get hasHash","ranges":[{"startOffset":4262,"endOffset":4333,"count":0}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":22444,"endOffset":33908,"count":1}],"isBlockCoverage":false},{"functionName":"setURLSearchParamsModified","ranges":[{"startOffset":22564,"endOffset":23052,"count":0}],"isBlockCoverage":false},{"functionName":"URL","ranges":[{"startOffset":23061,"endOffset":23966,"count":1}],"isBlockCoverage":false},{"functionName":"parse","ranges":[{"startOffset":23977,"endOffset":24219,"count":0}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":24223,"endOffset":24943,"count":0}],"isBlockCoverage":false},{"functionName":"#getSearchFromContext","ranges":[{"startOffset":24947,"endOffset":25281,"count":0}],"isBlockCoverage":false},{"functionName":"#getSearchFromParams","ranges":[{"startOffset":25285,"endOffset":25396,"count":0}],"isBlockCoverage":false},{"functionName":"#ensureSearchParamsUpdated","ranges":[{"startOffset":25400,"endOffset":25839,"count":1}],"isBlockCoverage":false},{"functionName":"#updateContext","ranges":[{"startOffset":26087,"endOffset":27732,"count":1}],"isBlockCoverage":false},{"functionName":"toString","ranges":[{"startOffset":27736,"endOffset":27921,"count":0}],"isBlockCoverage":false},{"functionName":"get href","ranges":[{"startOffset":27925,"endOffset":28110,"count":1}],"isBlockCoverage":false},{"functionName":"set href","ranges":[{"startOffset":28114,"endOffset":28333,"count":0}],"isBlockCoverage":false},{"functionName":"get origin","ranges":[{"startOffset":28351,"endOffset":29220,"count":0}],"isBlockCoverage":false},{"functionName":"get protocol","ranges":[{"startOffset":29224,"endOffset":29328,"count":0}],"isBlockCoverage":false},{"functionName":"set protocol","ranges":[{"startOffset":29332,"endOffset":29505,"count":0}],"isBlockCoverage":false},{"functionName":"get username","ranges":[{"startOffset":29509,"endOffset":29736,"count":0}],"isBlockCoverage":false},{"functionName":"set username","ranges":[{"startOffset":29740,"endOffset":29913,"count":0}],"isBlockCoverage":false},{"functionName":"get password","ranges":[{"startOffset":29917,"endOffset":30140,"count":0}],"isBlockCoverage":false},{"functionName":"set password","ranges":[{"startOffset":30144,"endOffset":30317,"count":0}],"isBlockCoverage":false},{"functionName":"get host","ranges":[{"startOffset":30321,"endOffset":30752,"count":0}],"isBlockCoverage":false},{"functionName":"set host","ranges":[{"startOffset":30756,"endOffset":30921,"count":0}],"isBlockCoverage":false},{"functionName":"get hostname","ranges":[{"startOffset":30925,"endOffset":31207,"count":0}],"isBlockCoverage":false},{"functionName":"set hostname","ranges":[{"startOffset":31211,"endOffset":31384,"count":0}],"isBlockCoverage":false},{"functionName":"get port","ranges":[{"startOffset":31388,"endOffset":31496,"count":0}],"isBlockCoverage":false},{"functionName":"set port","ranges":[{"startOffset":31500,"endOffset":31665,"count":0}],"isBlockCoverage":false},{"functionName":"get pathname","ranges":[{"startOffset":31669,"endOffset":31961,"count":0}],"isBlockCoverage":false},{"functionName":"set pathname","ranges":[{"startOffset":31965,"endOffset":32138,"count":0}],"isBlockCoverage":false},{"functionName":"get search","ranges":[{"startOffset":32142,"endOffset":32339,"count":0}],"isBlockCoverage":false},{"functionName":"set search","ranges":[{"startOffset":32343,"endOffset":32547,"count":0}],"isBlockCoverage":false},{"functionName":"get searchParams","ranges":[{"startOffset":32565,"endOffset":32923,"count":0}],"isBlockCoverage":false},{"functionName":"get hash","ranges":[{"startOffset":32927,"endOffset":33142,"count":0}],"isBlockCoverage":false},{"functionName":"set hash","ranges":[{"startOffset":33146,"endOffset":33311,"count":0}],"isBlockCoverage":false},{"functionName":"toJSON","ranges":[{"startOffset":33315,"endOffset":33498,"count":0}],"isBlockCoverage":false},{"functionName":"canParse","ranges":[{"startOffset":33509,"endOffset":33906,"count":0}],"isBlockCoverage":false},{"functionName":"pathToFileURL","ranges":[{"startOffset":44127,"endOffset":45978,"count":1}],"isBlockCoverage":false}]},{"scriptId":"40","url":"node:internal/vm","functions":[{"functionName":"makeContextifyScript","ranges":[{"startOffset":6642,"endOffset":7818,"count":1}],"isBlockCoverage":false}]},{"scriptId":"42","url":"node:internal/source_map/source_map_cache","functions":[{"functionName":"setSourceMapsSupport","ranges":[{"startOffset":2067,"endOffset":2836,"count":1}],"isBlockCoverage":false}]},{"scriptId":"43","url":"node:internal/modules/helpers","functions":[{"functionName":"","ranges":[{"startOffset":1339,"endOffset":1364,"count":1}],"isBlockCoverage":false},{"functionName":"initializeCjsConditions","ranges":[{"startOffset":2081,"endOffset":2572,"count":1}],"isBlockCoverage":false},{"functionName":"loadBuiltinModule","ranges":[{"startOffset":2993,"endOffset":3373,"count":1}],"isBlockCoverage":false},{"functionName":"lazyModule","ranges":[{"startOffset":3466,"endOffset":3559,"count":1}],"isBlockCoverage":false},{"functionName":"makeRequireFunction","ranges":[{"startOffset":3782,"endOffset":4860,"count":1}],"isBlockCoverage":false},{"functionName":"require","ranges":[{"startOffset":3977,"endOffset":4035,"count":0}],"isBlockCoverage":false},{"functionName":"resolve","ranges":[{"startOffset":4216,"endOffset":4362,"count":0}],"isBlockCoverage":false},{"functionName":"paths","ranges":[{"startOffset":4507,"endOffset":4629,"count":0}],"isBlockCoverage":false},{"functionName":"addBuiltinLibsToObject","ranges":[{"startOffset":5500,"endOffset":7439,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":5999,"endOffset":7435,"count":68}],"isBlockCoverage":false},{"functionName":"setReal","ranges":[{"startOffset":6593,"endOffset":6763,"count":1}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":6841,"endOffset":7351,"count":1}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":7107,"endOffset":7116,"count":0}],"isBlockCoverage":false},{"functionName":"hasStartedUserCJSExecution","ranges":[{"startOffset":12928,"endOffset":13002,"count":1}],"isBlockCoverage":false},{"functionName":"setHasStartedUserCJSExecution","ranges":[{"startOffset":13006,"endOffset":13083,"count":1}],"isBlockCoverage":false},{"functionName":"hasStartedUserESMExecution","ranges":[{"startOffset":13087,"endOffset":13161,"count":1}],"isBlockCoverage":false}]},{"scriptId":"55","url":"node:internal/console/constructor","functions":[{"functionName":"value","ranges":[{"startOffset":5822,"endOffset":6401,"count":1}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":6031,"endOffset":6095,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":6107,"endOffset":6137,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":6267,"endOffset":6331,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":6343,"endOffset":6373,"count":0}],"isBlockCoverage":false},{"functionName":"initializeGlobalConsole","ranges":[{"startOffset":19660,"endOffset":20650,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":20545,"endOffset":20646,"count":0}],"isBlockCoverage":false}]},{"scriptId":"56","url":"node:diagnostics_channel","functions":[{"functionName":"set","ranges":[{"startOffset":930,"endOffset":1047,"count":10}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":1051,"endOffset":1099,"count":10}],"isBlockCoverage":false},{"functionName":"Channel","ranges":[{"startOffset":4074,"endOffset":4215,"count":10}],"isBlockCoverage":false},{"functionName":"get hasSubscribers","ranges":[{"startOffset":4683,"endOffset":4727,"count":5}],"isBlockCoverage":false},{"functionName":"channel","ranges":[{"startOffset":4874,"endOffset":5140,"count":10}],"isBlockCoverage":false},{"functionName":"tracingChannelFrom","ranges":[{"startOffset":5698,"endOffset":6223,"count":10}],"isBlockCoverage":false},{"functionName":"TracingChannel","ranges":[{"startOffset":6250,"endOffset":6523,"count":2}],"isBlockCoverage":false},{"functionName":"get hasSubscribers","ranges":[{"startOffset":6527,"endOffset":6742,"count":1}],"isBlockCoverage":false},{"functionName":"traceSync","ranges":[{"startOffset":7235,"endOffset":7746,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":7445,"endOffset":7740,"count":0}],"isBlockCoverage":false},{"functionName":"tracingChannel","ranges":[{"startOffset":10037,"endOffset":10125,"count":2}],"isBlockCoverage":false}]},{"scriptId":"58","url":"node:internal/event_target","functions":[{"functionName":"defineEventHandler","ranges":[{"startOffset":29797,"endOffset":31263,"count":1}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":29957,"endOffset":30093,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":30192,"endOffset":31030,"count":0}],"isBlockCoverage":false}]},{"scriptId":"61","url":"node:internal/bootstrap/switches/is_main_thread","functions":[{"functionName":"createWritableStdioStream","ranges":[{"startOffset":1428,"endOffset":3030,"count":1}],"isBlockCoverage":false},{"functionName":"write","ranges":[{"startOffset":2845,"endOffset":2892,"count":0}],"isBlockCoverage":false},{"functionName":"addCleanup","ranges":[{"startOffset":3643,"endOffset":3734,"count":1}],"isBlockCoverage":false},{"functionName":"getStderr","ranges":[{"startOffset":4430,"endOffset":5121,"count":2}],"isBlockCoverage":false},{"functionName":"cleanupStderr","ranges":[{"startOffset":4787,"endOffset":4965,"count":0}],"isBlockCoverage":false}]},{"scriptId":"62","url":"node:internal/v8/startup_snapshot","functions":[{"functionName":"isBuildingSnapshot","ranges":[{"startOffset":433,"endOffset":504,"count":5}],"isBlockCoverage":false},{"functionName":"runDeserializeCallbacks","ranges":[{"startOffset":831,"endOffset":1004,"count":1}],"isBlockCoverage":false}]},{"scriptId":"63","url":"node:internal/process/signal","functions":[{"functionName":"isSignal","ranges":[{"startOffset":238,"endOffset":334,"count":1}],"isBlockCoverage":false},{"functionName":"startListeningIfSignal","ranges":[{"startOffset":398,"endOffset":908,"count":1}],"isBlockCoverage":false}]},{"scriptId":"65","url":"node:internal/modules/cjs/loader","functions":[{"functionName":"","ranges":[{"startOffset":4762,"endOffset":4805,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":5473,"endOffset":5532,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":5621,"endOffset":5659,"count":1}],"isBlockCoverage":false},{"functionName":"wrapModuleLoad","ranges":[{"startOffset":5894,"endOffset":6321,"count":1}],"isBlockCoverage":false},{"functionName":"updateChildren","ranges":[{"startOffset":7420,"endOffset":7622,"count":2}],"isBlockCoverage":false},{"functionName":"reportModuleToWatchMode","ranges":[{"startOffset":7739,"endOffset":7895,"count":1}],"isBlockCoverage":false},{"functionName":"Module","ranges":[{"startOffset":8409,"endOffset":8672,"count":2}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":10621,"endOffset":10646,"count":1}],"isBlockCoverage":false},{"functionName":"initializeCJS","ranges":[{"startOffset":11366,"endOffset":12170,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":25341,"endOffset":26529,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":31073,"endOffset":34951,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":35413,"endOffset":38275,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":40770,"endOffset":41071,"count":1}],"isBlockCoverage":false},{"functionName":"wrapSafe","ranges":[{"startOffset":46662,"endOffset":48669,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":49118,"endOffset":50869,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":59075,"endOffset":60040,"count":1}],"isBlockCoverage":false}]},{"scriptId":"67","url":"node:internal/modules/esm/utils","functions":[{"functionName":"initializeDefaultConditions","ranges":[{"startOffset":1785,"endOffset":2290,"count":1}],"isBlockCoverage":false},{"functionName":"initializeESM","ranges":[{"startOffset":10602,"endOffset":10988,"count":1}],"isBlockCoverage":false}]},{"scriptId":"68","url":"node:internal/process/pre_execution","functions":[{"functionName":"prepareMainThreadExecution","ranges":[{"startOffset":1056,"endOffset":1240,"count":1}],"isBlockCoverage":false},{"functionName":"prepareExecution","ranges":[{"startOffset":2420,"endOffset":4520,"count":1}],"isBlockCoverage":false},{"functionName":"setupSymbolDisposePolyfill","ranges":[{"startOffset":4522,"endOffset":5257,"count":1}],"isBlockCoverage":false},{"functionName":"setupUserModules","ranges":[{"startOffset":5259,"endOffset":6007,"count":1}],"isBlockCoverage":false},{"functionName":"refreshRuntimeOptions","ranges":[{"startOffset":6009,"endOffset":6065,"count":1}],"isBlockCoverage":false},{"functionName":"patchProcessObject","ranges":[{"startOffset":6492,"endOffset":8829,"count":1}],"isBlockCoverage":false},{"functionName":"addReadOnlyProcessAlias","ranges":[{"startOffset":8831,"endOffset":9112,"count":13}],"isBlockCoverage":false},{"functionName":"setupWarningHandler","ranges":[{"startOffset":9114,"endOffset":9634,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":9518,"endOffset":9620,"count":0}],"isBlockCoverage":false},{"functionName":"setupUndici","ranges":[{"startOffset":9709,"endOffset":10038,"count":1}],"isBlockCoverage":false},{"functionName":"setupEventsource","ranges":[{"startOffset":10106,"endOffset":10231,"count":1}],"isBlockCoverage":false},{"functionName":"setupNavigator","ranges":[{"startOffset":10335,"endOffset":10736,"count":1}],"isBlockCoverage":false},{"functionName":"setupWebCrypto","ranges":[{"startOffset":10840,"endOffset":11792,"count":1}],"isBlockCoverage":false},{"functionName":"cryptoThisCheck","ranges":[{"startOffset":11166,"endOffset":11342,"count":0}],"isBlockCoverage":false},{"functionName":"get crypto","ranges":[{"startOffset":11643,"endOffset":11742,"count":0}],"isBlockCoverage":false},{"functionName":"setupSQLite","ranges":[{"startOffset":11794,"endOffset":12001,"count":1}],"isBlockCoverage":false},{"functionName":"setupWebStorage","ranges":[{"startOffset":12003,"endOffset":12408,"count":1}],"isBlockCoverage":false},{"functionName":"setupCodeCoverage","ranges":[{"startOffset":12410,"endOffset":12931,"count":1}],"isBlockCoverage":false},{"functionName":"setupCustomEvent","ranges":[{"startOffset":13037,"endOffset":13314,"count":1}],"isBlockCoverage":false},{"functionName":"setupStacktracePrinterOnSigint","ranges":[{"startOffset":13316,"endOffset":13541,"count":1}],"isBlockCoverage":false},{"functionName":"initializeReport","ranges":[{"startOffset":13543,"endOffset":13792,"count":1}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":13688,"endOffset":13783,"count":0}],"isBlockCoverage":false},{"functionName":"setupDebugEnv","ranges":[{"startOffset":13794,"endOffset":14025,"count":1}],"isBlockCoverage":false},{"functionName":"initializeReportSignalHandlers","ranges":[{"startOffset":14087,"endOffset":14275,"count":1}],"isBlockCoverage":false},{"functionName":"initializeHeapSnapshotSignalHandlers","ranges":[{"startOffset":14277,"endOffset":15011,"count":1}],"isBlockCoverage":false},{"functionName":"doWriteHeapSnapshot","ranges":[{"startOffset":14585,"endOffset":14739,"count":0}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":14931,"endOffset":15003,"count":0}],"isBlockCoverage":false},{"functionName":"setupTraceCategoryState","ranges":[{"startOffset":15013,"endOffset":15272,"count":1}],"isBlockCoverage":false},{"functionName":"setupInspectorHooks","ranges":[{"startOffset":15274,"endOffset":15856,"count":1}],"isBlockCoverage":false},{"functionName":"setupNetworkInspection","ranges":[{"startOffset":15858,"endOffset":16171,"count":1}],"isBlockCoverage":false},{"functionName":"initializeDeprecations","ranges":[{"startOffset":16366,"endOffset":18268,"count":1}],"isBlockCoverage":false},{"functionName":"setupChildProcessIpcChannel","ranges":[{"startOffset":18270,"endOffset":18787,"count":1}],"isBlockCoverage":false},{"functionName":"initializeClusterIPC","ranges":[{"startOffset":18789,"endOffset":19059,"count":1}],"isBlockCoverage":false},{"functionName":"initializePermission","ranges":[{"startOffset":19061,"endOffset":20965,"count":1}],"isBlockCoverage":false},{"functionName":"binding","ranges":[{"startOffset":19190,"endOffset":19277,"count":0}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":20810,"endOffset":20957,"count":6}],"isBlockCoverage":false},{"functionName":"initializeCJSLoader","ranges":[{"startOffset":20967,"endOffset":21088,"count":1}],"isBlockCoverage":false},{"functionName":"initializeESMLoader","ranges":[{"startOffset":21090,"endOffset":21673,"count":1}],"isBlockCoverage":false},{"functionName":"initializeSourceMapsHandlers","ranges":[{"startOffset":21675,"endOffset":22181,"count":1}],"isBlockCoverage":false},{"functionName":"initializeFrozenIntrinsics","ranges":[{"startOffset":22183,"endOffset":22370,"count":1}],"isBlockCoverage":false},{"functionName":"loadPreloadModules","ranges":[{"startOffset":22477,"endOffset":22825,"count":1}],"isBlockCoverage":false},{"functionName":"markBootstrapComplete","ranges":[{"startOffset":22827,"endOffset":22921,"count":1}],"isBlockCoverage":false}]},{"scriptId":"71","url":"node:internal/dns/utils","functions":[{"functionName":"initializeDns","ranges":[{"startOffset":5465,"endOffset":5946,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":5886,"endOffset":5942,"count":0}],"isBlockCoverage":false}]},{"scriptId":"73","url":"node:internal/bootstrap/switches/does_own_process_state","functions":[{"functionName":"wrappedCwd","ranges":[{"startOffset":3731,"endOffset":3834,"count":2}],"isBlockCoverage":false}]},{"scriptId":"74","url":"node:internal/main/eval_string","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":2738,"count":1}],"isBlockCoverage":false},{"functionName":"setReal","ranges":[{"startOffset":1837,"endOffset":2007,"count":0}],"isBlockCoverage":false}]},{"scriptId":"75","url":"node:module","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":1121,"count":1}],"isBlockCoverage":false}]},{"scriptId":"76","url":"node:internal/modules/esm/loader","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":36514,"count":1}],"isBlockCoverage":false},{"functionName":"newResolveCache","ranges":[{"startOffset":1705,"endOffset":1835,"count":0}],"isBlockCoverage":false},{"functionName":"newLoadCache","ranges":[{"startOffset":1989,"endOffset":2110,"count":0}],"isBlockCoverage":false},{"functionName":"getTranslators","ranges":[{"startOffset":2272,"endOffset":2394,"count":0}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":3167,"endOffset":29227,"count":0}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":29310,"endOffset":31908,"count":0}],"isBlockCoverage":false},{"functionName":"createModuleLoader","ranges":[{"startOffset":32292,"endOffset":33916,"count":0}],"isBlockCoverage":false},{"functionName":"getHooksProxy","ranges":[{"startOffset":34029,"endOffset":34205,"count":0}],"isBlockCoverage":false},{"functionName":"getOrInitializeCascadedLoader","ranges":[{"startOffset":34707,"endOffset":34819,"count":0}],"isBlockCoverage":false},{"functionName":"register","ranges":[{"startOffset":36061,"endOffset":36406,"count":0}],"isBlockCoverage":false}]},{"scriptId":"77","url":"node:internal/modules/esm/assert","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":3875,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":1301,"endOffset":1342,"count":5}],"isBlockCoverage":true},{"functionName":"validateAttributes","ranges":[{"startOffset":1763,"endOffset":3145,"count":0}],"isBlockCoverage":false},{"functionName":"handleInvalidType","ranges":[{"startOffset":3379,"endOffset":3802,"count":0}],"isBlockCoverage":false}]},{"scriptId":"78","url":"node:internal/source_map/source_map","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":12164,"count":1}],"isBlockCoverage":false},{"functionName":"StringCharIterator","ranges":[{"startOffset":4050,"endOffset":4126,"count":0}],"isBlockCoverage":false},{"functionName":"next","ranges":[{"startOffset":4164,"endOffset":4242,"count":0}],"isBlockCoverage":false},{"functionName":"peek","ranges":[{"startOffset":4280,"endOffset":4356,"count":0}],"isBlockCoverage":false},{"functionName":"hasNext","ranges":[{"startOffset":4395,"endOffset":4459,"count":0}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":4616,"endOffset":10114,"count":0}],"isBlockCoverage":false},{"functionName":"isSeparator","ranges":[{"startOffset":10169,"endOffset":10238,"count":0}],"isBlockCoverage":false},{"functionName":"decodeVLQ","ranges":[{"startOffset":10328,"endOffset":11261,"count":0}],"isBlockCoverage":false},{"functionName":"cloneSourceMapV3","ranges":[{"startOffset":11328,"endOffset":11640,"count":0}],"isBlockCoverage":false},{"functionName":"compareSourceMapEntry","ranges":[{"startOffset":11835,"endOffset":12114,"count":0}],"isBlockCoverage":false}]},{"scriptId":"80","url":"[eval]-wrapper","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":182,"count":1}],"isBlockCoverage":true},{"functionName":"","ranges":[{"startOffset":160,"endOffset":176,"count":1}],"isBlockCoverage":true}]},{"scriptId":"82","url":"node:internal/util/colors","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":1136,"count":1}],"isBlockCoverage":false},{"functionName":"lazyInternalTTY","ranges":[{"startOffset":32,"endOffset":127,"count":0}],"isBlockCoverage":false},{"functionName":"shouldColorize","ranges":[{"startOffset":257,"endOffset":517,"count":2},{"startOffset":329,"endOffset":388,"count":0},{"startOffset":414,"endOffset":512,"count":0}],"isBlockCoverage":true},{"functionName":"refresh","ranges":[{"startOffset":521,"endOffset":1104,"count":1},{"startOffset":638,"endOffset":652,"count":0},{"startOffset":696,"endOffset":710,"count":0},{"startOffset":754,"endOffset":768,"count":0},{"startOffset":813,"endOffset":827,"count":0},{"startOffset":869,"endOffset":883,"count":0},{"startOffset":926,"endOffset":940,"count":0},{"startOffset":984,"endOffset":995,"count":0},{"startOffset":1039,"endOffset":1052,"count":0}],"isBlockCoverage":true}]},{"scriptId":"83","url":"node:internal/fs/sync_write_stream","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":1085,"count":1}],"isBlockCoverage":false},{"functionName":"SyncWriteStream","ranges":[{"startOffset":221,"endOffset":469,"count":1},{"startOffset":440,"endOffset":446,"count":0}],"isBlockCoverage":true},{"functionName":"SyncWriteStream._write","ranges":[{"startOffset":625,"endOffset":765,"count":0}],"isBlockCoverage":false},{"functionName":"SyncWriteStream._destroy","ranges":[{"startOffset":805,"endOffset":970,"count":0}],"isBlockCoverage":false}]},{"scriptId":"84","url":"node:stream","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":5095,"count":1}],"isBlockCoverage":false},{"functionName":"fn","ranges":[{"startOffset":2552,"endOffset":2712,"count":0}],"isBlockCoverage":false},{"functionName":"fn","ranges":[{"startOffset":3214,"endOffset":3352,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":4400,"endOffset":4432,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":4530,"endOffset":4571,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":4664,"endOffset":4705,"count":0}],"isBlockCoverage":false},{"functionName":"_uint8ArrayToBuffer","ranges":[{"startOffset":4886,"endOffset":5093,"count":0}],"isBlockCoverage":false}]},{"scriptId":"85","url":"node:internal/streams/operators","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":10140,"count":1}],"isBlockCoverage":false},{"functionName":"compose","ranges":[{"startOffset":971,"endOffset":1551,"count":0}],"isBlockCoverage":false},{"functionName":"map","ranges":[{"startOffset":1553,"endOffset":4656,"count":0}],"isBlockCoverage":false},{"functionName":"some","ranges":[{"startOffset":4658,"endOffset":4806,"count":0}],"isBlockCoverage":false},{"functionName":"every","ranges":[{"startOffset":4808,"endOffset":5136,"count":0}],"isBlockCoverage":false},{"functionName":"find","ranges":[{"startOffset":5138,"endOffset":5280,"count":0}],"isBlockCoverage":false},{"functionName":"forEach","ranges":[{"startOffset":5282,"endOffset":5652,"count":0}],"isBlockCoverage":false},{"functionName":"filter","ranges":[{"startOffset":5654,"endOffset":5981,"count":0}],"isBlockCoverage":false},{"functionName":"ReduceAwareErrMissingArgs","ranges":[{"startOffset":6197,"endOffset":6311,"count":0}],"isBlockCoverage":false},{"functionName":"reduce","ranges":[{"startOffset":6315,"endOffset":7757,"count":0}],"isBlockCoverage":false},{"functionName":"toArray","ranges":[{"startOffset":7759,"endOffset":8188,"count":0}],"isBlockCoverage":false},{"functionName":"flatMap","ranges":[{"startOffset":8190,"endOffset":8384,"count":0}],"isBlockCoverage":false},{"functionName":"toIntegerOrInfinity","ranges":[{"startOffset":8386,"endOffset":8708,"count":0}],"isBlockCoverage":false},{"functionName":"drop","ranges":[{"startOffset":8710,"endOffset":9258,"count":0}],"isBlockCoverage":false},{"functionName":"take","ranges":[{"startOffset":9260,"endOffset":9930,"count":0}],"isBlockCoverage":false}]},{"scriptId":"86","url":"node:internal/abort_controller","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":15245,"count":1}],"isBlockCoverage":false},{"functionName":"lazyMessageChannel","ranges":[{"startOffset":1746,"endOffset":1879,"count":0}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":2023,"endOffset":2272,"count":0}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":2386,"endOffset":2799,"count":0}],"isBlockCoverage":false},{"functionName":"customInspect","ranges":[{"startOffset":3154,"endOffset":3413,"count":0}],"isBlockCoverage":false},{"functionName":"validateThisAbortSignal","ranges":[{"startOffset":3415,"endOffset":3540,"count":0}],"isBlockCoverage":false},{"functionName":"setWeakAbortSignalTimeout","ranges":[{"startOffset":4122,"endOffset":4522,"count":0}],"isBlockCoverage":false},{"functionName":"AbortSignal","ranges":[{"startOffset":4782,"endOffset":5293,"count":0}],"isBlockCoverage":false},{"functionName":"get aborted","ranges":[{"startOffset":5330,"endOffset":5413,"count":0}],"isBlockCoverage":false},{"functionName":"get reason","ranges":[{"startOffset":5446,"endOffset":5525,"count":0}],"isBlockCoverage":false},{"functionName":"throwIfAborted","ranges":[{"startOffset":5529,"endOffset":5645,"count":0}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":5649,"endOffset":5778,"count":0}],"isBlockCoverage":false},{"functionName":"abort","ranges":[{"startOffset":5856,"endOffset":6016,"count":0}],"isBlockCoverage":false},{"functionName":"timeout","ranges":[{"startOffset":6094,"endOffset":6374,"count":0}],"isBlockCoverage":false},{"functionName":"any","ranges":[{"startOffset":6461,"endOffset":8487,"count":0}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":8491,"endOffset":9259,"count":0}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":9263,"endOffset":9617,"count":0}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":9621,"endOffset":10228,"count":0}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":10232,"endOffset":10484,"count":0}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":10488,"endOffset":10936,"count":0}],"isBlockCoverage":false},{"functionName":"ClonedAbortSignal","ranges":[{"startOffset":10940,"endOffset":11040,"count":0}],"isBlockCoverage":false},{"functionName":"ClonedAbortSignal.","ranges":[{"startOffset":11085,"endOffset":11093,"count":0}],"isBlockCoverage":false},{"functionName":"abortSignal","ranges":[{"startOffset":11463,"endOffset":12741,"count":0}],"isBlockCoverage":false},{"functionName":"runAbort","ranges":[{"startOffset":12795,"endOffset":12923,"count":0}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":12947,"endOffset":13626,"count":0}],"isBlockCoverage":false},{"functionName":"transferableAbortSignal","ranges":[{"startOffset":13774,"endOffset":13985,"count":0}],"isBlockCoverage":false},{"functionName":"transferableAbortController","ranges":[{"startOffset":14057,"endOffset":14146,"count":0}],"isBlockCoverage":false},{"functionName":"aborted","ranges":[{"startOffset":14240,"endOffset":14796,"count":0}],"isBlockCoverage":false}]},{"scriptId":"87","url":"node:internal/streams/end-of-stream","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":8484,"count":1}],"isBlockCoverage":false},{"functionName":"isRequest","ranges":[{"startOffset":883,"endOffset":978,"count":0}],"isBlockCoverage":false},{"functionName":"nop","ranges":[{"startOffset":992,"endOffset":1000,"count":0}],"isBlockCoverage":false},{"functionName":"eos","ranges":[{"startOffset":1003,"endOffset":7053,"count":0}],"isBlockCoverage":false},{"functionName":"eosWeb","ranges":[{"startOffset":7055,"endOffset":7964,"count":0}],"isBlockCoverage":false},{"functionName":"finished","ranges":[{"startOffset":7966,"endOffset":8424,"count":0}],"isBlockCoverage":false}]},{"scriptId":"88","url":"node:internal/streams/compose","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":5511,"count":1}],"isBlockCoverage":false},{"functionName":"compose","ranges":[{"startOffset":592,"endOffset":5509,"count":0}],"isBlockCoverage":false}]},{"scriptId":"89","url":"node:internal/streams/pipeline","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":12467,"count":1}],"isBlockCoverage":false},{"functionName":"destroyer","ranges":[{"startOffset":1056,"endOffset":1485,"count":0}],"isBlockCoverage":false},{"functionName":"popCallback","ranges":[{"startOffset":1487,"endOffset":1815,"count":0}],"isBlockCoverage":false},{"functionName":"makeAsyncIterable","ranges":[{"startOffset":1817,"endOffset":2103,"count":0}],"isBlockCoverage":false},{"functionName":"fromReadable","ranges":[{"startOffset":2105,"endOffset":2255,"count":0}],"isBlockCoverage":false},{"functionName":"pumpToNode","ranges":[{"startOffset":2257,"endOffset":3301,"count":0}],"isBlockCoverage":false},{"functionName":"pumpToWeb","ranges":[{"startOffset":3303,"endOffset":3901,"count":0}],"isBlockCoverage":false},{"functionName":"pipeline","ranges":[{"startOffset":3903,"endOffset":3996,"count":0}],"isBlockCoverage":false},{"functionName":"pipelineImpl","ranges":[{"startOffset":3998,"endOffset":10588,"count":0}],"isBlockCoverage":false},{"functionName":"pipe","ranges":[{"startOffset":10590,"endOffset":12420,"count":0}],"isBlockCoverage":false}]},{"scriptId":"90","url":"node:internal/streams/destroy","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":7355,"count":1}],"isBlockCoverage":false},{"functionName":"checkError","ranges":[{"startOffset":488,"endOffset":799,"count":0}],"isBlockCoverage":false},{"functionName":"destroy","ranges":[{"startOffset":909,"endOffset":1786,"count":0}],"isBlockCoverage":false},{"functionName":"_destroy","ranges":[{"startOffset":1788,"endOffset":2412,"count":0}],"isBlockCoverage":false},{"functionName":"emitErrorCloseNT","ranges":[{"startOffset":2414,"endOffset":2501,"count":0}],"isBlockCoverage":false},{"functionName":"emitCloseNT","ranges":[{"startOffset":2503,"endOffset":2823,"count":0}],"isBlockCoverage":false},{"functionName":"emitErrorNT","ranges":[{"startOffset":2825,"endOffset":3172,"count":0}],"isBlockCoverage":false},{"functionName":"undestroy","ranges":[{"startOffset":3174,"endOffset":3864,"count":0}],"isBlockCoverage":false},{"functionName":"errorOrDestroy","ranges":[{"startOffset":3866,"endOffset":5005,"count":0}],"isBlockCoverage":false},{"functionName":"construct","ranges":[{"startOffset":5007,"endOffset":5423,"count":0}],"isBlockCoverage":false},{"functionName":"constructNT","ranges":[{"startOffset":5425,"endOffset":6164,"count":0}],"isBlockCoverage":false},{"functionName":"isRequest","ranges":[{"startOffset":6166,"endOffset":6262,"count":0}],"isBlockCoverage":false},{"functionName":"emitCloseLegacy","ranges":[{"startOffset":6264,"endOffset":6324,"count":0}],"isBlockCoverage":false},{"functionName":"emitErrorCloseLegacy","ranges":[{"startOffset":6326,"endOffset":6446,"count":0}],"isBlockCoverage":false},{"functionName":"destroyer","ranges":[{"startOffset":6481,"endOffset":7263,"count":0}],"isBlockCoverage":false}]},{"scriptId":"91","url":"node:internal/streams/duplex","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":6529,"count":1}],"isBlockCoverage":false},{"functionName":"Duplex","ranges":[{"startOffset":2315,"endOffset":4278,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":5426,"endOffset":5638,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":5644,"endOffset":5905,"count":0}],"isBlockCoverage":false},{"functionName":"lazyWebStreams","ranges":[{"startOffset":5979,"endOffset":6143,"count":0}],"isBlockCoverage":false},{"functionName":"Duplex.fromWeb","ranges":[{"startOffset":6162,"endOffset":6280,"count":0}],"isBlockCoverage":false},{"functionName":"Duplex.toWeb","ranges":[{"startOffset":6298,"endOffset":6387,"count":0}],"isBlockCoverage":false},{"functionName":"Duplex.from","ranges":[{"startOffset":6420,"endOffset":6527,"count":0}],"isBlockCoverage":false}]},{"scriptId":"92","url":"node:internal/streams/legacy","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":3251,"count":1}],"isBlockCoverage":false},{"functionName":"Stream","ranges":[{"startOffset":130,"endOffset":178,"count":1}],"isBlockCoverage":true},{"functionName":"Stream.pipe","ranges":[{"startOffset":292,"endOffset":2094,"count":0}],"isBlockCoverage":false},{"functionName":"eventNames","ranges":[{"startOffset":2127,"endOffset":2393,"count":0}],"isBlockCoverage":false},{"functionName":"prependListener","ranges":[{"startOffset":2396,"endOffset":3203,"count":0}],"isBlockCoverage":false}]},{"scriptId":"93","url":"node:internal/streams/readable","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":51284,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":1880,"endOffset":1905,"count":0}],"isBlockCoverage":false},{"functionName":"nop","ranges":[{"startOffset":2867,"endOffset":2875,"count":0}],"isBlockCoverage":false},{"functionName":"makeBitMapDescriptor","ranges":[{"startOffset":3771,"endOffset":3993,"count":19}],"isBlockCoverage":true},{"functionName":"get","ranges":[{"startOffset":3846,"endOffset":3890,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":3896,"endOffset":3985,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":6167,"endOffset":6255,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":6261,"endOffset":6427,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":6504,"endOffset":6604,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":6610,"endOffset":6840,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":6909,"endOffset":6997,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":7003,"endOffset":7169,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":7239,"endOffset":7329,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":7335,"endOffset":7504,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":7573,"endOffset":7676,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":7682,"endOffset":7949,"count":0}],"isBlockCoverage":false},{"functionName":"ReadableState","ranges":[{"startOffset":7962,"endOffset":9928,"count":0}],"isBlockCoverage":false},{"functionName":"onConstructed","ranges":[{"startOffset":9972,"endOffset":10089,"count":0}],"isBlockCoverage":false},{"functionName":"Readable","ranges":[{"startOffset":10092,"endOffset":11126,"count":0}],"isBlockCoverage":false},{"functionName":"Readable._destroy","ranges":[{"startOffset":11263,"endOffset":11295,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.","ranges":[{"startOffset":11346,"endOffset":11384,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.","ranges":[{"startOffset":11428,"endOffset":11684,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.push","ranges":[{"startOffset":11913,"endOffset":12182,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.unshift","ranges":[{"startOffset":12278,"endOffset":12545,"count":0}],"isBlockCoverage":false},{"functionName":"readableAddChunkUnshiftByteMode","ranges":[{"startOffset":12549,"endOffset":13605,"count":0}],"isBlockCoverage":false},{"functionName":"readableAddChunkUnshiftObjectMode","ranges":[{"startOffset":13607,"endOffset":13847,"count":0}],"isBlockCoverage":false},{"functionName":"readableAddChunkUnshiftValue","ranges":[{"startOffset":13849,"endOffset":14182,"count":0}],"isBlockCoverage":false},{"functionName":"readableAddChunkPushByteMode","ranges":[{"startOffset":14184,"endOffset":15566,"count":0}],"isBlockCoverage":false},{"functionName":"readableAddChunkPushObjectMode","ranges":[{"startOffset":15568,"endOffset":16165,"count":0}],"isBlockCoverage":false},{"functionName":"canPushMore","ranges":[{"startOffset":16167,"endOffset":16497,"count":0}],"isBlockCoverage":false},{"functionName":"addChunk","ranges":[{"startOffset":16499,"endOffset":17443,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.isPaused","ranges":[{"startOffset":17475,"endOffset":17630,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.setEncoding","ranges":[{"startOffset":17694,"endOffset":18264,"count":0}],"isBlockCoverage":false},{"functionName":"computeNewHighWaterMark","ranges":[{"startOffset":18325,"endOffset":18676,"count":0}],"isBlockCoverage":false},{"functionName":"howMuchToRead","ranges":[{"startOffset":18789,"endOffset":19270,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.read","ranges":[{"startOffset":19367,"endOffset":24042,"count":0}],"isBlockCoverage":false},{"functionName":"onEofChunk","ranges":[{"startOffset":24045,"endOffset":24999,"count":0}],"isBlockCoverage":false},{"functionName":"emitReadable","ranges":[{"startOffset":25200,"endOffset":25531,"count":0}],"isBlockCoverage":false},{"functionName":"emitReadable_","ranges":[{"startOffset":25533,"endOffset":26205,"count":0}],"isBlockCoverage":false},{"functionName":"maybeReadMore","ranges":[{"startOffset":26555,"endOffset":26762,"count":0}],"isBlockCoverage":false},{"functionName":"maybeReadMore_","ranges":[{"startOffset":26764,"endOffset":28593,"count":0}],"isBlockCoverage":false},{"functionName":"Readable._read","ranges":[{"startOffset":28864,"endOffset":28930,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.pipe","ranges":[{"startOffset":28959,"endOffset":33469,"count":0}],"isBlockCoverage":false},{"functionName":"pipeOnDrain","ranges":[{"startOffset":33472,"endOffset":34149,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.unpipe","ranges":[{"startOffset":34180,"endOffset":34881,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.on","ranges":[{"startOffset":35007,"endOffset":36016,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.removeListener","ranges":[{"startOffset":36111,"endOffset":36818,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.removeAllListeners","ranges":[{"startOffset":36921,"endOffset":37515,"count":0}],"isBlockCoverage":false},{"functionName":"updateReadableListening","ranges":[{"startOffset":37518,"endOffset":38220,"count":0}],"isBlockCoverage":false},{"functionName":"nReadingNextTick","ranges":[{"startOffset":38222,"endOffset":38310,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.resume","ranges":[{"startOffset":38464,"endOffset":38969,"count":0}],"isBlockCoverage":false},{"functionName":"resume","ranges":[{"startOffset":38972,"endOffset":39145,"count":0}],"isBlockCoverage":false},{"functionName":"resume_","ranges":[{"startOffset":39147,"endOffset":39461,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.pause","ranges":[{"startOffset":39490,"endOffset":39802,"count":0}],"isBlockCoverage":false},{"functionName":"flow","ranges":[{"startOffset":39805,"endOffset":39956,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.wrap","ranges":[{"startOffset":40140,"endOffset":41161,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.","ranges":[{"startOffset":41206,"endOffset":41258,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.iterator","ranges":[{"startOffset":41291,"endOffset":41434,"count":0}],"isBlockCoverage":false},{"functionName":"streamToAsyncIterator","ranges":[{"startOffset":41437,"endOffset":41686,"count":0}],"isBlockCoverage":false},{"functionName":"createAsyncIterator","ranges":[{"startOffset":41688,"endOffset":42764,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":42983,"endOffset":43372,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":43378,"endOffset":43508,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":43590,"endOffset":43654,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":43736,"endOffset":43944,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":44032,"endOffset":44098,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":44179,"endOffset":44239,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":44321,"endOffset":44381,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":44392,"endOffset":44501,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":44577,"endOffset":44631,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":44711,"endOffset":44799,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":44877,"endOffset":44962,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":45031,"endOffset":45115,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":45160,"endOffset":45244,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":45315,"endOffset":45402,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":45408,"endOffset":45697,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":45772,"endOffset":45860,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":46001,"endOffset":46046,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":46126,"endOffset":46184,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":46190,"endOffset":46351,"count":0}],"isBlockCoverage":false},{"functionName":"fromList","ranges":[{"startOffset":46657,"endOffset":49109,"count":0}],"isBlockCoverage":false},{"functionName":"endReadable","ranges":[{"startOffset":49111,"endOffset":49337,"count":0}],"isBlockCoverage":false},{"functionName":"endReadableNT","ranges":[{"startOffset":49339,"endOffset":50232,"count":0}],"isBlockCoverage":false},{"functionName":"endWritableNT","ranges":[{"startOffset":50234,"endOffset":50394,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.from","ranges":[{"startOffset":50412,"endOffset":50481,"count":0}],"isBlockCoverage":false},{"functionName":"lazyWebStreams","ranges":[{"startOffset":50546,"endOffset":50710,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.fromWeb","ranges":[{"startOffset":50731,"endOffset":50865,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.toWeb","ranges":[{"startOffset":50885,"endOffset":51019,"count":0}],"isBlockCoverage":false},{"functionName":"Readable.wrap","ranges":[{"startOffset":51038,"endOffset":51282,"count":0}],"isBlockCoverage":false}]},{"scriptId":"94","url":"node:internal/streams/add-abort-signal","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":1734,"count":1}],"isBlockCoverage":false},{"functionName":"validateAbortSignal","ranges":[{"startOffset":563,"endOffset":722,"count":0}],"isBlockCoverage":false},{"functionName":"addAbortSignal","ranges":[{"startOffset":757,"endOffset":1068,"count":0}],"isBlockCoverage":false},{"functionName":"module.exports.addAbortSignalNoValidate","ranges":[{"startOffset":1113,"endOffset":1732,"count":0}],"isBlockCoverage":false}]},{"scriptId":"95","url":"node:internal/streams/state","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":1440,"count":1}],"isBlockCoverage":false},{"functionName":"highWaterMarkFrom","ranges":[{"startOffset":395,"endOffset":562,"count":1},{"startOffset":493,"endOffset":516,"count":0},{"startOffset":532,"endOffset":552,"count":0}],"isBlockCoverage":true},{"functionName":"getDefaultHighWaterMark","ranges":[{"startOffset":564,"endOffset":694,"count":1},{"startOffset":631,"endOffset":663,"count":0}],"isBlockCoverage":true},{"functionName":"setDefaultHighWaterMark","ranges":[{"startOffset":696,"endOffset":907,"count":0}],"isBlockCoverage":false},{"functionName":"getHighWaterMark","ranges":[{"startOffset":909,"endOffset":1342,"count":1},{"startOffset":1056,"endOffset":1268,"count":0}],"isBlockCoverage":true}]},{"scriptId":"96","url":"node:string_decoder","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":5141,"count":1}],"isBlockCoverage":false},{"functionName":"normalizeEncoding","ranges":[{"startOffset":2172,"endOffset":2422,"count":0}],"isBlockCoverage":false},{"functionName":"StringDecoder","ranges":[{"startOffset":2633,"endOffset":2832,"count":0}],"isBlockCoverage":false},{"functionName":"write","ranges":[{"startOffset":3155,"endOffset":3540,"count":0}],"isBlockCoverage":false},{"functionName":"end","ranges":[{"startOffset":3817,"endOffset":4008,"count":0}],"isBlockCoverage":false},{"functionName":"text","ranges":[{"startOffset":4219,"endOffset":4376,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":4514,"endOffset":4727,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":4819,"endOffset":4882,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":4975,"endOffset":5090,"count":0}],"isBlockCoverage":false}]},{"scriptId":"97","url":"node:internal/streams/from","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":4321,"count":1}],"isBlockCoverage":false},{"functionName":"from","ranges":[{"startOffset":241,"endOffset":4296,"count":0}],"isBlockCoverage":false}]},{"scriptId":"98","url":"node:internal/streams/writable","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":33592,"count":1}],"isBlockCoverage":false},{"functionName":"nop","ranges":[{"startOffset":2779,"endOffset":2796,"count":0}],"isBlockCoverage":false},{"functionName":"makeBitMapDescriptor","ranges":[{"startOffset":3852,"endOffset":4074,"count":20}],"isBlockCoverage":true},{"functionName":"get","ranges":[{"startOffset":3927,"endOffset":3971,"count":1}],"isBlockCoverage":true},{"functionName":"set","ranges":[{"startOffset":3977,"endOffset":4066,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":7038,"endOffset":7116,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":7122,"endOffset":7288,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":7358,"endOffset":7458,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":7464,"endOffset":7737,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":7814,"endOffset":7914,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":7920,"endOffset":8150,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":8291,"endOffset":8368,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":8374,"endOffset":8538,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":8725,"endOffset":8825,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":8831,"endOffset":9028,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":9098,"endOffset":9176,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":9182,"endOffset":9349,"count":0}],"isBlockCoverage":false},{"functionName":"WritableState","ranges":[{"startOffset":9362,"endOffset":11644,"count":1},{"startOffset":9630,"endOffset":9658,"count":0},{"startOffset":9675,"endOffset":9705,"count":0},{"startOffset":9711,"endOffset":9739,"count":0},{"startOffset":10030,"endOffset":10066,"count":0},{"startOffset":10258,"endOffset":10286,"count":0},{"startOffset":10409,"endOffset":10439,"count":0},{"startOffset":10696,"endOffset":10702,"count":0},{"startOffset":10734,"endOffset":10763,"count":0},{"startOffset":10764,"endOffset":10794,"count":0},{"startOffset":10843,"endOffset":11052,"count":0}],"isBlockCoverage":true},{"functionName":"resetBuffer","ranges":[{"startOffset":11646,"endOffset":11810,"count":1}],"isBlockCoverage":true},{"functionName":"getBuffer","ranges":[{"startOffset":11848,"endOffset":11977,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":12073,"endOffset":12184,"count":0}],"isBlockCoverage":false},{"functionName":"onConstructed","ranges":[{"startOffset":12233,"endOffset":12419,"count":0}],"isBlockCoverage":false},{"functionName":"Writable","ranges":[{"startOffset":12422,"endOffset":13528,"count":1},{"startOffset":12490,"endOffset":12519,"count":0},{"startOffset":12914,"endOffset":12942,"count":0},{"startOffset":12996,"endOffset":13026,"count":0},{"startOffset":13081,"endOffset":13113,"count":0},{"startOffset":13166,"endOffset":13194,"count":0},{"startOffset":13251,"endOffset":13287,"count":0},{"startOffset":13319,"endOffset":13356,"count":0},{"startOffset":13424,"endOffset":13526,"count":0}],"isBlockCoverage":true},{"functionName":"","ranges":[{"startOffset":13458,"endOffset":13520,"count":0}],"isBlockCoverage":false},{"functionName":"value","ranges":[{"startOffset":13610,"endOffset":13814,"count":1},{"startOffset":13699,"endOffset":13809,"count":0}],"isBlockCoverage":true},{"functionName":"Writable.pipe","ranges":[{"startOffset":13915,"endOffset":13983,"count":0}],"isBlockCoverage":false},{"functionName":"_write","ranges":[{"startOffset":13986,"endOffset":15384,"count":0}],"isBlockCoverage":false},{"functionName":"Writable.write","ranges":[{"startOffset":15413,"endOffset":15604,"count":0}],"isBlockCoverage":false},{"functionName":"Writable.cork","ranges":[{"startOffset":15633,"endOffset":15731,"count":0}],"isBlockCoverage":false},{"functionName":"Writable.uncork","ranges":[{"startOffset":15762,"endOffset":16000,"count":0}],"isBlockCoverage":false},{"functionName":"setDefaultEncoding","ranges":[{"startOffset":16043,"endOffset":16368,"count":0}],"isBlockCoverage":false},{"functionName":"writeOrBuffer","ranges":[{"startOffset":16558,"endOffset":17762,"count":0}],"isBlockCoverage":false},{"functionName":"doWrite","ranges":[{"startOffset":17764,"endOffset":18201,"count":0}],"isBlockCoverage":false},{"functionName":"onwriteError","ranges":[{"startOffset":18203,"endOffset":18588,"count":0}],"isBlockCoverage":false},{"functionName":"onwrite","ranges":[{"startOffset":18590,"endOffset":21196,"count":0}],"isBlockCoverage":false},{"functionName":"afterWriteTick","ranges":[{"startOffset":21198,"endOffset":21385,"count":0}],"isBlockCoverage":false},{"functionName":"afterWrite","ranges":[{"startOffset":21387,"endOffset":21895,"count":0}],"isBlockCoverage":false},{"functionName":"errorBuffer","ranges":[{"startOffset":21967,"endOffset":22518,"count":0}],"isBlockCoverage":false},{"functionName":"clearBuffer","ranges":[{"startOffset":22584,"endOffset":24254,"count":0}],"isBlockCoverage":false},{"functionName":"Writable._write","ranges":[{"startOffset":24284,"endOffset":24453,"count":0}],"isBlockCoverage":false},{"functionName":"Writable.end","ranges":[{"startOffset":24517,"endOffset":26157,"count":0}],"isBlockCoverage":false},{"functionName":"needFinish","ranges":[{"startOffset":26160,"endOffset":26589,"count":0}],"isBlockCoverage":false},{"functionName":"onFinish","ranges":[{"startOffset":26591,"endOffset":27223,"count":0}],"isBlockCoverage":false},{"functionName":"prefinish","ranges":[{"startOffset":27225,"endOffset":27749,"count":0}],"isBlockCoverage":false},{"functionName":"finishMaybe","ranges":[{"startOffset":27751,"endOffset":28250,"count":0}],"isBlockCoverage":false},{"functionName":"finish","ranges":[{"startOffset":28252,"endOffset":28895,"count":0}],"isBlockCoverage":false},{"functionName":"callFinishedCallbacks","ranges":[{"startOffset":28897,"endOffset":29215,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":29299,"endOffset":29402,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":29450,"endOffset":29556,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":29562,"endOffset":29812,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":29859,"endOffset":30262,"count":0}],"isBlockCoverage":false},{"functionName":"set","ranges":[{"startOffset":30268,"endOffset":30402,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":30457,"endOffset":30575,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":30632,"endOffset":30752,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":30805,"endOffset":30900,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":30952,"endOffset":31068,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":31124,"endOffset":31277,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":31337,"endOffset":31426,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":31479,"endOffset":31572,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":31625,"endOffset":31707,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":31776,"endOffset":31873,"count":0}],"isBlockCoverage":false},{"functionName":"get","ranges":[{"startOffset":31932,"endOffset":32189,"count":0}],"isBlockCoverage":false},{"functionName":"Writable.destroy","ranges":[{"startOffset":32267,"endOffset":32547,"count":0}],"isBlockCoverage":false},{"functionName":"Writable._destroy","ranges":[{"startOffset":32635,"endOffset":32667,"count":0}],"isBlockCoverage":false},{"functionName":"Writable.","ranges":[{"startOffset":32718,"endOffset":32756,"count":0}],"isBlockCoverage":false},{"functionName":"lazyWebStreams","ranges":[{"startOffset":32821,"endOffset":32985,"count":0}],"isBlockCoverage":false},{"functionName":"Writable.fromWeb","ranges":[{"startOffset":33006,"endOffset":33140,"count":0}],"isBlockCoverage":false},{"functionName":"Writable.toWeb","ranges":[{"startOffset":33160,"endOffset":33267,"count":0}],"isBlockCoverage":false},{"functionName":"Writable.","ranges":[{"startOffset":33311,"endOffset":33590,"count":0}],"isBlockCoverage":false}]},{"scriptId":"99","url":"node:stream/promises","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":917,"count":1}],"isBlockCoverage":false},{"functionName":"pipeline","ranges":[{"startOffset":318,"endOffset":869,"count":0}],"isBlockCoverage":false}]},{"scriptId":"100","url":"node:internal/streams/transform","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":7123,"count":1}],"isBlockCoverage":false},{"functionName":"Transform","ranges":[{"startOffset":3920,"endOffset":5500,"count":0}],"isBlockCoverage":false},{"functionName":"final","ranges":[{"startOffset":5502,"endOffset":5946,"count":0}],"isBlockCoverage":false},{"functionName":"prefinish","ranges":[{"startOffset":5948,"endOffset":6029,"count":0}],"isBlockCoverage":false},{"functionName":"Transform._transform","ranges":[{"startOffset":6101,"endOffset":6196,"count":0}],"isBlockCoverage":false},{"functionName":"Transform._write","ranges":[{"startOffset":6228,"endOffset":6965,"count":0}],"isBlockCoverage":false},{"functionName":"Transform._read","ranges":[{"startOffset":6996,"endOffset":7121,"count":0}],"isBlockCoverage":false}]},{"scriptId":"101","url":"node:internal/streams/passthrough","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":1762,"count":1}],"isBlockCoverage":false},{"functionName":"PassThrough","ranges":[{"startOffset":1529,"endOffset":1671,"count":0}],"isBlockCoverage":false},{"functionName":"PassThrough._transform","ranges":[{"startOffset":1708,"endOffset":1760,"count":0}],"isBlockCoverage":false}]},{"scriptId":"102","url":"node:internal/streams/duplexpair","functions":[{"functionName":"","ranges":[{"startOffset":0,"endOffset":1373,"count":1}],"isBlockCoverage":false},{"functionName":"","ranges":[{"startOffset":251,"endOffset":1136,"count":0}],"isBlockCoverage":false},{"functionName":"duplexPair","ranges":[{"startOffset":1138,"endOffset":1343,"count":0}],"isBlockCoverage":false}]}],"timestamp":17391.066092} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/crypto.test.d.ts b/yjs-poll/node_modules/lib0/crypto.test.d.ts deleted file mode 100644 index 050692d..0000000 --- a/yjs-poll/node_modules/lib0/crypto.test.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export function testJwt(_tc: t.TestCase): Promise; -export function testEncryption(tc: t.TestCase): Promise; -export function testReapeatEncryption(tc: t.TestCase): Promise; -export function testImportExport(tc: t.TestCase): Promise; -export function testEncryptionPerformance(tc: t.TestCase): Promise; -export function testConsistentKeyGeneration(_tc: t.TestCase): Promise; -export function testSigning(tc: t.TestCase): Promise; -import * as t from './testing.js'; -//# sourceMappingURL=crypto.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/crypto.test.d.ts.map b/yjs-poll/node_modules/lib0/crypto.test.d.ts.map deleted file mode 100644 index 0bae474..0000000 --- a/yjs-poll/node_modules/lib0/crypto.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"crypto.test.d.ts","sourceRoot":"","sources":["crypto.test.js"],"names":[],"mappings":"AAYO,6BAFI,CAAC,CAAC,QAAQ,iBA8BpB;AAKM,mCAFI,CAAC,CAAC,QAAQ,iBAoCpB;AAKM,0CAFI,CAAC,CAAC,QAAQ,iBA8BpB;AAKM,qCAFI,CAAC,CAAC,QAAQ,iBAgDpB;AAKM,8CAFI,CAAC,CAAC,QAAQ,iBAwCpB;AAKM,iDAFI,CAAC,CAAC,QAAQ,iBA2EpB;AAKM,gCAFI,CAAC,CAAC,QAAQ,iBAapB;mBAvSkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/crypto/aes-gcm.d.ts b/yjs-poll/node_modules/lib0/crypto/aes-gcm.d.ts deleted file mode 100644 index 2120545..0000000 --- a/yjs-poll/node_modules/lib0/crypto/aes-gcm.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export function encrypt(key: CryptoKey, data: Uint8Array): Promise>; -export function decrypt(key: CryptoKey, data: Uint8Array): PromiseLike; -export function importKeyJwk(jwk: any, { usages, extractable }?: { - usages?: Usages | undefined; - extractable?: boolean | undefined; -}): Promise; -export function importKeyRaw(raw: Uint8Array, { usages, extractable }?: { - usages?: Usages | undefined; - extractable?: boolean | undefined; -}): Promise; -export function deriveKey(secret: Uint8Array | string, salt: Uint8Array | string, { extractable, usages }?: { - extractable?: boolean | undefined; - usages?: Usages | undefined; -}): Promise; -export type Usages = Array<"encrypt" | "decrypt">; -export { exportKeyJwk, exportKeyRaw } from "./common.js"; -//# sourceMappingURL=aes-gcm.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/crypto/aes-gcm.d.ts.map b/yjs-poll/node_modules/lib0/crypto/aes-gcm.d.ts.map deleted file mode 100644 index d910a37..0000000 --- a/yjs-poll/node_modules/lib0/crypto/aes-gcm.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"aes-gcm.d.ts","sourceRoot":"","sources":["aes-gcm.js"],"names":[],"mappings":"AAuBO,6BAHI,SAAS,QACT,UAAU,CAAC,WAAW,CAAC,oCAkBjC;AAWM,6BAJI,SAAS,QACT,UAAU,CAAC,WAAW,CAAC,GACtB,WAAW,CAAC,UAAU,CAAC,CAclC;AAaM,kCALI,GAAG,4BAEX;IAAsB,MAAM;IACL,WAAW;CAAC,sBAQrC;AAUM,kCALI,UAAU,CAAC,WAAW,CAAC,4BAE/B;IAAsB,MAAM;IACL,WAAW;CAAC,sBAG0D;AAmBzF,kCANI,UAAU,CAAC,WAAW,CAAC,GAAC,MAAM,QAC9B,UAAU,CAAC,WAAW,CAAC,GAAC,MAAM,4BAEtC;IAAuB,WAAW;IACZ,MAAM;CAAC,sBAsB7B;qBAxHU,KAAK,CAAC,SAAS,GAAC,SAAS,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/crypto/aes-gcm.js b/yjs-poll/node_modules/lib0/crypto/aes-gcm.js deleted file mode 100644 index 98cd694..0000000 --- a/yjs-poll/node_modules/lib0/crypto/aes-gcm.js +++ /dev/null @@ -1,132 +0,0 @@ -/** - * AES-GCM is a symmetric key for encryption - */ - -import * as encoding from '../encoding.js' -import * as decoding from '../decoding.js' -import * as webcrypto from 'lib0/webcrypto' -import * as string from '../string.js' -export { exportKeyJwk, exportKeyRaw } from './common.js' - -/** - * @typedef {Array<'encrypt'|'decrypt'>} Usages - */ - -/** - * @type {Usages} - */ -const defaultUsages = ['encrypt', 'decrypt'] - -/** - * @param {CryptoKey} key - * @param {Uint8Array} data - */ -export const encrypt = (key, data) => { - const iv = webcrypto.getRandomValues(new Uint8Array(16)) // 92bit is enough. 128bit is recommended if space is not an issue. - return webcrypto.subtle.encrypt( - { - name: 'AES-GCM', - iv - }, - key, - data - ).then(cipher => { - const encryptedDataEncoder = encoding.createEncoder() - // iv may be sent in the clear to the other peers - encoding.writeUint8Array(encryptedDataEncoder, iv) - encoding.writeVarUint8Array(encryptedDataEncoder, new Uint8Array(cipher)) - return encoding.toUint8Array(encryptedDataEncoder) - }) -} - -/** - * @experimental The API is not final! - * - * Decrypt some data using AES-GCM method. - * - * @param {CryptoKey} key - * @param {Uint8Array} data - * @return {PromiseLike} decrypted buffer - */ -export const decrypt = (key, data) => { - const dataDecoder = decoding.createDecoder(data) - const iv = decoding.readUint8Array(dataDecoder, 16) - const cipher = decoding.readVarUint8Array(dataDecoder) - return webcrypto.subtle.decrypt( - { - name: 'AES-GCM', - iv - }, - key, - cipher - ).then(data => new Uint8Array(data)) -} - -const aesAlgDef = { - name: 'AES-GCM', - length: 256 -} - -/** - * @param {any} jwk - * @param {Object} opts - * @param {Usages} [opts.usages] - * @param {boolean} [opts.extractable] - */ -export const importKeyJwk = (jwk, { usages, extractable = false } = {}) => { - if (usages == null) { - /* c8 ignore next */ - usages = jwk.key_ops || defaultUsages - } - return webcrypto.subtle.importKey('jwk', jwk, 'AES-GCM', extractable, /** @type {Usages} */ (usages)) -} - -/** - * Only suited for importing public keys. - * - * @param {Uint8Array} raw - * @param {Object} opts - * @param {Usages} [opts.usages] - * @param {boolean} [opts.extractable] - */ -export const importKeyRaw = (raw, { usages = defaultUsages, extractable = false } = {}) => - webcrypto.subtle.importKey('raw', raw, aesAlgDef, extractable, /** @type {Usages} */ (usages)) - -/** - * @param {Uint8Array | string} data - */ -/* c8 ignore next */ -const toBinary = data => typeof data === 'string' ? string.encodeUtf8(data) : data - -/** - * @experimental The API is not final! - * - * Derive an symmetric key using the Password-Based-Key-Derivation-Function-2. - * - * @param {Uint8Array|string} secret - * @param {Uint8Array|string} salt - * @param {Object} opts - * @param {boolean} [opts.extractable] - * @param {Usages} [opts.usages] - */ -export const deriveKey = (secret, salt, { extractable = false, usages = defaultUsages } = {}) => - webcrypto.subtle.importKey( - 'raw', - toBinary(secret), - 'PBKDF2', - false, - ['deriveKey'] - ).then(keyMaterial => - webcrypto.subtle.deriveKey( - { - name: 'PBKDF2', - salt: toBinary(salt), // NIST recommends at least 64 bits - iterations: 600000, // OWASP recommends 600k iterations - hash: 'SHA-256' - }, - keyMaterial, - aesAlgDef, - extractable, - usages - ) - ) diff --git a/yjs-poll/node_modules/lib0/crypto/common.d.ts b/yjs-poll/node_modules/lib0/crypto/common.d.ts deleted file mode 100644 index 75106c9..0000000 --- a/yjs-poll/node_modules/lib0/crypto/common.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function exportKeyJwk(key: CryptoKey): Promise; -export function exportKeyRaw(key: CryptoKey): Promise>; -//# sourceMappingURL=common.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/crypto/common.d.ts.map b/yjs-poll/node_modules/lib0/crypto/common.d.ts.map deleted file mode 100644 index bcf4398..0000000 --- a/yjs-poll/node_modules/lib0/crypto/common.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["common.js"],"names":[],"mappings":"AAKO,kCAFI,SAAS,uBAMnB;AAQM,kCAHI,SAAS,GACR,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAG6B"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/crypto/common.js b/yjs-poll/node_modules/lib0/crypto/common.js deleted file mode 100644 index ae90978..0000000 --- a/yjs-poll/node_modules/lib0/crypto/common.js +++ /dev/null @@ -1,19 +0,0 @@ -import * as webcrypto from 'lib0/webcrypto' - -/** - * @param {CryptoKey} key - */ -export const exportKeyJwk = async key => { - const jwk = await webcrypto.subtle.exportKey('jwk', key) - jwk.key_ops = key.usages - return jwk -} - -/** - * Only suited for exporting public keys. - * - * @param {CryptoKey} key - * @return {Promise>} - */ -export const exportKeyRaw = key => - webcrypto.subtle.exportKey('raw', key).then(key => new Uint8Array(key)) diff --git a/yjs-poll/node_modules/lib0/crypto/ecdsa.d.ts b/yjs-poll/node_modules/lib0/crypto/ecdsa.d.ts deleted file mode 100644 index 5ebdfe1..0000000 --- a/yjs-poll/node_modules/lib0/crypto/ecdsa.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export function sign(key: CryptoKey, data: Uint8Array): PromiseLike>; -export function verify(key: CryptoKey, signature: Uint8Array, data: Uint8Array): PromiseLike; -export function generateKeyPair({ extractable, usages }?: { - extractable?: boolean | undefined; - usages?: Usages | undefined; -}): Promise; -export function importKeyJwk(jwk: any, { extractable, usages }?: { - extractable?: boolean | undefined; - usages?: Usages | undefined; -}): Promise; -export function importKeyRaw(raw: any, { extractable, usages }?: { - extractable?: boolean | undefined; - usages?: Usages | undefined; -}): Promise; -export type Usages = Array<"sign" | "verify">; -export { exportKeyJwk, exportKeyRaw } from "./common.js"; -//# sourceMappingURL=ecdsa.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/crypto/ecdsa.d.ts.map b/yjs-poll/node_modules/lib0/crypto/ecdsa.d.ts.map deleted file mode 100644 index 3b330b7..0000000 --- a/yjs-poll/node_modules/lib0/crypto/ecdsa.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ecdsa.d.ts","sourceRoot":"","sources":["ecdsa.js"],"names":[],"mappings":"AA8BO,0BAJI,SAAS,QACT,UAAU,CAAC,WAAW,CAAC,GACtB,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAOA;AAYzC,4BALI,SAAS,aACT,UAAU,CAAC,WAAW,CAAC,QACvB,UAAU,CAAC,WAAW,CAAC,GACtB,WAAW,CAAC,OAAO,CAAC,CAQ7B;AAaI,0DAHJ;IAAuB,WAAW;IACZ,MAAM;CAAC,0BAO7B;AAQI,kCALI,GAAG,4BAEX;IAAuB,WAAW;IACZ,MAAM;CAAC,sBAQ/B;AAUM,kCALI,GAAG,4BAEX;IAAuB,WAAW;IACZ,MAAM;CAAC,sBAGkD;qBAxFrE,KAAK,CAAC,MAAM,GAAC,QAAQ,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/crypto/ecdsa.js b/yjs-poll/node_modules/lib0/crypto/ecdsa.js deleted file mode 100644 index 6882af2..0000000 --- a/yjs-poll/node_modules/lib0/crypto/ecdsa.js +++ /dev/null @@ -1,97 +0,0 @@ -/** - * ECDSA is an asymmetric key for signing - */ - -import * as webcrypto from 'lib0/webcrypto' -export { exportKeyJwk, exportKeyRaw } from './common.js' - -/** - * @typedef {Array<'sign'|'verify'>} Usages - */ - -/** - * @type {Usages} - */ -const defaultUsages = ['sign', 'verify'] - -const defaultSignAlgorithm = { - name: 'ECDSA', - hash: 'SHA-384' -} - -/** - * @experimental The API is not final! - * - * Sign a message - * - * @param {CryptoKey} key - * @param {Uint8Array} data - * @return {PromiseLike>} signature - */ -export const sign = (key, data) => - webcrypto.subtle.sign( - defaultSignAlgorithm, - key, - data - ).then(signature => new Uint8Array(signature)) - -/** - * @experimental The API is not final! - * - * Sign a message - * - * @param {CryptoKey} key - * @param {Uint8Array} signature - * @param {Uint8Array} data - * @return {PromiseLike} signature - */ -export const verify = (key, signature, data) => - webcrypto.subtle.verify( - defaultSignAlgorithm, - key, - signature, - data - ) - -const defaultKeyAlgorithm = { - name: 'ECDSA', - namedCurve: 'P-384' -} - -/* c8 ignore next */ -/** - * @param {Object} opts - * @param {boolean} [opts.extractable] - * @param {Usages} [opts.usages] - */ -export const generateKeyPair = ({ extractable = false, usages = defaultUsages } = {}) => - webcrypto.subtle.generateKey( - defaultKeyAlgorithm, - extractable, - usages - ) - -/** - * @param {any} jwk - * @param {Object} opts - * @param {boolean} [opts.extractable] - * @param {Usages} [opts.usages] - */ -export const importKeyJwk = (jwk, { extractable = false, usages } = {}) => { - if (usages == null) { - /* c8 ignore next 2 */ - usages = jwk.key_ops || defaultUsages - } - return webcrypto.subtle.importKey('jwk', jwk, defaultKeyAlgorithm, extractable, /** @type {Usages} */ (usages)) -} - -/** - * Only suited for importing public keys. - * - * @param {any} raw - * @param {Object} opts - * @param {boolean} [opts.extractable] - * @param {Usages} [opts.usages] - */ -export const importKeyRaw = (raw, { extractable = false, usages = defaultUsages } = {}) => - webcrypto.subtle.importKey('raw', raw, defaultKeyAlgorithm, extractable, usages) diff --git a/yjs-poll/node_modules/lib0/crypto/jwt.d.ts b/yjs-poll/node_modules/lib0/crypto/jwt.d.ts deleted file mode 100644 index 0447def..0000000 --- a/yjs-poll/node_modules/lib0/crypto/jwt.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export function encodeJwt(privateKey: CryptoKey, payload: Object): PromiseLike; -export function verifyJwt(publicKey: CryptoKey, jwt: string): Promise<{ - header: any; - payload: any; -}>; -export function unsafeDecode(jwt: string): { - header: any; - payload: any; -}; -//# sourceMappingURL=jwt.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/crypto/jwt.d.ts.map b/yjs-poll/node_modules/lib0/crypto/jwt.d.ts.map deleted file mode 100644 index 96d4eb8..0000000 --- a/yjs-poll/node_modules/lib0/crypto/jwt.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["jwt.js"],"names":[],"mappings":"AAqBO,sCAHI,SAAS,WACT,MAAM,uBAgBhB;AAMM,qCAHI,SAAS,OACT,MAAM;;;GAiBhB;AAOM,kCAFI,MAAM;;;EAQhB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/crypto/jwt.js b/yjs-poll/node_modules/lib0/crypto/jwt.js deleted file mode 100644 index cbcc33d..0000000 --- a/yjs-poll/node_modules/lib0/crypto/jwt.js +++ /dev/null @@ -1,70 +0,0 @@ -import * as error from '../error.js' -import * as buffer from '../buffer.js' -import * as string from '../string.js' -import * as json from '../json.js' -import * as ecdsa from '../crypto/ecdsa.js' -import * as time from '../time.js' - -/** - * @param {Object} data - */ -const _stringify = data => buffer.toBase64UrlEncoded(string.encodeUtf8(json.stringify(data))) - -/** - * @param {string} base64url - */ -const _parse = base64url => json.parse(string.decodeUtf8(buffer.fromBase64UrlEncoded(base64url))) - -/** - * @param {CryptoKey} privateKey - * @param {Object} payload - */ -export const encodeJwt = (privateKey, payload) => { - const { name: algName, namedCurve: algCurve } = /** @type {any} */ (privateKey.algorithm) - /* c8 ignore next 3 */ - if (algName !== 'ECDSA' || algCurve !== 'P-384') { - error.unexpectedCase() - } - const header = { - alg: 'ES384', - typ: 'JWT' - } - const jwt = _stringify(header) + '.' + _stringify(payload) - return ecdsa.sign(privateKey, string.encodeUtf8(jwt)).then(signature => - jwt + '.' + buffer.toBase64UrlEncoded(signature) - ) -} - -/** - * @param {CryptoKey} publicKey - * @param {string} jwt - */ -export const verifyJwt = async (publicKey, jwt) => { - const [headerBase64, payloadBase64, signatureBase64] = jwt.split('.') - const verified = await ecdsa.verify(publicKey, buffer.fromBase64UrlEncoded(signatureBase64), string.encodeUtf8(headerBase64 + '.' + payloadBase64)) - /* c8 ignore next 3 */ - if (!verified) { - throw new Error('Invalid JWT') - } - const payload = _parse(payloadBase64) - if (payload.exp != null && time.getUnixTime() > payload.exp) { - throw new Error('Expired JWT') - } - return { - header: _parse(headerBase64), - payload - } -} - -/** - * Decode a jwt without verifying it. Probably a bad idea to use this. Only use if you know the jwt was already verified! - * - * @param {string} jwt - */ -export const unsafeDecode = jwt => { - const [headerBase64, payloadBase64] = jwt.split('.') - return { - header: _parse(headerBase64), - payload: _parse(payloadBase64) - } -} diff --git a/yjs-poll/node_modules/lib0/crypto/rsa-oaep.d.ts b/yjs-poll/node_modules/lib0/crypto/rsa-oaep.d.ts deleted file mode 100644 index b8bf3e9..0000000 --- a/yjs-poll/node_modules/lib0/crypto/rsa-oaep.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export { exportKeyJwk } from "./common.js"; -export function encrypt(key: CryptoKey, data: Uint8Array): PromiseLike>; -export function decrypt(key: CryptoKey, data: Uint8Array): PromiseLike; -export function generateKeyPair({ extractable, usages }?: { - extractable?: boolean | undefined; - usages?: Usages | undefined; -}): Promise; -export function importKeyJwk(jwk: any, { extractable, usages }?: { - extractable?: boolean | undefined; - usages?: Usages | undefined; -}): Promise; -export type Usages = Array<"encrypt" | "decrypt">; -//# sourceMappingURL=rsa-oaep.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/crypto/rsa-oaep.d.ts.map b/yjs-poll/node_modules/lib0/crypto/rsa-oaep.d.ts.map deleted file mode 100644 index e62c758..0000000 --- a/yjs-poll/node_modules/lib0/crypto/rsa-oaep.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rsa-oaep.d.ts","sourceRoot":"","sources":["rsa-oaep.js"],"names":[],"mappings":";AAuBO,6BAJI,SAAS,QACT,UAAU,CAAC,WAAW,CAAC,GACtB,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CASZ;AAW7B,6BAJI,SAAS,QACT,UAAU,CAAC,WAAW,CAAC,GACtB,WAAW,CAAC,UAAU,CAAC,CASG;AAQ/B,0DAJJ;IAAuB,WAAW;IACZ,MAAM;CAC5B,GAAS,OAAO,CAAC,aAAa,CAAC,CAY/B;AAQI,kCALI,GAAG,4BAEX;IAAuB,WAAW;IACZ,MAAM;CAAC,sBAQ/B;qBAxEY,KAAK,CAAC,SAAS,GAAC,SAAS,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/crypto/rsa-oaep.js b/yjs-poll/node_modules/lib0/crypto/rsa-oaep.js deleted file mode 100644 index 7a4e296..0000000 --- a/yjs-poll/node_modules/lib0/crypto/rsa-oaep.js +++ /dev/null @@ -1,81 +0,0 @@ -/** - * RSA-OAEP is an asymmetric keypair used for encryption - */ - -import * as webcrypto from 'lib0/webcrypto' -export { exportKeyJwk } from './common.js' - -/** - * @typedef {Array<'encrypt'|'decrypt'>} Usages - */ - -/** - * @type {Usages} - */ -const defaultUsages = ['encrypt', 'decrypt'] - -/** - * Note that the max data size is limited by the size of the RSA key. - * - * @param {CryptoKey} key - * @param {Uint8Array} data - * @return {PromiseLike>} - */ -export const encrypt = (key, data) => - webcrypto.subtle.encrypt( - { - name: 'RSA-OAEP' - }, - key, - data - ).then(buf => new Uint8Array(buf)) - -/** - * @experimental The API is not final! - * - * Decrypt some data using AES-GCM method. - * - * @param {CryptoKey} key - * @param {Uint8Array} data - * @return {PromiseLike} decrypted buffer - */ -export const decrypt = (key, data) => - webcrypto.subtle.decrypt( - { - name: 'RSA-OAEP' - }, - key, - data - ).then(data => new Uint8Array(data)) - -/** - * @param {Object} opts - * @param {boolean} [opts.extractable] - * @param {Usages} [opts.usages] - * @return {Promise} - */ -export const generateKeyPair = ({ extractable = false, usages = defaultUsages } = {}) => - webcrypto.subtle.generateKey( - { - name: 'RSA-OAEP', - modulusLength: 4096, - publicExponent: new Uint8Array([1, 0, 1]), - hash: 'SHA-256' - }, - extractable, - usages - ) - -/** - * @param {any} jwk - * @param {Object} opts - * @param {boolean} [opts.extractable] - * @param {Usages} [opts.usages] - */ -export const importKeyJwk = (jwk, { extractable = false, usages } = {}) => { - if (usages == null) { - /* c8 ignore next */ - usages = jwk.key_ops || defaultUsages - } - return webcrypto.subtle.importKey('jwk', jwk, { name: 'RSA-OAEP', hash: 'SHA-256' }, extractable, /** @type {Usages} */ (usages)) -} diff --git a/yjs-poll/node_modules/lib0/decoding.d.ts b/yjs-poll/node_modules/lib0/decoding.d.ts deleted file mode 100644 index 4eff347..0000000 --- a/yjs-poll/node_modules/lib0/decoding.d.ts +++ /dev/null @@ -1,165 +0,0 @@ -/** - * A Decoder handles the decoding of an Uint8Array. - * @template {ArrayBufferLike} [Buf=ArrayBufferLike] - */ -export class Decoder { - /** - * @param {Uint8Array} uint8Array Binary data to decode - */ - constructor(uint8Array: Uint8Array); - /** - * Decoding target. - * - * @type {Uint8Array} - */ - arr: Uint8Array; - /** - * Current decoding position. - * - * @type {number} - */ - pos: number; -} -export function createDecoder(uint8Array: Uint8Array): Decoder; -export function hasContent(decoder: Decoder): boolean; -export function clone(decoder: Decoder, newPos?: number): Decoder; -export function readUint8Array(decoder: Decoder, len: number): Uint8Array; -export function readVarUint8Array(decoder: Decoder): Uint8Array; -export function readTailAsUint8Array(decoder: Decoder): Uint8Array; -export function skip8(decoder: Decoder): number; -export function readUint8(decoder: Decoder): number; -export function readUint16(decoder: Decoder): number; -export function readUint32(decoder: Decoder): number; -export function readUint32BigEndian(decoder: Decoder): number; -export function peekUint8(decoder: Decoder): number; -export function peekUint16(decoder: Decoder): number; -export function peekUint32(decoder: Decoder): number; -export function readVarUint(decoder: Decoder): number; -export function readVarInt(decoder: Decoder): number; -export function peekVarUint(decoder: Decoder): number; -export function peekVarInt(decoder: Decoder): number; -export function _readVarStringPolyfill(decoder: Decoder): string; -export function _readVarStringNative(decoder: Decoder): string; -export function readVarString(decoder: Decoder): string; -export function readTerminatedUint8Array(decoder: Decoder): Uint8Array; -export function readTerminatedString(decoder: Decoder): string; -export function peekVarString(decoder: Decoder): string; -export function readFromDataView(decoder: Decoder, len: number): DataView; -export function readFloat32(decoder: Decoder): number; -export function readFloat64(decoder: Decoder): number; -export function readBigInt64(decoder: Decoder): any; -export function readBigUint64(decoder: Decoder): any; -export function readAny(decoder: Decoder): any; -/** - * T must not be null. - * - * @template T - */ -export class RleDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - * @param {function(Decoder):T} reader - */ - constructor(uint8Array: Uint8Array, reader: (arg0: Decoder) => T); - /** - * The reader - */ - reader: (arg0: Decoder) => T; - /** - * Current state - * @type {T|null} - */ - s: T | null; - count: number; - read(): T; -} -export class IntDiffDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - * @param {number} start - */ - constructor(uint8Array: Uint8Array, start: number); - /** - * Current state - * @type {number} - */ - s: number; - /** - * @return {number} - */ - read(): number; -} -export class RleIntDiffDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - * @param {number} start - */ - constructor(uint8Array: Uint8Array, start: number); - /** - * Current state - * @type {number} - */ - s: number; - count: number; - /** - * @return {number} - */ - read(): number; -} -export class UintOptRleDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - */ - constructor(uint8Array: Uint8Array); - /** - * @type {number} - */ - s: number; - count: number; - read(): number; -} -export class IncUintOptRleDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - */ - constructor(uint8Array: Uint8Array); - /** - * @type {number} - */ - s: number; - count: number; - read(): number; -} -export class IntDiffOptRleDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - */ - constructor(uint8Array: Uint8Array); - /** - * @type {number} - */ - s: number; - count: number; - diff: number; - /** - * @return {number} - */ - read(): number; -} -export class StringDecoder { - /** - * @param {Uint8Array} uint8Array - */ - constructor(uint8Array: Uint8Array); - decoder: UintOptRleDecoder; - str: string; - /** - * @type {number} - */ - spos: number; - /** - * @return {string} - */ - read(): string; -} -//# sourceMappingURL=decoding.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/decoding.d.ts.map b/yjs-poll/node_modules/lib0/decoding.d.ts.map deleted file mode 100644 index eb592d7..0000000 --- a/yjs-poll/node_modules/lib0/decoding.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"decoding.d.ts","sourceRoot":"","sources":["decoding.js"],"names":[],"mappings":"AAsCA;;;GAGG;AACH,qBAFgC,GAAG,SAArB,eAAgB;IAG5B;;OAEG;IACH,wBAFW,UAAU,CAAC,GAAG,CAAC,EAezB;IAZC;;;;OAIG;IACH,KAFU,UAAU,CAAC,GAAG,CAAC,CAEJ;IACrB;;;;OAIG;IACH,KAFU,MAAM,CAEJ;CAEf;AAQM,8BAJwB,GAAG,SAApB,eAAgB,cACnB,UAAU,CAAC,GAAG,CAAC,GACd,OAAO,CAAC,GAAG,CAAC,CAE0C;AAO3D,oCAHI,OAAO,GACN,OAAO,CAEoD;AAWhE,+BAJI,OAAO,WACP,MAAM,GACL,OAAO,CAMlB;AAcM,+BALwB,GAAG,SAApB,eAAgB,WACnB,O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FU,CAAC,GAAC,IAAI,CAEH;IACb,cAAc;IAGhB,QAUoB,CAAC,CACpB;CACF;AAED;IACE;;;OAGG;IACH,wBAHW,UAAU,SACV,MAAM,EAShB;IALC;;;OAGG;IACH,GAFU,MAAM,CAEF;IAGhB;;OAEG;IACH,QAFY,MAAM,CAKjB;CACF;AAED;IACE;;;OAGG;IACH,wBAHW,UAAU,SACV,MAAM,EAUhB;IANC;;;OAGG;IACH,GAFU,MAAM,CAEF;IACd,cAAc;IAGhB;;OAEG;IACH,QAFY,MAAM,CAajB;CACF;AAED;IACE;;OAEG;IACH,wBAFW,UAAU,EASpB;IALC;;OAEG;IACH,GAFU,MAAM,CAEN;IACV,cAAc;IAGhB,QAYoB,MAAM,CACzB;CACF;AAED;IACE;;OAEG;IACH,wBAFW,UAAU,EASpB;IALC;;OAEG;IACH,GAFU,MAAM,CAEN;IACV,cAAc;IAGhB,QAYoB,MAAM,CACzB;CACF;AAED;IACE;;OAEG;IACH,wBAFW,UAAU,EAUpB;IANC;;OAEG;IACH,GAFU,MAAM,CAEN;IACV,cAAc;IACd,aAAa;IAGf;;OAEG;IACH,QAFY,MAAM,CAgBjB;CACF;AAED;IACE;;OAEG;IACH,wBAFW,UAAU,EASpB;IANC,2BAAgD;IAChD,YAAsC;IACtC;;OAEG;IACH,MAFU,MAAM,CAEH;IAGf;;OAEG;IACH,QAFY,MAAM,CAOjB;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/decoding.js b/yjs-poll/node_modules/lib0/decoding.js deleted file mode 100644 index 6fd751f..0000000 --- a/yjs-poll/node_modules/lib0/decoding.js +++ /dev/null @@ -1,710 +0,0 @@ -/** - * Efficient schema-less binary decoding with support for variable length encoding. - * - * Use [lib0/decoding] with [lib0/encoding]. Every encoding function has a corresponding decoding function. - * - * Encodes numbers in little-endian order (least to most significant byte order) - * and is compatible with Golang's binary encoding (https://golang.org/pkg/encoding/binary/) - * which is also used in Protocol Buffers. - * - * ```js - * // encoding step - * const encoder = encoding.createEncoder() - * encoding.writeVarUint(encoder, 256) - * encoding.writeVarString(encoder, 'Hello world!') - * const buf = encoding.toUint8Array(encoder) - * ``` - * - * ```js - * // decoding step - * const decoder = decoding.createDecoder(buf) - * decoding.readVarUint(decoder) // => 256 - * decoding.readVarString(decoder) // => 'Hello world!' - * decoding.hasContent(decoder) // => false - all data is read - * ``` - * - * @module decoding - */ - -import * as binary from './binary.js' -import * as math from './math.js' -import * as number from './number.js' -import * as string from './string.js' -import * as error from './error.js' -import * as encoding from './encoding.js' - -const errorUnexpectedEndOfArray = error.create('Unexpected end of array') -const errorIntegerOutOfRange = error.create('Integer out of Range') - -/** - * A Decoder handles the decoding of an Uint8Array. - * @template {ArrayBufferLike} [Buf=ArrayBufferLike] - */ -export class Decoder { - /** - * @param {Uint8Array} uint8Array Binary data to decode - */ - constructor (uint8Array) { - /** - * Decoding target. - * - * @type {Uint8Array} - */ - this.arr = uint8Array - /** - * Current decoding position. - * - * @type {number} - */ - this.pos = 0 - } -} - -/** - * @function - * @template {ArrayBufferLike} Buf - * @param {Uint8Array} uint8Array - * @return {Decoder} - */ -export const createDecoder = uint8Array => new Decoder(uint8Array) - -/** - * @function - * @param {Decoder} decoder - * @return {boolean} - */ -export const hasContent = decoder => decoder.pos !== decoder.arr.length - -/** - * Clone a decoder instance. - * Optionally set a new position parameter. - * - * @function - * @param {Decoder} decoder The decoder instance - * @param {number} [newPos] Defaults to current position - * @return {Decoder} A clone of `decoder` - */ -export const clone = (decoder, newPos = decoder.pos) => { - const _decoder = createDecoder(decoder.arr) - _decoder.pos = newPos - return _decoder -} - -/** - * Create an Uint8Array view of the next `len` bytes and advance the position by `len`. - * - * Important: The Uint8Array still points to the underlying ArrayBuffer. Make sure to discard the result as soon as possible to prevent any memory leaks. - * Use `buffer.copyUint8Array` to copy the result into a new Uint8Array. - * - * @function - * @template {ArrayBufferLike} Buf - * @param {Decoder} decoder The decoder instance - * @param {number} len The length of bytes to read - * @return {Uint8Array} - */ -export const readUint8Array = (decoder, len) => { - const view = new Uint8Array(decoder.arr.buffer, decoder.pos + decoder.arr.byteOffset, len) - decoder.pos += len - return view -} - -/** - * Read variable length Uint8Array. - * - * Important: The Uint8Array still points to the underlying ArrayBuffer. Make sure to discard the result as soon as possible to prevent any memory leaks. - * Use `buffer.copyUint8Array` to copy the result into a new Uint8Array. - * - * @function - * @template {ArrayBufferLike} Buf - * @param {Decoder} decoder - * @return {Uint8Array} - */ -export const readVarUint8Array = decoder => readUint8Array(decoder, readVarUint(decoder)) - -/** - * Read the rest of the content as an ArrayBuffer - * @function - * @param {Decoder} decoder - * @return {Uint8Array} - */ -export const readTailAsUint8Array = decoder => readUint8Array(decoder, decoder.arr.length - decoder.pos) - -/** - * Skip one byte, jump to the next position. - * @function - * @param {Decoder} decoder The decoder instance - * @return {number} The next position - */ -export const skip8 = decoder => decoder.pos++ - -/** - * Read one byte as unsigned integer. - * @function - * @param {Decoder} decoder The decoder instance - * @return {number} Unsigned 8-bit integer - */ -export const readUint8 = decoder => decoder.arr[decoder.pos++] - -/** - * Read 2 bytes as unsigned integer. - * - * @function - * @param {Decoder} decoder - * @return {number} An unsigned integer. - */ -export const readUint16 = decoder => { - const uint = - decoder.arr[decoder.pos] + - (decoder.arr[decoder.pos + 1] << 8) - decoder.pos += 2 - return uint -} - -/** - * Read 4 bytes as unsigned integer. - * - * @function - * @param {Decoder} decoder - * @return {number} An unsigned integer. - */ -export const readUint32 = decoder => { - const uint = - (decoder.arr[decoder.pos] + - (decoder.arr[decoder.pos + 1] << 8) + - (decoder.arr[decoder.pos + 2] << 16) + - (decoder.arr[decoder.pos + 3] << 24)) >>> 0 - decoder.pos += 4 - return uint -} - -/** - * Read 4 bytes as unsigned integer in big endian order. - * (most significant byte first) - * - * @function - * @param {Decoder} decoder - * @return {number} An unsigned integer. - */ -export const readUint32BigEndian = decoder => { - const uint = - (decoder.arr[decoder.pos + 3] + - (decoder.arr[decoder.pos + 2] << 8) + - (decoder.arr[decoder.pos + 1] << 16) + - (decoder.arr[decoder.pos] << 24)) >>> 0 - decoder.pos += 4 - return uint -} - -/** - * Look ahead without incrementing the position - * to the next byte and read it as unsigned integer. - * - * @function - * @param {Decoder} decoder - * @return {number} An unsigned integer. - */ -export const peekUint8 = decoder => decoder.arr[decoder.pos] - -/** - * Look ahead without incrementing the position - * to the next byte and read it as unsigned integer. - * - * @function - * @param {Decoder} decoder - * @return {number} An unsigned integer. - */ -export const peekUint16 = decoder => - decoder.arr[decoder.pos] + - (decoder.arr[decoder.pos + 1] << 8) - -/** - * Look ahead without incrementing the position - * to the next byte and read it as unsigned integer. - * - * @function - * @param {Decoder} decoder - * @return {number} An unsigned integer. - */ -export const peekUint32 = decoder => ( - decoder.arr[decoder.pos] + - (decoder.arr[decoder.pos + 1] << 8) + - (decoder.arr[decoder.pos + 2] << 16) + - (decoder.arr[decoder.pos + 3] << 24) -) >>> 0 - -/** - * Read unsigned integer (32bit) with variable length. - * 1/8th of the storage is used as encoding overhead. - * * numbers < 2^7 is stored in one bytlength - * * numbers < 2^14 is stored in two bylength - * - * @function - * @param {Decoder} decoder - * @return {number} An unsigned integer.length - */ -export const readVarUint = decoder => { - let num = 0 - let mult = 1 - const len = decoder.arr.length - while (decoder.pos < len) { - const r = decoder.arr[decoder.pos++] - // num = num | ((r & binary.BITS7) << len) - num = num + (r & binary.BITS7) * mult // shift $r << (7*#iterations) and add it to num - mult *= 128 // next iteration, shift 7 "more" to the left - if (r < binary.BIT8) { - return num - } - /* c8 ignore start */ - if (num > number.MAX_SAFE_INTEGER) { - throw errorIntegerOutOfRange - } - /* c8 ignore stop */ - } - throw errorUnexpectedEndOfArray -} - -/** - * Read signed integer (32bit) with variable length. - * 1/8th of the storage is used as encoding overhead. - * * numbers < 2^7 is stored in one bytlength - * * numbers < 2^14 is stored in two bylength - * @todo This should probably create the inverse ~num if number is negative - but this would be a breaking change. - * - * @function - * @param {Decoder} decoder - * @return {number} An unsigned integer.length - */ -export const readVarInt = decoder => { - let r = decoder.arr[decoder.pos++] - let num = r & binary.BITS6 - let mult = 64 - const sign = (r & binary.BIT7) > 0 ? -1 : 1 - if ((r & binary.BIT8) === 0) { - // don't continue reading - return sign * num - } - const len = decoder.arr.length - while (decoder.pos < len) { - r = decoder.arr[decoder.pos++] - // num = num | ((r & binary.BITS7) << len) - num = num + (r & binary.BITS7) * mult - mult *= 128 - if (r < binary.BIT8) { - return sign * num - } - /* c8 ignore start */ - if (num > number.MAX_SAFE_INTEGER) { - throw errorIntegerOutOfRange - } - /* c8 ignore stop */ - } - throw errorUnexpectedEndOfArray -} - -/** - * Look ahead and read varUint without incrementing position - * - * @function - * @param {Decoder} decoder - * @return {number} - */ -export const peekVarUint = decoder => { - const pos = decoder.pos - const s = readVarUint(decoder) - decoder.pos = pos - return s -} - -/** - * Look ahead and read varUint without incrementing position - * - * @function - * @param {Decoder} decoder - * @return {number} - */ -export const peekVarInt = decoder => { - const pos = decoder.pos - const s = readVarInt(decoder) - decoder.pos = pos - return s -} - -/** - * We don't test this function anymore as we use native decoding/encoding by default now. - * Better not modify this anymore.. - * - * Transforming utf8 to a string is pretty expensive. The code performs 10x better - * when String.fromCodePoint is fed with all characters as arguments. - * But most environments have a maximum number of arguments per functions. - * For effiency reasons we apply a maximum of 10000 characters at once. - * - * @function - * @param {Decoder} decoder - * @return {String} The read String. - */ -/* c8 ignore start */ -export const _readVarStringPolyfill = decoder => { - let remainingLen = readVarUint(decoder) - if (remainingLen === 0) { - return '' - } else { - let encodedString = String.fromCodePoint(readUint8(decoder)) // remember to decrease remainingLen - if (--remainingLen < 100) { // do not create a Uint8Array for small strings - while (remainingLen--) { - encodedString += String.fromCodePoint(readUint8(decoder)) - } - } else { - while (remainingLen > 0) { - const nextLen = remainingLen < 10000 ? remainingLen : 10000 - // this is dangerous, we create a fresh array view from the existing buffer - const bytes = decoder.arr.subarray(decoder.pos, decoder.pos + nextLen) - decoder.pos += nextLen - // Starting with ES5.1 we can supply a generic array-like object as arguments - encodedString += String.fromCodePoint.apply(null, /** @type {any} */ (bytes)) - remainingLen -= nextLen - } - } - return decodeURIComponent(escape(encodedString)) - } -} -/* c8 ignore stop */ - -/** - * @function - * @param {Decoder} decoder - * @return {String} The read String - */ -export const _readVarStringNative = decoder => - /** @type any */ (string.utf8TextDecoder).decode(readVarUint8Array(decoder)) - -/** - * Read string of variable length - * * varUint is used to store the length of the string - * - * @function - * @param {Decoder} decoder - * @return {String} The read String - * - */ -/* c8 ignore next */ -export const readVarString = string.utf8TextDecoder ? _readVarStringNative : _readVarStringPolyfill - -/** - * @param {Decoder} decoder - * @return {Uint8Array} - */ -export const readTerminatedUint8Array = decoder => { - const encoder = encoding.createEncoder() - let b - while (true) { - b = readUint8(decoder) - if (b === 0) { - return encoding.toUint8Array(encoder) - } - if (b === 1) { - b = readUint8(decoder) - } - encoding.write(encoder, b) - } -} - -/** - * @param {Decoder} decoder - * @return {string} - */ -export const readTerminatedString = decoder => string.decodeUtf8(readTerminatedUint8Array(decoder)) - -/** - * Look ahead and read varString without incrementing position - * - * @function - * @param {Decoder} decoder - * @return {string} - */ -export const peekVarString = decoder => { - const pos = decoder.pos - const s = readVarString(decoder) - decoder.pos = pos - return s -} - -/** - * @param {Decoder} decoder - * @param {number} len - * @return {DataView} - */ -export const readFromDataView = (decoder, len) => { - const dv = new DataView(decoder.arr.buffer, decoder.arr.byteOffset + decoder.pos, len) - decoder.pos += len - return dv -} - -/** - * @param {Decoder} decoder - */ -export const readFloat32 = decoder => readFromDataView(decoder, 4).getFloat32(0, false) - -/** - * @param {Decoder} decoder - */ -export const readFloat64 = decoder => readFromDataView(decoder, 8).getFloat64(0, false) - -/** - * @param {Decoder} decoder - */ -export const readBigInt64 = decoder => /** @type {any} */ (readFromDataView(decoder, 8)).getBigInt64(0, false) - -/** - * @param {Decoder} decoder - */ -export const readBigUint64 = decoder => /** @type {any} */ (readFromDataView(decoder, 8)).getBigUint64(0, false) - -/** - * @type {Array} - */ -const readAnyLookupTable = [ - decoder => undefined, // CASE 127: undefined - decoder => null, // CASE 126: null - readVarInt, // CASE 125: integer - readFloat32, // CASE 124: float32 - readFloat64, // CASE 123: float64 - readBigInt64, // CASE 122: bigint - decoder => false, // CASE 121: boolean (false) - decoder => true, // CASE 120: boolean (true) - readVarString, // CASE 119: string - decoder => { // CASE 118: object - const len = readVarUint(decoder) - /** - * @type {Object} - */ - const obj = {} - for (let i = 0; i < len; i++) { - const key = readVarString(decoder) - obj[key] = readAny(decoder) - } - return obj - }, - decoder => { // CASE 117: array - const len = readVarUint(decoder) - const arr = [] - for (let i = 0; i < len; i++) { - arr.push(readAny(decoder)) - } - return arr - }, - readVarUint8Array // CASE 116: Uint8Array -] - -/** - * @param {Decoder} decoder - */ -export const readAny = decoder => readAnyLookupTable[127 - readUint8(decoder)](decoder) - -/** - * T must not be null. - * - * @template T - */ -export class RleDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - * @param {function(Decoder):T} reader - */ - constructor (uint8Array, reader) { - super(uint8Array) - /** - * The reader - */ - this.reader = reader - /** - * Current state - * @type {T|null} - */ - this.s = null - this.count = 0 - } - - read () { - if (this.count === 0) { - this.s = this.reader(this) - if (hasContent(this)) { - this.count = readVarUint(this) + 1 // see encoder implementation for the reason why this is incremented - } else { - this.count = -1 // read the current value forever - } - } - this.count-- - return /** @type {T} */ (this.s) - } -} - -export class IntDiffDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - * @param {number} start - */ - constructor (uint8Array, start) { - super(uint8Array) - /** - * Current state - * @type {number} - */ - this.s = start - } - - /** - * @return {number} - */ - read () { - this.s += readVarInt(this) - return this.s - } -} - -export class RleIntDiffDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - * @param {number} start - */ - constructor (uint8Array, start) { - super(uint8Array) - /** - * Current state - * @type {number} - */ - this.s = start - this.count = 0 - } - - /** - * @return {number} - */ - read () { - if (this.count === 0) { - this.s += readVarInt(this) - if (hasContent(this)) { - this.count = readVarUint(this) + 1 // see encoder implementation for the reason why this is incremented - } else { - this.count = -1 // read the current value forever - } - } - this.count-- - return /** @type {number} */ (this.s) - } -} - -export class UintOptRleDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - */ - constructor (uint8Array) { - super(uint8Array) - /** - * @type {number} - */ - this.s = 0 - this.count = 0 - } - - read () { - if (this.count === 0) { - this.s = readVarInt(this) - // if the sign is negative, we read the count too, otherwise count is 1 - const isNegative = math.isNegativeZero(this.s) - this.count = 1 - if (isNegative) { - this.s = -this.s - this.count = readVarUint(this) + 2 - } - } - this.count-- - return /** @type {number} */ (this.s) - } -} - -export class IncUintOptRleDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - */ - constructor (uint8Array) { - super(uint8Array) - /** - * @type {number} - */ - this.s = 0 - this.count = 0 - } - - read () { - if (this.count === 0) { - this.s = readVarInt(this) - // if the sign is negative, we read the count too, otherwise count is 1 - const isNegative = math.isNegativeZero(this.s) - this.count = 1 - if (isNegative) { - this.s = -this.s - this.count = readVarUint(this) + 2 - } - } - this.count-- - return /** @type {number} */ (this.s++) - } -} - -export class IntDiffOptRleDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - */ - constructor (uint8Array) { - super(uint8Array) - /** - * @type {number} - */ - this.s = 0 - this.count = 0 - this.diff = 0 - } - - /** - * @return {number} - */ - read () { - if (this.count === 0) { - const diff = readVarInt(this) - // if the first bit is set, we read more data - const hasCount = diff & 1 - this.diff = math.floor(diff / 2) // shift >> 1 - this.count = 1 - if (hasCount) { - this.count = readVarUint(this) + 2 - } - } - this.s += this.diff - this.count-- - return this.s - } -} - -export class StringDecoder { - /** - * @param {Uint8Array} uint8Array - */ - constructor (uint8Array) { - this.decoder = new UintOptRleDecoder(uint8Array) - this.str = readVarString(this.decoder) - /** - * @type {number} - */ - this.spos = 0 - } - - /** - * @return {string} - */ - read () { - const end = this.spos + this.decoder.read() - const res = this.str.slice(this.spos, end) - this.spos = end - return res - } -} diff --git a/yjs-poll/node_modules/lib0/delta/binding.d.ts b/yjs-poll/node_modules/lib0/delta/binding.d.ts deleted file mode 100644 index 5bf528f..0000000 --- a/yjs-poll/node_modules/lib0/delta/binding.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -/** - * @template T - * @typedef {import('../schema.js').Schema} Schema - */ -/** - * @template {delta.AbstractDelta} DeltaA - * @template {delta.AbstractDelta} DeltaB - */ -export class Binding { - /** - * @param {RDT} a - * @param {RDT} b - * @param {dt.Template} template - */ - constructor(a: RDT, b: RDT, template: dt.Template); - /** - * @type {dt.Transformer} - */ - t: dt.Transformer; - a: RDT; - b: RDT; - _mux: mux.mutex; - _achanged: (delta: DeltaA) => void; - _bchanged: (delta: DeltaB) => void; - destroy: () => void; -} -export function bind>(a: RDT, b: RDT ? DeltaB : never>, template: dt.Template): Binding ? DeltaB : never>; -export function deltaRDT($delta: Schema): DeltaRDT; -export const $domDelta: any; -export function domRDT(dom: Element): DomRDT>; -export type Schema = import("../schema.js").Schema; -/** - * Abstract Interface for a delta-based Replicated Data Type. - */ -export type RDT = ObservableV2<{ - "change": (delta: Delta) => void; - "destroy": (rdt: RDT) => void; -}> & { - update: (delta: Delta) => any; - destroy: () => void; -}; -export type DomDelta = delta.RecursiveNode; -import * as delta from './delta.js'; -import * as dt from './t3.test.js'; -import * as mux from '../mutex.js'; -/** - * @template {delta.AbstractDelta} Delta - * @implements RDT - * @extends {ObservableV2<{ change: (delta: Delta) => void, 'destroy': (rdt:DeltaRDT)=>void }>} - */ -declare class DeltaRDT extends ObservableV2<{ - change: (delta: Delta) => void; - destroy: (rdt: DeltaRDT) => void; -}> implements RDT { - /** - * @param {Schema} $delta - */ - constructor($delta: Schema); - $delta: s.Schema; - /** - * @type {Delta?} - */ - state: Delta | null; - _mux: mux.mutex; - /** - * @param {Delta} delta - */ - update: (delta: Delta) => any; -} -/** - * @typedef {delta.RecursiveNode} DomDelta - */ -/** - * @template {DomDelta} [D=DomDelta] - * @implements RDT - * @extends {ObservableV2<{ change: (delta: D)=>void, destroy: (rdt:DomRDT)=>void }>}>} - */ -declare class DomRDT> extends ObservableV2<{ - change: (delta: D) => void; - destroy: (rdt: DomRDT) => void; -}> implements RDT { - /** - * @param {Element} observedNode - */ - constructor(observedNode: Element); - observedNode: Element; - _mux: mux.mutex; - observer: MutationObserver; - /** - * @param {MutationRecord[]} mutations - */ - _mutationHandler: (mutations: MutationRecord[]) => any; - /** - * @param {D} delta - */ - update: (delta: D) => void; -} -import { ObservableV2 } from '../observable.js'; -import * as s from '../schema.js'; -export {}; -//# sourceMappingURL=binding.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/delta/binding.d.ts.map b/yjs-poll/node_modules/lib0/delta/binding.d.ts.map deleted file mode 100644 index 524ae15..0000000 --- a/yjs-poll/node_modules/lib0/delta/binding.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"binding.d.ts","sourceRoot":"","sources":["binding.js"],"names":[],"mappings":"AAeA;;;GAGG;AAEH;;;GAGG;AACH,qBAHmC,MAAM,SAA3B,KAAK,CAAC,aAAc,EACC,MAAM,SAA3B,KAAK,CAAC,aAAc;IAGhC;;;;OAIG;IACH,eAJW,GAAG,CAAC,MAAM,CAAC,KACX,GAAG,CAAC,MAAM,CAAC,YACX,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAC,MAAM,EAAC,MAAM,CAAC,EA4BxC;IAzBC;;OAEG;IACH,GAFU,EAAE,CAAC,WAAW,CAAC,GAAG,EAAC,MAAM,EAAC,MAAM,CAAC,CAEnB;IACxB,eAAU;IACV,eAAU;IACV,gBAA6B;IAC7B,8BAgCoD,IAAI,CAxBrD;IACH,8BAuBoD,IAAI,CAfrD;IAGL,oBAKC;CACF;AAgBM,qBAN4B,MAAM,SAA3B,KAAK,CAAC,aAAc,EACS,WAAW,SAAxC,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAC,MAAM,EAAC,GAAG,CAAE,KAC/B,GAAG,CAAC,MAAM,CAAC,KACX,GAAG,CAAC,WAAW,SAAS,EAAE,CAAC,QAAQ,CAAC,GA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EH;;;;GAIG;AACH,qBAJyB,CAAC,SAAZ,QAAS;;;YAEa,CAAC,KAAK,EAAE,CAAC,KAAG,IAAI;aAAW,CAAC,GAAG,EAAC,MAAM,CAAC,CAAC,CAAC,KAAG,IAAI;cADrE,GAAG,CAAC,CAAC;IAIlB;;OAEG;IACH,0BAFW,OAAO,EAajB;IATC,sBAAgC;IAChC,gBAA6B;IAC7B,2BAA2D;IAS7D;;OAEG;IACH,mBAAmB,WAFR,cAAc,EAEG,SAGxB;IAEJ;;OAEG;IACH,SAAS,OAFE,CAEG,UAWb;CAOF;6BA1W4B,kBAAkB;mBAS5B,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/delta/binding.js b/yjs-poll/node_modules/lib0/delta/binding.js deleted file mode 100644 index 2a1c007..0000000 --- a/yjs-poll/node_modules/lib0/delta/binding.js +++ /dev/null @@ -1,372 +0,0 @@ -/* eslint-disable */ -// @ts-nocheck -// @todo remove all @ts-nocheck and eslint-disable -/* global MutationObserver */ -import { ObservableV2 } from '../observable.js' -import * as delta from './delta.js' -import * as dt from './t3.test.js' // eslint-disable-line -import * as dom from '../dom.js' -import * as set from '../set.js' -import * as map from '../map.js' -import * as error from '../error.js' -import * as math from '../math.js' -import * as mux from '../mutex.js' -import * as s from '../schema.js' - -/** - * @template T - * @typedef {import('../schema.js').Schema} Schema - */ - -/** - * @template {delta.AbstractDelta} DeltaA - * @template {delta.AbstractDelta} DeltaB - */ -export class Binding { - /** - * @param {RDT} a - * @param {RDT} b - * @param {dt.Template} template - */ - constructor (a, b, template) { - /** - * @type {dt.Transformer} - */ - this.t = template.init() - this.a = a - this.b = b - this._mux = mux.createMutex() - this._achanged = this.a.on('change', d => this._mux(() => { - const tres = this.t.applyA(d) - if (tres.a) { - a.update(tres.a) - } - if (tres.b) { - b.update(tres.b) - } - })) - this._bchanged = this.b.on('change', d => this._mux(() => { - const tres = this.t.applyB(d) - if (tres.b) { - this.b.update(tres.b) - } - if (tres.a) { - a.update(tres.a) - } - })) - } - - destroy = () => { - this.a.off('destroy', this.destroy) - this.b.off('destroy', this.destroy) - this.a.off('change', this._achanged) - this.b.off('change', this._bchanged) - } -} - -/** - * Abstract Interface for a delta-based Replicated Data Type. - * - * @template {delta.AbstractDelta} Delta - * @typedef {ObservableV2<{ 'change': (delta: Delta) => void, 'destroy': (rdt:RDT)=>void }> & { update: (delta: Delta) => any, destroy: () => void }} RDT - */ - -/** - * @template {delta.AbstractDelta} DeltaA - * @template {dt.Template} Transformer - * @param {RDT} a - * @param {RDT ? DeltaB : never>} b - * @param {dt.Template} template - */ -export const bind = (a, b, template) => new Binding(a, b, template) - -/** - * @template {delta.AbstractDelta} Delta - * @implements RDT - * @extends {ObservableV2<{ change: (delta: Delta) => void, 'destroy': (rdt:DeltaRDT)=>void }>} - */ -class DeltaRDT extends ObservableV2 { - /** - * @param {Schema} $delta - */ - constructor ($delta) { - super() - this.$delta = $delta - /** - * @type {Delta?} - */ - this.state = null - this._mux = mux.createMutex() - } - - /** - * @param {Delta} delta - */ - update = delta => delta.isEmpty() || this._mux(() => { - if (this.state != null) { - this.state.apply(delta) - } else { - this.state = delta - } - this.emit('change', [delta]) - }) - - destroy () { - this.emit('destroy', [this]) - super.destroy() - } -} - -/** - * @template {delta.AbstractDelta} Delta - * @param {Schema} $delta - */ -export const deltaRDT = $delta => new DeltaRDT($delta) - -/** - * @param {Node} domNode - */ -const domToDelta = domNode => { - if (dom.$element.check(domNode)) { - const d = delta.node(domNode.nodeName.toLowerCase()) - for (let i = 0; i < domNode.attributes.length; i++) { - const attr = /** @type {Attr} */ (domNode.attributes.item(i)) - d.attributes.set(attr.nodeName, attr.value) - } - domNode.childNodes.forEach(child => { - d.children.insert(dom.$text.check(child) ? child.textContent : [domToDelta(child)]) - }) - return d - } - error.unexpectedCase() -} - -/** - * @param {DomDelta} d - */ -const deltaToDom = d => { - if (delta.$nodeAny.check(d)) { - const n = dom.element(d.name) - d.attributes.forEach(change => { - if (delta.$insertOp.check(change)) { - n.setAttribute(change.key, change.value) - } - }) - d.children.forEach(child => { - if (delta.$insertOp.check(child)) { - n.append(...child.insert.map(deltaToDom)) - } else if (delta.$textOp.check(child)) { - n.append(dom.text(child.insert)) - } - }) - return n - } - error.unexpectedCase() -} - -/** - * @param {Element} el - * @param {delta.Node} d - */ -const applyDeltaToDom = (el, d) => { - d.attributes.forEach(change => { - if (delta.$deleteOp.check(change)) { - el.removeAttribute(change.key) - } else { - el.setAttribute(change.key, change.value) - } - }) - let childIndex = 0 - let childOffset = 0 - d.children.forEach(change => { - let child = el.childNodes[childIndex] || null - if (delta.$deleteOp.check(change)) { - let len = change.length - while (len > 0) { - if (dom.$element.check(child)) { - child.remove() - len-- - } else if (dom.$text.check(child)) { - const childLen = child.length - if (childOffset === 0 && childLen <= len) { - child.remove() - len -= childLen - } else { - const spliceLen = math.min(len, childLen - childOffset) - child.deleteData(childOffset, spliceLen) - if (child.length <= childOffset) { - childOffset = 0 - childIndex++ - } - } - } - } - } else if (delta.$insertOp.check(change)) { - if (childOffset > 0) { - const tchild = dom.$text.cast(child) - child = tchild.splitText(childOffset) - childIndex++ - childOffset = 0 - } - el.insertBefore(dom.fragment(change.insert.map(deltaToDom)), child) - } else if (delta.$modifyOp.check(change)) { - applyDeltaToDom(dom.$element.cast(child), change.modify) - } else if (delta.$textOp.check(change)) { - el.insertBefore(dom.text(change.insert), child) - } else { - error.unexpectedCase() - } - }) -} - -export const $domDelta = delta.$node(s.$string, s.$record(s.$string, s.$string), s.$never, { recursive: true, withText: true }) - -/** - * @param {Element} observedNode - * @param {MutationRecord[]} mutations - * @param {any} origin assign this origin to the generated delta - */ -const _mutationsToDelta = (observedNode, mutations, origin) => { - /** - * @typedef {{ removedBefore: Map, added: Set, modified: number, d: delta.Node }} ChangedNodeInfo - */ - /** - * Compute all deltas without recursion. - * - * 1. mark all changed parents in parentsChanged - * 2. fill out necessary information for each changed parent () - */ - // - /** - * @type {Map} - */ - const changedNodes = map.create() - /** - * @param {Node} node - * @return {ChangedNodeInfo} - */ - const getChangedNodeInfo = node => map.setIfUndefined(changedNodes, node, () => ({ removedBefore: map.create(), added: set.create(), modified: 0, d: delta.node(node.nodeName.toLowerCase()) })) - const observedNodeInfo = getChangedNodeInfo(observedNode) - mutations.forEach(mutation => { - const target = /** @type {HTMLElement} */ (mutation.target) - const parent = target.parentNode - const attrName = /** @type {string} */ (mutation.attributeName) - const newVal = target.getAttribute(attrName) - const info = getChangedNodeInfo(target) - const d = info.d - // go up the tree and mark that a child has been modified - for (let changedParent = parent; changedParent != null && getChangedNodeInfo(changedParent).modified++ > 1 && changedParent !== observedNode; changedParent = changedParent.parentNode) { - // nop - } - switch (mutation.type) { - case 'attributes': { - const attrs = /** @type {delta.Node} */ (d).attributes - if (newVal == null) { - attrs.delete(attrName) - } else { - attrs.set(/** @type {string} */ (attrName), newVal) - } - break - } - case 'characterData': { - error.methodUnimplemented() - break - } - case 'childList': { - const targetInfo = getChangedNodeInfo(target) - mutation.addedNodes.forEach(node => { - targetInfo.added.add(node) - }) - const removed = mutation.removedNodes.length - if (removed > 0) { - // @todo this can't work because next can be null - targetInfo.removedBefore.set(mutation.nextSibling, removed) - } - break - } - } - }) - changedNodes.forEach((info, node) => { - const numOfChildChanges = info.modified + info.removedBefore.size + info.added.size - const d = /** @type {delta.Node} */ (info.d) - if (numOfChildChanges > 0) { - node.childNodes.forEach(nchild => { - if (info.removedBefore.has(nchild)) { // can happen separately - d.children.delete(/** @type {number} */ (info.removedBefore.get(nchild))) - } - if (info.added.has(nchild)) { - d.children.insert(dom.$text.check(nchild) ? nchild.textContent : [domToDelta(nchild)]) - } else if (changedNodes.has(nchild)) { - d.children.modify(getChangedNodeInfo(nchild).d) - } - }) - // remove items to the end, if necessary - d.children.delete(info.removedBefore.get(null) ?? 0) - } - d.done() - }) - observedNodeInfo.d.origin = origin - return observedNodeInfo.d -} - -/** - * @typedef {delta.RecursiveNode} DomDelta - */ - -/** - * @template {DomDelta} [D=DomDelta] - * @implements RDT - * @extends {ObservableV2<{ change: (delta: D)=>void, destroy: (rdt:DomRDT)=>void }>}>} - */ -class DomRDT extends ObservableV2 { - /** - * @param {Element} observedNode - */ - constructor (observedNode) { - super() - this.observedNode = observedNode - this._mux = mux.createMutex() - this.observer = new MutationObserver(this._mutationHandler) - this.observer.observe(observedNode, { - subtree: true, - childList: true, - attributes: true, - characterDataOldValue: true - }) - } - - /** - * @param {MutationRecord[]} mutations - */ - _mutationHandler = mutations => - mutations.length > 0 && this._mux(() => { - this.emit('change', [/** @type {D} */(_mutationsToDelta(this.observedNode, mutations, this))]) - }) - - /** - * @param {D} delta - */ - update = delta => { - if (delta.origin !== this) { - // @todo the retrieved changes must be transformed agains the updated changes. need a proper - // transaction system - this._mutationHandler(this.observer.takeRecords()) - this._mux(() => { - applyDeltaToDom(this.observedNode, delta) - const mutations = this.observer.takeRecords() - this.emit('change', [/** @type {D} */(_mutationsToDelta(this.observedNode, mutations, delta.origin))]) - }) - } - } - - destroy () { - this.emit('destroy', [this]) - super.destroy() - this.observer.disconnect() - } -} - -/** - * @param {Element} dom - */ -export const domRDT = dom => new DomRDT(dom) diff --git a/yjs-poll/node_modules/lib0/delta/binding.test.d.ts b/yjs-poll/node_modules/lib0/delta/binding.test.d.ts deleted file mode 100644 index eae1385..0000000 --- a/yjs-poll/node_modules/lib0/delta/binding.test.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function testBinding(): void; -export function testDomBindingBasics(): void; -export function testDomBindingBackAndForth(): void; -export function testDataToDom(): void; -//# sourceMappingURL=binding.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/delta/binding.test.d.ts.map b/yjs-poll/node_modules/lib0/delta/binding.test.d.ts.map deleted file mode 100644 index fbeb785..0000000 --- a/yjs-poll/node_modules/lib0/delta/binding.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"binding.test.d.ts","sourceRoot":"","sources":["binding.test.js"],"names":[],"mappings":"AAUO,oCAcN;AAEM,6CAcN;AAEM,mDAkCN;AAEM,sCAiBN"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/delta/delta-pitch.test.d.ts b/yjs-poll/node_modules/lib0/delta/delta-pitch.test.d.ts deleted file mode 100644 index 1d4291c..0000000 --- a/yjs-poll/node_modules/lib0/delta/delta-pitch.test.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function testDeltaBasics(_tc: t.TestCase): void; -export function testDeltaBasicSchema(_tc: t.TestCase): void; -export function testDeltaValues(_tc: t.TestCase): void; -import * as t from 'lib0/testing'; -//# sourceMappingURL=delta-pitch.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/delta/delta-pitch.test.d.ts.map b/yjs-poll/node_modules/lib0/delta/delta-pitch.test.d.ts.map deleted file mode 100644 index 1a2ad3e..0000000 --- a/yjs-poll/node_modules/lib0/delta/delta-pitch.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"delta-pitch.test.d.ts","sourceRoot":"","sources":["delta-pitch.test.js"],"names":[],"mappings":"AAmCO,qCAFI,CAAC,CAAC,QAAQ,QAWpB;AAmBM,0CAFI,CAAC,CAAC,QAAQ,QAWpB;AAYM,qCAFI,CAAC,CAAC,QAAQ,QAwBpB;mBAzGkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/delta/delta.d.ts b/yjs-poll/node_modules/lib0/delta/delta.d.ts deleted file mode 100644 index 2f11094..0000000 --- a/yjs-poll/node_modules/lib0/delta/delta.d.ts +++ /dev/null @@ -1,1008 +0,0 @@ -/** - * @typedef {{ - * insert?: string[] - * insertAt?: number - * delete?: string[] - * deleteAt?: number - * format?: Record - * formatAt?: number - * }} Attribution - */ -/** - * @type {s.Schema} - */ -export const $attribution: s.Schema; -/** - * @typedef {s.Unwrap<$anyOp>} DeltaOps - */ -/** - * @typedef {{ [key: string]: any }} FormattingAttributes - */ -/** - * @typedef {{ - * type: 'delta', - * name?: string, - * attrs?: { [Key in string|number]: DeltaAttrOpJSON }, - * children?: Array - * }} DeltaJSON - */ -/** - * @typedef {{ type: 'insert', insert: string|Array, format?: { [key: string]: any }, attribution?: Attribution } | { delete: number } | { type: 'retain', retain: number, format?: { [key:string]: any }, attribution?: Attribution } | { type: 'modify', value: object }} DeltaListOpJSON - */ -/** - * @typedef {{ type: 'insert', value: any, prevValue?: any, attribution?: Attribution } | { type: 'delete', prevValue?: any, attribution?: Attribution } | { type: 'modify', value: DeltaJSON }} DeltaAttrOpJSON - */ -/** - * @typedef {TextOp|InsertOp|DeleteOp|RetainOp|ModifyOp} ChildrenOpAny - */ -/** - * @typedef {AttrInsertOp|AttrDeleteOp|AttrModifyOp} AttrOpAny - */ -/** - * @typedef {ChildrenOpAny|AttrOpAny} _OpAny - */ -/** - * @type {s.Schema} - */ -export const $deltaMapChangeJson: s.Schema; -export class TextOp extends list.ListNode { - /** - * @param {string} insert - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor(insert: string, format: FormattingAttributes | null, attribution: Attribution | null); - /** - * @readonly - * @type {string} - */ - readonly insert: string; - /** - * @readonly - * @type {FormattingAttributes|null} - */ - readonly format: FormattingAttributes | null; - attribution: Attribution | null; - /** - * @type {string?} - */ - _fingerprint: string | null; - /** - * @param {string} newVal - */ - _updateInsert(newVal: string): void; - /** - * @return {'insert'} - */ - get type(): "insert"; - get length(): number; - get fingerprint(): string; - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} offset - * @param {number} len - */ - _splice(offset: number, len: number): this; - /** - * @return {DeltaListOpJSON} - */ - toJSON(): DeltaListOpJSON; - /** - * @return {TextOp} - */ - clone(start?: number, end?: number): TextOp; - /** - * @param {TextOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: TextOp): boolean; -} -/** - * @template {fingerprintTrait.Fingerprintable} ArrayContent - */ -export class InsertOp extends list.ListNode { - /** - * @param {Array} insert - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor(insert: Array, format: FormattingAttributes | null, attribution: Attribution | null); - /** - * @readonly - * @type {Array} - */ - readonly insert: Array; - /** - * @readonly - * @type {FormattingAttributes?} - */ - readonly format: FormattingAttributes | null; - /** - * @readonly - * @type {Attribution?} - */ - readonly attribution: Attribution | null; - /** - * @type {string?} - */ - _fingerprint: string | null; - /** - * @param {ArrayContent} newVal - */ - _updateInsert(newVal: ArrayContent): void; - /** - * @return {'insert'} - */ - get type(): "insert"; - get length(): number; - /** - * @param {number} i - * @return {Extract} - */ - _modValue(i: number): Extract; - get fingerprint(): string; - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} offset - * @param {number} len - */ - _splice(offset: number, len: number): this; - /** - * @return {DeltaListOpJSON} - */ - toJSON(): DeltaListOpJSON; - /** - * @return {InsertOp} - */ - clone(start?: number, end?: number): InsertOp; - /** - * @param {InsertOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: InsertOp): boolean; -} -/** - * @template {fingerprintTrait.Fingerprintable} [Children=never] - * @template {string} [Text=never] - */ -export class DeleteOp extends list.ListNode { - /** - * @param {number} len - */ - constructor(len: number); - delete: number; - /** - * @type {(Children|Text) extends never ? null : (Delta?)} - */ - prevValue: (Children | Text) extends never ? null : (Delta | null); - /** - * @type {string|null} - */ - _fingerprint: string | null; - /** - * @return {'delete'} - */ - get type(): "delete"; - get length(): number; - get fingerprint(): string; - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} _offset - * @param {number} len - */ - _splice(_offset: number, len: number): this; - /** - * @return {DeltaListOpJSON} - */ - toJSON(): DeltaListOpJSON; - clone(start?: number, end?: number): DeleteOp; - /** - * @param {DeleteOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: DeleteOp): boolean; -} -export class RetainOp extends list.ListNode { - /** - * @param {number} retain - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor(retain: number, format: FormattingAttributes | null, attribution: Attribution | null); - /** - * @readonly - * @type {number} - */ - readonly retain: number; - /** - * @readonly - * @type {FormattingAttributes?} - */ - readonly format: FormattingAttributes | null; - /** - * @readonly - * @type {Attribution?} - */ - readonly attribution: Attribution | null; - /** - * @type {string|null} - */ - _fingerprint: string | null; - /** - * @return {'retain'} - */ - get type(): "retain"; - get length(): number; - get fingerprint(): string; - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} _offset - * @param {number} len - */ - _splice(_offset: number, len: number): this; - /** - * @return {DeltaListOpJSON} - */ - toJSON(): DeltaListOpJSON; - clone(start?: number, end?: number): RetainOp; - /** - * @param {RetainOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: RetainOp): boolean; -} -/** - * Delta that can be applied on a YType Embed - * - * @template {DeltaAny} [DTypes=DeltaAny] - */ -export class ModifyOp extends list.ListNode { - /** - * @param {DTypes} delta - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor(delta: DTypes, format: FormattingAttributes | null, attribution: Attribution | null); - /** - * @readonly - * @type {DTypes} - */ - readonly value: DTypes; - /** - * @readonly - * @type {FormattingAttributes?} - */ - readonly format: FormattingAttributes | null; - /** - * @readonly - * @type {Attribution?} - */ - readonly attribution: Attribution | null; - /** - * @type {string|null} - */ - _fingerprint: string | null; - /** - * @return {'modify'} - */ - get type(): "modify"; - get length(): number; - /** - * @type {DeltaBuilderAny} - */ - get _modValue(): DeltaBuilderAny; - get fingerprint(): string; - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} _offset - * @param {number} _len - */ - _splice(_offset: number, _len: number): this; - /** - * @return {DeltaListOpJSON} - */ - toJSON(): DeltaListOpJSON; - /** - * @return {ModifyOp} - */ - clone(): ModifyOp; - /** - * @param {ModifyOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: ModifyOp): boolean; -} -/** - * @template {fingerprintTrait.Fingerprintable} V - * @template {string|number} [K=any] - */ -export class AttrInsertOp { - /** - * @param {K} key - * @param {V} value - * @param {V|undefined} prevValue - * @param {Attribution?} attribution - */ - constructor(key: K, value: V, prevValue: V | undefined, attribution: Attribution | null); - /** - * @readonly - * @type {K} - */ - readonly key: K; - /** - * @readonly - * @type {V} - */ - readonly value: V; - /** - * @readonly - * @type {V|undefined} - */ - readonly prevValue: V | undefined; - /** - * @readonly - * @type {Attribution?} - */ - readonly attribution: Attribution | null; - /** - * @type {string|null} - */ - _fingerprint: string | null; - /** - * @return {'insert'} - */ - get type(): "insert"; - /** - * @type {DeltaBuilderAny} - */ - get _modValue(): DeltaBuilderAny; - get fingerprint(): string; - toJSON(): { - type: "insert"; - value: V | DeltaJSON; - } & (({ - attribution: Attribution; - } | { - attribution?: undefined; - }) & ({ - prevValue: V & {}; - } | { - prevValue?: undefined; - })); - /** - * @return {AttrInsertOp} - */ - clone(): AttrInsertOp; - /** - * @param {AttrInsertOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: AttrInsertOp): boolean; -} -/** - * @template V - * @template {string|number} [K=string] - */ -export class AttrDeleteOp { - /** - * @param {K} key - * @param {V|undefined} prevValue - * @param {Attribution?} attribution - */ - constructor(key: K, prevValue: V | undefined, attribution: Attribution | null); - /** - * @type {K} - */ - key: K; - /** - * @type {V|undefined} - */ - prevValue: V | undefined; - attribution: Attribution | null; - /** - * @type {string|null} - */ - _fingerprint: string | null; - get value(): undefined; - /** - * @type {'delete'} - */ - get type(): "delete"; - get fingerprint(): string; - /** - * @return {DeltaAttrOpJSON} - */ - toJSON(): DeltaAttrOpJSON; - clone(): AttrDeleteOp; - /** - * @param {AttrDeleteOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: AttrDeleteOp): boolean; -} -/** - * @template {DeltaAny} [Modifier=DeltaAny] - * @template {string|number} [K=string] - */ -export class AttrModifyOp { - /** - * @param {K} key - * @param {Modifier} delta - */ - constructor(key: K, delta: Modifier); - /** - * @readonly - * @type {K} - */ - readonly key: K; - /** - * @readonly - * @type {Modifier} - */ - readonly value: Modifier; - /** - * @type {string|null} - */ - _fingerprint: string | null; - /** - * @type {'modify'} - */ - get type(): "modify"; - get fingerprint(): string; - /** - * @return {DeltaBuilder} - */ - get _modValue(): DeltaBuilder; - /** - * @return {DeltaAttrOpJSON} - */ - toJSON(): DeltaAttrOpJSON; - /** - * @return {AttrModifyOp} - */ - clone(): AttrModifyOp; - /** - * @param {AttrModifyOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: AttrModifyOp): boolean; -} -/** - * @type {s.Schema | DeleteOp>} - */ -export const $deleteOp: s.Schema | DeleteOp>; -/** - * @type {s.Schema | InsertOp>} - */ -export const $insertOp: s.Schema | InsertOp>; -export function $insertOpWith($content: s.Schema): s.Schema | InsertOp>; -/** - * @type {s.Schema} - */ -export const $textOp: s.Schema; -/** - * @type {s.Schema} - */ -export const $retainOp: s.Schema; -/** - * @type {s.Schema} - */ -export const $modifyOp: s.Schema; -export function $modifyOpWith($content: s.Schema): s.Schema | ModifyOp>; -export const $anyOp: s.Schema | InsertOp | AttrDeleteOp | DeleteOp | TextOp | AttrModifyOp | ModifyOp>; -/** - * @template {Array|string} C1 - * @template {Array|string} C2 - * @typedef {Extract> extends never - * ? never - * : (Array<(Extract> extends Array ? (unknown extends AC1 ? never : AC1) : never)>)} MergeListArrays - */ -/** - * @template {{[Key in string|number]: any}} Attrs - * @template {string|number} Key - * @template {any} Val - * @typedef {{ [K in (Key | keyof Attrs)]: (unknown extends Attrs[K] ? never : Attrs[K]) | (Key extends K ? Val : never) }} AddToAttrs - */ -/** - * @template {{[Key in string|number|symbol]: any}} Attrs - * @template {{[Key in string|number|symbol]: any}} NewAttrs - * @typedef {{ [K in (keyof NewAttrs | keyof Attrs)]: (unknown extends Attrs[K] ? never : Attrs[K]) | (unknown extends NewAttrs[K] ? never : NewAttrs[K]) }} MergeAttrs - */ -/** - * @template X - * @typedef {0 extends (1 & X) ? null : X} _AnyToNull - */ -/** - * @template {s.Schema>|null} Schema - * @typedef {_AnyToNull extends null ? Delta : (Schema extends s.Schema ? D : never)} AllowedDeltaFromSchema - */ -/** - * @typedef {Delta} DeltaAny - */ -/** - * @typedef {DeltaBuilder} DeltaBuilderAny - */ -/** - * @template {string} [NodeName=any] - * @template {{[k:string|number]:any}} [Attrs={}] - * @template {fingerprintTrait.Fingerprintable} [Children=never] - * @template {string} [Text=never] - * @template {s.Schema>|null} [Schema=any] - */ -export class Delta> | null = any> { - /** - * @param {NodeName} [name] - * @param {Schema} [$schema] - */ - constructor(name?: NodeName, $schema?: Schema); - name: NodeName | null; - $schema: NonNullable | null; - /** - * @type {{ [K in keyof Attrs]?: K extends string|number ? (AttrInsertOp|AttrDeleteOp|(Delta extends Attrs[K] ? AttrModifyOp,K> : never)) : never } - * & { [Symbol.iterator]: () => Iterator<{ [K in keyof Attrs]: K extends string|number ? (AttrInsertOp|AttrDeleteOp|(Delta extends Attrs[K] ? AttrModifyOp,K> : never)) : never }[keyof Attrs]> } - * } - */ - attrs: { [K in keyof Attrs]?: K extends string | number ? (AttrInsertOp | AttrDeleteOp | (Delta extends Attrs[K] ? AttrModifyOp, K> : never)) : never; } & { - [Symbol.iterator]: () => Iterator<{ [K in keyof Attrs]: K extends string | number ? (AttrInsertOp | AttrDeleteOp | (Delta extends Attrs[K] ? AttrModifyOp, K> : never)) : never; }[keyof Attrs]>; - }; - /** - * @type {list.List< - * RetainOp - * | DeleteOp - * | (Text extends never ? never : TextOp) - * | (Children extends never ? never : InsertOp) - * | (Delta extends Children ? ModifyOp>> : never) - * >} - */ - children: list.List) | (Delta extends Children ? ModifyOp>> : never)>; - childCnt: number; - /** - * @type {any} - */ - origin: any; - /** - * @type {string|null} - */ - _fingerprint: string | null; - isDone: boolean; - /** - * @type {string} - */ - get fingerprint(): string; - isEmpty(): boolean; - /** - * @return {DeltaJSON} - */ - toJSON(): DeltaJSON; - /** - * @param {Delta} other - * @return {boolean} - */ - equals(other: Delta): boolean; - /** - * @return {DeltaBuilder} - */ - clone(): DeltaBuilder; - /** - * @param {number} start - * @param {number} end - * @return {DeltaBuilder} - */ - slice(start?: number, end?: number): DeltaBuilder; - /** - * Mark this delta as done and perform some cleanup (e.g. remove appended retains without - * formats&attributions). In the future, there might be additional merge operations that can be - * performed to result in smaller deltas. Set `markAsDone=false` to only perform the cleanup. - * - * @return {Delta} - */ - done(markAsDone?: boolean): Delta; - [fingerprintTrait.FingerprintTraitSymbol](): string; - /** - * @param {any} other - * @return {boolean} - */ - [equalityTrait.EqualityTraitSymbol](other: any): boolean; -} -export function clone(d: D): D extends DeltaBuilder ? DeltaBuilder : never; -/** - * @template {string} [NodeName=any] - * @template {{[key:string|number]:any}} [Attrs={}] - * @template {fingerprintTrait.Fingerprintable} [Children=never] - * @template {string} [Text=never] - * @template {s.Schema>|null} [Schema=any] - * @extends {Delta} - */ -export class DeltaBuilder> | null = any> extends Delta { - /** - * @type {FormattingAttributes?} - */ - usedAttributes: FormattingAttributes | null; - /** - * @type {Attribution?} - */ - usedAttribution: Attribution | null; - /** - * @param {Attribution?} attribution - */ - useAttribution(attribution: Attribution | null): this; - /** - * @param {FormattingAttributes?} attributes - * @return {this} - */ - useAttributes(attributes: FormattingAttributes | null): this; - /** - * @param {string} name - * @param {any} value - */ - updateUsedAttributes(name: string, value: any): this; - /** - * @template {keyof Attribution} NAME - * @param {NAME} name - * @param {Attribution[NAME]?} value - */ - updateUsedAttribution(name: NAME, value: Attribution[NAME] | null): this; - /** - * @template {AllowedDeltaFromSchema extends Delta ? ((Children extends never ? never : Array) | Text) : never} NewContent - * @param {NewContent} insert - * @param {FormattingAttributes?} [formatting] - * @param {Attribution?} [attribution] - * @return {DeltaBuilder< - * NodeName, - * Attrs, - * Exclude[number]|Children, - * (Extract|Text) extends never ? never : string, - * Schema - * >} - */ - insert extends Delta ? ((Children_1 extends never ? never : Array) | Text_1) : never>(insert: NewContent, formatting?: FormattingAttributes | null, attribution?: Attribution | null): DeltaBuilder[number] | Children, (Extract | Text) extends never ? never : string, Schema>; - /** - * @template {AllowedDeltaFromSchema extends Delta ? Extract> : never} NewContent - * @param {NewContent} modify - * @param {FormattingAttributes?} formatting - * @param {Attribution?} attribution - * @return {DeltaBuilder< - * NodeName, - * Attrs, - * Exclude[number]|Children, - * (Extract|Text) extends string ? string : never, - * Schema - * >} - */ - modify extends Delta ? Extract> : never>(modify: NewContent, formatting?: FormattingAttributes | null, attribution?: Attribution | null): DeltaBuilder[number] | Children, (Extract | Text) extends string ? string : never, Schema>; - /** - * @param {number} len - * @param {FormattingAttributes?} [format] - * @param {Attribution?} [attribution] - */ - retain(len: number, format?: FormattingAttributes | null, attribution?: Attribution | null): this; - /** - * @param {number} len - */ - delete(len: number): this; - /** - * @template {AllowedDeltaFromSchema extends Delta ? (keyof Attrs) : never} Key - * @template {AllowedDeltaFromSchema extends Delta ? (Attrs[Key]) : never} Val - * @param {Key} key - * @param {Val} val - * @param {Attribution?} attribution - * @param {Val|undefined} [prevValue] - * @return {DeltaBuilder< - * NodeName, - * { [K in keyof AddToAttrs]: AddToAttrs[K] }, - * Children, - * Text, - * Schema - * >} - */ - set extends Delta ? (keyof Attrs_1) : never, Val extends AllowedDeltaFromSchema extends Delta ? (Attrs_1[Key]) : never>(key: Key, val: Val, attribution?: Attribution | null, prevValue?: Val | undefined): DeltaBuilder]: AddToAttrs[K]; }, Children, Text, Schema>; - /** - * @template {AllowedDeltaFromSchema extends Delta ? Attrs : never} NewAttrs - * @param {NewAttrs} attrs - * @param {Attribution?} attribution - * @return {DeltaBuilder< - * NodeName, - * { [K in keyof MergeAttrs]: MergeAttrs[K] }, - * Children, - * Text, - * Schema - * >} - */ - setMany extends Delta ? Attrs_1 : never>(attrs: NewAttrs, attribution?: Attribution | null): DeltaBuilder]: MergeAttrs[K]; }, Children, Text, Schema>; - /** - * @template {AllowedDeltaFromSchema extends Delta ? keyof As : never} Key - * @param {Key} key - * @param {Attribution?} attribution - * @param {any} [prevValue] - * @return {DeltaBuilder< - * NodeName, - * { [K in keyof AddToAttrs]: AddToAttrs[K] }, - * Children, - * Text, - * Schema - * >} - */ - unset extends Delta ? keyof As : never>(key: Key, attribution?: Attribution | null, prevValue?: any): DeltaBuilder]: AddToAttrs[K]; }, Children, Text, Schema>; - /** - * @template {AllowedDeltaFromSchema extends Delta ? { [K in keyof As]: Extract> extends never ? never : K }[keyof As] : never} Key - * @template {AllowedDeltaFromSchema extends Delta ? Extract> : never} D - * @param {Key} key - * @param {D} modify - * @return {DeltaBuilder< - * NodeName, - * { [K in keyof AddToAttrs]: AddToAttrs[K] }, - * Children, - * Text, - * Schema - * >} - */ - update extends Delta ? { [K in keyof As]: Extract> extends never ? never : K; }[keyof As] : never, D extends AllowedDeltaFromSchema extends Delta ? Extract> : never>(key: Key, modify: D): DeltaBuilder]: AddToAttrs[K]; }, Children, Text, Schema>; - /** - * @param {Delta} other - */ - apply(other: Delta): this; - /** - * @param {DeltaAny} other - * @param {boolean} priority - */ - rebase(other: DeltaAny, priority: boolean): this; - /** - * Same as doing `delta.rebase(other.inverse())`, without creating a temporary delta. - * - * @param {DeltaAny} other - * @param {boolean} priority - */ - rebaseOnInverse(other: DeltaAny, priority: boolean): this; - /** - * Append child ops from one op to the other. - * - * delta.create().insert('a').append(delta.create().insert('b')) // => insert "ab" - * - * @template {DeltaAny} OtherDelta - * @param {OtherDelta} other - * @return {CastToDelta extends Delta ? DeltaBuilder : never} - */ - append(other: OtherDelta): CastToDelta extends Delta ? DeltaBuilder : never; -} -/** - * @template {DeltaAny} D - * @typedef {D extends DeltaBuilder ? Delta : D} CastToDelta - */ -/** - * @template {string} NodeName - * @template {{ [key: string|number]: any }} [Attrs={}] - * @template {fingerprintTrait.Fingerprintable|never} [Children=never] - * @template {string|never} [Text=never] - * @typedef {Delta|RecursiveDelta,Text>} RecursiveDelta - */ -/** - * @template {string} Name - * @template {{[k:string|number]:any}} Attrs - * @template {fingerprintTrait.Fingerprintable} Children - * @template {boolean} HasText - * @template {{ [k:string]:any }} Formats - * @template {boolean} Recursive - * @extends {s.Schema : never), - * HasText extends true ? string : never, - * any>>} - */ -export class $Delta extends s.Schema : never), HasText extends true ? string : never, any>> { - /** - * @param {s.Schema} $name - * @param {s.Schema} $attrs - * @param {s.Schema} $children - * @param {HasText} hasText - * @param {s.Schema} $formats - * @param {Recursive} recursive - */ - constructor($name: s.Schema, $attrs: s.Schema, $children: s.Schema, hasText: HasText, $formats: s.Schema, recursive: Recursive); - shape: { - $name: s.Schema; - $attrs: s.Schema | s.Schema; - [key: number]: s.Schema; - [key: symbol]: s.Schema; - }>>>; - $children: s.Schema; - hasText: HasText; - $formats: s.Schema; - }; -} -export function $delta | string | Array = s.Schema, AttrsSchema extends s.Schema<{ - [key: string | number]: any; -}> | { - [key: string | number]: any; -} = s.Schema<{}>, ChildrenSchema extends unknown = s.Schema, HasText extends boolean = false, Recursive extends boolean = false, Formats extends { - [k: string]: any; -} = { - [k: string]: any; -}>({ name, attrs, children, text, formats, recursive }: { - name?: NodeNameSchema | null | undefined; - attrs?: AttrsSchema | null | undefined; - children?: ChildrenSchema | null | undefined; - text?: HasText | undefined; - formats?: Formats | undefined; - recursive?: Recursive | undefined; -}): [s.Unwrap>, s.Unwrap>, s.Unwrap>] extends [infer NodeName_1, infer Attrs_1, infer Children_1] ? s.Schema : never), HasText extends true ? string : never>> : never; -export const $$delta: s.Schema<$Delta>; -export function _$delta | string | Array = s.Schema, AttrsSchema extends s.Schema<{ - [key: string | number]: any; -}> | { - [key: string | number]: any; -} = s.Schema<{}>, ChildrenSchema extends unknown = s.Schema, HasText extends boolean = false, Recursive extends boolean = false>({ name, attrs, children, text, recursive }: { - name?: NodeNameSchema | null | undefined; - attrs?: AttrsSchema | null | undefined; - children?: ChildrenSchema | null | undefined; - text?: HasText | undefined; - recursive?: Recursive | undefined; -}): [s.Unwrap>, s.Unwrap>, s.Unwrap>] extends [infer NodeName_1, infer Attrs_1, infer Children_1] ? s.Schema : never), HasText extends true ? string : never>> : never; -/** - * @type {s.Schema} - */ -export const $deltaAny: s.Schema; -/** - * @type {s.Schema} - */ -export const $deltaBuilderAny: s.Schema; -export function mergeAttrs(a: T | null, b: T | null): T | null; -export function mergeDeltas(a: D, b: D): D; -export function random(gen: prng.PRNG, $d: s.Schema): D extends Delta ? DeltaBuilder : never; -/** - * @overload - * @return {DeltaBuilder} - */ -export function create(): DeltaBuilder; -/** - * @template {string} NodeName - * @overload - * @param {NodeName} nodeName - * @return {DeltaBuilder} - */ -export function create(nodeName: NodeName): DeltaBuilder; -/** - * @template {string} NodeName - * @template {s.Schema} Schema - * @overload - * @param {NodeName} nodeName - * @param {Schema} schema - * @return {Schema extends s.Schema> ? DeltaBuilder : never} - */ -export function create>(nodeName: NodeName, schema: Schema): Schema extends s.Schema> ? DeltaBuilder : never; -/** - * @template {s.Schema} Schema - * @overload - * @param {Schema} schema - * @return {Schema extends s.Schema> ? DeltaBuilder : never} - */ -export function create>(schema: Schema): Schema extends s.Schema> ? DeltaBuilder : never; -/** - * @template {string|null} NodeName - * @template {{[k:string|number]:any}|null} Attrs - * @template {Array|string} [Children=never] - * @overload - * @param {NodeName} nodeName - * @param {Attrs} attrs - * @param {Children} [children] - * @return {DeltaBuilder< - * NodeName extends null ? any : NodeName, - * Attrs extends null ? {} : Attrs, - * Extract> extends Array ? (unknown extends Ac ? never : Ac) : never, - * Extract, - * null - * >} - */ -export function create | string = never>(nodeName: NodeName, attrs: Attrs, children?: Children | undefined): DeltaBuilder> extends Array ? (unknown extends Ac ? never : Ac) : never, Extract, null>; -export function $text<$Embeds extends Array> = any>(...$embeds: $Embeds): s.Schema extends null ? never : ($Embeds extends Array> ? $C : never)>>; -export const $textOnly: s.Schema>; -export function text> = s.Schema>>($schema?: Schema_1): Schema_1 extends s.Schema> ? DeltaBuilder : never; -export function $array<$Children extends unknown>($children?: $Children): s.Schema>>>; -export function array<$Schema extends s.Schema> = never>($schema: $Schema): $Schema extends never ? ArrayDeltaBuilder : DeltaBuilder; -export function $map<$Attrs extends { - [K: string | number]: any; -}>($attrs: s.Schema<$Attrs>): s.Schema>; -export function map<$Schema extends s.Schema> | undefined = undefined>($schema?: $Schema): $Schema extends s.Schema> ? DeltaBuilder : MapDeltaBuilder<{}>; -export function diff(d1: D, d2: NoInfer): D extends Delta ? DeltaBuilder : never; -export type Attribution = { - insert?: string[]; - insertAt?: number; - delete?: string[]; - deleteAt?: number; - format?: Record; - formatAt?: number; -}; -export type DeltaOps = s.Unwrap | InsertOp | AttrDeleteOp | DeleteOp | TextOp | AttrModifyOp | ModifyOp>>; -export type FormattingAttributes = { - [key: string]: any; -}; -export type DeltaJSON = { - type: "delta"; - name?: string; - attrs?: { [Key in string | number]: DeltaAttrOpJSON; }; - children?: Array; -}; -export type DeltaListOpJSON = { - type: "insert"; - insert: string | Array; - format?: { - [key: string]: any; - }; - attribution?: Attribution; -} | { - delete: number; -} | { - type: "retain"; - retain: number; - format?: { - [key: string]: any; - }; - attribution?: Attribution; -} | { - type: "modify"; - value: object; -}; -export type DeltaAttrOpJSON = { - type: "insert"; - value: any; - prevValue?: any; - attribution?: Attribution; -} | { - type: "delete"; - prevValue?: any; - attribution?: Attribution; -} | { - type: "modify"; - value: DeltaJSON; -}; -export type ChildrenOpAny = TextOp | InsertOp | DeleteOp | RetainOp | ModifyOp; -export type AttrOpAny = AttrInsertOp | AttrDeleteOp | AttrModifyOp; -export type _OpAny = ChildrenOpAny | AttrOpAny; -export type MergeListArrays | string, C2 extends Array | string> = Extract> extends never ? never : (Array<(Extract> extends Array ? (unknown extends AC1 ? never : AC1) : never)>); -export type AddToAttrs = { [K in (Key | keyof Attrs_1)]: (unknown extends Attrs_1[K] ? never : Attrs_1[K]) | (Key extends K ? Val : never); }; -export type MergeAttrs = { [K in (keyof NewAttrs | keyof Attrs_1)]: (unknown extends Attrs_1[K] ? never : Attrs_1[K]) | (unknown extends NewAttrs[K] ? never : NewAttrs[K]); }; -export type _AnyToNull = 0 extends (1 & X) ? null : X; -export type AllowedDeltaFromSchema> | null> = _AnyToNull extends null ? Delta : (Schema_1 extends s.Schema ? D : never); -export type DeltaAny = Delta; -export type DeltaBuilderAny = DeltaBuilder; -export type CastToDelta = D extends DeltaBuilder ? Delta : D; -export type RecursiveDelta = Delta | RecursiveDelta, Text>; -export type TextDelta = Delta; -export type TextDeltaBuilder = DeltaBuilder; -export type ArrayDelta = Delta; -export type ArrayDeltaBuilder = DeltaBuilder; -export type MapDelta = Delta; -export type MapDeltaBuilder = DeltaBuilder; -import * as s from '../schema.js'; -import * as list from '../list.js'; -import * as equalityTrait from '../trait/equality.js'; -import * as fingerprintTrait from '../trait/fingerprint.js'; -import * as prng from '../prng.js'; -//# sourceMappingURL=delta.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/delta/delta.d.ts.map b/yjs-poll/node_modules/lib0/delta/delta.d.ts.map deleted file mode 100644 index a312111..0000000 --- a/yjs-poll/node_modules/lib0/delta/delta.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"delta.d.ts","sourceRoot":"","sources":["delta.js"],"names":[],"mappings":"AAyBA;;;;;;;;;GASG;AAEH;;GAEG;AACH,2BAFU,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAS7B;AAEF;;GAEG;AAEH;;GAEG;AAEH;;;;;;;GAOG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AACH,kCAFU,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAMlC;AAeD;IACE;;;;OAIG;IACH,oBAJW,MAAM,UACN,oBAAoB,GAAC,IAAI,eACzB,WAAW,OAAC,EAoBtB;IAfC;;;OAGG;IACH,iBAFU,MAAM,CAEI;IACpB;;;OAGG;IACH,iBAFU,oBAAoB,GAAC,IAAI,CAEf;IACpB,gCAA8B;IAC9B;;OAEG;IACH,cAFU,MAAM,OAAC,CAEO;IAG1B;;OAEG;IACH,sBAFW,MAAM,QAMhB;IAED;;OAEG;IACH,YAFY,QAAQ,CAInB;IAED,qBAEC;IAED,0BAMC;IAED;;;;;OAKG;IACH,gBAHW,MAAM,OACN,MAAM,QAOhB;IAED;;OAEG;IACH,UAFY,eAAe,CAK1B;IASD;;OAEG;IACH,qCAFY,MAAM,CAIjB;IAZD;;OAE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_modules/lib0/delta/delta.js deleted file mode 100644 index 18d8f6d..0000000 --- a/yjs-poll/node_modules/lib0/delta/delta.js +++ /dev/null @@ -1,2362 +0,0 @@ -/** - * @beta this API is about to change - * - * ## Mutability - * - * Deltas are mutable by default. But references are often shared, by marking a Delta as "done". You - * may only modify deltas by applying other deltas to them. Casting a Delta to a DeltaBuilder - * manually, will likely modify "shared" state. - */ - -import * as list from '../list.js' -import * as object from '../object.js' -import * as equalityTrait from '../trait/equality.js' -import * as fingerprintTrait from '../trait/fingerprint.js' -import * as arr from '../array.js' -import * as fun from '../function.js' -import * as s from '../schema.js' -import * as error from '../error.js' -import * as math from '../math.js' -import * as rabin from '../hash/rabin.js' -import * as encoding from '../encoding.js' -import * as buffer from '../buffer.js' -import * as patience from '../diff/patience.js' -import * as prng from '../prng.js' - -/** - * @typedef {{ - * insert?: string[] - * insertAt?: number - * delete?: string[] - * deleteAt?: number - * format?: Record - * formatAt?: number - * }} Attribution - */ - -/** - * @type {s.Schema} - */ -export const $attribution = s.$object({ - insert: s.$array(s.$string).optional, - insertAt: s.$number.optional, - delete: s.$array(s.$string).optional, - deleteAt: s.$number.optional, - format: s.$record(s.$string, s.$array(s.$string)).optional, - formatAt: s.$number.optional -}) - -/** - * @typedef {s.Unwrap<$anyOp>} DeltaOps - */ - -/** - * @typedef {{ [key: string]: any }} FormattingAttributes - */ - -/** - * @typedef {{ - * type: 'delta', - * name?: string, - * attrs?: { [Key in string|number]: DeltaAttrOpJSON }, - * children?: Array - * }} DeltaJSON - */ - -/** - * @typedef {{ type: 'insert', insert: string|Array, format?: { [key: string]: any }, attribution?: Attribution } | { delete: number } | { type: 'retain', retain: number, format?: { [key:string]: any }, attribution?: Attribution } | { type: 'modify', value: object }} DeltaListOpJSON - */ - -/** - * @typedef {{ type: 'insert', value: any, prevValue?: any, attribution?: Attribution } | { type: 'delete', prevValue?: any, attribution?: Attribution } | { type: 'modify', value: DeltaJSON }} DeltaAttrOpJSON - */ - -/** - * @typedef {TextOp|InsertOp|DeleteOp|RetainOp|ModifyOp} ChildrenOpAny - */ - -/** - * @typedef {AttrInsertOp|AttrDeleteOp|AttrModifyOp} AttrOpAny - */ - -/** - * @typedef {ChildrenOpAny|AttrOpAny} _OpAny - */ - -/** - * @type {s.Schema} - */ -export const $deltaMapChangeJson = s.$union( - s.$object({ type: s.$literal('insert'), value: s.$any, prevValue: s.$any.optional, attribution: $attribution.optional }), - s.$object({ type: s.$literal('modify'), value: s.$any }), - s.$object({ type: s.$literal('delete'), prevValue: s.$any.optional, attribution: $attribution.optional }) -) - -/** - * @template {{[key:string]: any} | null} Attrs - * @param {Attrs} attrs - * @return {Attrs} - */ -const _cloneAttrs = attrs => attrs == null ? attrs : { ...attrs } -/** - * @template {any} MaybeDelta - * @param {MaybeDelta} maybeDelta - * @return {MaybeDelta} - */ -const _markMaybeDeltaAsDone = maybeDelta => $deltaAny.check(maybeDelta) ? /** @type {MaybeDelta} */ (maybeDelta.done()) : maybeDelta - -export class TextOp extends list.ListNode { - /** - * @param {string} insert - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor (insert, format, attribution) { - super() - // Whenever this is modified, make sure to clear _fingerprint - /** - * @readonly - * @type {string} - */ - this.insert = insert - /** - * @readonly - * @type {FormattingAttributes|null} - */ - this.format = format - this.attribution = attribution - /** - * @type {string?} - */ - this._fingerprint = null - } - - /** - * @param {string} newVal - */ - _updateInsert (newVal) { - // @ts-ignore - this.insert = newVal - this._fingerprint = null - } - - /** - * @return {'insert'} - */ - get type () { - return 'insert' - } - - get length () { - return this.insert.length - } - - get fingerprint () { - return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => { - encoding.writeVarUint(encoder, 0) // textOp type: 0 - encoding.writeVarString(encoder, this.insert) - encoding.writeAny(encoder, this.format) - }))) - } - - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} offset - * @param {number} len - */ - _splice (offset, len) { - this._fingerprint = null - // @ts-ignore - this.insert = this.insert.slice(0, offset) + this.insert.slice(offset + len) - return this - } - - /** - * @return {DeltaListOpJSON} - */ - toJSON () { - const { insert, format, attribution } = this - return object.assign(/** @type {{type: 'insert', insert: string}} */ ({ type: 'insert', insert }), format != null ? { format } : ({}), attribution != null ? { attribution } : ({})) - } - - /** - * @param {TextOp} other - */ - [equalityTrait.EqualityTraitSymbol] (other) { - return fun.equalityDeep(this.insert, other.insert) && fun.equalityDeep(this.format, other.format) && fun.equalityDeep(this.attribution, other.attribution) - } - - /** - * @return {TextOp} - */ - clone (start = 0, end = this.length) { - return new TextOp(this.insert.slice(start, end), _cloneAttrs(this.format), _cloneAttrs(this.attribution)) - } -} - -/** - * @template {fingerprintTrait.Fingerprintable} ArrayContent - */ -export class InsertOp extends list.ListNode { - /** - * @param {Array} insert - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor (insert, format, attribution) { - super() - /** - * @readonly - * @type {Array} - */ - this.insert = insert - /** - * @readonly - * @type {FormattingAttributes?} - */ - this.format = format - /** - * @readonly - * @type {Attribution?} - */ - this.attribution = attribution - /** - * @type {string?} - */ - this._fingerprint = null - } - - /** - * @param {ArrayContent} newVal - */ - _updateInsert (newVal) { - // @ts-ignore - this.insert = newVal - this._fingerprint = null - } - - /** - * @return {'insert'} - */ - get type () { - return 'insert' - } - - get length () { - return this.insert.length - } - - /** - * @param {number} i - * @return {Extract} - */ - _modValue (i) { - /** - * @type {any} - */ - let d = this.insert[i] - this._fingerprint = null - $deltaAny.expect(d) - if (d.isDone) { - // @ts-ignore - this.insert[i] = (d = clone(d)) - return d - } - return d - } - - get fingerprint () { - return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => { - encoding.writeVarUint(encoder, 1) // insertOp type: 1 - encoding.writeVarUint(encoder, this.insert.length) - this.insert.forEach(ins => { - encoding.writeVarString(encoder, fingerprintTrait.fingerprint(ins)) - }) - encoding.writeAny(encoder, this.format) - }))) - } - - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} offset - * @param {number} len - */ - _splice (offset, len) { - this._fingerprint = null - this.insert.splice(offset, len) - return this - } - - /** - * @return {DeltaListOpJSON} - */ - toJSON () { - const { insert, format, attribution } = this - return object.assign({ type: /** @type {'insert'} */ ('insert'), insert: insert.map(ins => $deltaAny.check(ins) ? ins.toJSON() : ins) }, format ? { format } : ({}), attribution != null ? { attribution } : ({})) - } - - /** - * @param {InsertOp} other - */ - [equalityTrait.EqualityTraitSymbol] (other) { - return fun.equalityDeep(this.insert, other.insert) && fun.equalityDeep(this.format, other.format) && fun.equalityDeep(this.attribution, other.attribution) - } - - /** - * @return {InsertOp} - */ - clone (start = 0, end = this.length) { - return new InsertOp(this.insert.slice(start, end).map(_markMaybeDeltaAsDone), _cloneAttrs(this.format), _cloneAttrs(this.attribution)) - } -} - -/** - * @template {fingerprintTrait.Fingerprintable} [Children=never] - * @template {string} [Text=never] - */ -export class DeleteOp extends list.ListNode { - /** - * @param {number} len - */ - constructor (len) { - super() - this.delete = len - /** - * @type {(Children|Text) extends never ? null : (Delta?)} - */ - this.prevValue = null - /** - * @type {string|null} - */ - this._fingerprint = null - } - - /** - * @return {'delete'} - */ - get type () { - return 'delete' - } - - get length () { - return 0 - } - - get fingerprint () { - return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => { - encoding.writeVarUint(encoder, 2) // deleteOp type: 2 - encoding.writeVarUint(encoder, this.delete) - }))) - } - - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} _offset - * @param {number} len - */ - _splice (_offset, len) { - this.prevValue = /** @type {any} */ (this.prevValue?.slice(_offset, len) || null) - this._fingerprint = null - this.delete -= len - return this - } - - /** - * @return {DeltaListOpJSON} - */ - toJSON () { - return { delete: this.delete } - } - - /** - * @param {DeleteOp} other - */ - [equalityTrait.EqualityTraitSymbol] (other) { - return this.delete === other.delete - } - - clone (start = 0, end = this.delete) { - return new DeleteOp(end - start) - } -} - -export class RetainOp extends list.ListNode { - /** - * @param {number} retain - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor (retain, format, attribution) { - super() - /** - * @readonly - * @type {number} - */ - this.retain = retain - /** - * @readonly - * @type {FormattingAttributes?} - */ - this.format = format - /** - * @readonly - * @type {Attribution?} - */ - this.attribution = attribution - /** - * @type {string|null} - */ - this._fingerprint = null - } - - /** - * @return {'retain'} - */ - get type () { - return 'retain' - } - - get length () { - return this.retain - } - - get fingerprint () { - return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => { - encoding.writeVarUint(encoder, 3) // retainOp type: 3 - encoding.writeVarUint(encoder, this.retain) - encoding.writeAny(encoder, this.format) - }))) - } - - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} _offset - * @param {number} len - */ - _splice (_offset, len) { - // @ts-ignore - this.retain -= len - this._fingerprint = null - return this - } - - /** - * @return {DeltaListOpJSON} - */ - toJSON () { - const { retain, format, attribution } = this - return object.assign({ type: /** @type {'retain'} */ ('retain'), retain }, format ? { format } : {}, attribution != null ? { attribution } : {}) - } - - /** - * @param {RetainOp} other - */ - [equalityTrait.EqualityTraitSymbol] (other) { - return this.retain === other.retain && fun.equalityDeep(this.format, other.format) && fun.equalityDeep(this.attribution, other.attribution) - } - - clone (start = 0, end = this.retain) { - return new RetainOp(end - start, _cloneAttrs(this.format), _cloneAttrs(this.attribution)) - } -} - -/** - * Delta that can be applied on a YType Embed - * - * @template {DeltaAny} [DTypes=DeltaAny] - */ -export class ModifyOp extends list.ListNode { - /** - * @param {DTypes} delta - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor (delta, format, attribution) { - super() - /** - * @readonly - * @type {DTypes} - */ - this.value = delta - /** - * @readonly - * @type {FormattingAttributes?} - */ - this.format = format - /** - * @readonly - * @type {Attribution?} - */ - this.attribution = attribution - /** - * @type {string|null} - */ - this._fingerprint = null - } - - /** - * @return {'modify'} - */ - get type () { - return 'modify' - } - - get length () { - return 1 - } - - /** - * @type {DeltaBuilderAny} - */ - get _modValue () { - /** - * @type {any} - */ - const d = this.value - this._fingerprint = null - if (d.isDone) { - // @ts-ignore - return (this.value = clone(d)) - } - return d - } - - get fingerprint () { - // don't cache fingerprint because we don't know when delta changes - return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => { - encoding.writeVarUint(encoder, 4) // modifyOp type: 4 - encoding.writeVarString(encoder, this.value.fingerprint) - encoding.writeAny(encoder, this.format) - }))) - } - - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} _offset - * @param {number} _len - */ - _splice (_offset, _len) { - return this - } - - /** - * @return {DeltaListOpJSON} - */ - toJSON () { - const { value, attribution, format } = this - return object.assign({ type: /** @type {'modify'} */ ('modify'), value: value.toJSON() }, format ? { format } : {}, attribution != null ? { attribution } : {}) - } - - /** - * @param {ModifyOp} other - */ - [equalityTrait.EqualityTraitSymbol] (other) { - return this.value[equalityTrait.EqualityTraitSymbol](other.value) && fun.equalityDeep(this.format, other.format) && fun.equalityDeep(this.attribution, other.attribution) - } - - /** - * @return {ModifyOp} - */ - clone () { - return new ModifyOp(/** @type {DTypes} */ (this.value.done()), _cloneAttrs(this.format), _cloneAttrs(this.attribution)) - } -} - -/** - * @template {fingerprintTrait.Fingerprintable} V - * @template {string|number} [K=any] - */ -export class AttrInsertOp { - /** - * @param {K} key - * @param {V} value - * @param {V|undefined} prevValue - * @param {Attribution?} attribution - */ - constructor (key, value, prevValue, attribution) { - /** - * @readonly - * @type {K} - */ - this.key = key - /** - * @readonly - * @type {V} - */ - this.value = value - /** - * @readonly - * @type {V|undefined} - */ - this.prevValue = prevValue - /** - * @readonly - * @type {Attribution?} - */ - this.attribution = attribution - /** - * @type {string|null} - */ - this._fingerprint = null - } - - /** - * @return {'insert'} - */ - get type () { return 'insert' } - - /** - * @type {DeltaBuilderAny} - */ - get _modValue () { - /** - * @type {any} - */ - const v = this.value - this._fingerprint = null - if ($deltaAny.check(v) && v.isDone) { - // @ts-ignore - return (this.value = clone(v)) - } - return v - } - - get fingerprint () { - return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => { - encoding.writeVarUint(encoder, 5) // map insert type: 5 - encoding.writeAny(encoder, this.key) - if ($deltaAny.check(this.value)) { - encoding.writeUint8(encoder, 0) - encoding.writeVarString(encoder, this.value.fingerprint) - } else { - encoding.writeUint8(encoder, 1) - encoding.writeAny(encoder, this.value) - } - }))) - } - - toJSON () { - const v = this.value - const prevValue = this.prevValue - const attribution = this.attribution - return object.assign({ - type: this.type, - value: $deltaAny.check(v) ? v.toJSON() : v - }, attribution != null ? { attribution } : {}, prevValue !== undefined ? { prevValue } : {}) - } - - /** - * @param {AttrInsertOp} other - */ - [equalityTrait.EqualityTraitSymbol] (other) { - return this.key === other.key && fun.equalityDeep(this.value, other.value) && fun.equalityDeep(this.attribution, other.attribution) - } - - /** - * @return {AttrInsertOp} - */ - clone () { - return new AttrInsertOp(this.key, _markMaybeDeltaAsDone(this.value), _markMaybeDeltaAsDone(this.prevValue), _cloneAttrs(this.attribution)) - } -} - -/** - * @template V - * @template {string|number} [K=string] - */ -export class AttrDeleteOp { - /** - * @param {K} key - * @param {V|undefined} prevValue - * @param {Attribution?} attribution - */ - constructor (key, prevValue, attribution) { - /** - * @type {K} - */ - this.key = key - /** - * @type {V|undefined} - */ - this.prevValue = prevValue - this.attribution = attribution - /** - * @type {string|null} - */ - this._fingerprint = null - } - - get value () { return undefined } - - /** - * @type {'delete'} - */ - get type () { return 'delete' } - - get fingerprint () { - return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => { - encoding.writeVarUint(encoder, 6) // map delete type: 6 - encoding.writeAny(encoder, this.key) - }))) - } - - /** - * @return {DeltaAttrOpJSON} - */ - toJSON () { - const { - type, attribution, prevValue - } = this - return object.assign({ type }, attribution != null ? { attribution } : {}, prevValue !== undefined ? { prevValue } : {}) - } - - /** - * @param {AttrDeleteOp} other - */ - [equalityTrait.EqualityTraitSymbol] (other) { - return this.key === other.key && fun.equalityDeep(this.attribution, other.attribution) - } - - clone () { - return new AttrDeleteOp(this.key, _markMaybeDeltaAsDone(this.prevValue), _cloneAttrs(this.attribution)) - } -} - -/** - * @template {DeltaAny} [Modifier=DeltaAny] - * @template {string|number} [K=string] - */ -export class AttrModifyOp { - /** - * @param {K} key - * @param {Modifier} delta - */ - constructor (key, delta) { - /** - * @readonly - * @type {K} - */ - this.key = key - /** - * @readonly - * @type {Modifier} - */ - this.value = delta - /** - * @type {string|null} - */ - this._fingerprint = null - } - - /** - * @type {'modify'} - */ - get type () { return 'modify' } - - get fingerprint () { - return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => { - encoding.writeVarUint(encoder, 7) // map modify type: 7 - encoding.writeAny(encoder, this.key) - encoding.writeVarString(encoder, this.value.fingerprint) - }))) - } - - /** - * @return {DeltaBuilder} - */ - get _modValue () { - this._fingerprint = null - if (this.value.isDone) { - // @ts-ignore - this.value = /** @type {any} */ (clone(this.value)) - } - // @ts-ignore - return this.value - } - - /** - * @return {DeltaAttrOpJSON} - */ - toJSON () { - return { - type: this.type, - value: this.value.toJSON() - } - } - - /** - * @param {AttrModifyOp} other - */ - [equalityTrait.EqualityTraitSymbol] (other) { - return this.key === other.key && this.value[equalityTrait.EqualityTraitSymbol](other.value) - } - - /** - * @return {AttrModifyOp} - */ - clone () { - return new AttrModifyOp(this.key, /** @type {Modifier} */ (this.value.done())) - } -} - -/** - * @type {s.Schema | DeleteOp>} - */ -export const $deleteOp = s.$custom(o => o != null && (o.constructor === DeleteOp || o.constructor === AttrDeleteOp)) - -/** - * @type {s.Schema | InsertOp>} - */ -export const $insertOp = s.$custom(o => o != null && (o.constructor === AttrInsertOp || o.constructor === InsertOp)) - -/** - * @template {fingerprintTrait.Fingerprintable} Content - * @param {s.Schema} $content - * @return {s.Schema | InsertOp>} - */ -export const $insertOpWith = $content => s.$custom(o => - o != null && ( - (o.constructor === AttrInsertOp && $content.check(/** @type {AttrInsertOp} */ (o).value)) || - (o.constructor === InsertOp && /** @type {InsertOp} */ (o).insert.every(ins => $content.check(ins))) - ) -) - -/** - * @type {s.Schema} - */ -export const $textOp = s.$constructedBy(TextOp) - -/** - * @type {s.Schema} - */ -export const $retainOp = s.$constructedBy(RetainOp) - -/** - * @type {s.Schema} - */ -export const $modifyOp = s.$custom(o => o != null && (o.constructor === AttrModifyOp || o.constructor === ModifyOp)) - -/** - * @template {DeltaAny} Modify - * @param {s.Schema} $content - * @return {s.Schema | ModifyOp>} - */ -export const $modifyOpWith = $content => s.$custom(o => - o != null && ( - (o.constructor === AttrModifyOp && $content.check(/** @type {AttrModifyOp} */ (o).value)) || - (o.constructor === ModifyOp && $content.check(/** @type {ModifyOp} */ (o).value)) - ) -) - -export const $anyOp = s.$union($insertOp, $deleteOp, $textOp, $modifyOp) - -/** - * @template {Array|string} C1 - * @template {Array|string} C2 - * @typedef {Extract> extends never - * ? never - * : (Array<(Extract> extends Array ? (unknown extends AC1 ? never : AC1) : never)>)} MergeListArrays - */ - -/** - * @template {{[Key in string|number]: any}} Attrs - * @template {string|number} Key - * @template {any} Val - * @typedef {{ [K in (Key | keyof Attrs)]: (unknown extends Attrs[K] ? never : Attrs[K]) | (Key extends K ? Val : never) }} AddToAttrs - */ - -/** - * @template {{[Key in string|number|symbol]: any}} Attrs - * @template {{[Key in string|number|symbol]: any}} NewAttrs - * @typedef {{ [K in (keyof NewAttrs | keyof Attrs)]: (unknown extends Attrs[K] ? never : Attrs[K]) | (unknown extends NewAttrs[K] ? never : NewAttrs[K]) }} MergeAttrs - */ - -/** - * @template X - * @typedef {0 extends (1 & X) ? null : X} _AnyToNull - */ - -/** - * @template {s.Schema>|null} Schema - * @typedef {_AnyToNull extends null ? Delta : (Schema extends s.Schema ? D : never)} AllowedDeltaFromSchema - */ - -/** - * @typedef {Delta} DeltaAny - */ -/** - * @typedef {DeltaBuilder} DeltaBuilderAny - */ - -/** - * @template {string} [NodeName=any] - * @template {{[k:string|number]:any}} [Attrs={}] - * @template {fingerprintTrait.Fingerprintable} [Children=never] - * @template {string} [Text=never] - * @template {s.Schema>|null} [Schema=any] - */ -export class Delta { - /** - * @param {NodeName} [name] - * @param {Schema} [$schema] - */ - constructor (name, $schema) { - this.name = name || null - this.$schema = $schema || null - /** - * @type {{ [K in keyof Attrs]?: K extends string|number ? (AttrInsertOp|AttrDeleteOp|(Delta extends Attrs[K] ? AttrModifyOp,K> : never)) : never } - * & { [Symbol.iterator]: () => Iterator<{ [K in keyof Attrs]: K extends string|number ? (AttrInsertOp|AttrDeleteOp|(Delta extends Attrs[K] ? AttrModifyOp,K> : never)) : never }[keyof Attrs]> } - * } - */ - this.attrs = /** @type {any} */ ({ - * [Symbol.iterator] () { - for (const k in this) { - yield this[k] - } - } - }) - - /** - * @type {list.List< - * RetainOp - * | DeleteOp - * | (Text extends never ? never : TextOp) - * | (Children extends never ? never : InsertOp) - * | (Delta extends Children ? ModifyOp>> : never) - * >} - */ - this.children = /** @type {any} */ (list.create()) - this.childCnt = 0 - /** - * @type {any} - */ - this.origin = null - /** - * @type {string|null} - */ - this._fingerprint = null - this.isDone = false - } - - /** - * @type {string} - */ - get fingerprint () { - return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => { - encoding.writeUint32(encoder, 0xf2ae5680) // "magic number" that ensures that different types of content don't yield the same fingerprint - encoding.writeAny(encoder, this.name) - /** - * @type {Array} - */ - const keys = [] - for (const attr of this.attrs) { - keys.push(attr.key) - } - keys.sort((a, b) => { - const aIsString = s.$string.check(a) - const bIsString = s.$string.check(b) - // numbers first - // in ascending order - return (aIsString && bIsString) - ? a.localeCompare(b) - : (aIsString ? 1 : (bIsString ? -1 : (a - b))) - }) - encoding.writeVarUint(encoder, keys.length) - for (const key of keys) { - encoding.writeVarString(encoder, /** @type {any} */ (this.attrs[/** @type {keyof Attrs} */ (key)]).fingerprint) - } - encoding.writeVarUint(encoder, this.children.len) - for (const child of this.children) { - encoding.writeVarString(encoder, child.fingerprint) - } - return buffer.toBase64(rabin.fingerprint(rabin.StandardIrreducible128, encoding.toUint8Array(encoder))) - }))) - } - - [fingerprintTrait.FingerprintTraitSymbol] () { - return this.fingerprint - } - - isEmpty () { - return object.isEmpty(this.attrs) && list.isEmpty(this.children) - } - - /** - * @return {DeltaJSON} - */ - toJSON () { - const name = this.name - /** - * @type {any} - */ - const attrs = {} - /** - * @type {any} - */ - const children = [] - for (const attr of this.attrs) { - attrs[attr.key] = attr.toJSON() - } - this.children.forEach(val => { - children.push(val.toJSON()) - }) - return object.assign( - { type: /** @type {'delta'} */ ('delta') }, - (name != null ? { name } : {}), - (object.isEmpty(attrs) ? {} : { attrs }), - (children.length > 0 ? { children } : {}) - ) - } - - /** - * @param {Delta} other - * @return {boolean} - */ - equals (other) { - return this[equalityTrait.EqualityTraitSymbol](other) - } - - /** - * @param {any} other - * @return {boolean} - */ - [equalityTrait.EqualityTraitSymbol] (other) { - // @todo it is only necessary to compare finrerprints OR do a deep equality check (remove - // childCnt as well) - return this.name === other.name && fun.equalityDeep(this.attrs, other.attrs) && fun.equalityDeep(this.children, other.children) && this.childCnt === other.childCnt - } - - /** - * @return {DeltaBuilder} - */ - clone () { - return this.slice(0, this.childCnt) - } - - /** - * @param {number} start - * @param {number} end - * @return {DeltaBuilder} - */ - slice (start = 0, end = this.childCnt) { - const cpy = /** @type {DeltaAny} */ (new DeltaBuilder(/** @type {any} */ (this.name), this.$schema)) - cpy.origin = this.origin - // copy attrs - for (const op of this.attrs) { - cpy.attrs[op.key] = /** @type {any} */ (op.clone()) - } - // copy children - const slicedLen = end - start - let remainingLen = slicedLen - /** - * @type {ChildrenOpAny?} - */ - let currNode = this.children.start - let currNodeOffset = 0 - while (start > 0 && currNode != null) { - if (currNode.length <= start) { - start -= currNode.length - currNode = currNode.next - } else { - currNodeOffset = start - start = 0 - } - } - if (currNodeOffset > 0 && currNode) { - const ncpy = currNode.clone(currNodeOffset, currNodeOffset + math.min(remainingLen, currNode.length - currNodeOffset)) - list.pushEnd(cpy.children, ncpy) - remainingLen -= ncpy.length - currNode = currNode.next - } - while (currNode != null && currNode.length <= remainingLen) { - list.pushEnd(cpy.children, currNode.clone()) - remainingLen -= currNode.length - currNode = currNode.next - } - if (currNode != null && remainingLen > 0) { - list.pushEnd(cpy.children, currNode.clone(0, remainingLen)) - remainingLen -= math.min(currNode.length, remainingLen) - } - cpy.childCnt = slicedLen - remainingLen - // @ts-ignore - return cpy - } - - /** - * Mark this delta as done and perform some cleanup (e.g. remove appended retains without - * formats&attributions). In the future, there might be additional merge operations that can be - * performed to result in smaller deltas. Set `markAsDone=false` to only perform the cleanup. - * - * @return {Delta} - */ - done (markAsDone = true) { - if (!this.isDone) { - this.isDone = markAsDone - const cs = this.children - for (let end = cs.end; end !== null && $retainOp.check(end) && end.format == null && end.attribution == null; end = cs.end) { - this.childCnt -= end.length - list.popEnd(cs) - } - } - return this - } -} - -/** - * @template {DeltaAny} D - * @param {D} d - * @return {D extends DeltaBuilder ? DeltaBuilder : never} - */ -export const clone = d => /** @type {any} */ (d.slice(0, d.childCnt)) - -/** - * Try merging this op with the previous op - * @param {list.List} parent - * @param {InsertOp|RetainOp|DeleteOp|TextOp|ModifyOp} op - */ -const tryMergeWithPrev = (parent, op) => { - const prevOp = op.prev - if ( - prevOp?.constructor !== op.constructor || - ( - (!$deleteOp.check(op) && !$modifyOp.check(op)) && (!fun.equalityDeep(op.format, /** @type {InsertOp} */ (prevOp).format) || !fun.equalityDeep(op.attribution, /** @type {InsertOp} */ (prevOp).attribution)) - ) - ) { - // constructor mismatch or format/attribution mismatch - return - } - // can be merged - if ($insertOp.check(op)) { - /** @type {InsertOp} */ (prevOp).insert.push(...op.insert) - } else if ($retainOp.check(op)) { - // @ts-ignore - /** @type {RetainOp} */ (prevOp).retain += op.retain - } else if ($deleteOp.check(op)) { - /** @type {DeleteOp} */ (prevOp).delete += op.delete - } else if ($textOp.check(op)) { - /** @type {TextOp} */ (prevOp)._updateInsert(/** @type {TextOp} */ (prevOp).insert + op.insert) - } else { - error.unexpectedCase() - } - list.remove(parent, op) -} - -/** - * Ensures that the delta can be edited. clears _fingerprint cache. - * - * @param {any} d - */ -const modDeltaCheck = d => { - if (d.isDone) { - /** - * You tried to modify a delta after it has been marked as "done". - */ - throw error.create("Readonly Delta can't be modified") - } - d._fingerprint = null -} - -/** - * @template {string} [NodeName=any] - * @template {{[key:string|number]:any}} [Attrs={}] - * @template {fingerprintTrait.Fingerprintable} [Children=never] - * @template {string} [Text=never] - * @template {s.Schema>|null} [Schema=any] - * @extends {Delta} - */ -export class DeltaBuilder extends Delta { - /** - * @param {NodeName} [name] - * @param {Schema} [$schema] - */ - constructor (name, $schema) { - super(name, $schema) - /** - * @type {FormattingAttributes?} - */ - this.usedAttributes = null - /** - * @type {Attribution?} - */ - this.usedAttribution = null - } - - /** - * @param {Attribution?} attribution - */ - useAttribution (attribution) { - modDeltaCheck(this) - this.usedAttribution = attribution - return this - } - - /** - * @param {FormattingAttributes?} attributes - * @return {this} - */ - useAttributes (attributes) { - modDeltaCheck(this) - this.usedAttributes = attributes - return this - } - - /** - * @param {string} name - * @param {any} value - */ - updateUsedAttributes (name, value) { - modDeltaCheck(this) - if (value == null) { - this.usedAttributes = object.assign({}, this.usedAttributes) - delete this.usedAttributes?.[name] - if (object.isEmpty(this.usedAttributes)) { - this.usedAttributes = null - } - } else if (!fun.equalityDeep(this.usedAttributes?.[name], value)) { - this.usedAttributes = object.assign({}, this.usedAttributes) - this.usedAttributes[name] = value - } - return this - } - - /** - * @template {keyof Attribution} NAME - * @param {NAME} name - * @param {Attribution[NAME]?} value - */ - updateUsedAttribution (name, value) { - modDeltaCheck(this) - if (value == null) { - this.usedAttribution = object.assign({}, this.usedAttribution) - delete this.usedAttribution?.[name] - if (object.isEmpty(this.usedAttribution)) { - this.usedAttribution = null - } - } else if (!fun.equalityDeep(this.usedAttribution?.[name], value)) { - this.usedAttribution = object.assign({}, this.usedAttribution) - this.usedAttribution[name] = value - } - return this - } - - /** - * @template {AllowedDeltaFromSchema extends Delta ? ((Children extends never ? never : Array) | Text) : never} NewContent - * @param {NewContent} insert - * @param {FormattingAttributes?} [formatting] - * @param {Attribution?} [attribution] - * @return {DeltaBuilder< - * NodeName, - * Attrs, - * Exclude[number]|Children, - * (Extract|Text) extends never ? never : string, - * Schema - * >} - */ - insert (insert, formatting = null, attribution = null) { - modDeltaCheck(this) - const mergedAttributes = mergeAttrs(this.usedAttributes, formatting) - const mergedAttribution = mergeAttrs(this.usedAttribution, attribution) - /** - * @param {TextOp | InsertOp} lastOp - */ - const checkMergedEquals = lastOp => (mergedAttributes === lastOp.format || fun.equalityDeep(mergedAttributes, lastOp.format)) && (mergedAttribution === lastOp.attribution || fun.equalityDeep(mergedAttribution, lastOp.attribution)) - const end = this.children.end - if (s.$string.check(insert)) { - if ($textOp.check(end) && checkMergedEquals(end)) { - end._updateInsert(end.insert + insert) - } else if (insert.length > 0) { - list.pushEnd(this.children, new TextOp(insert, object.isEmpty(mergedAttributes) ? null : mergedAttributes, object.isEmpty(mergedAttribution) ? null : mergedAttribution)) - } - this.childCnt += insert.length - } else if (arr.isArray(insert)) { - if ($insertOp.check(end) && checkMergedEquals(end)) { - // @ts-ignore - end.insert.push(...insert) - end._fingerprint = null - } else if (insert.length > 0) { - list.pushEnd(this.children, new InsertOp(insert, object.isEmpty(mergedAttributes) ? null : mergedAttributes, object.isEmpty(mergedAttribution) ? null : mergedAttribution)) - } - this.childCnt += insert.length - } - return /** @type {any} */ (this) - } - - /** - * @template {AllowedDeltaFromSchema extends Delta ? Extract> : never} NewContent - * @param {NewContent} modify - * @param {FormattingAttributes?} formatting - * @param {Attribution?} attribution - * @return {DeltaBuilder< - * NodeName, - * Attrs, - * Exclude[number]|Children, - * (Extract|Text) extends string ? string : never, - * Schema - * >} - */ - modify (modify, formatting = null, attribution = null) { - modDeltaCheck(this) - const mergedAttributes = mergeAttrs(this.usedAttributes, formatting) - const mergedAttribution = mergeAttrs(this.usedAttribution, attribution) - list.pushEnd(this.children, new ModifyOp(modify, object.isEmpty(mergedAttributes) ? null : mergedAttributes, object.isEmpty(mergedAttribution) ? null : mergedAttribution)) - this.childCnt += 1 - return /** @type {any} */ (this) - } - - /** - * @param {number} len - * @param {FormattingAttributes?} [format] - * @param {Attribution?} [attribution] - */ - retain (len, format = null, attribution = null) { - modDeltaCheck(this) - const mergedFormats = mergeAttrs(this.usedAttributes, format) - const mergedAttribution = mergeAttrs(this.usedAttribution, attribution) - const lastOp = /** @type {RetainOp|InsertOp} */ (this.children.end) - if (lastOp instanceof RetainOp && fun.equalityDeep(mergedFormats, lastOp.format) && fun.equalityDeep(mergedAttribution, lastOp.attribution)) { - // @ts-ignore - lastOp.retain += len - } else if (len > 0) { - list.pushEnd(this.children, new RetainOp(len, mergedFormats, mergedAttribution)) - } - this.childCnt += len - return this - } - - /** - * @param {number} len - */ - delete (len) { - modDeltaCheck(this) - const lastOp = /** @type {DeleteOp|InsertOp} */ (this.children.end) - if (lastOp instanceof DeleteOp) { - lastOp.delete += len - } else if (len > 0) { - list.pushEnd(this.children, new DeleteOp(len)) - } - this.childCnt += len - return this - } - - /** - * @template {AllowedDeltaFromSchema extends Delta ? (keyof Attrs) : never} Key - * @template {AllowedDeltaFromSchema extends Delta ? (Attrs[Key]) : never} Val - * @param {Key} key - * @param {Val} val - * @param {Attribution?} attribution - * @param {Val|undefined} [prevValue] - * @return {DeltaBuilder< - * NodeName, - * { [K in keyof AddToAttrs]: AddToAttrs[K] }, - * Children, - * Text, - * Schema - * >} - */ - set (key, val, attribution = null, prevValue) { - modDeltaCheck(this) - this.attrs[key] = /** @type {any} */ (new AttrInsertOp(key, val, prevValue, mergeAttrs(this.usedAttribution, attribution))) - return /** @type {any} */ (this) - } - - /** - * @template {AllowedDeltaFromSchema extends Delta ? Attrs : never} NewAttrs - * @param {NewAttrs} attrs - * @param {Attribution?} attribution - * @return {DeltaBuilder< - * NodeName, - * { [K in keyof MergeAttrs]: MergeAttrs[K] }, - * Children, - * Text, - * Schema - * >} - */ - setMany (attrs, attribution = null) { - modDeltaCheck(this) - for (const k in attrs) { - this.set(/** @type {any} */ (k), attrs[k], attribution) - } - return /** @type {any} */ (this) - } - - /** - * @template {AllowedDeltaFromSchema extends Delta ? keyof As : never} Key - * @param {Key} key - * @param {Attribution?} attribution - * @param {any} [prevValue] - * @return {DeltaBuilder< - * NodeName, - * { [K in keyof AddToAttrs]: AddToAttrs[K] }, - * Children, - * Text, - * Schema - * >} - */ - unset (key, attribution = null, prevValue) { - modDeltaCheck(this) - this.attrs[key] = /** @type {any} */ (new AttrDeleteOp(key, prevValue, mergeAttrs(this.usedAttribution, attribution))) - return /** @type {any} */ (this) - } - - /** - * @template {AllowedDeltaFromSchema extends Delta ? { [K in keyof As]: Extract> extends never ? never : K }[keyof As] : never} Key - * @template {AllowedDeltaFromSchema extends Delta ? Extract> : never} D - * @param {Key} key - * @param {D} modify - * @return {DeltaBuilder< - * NodeName, - * { [K in keyof AddToAttrs]: AddToAttrs[K] }, - * Children, - * Text, - * Schema - * >} - */ - update (key, modify) { - modDeltaCheck(this) - this.attrs[key] = /** @type {any} */ (new AttrModifyOp(key, modify)) - return /** @type {any} */ (this) - } - - /** - * @param {Delta} other - */ - apply (other) { - modDeltaCheck(this) - this.$schema?.expect(other) - // apply attrs - for (const op of other.attrs) { - const c = /** @type {AttrInsertOp|AttrDeleteOp|AttrModifyOp} */ (this.attrs[op.key]) - if ($modifyOp.check(op)) { - if ($deltaAny.check(c?.value)) { - c._modValue.apply(op.value) - } else { - // then this is a simple modify - // @ts-ignore - this.attrs[op.key] = op.clone() - } - } else if ($insertOp.check(op)) { - // @ts-ignore - op.prevValue = c?.value - // @ts-ignore - this.attrs[op.key] = op.clone() - } else if ($deleteOp.check(op)) { - op.prevValue = c?.value - delete this.attrs[op.key] - } - } - // apply children - /** - * @type {ChildrenOpAny?} - */ - let opsI = this.children.start - let offset = 0 - /** - * At the end, we will try to merge this op, and op.next op with their respective previous op. - * - * Hence, anytime an op is cloned, deleted, or inserted (anytime list.* api is used) we must add - * an op to maybeMergeable. - * - * @type {Array|RetainOp|DeleteOp|TextOp|ModifyOp>} - */ - const maybeMergeable = [] - /** - * @template {InsertOp|RetainOp|DeleteOp|TextOp|ModifyOp|null} OP - * @param {OP} op - * @return {OP} - */ - const scheduleForMerge = op => { - op && maybeMergeable.push(op) - return op - } - other.children.forEach(op => { - if ($textOp.check(op) || $insertOp.check(op)) { - if (offset === 0) { - list.insertBetween(this.children, opsI == null ? this.children.end : opsI.prev, opsI, scheduleForMerge(op.clone())) - } else { - // @todo inmplement "splitHelper" and "insertHelper" - I'm splitting all the time and - // forget to update opsI - if (opsI == null) error.unexpectedCase() - const cpy = scheduleForMerge(opsI.clone(offset)) - opsI._splice(offset, opsI.length - offset) - list.insertBetween(this.children, opsI, opsI.next || null, cpy) - list.insertBetween(this.children, opsI, cpy || null, scheduleForMerge(op.clone())) - opsI = cpy - offset = 0 - } - this.childCnt += op.insert.length - } else if ($retainOp.check(op)) { - let retainLen = op.length - - if (offset > 0 && opsI != null && op.format != null && !$deleteOp.check(opsI) && !object.every(op.format, (v, k) => fun.equalityDeep(v, /** @type {InsertOp|RetainOp|ModifyOp} */ (opsI).format?.[k] || null))) { - // need to split current op - const cpy = scheduleForMerge(opsI.clone(offset)) - opsI._splice(offset, opsI.length - offset) - list.insertBetween(this.children, opsI, opsI.next || null, cpy) - opsI = cpy - offset = 0 - } - - while (opsI != null && opsI.length - offset <= retainLen) { - op.format != null && updateOpFormat(opsI, op.format) - retainLen -= opsI.length - offset - opsI = opsI?.next || null - offset = 0 - } - - if (opsI != null) { - if (op.format != null && retainLen > 0) { - // split current op and apply format - const cpy = scheduleForMerge(opsI.clone(retainLen)) - opsI._splice(retainLen, opsI.length - retainLen) - list.insertBetween(this.children, opsI, opsI.next || null, cpy) - updateOpFormat(opsI, op.format) - opsI = cpy - } else { - offset += retainLen - } - } else if (retainLen > 0) { - list.pushEnd(this.children, scheduleForMerge(new RetainOp(retainLen, op.format, op.attribution))) - this.childCnt += retainLen - } - } else if ($deleteOp.check(op)) { - let remainingLen = op.delete - while (remainingLen > 0) { - if (opsI == null) { - list.pushEnd(this.children, scheduleForMerge(new DeleteOp(remainingLen))) - this.childCnt += remainingLen - break - } else if (opsI instanceof DeleteOp) { - const delLen = opsI.length - offset - // the same content can't be deleted twice, remove duplicated deletes - if (delLen >= remainingLen) { - offset = 0 - opsI = opsI.next - } else { - offset += remainingLen - } - remainingLen -= delLen - } else { // insert / embed / retain / modify ⇒ replace - // case1: delete o fully - // case2: delete some part of beginning - // case3: delete some part of end - // case4: delete some part of center - const delLen = math.min(opsI.length - offset, remainingLen) - this.childCnt -= delLen - if (opsI.length === delLen) { - // case 1 - offset = 0 - scheduleForMerge(opsI.next) - list.remove(this.children, opsI) - opsI = opsI.next - } else if (offset === 0) { - // case 2 - offset = 0 - opsI._splice(0, delLen) - } else if (offset + delLen === opsI.length) { - // case 3 - opsI._splice(offset, delLen) - offset = 0 - opsI = opsI.next - } else { - // case 4 - opsI._splice(offset, delLen) - } - remainingLen -= delLen - } - } - } else if ($modifyOp.check(op)) { - if (opsI == null) { - list.pushEnd(this.children, op.clone()) - this.childCnt += 1 - return - } - if ($modifyOp.check(opsI)) { - opsI._modValue.apply(op.value) - } else if ($insertOp.check(opsI)) { - opsI._modValue(offset).apply(op.value) - } else if ($retainOp.check(opsI)) { - if (offset > 0) { - const cpy = scheduleForMerge(opsI.clone(0, offset)) // skipped len - opsI._splice(0, offset) // new remainder - list.insertBetween(this.children, opsI.prev, opsI, cpy) // insert skipped len - offset = 0 - } - list.insertBetween(this.children, opsI.prev, opsI, scheduleForMerge(op.clone())) // insert skipped len - if (opsI.length === 1) { - list.remove(this.children, opsI) - } else { - opsI._splice(0, 1) - scheduleForMerge(opsI) - } - } else if ($deleteOp.check(opsI)) { - // nop - } else { - error.unexpectedCase() - } - } else { - error.unexpectedCase() - } - }) - maybeMergeable.forEach(op => { - // check if this is still integrated - if (op.prev?.next === op) { - tryMergeWithPrev(this.children, op) - op.next && tryMergeWithPrev(this.children, op.next) - } - }) - return this - } - - /** - * @param {DeltaAny} other - * @param {boolean} priority - */ - rebase (other, priority) { - modDeltaCheck(this) - /** - * Rebase attributes - * - * - insert vs delete ⇒ insert takes precedence - * - insert vs modify ⇒ insert takes precedence - * - insert vs insert ⇒ priority decides - * - delete vs modify ⇒ delete takes precedence - * - delete vs delete ⇒ current delete op is removed because item has already been deleted - * - modify vs modify ⇒ rebase using priority - */ - for (const op of this.attrs) { - if ($insertOp.check(op)) { - if ($insertOp.check(other.attrs[op.key]) && !priority) { - delete this.attrs[op.key] - } - } else if ($deleteOp.check(op)) { - const otherOp = other.attrs[/** @type {any} */ (op.key)] - if ($insertOp.check(otherOp)) { - delete this.attrs[otherOp.key] - } - } else if ($modifyOp.check(op)) { - const otherOp = other.attrs[/** @type {any} */ (op.key)] - if (otherOp == null) { - // nop - } else if ($modifyOp.check(otherOp)) { - op._modValue.rebase(otherOp.value, priority) - } else { - delete this.attrs[otherOp.key] - } - } - } - /** - * Rebase children. - * - * Precedence: insert with higher priority comes first. Op with less priority is transformed to - * be inserted later. - * - * @todo always check if inser OR text - */ - /** - * @type {ChildrenOpAny?} - */ - let currChild = this.children.start - let currOffset = 0 - /** - * @type {ChildrenOpAny?} - */ - let otherChild = other.children.start - let otherOffset = 0 - while (currChild != null && otherChild != null) { - if ($insertOp.check(currChild) || $textOp.check(currChild)) { - /** - * Transforming *insert*. If other is.. - * - insert: transform based on priority - * - retain/delete/modify: transform next op against other - */ - if ($insertOp.check(otherChild) || $modifyOp.check(otherChild) || $textOp.check(otherChild)) { - if (!priority) { - list.insertBetween(this.children, currChild.prev, currChild, new RetainOp(otherChild.length, null, null)) - this.childCnt += otherChild.length - // curr is transformed against other, transform curr against next - otherOffset = otherChild.length - } else { - // curr stays as is, transform next op - currOffset = currChild.length - } - } else { // otherChild = delete | retain | modify - curr stays as is, transform next op - currOffset = currChild.length - } - } else if ($modifyOp.check(currChild)) { - /** - * Transforming *modify*. If other is.. - * - insert: adjust position - * - modify: rebase curr modify on other modify - * - delete: remove modify - * - retain: adjust offset - */ - if ($insertOp.check(otherChild) || $textOp.check(otherChild)) { - // @todo: with all list changes (retain insertions, removal), try to merge the surrounding - // ops later - list.insertBetween(this.children, currChild.prev, currChild, new RetainOp(otherChild.length, null, null)) - this.childCnt += otherChild.length - // curr is transformed against other, transform curr against next - otherOffset = otherChild.length - } else { - if ($modifyOp.check(otherChild)) { - /** @type {any} */ (currChild.value).rebase(otherChild, priority) - } else if ($deleteOp.check(otherChild)) { - list.remove(this.children, currChild) - this.childCnt -= 1 - } - currOffset += 1 - otherOffset += 1 - } - } else { // DeleteOp | RetainOp - const maxCommonLen = math.min(currChild.length - currOffset, otherChild.length - otherOffset) - /** - * Transforming *retain* OR *delete*. If other is.. - * - retain / modify: adjust offsets - * - delete: shorten curr op - * - insert: split curr op and insert retain - */ - if ($retainOp.check(otherChild) || $modifyOp.check(otherChild)) { - currOffset += maxCommonLen - otherOffset += maxCommonLen - } else if ($deleteOp.check(otherChild)) { - if ($retainOp.check(currChild)) { - // @ts-ignore - currChild.retain -= maxCommonLen - } else if ($deleteOp.check(currChild)) { - currChild.delete -= maxCommonLen - } - this.childCnt -= maxCommonLen - } else { // insert/text.check(currOp) - if (currOffset > 0) { - const leftPart = currChild.clone(currOffset) - list.insertBetween(this.children, currChild.prev, currChild, leftPart) - currChild._splice(currOffset, currChild.length - currOffset) - currOffset = 0 - } - list.insertBetween(this.children, currChild.prev, currChild, new RetainOp(otherChild.length, null, null)) - this.childCnt += otherChild.length - otherOffset = otherChild.length - } - } - if (currOffset >= currChild.length) { - currChild = currChild.next - currOffset = 0 - } - if (otherOffset >= otherChild.length) { - otherChild = otherChild.next - otherOffset = 0 - } - } - return this - } - - /** - * Same as doing `delta.rebase(other.inverse())`, without creating a temporary delta. - * - * @param {DeltaAny} other - * @param {boolean} priority - */ - rebaseOnInverse (other, priority) { - modDeltaCheck(this) - // @todo - console.info('method rebaseOnInverse unimplemented') - return this - } - - /** - * Append child ops from one op to the other. - * - * delta.create().insert('a').append(delta.create().insert('b')) // => insert "ab" - * - * @template {DeltaAny} OtherDelta - * @param {OtherDelta} other - * @return {CastToDelta extends Delta ? DeltaBuilder : never} - */ - append (other) { - const children = this.children - const prevLast = children.end - // @todo Investigate. Above is a typescript issue. It is necessary to cast OtherDelta to a Delta first before - // inferring type, otherwise Children will contain Text. - for (const child of other.children) { - list.pushEnd(children, child.clone()) - } - this.childCnt += other.childCnt - prevLast?.next && tryMergeWithPrev(children, prevLast.next) - // @ts-ignore - return this - } -} - -/** - * @param {ChildrenOpAny} op - * @param {{[k:string]:any}} formatUpdate - */ -const updateOpFormat = (op, formatUpdate) => { - if (!$deleteOp.check(op)) { - // apply formatting attributes - for (const k in formatUpdate) { - const v = formatUpdate[k] - if (v != null || $retainOp.check(op)) { - // never modify formats - /** @type {any} */ (op).format = object.assign({}, op.format, { [k]: v }) - } else if (op.format != null) { - const { [k]: _, ...rest } = op.format - ;/** @type {any} */ (op).format = rest - } - } - } -} - -/** - * @template {DeltaAny} D - * @typedef {D extends DeltaBuilder ? Delta : D} CastToDelta - */ - -/** - * @template {string} NodeName - * @template {{ [key: string|number]: any }} [Attrs={}] - * @template {fingerprintTrait.Fingerprintable|never} [Children=never] - * @template {string|never} [Text=never] - * @typedef {Delta|RecursiveDelta,Text>} RecursiveDelta - */ - -/** - * @template {string} Name - * @template {{[k:string|number]:any}} Attrs - * @template {fingerprintTrait.Fingerprintable} Children - * @template {boolean} HasText - * @template {{ [k:string]:any }} Formats - * @template {boolean} Recursive - * @extends {s.Schema : never), - * HasText extends true ? string : never, - * any>>} - */ -export class $Delta extends s.Schema { - /** - * @param {s.Schema} $name - * @param {s.Schema} $attrs - * @param {s.Schema} $children - * @param {HasText} hasText - * @param {s.Schema} $formats - * @param {Recursive} recursive - */ - constructor ($name, $attrs, $children, hasText, $formats, recursive) { - super() - const $attrsPartial = s.$$object.check($attrs) ? $attrs.partial : $attrs - if (recursive) { - // @ts-ignore - $children = s.$union($children, this) - } - this.shape = { $name, $attrs: $attrsPartial, $children, hasText, $formats } - } - - /** - * @param {any} o - * @param {s.ValidationError} [err] - * @return {o is Delta< - * Name, - * Attrs, - * Children|(Recursive extends true ? RecursiveDelta : never), - * HasText extends true ? string : never, - * any>} - */ - check (o, err = undefined) { - const { $name, $attrs, $children, hasText, $formats } = this.shape - if (!(o instanceof Delta)) { - err?.extend(null, 'Delta', o?.constructor.name, 'Constructor match failed') - } else if (o.name != null && !$name.check(o.name, err)) { - err?.extend('Delta.name', $name.toString(), o.name, 'Unexpected node name') - } else if (list.toArray(o.children).some(c => (!hasText && $textOp.check(c)) || (hasText && $textOp.check(c) && c.format != null && !$formats.check(c.format)) || ($insertOp.check(c) && !c.insert.every(ins => $children.check(ins))))) { - err?.extend('Delta.children', '', '', 'Children don\'t match the schema') - } else if (object.some(o.attrs, (op, k) => $insertOp.check(op) && !$attrs.check({ [k]: op.value }, err))) { - err?.extend('Delta.attrs', '', '', 'Attrs don\'t match the schema') - } else { - return true - } - return false - } -} - -/** - * @template {s.Schema|string|Array} [NodeNameSchema=s.Schema] - * @template {s.Schema<{ [key: string|number]: any }>|{ [key:string|number]:any }} [AttrsSchema=s.Schema<{}>] - * @template {any} [ChildrenSchema=s.Schema] - * @template {boolean} [HasText=false] - * @template {boolean} [Recursive=false] - * @template {{ [k:string]:any }} [Formats={[k:string]:any}] - * @param {object} opts - * @param {NodeNameSchema?} [opts.name] - * @param {AttrsSchema?} [opts.attrs] What key-value pairs are included. - * @param {ChildrenSchema?} [opts.children] The type of content in `insertOp` - * @param {HasText} [opts.text] Whether this delta contains text using `textOp` - * @param {Formats} [opts.formats] - * @param {Recursive} [opts.recursive] - * @return {[s.Unwrap>,s.Unwrap>,s.Unwrap>] extends [infer NodeName, infer Attrs, infer Children] ? s.Schema : never), - * HasText extends true ? string : never - * >> : never} - */ -export const $delta = ({ name, attrs, children, text, formats, recursive }) => /** @type {any} */ (new $Delta( - name == null ? s.$any : s.$(name), - /** @type {any} */ (attrs == null ? s.$object({}) : s.$(attrs)), - /** @type {any} */ (children == null ? s.$never : s.$(children)), - text ?? false, - formats == null ? s.$any : s.$(formats), - recursive ?? false -)) - -export const $$delta = s.$constructedBy($Delta) - -/** - * @todo remove this - * - * @template {s.Schema|string|Array} [NodeNameSchema=s.Schema] - * @template {s.Schema<{ [key: string|number]: any }>|{ [key:string|number]:any }} [AttrsSchema=s.Schema<{}>] - * @template {any} [ChildrenSchema=s.Schema] - * @template {boolean} [HasText=false] - * @template {boolean} [Recursive=false] - * @param {object} opts - * @param {NodeNameSchema?} [opts.name] - * @param {AttrsSchema?} [opts.attrs] - * @param {ChildrenSchema?} [opts.children] - * @param {HasText} [opts.text] - * @param {Recursive} [opts.recursive] - * @return {[s.Unwrap>,s.Unwrap>,s.Unwrap>] extends [infer NodeName, infer Attrs, infer Children] ? s.Schema : never), - * HasText extends true ? string : never - * >> : never} - */ -export const _$delta = ({ name, attrs, children, text, recursive }) => { - /** - * @type {s.Schema>} - */ - let $arrContent = children == null ? s.$never : s.$array(s.$(children)) - const $name = name == null ? s.$any : s.$(name) - const $attrsPartial = attrs == null ? s.$object({}) : (s.$$record.check(attrs) ? attrs : /** @type {any} */ (s.$(attrs)).partial) - const $d = s.$instanceOf(Delta, /** @param {Delta} d */ d => { - if ( - !$name.check(d.name) || - object.some(d.attrs, - (op, k) => $insertOp.check(op) && !$attrsPartial.check({ [k]: op.value }) - ) - ) return false - for (const op of d.children) { - if ((!text && $textOp.check(op)) || ($insertOp.check(op) && !$arrContent.check(op.insert))) { - return false - } - } - return true - }) - if (recursive) { - $arrContent = children == null ? s.$array($d) : s.$array(s.$(children), $d) - } - return /** @type {any} */ ($d) -} - -/** - * @type {s.Schema} - */ -export const $deltaAny = /** @type {any} */ (s.$instanceOf(Delta)) - -/** - * @type {s.Schema} - */ -export const $deltaBuilderAny = /** @type {any} */ (s.$instanceOf(DeltaBuilder)) - -/** - * Helper function to merge attribution and attributes. The latter input "wins". - * - * @template {{ [key: string]: any }} T - * @param {T | null} a - * @param {T | null} b - */ -export const mergeAttrs = (a, b) => object.isEmpty(a) - ? (object.isEmpty(b) ? null : b) - : (object.isEmpty(b) ? a : object.assign({}, a, b)) - -/** - * @template {DeltaAny|null} D - * @param {D} a - * @param {D} b - * @return {D} - */ -export const mergeDeltas = (a, b) => { - if (a != null && b != null) { - const c = clone(a) - c.apply(b) - return /** @type {any} */ (c) - } - return a == null ? b : (a || null) -} - -/** - * @template {DeltaAny} D - * @param {prng.PRNG} gen - * @param {s.Schema} $d - * @return {D extends Delta ? DeltaBuilder : never} - */ -export const random = (gen, $d) => { - const { $name, $attrs, $children, hasText, $formats: $formats_ } = /** @type {$Delta} */ (/** @type {any} */ ($d)).shape - const d = s.$$any.check($name) ? create($deltaAny) : create(s.random(gen, $name), $deltaAny) - const $formats = s.$$any.check($formats_) ? s.$null : $formats_ - prng.bool(gen) && d.setMany(s.random(gen, $attrs)) - for (let i = prng.uint32(gen, 0, 5); i > 0; i--) { - if (hasText && prng.bool(gen)) { - d.insert(prng.word(gen), s.random(gen, $formats)) - } else if (!s.$$never.check($children)) { - /** - * @type {Array} - */ - const ins = [] - let insN = prng.int32(gen, 0, 5) - while (insN--) { - ins.push(s.random(gen, $children)) - } - d.insert(ins, s.random(gen, $formats)) - } - } - return /** @type {any} */ (d) -} - -/** - * @overload - * @return {DeltaBuilder} - */ -/** - * @template {string} NodeName - * @overload - * @param {NodeName} nodeName - * @return {DeltaBuilder} - */ -/** - * @template {string} NodeName - * @template {s.Schema} Schema - * @overload - * @param {NodeName} nodeName - * @param {Schema} schema - * @return {Schema extends s.Schema> ? DeltaBuilder : never} - */ -/** - * @template {s.Schema} Schema - * @overload - * @param {Schema} schema - * @return {Schema extends s.Schema> ? DeltaBuilder : never} - */ -/** - * @template {string|null} NodeName - * @template {{[k:string|number]:any}|null} Attrs - * @template {Array|string} [Children=never] - * @overload - * @param {NodeName} nodeName - * @param {Attrs} attrs - * @param {Children} [children] - * @return {DeltaBuilder< - * NodeName extends null ? any : NodeName, - * Attrs extends null ? {} : Attrs, - * Extract> extends Array ? (unknown extends Ac ? never : Ac) : never, - * Extract, - * null - * >} - */ -/** - * @param {string|s.Schema} [nodeNameOrSchema] - * @param {{[K:string|number]:any}|s.Schema} [attrsOrSchema] - * @param {(Array|string)} [children] - * @return {DeltaBuilder} - */ -export const create = (nodeNameOrSchema, attrsOrSchema, children) => { - const nodeName = /** @type {any} */ (s.$string.check(nodeNameOrSchema) ? nodeNameOrSchema : null) - const schema = /** @type {any} */ (s.$$schema.check(nodeNameOrSchema) ? nodeNameOrSchema : (s.$$schema.check(attrsOrSchema) ? attrsOrSchema : null)) - const d = /** @type {DeltaBuilder} */ (new DeltaBuilder(nodeName, schema)) - if (s.$objectAny.check(attrsOrSchema)) { - d.setMany(attrsOrSchema) - } - children && d.insert(children) - return d -} - -// DELTA TEXT - -/** - * @template {fingerprintTrait.Fingerprintable} [Embeds=never] - * @typedef {Delta} TextDelta - */ - -/** - * @template {fingerprintTrait.Fingerprintable} [Embeds=never] - * @typedef {DeltaBuilder} TextDeltaBuilder - */ - -/** - * @template {Array>} [$Embeds=any] - * @param {$Embeds} $embeds - * @return {s.Schema extends null ? never : ($Embeds extends Array> ? $C : never)>>} - */ -export const $text = (...$embeds) => /** @type {any} */ ($delta({ children: s.$union(...$embeds), text: true })) -export const $textOnly = $text() - -/** - * @template {s.Schema>} [Schema=s.Schema>] - * @param {Schema} [$schema] - * @return {Schema extends s.Schema> ? DeltaBuilder : never} - */ -export const text = $schema => /** @type {any} */ (create($schema || $textOnly)) - -/** - * @template {fingerprintTrait.Fingerprintable} Children - * @typedef {Delta} ArrayDelta - */ - -/** - * @template {fingerprintTrait.Fingerprintable} Children - * @typedef {DeltaBuilder} ArrayDeltaBuilder - */ - -/** - * @template {any|s.Schema} $Children - * @param {$Children} [$children] - * @return {s.Schema>>>} - */ -export const $array = $children => /** @type {any} */ ($delta({ children: $children })) - -/** - * @template {s.Schema>} [$Schema=never] - * @param {$Schema} $schema - * @return {$Schema extends never ? ArrayDeltaBuilder : DeltaBuilder} - */ -export const array = $schema => /** @type {any} */ ($schema ? create($schema) : create()) - -/** - * @template {{ [K: string|number]: any }} Attrs - * @typedef {Delta} MapDelta - */ - -/** - * @template {{ [K: string|number]: any }} Attrs - * @typedef {DeltaBuilder} MapDeltaBuilder - */ - -/** - * @template {{ [K: string|number]: any }} $Attrs - * @param {s.Schema<$Attrs>} $attrs - * @return {s.Schema>} - */ -export const $map = $attrs => /** @type {any} */ ($delta({ attrs: $attrs })) - -/** - * @template {s.Schema>|undefined} [$Schema=undefined] - * @param {$Schema} [$schema] - * @return {$Schema extends s.Schema> ? DeltaBuilder : MapDeltaBuilder<{}>} - */ -export const map = $schema => /** @type {any} */ (create(/** @type {any} */ ($schema))) - -/** - * @template {DeltaAny} D - * @param {D} d1 - * @param {NoInfer} d2 - * @return {D extends Delta ? DeltaBuilder : never} - */ -export const diff = (d1, d2) => { - /** - * @type {DeltaBuilderAny} - */ - const d = create() - if (d1.fingerprint !== d2.fingerprint) { - let left1 = d1.children.start - let left2 = d2.children.start - let right1 = d1.children.end - let right2 = d2.children.end - let commonPrefixOffset = 0 - // perform a patience sort - // 1) remove common prefix and suffix - while (left1 != null && left1.fingerprint === left2?.fingerprint) { - if (!$deleteOp.check(left1)) { - commonPrefixOffset += left1.length - } - left1 = left1.next - left2 = left2.next - } - while (right1 !== null && right1 !== left1 && right1.fingerprint === right2?.fingerprint) { - right1 = right1.prev - right2 = right2.prev - } - /** - * @type {Array} - */ - const ops1 = [] - /** - * @type {Array} - */ - const ops2 = [] - while (left1 !== null && left1 !== right1?.next) { - ops1.push(left1) - left1 = left1.next - } - while (left2 !== null && left2 !== right2?.next) { - ops2.push(left2) - left2 = left2.next - } - const fprints1 = ops1.map(op => op.fingerprint) - const fprints2 = ops2.map(op => op.fingerprint) - const changeset = patience.diff(fprints1, fprints2) - d.retain(commonPrefixOffset) - for (let i = 0, lastIndex1 = 0, currIndexOffset2 = 0; i < changeset.length; i++) { - const change = changeset[i] - d.retain(change.index - lastIndex1) - // insert minimal diff at curred position in d - /** - * - * @todo it would be better if these would be slices of delta (an actual delta) - * - * @param {ChildrenOpAny[]} opsIs - * @param {ChildrenOpAny[]} opsShould - */ - const diffAndApply = (opsIs, opsShould) => { - const d = create() - // @todo unoptimized implementation. Convert content to array and diff that based on - // generated fingerprints. We probably could do better and cache more information. - // - benchmark - // - cache fingerprints in ops - /** - * @type {Array} - */ - const isContent = opsIs.flatMap(op => $insertOp.check(op) ? op.insert : ($textOp.check(op) ? op.insert.split('') : error.unexpectedCase())) - /** - * @type {Array} - */ - const shouldContent = opsShould.flatMap(op => $insertOp.check(op) ? op.insert : ($textOp.check(op) ? op.insert.split('') : error.unexpectedCase())) - const isContentFingerprinted = isContent.map(c => s.$string.check(c) ? c : fingerprintTrait.fingerprint(c)) - const shouldContentFingerprinted = shouldContent.map(c => s.$string.check(c) ? c : fingerprintTrait.fingerprint(c)) - const hasFormatting = opsIs.some(op => !$deleteOp.check(op) && op.format != null) || opsShould.some(op => !$deleteOp.check(op) && op.format != null) - /** - * @type {{ index: number, insert: Array, remove: Array }[]} - */ - const cdiff = patience.diff(isContentFingerprinted, shouldContentFingerprinted) - // overwrite fingerprinted content with actual content - for (let i = 0, adj = 0; i < cdiff.length; i++) { - const cd = cdiff[i] - cd.remove = isContent.slice(cd.index, cd.index + cd.remove.length) - cd.insert = shouldContent.slice(cd.index + adj, cd.index + adj + cd.insert.length) - adj += cd.insert.length - cd.remove.length - } - for (let i = 0, lastIndex = 0; i < cdiff.length; i++) { - const cd = cdiff[i] - d.retain(cd.index - lastIndex) - lastIndex = cd.index - let cdii = 0 - let cdri = 0 - // try to match as much content as possible, preferring to skip over non-deltas - for (; cdii < cd.insert.length && cdri < cd.remove.length;) { - const a = cd.insert[cdii] - const b = cd.remove[cdri] - if ($deltaAny.check(a) && $deltaAny.check(b) && a.name === b.name) { - d.modify(diff(b, a)) - cdii++ - cdri++ - } else if ($deltaAny.check(b)) { - d.insert(s.$string.check(a) ? a : [a]) - cdii++ - } else { - d.delete(1) - cdri++ - } - } - for (; cdii < cd.insert.length; cdii++) { - const a = cd.insert[cdii] - d.insert(s.$string.check(a) ? a : [a]) - } - d.delete(cd.remove.length - cdri) - } - // create the diff for formatting - if (hasFormatting) { - const formattingDiff = create() - // update opsIs with content diff. then we can figure out the formatting diff. - const isUpdated = create() - // copy opsIs to fresh delta - opsIs.forEach(op => { - isUpdated.childCnt += op.length - list.pushEnd(isUpdated.children, op.clone()) - }) - isUpdated.apply(d) - let shouldI = 0 - let shouldOffset = 0 - let isOp = isUpdated.children.start - let isOffset = 0 - while (shouldI < opsShould.length && isOp != null) { - const shouldOp = opsShould[shouldI] - if (!$deleteOp.check(shouldOp) && !$deleteOp.check(isOp)) { - const isFormat = isOp.format - const minForward = math.min(shouldOp.length - shouldOffset, isOp.length - isOffset) - shouldOffset += minForward - isOffset += minForward - if (fun.equalityDeep(shouldOp.format, isFormat)) { - formattingDiff.retain(minForward) - } else { - /** - * @type {FormattingAttributes} - */ - const fupdate = {} - shouldOp.format != null && object.forEach(shouldOp.format, (v, k) => { - if (!fun.equalityDeep(v, isFormat?.[k] || null)) { - fupdate[k] = v - } - }) - isFormat && object.forEach(isFormat, (_, k) => { - if (shouldOp?.format?.[k] === undefined) { - fupdate[k] = null - } - }) - formattingDiff.retain(minForward, fupdate) - } - // update offset and iterators - if (shouldOffset >= shouldOp.length) { - shouldI++ - shouldOffset = 0 - } - if (isOffset >= isOp.length) { - isOp = isOp.next - isOffset = 0 - } - } - } - d.apply(formattingDiff) - } - return d - } - const subd = diffAndApply(ops1.slice(change.index, change.index + change.remove.length), ops2.slice(change.index + currIndexOffset2, change.index + currIndexOffset2 + change.insert.length)) - d.append(subd) - lastIndex1 = change.index + change.remove.length - currIndexOffset2 += change.insert.length - change.remove.length - } - for (const attr2 of d2.attrs) { - const attr1 = d1.attrs[attr2.key] - if (attr1 == null || (attr1.fingerprint !== attr2.fingerprint)) { - /* c8 ignore else */ - if ($insertOp.check(attr2)) { - d.set(attr2.key, attr2.value) - } else { - /* c8 ignore next 2 */ - error.unexpectedCase() - } - } - } - for (const attr1 of d1.attrs) { - if (d2.attrs[attr1.key] == null) { - d.unset(attr1.key) - } - } - } - return /** @type {any} */ (d.done(false)) -} diff --git a/yjs-poll/node_modules/lib0/delta/delta.test.d.ts b/yjs-poll/node_modules/lib0/delta/delta.test.d.ts deleted file mode 100644 index ceb757e..0000000 --- a/yjs-poll/node_modules/lib0/delta/delta.test.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -export function testDeltaBasicApi(_tc: t.TestCase): void; -export function testDeltaValues(_tc: t.TestCase): void; -export function testDeltaBasicCases(): void; -export function testDeltaArrayBasics(): void; -export function testAssignability(): void; -export function testText(): void; -export function testDelta(_tc: t.TestCase): void; -export function testDeltaMerging(_tc: t.TestCase): void; -export function testUseAttributes(_tc: t.TestCase): void; -export function testUseAttribution(_tc: t.TestCase): void; -export function testMapTyping(): void; -export function testMapDeltaBasics(_tc: t.TestCase): void; -export function testMapDeltaModify(_tc: t.TestCase): void; -export function testMapDelta(_tc: t.TestCase): void; -export function testRepeatRebaseMergeDeltas(tc: t.TestCase): void; -export function testNodeDelta(_tc: t.TestCase): void; -export function testRecursiveNode(): void; -export function testSimplifiedDeltaSchemaDefinition(): void; -export function testDiffing(): void; -export function testDiffingCommonPreSuffix(): void; -export function testSlice(): void; -export function testRepeatRandomListDiff(tc: t.TestCase): void; -export function testRepeatRandomMapDiff(tc: t.TestCase): void; -export function testDeltaAppend(_tc: t.TestCase): void; -export function testDeltaDiffWithFormatting(): void; -export function testDeltaDiffWithFormatting2(): void; -export function testDeltaDiffIssue1(): void; -import * as t from 'lib0/testing'; -//# sourceMappingURL=delta.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/delta/delta.test.d.ts.map b/yjs-poll/node_modules/lib0/delta/delta.test.d.ts.map deleted file mode 100644 index 3f61b71..0000000 --- a/yjs-poll/node_modules/lib0/delta/delta.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"delta.test.d.ts","sourceRoot":"","sources":["delta.test.js"],"names":[],"mappings":"AAqCO,uCAFI,CAAC,CAAC,QAAQ,QAWpB;AAYM,qCAFI,CAAC,CAAC,QAAQ,QAwBpB;AAEM,4CA2BN;AAEM,6CAMN;AAKM,0CAkJN;AAEM,iCAWN;AAKM,+BAFI,CAAC,CAAC,QAAQ,QAKpB;AAKM,sCAFI,CAAC,CAAC,QAAQ,QAYpB;AAKM,uCAFI,CAAC,CAAC,QAAQ,QAuBpB;AAKM,wCAFI,CAAC,CAAC,QAAQ,QAsBpB;AAEM,sCAaN;AAKM,wCAFI,CAAC,CAAC,QAAQ,QA4BpB;AAKM,wCAFI,CAAC,CAAC,QAAQ,QA2CpB;AAKM,kCAFI,CAAC,CAAC,QAAQ,QAqDpB;AAKM,gDAFI,CAAC,CAAC,QAAQ,QAoEpB;AAKM,mCAFI,CAAC,CAAC,QAAQ,QAiCpB;AAEM,0CAmBN;AAEM,4DAIN;AAEM,oCAMN;AAEM,mDAMN;AAEM,kCAGN;AAKM,6CAFI,CAAC,CAAC,QAAQ,QAWpB;AAKM,4CAFI,CAAC,CAAC,QAAQ,QAWpB;AAKM,qCAFI,CAAC,CAAC,QAAQ,QAQpB;AAEM,oDAKN;AAEM,qDAKN;AAEM,4CAQN;mBAjtBkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/delta/readme.md b/yjs-poll/node_modules/lib0/delta/readme.md deleted file mode 100644 index 0491c10..0000000 --- a/yjs-poll/node_modules/lib0/delta/readme.md +++ /dev/null @@ -1,129 +0,0 @@ -# Deltas - -- Enable you to efficiently represent changes on all kinds of data structures. -- Support schemas -- Support OT-style conflict resolution `delta2.apply(delta1.rebase(delta2, true)) === delta1.apply(delta2.rebase(delta1, false))` -- nice typings - -## Delta for Map-like structures - -```javascript -// define schema -const $d = delta.$delta(s.$any, { attr1: s.$string, attr2: s.$number }) -const d = delta.create($d) - - -// create an update -const update = delta.create().set('attr1', 'val1').set('attr2', 42) -d.apply(update) - -// In case of an invalid update -const update2 = delta.create().set('attr1', 42) -// it is possible to check an update beforehand -$d.check(update2) // => false -// and you also get type errors -d.apply(update2) // type error: expected 'attr1' to be of type string -``` - -## Delta for Text-like structures - -Text-like deltas work similarly to [Quill Deltas]{https://quilljs.com/docs/delta} - -```javascript -// define schema -const $d = delta.$delta(s.$any, null, s.$string) -const d = delta.create($d).insert('hello world') - -// create an update -const update = delta.create().retain(11).insert('!') -d.apply(update) - -// In case of an invalid update -const update2 = delta.create().insert([{ some: 'object' }]) -// it is possible to check an update beforehando -$d.check(update2) // => false -// and you also get type errors -d.apply(update2) // type error: unexpected attribute 'attr1' -``` - -## Delta for Array-like structures - -```javascript -// define schema -const $d = delta.$delta(s.$any, null, s.$array(s.object({ some: s.$string }, s.$string))) -const d = delta.create($d).insert(['hello world']) - -// create an update -const update = delta.create().retain(1).insert({ some: 'object' }) -d.apply(update) - -// In case of an invalid update -const update2 = delta.create().insert([{ unknown: 'prop' }]) -// it is possible to check an update beforehando -$d.check(update2) // => false -// and you also get type errors -d.apply(update2) // type error: { unknown: 'prop' } is not assignable to { some: string } -``` - -## Delta for Node-like structures (similar to XML,Trees with named nodes) - -```javascript -// define schema for a 'p'|'h1' node that may contain text or other instances of itself -const $d = delta.$delta(s.$literal('div', 'p', 'h1'), { style: s.$string }, s.$string, true)) -const d = delta.create('div', $d) - -// create an update - insert paragraph into the
-const update = delta.create().insert([delta.create('p', { style: 'bold: true' }, 'hello world')]) -d.apply(update) - -// modify the paragraph by deleting the text 'world' and appending '!' -d.apply(delta.create().modify( - delta.create().retain(6).delete(5).insert('!') -)) -``` - -# Transformers - -We often have two different data structures that we want to sync. There might be -slight differences between those data structures. I.e. we might have a Yjs data -structure containing the following content: - -```javascript -/** - * { - * headline: {{ headline }}, - * content: {{ content }} - * } - */ -const $data = s.$delta(null, { headline: s.$string, content: s.$string }) -``` - -A typical scenario is that we want to sync that to the dom and back. "two-way bindings" -- When the Yjs struucture updates, we want to sync the changes to the dom. -- When the dom is updated (because the dom is a `contenteditable` editor), we -want to sync back the changes to the yjs structure. - -Now, the dom might look like this: - -```javascript -/** - *
- *

{{headline}}

- * dturianed - *

{{content}}

- *
- */ -``` - -We can achieve automattic back-and-forth transformations with delta -transformers: - -```javascript -const Λdata = Λ.transform($data, $d => - Λ.delta('div', {}, [ - Λ.delta('h1', { style: 'bold:true' }, [Λ.query('headline')($d)], []), - Λ.delta('p', null, [Λ.query('content')($d)]) - ]) -) -``` - diff --git a/yjs-poll/node_modules/lib0/delta/t3.test.d.ts b/yjs-poll/node_modules/lib0/delta/t3.test.d.ts deleted file mode 100644 index b449d55..0000000 --- a/yjs-poll/node_modules/lib0/delta/t3.test.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -export function transformResult(a: DeltaA, b: DeltaB): TransformResult; -export const transformResultEmpty: TransformResult; -export type TransformResult = { - a: DeltaA | null; - b: DeltaB | null; -}; -export type DeltaTransformer = (t: { - a: DeltaA | null; - b: DeltaB | null; -}) => ({ - a: DeltaA | null; - b: DeltaB | null; -}); -export type Transform = { - applyA: (da: DeltaA) => TransformResult; - applyB: (db: DeltaB) => TransformResult; -}; -import * as delta from './delta.js'; -//# sourceMappingURL=t3.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/delta/t3.test.d.ts.map b/yjs-poll/node_modules/lib0/delta/t3.test.d.ts.map deleted file mode 100644 index 3559346..0000000 --- a/yjs-poll/node_modules/lib0/delta/t3.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"t3.test.d.ts","sourceRoot":"","sources":["t3.test.js"],"names":[],"mappings":"AAoBO,gCAN4B,MAAM,SAA3B,KAAK,CAAC,YAAY,OAAE,EACC,MAAM,SAA3B,KAAK,CAAC,YAAY,OAAE,KACvB,MAAM,KACN,MAAM,GACL,eAAe,CAAC,MAAM,OAAC,EAAC,MAAM,OAAC,CAAC,CAEO;AACnD,+DAA+D;4BAbnC,MAAM,SAApB,KAAK,CAAC,KAAK,OAAE,EACC,MAAM,SAApB,KAAK,CAAC,KAAK,OAAE,IACd;IAAE,CAAC,EAAE,MAAM,OAAC,CAAC;IAAC,CAAC,EAAE,MAAM,OAAC,CAAA;CAAE;6BAiBT,MAAM,SAAtB,KAAK,CAAC,QAAS,EACC,MAAM,SAAtB,KAAK,CAAC,QAAS,IAChB,CAAC,CAAC,EAAC;IAAC,CAAC,EAAC,MAAM,OAAC,CAAC;IAAA,CAAC,EAAC,MAAM,OAAC,CAAA;CAAC,KAAG,CAAC;IAAC,CAAC,EAAC,MAAM,OAAC,CAAC;IAAA,CAAC,EAAC,MAAM,OAAC,CAAA;CAAC,CAAC;sBA2GpC,MAAM,SAAnB,KAAK,CAAC,KAAM,EACC,MAAM,SAAnB,KAAK,CAAC,KAAM,IACb;IAAE,MAAM,EAAE,CAAC,EAAE,EAAC,MAAM,KAAG,eAAe,CAAC,MAAM,EAAC,MAAM,CAAC,CAAC;IAAC,MAAM,EAAE,CAAC,EAAE,EAAC,MAAM,KAAG,eAAe,CAAC,MAAM,EAAC,MAAM,CAAC,CAAA;CAAE;uBAvIlG,YAAY"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/deno.json b/yjs-poll/node_modules/lib0/deno.json deleted file mode 100644 index 6e68cf4..0000000 --- a/yjs-poll/node_modules/lib0/deno.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "imports": { - "isomorphic.js": "./node_modules/isomorphic.js/node.mjs", - "lib0/logging": "./logging.node.js", - "lib0/performance": "./performance.node.js", - "lib0/crypto/aes-gcm": "./crypto/aes-gcm.js", - "lib0/crypto/rsa-oaep": "./crypto/rsa-oaep.js", - "lib0/crypto/ecdsa": "./crypto/ecdsa.js", - "lib0/crypto/jwt": "./crypto/jwt.js", - "lib0/webcrypto": "./webcrypto.deno.js" - } -} diff --git a/yjs-poll/node_modules/lib0/deno.lock b/yjs-poll/node_modules/lib0/deno.lock deleted file mode 100644 index 794d4eb..0000000 --- a/yjs-poll/node_modules/lib0/deno.lock +++ /dev/null @@ -1,122 +0,0 @@ -{ - "version": "2", - "remote": { - "https://deno.land/std@0.177.0/_util/asserts.ts": "178dfc49a464aee693a7e285567b3d0b555dc805ff490505a8aae34f9cfb1462", - "https://deno.land/std@0.177.0/_util/os.ts": "d932f56d41e4f6a6093d56044e29ce637f8dcc43c5a90af43504a889cf1775e3", - "https://deno.land/std@0.177.0/bytes/index_of_needle.ts": "65c939607df609374c4415598fa4dad04a2f14c4d98cd15775216f0aaf597f24", - "https://deno.land/std@0.177.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.mjs": "5dedb7f9aa05f0e18ed017691c58df5f4686e4cbbd70368c6f896e5cca03f2b4", - "https://deno.land/std@0.177.0/crypto/_wasm/mod.ts": "e2df88236fc061eac7a89e8cb0b97843f5280b08b2a990e473b7397a3e566003", - "https://deno.land/std@0.177.0/crypto/timing_safe_equal.ts": "8d69ab611c67fe51b6127d97fcfb4d8e7d0e1b6b4f3e0cc4ab86744c3691f965", - "https://deno.land/std@0.177.0/encoding/base64.ts": "7de04c2f8aeeb41453b09b186480be90f2ff357613b988e99fabb91d2eeceba1", - "https://deno.land/std@0.177.0/encoding/base64url.ts": "3f1178f6446834457b16bfde8b559c1cd3481727fe384d3385e4a9995dc2d851", - "https://deno.land/std@0.177.0/encoding/hex.ts": "50f8c95b52eae24395d3dfcb5ec1ced37c5fe7610ef6fffdcc8b0fdc38e3b32f", - "https://deno.land/std@0.177.0/flags/mod.ts": "d1cdefa18472ef69858a17df5cf7c98445ed27ac10e1460183081303b0ebc270", - "https://deno.land/std@0.177.0/node/_core.ts": "9a58c0ef98ee77e9b8fcc405511d1b37a003a705eb6a9b6e95f75434d8009adc", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/asn1.js/base/buffer.js": "c9364c761681134015ec8ba6f33b39c067d6e5dd59860d55face8d5be8522744", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/asn1.js/base/node.js": "8f7f23bfa300990bbd6db7e7395e9688b54a04e3eb2fab5cab9a9a72e26c525f", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/asn1.js/base/reporter.js": "788aec7662991da549e5f7f3edbc3e3d6c6cecabc894b18d1a705b0f204e06c3", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/asn1.js/constants/der.js": "57181db0519bb3864a6cdf4e7eb9bfeb1bf5f80605187fbe80e27083b473e367", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/asn1.js/decoders/der.js": "fdc4de98c9b0b59db169a2b225895741e2ab34b00e14315ac2ff5e389d6db16e", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/asn1.js/decoders/pem.js": "fd7f0072c193c82959fec0374f4fd3adf3f4ac38594fd404d66b3e8724107151", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/asn1.js/encoders/der.js": "137bc4f8fe66b9950c743025e199789e25342f791e2d52353ceb016ad2854b42", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/asn1.js/encoders/pem.js": "e43bc706973c4c27e1e2f96262daba3d38822cb10f5b494f6944c726ee655160", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/asn1.js/mod.js": "1f88293688296be7a6c735bd8ea39425f5b274b94db1d6b7968dddfb54ac9d37", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/bn.js/bn.js": "f3f3c1dae1aa55de9e6472af1d6bec5ccda4b4890ee5c52a90961137fe99564e", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/browserify_aes/aes.js": "698e1ed386b7dff27b2d59fa1c75f506beceec96b78670a15a734e438c08f138", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/browserify_aes/auth_cipher.js": "5c245b5685b066356a7c9529a3a441bf5f57823a6946ce1b0ef2e1af32bb76f4", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/browserify_aes/decrypter.js": "39152b2b3409893b8548feeab7e5997ceb1595f31df0dedaf765708be8f025c0", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/browserify_aes/encrypter.js": "f9cc703d5a7b5255999c1a3600fbf48ff564b65f827744877526803093ceebff", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/browserify_aes/ghash.js": "759d80b760f44cd3a454b4f161fd03a7d6c359901446f0a907a6870cb66d6767", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/browserify_aes/incr32.js": "2bdea27b74b3990ee56807a1a5abe335f118826beabeeb905459c8768094b28f", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/browserify_aes/mod.js": "fe4affebbd210d885b2e5135c668751f9d10bc14aa0cc3905cbfff66f04b4c58", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/browserify_aes/modes/cbc.js": "ff24b4506522a724ba7a03c1403ad8938aba45056f9fd47c7f0b4fcb3a640adf", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/browserify_aes/modes/cfb.js": "643720a1db969b6bcc896c95523630838a8335513d02f340514fd524bb4113cb", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/browserify_aes/modes/cfb1.js": "01c9a46aa3affd84a54ae33652fb0fa0ff7c862be2a459d9cb188cb8e2c4b11e", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/browserify_aes/modes/cfb8.js": "97476cee25103e02a02b196d7fe6f28a9f0f9e47ee344687d7492bc7282a59f8", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/browserify_aes/modes/ctr.js": "1e3835adb753cfe6761e4df8c43d190e31e1ca6a586fd582747c8255c82ed78d", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/browserify_aes/modes/ecb.js": "79677b96d4af50c49f0a4f698e5c7e5a64f1d2926b799e0d2eac2cdd5ec7488c", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/browserify_aes/modes/mod.js": "fe3db429b867a0a8066c64d7b33b840a1f24cad9174156384a763733f68cf518", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/browserify_aes/modes/ofb.js": "3553308f98d078e2006eac39bb6d91818f8bb376b01d962ae98eabf6ee79ad4e", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/browserify_aes/stream_cipher.js": "70f50f37ddec530ae95911ca2f286ebd2ddbd54d914ab0be461ec1dc3c61990f", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/browserify_aes/xor.ts": "7132baacdb39ba82c3bfe325a60e68ca87469c0ed0cdd0508caf6f40bab852b8", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/browserify_rsa.js": "96e0e4fee7c2cf75ef86d958c709bfc239297a080fd17ace5ea5ab699a1b6174", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/cipher_base.js": "9ebc6ccc364cf7b23024821054d2e72a2d8da8d8a2a36cacdc5aa6cc6770ef93", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/evp_bytes_to_key.ts": "7c4c27b6e321b2d7065a6703d90264921e9a805d91d9dfdb21103393228024e2", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/parse_asn1/asn1.js": "7d99b6df508164169a33377346e8840d519fe2defccb362a023c92c5bd503433", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/parse_asn1/certificate.js": "5795348417b3ec7aafa4854ba55f364e0148eadfdd29d1566c90e617237621bb", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/parse_asn1/fix_proc.js": "858dd3e6ce264d75822cadc21bb55114f4e4867a706abde1663548aa2710fc1b", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/parse_asn1/mod.js": "ea164fbd497ce3d710426742d4b72f71da8954c4ebaeb7eadc33316c5b0060f1", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/public_encrypt/mgf.js": "dfac5008a550b3e7e6b851c4fb42e984aa9e7fae64707888f47f2aa0991c004d", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/public_encrypt/mod.js": "0704326ff3ee2bb0764a964995d1aa62b1147b714ad5465e878ba4d57731e3db", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/public_encrypt/private_decrypt.js": "8a1d11edb176d95d1e3bdf1aff5c3248a986bf9734d1a6b07508e29132d2f65c", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/public_encrypt/public_encrypt.js": "f88b0e3c228d84096fdbc03e614e86bef86e56013cb9628b2425e31b3b142b2c", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/public_encrypt/with_public.js": "752da754d253b5743d89c0f2432b6eb6f8815b80efd9ee588683e10a13d34400", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/public_encrypt/xor.js": "087ebef8f6fcb8ca4c7216cc22de728d9a61ec27b9a036b900681ff25d6409af", - "https://deno.land/std@0.177.0/node/_crypto/crypto_browserify/randombytes.ts": "23bde8be640e274d7bb88cf10d1da8bba252654252dc6a877fed86a77da5952c", - "https://deno.land/std@0.177.0/node/_events.d.ts": "1347437fd6b084d7c9a4e16b9fe7435f00b030970086482edeeb3b179d0775af", - "https://deno.land/std@0.177.0/node/_events.mjs": "d4ba4e629abe3db9f1b14659fd5c282b7da8b2b95eaf13238eee4ebb142a2448", - "https://deno.land/std@0.177.0/node/_global.d.ts": "2d88342f38b4083b858998e27c706725fb03a74aa14ef8d985dc18438b5188e4", - "https://deno.land/std@0.177.0/node/_next_tick.ts": "9a3cf107d59b019a355d3cf32275b4c6157282e4b68ea85b46a799cb1d379305", - "https://deno.land/std@0.177.0/node/_process/exiting.ts": "6e336180aaabd1192bf99ffeb0d14b689116a3dec1dfb34a2afbacd6766e98ab", - "https://deno.land/std@0.177.0/node/_process/process.ts": "c96bb1f6253824c372f4866ee006dcefda02b7050d46759736e403f862d91051", - "https://deno.land/std@0.177.0/node/_process/stdio.mjs": "cf17727eac8da3a665851df700b5aca6a12bacc3ebbf33e63e4b919f80ba44a6", - "https://deno.land/std@0.177.0/node/_stream.d.ts": "112e1a0677cd6db932c3ce0e6e5bbdc7a2ac1874572f449044ecc82afcf5ee2e", - "https://deno.land/std@0.177.0/node/_stream.mjs": "d6e2c86c1158ac65b4c2ca4fa019d7e84374ff12e21e2175345fe68c0823efe3", - "https://deno.land/std@0.177.0/node/_utils.ts": "7fd55872a0cf9275e3c080a60e2fa6d45b8de9e956ebcde9053e72a344185884", - "https://deno.land/std@0.177.0/node/buffer.ts": "85617be2063eccaf177dbb84c7580d1e32023724ed14bd9df4e453b152a26167", - "https://deno.land/std@0.177.0/node/crypto.ts": "2c94fa0f76e90190fbc34df891dc5c284bddb86c932fae8ac11747de3f75293c", - "https://deno.land/std@0.177.0/node/events.ts": "d2de352d509de11a375e2cb397d6b98f5fed4e562fc1d41be33214903a38e6b0", - "https://deno.land/std@0.177.0/node/internal/buffer.d.ts": "bdfa991cd88cb02fd08bf8235d2618550e3e511c970b2a8f2e1a6885a2793cac", - "https://deno.land/std@0.177.0/node/internal/buffer.mjs": "e92303a3cc6d9aaabcd270a937ad9319825d9ba08cb332650944df4562029b27", - "https://deno.land/std@0.177.0/node/internal/crypto/_keys.ts": "8f3c3b5a141aa0331a53c205e9338655f1b3b307a08085fd6ff6dda6f7c4190b", - "https://deno.land/std@0.177.0/node/internal/crypto/_randomBytes.ts": "36dd164747f73b830ba86562abb160a8ac5bea34aaeb816a67f3005a00d41177", - "https://deno.land/std@0.177.0/node/internal/crypto/_randomFill.ts": "297186f290eba87a1ad7b8aa42a960ff4278a8b6b0c963fa81918c326d5c0b58", - "https://deno.land/std@0.177.0/node/internal/crypto/_randomInt.ts": "6cf19da9684b67520e67a2d99f2581a3f841140842c7ce2e014d166457550fe1", - "https://deno.land/std@0.177.0/node/internal/crypto/certificate.ts": "b4a6695f82e70a42e85247c74a7691ed4b3a904646451af0287e49efe1a28814", - "https://deno.land/std@0.177.0/node/internal/crypto/cipher.ts": "2bae9b4d94c465e4d1c70e5a9e8fd67ce20bcc66fecd2eec6be00d35144ca4eb", - "https://deno.land/std@0.177.0/node/internal/crypto/constants.ts": "544d605703053218499b08214f2e25cf4310651d535b7ab995891c4b7a217693", - "https://deno.land/std@0.177.0/node/internal/crypto/diffiehellman.ts": "9cfb219c5b2936db773f559b6affe6d25b0e40531010389f05df3f05ce7eebf5", - "https://deno.land/std@0.177.0/node/internal/crypto/hash.ts": "d01f5d3ad5477655b432036d2d553c7a0c31a901ac0e1e9e0d8b3975daae7624", - "https://deno.land/std@0.177.0/node/internal/crypto/hkdf.ts": "5bd801234e56468fbd47466f46e88bdadc66432d625e3616abe38878d410bb66", - "https://deno.land/std@0.177.0/node/internal/crypto/keygen.ts": "530cc1a00acf71a43719bb876a2dc563b6196095d080eba77c92c9f39658a5b9", - "https://deno.land/std@0.177.0/node/internal/crypto/keys.ts": "c4dfa5aa3420cf700178b87203593a0989c8a93934bfef2b29adb3399d687958", - "https://deno.land/std@0.177.0/node/internal/crypto/pbkdf2.ts": "0a0a3e0d3d45db0638fe75a4199c7ed7ca2164405750a520e786e4adebdb45a4", - "https://deno.land/std@0.177.0/node/internal/crypto/random.ts": "85f3147e14cb45c18e016da45d319a5c663309411232a956fdc09c2317acdd9f", - "https://deno.land/std@0.177.0/node/internal/crypto/scrypt.ts": "b55a0fcd12b295af4127d05b1c0bc3098b74fc0e3c62321c2a43c20f9ed18209", - "https://deno.land/std@0.177.0/node/internal/crypto/sig.ts": "25819a89d49c1ebfe3baa1f9464501ec599a36cf53e9b600ec0399e568b9dccc", - "https://deno.land/std@0.177.0/node/internal/crypto/types.ts": "52feb182bcbd59206f3e2f4a3cb8a5775d4452c2a8045c3e613e2178d32c2a86", - "https://deno.land/std@0.177.0/node/internal/crypto/util.ts": "db282c0413aeee28bc0665fcfc1c08a65fc96dc12ed4d03282f2da4907fcf0ce", - "https://deno.land/std@0.177.0/node/internal/crypto/x509.ts": "0e8a541c4f58ecb83862c373d3f7d2371aa8f5108f55bc837b190c4ab3408764", - "https://deno.land/std@0.177.0/node/internal/error_codes.ts": "8495e33f448a484518d76fa3d41d34fc20fe03c14b30130ad8e936b0035d4b8b", - "https://deno.land/std@0.177.0/node/internal/errors.ts": "1c699b8a3cb93174f697a348c004b1c6d576b66688eac8a48ebb78e65c720aae", - "https://deno.land/std@0.177.0/node/internal/fixed_queue.ts": "62bb119afa5b5ae8fc0c7048b50502347bec82e2588017d0b250c4671d6eff8f", - "https://deno.land/std@0.177.0/node/internal/hide_stack_frames.ts": "9dd1bad0a6e62a1042ce3a51eb1b1ecee2f246907bff44835f86e8f021de679a", - "https://deno.land/std@0.177.0/node/internal/normalize_encoding.mjs": "fd1d9df61c44d7196432f6e8244621468715131d18cc79cd299fc78ac549f707", - "https://deno.land/std@0.177.0/node/internal/options.ts": "888f267c3fe8f18dc7b2f2fbdbe7e4a0fd3302ff3e99f5d6645601e924f3e3fb", - "https://deno.land/std@0.177.0/node/internal/primordials.mjs": "a72d86b5aa55d3d50b8e916b6a59b7cc0dc5a31da8937114b4a113ad5aa08c74", - "https://deno.land/std@0.177.0/node/internal/streams/destroy.mjs": "b665fc71178919a34ddeac8389d162a81b4bc693ff7dc2557fa41b3a91011967", - "https://deno.land/std@0.177.0/node/internal/streams/end-of-stream.mjs": "a4fb1c2e32d58dff440d4e716e2c4daaa403b3095304a028bb428575cfeed716", - "https://deno.land/std@0.177.0/node/internal/streams/utils.mjs": "f2fe2e6bdc506da24c758970890cc2a21642045b129dee618bd3827c60dd9e33", - "https://deno.land/std@0.177.0/node/internal/streams/writable.mjs": "775928726d0483ace8e45a35f30db2019a22dd7b9a81b67b158420e21cc692c5", - "https://deno.land/std@0.177.0/node/internal/util.mjs": "f7fe2e1ca5e66f550ad0856b9f5ee4d666f0c071fe212ea7fc7f37cfa81f97a5", - "https://deno.land/std@0.177.0/node/internal/util/inspect.mjs": "11d7c9cab514b8e485acc3978c74b837263ff9c08ae4537fa18ad56bae633259", - "https://deno.land/std@0.177.0/node/internal/util/types.ts": "0e587b44ec5e017cf228589fc5ce9983b75beece6c39409c34170cfad49d6417", - "https://deno.land/std@0.177.0/node/internal/validators.mjs": "e02f2b02dd072a5d623970292588d541204dc82207b4c58985d933a5f4b382e6", - "https://deno.land/std@0.177.0/node/internal_binding/_libuv_winerror.ts": "30c9569603d4b97a1f1a034d88a3f74800d5ea1f12fcc3d225c9899d4e1a518b", - "https://deno.land/std@0.177.0/node/internal_binding/_node.ts": "cb2389b0eab121df99853eb6a5e3a684e4537e065fb8bf2cca0cbf219ce4e32e", - "https://deno.land/std@0.177.0/node/internal_binding/_timingSafeEqual.ts": "7d9732464d3c669ff07713868ce5d25bc974a06112edbfb5f017fc3c70c0853e", - "https://deno.land/std@0.177.0/node/internal_binding/_utils.ts": "7c58a2fbb031a204dee9583ba211cf9c67922112fe77e7f0b3226112469e9fe1", - "https://deno.land/std@0.177.0/node/internal_binding/_winerror.ts": "3e8cfdfe22e89f13d2b28529bab35155e6b1730c0221ec5a6fc7077dc037be13", - "https://deno.land/std@0.177.0/node/internal_binding/buffer.ts": "31729e0537921d6c730ad0afea44a7e8a0a1044d070ade8368226cb6f7390c8b", - "https://deno.land/std@0.177.0/node/internal_binding/constants.ts": "21ff9d1ee71d0a2086541083a7711842fc6ae25e264dbf45c73815aadce06f4c", - "https://deno.land/std@0.177.0/node/internal_binding/crypto.ts": "29e8f94f283a2e7d4229d3551369c6a40c2af9737fad948cb9be56bef6c468cd", - "https://deno.land/std@0.177.0/node/internal_binding/node_options.ts": "0b5cb0bf4379a39278d7b7bb6bb2c2751baf428fe437abe5ed3e8441fae1f18b", - "https://deno.land/std@0.177.0/node/internal_binding/string_decoder.ts": "54c3c1cbd5a9254881be58bf22637965dc69535483014dab60487e299cb95445", - "https://deno.land/std@0.177.0/node/internal_binding/types.ts": "2187595a58d2cf0134f4db6cc2a12bf777f452f52b15b6c3aed73fa072aa5fc3", - "https://deno.land/std@0.177.0/node/internal_binding/util.ts": "808ff3b92740284184ab824adfc420e75398c88c8bccf5111f0c24ac18c48f10", - "https://deno.land/std@0.177.0/node/internal_binding/uv.ts": "eb0048e30af4db407fb3f95563e30d70efd6187051c033713b0a5b768593a3a3", - "https://deno.land/std@0.177.0/node/perf_hooks.ts": "c20e1f02f463e065e8f6c1d4fa97b0d3832dc0db5b5d8ea37f99a962ecf11f35", - "https://deno.land/std@0.177.0/node/stream.ts": "09e348302af40dcc7dc58aa5e40fdff868d11d8d6b0cfb85cbb9c75b9fe450c7", - "https://deno.land/std@0.177.0/node/string_decoder.ts": "1a17e3572037c512cc5fc4b29076613e90f225474362d18da908cb7e5ccb7e88" - } -} diff --git a/yjs-poll/node_modules/lib0/diff.d.ts b/yjs-poll/node_modules/lib0/diff.d.ts deleted file mode 100644 index 290daec..0000000 --- a/yjs-poll/node_modules/lib0/diff.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -export function simpleDiffString(a: string, b: string): SimpleDiff; -export function simpleDiff(a: string, b: string): SimpleDiff; -export function simpleDiffArray(a: Array, b: Array, compare?: (arg0: T, arg1: T) => boolean): SimpleDiff>; -export function simpleDiffStringWithCursor(a: string, b: string, cursor: number): { - index: number; - remove: number; - insert: string; -}; -/** - * A SimpleDiff describes a change on a String. - * - * ```js - * console.log(a) // the old value - * console.log(b) // the updated value - * // Apply changes of diff (pseudocode) - * a.remove(diff.index, diff.remove) // Remove `diff.remove` characters - * a.insert(diff.index, diff.insert) // Insert `diff.insert` - * a === b // values match - * ``` - */ -export type SimpleDiff> = { - /** - * The index where changes were applied - */ - index: number; - /** - * The number of characters to delete starting - * at `index`. - */ - remove: number; - /** - * The new text to insert at `index` after applying - */ - insert: T; -}; -//# sourceMappingURL=diff.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/diff.d.ts.map b/yjs-poll/node_modules/lib0/diff.d.ts.map deleted file mode 100644 index 5f32a1f..0000000 --- a/yjs-poll/node_modules/lib0/diff.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["diff.js"],"names":[],"mappings":"AAyCO,oCAJI,MAAM,KACN,MAAM,GACL,UAAU,CAAC,MAAM,CAAC,CAoB7B;AAlBM,8BAJI,MAAM,KACN,MAAM,GACL,UAAU,CAAC,MAAM,CAAC,CAoB7B;AAuBM,gCAPM,CAAC,KAEH,KAAK,CAAC,CAAC,CAAC,KACR,KAAK,CAAC,CAAC,CAAC,YACR,CAAS,IAAC,EAAD,CAAC,EAAE,IAAC,EAAD,CAAC,KAAE,OAAO,GACrB,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAgB/B;AASM,8CAJI,MAAM,KACN,MAAM,UACN,MAAM;;;;EAyChB;;;;;;;;;;;;;uBA5HgC,CAAC,SAApB,MAAM,GAAC,KAAK,CAAC,GAAG,CAAE;;;;;;;;;;;;;YAKlB,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/diff.js b/yjs-poll/node_modules/lib0/diff.js deleted file mode 100644 index ddfa903..0000000 --- a/yjs-poll/node_modules/lib0/diff.js +++ /dev/null @@ -1,145 +0,0 @@ -/** - * Efficient diffs. - * - * @module diff - */ - -import { equalityStrict } from './function.js' - -/** - * A SimpleDiff describes a change on a String. - * - * ```js - * console.log(a) // the old value - * console.log(b) // the updated value - * // Apply changes of diff (pseudocode) - * a.remove(diff.index, diff.remove) // Remove `diff.remove` characters - * a.insert(diff.index, diff.insert) // Insert `diff.insert` - * a === b // values match - * ``` - * - * @template {string|Array} T - * @typedef {Object} SimpleDiff - * @property {Number} index The index where changes were applied - * @property {Number} remove The number of characters to delete starting - * at `index`. - * @property {T} insert The new text to insert at `index` after applying - */ - -const highSurrogateRegex = /[\uD800-\uDBFF]/ -const lowSurrogateRegex = /[\uDC00-\uDFFF]/ - -/** - * Create a diff between two strings. This diff implementation is highly - * efficient, but not very sophisticated. - * - * @function - * - * @param {string} a The old version of the string - * @param {string} b The updated version of the string - * @return {SimpleDiff} The diff description. - */ -export const simpleDiffString = (a, b) => { - let left = 0 // number of same characters counting from left - let right = 0 // number of same characters counting from right - while (left < a.length && left < b.length && a[left] === b[left]) { - left++ - } - // If the last same character is a high surrogate, we need to rollback to the previous character - if (left > 0 && highSurrogateRegex.test(a[left - 1])) left-- - while (right + left < a.length && right + left < b.length && a[a.length - right - 1] === b[b.length - right - 1]) { - right++ - } - // If the last same character is a low surrogate, we need to rollback to the previous character - if (right > 0 && lowSurrogateRegex.test(a[a.length - right])) right-- - return { - index: left, - remove: a.length - left - right, - insert: b.slice(left, b.length - right) - } -} - -/** - * @todo Remove in favor of simpleDiffString - * @deprecated - */ -export const simpleDiff = simpleDiffString - -/** - * Create a diff between two arrays. This diff implementation is highly - * efficient, but not very sophisticated. - * - * Note: This is basically the same function as above. Another function was created so that the runtime - * can better optimize these function calls. - * - * @function - * @template T - * - * @param {Array} a The old version of the array - * @param {Array} b The updated version of the array - * @param {function(T, T):boolean} [compare] - * @return {SimpleDiff>} The diff description. - */ -export const simpleDiffArray = (a, b, compare = equalityStrict) => { - let left = 0 // number of same characters counting from left - let right = 0 // number of same characters counting from right - while (left < a.length && left < b.length && compare(a[left], b[left])) { - left++ - } - while (right + left < a.length && right + left < b.length && compare(a[a.length - right - 1], b[b.length - right - 1])) { - right++ - } - return { - index: left, - remove: a.length - left - right, - insert: b.slice(left, b.length - right) - } -} - -/** - * Diff text and try to diff at the current cursor position. - * - * @param {string} a - * @param {string} b - * @param {number} cursor This should refer to the current left cursor-range position - */ -export const simpleDiffStringWithCursor = (a, b, cursor) => { - let left = 0 // number of same characters counting from left - let right = 0 // number of same characters counting from right - // Iterate left to the right until we find a changed character - // First iteration considers the current cursor position - while ( - left < a.length && - left < b.length && - a[left] === b[left] && - left < cursor - ) { - left++ - } - // If the last same character is a high surrogate, we need to rollback to the previous character - if (left > 0 && highSurrogateRegex.test(a[left - 1])) left-- - // Iterate right to the left until we find a changed character - while ( - right + left < a.length && - right + left < b.length && - a[a.length - right - 1] === b[b.length - right - 1] - ) { - right++ - } - // If the last same character is a low surrogate, we need to rollback to the previous character - if (right > 0 && lowSurrogateRegex.test(a[a.length - right])) right-- - // Try to iterate left further to the right without caring about the current cursor position - while ( - right + left < a.length && - right + left < b.length && - a[left] === b[left] - ) { - left++ - } - if (left > 0 && highSurrogateRegex.test(a[left - 1])) left-- - return { - index: left, - remove: a.length - left - right, - insert: b.slice(left, b.length - right) - } -} diff --git a/yjs-poll/node_modules/lib0/diff.test.d.ts b/yjs-poll/node_modules/lib0/diff.test.d.ts deleted file mode 100644 index 5df670c..0000000 --- a/yjs-poll/node_modules/lib0/diff.test.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export function testDiffing(tc: t.TestCase): void; -export function testRepeatDiffing(tc: t.TestCase): void; -export function testSimpleDiffWithCursor(tc: t.TestCase): void; -export function testArrayDiffing(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=diff.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/diff.test.d.ts.map b/yjs-poll/node_modules/lib0/diff.test.d.ts.map deleted file mode 100644 index a0157b2..0000000 --- a/yjs-poll/node_modules/lib0/diff.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"diff.test.d.ts","sourceRoot":"","sources":["diff.test.js"],"names":[],"mappings":"AA0BO,gCAFI,CAAC,CAAC,QAAQ,QAmBpB;AAKM,sCAFI,CAAC,CAAC,QAAQ,QAQpB;AAKM,6CAFI,CAAC,CAAC,QAAQ,QA4CpB;AAKM,qCAFI,CAAC,CAAC,QAAQ,QAQpB;mBA7GkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/diff/patience.d.ts b/yjs-poll/node_modules/lib0/diff/patience.d.ts deleted file mode 100644 index bb84468..0000000 --- a/yjs-poll/node_modules/lib0/diff/patience.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -export function diff(as: Array, bs: Array): Array<{ - index: number; - remove: Array; - insert: Array; -}>; -export function diffSplitBy(a: string, b: string, _regexp: RegExp | string): { - index: number; - remove: string; - insert: string; -}[]; -export function diffAuto(a: string, b: string): { - insert: string; - remove: string; - index: number; -}[]; -//# sourceMappingURL=patience.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/diff/patience.d.ts.map b/yjs-poll/node_modules/lib0/diff/patience.d.ts.map deleted file mode 100644 index e2fe8b0..0000000 --- a/yjs-poll/node_modules/lib0/diff/patience.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"patience.d.ts","sourceRoot":"","sources":["patience.js"],"names":[],"mappings":"AAoBO,yBAJI,KAAK,CAAC,MAAM,CAAC,MACb,KAAK,CAAC,MAAM,CAAC,GACZ,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CAAC,CAAC,CAShF;AAOM,+BAJI,MAAM,KACN,MAAM,WACN,MAAM,GAAC,MAAM;;;;IAqBvB;AAWM,4BAHI,MAAM,KACN,MAAM;;;;IASP"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/diff/patience.js b/yjs-poll/node_modules/lib0/diff/patience.js deleted file mode 100644 index 40c1381..0000000 --- a/yjs-poll/node_modules/lib0/diff/patience.js +++ /dev/null @@ -1,226 +0,0 @@ -/** - * A very simple diff algorithm. Slightly adapted to support splitting at different stages (e.g. - * first diff lines, then diff words) - * - * https://bramcohen.livejournal.com/73318.html - * - * @experiemantal This API will likely change. - */ - -import * as map from '../map.js' -import * as math from '../math.js' -import * as array from '../array.js' - -/** - * Implementation of patience diff. Expects that content is pre-split (e.g. by newline). - * - * @param {Array} as - * @param {Array} bs - * @return {Array<{ index: number, remove: Array, insert: Array}>} changeset @todo should use delta instead - */ -export const diff = (as, bs) => { - const { - middleAs, - middleBs, - commonPrefix - } = removeCommonPrefixAndSuffix(as, bs) - return lcs(middleAs, middleBs, commonPrefix) -} - -/** - * @param {string} a - * @param {string} b - * @param {RegExp|string} _regexp - */ -export const diffSplitBy = (a, b, _regexp) => { - const isStringSeparator = typeof _regexp === 'string' - const separator = isStringSeparator ? _regexp : '' - const regexp = isStringSeparator ? new RegExp(_regexp, 'g') : _regexp - const as = splitByRegexp(a, regexp, !isStringSeparator) - const bs = splitByRegexp(b, regexp, !isStringSeparator) - const changes = diff(as, bs) - let prevSplitIndex = 0 - let prevStringIndex = 0 - return changes.map(change => { - for (; prevSplitIndex < change.index; prevSplitIndex++) { - prevStringIndex += as[prevSplitIndex].length - } - return { - index: prevStringIndex, - remove: change.remove.join(separator), - insert: change.insert.join(separator) - } - }) -} - -/** - * Sensible default for diffing strings using patience (it's fast though). - * - * Perform different types of patience diff on the content. Diff first by newline, then paragraphs, then by word - * (split by space, brackets, punctuation) - * - * @param {string} a - * @param {string} b - */ -export const diffAuto = (a, b) => - diffSplitBy(a, b, '\n').map(d => - diffSplitBy(d.remove, d.insert, /\. |[a-zA-Z0-9]+|[. ()[\],;{}]/g).map(dd => ({ - insert: dd.insert, - remove: dd.remove, - index: dd.index + d.index - })) - ).flat() - -/** - * @param {Array} as - * @param {Array} bs - */ -const removeCommonPrefixAndSuffix = (as, bs) => { - const commonLen = math.min(as.length, bs.length) - let commonPrefix = 0 - let commonSuffix = 0 - // match start - for (; commonPrefix < commonLen && as[commonPrefix] === bs[commonPrefix]; commonPrefix++) { /* nop */ } - // match end - for (; commonSuffix < commonLen - commonPrefix && as[as.length - 1 - commonSuffix] === bs[bs.length - 1 - commonSuffix]; commonSuffix++) { /* nop */ } - const middleAs = as.slice(commonPrefix, as.length - commonSuffix) - const middleBs = bs.slice(commonPrefix, bs.length - commonSuffix) - return { - middleAs, middleBs, commonPrefix, commonSuffix - } -} - -/** - * Splits string by regex and returns all strings as an array. The matched parts are also returned. - * - * @param {string} str - * @param {RegExp} regexp - * @param {boolean} includeSeparator - */ -const splitByRegexp = (str, regexp, includeSeparator) => { - const matches = [...str.matchAll(regexp)] - let prevIndex = 0 - /** - * @type {Array} - */ - const res = [] - matches.forEach(m => { - prevIndex < (m.index || 0) && res.push(str.slice(prevIndex, m.index)) - includeSeparator && res.push(m[0]) // is always non-empty - prevIndex = /** @type {number} */ (m.index) + m[0].length - }) - const end = str.slice(prevIndex) - end.length > 0 && res.push(end) - return res -} - -/** - * An item may have multiple occurances (not when matching unique entries). It also may have a - * reference to the stack of other items (from as to bs). - */ -class Item { - constructor () { - /** - * @type {Array} - */ - this.indexes = [] - /** - * The matching item from the other side - * @type {Item?} - */ - this.match = null - /** - * For patience sort. Reference (index of the stack) to the previous pile. - * - * @type {Item?} - */ - this.ref = null - } -} - -/** - * @param {Array} xs - */ -const partition = xs => { - /** - * @type {Map} - */ - const refs = map.create() - xs.forEach((x, index) => { - map.setIfUndefined(refs, x, () => new Item()).indexes.push(index) - }) - return refs -} - -/** - * Find the longest common subsequence of items using patience sort. - * - * @param {Array} as - * @param {Array} bs - * @param {number} indexAdjust - */ -const lcs = (as, bs, indexAdjust) => { - if (as.length === 0 && bs.length === 0) return [] - const aParts = partition(as) - const bParts = partition(bs) - /** - * @type {Array>} I.e. Array> - */ - const piles = [] - aParts.forEach((aItem, aKey) => { - // skip if no match or if either item is not unique - if (aItem.indexes.length > 1 || (aItem.match = bParts.get(aKey) || null) == null || aItem.match.indexes.length > 1) return - for (let i = 0; i < piles.length; i++) { - const pile = piles[i] - if (aItem.match.indexes[0] < /** @type {Item} */ (pile[pile.length - 1].match).indexes[0]) { - pile.push(aItem) - if (i > 0) aItem.ref = array.last(piles[i - 1]) - return - } - } - piles.length > 0 && (aItem.ref = array.last(piles[piles.length - 1])) - piles.push([aItem]) - }) - /** - * References to all matched items - * - * @type {Array} - */ - const matches = [] - /** - * @type {Item?} - */ - let currPileItem = piles[piles.length - 1]?.[0] - while (currPileItem != null) { - matches.push(currPileItem) - currPileItem = currPileItem.ref - } - matches.reverse() - // add pseude match (assume the string terminal always matches) - const pseudoA = new Item() - const pseudoB = new Item() - pseudoA.match = pseudoB - pseudoA.indexes.push(as.length) - pseudoB.indexes.push(bs.length) - matches.push(pseudoA) - /** - * @type {Array<{ index: number, remove: Array, insert: Array}>} - */ - const changeset = [] - let diffAStart = 0 - let diffBStart = 0 - for (let i = 0; i < matches.length; i++) { - const m = matches[i] - const delLength = m.indexes[0] - diffAStart - const insLength = /** @type {Item} */ (m.match).indexes[0] - diffBStart - if (delLength !== 0 || insLength !== 0) { - const stripped = removeCommonPrefixAndSuffix(as.slice(diffAStart, diffAStart + delLength), bs.slice(diffBStart, diffBStart + insLength)) - if (stripped.middleAs.length !== 0 || stripped.middleBs.length !== 0) { - changeset.push({ index: diffAStart + indexAdjust + stripped.commonPrefix, remove: stripped.middleAs, insert: stripped.middleBs }) - } - } - diffAStart = m.indexes[0] + 1 - diffBStart = /** @type {Item} */ (m.match).indexes[0] + 1 - } - return changeset -} diff --git a/yjs-poll/node_modules/lib0/diff/patience.test.d.ts b/yjs-poll/node_modules/lib0/diff/patience.test.d.ts deleted file mode 100644 index 7633a91..0000000 --- a/yjs-poll/node_modules/lib0/diff/patience.test.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function testDiffing(_tc: t.TestCase): void; -export function testRepeatRandomWordReplace(tc: t.TestCase): void; -import * as t from '../testing.js'; -//# sourceMappingURL=patience.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/diff/patience.test.d.ts.map b/yjs-poll/node_modules/lib0/diff/patience.test.d.ts.map deleted file mode 100644 index d836cc4..0000000 --- a/yjs-poll/node_modules/lib0/diff/patience.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"patience.test.d.ts","sourceRoot":"","sources":["patience.test.js"],"names":[],"mappings":"AAmBO,iCAFI,CAAC,CAAC,QAAQ,QAwGpB;AAKM,gDAFI,CAAC,CAAC,QAAQ,QAgDpB;mBA3KkB,eAAe"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/aes-gcm.cjs b/yjs-poll/node_modules/lib0/dist/aes-gcm.cjs deleted file mode 100644 index fac8f5d..0000000 --- a/yjs-poll/node_modules/lib0/dist/aes-gcm.cjs +++ /dev/null @@ -1,171 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var encoding = require('./encoding-1a745c43.cjs'); -var decoding = require('./decoding-76e75827.cjs'); -var webcrypto = require('lib0/webcrypto'); -var string = require('./string-fddc5f8b.cjs'); -var common = require('./common.cjs'); -require('./math-96d5e8c4.cjs'); -require('./number-1fb57bba.cjs'); -require('./binary-ac8e39e2.cjs'); -require('./array-78849c95.cjs'); -require('./set-5b47859e.cjs'); -require('./error-0c1f634f.cjs'); - -function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n["default"] = e; - return Object.freeze(n); -} - -var webcrypto__namespace = /*#__PURE__*/_interopNamespace(webcrypto); - -/** - * AES-GCM is a symmetric key for encryption - */ - -/** - * @typedef {Array<'encrypt'|'decrypt'>} Usages - */ - -/** - * @type {Usages} - */ -const defaultUsages = ['encrypt', 'decrypt']; - -/** - * @param {CryptoKey} key - * @param {Uint8Array} data - */ -const encrypt = (key, data) => { - const iv = webcrypto__namespace.getRandomValues(new Uint8Array(16)); // 92bit is enough. 128bit is recommended if space is not an issue. - return webcrypto__namespace.subtle.encrypt( - { - name: 'AES-GCM', - iv - }, - key, - data - ).then(cipher => { - const encryptedDataEncoder = encoding.createEncoder(); - // iv may be sent in the clear to the other peers - encoding.writeUint8Array(encryptedDataEncoder, iv); - encoding.writeVarUint8Array(encryptedDataEncoder, new Uint8Array(cipher)); - return encoding.toUint8Array(encryptedDataEncoder) - }) -}; - -/** - * @experimental The API is not final! - * - * Decrypt some data using AES-GCM method. - * - * @param {CryptoKey} key - * @param {Uint8Array} data - * @return {PromiseLike} decrypted buffer - */ -const decrypt = (key, data) => { - const dataDecoder = decoding.createDecoder(data); - const iv = decoding.readUint8Array(dataDecoder, 16); - const cipher = decoding.readVarUint8Array(dataDecoder); - return webcrypto__namespace.subtle.decrypt( - { - name: 'AES-GCM', - iv - }, - key, - cipher - ).then(data => new Uint8Array(data)) -}; - -const aesAlgDef = { - name: 'AES-GCM', - length: 256 -}; - -/** - * @param {any} jwk - * @param {Object} opts - * @param {Usages} [opts.usages] - * @param {boolean} [opts.extractable] - */ -const importKeyJwk = (jwk, { usages, extractable = false } = {}) => { - if (usages == null) { - /* c8 ignore next */ - usages = jwk.key_ops || defaultUsages; - } - return webcrypto__namespace.subtle.importKey('jwk', jwk, 'AES-GCM', extractable, /** @type {Usages} */ (usages)) -}; - -/** - * Only suited for importing public keys. - * - * @param {Uint8Array} raw - * @param {Object} opts - * @param {Usages} [opts.usages] - * @param {boolean} [opts.extractable] - */ -const importKeyRaw = (raw, { usages = defaultUsages, extractable = false } = {}) => - webcrypto__namespace.subtle.importKey('raw', raw, aesAlgDef, extractable, /** @type {Usages} */ (usages)); - -/** - * @param {Uint8Array | string} data - */ -/* c8 ignore next */ -const toBinary = data => typeof data === 'string' ? string.encodeUtf8(data) : data; - -/** - * @experimental The API is not final! - * - * Derive an symmetric key using the Password-Based-Key-Derivation-Function-2. - * - * @param {Uint8Array|string} secret - * @param {Uint8Array|string} salt - * @param {Object} opts - * @param {boolean} [opts.extractable] - * @param {Usages} [opts.usages] - */ -const deriveKey = (secret, salt, { extractable = false, usages = defaultUsages } = {}) => - webcrypto__namespace.subtle.importKey( - 'raw', - toBinary(secret), - 'PBKDF2', - false, - ['deriveKey'] - ).then(keyMaterial => - webcrypto__namespace.subtle.deriveKey( - { - name: 'PBKDF2', - salt: toBinary(salt), // NIST recommends at least 64 bits - iterations: 600000, // OWASP recommends 600k iterations - hash: 'SHA-256' - }, - keyMaterial, - aesAlgDef, - extractable, - usages - ) - ); - -exports.exportKeyJwk = common.exportKeyJwk; -exports.exportKeyRaw = common.exportKeyRaw; -exports.decrypt = decrypt; -exports.deriveKey = deriveKey; -exports.encrypt = encrypt; -exports.importKeyJwk = importKeyJwk; -exports.importKeyRaw = importKeyRaw; -//# sourceMappingURL=aes-gcm.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/aes-gcm.cjs.map b/yjs-poll/node_modules/lib0/dist/aes-gcm.cjs.map deleted file mode 100644 index 2e86cf8..0000000 --- a/yjs-poll/node_modules/lib0/dist/aes-gcm.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"aes-gcm.cjs","sources":["../crypto/aes-gcm.js"],"sourcesContent":["/**\n * AES-GCM is a symmetric key for encryption\n */\n\nimport * as encoding from '../encoding.js'\nimport * as decoding from '../decoding.js'\nimport * as webcrypto from 'lib0/webcrypto'\nimport * as string from '../string.js'\nexport { exportKeyJwk, exportKeyRaw } from './common.js'\n\n/**\n * @typedef {Array<'encrypt'|'decrypt'>} Usages\n */\n\n/**\n * @type {Usages}\n */\nconst defaultUsages = ['encrypt', 'decrypt']\n\n/**\n * @param {CryptoKey} key\n * @param {Uint8Array} data\n */\nexport const encrypt = (key, data) => {\n const iv = webcrypto.getRandomValues(new Uint8Array(16)) // 92bit is enough. 128bit is recommended if space is not an issue.\n return webcrypto.subtle.encrypt(\n {\n name: 'AES-GCM',\n iv\n },\n key,\n data\n ).then(cipher => {\n const encryptedDataEncoder = encoding.createEncoder()\n // iv may be sent in the clear to the other peers\n encoding.writeUint8Array(encryptedDataEncoder, iv)\n encoding.writeVarUint8Array(encryptedDataEncoder, new Uint8Array(cipher))\n return encoding.toUint8Array(encryptedDataEncoder)\n })\n}\n\n/**\n * @experimental The API is not final!\n *\n * Decrypt some data using AES-GCM method.\n *\n * @param {CryptoKey} key\n * @param {Uint8Array} data\n * @return {PromiseLike} decrypted buffer\n */\nexport const decrypt = (key, data) => {\n const dataDecoder = decoding.createDecoder(data)\n const iv = decoding.readUint8Array(dataDecoder, 16)\n const cipher = decoding.readVarUint8Array(dataDecoder)\n return webcrypto.subtle.decrypt(\n {\n name: 'AES-GCM',\n iv\n },\n key,\n cipher\n ).then(data => new Uint8Array(data))\n}\n\nconst aesAlgDef = {\n name: 'AES-GCM',\n length: 256\n}\n\n/**\n * @param {any} jwk\n * @param {Object} opts\n * @param {Usages} [opts.usages]\n * @param {boolean} [opts.extractable]\n */\nexport const importKeyJwk = (jwk, { usages, extractable = false } = {}) => {\n if (usages == null) {\n /* c8 ignore next */\n usages = jwk.key_ops || defaultUsages\n }\n return webcrypto.subtle.importKey('jwk', jwk, 'AES-GCM', extractable, /** @type {Usages} */ (usages))\n}\n\n/**\n * Only suited for importing public keys.\n *\n * @param {Uint8Array} raw\n * @param {Object} opts\n * @param {Usages} [opts.usages]\n * @param {boolean} [opts.extractable]\n */\nexport const importKeyRaw = (raw, { usages = defaultUsages, extractable = false } = {}) =>\n webcrypto.subtle.importKey('raw', raw, aesAlgDef, extractable, /** @type {Usages} */ (usages))\n\n/**\n * @param {Uint8Array | string} data\n */\n/* c8 ignore next */\nconst toBinary = data => typeof data === 'string' ? string.encodeUtf8(data) : data\n\n/**\n * @experimental The API is not final!\n *\n * Derive an symmetric key using the Password-Based-Key-Derivation-Function-2.\n *\n * @param {Uint8Array|string} secret\n * @param {Uint8Array|string} salt\n * @param {Object} opts\n * @param {boolean} [opts.extractable]\n * @param {Usages} [opts.usages]\n */\nexport const deriveKey = (secret, salt, { extractable = false, usages = defaultUsages } = {}) =>\n webcrypto.subtle.importKey(\n 'raw',\n toBinary(secret),\n 'PBKDF2',\n false,\n ['deriveKey']\n ).then(keyMaterial =>\n webcrypto.subtle.deriveKey(\n {\n name: 'PBKDF2',\n salt: toBinary(salt), // NIST recommends at least 64 bits\n iterations: 600000, // OWASP recommends 600k iterations\n hash: 'SHA-256'\n },\n keyMaterial,\n aesAlgDef,\n extractable,\n usages\n )\n )\n"],"names":["webcrypto","encoding.createEncoder","encoding.writeUint8Array","encoding.writeVarUint8Array","encoding.toUint8Array","decoding.createDecoder","decoding.readUint8Array","decoding.readVarUint8Array","string.encodeUtf8"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA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CAAC,IAAI,CAAC,WAAW;AACpB,IAAIA,oBAAS,CAAC,MAAM,CAAC,SAAS;AAC9B,MAAM;AACN,QAAQ,IAAI,EAAE,QAAQ;AACtB,QAAQ,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;AAC5B,QAAQ,UAAU,EAAE,MAAM;AAC1B,QAAQ,IAAI,EAAE,SAAS;AACvB,OAAO;AACP,MAAM,WAAW;AACjB,MAAM,SAAS;AACf,MAAM,WAAW;AACjB,MAAM,MAAM;AACZ,KAAK;AACL;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/array-78849c95.cjs b/yjs-poll/node_modules/lib0/dist/array-78849c95.cjs deleted file mode 100644 index fca0aff..0000000 --- a/yjs-poll/node_modules/lib0/dist/array-78849c95.cjs +++ /dev/null @@ -1,260 +0,0 @@ -'use strict'; - -var set = require('./set-5b47859e.cjs'); - -/** - * Utility module to work with Arrays. - * - * @module array - */ - -/** - * Return the last element of an array. The element must exist - * - * @template L - * @param {ArrayLike} arr - * @return {L} - */ -const last = arr => arr[arr.length - 1]; - -/** - * @template C - * @return {Array} - */ -const create = () => /** @type {Array} */ ([]); - -/** - * @template D - * @param {Array} a - * @return {Array} - */ -const copy = a => /** @type {Array} */ (a.slice()); - -/** - * Append elements from src to dest - * - * @template M - * @param {Array} dest - * @param {Array} src - */ -const appendTo = (dest, src) => { - for (let i = 0; i < src.length; i++) { - dest.push(src[i]); - } -}; - -/** - * Transforms something array-like to an actual Array. - * - * @function - * @template T - * @param {ArrayLike|Iterable} arraylike - * @return {T} - */ -const from = Array.from; - -/** - * True iff condition holds on every element in the Array. - * - * @function - * @template {ArrayLike} ARR - * - * @param {ARR} arr - * @param {ARR extends ArrayLike ? ((value:S, index:number, arr:ARR) => boolean) : any} f - * @return {boolean} - */ -const every = (arr, f) => { - for (let i = 0; i < arr.length; i++) { - if (!f(arr[i], i, arr)) { - return false - } - } - return true -}; - -/** - * True iff condition holds on some element in the Array. - * - * @function - * @template {ArrayLike} ARR - * - * @param {ARR} arr - * @param {ARR extends ArrayLike ? ((value:S, index:number, arr:ARR) => boolean) : never} f - * @return {boolean} - */ -const some = (arr, f) => { - for (let i = 0; i < arr.length; i++) { - if (f(arr[i], i, arr)) { - return true - } - } - return false -}; - -/** - * @template ELEM - * - * @param {ArrayLike} a - * @param {ArrayLike} b - * @return {boolean} - */ -const equalFlat = (a, b) => a.length === b.length && every(a, (item, index) => item === b[index]); - -/** - * @template ELEM - * @param {Array>} arr - * @return {Array} - */ -const flatten = arr => fold(arr, /** @type {Array} */ ([]), (acc, val) => acc.concat(val)); - -/** - * @template T - * @param {number} len - * @param {function(number, Array):T} f - * @return {Array} - */ -const unfold = (len, f) => { - const array = new Array(len); - for (let i = 0; i < len; i++) { - array[i] = f(i, array); - } - return array -}; - -/** - * @template T - * @template RESULT - * @param {Array} arr - * @param {RESULT} seed - * @param {function(RESULT, T, number):RESULT} folder - */ -const fold = (arr, seed, folder) => arr.reduce(folder, seed); - -const isArray = Array.isArray; - -/** - * @template T - * @param {Array} arr - * @return {Array} - */ -const unique = arr => from(set.from(arr)); - -/** - * @template T - * @template M - * @param {ArrayLike} arr - * @param {function(T):M} mapper - * @return {Array} - */ -const uniqueBy = (arr, mapper) => { - /** - * @type {Set} - */ - const happened = set.create(); - /** - * @type {Array} - */ - const result = []; - for (let i = 0; i < arr.length; i++) { - const el = arr[i]; - const mapped = mapper(el); - if (!happened.has(mapped)) { - happened.add(mapped); - result.push(el); - } - } - return result -}; - -/** - * @template {ArrayLike} ARR - * @template {function(ARR extends ArrayLike ? T : never, number, ARR):any} MAPPER - * @param {ARR} arr - * @param {MAPPER} mapper - * @return {Array} - */ -const map = (arr, mapper) => { - /** - * @type {Array} - */ - const res = Array(arr.length); - for (let i = 0; i < arr.length; i++) { - res[i] = mapper(/** @type {any} */ (arr[i]), i, /** @type {any} */ (arr)); - } - return /** @type {any} */ (res) -}; - -/** - * This function bubble-sorts a single item to the correct position. The sort happens in-place and - * might be useful to ensure that a single item is at the correct position in an otherwise sorted - * array. - * - * @example - * const arr = [3, 2, 5] - * arr.sort((a, b) => a - b) - * arr // => [2, 3, 5] - * arr.splice(1, 0, 7) - * array.bubbleSortItem(arr, 1, (a, b) => a - b) - * arr // => [2, 3, 5, 7] - * - * @template T - * @param {Array} arr - * @param {number} i - * @param {(a:T,b:T) => number} compareFn - */ -const bubblesortItem = (arr, i, compareFn) => { - const n = arr[i]; - let j = i; - // try to sort to the right - while (j + 1 < arr.length && compareFn(n, arr[j + 1]) > 0) { - arr[j] = arr[j + 1]; - arr[++j] = n; - } - if (i === j && j > 0) { // no change yet - // sort to the left - while (j > 0 && compareFn(arr[j - 1], n) > 0) { - arr[j] = arr[j - 1]; - arr[--j] = n; - } - } - return j -}; - -var array = /*#__PURE__*/Object.freeze({ - __proto__: null, - last: last, - create: create, - copy: copy, - appendTo: appendTo, - from: from, - every: every, - some: some, - equalFlat: equalFlat, - flatten: flatten, - unfold: unfold, - fold: fold, - isArray: isArray, - unique: unique, - uniqueBy: uniqueBy, - map: map, - bubblesortItem: bubblesortItem -}); - -exports.appendTo = appendTo; -exports.array = array; -exports.bubblesortItem = bubblesortItem; -exports.copy = copy; -exports.create = create; -exports.equalFlat = equalFlat; -exports.every = every; -exports.flatten = flatten; -exports.fold = fold; -exports.from = from; -exports.isArray = isArray; -exports.last = last; -exports.map = map; -exports.some = some; -exports.unfold = unfold; -exports.unique = unique; -exports.uniqueBy = uniqueBy; -//# sourceMappingURL=array-78849c95.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/array-78849c95.cjs.map b/yjs-poll/node_modules/lib0/dist/array-78849c95.cjs.map deleted file mode 100644 index 6a353b3..0000000 --- a/yjs-poll/node_modules/lib0/dist/array-78849c95.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"array-78849c95.cjs","sources":["../array.js"],"sourcesContent":["/**\n * Utility module to work with Arrays.\n *\n * @module array\n */\n\nimport * as set from './set.js'\n\n/**\n * Return the last element of an array. The element must exist\n *\n * @template L\n * @param {ArrayLike} arr\n * @return {L}\n */\nexport const last = arr => arr[arr.length - 1]\n\n/**\n * @template C\n * @return {Array}\n */\nexport const create = () => /** @type {Array} */ ([])\n\n/**\n * @template D\n * @param {Array} a\n * @return {Array}\n */\nexport const copy = a => /** @type {Array} */ (a.slice())\n\n/**\n * Append elements from src to dest\n *\n * @template M\n * @param {Array} dest\n * @param {Array} src\n */\nexport const appendTo = (dest, src) => {\n for (let i = 0; i < src.length; i++) {\n dest.push(src[i])\n }\n}\n\n/**\n * Transforms something array-like to an actual Array.\n *\n * @function\n * @template T\n * @param {ArrayLike|Iterable} arraylike\n * @return {T}\n */\nexport const from = Array.from\n\n/**\n * True iff condition holds on every element in the Array.\n *\n * @function\n * @template {ArrayLike} ARR\n *\n * @param {ARR} arr\n * @param {ARR extends ArrayLike ? ((value:S, index:number, arr:ARR) => boolean) : any} f\n * @return {boolean}\n */\nexport const every = (arr, f) => {\n for (let i = 0; i < arr.length; i++) {\n if (!f(arr[i], i, arr)) {\n return false\n }\n }\n return true\n}\n\n/**\n * True iff condition holds on some element in the Array.\n *\n * @function\n * @template {ArrayLike} ARR\n *\n * @param {ARR} arr\n * @param {ARR extends ArrayLike ? ((value:S, index:number, arr:ARR) => boolean) : never} f\n * @return {boolean}\n */\nexport const some = (arr, f) => {\n for (let i = 0; i < arr.length; i++) {\n if (f(arr[i], i, arr)) {\n return true\n }\n }\n return false\n}\n\n/**\n * @template ELEM\n *\n * @param {ArrayLike} a\n * @param {ArrayLike} b\n * @return {boolean}\n */\nexport const equalFlat = (a, b) => a.length === b.length && every(a, (item, index) => item === b[index])\n\n/**\n * @template ELEM\n * @param {Array>} arr\n * @return {Array}\n */\nexport const flatten = arr => fold(arr, /** @type {Array} */ ([]), (acc, val) => acc.concat(val))\n\n/**\n * @template T\n * @param {number} len\n * @param {function(number, Array):T} f\n * @return {Array}\n */\nexport const unfold = (len, f) => {\n const array = new Array(len)\n for (let i = 0; i < len; i++) {\n array[i] = f(i, array)\n }\n return array\n}\n\n/**\n * @template T\n * @template RESULT\n * @param {Array} arr\n * @param {RESULT} seed\n * @param {function(RESULT, T, number):RESULT} folder\n */\nexport const fold = (arr, seed, folder) => arr.reduce(folder, seed)\n\nexport const isArray = Array.isArray\n\n/**\n * @template T\n * @param {Array} arr\n * @return {Array}\n */\nexport const unique = arr => from(set.from(arr))\n\n/**\n * @template T\n * @template M\n * @param {ArrayLike} arr\n * @param {function(T):M} mapper\n * @return {Array}\n */\nexport const uniqueBy = (arr, mapper) => {\n /**\n * @type {Set}\n */\n const happened = set.create()\n /**\n * @type {Array}\n */\n const result = []\n for (let i = 0; i < arr.length; i++) {\n const el = arr[i]\n const mapped = mapper(el)\n if (!happened.has(mapped)) {\n happened.add(mapped)\n result.push(el)\n }\n }\n return result\n}\n\n/**\n * @template {ArrayLike} ARR\n * @template {function(ARR extends ArrayLike ? T : never, number, ARR):any} MAPPER\n * @param {ARR} arr\n * @param {MAPPER} mapper\n * @return {Array}\n */\nexport const map = (arr, mapper) => {\n /**\n * @type {Array}\n */\n const res = Array(arr.length)\n for (let i = 0; i < arr.length; i++) {\n res[i] = mapper(/** @type {any} */ (arr[i]), i, /** @type {any} */ (arr))\n }\n return /** @type {any} */ (res)\n}\n\n/**\n * This function bubble-sorts a single item to the correct position. The sort happens in-place and\n * might be useful to ensure that a single item is at the correct position in an otherwise sorted\n * array.\n *\n * @example\n * const arr = [3, 2, 5]\n * arr.sort((a, b) => a - b)\n * arr // => [2, 3, 5]\n * arr.splice(1, 0, 7)\n * array.bubbleSortItem(arr, 1, (a, b) => a - b)\n * arr // => [2, 3, 5, 7]\n *\n * @template T\n * @param {Array} arr\n * @param {number} i\n * @param {(a:T,b:T) => number} compareFn\n */\nexport const bubblesortItem = (arr, i, compareFn) => {\n const n = arr[i]\n let j = i\n // try to sort to the right\n while (j + 1 < arr.length && compareFn(n, arr[j + 1]) > 0) {\n arr[j] = arr[j + 1]\n arr[++j] = n\n }\n if (i === j && j > 0) { // no change yet\n // sort to the left\n while (j > 0 && compareFn(arr[j - 1], n) > 0) {\n arr[j] = arr[j - 1]\n arr[--j] = n\n }\n }\n return j\n}\n"],"names":["set.from","set.create"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,IAAI,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAC;AAC9C;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,+BAA+B,EAAE,EAAC;AACxD;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,IAAI,GAAG,CAAC,6BAA6B,CAAC,CAAC,KAAK,EAAE,EAAC;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,QAAQ,GAAG,CAAC,IAAI,EAAE,GAAG,KAAK;AACvC,EAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACvC,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAC;AACrB,GAAG;AACH,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,IAAI,GAAG,KAAK,CAAC,KAAI;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,KAAK,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK;AACjC,EAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACvC,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE;AAC5B,MAAM,OAAO,KAAK;AAClB,KAAK;AACL,GAAG;AACH,EAAE,OAAO,IAAI;AACb,EAAC;AACD;AACA;AACA;AACA;A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,GAAE;AAC7E,GAAG;AACH,EAAE,2BAA2B,GAAG,CAAC;AACjC,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,SAAS,KAAK;AACrD,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,EAAC;AAClB,EAAE,IAAI,CAAC,GAAG,EAAC;AACX;AACA,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,IAAI,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;AAC7D,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,EAAC;AACvB,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,EAAC;AAChB,GAAG;AACH,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;AACxB;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE;AAClD,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,EAAC;AACzB,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,EAAC;AAClB,KAAK;AACL,GAAG;AACH,EAAE,OAAO,CAAC;AACV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/array.cjs b/yjs-poll/node_modules/lib0/dist/array.cjs deleted file mode 100644 index e0f3417..0000000 --- a/yjs-poll/node_modules/lib0/dist/array.cjs +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./set-5b47859e.cjs'); -var array = require('./array-78849c95.cjs'); - - - -exports.appendTo = array.appendTo; -exports.bubblesortItem = array.bubblesortItem; -exports.copy = array.copy; -exports.create = array.create; -exports.equalFlat = array.equalFlat; -exports.every = array.every; -exports.flatten = array.flatten; -exports.fold = array.fold; -exports.from = array.from; -exports.isArray = array.isArray; -exports.last = array.last; -exports.map = array.map; -exports.some = array.some; -exports.unfold = array.unfold; -exports.unique = array.unique; -exports.uniqueBy = array.uniqueBy; -//# sourceMappingURL=array.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/array.cjs.map b/yjs-poll/node_modules/lib0/dist/array.cjs.map deleted file mode 100644 index 0a2fe5f..0000000 --- a/yjs-poll/node_modules/lib0/dist/array.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"array.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/array.d.ts b/yjs-poll/node_modules/lib0/dist/array.d.ts deleted file mode 100644 index 4b2730c..0000000 --- a/yjs-poll/node_modules/lib0/dist/array.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -export function last(arr: ArrayLike): L; -export function create(): Array; -export function copy(a: Array): Array; -export function appendTo(dest: Array, src: Array): void; -/** - * Transforms something array-like to an actual Array. - * - * @function - * @template T - * @param {ArrayLike|Iterable} arraylike - * @return {T} - */ -export const from: { - (arrayLike: ArrayLike): T_1[]; - (arrayLike: ArrayLike, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[]; - (iterable: Iterable | ArrayLike): T_1[]; - (iterable: Iterable | ArrayLike, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[]; -}; -export function every>(arr: ARR, f: ARR extends ArrayLike ? ((value: S, index: number, arr: ARR) => boolean) : any): boolean; -export function some>(arr: ARR, f: ARR extends ArrayLike ? ((value: S, index: number, arr: ARR) => boolean) : never): boolean; -export function equalFlat(a: ArrayLike, b: ArrayLike): boolean; -export function flatten(arr: Array>): Array; -export function unfold(len: number, f: (arg0: number, arg1: Array) => T_1): Array; -export function fold(arr: Array, seed: RESULT, folder: (arg0: RESULT, arg1: T_1, arg2: number) => RESULT): RESULT; -export const isArray: (arg: any) => arg is any[]; -export function unique(arr: Array): Array; -export function uniqueBy(arr: ArrayLike, mapper: (arg0: T_1) => M): Array; -export function map, MAPPER extends (arg0: ARR extends ArrayLike ? T_1 : never, arg1: number, arg2: ARR) => any>(arr: ARR, mapper: MAPPER): Array infer M ? M : never>; -export function bubblesortItem(arr: Array, i: number, compareFn: (a: T_1, b: T_1) => number): number; -//# sourceMappingURL=array.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/array.d.ts.map b/yjs-poll/node_modules/lib0/dist/array.d.ts.map deleted file mode 100644 index 37490fc..0000000 --- a/yjs-poll/node_modules/lib0/dist/array.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../array.js"],"names":[],"mappings":"AAeO,qBAJM,CAAC,OACH,SAAS,CAAC,CAAC,CAAC,GACX,CAAC,CAEiC;AAMvC,uBAHM,CAAC,KACF,KAAK,CAAC,CAAC,CAAC,CAEoC;AAOjD,qBAJM,CAAC,KACH,KAAK,CAAC,CAAC,CAAC,GACP,KAAK,CAAC,CAAC,CAAC,CAEwC;AASrD,yBAJM,CAAC,QACH,KAAK,CAAC,CAAC,CAAC,OACR,KAAK,CAAC,CAAC,CAAC,QAMlB;AAED;;;;;;;GAOG;AACH;;;;;EAA8B;AAYvB,sBANuB,GAAG,SAAnB,SAAS,CAAC,GAAG,CAAE,OAElB,GAAG,KACH,GAAG,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAC,CAAC,EAAE,KAAK,EAAC,MAAM,EAAE,GAAG,EAAC,GAAG,KAAK,OAAO,CAAC,GAAG,GAAG,GACnF,OAAO,CASlB;AA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AAH,GAAG,EAAA,KAAG,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAWtE;AAoBM,yCAJI,KAAK,CAAC,GAAC,CAAC,KACR,MAAM,aACN,CAAC,CAAC,EAAC,GAAC,EAAC,CAAC,EAAC,GAAC,KAAK,MAAM,UAkB7B"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/array.test.d.ts b/yjs-poll/node_modules/lib0/dist/array.test.d.ts deleted file mode 100644 index 4776afd..0000000 --- a/yjs-poll/node_modules/lib0/dist/array.test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export function testIsarrayPerformance(_tc: t.TestCase): void; -export function testAppend(_tc: t.TestCase): void; -export function testBasic(_tc: t.TestCase): void; -export function testflatten(_tc: t.TestCase): void; -export function testFolding(_tc: t.TestCase): void; -export function testEvery(_tc: t.TestCase): void; -export function testIsArray(_tc: t.TestCase): void; -export function testUnique(_tc: t.TestCase): void; -export function testBubblesortItemEdgeCases(tc: t.TestCase): void; -export function testRepeatBubblesortItem(tc: t.TestCase): void; -export function testRepeatBubblesort(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=array.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/array.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/array.test.d.ts.map deleted file mode 100644 index f9df3b5..0000000 --- a/yjs-poll/node_modules/lib0/dist/array.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"array.test.d.ts","sourceRoot":"","sources":["../array.test.js"],"names":[],"mappings":"AAOO,4CAFI,CAAC,CAAC,QAAQ,QAkCpB;AAKM,gCAFI,CAAC,CAAC,QAAQ,QAMpB;AAKM,+BAFI,CAAC,CAAC,QAAQ,QAMpB;AAKM,iCAFI,CAAC,CAAC,QAAQ,QAKpB;AAKM,iCAFI,CAAC,CAAC,QAAQ,QAkBpB;AAKM,+BAFI,CAAC,CAAC,QAAQ,QAQpB;AAKM,iCAFI,CAAC,CAAC,QAAQ,QASpB;AAKM,gCAFI,CAAC,CAAC,QAAQ,QAOpB;AAKM,gDAFI,CAAC,CAAC,QAAQ,QAOpB;AAKM,6CAFI,CAAC,CAAC,QAAQ,QAWpB;AAKM,yCAFI,CAAC,CAAC,QAAQ,QASpB;mBA1JkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/bin/0ecdsa-generate-keypair.d.ts b/yjs-poll/node_modules/lib0/dist/bin/0ecdsa-generate-keypair.d.ts deleted file mode 100644 index 71a08e3..0000000 --- a/yjs-poll/node_modules/lib0/dist/bin/0ecdsa-generate-keypair.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -export {}; -//# sourceMappingURL=0ecdsa-generate-keypair.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/bin/0ecdsa-generate-keypair.d.ts.map b/yjs-poll/node_modules/lib0/dist/bin/0ecdsa-generate-keypair.d.ts.map deleted file mode 100644 index 58c48c6..0000000 --- a/yjs-poll/node_modules/lib0/dist/bin/0ecdsa-generate-keypair.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"0ecdsa-generate-keypair.d.ts","sourceRoot":"","sources":["../../bin/0ecdsa-generate-keypair.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/bin/0serve.d.ts b/yjs-poll/node_modules/lib0/dist/bin/0serve.d.ts deleted file mode 100644 index 97bafa4..0000000 --- a/yjs-poll/node_modules/lib0/dist/bin/0serve.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -export {}; -//# sourceMappingURL=0serve.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/bin/0serve.d.ts.map b/yjs-poll/node_modules/lib0/dist/bin/0serve.d.ts.map deleted file mode 100644 index 8e6e013..0000000 --- a/yjs-poll/node_modules/lib0/dist/bin/0serve.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"0serve.d.ts","sourceRoot":"","sources":["../../bin/0serve.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/bin/gendocs.d.ts b/yjs-poll/node_modules/lib0/dist/bin/gendocs.d.ts deleted file mode 100644 index 422e119..0000000 --- a/yjs-poll/node_modules/lib0/dist/bin/gendocs.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -export {}; -//# sourceMappingURL=gendocs.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/bin/gendocs.d.ts.map b/yjs-poll/node_modules/lib0/dist/bin/gendocs.d.ts.map deleted file mode 100644 index 9ea4ead..0000000 --- a/yjs-poll/node_modules/lib0/dist/bin/gendocs.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gendocs.d.ts","sourceRoot":"","sources":["../../bin/gendocs.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/bin/gentesthtml.d.ts b/yjs-poll/node_modules/lib0/dist/bin/gentesthtml.d.ts deleted file mode 100644 index 39f067b..0000000 --- a/yjs-poll/node_modules/lib0/dist/bin/gentesthtml.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -export {}; -//# sourceMappingURL=gentesthtml.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/bin/gentesthtml.d.ts.map b/yjs-poll/node_modules/lib0/dist/bin/gentesthtml.d.ts.map deleted file mode 100644 index f4bf70a..0000000 --- a/yjs-poll/node_modules/lib0/dist/bin/gentesthtml.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gentesthtml.d.ts","sourceRoot":"","sources":["../../bin/gentesthtml.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/binary-ac8e39e2.cjs b/yjs-poll/node_modules/lib0/dist/binary-ac8e39e2.cjs deleted file mode 100644 index 7b705b8..0000000 --- a/yjs-poll/node_modules/lib0/dist/binary-ac8e39e2.cjs +++ /dev/null @@ -1,229 +0,0 @@ -'use strict'; - -/* eslint-env browser */ - -/** - * Binary data constants. - * - * @module binary - */ - -/** - * n-th bit activated. - * - * @type {number} - */ -const BIT1 = 1; -const BIT2 = 2; -const BIT3 = 4; -const BIT4 = 8; -const BIT5 = 16; -const BIT6 = 32; -const BIT7 = 64; -const BIT8 = 128; -const BIT9 = 256; -const BIT10 = 512; -const BIT11 = 1024; -const BIT12 = 2048; -const BIT13 = 4096; -const BIT14 = 8192; -const BIT15 = 16384; -const BIT16 = 32768; -const BIT17 = 65536; -const BIT18 = 1 << 17; -const BIT19 = 1 << 18; -const BIT20 = 1 << 19; -const BIT21 = 1 << 20; -const BIT22 = 1 << 21; -const BIT23 = 1 << 22; -const BIT24 = 1 << 23; -const BIT25 = 1 << 24; -const BIT26 = 1 << 25; -const BIT27 = 1 << 26; -const BIT28 = 1 << 27; -const BIT29 = 1 << 28; -const BIT30 = 1 << 29; -const BIT31 = 1 << 30; -const BIT32 = 1 << 31; - -/** - * First n bits activated. - * - * @type {number} - */ -const BITS0 = 0; -const BITS1 = 1; -const BITS2 = 3; -const BITS3 = 7; -const BITS4 = 15; -const BITS5 = 31; -const BITS6 = 63; -const BITS7 = 127; -const BITS8 = 255; -const BITS9 = 511; -const BITS10 = 1023; -const BITS11 = 2047; -const BITS12 = 4095; -const BITS13 = 8191; -const BITS14 = 16383; -const BITS15 = 32767; -const BITS16 = 65535; -const BITS17 = BIT18 - 1; -const BITS18 = BIT19 - 1; -const BITS19 = BIT20 - 1; -const BITS20 = BIT21 - 1; -const BITS21 = BIT22 - 1; -const BITS22 = BIT23 - 1; -const BITS23 = BIT24 - 1; -const BITS24 = BIT25 - 1; -const BITS25 = BIT26 - 1; -const BITS26 = BIT27 - 1; -const BITS27 = BIT28 - 1; -const BITS28 = BIT29 - 1; -const BITS29 = BIT30 - 1; -const BITS30 = BIT31 - 1; -/** - * @type {number} - */ -const BITS31 = 0x7FFFFFFF; -/** - * @type {number} - */ -const BITS32 = 0xFFFFFFFF; - -var binary = /*#__PURE__*/Object.freeze({ - __proto__: null, - BIT1: BIT1, - BIT2: BIT2, - BIT3: BIT3, - BIT4: BIT4, - BIT5: BIT5, - BIT6: BIT6, - BIT7: BIT7, - BIT8: BIT8, - BIT9: BIT9, - BIT10: BIT10, - BIT11: BIT11, - BIT12: BIT12, - BIT13: BIT13, - BIT14: BIT14, - BIT15: BIT15, - BIT16: BIT16, - BIT17: BIT17, - BIT18: BIT18, - BIT19: BIT19, - BIT20: BIT20, - BIT21: BIT21, - BIT22: BIT22, - BIT23: BIT23, - BIT24: BIT24, - BIT25: BIT25, - BIT26: BIT26, - BIT27: BIT27, - BIT28: BIT28, - BIT29: BIT29, - BIT30: BIT30, - BIT31: BIT31, - BIT32: BIT32, - BITS0: BITS0, - BITS1: BITS1, - BITS2: BITS2, - BITS3: BITS3, - BITS4: BITS4, - BITS5: BITS5, - BITS6: BITS6, - BITS7: BITS7, - BITS8: BITS8, - BITS9: BITS9, - BITS10: BITS10, - BITS11: BITS11, - BITS12: BITS12, - BITS13: BITS13, - BITS14: BITS14, - BITS15: BITS15, - BITS16: BITS16, - BITS17: BITS17, - BITS18: BITS18, - BITS19: BITS19, - BITS20: BITS20, - BITS21: BITS21, - BITS22: BITS22, - BITS23: BITS23, - BITS24: BITS24, - BITS25: BITS25, - BITS26: BITS26, - BITS27: BITS27, - BITS28: BITS28, - BITS29: BITS29, - BITS30: BITS30, - BITS31: BITS31, - BITS32: BITS32 -}); - -exports.BIT1 = BIT1; -exports.BIT10 = BIT10; -exports.BIT11 = BIT11; -exports.BIT12 = BIT12; -exports.BIT13 = BIT13; -exports.BIT14 = BIT14; -exports.BIT15 = BIT15; -exports.BIT16 = BIT16; -exports.BIT17 = BIT17; -exports.BIT18 = BIT18; -exports.BIT19 = BIT19; -exports.BIT2 = BIT2; -exports.BIT20 = BIT20; -exports.BIT21 = BIT21; -exports.BIT22 = BIT22; -exports.BIT23 = BIT23; -exports.BIT24 = BIT24; -exports.BIT25 = BIT25; -exports.BIT26 = BIT26; -exports.BIT27 = BIT27; -exports.BIT28 = BIT28; -exports.BIT29 = BIT29; -exports.BIT3 = BIT3; -exports.BIT30 = BIT30; -exports.BIT31 = BIT31; -exports.BIT32 = BIT32; -exports.BIT4 = BIT4; -exports.BIT5 = BIT5; -exports.BIT6 = BIT6; -exports.BIT7 = BIT7; -exports.BIT8 = BIT8; -exports.BIT9 = BIT9; -exports.BITS0 = BITS0; -exports.BITS1 = BITS1; -exports.BITS10 = BITS10; -exports.BITS11 = BITS11; -exports.BITS12 = BITS12; -exports.BITS13 = BITS13; -exports.BITS14 = BITS14; -exports.BITS15 = BITS15; -exports.BITS16 = BITS16; -exports.BITS17 = BITS17; -exports.BITS18 = BITS18; -exports.BITS19 = BITS19; -exports.BITS2 = BITS2; -exports.BITS20 = BITS20; -exports.BITS21 = BITS21; -exports.BITS22 = BITS22; -exports.BITS23 = BITS23; -exports.BITS24 = BITS24; -exports.BITS25 = BITS25; -exports.BITS26 = BITS26; -exports.BITS27 = BITS27; -exports.BITS28 = BITS28; -exports.BITS29 = BITS29; -exports.BITS3 = BITS3; -exports.BITS30 = BITS30; -exports.BITS31 = BITS31; -exports.BITS32 = BITS32; -exports.BITS4 = BITS4; -exports.BITS5 = BITS5; -exports.BITS6 = BITS6; -exports.BITS7 = BITS7; -exports.BITS8 = BITS8; -exports.BITS9 = BITS9; -exports.binary = binary; -//# sourceMappingURL=binary-ac8e39e2.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/binary-ac8e39e2.cjs.map b/yjs-poll/node_modules/lib0/dist/binary-ac8e39e2.cjs.map deleted file mode 100644 index cee5b9b..0000000 --- a/yjs-poll/node_modules/lib0/dist/binary-ac8e39e2.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"binary-ac8e39e2.cjs","sources":["../binary.js"],"sourcesContent":["/* eslint-env browser */\n\n/**\n * Binary data constants.\n *\n * @module binary\n */\n\n/**\n * n-th bit activated.\n *\n * @type {number}\n */\nexport const BIT1 = 1\nexport const BIT2 = 2\nexport const BIT3 = 4\nexport const BIT4 = 8\nexport const BIT5 = 16\nexport const BIT6 = 32\nexport const BIT7 = 64\nexport const BIT8 = 128\nexport const BIT9 = 256\nexport const BIT10 = 512\nexport const BIT11 = 1024\nexport const BIT12 = 2048\nexport const BIT13 = 4096\nexport const BIT14 = 8192\nexport const BIT15 = 16384\nexport const BIT16 = 32768\nexport const BIT17 = 65536\nexport const BIT18 = 1 << 17\nexport const BIT19 = 1 << 18\nexport const BIT20 = 1 << 19\nexport const BIT21 = 1 << 20\nexport const BIT22 = 1 << 21\nexport const BIT23 = 1 << 22\nexport const BIT24 = 1 << 23\nexport const BIT25 = 1 << 24\nexport const BIT26 = 1 << 25\nexport const BIT27 = 1 << 26\nexport const BIT28 = 1 << 27\nexport const BIT29 = 1 << 28\nexport const BIT30 = 1 << 29\nexport const BIT31 = 1 << 30\nexport const BIT32 = 1 << 31\n\n/**\n * First n bits activated.\n *\n * @type {number}\n */\nexport const BITS0 = 0\nexport const BITS1 = 1\nexport const BITS2 = 3\nexport const BITS3 = 7\nexport const BITS4 = 15\nexport const BITS5 = 31\nexport const BITS6 = 63\nexport const BITS7 = 127\nexport const BITS8 = 255\nexport const BITS9 = 511\nexport const BITS10 = 1023\nexport const BITS11 = 2047\nexport const BITS12 = 4095\nexport const BITS13 = 8191\nexport const BITS14 = 16383\nexport const BITS15 = 32767\nexport const BITS16 = 65535\nexport const BITS17 = BIT18 - 1\nexport const BITS18 = BIT19 - 1\nexport const BITS19 = BIT20 - 1\nexport const BITS20 = BIT21 - 1\nexport const BITS21 = BIT22 - 1\nexport const BITS22 = BIT23 - 1\nexport const BITS23 = BIT24 - 1\nexport const BITS24 = BIT25 - 1\nexport const BITS25 = BIT26 - 1\nexport const BITS26 = BIT27 - 1\nexport const BITS27 = BIT28 - 1\nexport const BITS28 = BIT29 - 1\nexport const BITS29 = BIT30 - 1\nexport const BITS30 = BIT31 - 1\n/**\n * @type {number}\n */\nexport const BITS31 = 0x7FFFFFFF\n/**\n * @type {number}\n */\nexport const BITS32 = 0xFFFFFFFF\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,IAAI,GAAG,EAAC;AACT,MAAC,IAAI,GAAG,EAAC;AACT,MAAC,IAAI,GAAG,EAAC;AACT,MAAC,IAAI,GAAG,EAAC;AACT,MAAC,IAAI,GAAG,GAAE;AACV,MAAC,IAAI,GAAG,GAAE;AACV,MAAC,IAAI,GAAG,GAAE;AACV,MAAC,IAAI,GAAG,IAAG;AACX,MAAC,IAAI,GAAG,IAAG;AACX,MAAC,KAAK,GAAG,IAAG;AACZ,MAAC,KAAK,GAAG,KAAI;AACb,MAAC,KAAK,GAAG,KAAI;AACb,MAAC,KAAK,GAAG,KAAI;AACb,MAAC,KAAK,GAAG,KAAI;AACb,MAAC,KAAK,GAAG,MAAK;AACd,MAAC,KAAK,GAAG,MAAK;AACd,MAAC,KAAK,GAAG,MAAK;AACd,MAAC,KAAK,GAAG,CAAC,IAAI,GAAE;AAChB,MAAC,KAAK,GAAG,CAAC,IAAI,GAAE;AAChB,MAAC,KAAK,GAAG,CAAC,IAAI,GAAE;AAChB,MAAC,KAAK,GAAG,CAAC,IAAI,GAAE;AAChB,MAAC,KAAK,GAAG,CAAC,IAAI,GAAE;AAChB,MAAC,KAAK,GAAG,CAAC,IAAI,GAAE;AAChB,MAAC,KAAK,GAAG,CAAC,IAAI,GAAE;AAChB,MAAC,KAAK,GAAG,CAAC,IAAI,GAAE;AAChB,MAAC,KAAK,GAAG,CAAC,IAAI,GAAE;AAChB,MAAC,KAAK,GAAG,CAAC,IAAI,GAAE;AAChB,MAAC,KAAK,GAAG,CAAC,IAAI,GAAE;AAChB,MAAC,KAAK,GAAG,CAAC,IAAI,GAAE;AAChB,MAAC,KAAK,GAAG,CAAC,IAAI,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MAAM,GAAG,WAAU;AAChC;AACA;AACA;AACY,MAAC,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/binary.cjs b/yjs-poll/node_modules/lib0/dist/binary.cjs deleted file mode 100644 index ea72a37..0000000 --- a/yjs-poll/node_modules/lib0/dist/binary.cjs +++ /dev/null @@ -1,74 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var binary = require('./binary-ac8e39e2.cjs'); - - - -exports.BIT1 = binary.BIT1; -exports.BIT10 = binary.BIT10; -exports.BIT11 = binary.BIT11; -exports.BIT12 = binary.BIT12; -exports.BIT13 = binary.BIT13; -exports.BIT14 = binary.BIT14; -exports.BIT15 = binary.BIT15; -exports.BIT16 = binary.BIT16; -exports.BIT17 = binary.BIT17; -exports.BIT18 = binary.BIT18; -exports.BIT19 = binary.BIT19; -exports.BIT2 = binary.BIT2; -exports.BIT20 = binary.BIT20; -exports.BIT21 = binary.BIT21; -exports.BIT22 = binary.BIT22; -exports.BIT23 = binary.BIT23; -exports.BIT24 = binary.BIT24; -exports.BIT25 = binary.BIT25; -exports.BIT26 = binary.BIT26; -exports.BIT27 = binary.BIT27; -exports.BIT28 = binary.BIT28; -exports.BIT29 = binary.BIT29; -exports.BIT3 = binary.BIT3; -exports.BIT30 = binary.BIT30; -exports.BIT31 = binary.BIT31; -exports.BIT32 = binary.BIT32; -exports.BIT4 = binary.BIT4; -exports.BIT5 = binary.BIT5; -exports.BIT6 = binary.BIT6; -exports.BIT7 = binary.BIT7; -exports.BIT8 = binary.BIT8; -exports.BIT9 = binary.BIT9; -exports.BITS0 = binary.BITS0; -exports.BITS1 = binary.BITS1; -exports.BITS10 = binary.BITS10; -exports.BITS11 = binary.BITS11; -exports.BITS12 = binary.BITS12; -exports.BITS13 = binary.BITS13; -exports.BITS14 = binary.BITS14; -exports.BITS15 = binary.BITS15; -exports.BITS16 = binary.BITS16; -exports.BITS17 = binary.BITS17; -exports.BITS18 = binary.BITS18; -exports.BITS19 = binary.BITS19; -exports.BITS2 = binary.BITS2; -exports.BITS20 = binary.BITS20; -exports.BITS21 = binary.BITS21; -exports.BITS22 = binary.BITS22; -exports.BITS23 = binary.BITS23; -exports.BITS24 = binary.BITS24; -exports.BITS25 = binary.BITS25; -exports.BITS26 = binary.BITS26; -exports.BITS27 = binary.BITS27; -exports.BITS28 = binary.BITS28; -exports.BITS29 = binary.BITS29; -exports.BITS3 = binary.BITS3; -exports.BITS30 = binary.BITS30; -exports.BITS31 = binary.BITS31; -exports.BITS32 = binary.BITS32; -exports.BITS4 = binary.BITS4; -exports.BITS5 = binary.BITS5; -exports.BITS6 = binary.BITS6; -exports.BITS7 = binary.BITS7; -exports.BITS8 = binary.BITS8; -exports.BITS9 = binary.BITS9; -//# sourceMappingURL=binary.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/binary.cjs.map b/yjs-poll/node_modules/lib0/dist/binary.cjs.map deleted file mode 100644 index eaadb4c..0000000 --- a/yjs-poll/node_modules/lib0/dist/binary.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"binary.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/binary.d.ts b/yjs-poll/node_modules/lib0/dist/binary.d.ts deleted file mode 100644 index 890f0c4..0000000 --- a/yjs-poll/node_modules/lib0/dist/binary.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Binary data constants. - * - * @module binary - */ -/** - * n-th bit activated. - * - * @type {number} - */ -export const BIT1: number; -export const BIT2: 2; -export const BIT3: 4; -export const BIT4: 8; -export const BIT5: 16; -export const BIT6: 32; -export const BIT7: 64; -export const BIT8: 128; -export const BIT9: 256; -export const BIT10: 512; -export const BIT11: 1024; -export const BIT12: 2048; -export const BIT13: 4096; -export const BIT14: 8192; -export const BIT15: 16384; -export const BIT16: 32768; -export const BIT17: 65536; -export const BIT18: number; -export const BIT19: number; -export const BIT20: number; -export const BIT21: number; -export const BIT22: number; -export const BIT23: number; -export const BIT24: number; -export const BIT25: number; -export const BIT26: number; -export const BIT27: number; -export const BIT28: number; -export const BIT29: number; -export const BIT30: number; -export const BIT31: number; -export const BIT32: number; -/** - * First n bits activated. - * - * @type {number} - */ -export const BITS0: number; -export const BITS1: 1; -export const BITS2: 3; -export const BITS3: 7; -export const BITS4: 15; -export const BITS5: 31; -export const BITS6: 63; -export const BITS7: 127; -export const BITS8: 255; -export const BITS9: 511; -export const BITS10: 1023; -export const BITS11: 2047; -export const BITS12: 4095; -export const BITS13: 8191; -export const BITS14: 16383; -export const BITS15: 32767; -export const BITS16: 65535; -export const BITS17: number; -export const BITS18: number; -export const BITS19: number; -export const BITS20: number; -export const BITS21: number; -export const BITS22: number; -export const BITS23: number; -export const BITS24: number; -export const BITS25: number; -export const BITS26: number; -export const BITS27: number; -export const BITS28: number; -export const BITS29: number; -export const BITS30: number; -/** - * @type {number} - */ -export const BITS31: number; -/** - * @type {number} - */ -export const BITS32: number; -//# sourceMappingURL=binary.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/binary.d.ts.map b/yjs-poll/node_modules/lib0/dist/binary.d.ts.map deleted file mode 100644 index 183f702..0000000 --- a/yjs-poll/node_modules/lib0/dist/binary.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../binary.js"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH;;;;GAIG;AACH,mBAFU,MAAM,CAEK;AACrB,mBAAoB,CAAC,CAAA;AACrB,mBAAoB,CAA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/B,4BAA+B;AAC/B,4BAA+B;AAC/B,4BAA+B;AAC/B,4BAA+B;AAC/B,4BAA+B;AAC/B;;GAEG;AACH,qBAFU,MAAM,CAEgB;AAChC;;GAEG;AACH,qBAFU,MAAM,CAEgB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/binary.test.d.ts b/yjs-poll/node_modules/lib0/dist/binary.test.d.ts deleted file mode 100644 index 1c2e586..0000000 --- a/yjs-poll/node_modules/lib0/dist/binary.test.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function testBitx(tc: t.TestCase): void; -export function testBitsx(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=binary.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/binary.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/binary.test.d.ts.map deleted file mode 100644 index 8434c62..0000000 --- a/yjs-poll/node_modules/lib0/dist/binary.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"binary.test.d.ts","sourceRoot":"","sources":["../binary.test.js"],"names":[],"mappings":"AAMO,6BAFI,CAAC,CAAC,QAAQ,QAOpB;AAKM,8BAFI,CAAC,CAAC,QAAQ,QAWpB;mBAxBkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/binding.cjs b/yjs-poll/node_modules/lib0/dist/binding.cjs deleted file mode 100644 index 00c550e..0000000 --- a/yjs-poll/node_modules/lib0/dist/binding.cjs +++ /dev/null @@ -1,484 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var observable = require('./observable.cjs'); -var delta = require('./delta.cjs'); -require('./testing.cjs'); -var schema = require('./schema.cjs'); -var dom = require('./dom-7e625b09.cjs'); -var set = require('./set-5b47859e.cjs'); -var map = require('./map-24d263c0.cjs'); -var error = require('./error-0c1f634f.cjs'); -var math = require('./math-96d5e8c4.cjs'); -var mutex = require('./mutex-63f09c81.cjs'); -require('./array-78849c95.cjs'); -require('./list.cjs'); -require('./function-314580f7.cjs'); -require('./object-c0c9435b.cjs'); -require('./equality.cjs'); -require('./fingerprint.cjs'); -require('./encoding-1a745c43.cjs'); -require('./number-1fb57bba.cjs'); -require('./binary-ac8e39e2.cjs'); -require('./string-fddc5f8b.cjs'); -require('./rabin.cjs'); -require('./buffer-3e750729.cjs'); -require('./environment-1c97264d.cjs'); -require('./conditions-f5c0c102.cjs'); -require('./storage.cjs'); -require('./decoding-76e75827.cjs'); -require('./patience.cjs'); -require('./prng-37d48618.cjs'); -require('lib0/logging'); -require('./diff-9d236524.cjs'); -require('./random.cjs'); -require('lib0/webcrypto'); -require('./statistics-65f6114b.cjs'); -require('./json-092190a1.cjs'); -require('./time-d8438852.cjs'); -require('./metric.cjs'); -require('./promise-cda7b9bb.cjs'); -require('lib0/performance'); -require('./pair-ab022bc3.cjs'); - -/* eslint-disable */ - -/** - * @template {delta.Delta?} DeltaA - * @template {delta.Delta?} DeltaB - * @typedef {{ a: DeltaA?, b: DeltaB? }} TransformResult - */ - -/** - * @template {delta.DeltaBuilder?} DeltaA - * @template {delta.DeltaBuilder?} DeltaB - * @param {DeltaA} a - * @param {DeltaB} b - * @return {TransformResult} - */ -const transformResult = (a, b) => ({ a, b }); - -transformResult(delta.create('x'), null); - -/** - * @template {delta.DeltaAny} DeltaA - * @template {delta.DeltaAny} DeltaB - * @typedef {(t:{a:DeltaA?,b:DeltaB?})=>({a:DeltaA?,b:DeltaB?})} DeltaTransformer - */ - -/** - * @template {delta.Delta} A - * @template {(A extends delta.Delta ? delta.Delta<`x-${NodeName}`,Attrs,Children,Text> : never)} B - * @param {TransformResult} t - * @return {TransformResult} - */ -const rename = t => { - /** - * @type {any} - */ - const tout = /** @type {any} */ (transformResult(null, null)); - if (t.a) { - const c = /** @type {delta.Delta} */ (t.a.clone()); - c.name = 'x-' + c.name; - // @ts-ignore - tout.b = c; - } - if (t.b) { - const c = /** @type {delta.Delta} */ (t.b.clone()); - c.name = c.name.slice(2); - // @ts-ignore - tout.a = c; - } - return tout -}; - -delta.create('x', { x: 'dtrn' }); -rename({ a: delta.create('x', { x: 'dtrn' }), b: null }); -// -// /** -// * @template {delta.Delta} D -// * @param {s.Schema} $d -// * @return {Transformer} -// */ -// const id = ($d) => /** @type {Transformer} */ (new Transformer($d)) -// -// const q = id(delta.$delta({ name: 'div' })) -// const q2 = id(delta.$delta({ name: 'div', attrs: { a: s.$string } })).pipe(t.delta('h1', { color: t => query('a')(t), name:'mystuff' }, t => [query('b')(t)])) -// const q3 = t.delta('h1', { color: t => query('a')(t), name:'mystuff' }, t => [query('b')(t)])(id(delta.$delta({ name: 'div', attrs: { a: s.$string } })))) -// -// -// /** -// * @param {Transformer>} t -// */ -// const dataToH1 = t => t.delta('h1', { color: t => query('a')(t), name:'mystuff' }, t => [query('b')(t)])(t) -// const q4 = dataToH1(id(delta.$delta({ name: 'div', attrs: { a: s.$string } }))) -// -// const dataToH1_2 = t => rename('h1')(renameAttr({ a: 'color' })(static(delta.create('h1', { name: 'mystuff' }, 'some content!'))(t))) - -/* eslint-disable */ - -/** - * @template T - * @typedef {import('../schema.js').Schema} Schema - */ - -/** - * @template {delta.AbstractDelta} DeltaA - * @template {delta.AbstractDelta} DeltaB - */ -class Binding { - /** - * @param {RDT} a - * @param {RDT} b - * @param {dt.Template} template - */ - constructor (a, b, template) { - /** - * @type {dt.Transformer} - */ - this.t = template.init(); - this.a = a; - this.b = b; - this._mux = mutex.createMutex(); - this._achanged = this.a.on('change', d => this._mux(() => { - const tres = this.t.applyA(d); - if (tres.a) { - a.update(tres.a); - } - if (tres.b) { - b.update(tres.b); - } - })); - this._bchanged = this.b.on('change', d => this._mux(() => { - const tres = this.t.applyB(d); - if (tres.b) { - this.b.update(tres.b); - } - if (tres.a) { - a.update(tres.a); - } - })); - } - - destroy = () => { - this.a.off('destroy', this.destroy); - this.b.off('destroy', this.destroy); - this.a.off('change', this._achanged); - this.b.off('change', this._bchanged); - } -} - -/** - * Abstract Interface for a delta-based Replicated Data Type. - * - * @template {delta.AbstractDelta} Delta - * @typedef {ObservableV2<{ 'change': (delta: Delta) => void, 'destroy': (rdt:RDT)=>void }> & { update: (delta: Delta) => any, destroy: () => void }} RDT - */ - -/** - * @template {delta.AbstractDelta} DeltaA - * @template {dt.Template} Transformer - * @param {RDT} a - * @param {RDT ? DeltaB : never>} b - * @param {dt.Template} template - */ -const bind = (a, b, template) => new Binding(a, b, template); - -/** - * @template {delta.AbstractDelta} Delta - * @implements RDT - * @extends {ObservableV2<{ change: (delta: Delta) => void, 'destroy': (rdt:DeltaRDT)=>void }>} - */ -class DeltaRDT extends observable.ObservableV2 { - /** - * @param {Schema} $delta - */ - constructor ($delta) { - super(); - this.$delta = $delta; - /** - * @type {Delta?} - */ - this.state = null; - this._mux = mutex.createMutex(); - } - - /** - * @param {Delta} delta - */ - update = delta => delta.isEmpty() || this._mux(() => { - if (this.state != null) { - this.state.apply(delta); - } else { - this.state = delta; - } - this.emit('change', [delta]); - }) - - destroy () { - this.emit('destroy', [this]); - super.destroy(); - } -} - -/** - * @template {delta.AbstractDelta} Delta - * @param {Schema} $delta - */ -const deltaRDT = $delta => new DeltaRDT($delta); - -/** - * @param {Node} domNode - */ -const domToDelta = domNode => { - if (dom.$element.check(domNode)) { - const d = undefined(domNode.nodeName.toLowerCase()); - for (let i = 0; i < domNode.attributes.length; i++) { - const attr = /** @type {Attr} */ (domNode.attributes.item(i)); - d.attributes.set(attr.nodeName, attr.value); - } - domNode.childNodes.forEach(child => { - d.children.insert(dom.$text.check(child) ? child.textContent : [domToDelta(child)]); - }); - return d - } - error.unexpectedCase(); -}; - -/** - * @param {DomDelta} d - */ -const deltaToDom = d => { - if (undefined(d)) { - const n = dom.element(d.name); - d.attributes.forEach(change => { - if (delta.$insertOp.check(change)) { - n.setAttribute(change.key, change.value); - } - }); - d.children.forEach(child => { - if (delta.$insertOp.check(child)) { - n.append(...child.insert.map(deltaToDom)); - } else if (delta.$textOp.check(child)) { - n.append(dom.text(child.insert)); - } - }); - return n - } - error.unexpectedCase(); -}; - -/** - * @param {Element} el - * @param {delta.Node} d - */ -const applyDeltaToDom = (el, d) => { - d.attributes.forEach(change => { - if (delta.$deleteOp.check(change)) { - el.removeAttribute(change.key); - } else { - el.setAttribute(change.key, change.value); - } - }); - let childIndex = 0; - let childOffset = 0; - d.children.forEach(change => { - let child = el.childNodes[childIndex] || null; - if (delta.$deleteOp.check(change)) { - let len = change.length; - while (len > 0) { - if (dom.$element.check(child)) { - child.remove(); - len--; - } else if (dom.$text.check(child)) { - const childLen = child.length; - if (childOffset === 0 && childLen <= len) { - child.remove(); - len -= childLen; - } else { - const spliceLen = math.min(len, childLen - childOffset); - child.deleteData(childOffset, spliceLen); - if (child.length <= childOffset) { - childOffset = 0; - childIndex++; - } - } - } - } - } else if (delta.$insertOp.check(change)) { - if (childOffset > 0) { - const tchild = dom.$text.cast(child); - child = tchild.splitText(childOffset); - childIndex++; - childOffset = 0; - } - el.insertBefore(dom.fragment(change.insert.map(deltaToDom)), child); - } else if (delta.$modifyOp.check(change)) { - applyDeltaToDom(dom.$element.cast(child), change.modify); - } else if (delta.$textOp.check(change)) { - el.insertBefore(dom.text(change.insert), child); - } else { - error.unexpectedCase(); - } - }); -}; - -const $domDelta = undefined(schema.$string, schema.$record(schema.$string, schema.$string), schema.$never, { recursive: true, withText: true }); - -/** - * @param {Element} observedNode - * @param {MutationRecord[]} mutations - * @param {any} origin assign this origin to the generated delta - */ -const _mutationsToDelta = (observedNode, mutations, origin) => { - /** - * @typedef {{ removedBefore: Map, added: Set, modified: number, d: delta.Node }} ChangedNodeInfo - */ - /** - * Compute all deltas without recursion. - * - * 1. mark all changed parents in parentsChanged - * 2. fill out necessary information for each changed parent () - */ - // - /** - * @type {Map} - */ - const changedNodes = map.create(); - /** - * @param {Node} node - * @return {ChangedNodeInfo} - */ - const getChangedNodeInfo = node => map.setIfUndefined(changedNodes, node, () => ({ removedBefore: map.create(), added: set.create(), modified: 0, d: undefined(node.nodeName.toLowerCase()) })); - const observedNodeInfo = getChangedNodeInfo(observedNode); - mutations.forEach(mutation => { - const target = /** @type {HTMLElement} */ (mutation.target); - const parent = target.parentNode; - const attrName = /** @type {string} */ (mutation.attributeName); - const newVal = target.getAttribute(attrName); - const info = getChangedNodeInfo(target); - const d = info.d; - // go up the tree and mark that a child has been modified - for (let changedParent = parent; changedParent != null && getChangedNodeInfo(changedParent).modified++ > 1 && changedParent !== observedNode; changedParent = changedParent.parentNode) { - // nop - } - switch (mutation.type) { - case 'attributes': { - const attrs = /** @type {delta.Node} */ (d).attributes; - if (newVal == null) { - attrs.delete(attrName); - } else { - attrs.set(/** @type {string} */ (attrName), newVal); - } - break - } - case 'characterData': { - error.methodUnimplemented(); - break - } - case 'childList': { - const targetInfo = getChangedNodeInfo(target); - mutation.addedNodes.forEach(node => { - targetInfo.added.add(node); - }); - const removed = mutation.removedNodes.length; - if (removed > 0) { - // @todo this can't work because next can be null - targetInfo.removedBefore.set(mutation.nextSibling, removed); - } - break - } - } - }); - changedNodes.forEach((info, node) => { - const numOfChildChanges = info.modified + info.removedBefore.size + info.added.size; - const d = /** @type {delta.Node} */ (info.d); - if (numOfChildChanges > 0) { - node.childNodes.forEach(nchild => { - if (info.removedBefore.has(nchild)) { // can happen separately - d.children.delete(/** @type {number} */ (info.removedBefore.get(nchild))); - } - if (info.added.has(nchild)) { - d.children.insert(dom.$text.check(nchild) ? nchild.textContent : [domToDelta(nchild)]); - } else if (changedNodes.has(nchild)) { - d.children.modify(getChangedNodeInfo(nchild).d); - } - }); - // remove items to the end, if necessary - d.children.delete(info.removedBefore.get(null) ?? 0); - } - d.done(); - }); - observedNodeInfo.d.origin = origin; - return observedNodeInfo.d -}; - -/** - * @typedef {delta.RecursiveNode} DomDelta - */ - -/** - * @template {DomDelta} [D=DomDelta] - * @implements RDT - * @extends {ObservableV2<{ change: (delta: D)=>void, destroy: (rdt:DomRDT)=>void }>}>} - */ -class DomRDT extends observable.ObservableV2 { - /** - * @param {Element} observedNode - */ - constructor (observedNode) { - super(); - this.observedNode = observedNode; - this._mux = mutex.createMutex(); - this.observer = new MutationObserver(this._mutationHandler); - this.observer.observe(observedNode, { - subtree: true, - childList: true, - attributes: true, - characterDataOldValue: true - }); - } - - /** - * @param {MutationRecord[]} mutations - */ - _mutationHandler = mutations => - mutations.length > 0 && this._mux(() => { - this.emit('change', [/** @type {D} */(_mutationsToDelta(this.observedNode, mutations, this))]); - }) - - /** - * @param {D} delta - */ - update = delta => { - if (delta.origin !== this) { - // @todo the retrieved changes must be transformed agains the updated changes. need a proper - // transaction system - this._mutationHandler(this.observer.takeRecords()); - this._mux(() => { - applyDeltaToDom(this.observedNode, delta); - const mutations = this.observer.takeRecords(); - this.emit('change', [/** @type {D} */(_mutationsToDelta(this.observedNode, mutations, delta.origin))]); - }); - } - } - - destroy () { - this.emit('destroy', [this]); - super.destroy(); - this.observer.disconnect(); - } -} - -/** - * @param {Element} dom - */ -const domRDT = dom => new DomRDT(dom); - -exports.$domDelta = $domDelta; -exports.Binding = Binding; -exports.bind = bind; -exports.deltaRDT = deltaRDT; -exports.domRDT = domRDT; -//# sourceMappingURL=binding.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/binding.cjs.map b/yjs-poll/node_modules/lib0/dist/binding.cjs.map deleted file mode 100644 index 289185f..0000000 --- a/yjs-poll/node_modules/lib0/dist/binding.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"binding.cjs","sources":["../delta/t3.test.js","../delta/binding.js"],"sourcesContent":["/* eslint-disable */\n// @ts-nocheck\nimport * as t from '../testing.js'\nimport * as delta from './delta.js'\nimport * as s from '../schema.js'\nimport * as array from '../array.js'\n\n/**\n * @template {delta.Delta?} DeltaA\n * @template {delta.Delta?} DeltaB\n * @typedef {{ a: DeltaA?, b: DeltaB? }} TransformResult\n */\n\n/**\n * @template {delta.DeltaBuilder?} DeltaA\n * @template {delta.DeltaBuilder?} DeltaB\n * @param {DeltaA} a\n * @param {DeltaB} b\n * @return {TransformResult}\n */\nexport const transformResult = (a, b) => ({ a, b })\nexport const transformResultEmpty = transformResult(null, null)\n\nlet x = transformResult(delta.create('x'), null)\nx = transformResult(null, null)\n\n/**\n * @template {delta.DeltaAny} DeltaA\n * @template {delta.DeltaAny} DeltaB\n * @typedef {(t:{a:DeltaA?,b:DeltaB?})=>({a:DeltaA?,b:DeltaB?})} DeltaTransformer\n */\n\n/**\n * @template {delta.Delta} A\n * @template {(A extends delta.Delta ? delta.Delta<`x-${NodeName}`,Attrs,Children,Text> : never)} B\n * @param {TransformResult} t\n * @return {TransformResult}\n */\nconst rename = t => {\n /**\n * @type {any}\n */\n const tout = /** @type {any} */ (transformResult(null, null))\n if (t.a) {\n const c = /** @type {delta.Delta} */ (t.a.clone())\n c.name = 'x-' + c.name\n // @ts-ignore\n tout.b = c\n }\n if (t.b) {\n const c = /** @type {delta.Delta} */ (t.b.clone())\n c.name = c.name.slice(2)\n // @ts-ignore\n tout.a = c\n }\n return tout\n}\n\n/**\n * @param {Set} allowed\n */\nconst filter = (allowed) => {\n /**\n * contains inserted items that didn't make it into t.b\n */\n const diff = delta.create()\n /**\n * @template {delta.Delta?} A\n * @template {(A extends delta.Delta ? delta.Delta<`x-${NodeName}`,Attrs,Children,Text> : never)} B\n * @param {{ a: A?, b: B? }} t\n * @return {{ a: A?, b: B? }}\n */\n return t => {\n /**\n * @type {any}\n */\n const tout = /** @type {any} */ (transformResult(null, null))\n if (t.a) {\n const c = delta.create()\n let index = 0\n /**\n * Split delta into two parts: hidden and visible. hidden contains all \"hidden\" changes (filtered inserts).\n * visible everything else.\n *\n * return visible.rebaseAgainstInverse(diff)\n * apply `diff.apply(merge)`\n *\n */\n for (const child of t.a.children) {\n if (delta.$insertOp.check(child)) {\n for (let i = 0; i < child.insert.length; i++) {\n const ins = child.insert[i]\n if (delta.$deltaAny.check(ins) && allowed.has(ins.name)) {\n ins\n } else {\n\n }\n ins\n }\n }\n if (!delta.$deleteOp.check(child)) {\n index += child.length\n }\n }\n }\n if (t.b) {\n }\n return tout\n }\n}\n\nconst dd = delta.create('x', { x: 'dtrn' })\nconst y = rename({ a: delta.create('x', { x: 'dtrn' }), b: null })\n\n/**\n * @template {delta.DeltaAny} DeltaA\n * @template {delta.DeltaAny} Delta_\n * @template {delta.DeltaAny} DeltaB\n * @param {(t:TransformResult)=>TransformResult} t1\n * @param {(t:TransformResult)=>TransformResult} t2\n * @return {(dx:TransformResult)=>TransformResult}\n */\nconst pipe = (t1, t2) => (dx) => {\n return /** @type {any} */ (null)\n}\n\n// next idea: Transform object that changes typings\n\n/**\n * Transforms should..\n * - transform from a->b->c->b->a\n * - extendable mod(Transform):Transform\n * - i can start with id: mod(Id($d))\n */\n\n/**\n * @template {delta.Delta} DeltaA\n * @template {delta.Delta} DeltaB\n * @typedef {{ applyA: (da:DeltaA)=>TransformResult, applyB: (db:DeltaB)=>TransformResult }} Transform\n */\n\n/**\n * @template {delta.DeltaBuilder} A\n * @template {delta.DeltaBuilder} B\n */\nclass Transformer {\n /**\n * @param {s.Schema} $da\n */\n constructor ($da) {\n this.$da = $da\n /**\n * @type {Array>}\n */\n this._tr = []\n }\n\n /**\n * @param {TransformResult} d\n * @return {TransformResult}\n */\n apply ({ a, b }) {\n if (a == null && b == null) return transformResult(null, null)\n /**\n * @type {Array<{ a: delta.DeltaBuilder?, b: delta.DeltaBuilder? }>}\n */\n const pendingApply = array.unfold(this._tr.length + 2, () => ({ a: null, b: null }))\n pendingApply[1].a = a\n pendingApply[pendingApply.length - 2].b = b\n /**\n * @param {number} i\n */\n const applyTransformI = i => {\n const p = pendingApply[i + 1]\n const t = this._tr[i]\n const aout = p.a !== null ? t.applyA(p.a) : transformResult(null, null)\n if (p.b !== null) {\n if (aout.b !== null) {\n p.b = p.b.rebase(aout.b, true)\n }\n const bout = t.applyB(p.b)\n aout.a = delta.mergeDeltas(aout.a, bout.a)\n aout.b = delta.mergeDeltas(aout.b, bout.b)\n }\n // write out.a into prev.b, and out.b into next.a\n pendingApply[i].b = delta.mergeDeltas(pendingApply[i].b, aout.a)\n pendingApply[i + 2].a = delta.mergeDeltas(pendingApply[i + 2].a, aout.b)\n return aout\n }\n let needsBackwardTransform = a != null\n let needsForwardTransform = b != null\n while (needsBackwardTransform || needsForwardTransform) {\n if (needsForwardTransform) {\n for (let i = 0; i < this._tr.length; i++) {\n const r = applyTransformI(i)\n if (i != null) {\n needsBackwardTransform = needsBackwardTransform || r.a != null\n }\n }\n needsForwardTransform = false\n }\n if (needsBackwardTransform) {\n for (let i = this._tr.length - 1; i >= 0; i--) {\n const r = applyTransformI(i)\n if (i != null) {\n needsForwardTransform = needsForwardTransform || r.b != null\n }\n }\n needsBackwardTransform = false\n }\n }\n return /** @type {TransformResult} */ (transformResult(pendingApply[0].b, pendingApply[pendingApply.length - 1].a))\n }\n}\n//\n// /**\n// * @template {delta.Delta} D\n// * @param {s.Schema} $d\n// * @return {Transformer}\n// */\n// const id = ($d) => /** @type {Transformer} */ (new Transformer($d))\n//\n// const q = id(delta.$delta({ name: 'div' }))\n// const q2 = id(delta.$delta({ name: 'div', attrs: { a: s.$string } })).pipe(t.delta('h1', { color: t => query('a')(t), name:'mystuff' }, t => [query('b')(t)]))\n// const q3 = t.delta('h1', { color: t => query('a')(t), name:'mystuff' }, t => [query('b')(t)])(id(delta.$delta({ name: 'div', attrs: { a: s.$string } }))))\n//\n//\n// /**\n// * @param {Transformer>} t\n// */\n// const dataToH1 = t => t.delta('h1', { color: t => query('a')(t), name:'mystuff' }, t => [query('b')(t)])(t)\n// const q4 = dataToH1(id(delta.$delta({ name: 'div', attrs: { a: s.$string } })))\n//\n// const dataToH1_2 = t => rename('h1')(renameAttr({ a: 'color' })(static(delta.create('h1', { name: 'mystuff' }, 'some content!'))(t)))\n","/* eslint-disable */\n// @ts-nocheck\n// @todo remove all @ts-nocheck and eslint-disable\n/* global MutationObserver */\nimport { ObservableV2 } from '../observable.js'\nimport * as delta from './delta.js'\nimport * as dt from './t3.test.js' // eslint-disable-line\nimport * as dom from '../dom.js'\nimport * as set from '../set.js'\nimport * as map from '../map.js'\nimport * as error from '../error.js'\nimport * as math from '../math.js'\nimport * as mux from '../mutex.js'\nimport * as s from '../schema.js'\n\n/**\n * @template T\n * @typedef {import('../schema.js').Schema} Schema\n */\n\n/**\n * @template {delta.AbstractDelta} DeltaA\n * @template {delta.AbstractDelta} DeltaB\n */\nexport class Binding {\n /**\n * @param {RDT} a\n * @param {RDT} b\n * @param {dt.Template} template\n */\n constructor (a, b, template) {\n /**\n * @type {dt.Transformer}\n */\n this.t = template.init()\n this.a = a\n this.b = b\n this._mux = mux.createMutex()\n this._achanged = this.a.on('change', d => this._mux(() => {\n const tres = this.t.applyA(d)\n if (tres.a) {\n a.update(tres.a)\n }\n if (tres.b) {\n b.update(tres.b)\n }\n }))\n this._bchanged = this.b.on('change', d => this._mux(() => {\n const tres = this.t.applyB(d)\n if (tres.b) {\n this.b.update(tres.b)\n }\n if (tres.a) {\n a.update(tres.a)\n }\n }))\n }\n\n destroy = () => {\n this.a.off('destroy', this.destroy)\n this.b.off('destroy', this.destroy)\n this.a.off('change', this._achanged)\n this.b.off('change', this._bchanged)\n }\n}\n\n/**\n * Abstract Interface for a delta-based Replicated Data Type.\n *\n * @template {delta.AbstractDelta} Delta\n * @typedef {ObservableV2<{ 'change': (delta: Delta) => void, 'destroy': (rdt:RDT)=>void }> & { update: (delta: Delta) => any, destroy: () => void }} RDT\n */\n\n/**\n * @template {delta.AbstractDelta} DeltaA\n * @template {dt.Template} Transformer\n * @param {RDT} a\n * @param {RDT ? DeltaB : never>} b\n * @param {dt.Template} template\n */\nexport const bind = (a, b, template) => new Binding(a, b, template)\n\n/**\n * @template {delta.AbstractDelta} Delta\n * @implements RDT\n * @extends {ObservableV2<{ change: (delta: Delta) => void, 'destroy': (rdt:DeltaRDT)=>void }>}\n */\nclass DeltaRDT extends ObservableV2 {\n /**\n * @param {Schema} $delta\n */\n constructor ($delta) {\n super()\n this.$delta = $delta\n /**\n * @type {Delta?}\n */\n this.state = null\n this._mux = mux.createMutex()\n }\n\n /**\n * @param {Delta} delta\n */\n update = delta => delta.isEmpty() || this._mux(() => {\n if (this.state != null) {\n this.state.apply(delta)\n } else {\n this.state = delta\n }\n this.emit('change', [delta])\n })\n\n destroy () {\n this.emit('destroy', [this])\n super.destroy()\n }\n}\n\n/**\n * @template {delta.AbstractDelta} Delta\n * @param {Schema} $delta\n */\nexport const deltaRDT = $delta => new DeltaRDT($delta)\n\n/**\n * @param {Node} domNode\n */\nconst domToDelta = domNode => {\n if (dom.$element.check(domNode)) {\n const d = delta.node(domNode.nodeName.toLowerCase())\n for (let i = 0; i < domNode.attributes.length; i++) {\n const attr = /** @type {Attr} */ (domNode.attributes.item(i))\n d.attributes.set(attr.nodeName, attr.value)\n }\n domNode.childNodes.forEach(child => {\n d.children.insert(dom.$text.check(child) ? child.textContent : [domToDelta(child)])\n })\n return d\n }\n error.unexpectedCase()\n}\n\n/**\n * @param {DomDelta} d\n */\nconst deltaToDom = d => {\n if (delta.$nodeAny.check(d)) {\n const n = dom.element(d.name)\n d.attributes.forEach(change => {\n if (delta.$insertOp.check(change)) {\n n.setAttribute(change.key, change.value)\n }\n })\n d.children.forEach(child => {\n if (delta.$insertOp.check(child)) {\n n.append(...child.insert.map(deltaToDom))\n } else if (delta.$textOp.check(child)) {\n n.append(dom.text(child.insert))\n }\n })\n return n\n }\n error.unexpectedCase()\n}\n\n/**\n * @param {Element} el\n * @param {delta.Node} d\n */\nconst applyDeltaToDom = (el, d) => {\n d.attributes.forEach(change => {\n if (delta.$deleteOp.check(change)) {\n el.removeAttribute(change.key)\n } else {\n el.setAttribute(change.key, change.value)\n }\n })\n let childIndex = 0\n let childOffset = 0\n d.children.forEach(change => {\n let child = el.childNodes[childIndex] || null\n if (delta.$deleteOp.check(change)) {\n let len = change.length\n while (len > 0) {\n if (dom.$element.check(child)) {\n child.remove()\n len--\n } else if (dom.$text.check(child)) {\n const childLen = child.length\n if (childOffset === 0 && childLen <= len) {\n child.remove()\n len -= childLen\n } else {\n const spliceLen = math.min(len, childLen - childOffset)\n child.deleteData(childOffset, spliceLen)\n if (child.length <= childOffset) {\n childOffset = 0\n childIndex++\n }\n }\n }\n }\n } else if (delta.$insertOp.check(change)) {\n if (childOffset > 0) {\n const tchild = dom.$text.cast(child)\n child = tchild.splitText(childOffset)\n childIndex++\n childOffset = 0\n }\n el.insertBefore(dom.fragment(change.insert.map(deltaToDom)), child)\n } else if (delta.$modifyOp.check(change)) {\n applyDeltaToDom(dom.$element.cast(child), change.modify)\n } else if (delta.$textOp.check(change)) {\n el.insertBefore(dom.text(change.insert), child)\n } else {\n error.unexpectedCase()\n }\n })\n}\n\nexport const $domDelta = delta.$node(s.$string, s.$record(s.$string, s.$string), s.$never, { recursive: true, withText: true })\n\n/**\n * @param {Element} observedNode\n * @param {MutationRecord[]} mutations\n * @param {any} origin assign this origin to the generated delta\n */\nconst _mutationsToDelta = (observedNode, mutations, origin) => {\n /**\n * @typedef {{ removedBefore: Map, added: Set, modified: number, d: delta.Node }} ChangedNodeInfo\n */\n /**\n * Compute all deltas without recursion.\n *\n * 1. mark all changed parents in parentsChanged\n * 2. fill out necessary information for each changed parent ()\n */\n //\n /**\n * @type {Map}\n */\n const changedNodes = map.create()\n /**\n * @param {Node} node\n * @return {ChangedNodeInfo}\n */\n const getChangedNodeInfo = node => map.setIfUndefined(changedNodes, node, () => ({ removedBefore: map.create(), added: set.create(), modified: 0, d: delta.node(node.nodeName.toLowerCase()) }))\n const observedNodeInfo = getChangedNodeInfo(observedNode)\n mutations.forEach(mutation => {\n const target = /** @type {HTMLElement} */ (mutation.target)\n const parent = target.parentNode\n const attrName = /** @type {string} */ (mutation.attributeName)\n const newVal = target.getAttribute(attrName)\n const info = getChangedNodeInfo(target)\n const d = info.d\n // go up the tree and mark that a child has been modified\n for (let changedParent = parent; changedParent != null && getChangedNodeInfo(changedParent).modified++ > 1 && changedParent !== observedNode; changedParent = changedParent.parentNode) {\n // nop\n }\n switch (mutation.type) {\n case 'attributes': {\n const attrs = /** @type {delta.Node} */ (d).attributes\n if (newVal == null) {\n attrs.delete(attrName)\n } else {\n attrs.set(/** @type {string} */ (attrName), newVal)\n }\n break\n }\n case 'characterData': {\n error.methodUnimplemented()\n break\n }\n case 'childList': {\n const targetInfo = getChangedNodeInfo(target)\n mutation.addedNodes.forEach(node => {\n targetInfo.added.add(node)\n })\n const removed = mutation.removedNodes.length\n if (removed > 0) {\n // @todo this can't work because next can be null\n targetInfo.removedBefore.set(mutation.nextSibling, removed)\n }\n break\n }\n }\n })\n changedNodes.forEach((info, node) => {\n const numOfChildChanges = info.modified + info.removedBefore.size + info.added.size\n const d = /** @type {delta.Node} */ (info.d)\n if (numOfChildChanges > 0) {\n node.childNodes.forEach(nchild => {\n if (info.removedBefore.has(nchild)) { // can happen separately\n d.children.delete(/** @type {number} */ (info.removedBefore.get(nchild)))\n }\n if (info.added.has(nchild)) {\n d.children.insert(dom.$text.check(nchild) ? nchild.textContent : [domToDelta(nchild)])\n } else if (changedNodes.has(nchild)) {\n d.children.modify(getChangedNodeInfo(nchild).d)\n }\n })\n // remove items to the end, if necessary\n d.children.delete(info.removedBefore.get(null) ?? 0)\n }\n d.done()\n })\n observedNodeInfo.d.origin = origin\n return observedNodeInfo.d\n}\n\n/**\n * @typedef {delta.RecursiveNode} DomDelta\n */\n\n/**\n * @template {DomDelta} [D=DomDelta]\n * @implements RDT\n * @extends {ObservableV2<{ change: (delta: D)=>void, destroy: (rdt:DomRDT)=>void }>}>}\n */\nclass DomRDT extends ObservableV2 {\n /**\n * @param {Element} observedNode\n */\n constructor (observedNode) {\n super()\n this.observedNode = observedNode\n this._mux = mux.createMutex()\n this.observer = new MutationObserver(this._mutationHandler)\n this.observer.observe(observedNode, {\n subtree: true,\n childList: true,\n attributes: true,\n characterDataOldValue: true\n })\n }\n\n /**\n * @param {MutationRecord[]} mutations\n */\n _mutationHandler = mutations =>\n mutations.length > 0 && this._mux(() => {\n this.emit('change', [/** @type {D} */(_mutationsToDelta(this.observedNode, mutations, this))])\n })\n\n /**\n * @param {D} delta\n */\n update = delta => {\n if (delta.origin !== this) {\n // @todo the retrieved changes must be transformed agains the updated changes. need a proper\n // transaction system\n this._mutationHandler(this.observer.takeRecords())\n this._mux(() => {\n applyDeltaToDom(this.observedNode, delta)\n const mutations = this.observer.takeRecords()\n this.emit('change', [/** @type {D} */(_mutationsToDelta(this.observedNode, mutations, delta.origin))])\n })\n }\n }\n\n destroy () {\n this.emit('destroy', [this])\n super.destroy()\n this.observer.disconnect()\n }\n}\n\n/**\n * @param {Element} dom\n */\nexport const domRDT = dom => new DomRDT(dom)\n"],"names":["delta.create","mux.createMutex","ObservableV2","dom.$element","delta.node","dom.$text","error.unexpectedCase","delta.$nodeAny.check","dom.element","delta.$insertOp","delta.$textOp","dom.text","delta.$deleteOp","math.min","dom.fragment","delta.$modifyOp","delta.$node","s.$string","s.$record","s.$never","map.create","map.setIfUndefined","set.create","error.methodUnimplemented"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,eAAe,GAAG,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,EAAC;AAEnD;AACQ,eAAe,CAACA,YAAY,CAAC,GAAG,CAAC,EAAE,IAAI,EAAC;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,MAAM,GAAG,CAAC,IAAI;AACpB;AACA;AACA;AACA,EAAE,MAAM,IAAI,uBAAuB,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,EAAC;AAC/D,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE;AACX,IAAI,MAAM,CAAC,+BAA+B,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,EAAC;AACtD,IAAI,CAAC,CAAC,IAAI,GAAG,IAAI,GAA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,kBAAkB,iBAAiB,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,EAAC;AAC9G,OAAO,EAAC;AACR,KAAK;AACL,GAAG;AACH;AACA,EAAE,OAAO,CAAC,GAAG;AACb,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,EAAC;AAChC,IAAI,KAAK,CAAC,OAAO,GAAE;AACnB,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,GAAE;AAC9B,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,GAAG,IAAI,IAAI,MAAM,CAAC,GAAG;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/broadcastchannel-aca4f606.cjs b/yjs-poll/node_modules/lib0/dist/broadcastchannel-aca4f606.cjs deleted file mode 100644 index 960d19c..0000000 --- a/yjs-poll/node_modules/lib0/dist/broadcastchannel-aca4f606.cjs +++ /dev/null @@ -1,128 +0,0 @@ -'use strict'; - -var map = require('./map-24d263c0.cjs'); -var set = require('./set-5b47859e.cjs'); -var buffer = require('./buffer-3e750729.cjs'); -var storage = require('./storage.cjs'); - -/* eslint-env browser */ - -/** - * @typedef {Object} Channel - * @property {Set} Channel.subs - * @property {any} Channel.bc - */ - -/** - * @type {Map} - */ -const channels = new Map(); - -/* c8 ignore start */ -class LocalStoragePolyfill { - /** - * @param {string} room - */ - constructor (room) { - this.room = room; - /** - * @type {null|function({data:Uint8Array}):void} - */ - this.onmessage = null; - /** - * @param {any} e - */ - this._onChange = e => e.key === room && this.onmessage !== null && this.onmessage({ data: buffer.fromBase64(e.newValue || '') }); - storage.onChange(this._onChange); - } - - /** - * @param {ArrayBuffer} buf - */ - postMessage (buf) { - storage.varStorage.setItem(this.room, buffer.toBase64(buffer.createUint8ArrayFromArrayBuffer(buf))); - } - - close () { - storage.offChange(this._onChange); - } -} -/* c8 ignore stop */ - -// Use BroadcastChannel or Polyfill -/* c8 ignore next */ -const BC = typeof BroadcastChannel === 'undefined' ? LocalStoragePolyfill : BroadcastChannel; - -/** - * @param {string} room - * @return {Channel} - */ -const getChannel = room => - map.setIfUndefined(channels, room, () => { - const subs = set.create(); - const bc = new BC(room); - /** - * @param {{data:ArrayBuffer}} e - */ - /* c8 ignore next */ - bc.onmessage = e => subs.forEach(sub => sub(e.data, 'broadcastchannel')); - return { - bc, subs - } - }); - -/** - * Subscribe to global `publish` events. - * - * @function - * @param {string} room - * @param {function(any, any):any} f - */ -const subscribe = (room, f) => { - getChannel(room).subs.add(f); - return f -}; - -/** - * Unsubscribe from `publish` global events. - * - * @function - * @param {string} room - * @param {function(any, any):any} f - */ -const unsubscribe = (room, f) => { - const channel = getChannel(room); - const unsubscribed = channel.subs.delete(f); - if (unsubscribed && channel.subs.size === 0) { - channel.bc.close(); - channels.delete(room); - } - return unsubscribed -}; - -/** - * Publish data to all subscribers (including subscribers on this tab) - * - * @function - * @param {string} room - * @param {any} data - * @param {any} [origin] - */ -const publish = (room, data, origin = null) => { - const c = getChannel(room); - c.bc.postMessage(data); - c.subs.forEach(sub => sub(data, origin)); -}; - -var broadcastchannel = /*#__PURE__*/Object.freeze({ - __proto__: null, - subscribe: subscribe, - unsubscribe: unsubscribe, - publish: publish -}); - -exports.broadcastchannel = broadcastchannel; -exports.publish = publish; -exports.subscribe = subscribe; -exports.unsubscribe = unsubscribe; -//# sourceMappingURL=broadcastchannel-aca4f606.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/broadcastchannel-aca4f606.cjs.map b/yjs-poll/node_modules/lib0/dist/broadcastchannel-aca4f606.cjs.map deleted file mode 100644 index f17692b..0000000 --- a/yjs-poll/node_modules/lib0/dist/broadcastchannel-aca4f606.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"broadcastchannel-aca4f606.cjs","sources":["../broadcastchannel.js"],"sourcesContent":["/* eslint-env browser */\n\n/**\n * Helpers for cross-tab communication using broadcastchannel with LocalStorage fallback.\n *\n * ```js\n * // In browser window A:\n * broadcastchannel.subscribe('my events', data => console.log(data))\n * broadcastchannel.publish('my events', 'Hello world!') // => A: 'Hello world!' fires synchronously in same tab\n *\n * // In browser window B:\n * broadcastchannel.publish('my events', 'hello from tab B') // => A: 'hello from tab B'\n * ```\n *\n * @module broadcastchannel\n */\n\n// @todo before next major: use Uint8Array instead as buffer object\n\nimport * as map from './map.js'\nimport * as set from './set.js'\nimport * as buffer from './buffer.js'\nimport * as storage from './storage.js'\n\n/**\n * @typedef {Object} Channel\n * @property {Set} Channel.subs\n * @property {any} Channel.bc\n */\n\n/**\n * @type {Map}\n */\nconst channels = new Map()\n\n/* c8 ignore start */\nclass LocalStoragePolyfill {\n /**\n * @param {string} room\n */\n constructor (room) {\n this.room = room\n /**\n * @type {null|function({data:Uint8Array}):void}\n */\n this.onmessage = null\n /**\n * @param {any} e\n */\n this._onChange = e => e.key === room && this.onmessage !== null && this.onmessage({ data: buffer.fromBase64(e.newValue || '') })\n storage.onChange(this._onChange)\n }\n\n /**\n * @param {ArrayBuffer} buf\n */\n postMessage (buf) {\n storage.varStorage.setItem(this.room, buffer.toBase64(buffer.createUint8ArrayFromArrayBuffer(buf)))\n }\n\n close () {\n storage.offChange(this._onChange)\n }\n}\n/* c8 ignore stop */\n\n// Use BroadcastChannel or Polyfill\n/* c8 ignore next */\nconst BC = typeof BroadcastChannel === 'undefined' ? LocalStoragePolyfill : BroadcastChannel\n\n/**\n * @param {string} room\n * @return {Channel}\n */\nconst getChannel = room =>\n map.setIfUndefined(channels, room, () => {\n const subs = set.create()\n const bc = new BC(room)\n /**\n * @param {{data:ArrayBuffer}} e\n */\n /* c8 ignore next */\n bc.onmessage = e => subs.forEach(sub => sub(e.data, 'broadcastchannel'))\n return {\n bc, subs\n }\n })\n\n/**\n * Subscribe to global `publish` events.\n *\n * @function\n * @param {string} room\n * @param {function(any, any):any} f\n */\nexport const subscribe = (room, f) => {\n getChannel(room).subs.add(f)\n return f\n}\n\n/**\n * Unsubscribe from `publish` global events.\n *\n * @function\n * @param {string} room\n * @param {function(any, any):any} f\n */\nexport const unsubscribe = (room, f) => {\n const channel = getChannel(room)\n const unsubscribed = channel.subs.delete(f)\n if (unsubscribed && channel.subs.size === 0) {\n channel.bc.close()\n channels.delete(room)\n }\n return unsubscribed\n}\n\n/**\n * Publish data to all subscribers (including subscribers on this tab)\n *\n * @function\n * @param {string} room\n * @param {any} data\n * @param {any} [origin]\n */\nexport const publish = (room, data, origin = null) => {\n const c = getChannel(room)\n c.bc.postMessage(data)\n c.subs.forEach(sub => sub(data, origin))\n}\n"],"names":["buffer.fromBase64","storage.onChange","storage.varStorage","buffer.toBase64","buffer.createUint8ArrayFromArrayBuffer","storage.offChange","map.setIfUndefined","set.create"],"mappings":";;;;;;;AAAA;AAuBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,QAAQ,GAAG,IAAI,GAAG,GAAE;AAC1B;AACA;AACA,MAAM,oBAAoB,CAAC;AAC3B;AACA;AACA;AACA,EAAE,WAAW,CAAC,CAAC,IAAI,EAAE;AACrB,IAAI,IAAI,CAAC,IAAI,GAAG,KAAI;AACpB;AACA;AACA;AACA,IAAI,IAAI,CAAC,SAAS,GAAG,KAAI;AACzB;AACA;AACA;AACA,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,IAAI,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAEA,iBAAiB,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,EAAC;AACpI,IAAIC,gBAAgB,CAAC,IAAI,CAAC,SAAS,EAAC;AACpC,GAAG;AACH;AACA;AACA;AACA;AACA,EAAE,WAAW,CAAC,CAAC,GAAG,EAAE;AACpB,IAAIC,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAEC,eAAe,CAACC,sC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,OAAO,CAAC,EAAE,CAAC,KAAK,GAAE;AACtB,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAC;AACzB,GAAG;AACH,EAAE,OAAO,YAAY;AACrB,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,OAAO,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK;AACtD,EAAE,MAAM,CAAC,GAAG,UAAU,CAAC,IAAI,EAAC;AAC5B,EAAE,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,EAAC;AACxB,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,EAAC;AAC1C;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/broadcastchannel.cjs b/yjs-poll/node_modules/lib0/dist/broadcastchannel.cjs deleted file mode 100644 index 18ad41d..0000000 --- a/yjs-poll/node_modules/lib0/dist/broadcastchannel.cjs +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./map-24d263c0.cjs'); -require('./set-5b47859e.cjs'); -require('./buffer-3e750729.cjs'); -require('./storage.cjs'); -var broadcastchannel = require('./broadcastchannel-aca4f606.cjs'); -require('./string-fddc5f8b.cjs'); -require('./array-78849c95.cjs'); -require('./environment-1c97264d.cjs'); -require('./conditions-f5c0c102.cjs'); -require('./function-314580f7.cjs'); -require('./object-c0c9435b.cjs'); -require('./equality.cjs'); -require('./math-96d5e8c4.cjs'); -require('./encoding-1a745c43.cjs'); -require('./number-1fb57bba.cjs'); -require('./binary-ac8e39e2.cjs'); -require('./decoding-76e75827.cjs'); -require('./error-0c1f634f.cjs'); - - - -exports.publish = broadcastchannel.publish; -exports.subscribe = broadcastchannel.subscribe; -exports.unsubscribe = broadcastchannel.unsubscribe; -//# sourceMappingURL=broadcastchannel.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/broadcastchannel.cjs.map b/yjs-poll/node_modules/lib0/dist/broadcastchannel.cjs.map deleted file mode 100644 index 77829c4..0000000 --- a/yjs-poll/node_modules/lib0/dist/broadcastchannel.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"broadcastchannel.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/broadcastchannel.d.ts b/yjs-poll/node_modules/lib0/dist/broadcastchannel.d.ts deleted file mode 100644 index d8f048e..0000000 --- a/yjs-poll/node_modules/lib0/dist/broadcastchannel.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export function subscribe(room: string, f: (arg0: any, arg1: any) => any): (arg0: any, arg1: any) => any; -export function unsubscribe(room: string, f: (arg0: any, arg1: any) => any): boolean; -export function publish(room: string, data: any, origin?: any): void; -export type Channel = { - subs: Set<(arg0: any, arg1: any) => any>; - bc: any; -}; -//# sourceMappingURL=broadcastchannel.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/broadcastchannel.d.ts.map b/yjs-poll/node_modules/lib0/dist/broadcastchannel.d.ts.map deleted file mode 100644 index 00c571a..0000000 --- a/yjs-poll/node_modules/lib0/dist/broadcastchannel.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"broadcastchannel.d.ts","sourceRoot":"","sources":["../broadcastchannel.js"],"names":[],"mappings":"AA+FO,gCAHI,MAAM,KACN,CAAS,IAAG,EAAH,GAAG,EAAE,IAAG,EAAH,GAAG,KAAE,GAAG,UAAb,GAAG,QAAE,GAAG,KAAE,GAAG,CAKhC;AASM,kCAHI,MAAM,KACN,CAAS,IAAG,EAAH,GAAG,EAAE,IAAG,EAAH,GAAG,KAAE,GAAG,WAUhC;AAUM,8BAJI,MAAM,QACN,GAAG,WACH,GAAG,QAMb;;UAvGa,GAAG,CAAC,CAAS,IAAG,EAAH,GAAG,EAAE,IAAG,EAAH,GAAG,KAAE,GAAG,CAAC;QAC3B,GAAG"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/broadcastchannel.test.d.ts b/yjs-poll/node_modules/lib0/dist/broadcastchannel.test.d.ts deleted file mode 100644 index a746c1d..0000000 --- a/yjs-poll/node_modules/lib0/dist/broadcastchannel.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testBroadcastChannel(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=broadcastchannel.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/broadcastchannel.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/broadcastchannel.test.d.ts.map deleted file mode 100644 index e42fcf1..0000000 --- a/yjs-poll/node_modules/lib0/dist/broadcastchannel.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"broadcastchannel.test.d.ts","sourceRoot":"","sources":["../broadcastchannel.test.js"],"names":[],"mappings":"AAMO,yCAFI,CAAC,CAAC,QAAQ,QAkBpB;mBAtBkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/buffer-3e750729.cjs b/yjs-poll/node_modules/lib0/dist/buffer-3e750729.cjs deleted file mode 100644 index ea76659..0000000 --- a/yjs-poll/node_modules/lib0/dist/buffer-3e750729.cjs +++ /dev/null @@ -1,198 +0,0 @@ -'use strict'; - -var string = require('./string-fddc5f8b.cjs'); -var environment = require('./environment-1c97264d.cjs'); -var array = require('./array-78849c95.cjs'); -var math = require('./math-96d5e8c4.cjs'); -var encoding = require('./encoding-1a745c43.cjs'); -var decoding = require('./decoding-76e75827.cjs'); - -/** - * Utility functions to work with buffers (Uint8Array). - * - * @module buffer - */ - -/** - * @param {number} len - */ -const createUint8ArrayFromLen = len => new Uint8Array(len); - -/** - * Create Uint8Array with initial content from buffer - * - * @param {ArrayBuffer} buffer - * @param {number} byteOffset - * @param {number} length - */ -const createUint8ArrayViewFromArrayBuffer = (buffer, byteOffset, length) => new Uint8Array(buffer, byteOffset, length); - -/** - * Create Uint8Array with initial content from buffer - * - * @param {ArrayBuffer} buffer - */ -const createUint8ArrayFromArrayBuffer = buffer => new Uint8Array(buffer); - -/* c8 ignore start */ -/** - * @param {Uint8Array} bytes - * @return {string} - */ -const toBase64Browser = bytes => { - let s = ''; - for (let i = 0; i < bytes.byteLength; i++) { - s += string.fromCharCode(bytes[i]); - } - // eslint-disable-next-line no-undef - return btoa(s) -}; -/* c8 ignore stop */ - -/** - * @param {Uint8Array} bytes - * @return {string} - */ -const toBase64Node = bytes => Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString('base64'); - -/* c8 ignore start */ -/** - * @param {string} s - * @return {Uint8Array} - */ -const fromBase64Browser = s => { - // eslint-disable-next-line no-undef - const a = atob(s); - const bytes = createUint8ArrayFromLen(a.length); - for (let i = 0; i < a.length; i++) { - bytes[i] = a.charCodeAt(i); - } - return bytes -}; -/* c8 ignore stop */ - -/** - * @param {string} s - */ -const fromBase64Node = s => { - const buf = Buffer.from(s, 'base64'); - return createUint8ArrayViewFromArrayBuffer(buf.buffer, buf.byteOffset, buf.byteLength) -}; - -/* c8 ignore next */ -const toBase64 = environment.isBrowser ? toBase64Browser : toBase64Node; - -/* c8 ignore next */ -const fromBase64 = environment.isBrowser ? fromBase64Browser : fromBase64Node; - -/** - * Implements base64url - see https://datatracker.ietf.org/doc/html/rfc4648#section-5 - * @param {Uint8Array} buf - */ -const toBase64UrlEncoded = buf => toBase64(buf).replaceAll('+', '-').replaceAll('/', '_').replaceAll('=', ''); - -/** - * @param {string} base64 - */ -const fromBase64UrlEncoded = base64 => fromBase64(base64.replaceAll('-', '+').replaceAll('_', '/')); - -/** - * Base64 is always a more efficient choice. This exists for utility purposes only. - * - * @param {Uint8Array} buf - */ -const toHexString = buf => array.map(buf, b => b.toString(16).padStart(2, '0')).join(''); - -/** - * Note: This function expects that the hex doesn't start with 0x.. - * - * @param {string} hex - */ -const fromHexString = hex => { - const hlen = hex.length; - const buf = new Uint8Array(math.ceil(hlen / 2)); - for (let i = 0; i < hlen; i += 2) { - buf[buf.length - i / 2 - 1] = Number.parseInt(hex.slice(hlen - i - 2, hlen - i), 16); - } - return buf -}; - -/** - * Copy the content of an Uint8Array view to a new ArrayBuffer. - * - * @param {Uint8Array} uint8Array - * @return {Uint8Array} - */ -const copyUint8Array = uint8Array => { - const newBuf = createUint8ArrayFromLen(uint8Array.byteLength); - newBuf.set(uint8Array); - return newBuf -}; - -/** - * Encode anything as a UInt8Array. It's a pun on typescripts's `any` type. - * See encoding.writeAny for more information. - * - * @param {any} data - * @return {Uint8Array} - */ -const encodeAny = data => - encoding.encode(encoder => encoding.writeAny(encoder, data)); - -/** - * Decode an any-encoded value. - * - * @param {Uint8Array} buf - * @return {any} - */ -const decodeAny = buf => decoding.readAny(decoding.createDecoder(buf)); - -/** - * Shift Byte Array {N} bits to the left. Does not expand byte array. - * - * @param {Uint8Array} bs - * @param {number} N should be in the range of [0-7] - */ -const shiftNBitsLeft = (bs, N) => { - if (N === 0) return bs - bs = new Uint8Array(bs); - bs[0] <<= N; - for (let i = 1; i < bs.length; i++) { - bs[i - 1] |= bs[i] >>> (8 - N); - bs[i] <<= N; - } - return bs -}; - -var buffer = /*#__PURE__*/Object.freeze({ - __proto__: null, - createUint8ArrayFromLen: createUint8ArrayFromLen, - createUint8ArrayViewFromArrayBuffer: createUint8ArrayViewFromArrayBuffer, - createUint8ArrayFromArrayBuffer: createUint8ArrayFromArrayBuffer, - toBase64: toBase64, - fromBase64: fromBase64, - toBase64UrlEncoded: toBase64UrlEncoded, - fromBase64UrlEncoded: fromBase64UrlEncoded, - toHexString: toHexString, - fromHexString: fromHexString, - copyUint8Array: copyUint8Array, - encodeAny: encodeAny, - decodeAny: decodeAny, - shiftNBitsLeft: shiftNBitsLeft -}); - -exports.buffer = buffer; -exports.copyUint8Array = copyUint8Array; -exports.createUint8ArrayFromArrayBuffer = createUint8ArrayFromArrayBuffer; -exports.createUint8ArrayFromLen = createUint8ArrayFromLen; -exports.createUint8ArrayViewFromArrayBuffer = createUint8ArrayViewFromArrayBuffer; -exports.decodeAny = decodeAny; -exports.encodeAny = encodeAny; -exports.fromBase64 = fromBase64; -exports.fromBase64UrlEncoded = fromBase64UrlEncoded; -exports.fromHexString = fromHexString; -exports.shiftNBitsLeft = shiftNBitsLeft; -exports.toBase64 = toBase64; -exports.toBase64UrlEncoded = toBase64UrlEncoded; -exports.toHexString = toHexString; -//# sourceMappingURL=buffer-3e750729.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/buffer-3e750729.cjs.map b/yjs-poll/node_modules/lib0/dist/buffer-3e750729.cjs.map deleted file mode 100644 index f355adb..0000000 --- a/yjs-poll/node_modules/lib0/dist/buffer-3e750729.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"buffer-3e750729.cjs","sources":["../buffer.js"],"sourcesContent":["/**\n * Utility functions to work with buffers (Uint8Array).\n *\n * @module buffer\n */\n\nimport * as string from './string.js'\nimport * as env from './environment.js'\nimport * as array from './array.js'\nimport * as math from './math.js'\nimport * as encoding from './encoding.js'\nimport * as decoding from './decoding.js'\n\n/**\n * @param {number} len\n */\nexport const createUint8ArrayFromLen = len => new Uint8Array(len)\n\n/**\n * Create Uint8Array with initial content from buffer\n *\n * @param {ArrayBuffer} buffer\n * @param {number} byteOffset\n * @param {number} length\n */\nexport const createUint8ArrayViewFromArrayBuffer = (buffer, byteOffset, length) => new Uint8Array(buffer, byteOffset, length)\n\n/**\n * Create Uint8Array with initial content from buffer\n *\n * @param {ArrayBuffer} buffer\n */\nexport const createUint8ArrayFromArrayBuffer = buffer => new Uint8Array(buffer)\n\n/* c8 ignore start */\n/**\n * @param {Uint8Array} bytes\n * @return {string}\n */\nconst toBase64Browser = bytes => {\n let s = ''\n for (let i = 0; i < bytes.byteLength; i++) {\n s += string.fromCharCode(bytes[i])\n }\n // eslint-disable-next-line no-undef\n return btoa(s)\n}\n/* c8 ignore stop */\n\n/**\n * @param {Uint8Array} bytes\n * @return {string}\n */\nconst toBase64Node = bytes => Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString('base64')\n\n/* c8 ignore start */\n/**\n * @param {string} s\n * @return {Uint8Array}\n */\nconst fromBase64Browser = s => {\n // eslint-disable-next-line no-undef\n const a = atob(s)\n const bytes = createUint8ArrayFromLen(a.length)\n for (let i = 0; i < a.length; i++) {\n bytes[i] = a.charCodeAt(i)\n }\n return bytes\n}\n/* c8 ignore stop */\n\n/**\n * @param {string} s\n */\nconst fromBase64Node = s => {\n const buf = Buffer.from(s, 'base64')\n return createUint8ArrayViewFromArrayBuffer(buf.buffer, buf.byteOffset, buf.byteLength)\n}\n\n/* c8 ignore next */\nexport const toBase64 = env.isBrowser ? toBase64Browser : toBase64Node\n\n/* c8 ignore next */\nexport const fromBase64 = env.isBrowser ? fromBase64Browser : fromBase64Node\n\n/**\n * Implements base64url - see https://datatracker.ietf.org/doc/html/rfc4648#section-5\n * @param {Uint8Array} buf\n */\nexport const toBase64UrlEncoded = buf => toBase64(buf).replaceAll('+', '-').replaceAll('/', '_').replaceAll('=', '')\n\n/**\n * @param {string} base64\n */\nexport const fromBase64UrlEncoded = base64 => fromBase64(base64.replaceAll('-', '+').replaceAll('_', '/'))\n\n/**\n * Base64 is always a more efficient choice. This exists for utility purposes only.\n *\n * @param {Uint8Array} buf\n */\nexport const toHexString = buf => array.map(buf, b => b.toString(16).padStart(2, '0')).join('')\n\n/**\n * Note: This function expects that the hex doesn't start with 0x..\n *\n * @param {string} hex\n */\nexport const fromHexString = hex => {\n const hlen = hex.length\n const buf = new Uint8Array(math.ceil(hlen / 2))\n for (let i = 0; i < hlen; i += 2) {\n buf[buf.length - i / 2 - 1] = Number.parseInt(hex.slice(hlen - i - 2, hlen - i), 16)\n }\n return buf\n}\n\n/**\n * Copy the content of an Uint8Array view to a new ArrayBuffer.\n *\n * @param {Uint8Array} uint8Array\n * @return {Uint8Array}\n */\nexport const copyUint8Array = uint8Array => {\n const newBuf = createUint8ArrayFromLen(uint8Array.byteLength)\n newBuf.set(uint8Array)\n return newBuf\n}\n\n/**\n * Encode anything as a UInt8Array. It's a pun on typescripts's `any` type.\n * See encoding.writeAny for more information.\n *\n * @param {any} data\n * @return {Uint8Array}\n */\nexport const encodeAny = data =>\n encoding.encode(encoder => encoding.writeAny(encoder, data))\n\n/**\n * Decode an any-encoded value.\n *\n * @param {Uint8Array} buf\n * @return {any}\n */\nexport const decodeAny = buf => decoding.readAny(decoding.createDecoder(buf))\n\n/**\n * Shift Byte Array {N} bits to the left. Does not expand byte array.\n *\n * @param {Uint8Array} bs\n * @param {number} N should be in the range of [0-7]\n */\nexport const shiftNBitsLeft = (bs, N) => {\n if (N === 0) return bs\n bs = new Uint8Array(bs)\n bs[0] <<= N\n for (let i = 1; i < bs.length; i++) {\n bs[i - 1] |= bs[i] >>> (8 - N)\n bs[i] <<= N\n }\n return bs\n}\n"],"names":["string.fromCharCode","env.isBrowser","array.map","math.ceil","encoding.encode","encoding.writeAny","decoding.readAny","decoding.createDecoder"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACY,MAAC,uBAAuB,GAAG,GAAG,IAAI,IAAI,UAAU,CAAC,GAAG,EAAC;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,mCAAmC,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAC;AAC7H;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,+BAA+B,GAAG,MAAM,IAAI,IAAI,UAAU,CAAC,MAAM,EAAC;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,eAAe,GAAG,KAAK,IAAI;AACjC,EAAE,IAAI,CAAC,GAAG,GAAE;AACZ,EAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,G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BAAuB,CAAC,UAAU,CAAC,UAAU,EAAC;AAC/D,EAAE,MAAM,CAAC,GAAG,CAAC,UAAU,EAAC;AACxB,EAAE,OAAO,MAAM;AACf,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,SAAS,GAAG,IAAI;AAC7B,EAAEC,eAAe,CAAC,OAAO,IAAIC,iBAAiB,CAAC,OAAO,EAAE,IAAI,CAAC,EAAC;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,SAAS,GAAG,GAAG,IAAIC,gBAAgB,CAACC,sBAAsB,CAAC,GAAG,CAAC,EAAC;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAG,CAAC,EAAE,EAAE,CAAC,KAAK;AACzC,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE;AACxB,EAAE,EAAE,GAAG,IAAI,UAAU,CAAC,EAAE,EAAC;AACzB,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,EAAC;AACb,EAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACtC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAC;AAClC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,EAAC;AACf,GAAG;AACH,EAAE,OAAO,EAAE;AACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/buffer.cjs b/yjs-poll/node_modules/lib0/dist/buffer.cjs deleted file mode 100644 index 84222ff..0000000 --- a/yjs-poll/node_modules/lib0/dist/buffer.cjs +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./string-fddc5f8b.cjs'); -require('./environment-1c97264d.cjs'); -require('./array-78849c95.cjs'); -require('./math-96d5e8c4.cjs'); -require('./encoding-1a745c43.cjs'); -require('./decoding-76e75827.cjs'); -var buffer = require('./buffer-3e750729.cjs'); -require('./map-24d263c0.cjs'); -require('./conditions-f5c0c102.cjs'); -require('./storage.cjs'); -require('./function-314580f7.cjs'); -require('./object-c0c9435b.cjs'); -require('./equality.cjs'); -require('./set-5b47859e.cjs'); -require('./number-1fb57bba.cjs'); -require('./binary-ac8e39e2.cjs'); -require('./error-0c1f634f.cjs'); - - - -exports.copyUint8Array = buffer.copyUint8Array; -exports.createUint8ArrayFromArrayBuffer = buffer.createUint8ArrayFromArrayBuffer; -exports.createUint8ArrayFromLen = buffer.createUint8ArrayFromLen; -exports.createUint8ArrayViewFromArrayBuffer = buffer.createUint8ArrayViewFromArrayBuffer; -exports.decodeAny = buffer.decodeAny; -exports.encodeAny = buffer.encodeAny; -exports.fromBase64 = buffer.fromBase64; -exports.fromBase64UrlEncoded = buffer.fromBase64UrlEncoded; -exports.fromHexString = buffer.fromHexString; -exports.shiftNBitsLeft = buffer.shiftNBitsLeft; -exports.toBase64 = buffer.toBase64; -exports.toBase64UrlEncoded = buffer.toBase64UrlEncoded; -exports.toHexString = buffer.toHexString; -//# sourceMappingURL=buffer.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/buffer.cjs.map b/yjs-poll/node_modules/lib0/dist/buffer.cjs.map deleted file mode 100644 index ce79402..0000000 --- a/yjs-poll/node_modules/lib0/dist/buffer.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"buffer.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/buffer.d.ts b/yjs-poll/node_modules/lib0/dist/buffer.d.ts deleted file mode 100644 index 2f27c30..0000000 --- a/yjs-poll/node_modules/lib0/dist/buffer.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -export function createUint8ArrayFromLen(len: number): Uint8Array; -export function createUint8ArrayViewFromArrayBuffer(buffer: ArrayBuffer, byteOffset: number, length: number): Uint8Array; -export function createUint8ArrayFromArrayBuffer(buffer: ArrayBuffer): Uint8Array; -/** - * @param {Uint8Array} bytes - * @return {string} - */ -export function toBase64(bytes: Uint8Array): string; -/** - * @param {string} s - * @return {Uint8Array} - */ -export function fromBase64(s: string): Uint8Array; -export function toBase64UrlEncoded(buf: Uint8Array): string; -export function fromBase64UrlEncoded(base64: string): Uint8Array; -export function toHexString(buf: Uint8Array): string; -export function fromHexString(hex: string): Uint8Array; -export function copyUint8Array(uint8Array: Uint8Array): Uint8Array; -export function encodeAny(data: any): Uint8Array; -export function decodeAny(buf: Uint8Array): any; -export function shiftNBitsLeft(bs: Uint8Array, N: number): Uint8Array; -//# sourceMappingURL=buffer.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/buffer.d.ts.map b/yjs-poll/node_modules/lib0/dist/buffer.d.ts.map deleted file mode 100644 index a51b03a..0000000 --- a/yjs-poll/node_modules/lib0/dist/buffer.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../buffer.js"],"names":[],"mappings":"AAgBO,6CAFI,MAAM,2BAEgD;AAS1D,4DAJI,WAAW,cACX,MAAM,UACN,MAAM,2BAE4G;AAOtH,wDAFI,WAAW,2BAEyD;AAG/E;;;GAGG;AACH,gCAHW,UAAU,GACT,MAAM,CASjB;AAUD;;;GAGG;AACH,8BAHW,MAAM,GACL,UAAU,CAAC,WAAW,CAAC,CAUlC;AAqBM,wCAFI,UAAU,UAE+F;AAK7G,6CAFI,MAAM,2BAEyF;AAOnG,iCAFI,UAAU,UAE0E;AAOxF,mCAFI,MAAM,2BAShB;AAQM,2CAHI,UAAU,GACT,UAAU,CAMrB;AASM,gCAHI,GAAG,GACF,UAAU,CAGwC;AAQvD,+BAHI,UAAU,GACT,GAAG,CAE8D;AAQtE,mCAHI,UAAU,KACV,MAAM,+BAWhB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/buffer.test.d.ts b/yjs-poll/node_modules/lib0/dist/buffer.test.d.ts deleted file mode 100644 index 0bd7014..0000000 --- a/yjs-poll/node_modules/lib0/dist/buffer.test.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export function testRepeatBase64urlEncoding(tc: t.TestCase): void; -export function testRepeatBase64Encoding(tc: t.TestCase): void; -export function testRepeatHexEncoding(tc: t.TestCase): void; -export function testAnyEncoding(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=buffer.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/buffer.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/buffer.test.d.ts.map deleted file mode 100644 index 5b23123..0000000 --- a/yjs-poll/node_modules/lib0/dist/buffer.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"buffer.test.d.ts","sourceRoot":"","sources":["../buffer.test.js"],"names":[],"mappings":"AA2BO,gDAFI,CAAC,CAAC,QAAQ,QAIpB;AAKM,6CAFI,CAAC,CAAC,QAAQ,QAIpB;AAKM,0CAFI,CAAC,CAAC,QAAQ,QAIpB;AAKM,qCAFI,CAAC,CAAC,QAAQ,QAMpB;mBApDkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/cache.cjs b/yjs-poll/node_modules/lib0/dist/cache.cjs deleted file mode 100644 index fe8908a..0000000 --- a/yjs-poll/node_modules/lib0/dist/cache.cjs +++ /dev/null @@ -1,223 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var list = require('./list.cjs'); -var map = require('./map-24d263c0.cjs'); -var time = require('./time-d8438852.cjs'); -require('./function-314580f7.cjs'); -require('./array-78849c95.cjs'); -require('./set-5b47859e.cjs'); -require('./object-c0c9435b.cjs'); -require('./equality.cjs'); -require('./error-0c1f634f.cjs'); -require('./metric.cjs'); -require('./math-96d5e8c4.cjs'); - -/* eslint-env browser */ - -/** - * @template K, V - * - * @implements {list.ListNode} - */ -class Entry { - /** - * @param {K} key - * @param {V | Promise} val - */ - constructor (key, val) { - /** - * @type {this | null} - */ - this.prev = null; - /** - * @type {this | null} - */ - this.next = null; - this.created = time.getUnixTime(); - this.val = val; - this.key = key; - } -} - -/** - * @template K, V - */ -class Cache { - /** - * @param {number} timeout - */ - constructor (timeout) { - this.timeout = timeout; - /** - * @type list.List> - */ - this._q = list.create(); - /** - * @type {Map>} - */ - this._map = map.create(); - } -} - -/** - * @template K, V - * - * @param {Cache} cache - * @return {number} Returns the current timestamp - */ -const removeStale = cache => { - const now = time.getUnixTime(); - const q = cache._q; - while (q.start && now - q.start.created > cache.timeout) { - cache._map.delete(q.start.key); - list.popFront(q); - } - return now -}; - -/** - * @template K, V - * - * @param {Cache} cache - * @param {K} key - * @param {V} value - */ -const set = (cache, key, value) => { - const now = removeStale(cache); - const q = cache._q; - const n = cache._map.get(key); - if (n) { - list.removeNode(q, n); - list.pushEnd(q, n); - n.created = now; - n.val = value; - } else { - const node = new Entry(key, value); - list.pushEnd(q, node); - cache._map.set(key, node); - } -}; - -/** - * @template K, V - * - * @param {Cache} cache - * @param {K} key - * @return {Entry | undefined} - */ -const getNode = (cache, key) => { - removeStale(cache); - const n = cache._map.get(key); - if (n) { - return n - } -}; - -/** - * @template K, V - * - * @param {Cache} cache - * @param {K} key - * @return {V | undefined} - */ -const get = (cache, key) => { - const n = getNode(cache, key); - return n && !(n.val instanceof Promise) ? n.val : undefined -}; - -/** - * @template K, V - * - * @param {Cache} cache - * @param {K} key - */ -const refreshTimeout = (cache, key) => { - const now = time.getUnixTime(); - const q = cache._q; - const n = cache._map.get(key); - if (n) { - list.removeNode(q, n); - list.pushEnd(q, n); - n.created = now; - } -}; - -/** - * Works well in conjunktion with setIfUndefined which has an async init function. - * Using getAsync & setIfUndefined ensures that the init function is only called once. - * - * @template K, V - * - * @param {Cache} cache - * @param {K} key - * @return {V | Promise | undefined} - */ -const getAsync = (cache, key) => { - const n = getNode(cache, key); - return n ? n.val : undefined -}; - -/** - * @template K, V - * - * @param {Cache} cache - * @param {K} key - */ -const remove = (cache, key) => { - const n = cache._map.get(key); - if (n) { - list.removeNode(cache._q, n); - cache._map.delete(key); - return n.val && !(n.val instanceof Promise) ? n.val : undefined - } -}; - -/** - * @template K, V - * - * @param {Cache} cache - * @param {K} key - * @param {function():Promise} init - * @param {boolean} removeNull Optional argument that automatically removes values that resolve to null/undefined from the cache. - * @return {Promise | V} - */ -const setIfUndefined = (cache, key, init, removeNull = false) => { - removeStale(cache); - const q = cache._q; - const n = cache._map.get(key); - if (n) { - return n.val - } else { - const p = init(); - const node = new Entry(key, p); - list.pushEnd(q, node); - cache._map.set(key, node); - p.then(v => { - if (p === node.val) { - node.val = v; - } - if (removeNull && v == null) { - remove(cache, key); - } - }); - return p - } -}; - -/** - * @param {number} timeout - */ -const create = timeout => new Cache(timeout); - -exports.Cache = Cache; -exports.create = create; -exports.get = get; -exports.getAsync = getAsync; -exports.refreshTimeout = refreshTimeout; -exports.remove = remove; -exports.removeStale = removeStale; -exports.set = set; -exports.setIfUndefined = setIfUndefined; -//# sourceMappingURL=cache.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/cache.cjs.map b/yjs-poll/node_modules/lib0/dist/cache.cjs.map deleted file mode 100644 index 81dc848..0000000 --- a/yjs-poll/node_modules/lib0/dist/cache.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cache.cjs","sources":["../cache.js"],"sourcesContent":["/* eslint-env browser */\n\n/**\n * An implementation of a map which has keys that expire.\n *\n * @module cache\n */\n\nimport * as list from './list.js'\nimport * as map from './map.js'\nimport * as time from './time.js'\n\n/**\n * @template K, V\n *\n * @implements {list.ListNode}\n */\nclass Entry {\n /**\n * @param {K} key\n * @param {V | Promise} val\n */\n constructor (key, val) {\n /**\n * @type {this | null}\n */\n this.prev = null\n /**\n * @type {this | null}\n */\n this.next = null\n this.created = time.getUnixTime()\n this.val = val\n this.key = key\n }\n}\n\n/**\n * @template K, V\n */\nexport class Cache {\n /**\n * @param {number} timeout\n */\n constructor (timeout) {\n this.timeout = timeout\n /**\n * @type list.List>\n */\n this._q = list.create()\n /**\n * @type {Map>}\n */\n this._map = map.create()\n }\n}\n\n/**\n * @template K, V\n *\n * @param {Cache} cache\n * @return {number} Returns the current timestamp\n */\nexport const removeStale = cache => {\n const now = time.getUnixTime()\n const q = cache._q\n while (q.start && now - q.start.created > cache.timeout) {\n cache._map.delete(q.start.key)\n list.popFront(q)\n }\n return now\n}\n\n/**\n * @template K, V\n *\n * @param {Cache} cache\n * @param {K} key\n * @param {V} value\n */\nexport const set = (cache, key, value) => {\n const now = removeStale(cache)\n const q = cache._q\n const n = cache._map.get(key)\n if (n) {\n list.removeNode(q, n)\n list.pushEnd(q, n)\n n.created = now\n n.val = value\n } else {\n const node = new Entry(key, value)\n list.pushEnd(q, node)\n cache._map.set(key, node)\n }\n}\n\n/**\n * @template K, V\n *\n * @param {Cache} cache\n * @param {K} key\n * @return {Entry | undefined}\n */\nconst getNode = (cache, key) => {\n removeStale(cache)\n const n = cache._map.get(key)\n if (n) {\n return n\n }\n}\n\n/**\n * @template K, V\n *\n * @param {Cache} cache\n * @param {K} key\n * @return {V | undefined}\n */\nexport const get = (cache, key) => {\n const n = getNode(cache, key)\n return n && !(n.val instanceof Promise) ? n.val : undefined\n}\n\n/**\n * @template K, V\n *\n * @param {Cache} cache\n * @param {K} key\n */\nexport const refreshTimeout = (cache, key) => {\n const now = time.getUnixTime()\n const q = cache._q\n const n = cache._map.get(key)\n if (n) {\n list.removeNode(q, n)\n list.pushEnd(q, n)\n n.created = now\n }\n}\n\n/**\n * Works well in conjunktion with setIfUndefined which has an async init function.\n * Using getAsync & setIfUndefined ensures that the init function is only called once.\n *\n * @template K, V\n *\n * @param {Cache} cache\n * @param {K} key\n * @return {V | Promise | undefined}\n */\nexport const getAsync = (cache, key) => {\n const n = getNode(cache, key)\n return n ? n.val : undefined\n}\n\n/**\n * @template K, V\n *\n * @param {Cache} cache\n * @param {K} key\n */\nexport const remove = (cache, key) => {\n const n = cache._map.get(key)\n if (n) {\n list.removeNode(cache._q, n)\n cache._map.delete(key)\n return n.val && !(n.val instanceof Promise) ? n.val : undefined\n }\n}\n\n/**\n * @template K, V\n *\n * @param {Cache} cache\n * @param {K} key\n * @param {function():Promise} init\n * @param {boolean} removeNull Optional argument that automatically removes values that resolve to null/undefined from the cache.\n * @return {Promise | V}\n */\nexport const setIfUndefined = (cache, key, init, removeNull = false) => {\n removeStale(cache)\n const q = cache._q\n const n = cache._map.get(key)\n if (n) {\n return n.val\n } else {\n const p = init()\n const node = new Entry(key, p)\n list.pushEnd(q, node)\n cache._map.set(key, node)\n p.then(v => {\n if (p === node.val) {\n node.val = v\n }\n if (removeNull && v == null) {\n remove(cache, key)\n }\n })\n return p\n }\n}\n\n/**\n * @param {number} timeout\n */\nexport const create = timeout => new Cache(timeout)\n"],"names":["time.getUnixTime","list.create","map.create","list.popFront","list.removeNode","list.pushEnd"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,KAAK,CAAC;AACZ;AACA;AACA;AACA;AACA,EAAE,WAAW,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE;AACzB;AACA;AACA;AACA,IAAI,IAAI,CAAC,IAAI,GAAG,KAAI;AACpB;AACA;AACA;AACA,IAAI,IAAI,CAAC,IAAI,GAAG,KAAI;AACpB,IAAI,IAAI,CAAC,OAAO,GAAGA,gBAAgB,GAAE;AACrC,IAAI,IAAI,CAAC,GAAG,GAAG,IAAG;AAClB,IAAI,IAAI,CAAC,GAAG,GAAG,IAAG;AAClB,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACO,MAAM,KAAK,CAAC;AACnB;AACA;AACA;AACA,EAAE,WAAW,CAAC,CAAC,OAAO,EAAE;AACxB,IAAI,IAAI,CAAC,OAAO,GAA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CAAC,CAAC,IAAI,CAAC,CAAC,IAAI;AAChB,MAAM,IAAI,CAAC,KAAK,IAAI,CAAC,GAAG,EAAE;AAC1B,QAAQ,IAAI,CAAC,GAAG,GAAG,EAAC;AACpB,OAAO;AACP,MAAM,IAAI,UAAU,IAAI,CAAC,IAAI,IAAI,EAAE;AACnC,QAAQ,MAAM,CAAC,KAAK,EAAE,GAAG,EAAC;AAC1B,OAAO;AACP,KAAK,EAAC;AACN,IAAI,OAAO,CAAC;AACZ,GAAG;AACH,EAAC;AACD;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,OAAO,IAAI,IAAI,KAAK,CAAC,OAAO;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/cache.d.ts b/yjs-poll/node_modules/lib0/dist/cache.d.ts deleted file mode 100644 index 3317bc2..0000000 --- a/yjs-poll/node_modules/lib0/dist/cache.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @template K, V - */ -export class Cache { - /** - * @param {number} timeout - */ - constructor(timeout: number); - timeout: number; - /** - * @type list.List> - */ - _q: list.List>; - /** - * @type {Map>} - */ - _map: Map>; -} -export function removeStale(cache: Cache): number; -export function set(cache: Cache, key: K, value: V): void; -export function get(cache: Cache, key: K): V | undefined; -export function refreshTimeout(cache: Cache, key: K): void; -export function getAsync(cache: Cache, key: K): V | Promise | undefined; -export function remove(cache: Cache, key: K): NonNullable | undefined; -export function setIfUndefined(cache: Cache, key: K, init: () => Promise, removeNull?: boolean): Promise | V; -export function create(timeout: number): Cache; -import * as list from './list.js'; -/** - * @template K, V - * - * @implements {list.ListNode} - */ -declare class Entry implements list.ListNode { - /** - * @param {K} key - * @param {V | Promise} val - */ - constructor(key: K, val: V | Promise); - /** - * @type {this | null} - */ - prev: this | null; - /** - * @type {this | null} - */ - next: this | null; - created: number; - val: V | Promise; - key: K; -} -export {}; -//# sourceMappingURL=cache.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/cache.d.ts.map b/yjs-poll/node_modules/lib0/dist/cache.d.ts.map deleted file mode 100644 index c2505aa..0000000 --- a/yjs-poll/node_modules/lib0/dist/cache.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../cache.js"],"names":[],"mappings":"AAqCA;;GAEG;AACH,mBAFa,CAAC,EAAE,CAAC;IAGf;;OAEG;IACH,qBAFW,MAAM,EAYhB;IATC,gBAAsB;IACtB;;OAEG;IACH,IAFS,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAER;IACvB;;OAEG;IACH,MAFU,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAEL;CAE3B;AAQM,4BALM,CAAC,EAAE,CAAC,SAEN,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GACV,MAAM,CAUjB;AASM,oBANM,CAAC,EAAE,CAAC,SAEN,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,OACX,CAAC,SACD,CAAC,QAgBX;AAwBM,oBANM,CAAC,EAAE,CAAC,SAEN,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,OACX,CAAC,GACA,CAAC,GAAG,SAAS,CAKxB;AAQM,+BALM,CAAC,EAAE,CAAC,SAEN,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,OACX,CAAC,QAWX;AAYM,yBANM,CAAC,EAAE,CAAC,SAEN,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,OACX,CAAC,GACA,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,CAKrC;AAQM,uBALM,CAAC,EAAE,CAAC,SAEN,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,OACX,CAAC,8BASX;AAWM,+BARM,CAAC,EAAE,CAAC,SAEN,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,OACX,CAAC,QACD,MAAW,OAAO,CAAC,CAAC,CAAC,eACrB,OAAO,GACN,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAuBzB;AAKM,gCAFI,MAAM,mBAEkC;sBArM7B,WAAW;AAIjC;;;;GAIG;AACH,oBAJa,CAAC,EAAE,CAAC,aAED,IAAI,CAAC,QAAQ;IAG3B;;;OAGG;IACH,iBAHW,CAAC,OACD,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAcxB;IAXC;;OAEG;IACH,MAFU,IAAI,GAAG,IAAI,CAEL;IAChB;;OAEG;IACH,MAFU,IAAI,GAAG,IAAI,CAEL;IAChB,gBAAiC;IACjC,oBAAc;IACd,OAAc;CAEjB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/cache.test.d.ts b/yjs-poll/node_modules/lib0/dist/cache.test.d.ts deleted file mode 100644 index 693e0d4..0000000 --- a/yjs-poll/node_modules/lib0/dist/cache.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testCache(tc: t.TestCase): Promise; -import * as t from './testing.js'; -//# sourceMappingURL=cache.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/cache.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/cache.test.d.ts.map deleted file mode 100644 index 2b7d5f8..0000000 --- a/yjs-poll/node_modules/lib0/dist/cache.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cache.test.d.ts","sourceRoot":"","sources":["../cache.test.js"],"names":[],"mappings":"AAOO,8BAFI,CAAC,CAAC,QAAQ,iBA6EpB;mBAlFkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/common.cjs b/yjs-poll/node_modules/lib0/dist/common.cjs deleted file mode 100644 index 5936706..0000000 --- a/yjs-poll/node_modules/lib0/dist/common.cjs +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var webcrypto = require('lib0/webcrypto'); - -function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n["default"] = e; - return Object.freeze(n); -} - -var webcrypto__namespace = /*#__PURE__*/_interopNamespace(webcrypto); - -/** - * @param {CryptoKey} key - */ -const exportKeyJwk = async key => { - const jwk = await webcrypto__namespace.subtle.exportKey('jwk', key); - jwk.key_ops = key.usages; - return jwk -}; - -/** - * Only suited for exporting public keys. - * - * @param {CryptoKey} key - * @return {Promise>} - */ -const exportKeyRaw = key => - webcrypto__namespace.subtle.exportKey('raw', key).then(key => new Uint8Array(key)); - -exports.exportKeyJwk = exportKeyJwk; -exports.exportKeyRaw = exportKeyRaw; -//# sourceMappingURL=common.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/common.cjs.map b/yjs-poll/node_modules/lib0/dist/common.cjs.map deleted file mode 100644 index bc9fa8e..0000000 --- a/yjs-poll/node_modules/lib0/dist/common.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"common.cjs","sources":["../crypto/common.js"],"sourcesContent":["import * as webcrypto from 'lib0/webcrypto'\n\n/**\n * @param {CryptoKey} key\n */\nexport const exportKeyJwk = async key => {\n const jwk = await webcrypto.subtle.exportKey('jwk', key)\n jwk.key_ops = key.usages\n return jwk\n}\n\n/**\n * Only suited for exporting public keys.\n *\n * @param {CryptoKey} key\n * @return {Promise>}\n */\nexport const exportKeyRaw = key =>\n webcrypto.subtle.exportKey('raw', key).then(key => new Uint8Array(key))\n"],"names":["webcrypto"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACY,MAAC,YAAY,GAAG,MAAM,GAAG,IAAI;AACzC,EAAE,MAAM,GAAG,GAAG,MAAMA,oBAAS,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,EAAC;AAC1D,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAM;AAC1B,EAAE,OAAO,GAAG;AACZ,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,YAAY,GAAG,GAAG;AAC/B,EAAEA,oBAAS,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,UAAU,CAAC,GAAG,CAAC;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/component.cjs b/yjs-poll/node_modules/lib0/dist/component.cjs deleted file mode 100644 index a7b903b..0000000 --- a/yjs-poll/node_modules/lib0/dist/component.cjs +++ /dev/null @@ -1,437 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var dom = require('./dom-7e625b09.cjs'); -var diff = require('./diff-9d236524.cjs'); -var object = require('./object-c0c9435b.cjs'); -var json = require('./json-092190a1.cjs'); -var string = require('./string-fddc5f8b.cjs'); -var array = require('./array-78849c95.cjs'); -var number = require('./number-1fb57bba.cjs'); -var _function = require('./function-314580f7.cjs'); -require('./pair-ab022bc3.cjs'); -require('./map-24d263c0.cjs'); -require('./schema.cjs'); -require('./error-0c1f634f.cjs'); -require('./environment-1c97264d.cjs'); -require('./conditions-f5c0c102.cjs'); -require('./storage.cjs'); -require('./equality.cjs'); -require('./prng-37d48618.cjs'); -require('./binary-ac8e39e2.cjs'); -require('./math-96d5e8c4.cjs'); -require('./buffer-3e750729.cjs'); -require('./encoding-1a745c43.cjs'); -require('./decoding-76e75827.cjs'); -require('./set-5b47859e.cjs'); - -/* eslint-env browser */ - -/** - * @type {CustomElementRegistry} - */ -const registry = customElements; - -/** - * @param {string} name - * @param {any} constr - * @param {ElementDefinitionOptions} [opts] - */ -const define = (name, constr, opts) => registry.define(name, constr, opts); - -/** - * @param {string} name - * @return {Promise} - */ -const whenDefined = name => registry.whenDefined(name); - -const upgradedEventName = 'upgraded'; -const connectedEventName = 'connected'; -const disconnectedEventName = 'disconnected'; - -/** - * @template S - */ -class Lib0Component extends HTMLElement { - /** - * @param {S} [state] - */ - constructor (state) { - super(); - /** - * @type {S|null} - */ - this.state = /** @type {any} */ (state); - /** - * @type {any} - */ - this._internal = {}; - } - - /** - * @param {S} _state - * @param {boolean} [_forceStateUpdate] Force that the state is rerendered even if state didn't change - */ - setState (_state, _forceStateUpdate = true) {} - - /** - * @param {any} _stateUpdate - */ - updateState (_stateUpdate) { } -} - -/** - * @param {any} val - * @param {"json"|"string"|"number"} type - * @return {string} - */ -const encodeAttrVal = (val, type) => { - if (type === 'json') { - val = json.stringify(val); - } - return val + '' -}; - -/** - * @param {any} val - * @param {"json"|"string"|"number"|"bool"} type - * @return {any} - */ -const parseAttrVal = (val, type) => { - switch (type) { - case 'json': - return json.parse(val) - case 'number': - return Number.parseFloat(val) - case 'string': - return val - case 'bool': - return val != null - default: - return null - } -}; - -/** - * @template S - * @typedef {Object} CONF - * @property {string?} [CONF.template] Template for the shadow dom. - * @property {string} [CONF.style] shadow dom style. Is only used when - * `CONF.template` is defined - * @property {S} [CONF.state] Initial component state. - * @property {function(S,S|null,Lib0Component):void} [CONF.onStateChange] Called when - * the state changes. - * @property {Object} [CONF.childStates] maps from - * CSS-selector to transformer function. The first element that matches the - * CSS-selector receives state updates via the transformer function. - * @property {Object} [CONF.attrs] - * attrs-keys and state-keys should be camelCase, but the DOM uses kebap-case. I.e. - * `attrs = { myAttr: 4 }` is represeted as `` in the DOM - * @property {Object):boolean|void>} [CONF.listeners] Maps from dom-event-name - * to event listener. - * @property {function(S, S, Lib0Component):Object} [CONF.slots] Fill slots - * automatically when state changes. Maps from slot-name to slot-html. - */ - -/** - * @template T - * @param {string} name - * @param {CONF} cnf - * @return {typeof Lib0Component} - */ -const createComponent = (name, { template, style = '', state: defaultState, onStateChange = () => {}, childStates = { }, attrs = {}, listeners = {}, slots = () => ({}) }) => { - /** - * Maps from camelCase attribute name to kebap-case attribute name. - * @type {Object} - */ - const normalizedAttrs = {}; - for (const key in attrs) { - normalizedAttrs[string.fromCamelCase(key, '-')] = key; - } - const templateElement = template - ? /** @type {HTMLTemplateElement} */ (dom.parseElement(` - - `)) - : null; - - class _Lib0Component extends HTMLElement { - /** - * @param {T} [state] - */ - constructor (state) { - super(); - /** - * @type {Array<{d:Lib0Component, s:function(any, any):Object}>} - */ - this._childStates = []; - /** - * @type {Object} - */ - this._slots = {}; - this._init = false; - /** - * @type {any} - */ - this._internal = {}; - /** - * @type {any} - */ - this.state = state || null; - this.connected = false; - // init shadow dom - if (templateElement) { - const shadow = /** @type {ShadowRoot} */ (this.attachShadow({ mode: 'open' })); - shadow.appendChild(templateElement.content.cloneNode(true)); - // fill child states - for (const key in childStates) { - this._childStates.push({ - d: /** @type {Lib0Component} */ (dom.querySelector(/** @type {any} */ (shadow), key)), - s: childStates[key] - }); - } - } - dom.emitCustomEvent(this, upgradedEventName, { bubbles: true }); - } - - connectedCallback () { - this.connected = true; - if (!this._init) { - this._init = true; - const shadow = this.shadowRoot; - if (shadow) { - dom.addEventListener(shadow, upgradedEventName, event => { - this.setState(this.state, true); - event.stopPropagation(); - }); - } - /** - * @type {Object} - */ - const startState = this.state || object.assign({}, defaultState); - if (attrs) { - for (const key in attrs) { - const normalizedKey = string.fromCamelCase(key, '-'); - const val = parseAttrVal(this.getAttribute(normalizedKey), attrs[key]); - if (val) { - startState[key] = val; - } - } - } - // add event listeners - for (const key in listeners) { - dom.addEventListener(shadow || this, key, event => { - if (listeners[key](/** @type {CustomEvent} */ (event), this) !== false) { - event.stopPropagation(); - event.preventDefault(); - return false - } - }); - } - // first setState call - this.state = null; - this.setState(startState); - } - dom.emitCustomEvent(/** @type {any} */ (this.shadowRoot || this), connectedEventName, { bubbles: true }); - } - - disconnectedCallback () { - this.connected = false; - dom.emitCustomEvent(/** @type {any} */ (this.shadowRoot || this), disconnectedEventName, { bubbles: true }); - this.setState(null); - } - - static get observedAttributes () { - return object.keys(normalizedAttrs) - } - - /** - * @param {string} name - * @param {string} oldVal - * @param {string} newVal - * - * @private - */ - attributeChangedCallback (name, oldVal, newVal) { - const curState = /** @type {any} */ (this.state); - const camelAttrName = normalizedAttrs[name]; - const type = attrs[camelAttrName]; - const parsedVal = parseAttrVal(newVal, type); - if (curState && (type !== 'json' || json.stringify(curState[camelAttrName]) !== newVal) && curState[camelAttrName] !== parsedVal && !number.isNaN(parsedVal)) { - this.updateState({ [camelAttrName]: parsedVal }); - } - } - - /** - * @param {any} stateUpdate - */ - updateState (stateUpdate) { - this.setState(object.assign({}, this.state, stateUpdate)); - } - - /** - * @param {any} state - */ - setState (state, forceStateUpdates = false) { - const prevState = this.state; - this.state = state; - if (this._init && (!_function.equalityFlat(state, prevState) || forceStateUpdates)) { - // fill slots - if (state) { - const slotElems = slots(state, prevState, this); - for (const key in slotElems) { - const slotContent = slotElems[key]; - if (this._slots[key] !== slotContent) { - this._slots[key] = slotContent; - const currentSlots = /** @type {Array} */ (key !== 'default' ? array.from(dom.querySelectorAll(this, `[slot="${key}"]`)) : array.from(this.childNodes).filter(/** @param {any} child */ child => !dom.checkNodeType(child, dom.ELEMENT_NODE) || !child.hasAttribute('slot'))); - currentSlots.slice(1).map(dom.remove); - const nextSlot = dom.parseFragment(slotContent); - if (key !== 'default') { - array.from(nextSlot.children).forEach(c => c.setAttribute('slot', key)); - } - if (currentSlots.length > 0) { - dom.replaceWith(currentSlots[0], nextSlot); - } else { - dom.appendChild(this, nextSlot); - } - } - } - } - onStateChange(state, prevState, this); - if (state != null) { - this._childStates.forEach(cnf => { - const d = cnf.d; - if (d.updateState) { - d.updateState(cnf.s(state, this)); - } - }); - } - for (const key in attrs) { - const normalizedKey = string.fromCamelCase(key, '-'); - if (state == null) { - this.removeAttribute(normalizedKey); - } else { - const stateVal = state[key]; - const attrsType = attrs[key]; - if (!prevState || prevState[key] !== stateVal) { - if (attrsType === 'bool') { - if (stateVal) { - this.setAttribute(normalizedKey, ''); - } else { - this.removeAttribute(normalizedKey); - } - } else if (stateVal == null && (attrsType === 'string' || attrsType === 'number')) { - this.removeAttribute(normalizedKey); - } else { - this.setAttribute(normalizedKey, encodeAttrVal(stateVal, attrsType)); - } - } - } - } - } - } - } - define(name, _Lib0Component); - // @ts-ignore - return _Lib0Component -}; - -/** - * @param {function} definer function that defines a component when executed - */ -const createComponentDefiner = definer => { - /** - * @type {any} - */ - let defined = null; - return () => { - if (!defined) { - defined = definer(); - } - return defined - } -}; - -const defineListComponent = createComponentDefiner(() => { - const ListItem = createComponent('lib0-list-item', { - template: '', - slots: state => ({ - content: `
${state}
` - }) - }); - return createComponent('lib0-list', { - state: { list: /** @type {Array} */ ([]), Item: ListItem }, - onStateChange: (state, prevState, component) => { - if (state == null) { - return - } - const { list = /** @type {Array} */ ([]), Item = ListItem } = state; - // @todo deep compare here by providing another parameter to simpleDiffArray - let { index, remove, insert } = diff.simpleDiffArray(prevState ? prevState.list : [], list, _function.equalityFlat); - if (remove === 0 && insert.length === 0) { - return - } - let child = /** @type {Lib0Component} */ (component.firstChild); - while (index-- > 0) { - child = /** @type {Lib0Component} */ (child.nextElementSibling); - } - let insertStart = 0; - while (insertStart < insert.length && remove-- > 0) { - // update existing state - child.setState(insert[insertStart++]); - child = /** @type {Lib0Component} */ (child.nextElementSibling); - } - while (remove-- > 0) { - // remove remaining - const prevChild = child; - child = /** @type {Lib0Component} */ (child.nextElementSibling); - component.removeChild(prevChild); - } - // insert remaining - component.insertBefore(dom.fragment(insert.slice(insertStart).map(/** @param {any} insState */ insState => { - const el = new Item(); - el.setState(insState); - return el - })), child); - } - }) -}); - -const defineLazyLoadingComponent = createComponentDefiner(() => createComponent('lib0-lazy', { - state: /** @type {{component:null|String,import:null|function():Promise,state:null|object}} */ ({ - component: null, import: null, state: null - }), - attrs: { - component: 'string' - }, - onStateChange: ({ component, state, import: getImport }, prevState, componentEl) => { - if (component !== null) { - if (getImport) { - getImport(); - } - if (!prevState || component !== prevState.component) { - const el = /** @type {any} */ (dom.createElement(component)); - componentEl.innerHTML = ''; - componentEl.insertBefore(el, null); - } - const el = /** @type {any} */ (componentEl.firstElementChild); - // @todo generalize setting state and check if setState is defined - if (el.setState) { - el.setState(state); - } - } - } -})); - -exports.Lib0Component = Lib0Component; -exports.createComponent = createComponent; -exports.createComponentDefiner = createComponentDefiner; -exports.define = define; -exports.defineLazyLoadingComponent = defineLazyLoadingComponent; -exports.defineListComponent = defineListComponent; -exports.registry = registry; -exports.whenDefined = whenDefined; -//# sourceMappingURL=component.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/component.cjs.map b/yjs-poll/node_modules/lib0/dist/component.cjs.map deleted file mode 100644 index dab924b..0000000 --- a/yjs-poll/node_modules/lib0/dist/component.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"component.cjs","sources":["../component.js"],"sourcesContent":["/* eslint-env browser */\n\n/**\n * Web components.\n *\n * @module component\n */\n\nimport * as dom from './dom.js'\nimport * as diff from './diff.js'\nimport * as object from './object.js'\nimport * as json from './json.js'\nimport * as string from './string.js'\nimport * as array from './array.js'\nimport * as number from './number.js'\nimport * as func from './function.js'\n\n/**\n * @type {CustomElementRegistry}\n */\nexport const registry = customElements\n\n/**\n * @param {string} name\n * @param {any} constr\n * @param {ElementDefinitionOptions} [opts]\n */\nexport const define = (name, constr, opts) => registry.define(name, constr, opts)\n\n/**\n * @param {string} name\n * @return {Promise}\n */\nexport const whenDefined = name => registry.whenDefined(name)\n\nconst upgradedEventName = 'upgraded'\nconst connectedEventName = 'connected'\nconst disconnectedEventName = 'disconnected'\n\n/**\n * @template S\n */\nexport class Lib0Component extends HTMLElement {\n /**\n * @param {S} [state]\n */\n constructor (state) {\n super()\n /**\n * @type {S|null}\n */\n this.state = /** @type {any} */ (state)\n /**\n * @type {any}\n */\n this._internal = {}\n }\n\n /**\n * @param {S} _state\n * @param {boolean} [_forceStateUpdate] Force that the state is rerendered even if state didn't change\n */\n setState (_state, _forceStateUpdate = true) {}\n\n /**\n * @param {any} _stateUpdate\n */\n updateState (_stateUpdate) { }\n}\n\n/**\n * @param {any} val\n * @param {\"json\"|\"string\"|\"number\"} type\n * @return {string}\n */\nconst encodeAttrVal = (val, type) => {\n if (type === 'json') {\n val = json.stringify(val)\n }\n return val + ''\n}\n\n/**\n * @param {any} val\n * @param {\"json\"|\"string\"|\"number\"|\"bool\"} type\n * @return {any}\n */\nconst parseAttrVal = (val, type) => {\n switch (type) {\n case 'json':\n return json.parse(val)\n case 'number':\n return Number.parseFloat(val)\n case 'string':\n return val\n case 'bool':\n return val != null\n default:\n return null\n }\n}\n\n/**\n * @template S\n * @typedef {Object} CONF\n * @property {string?} [CONF.template] Template for the shadow dom.\n * @property {string} [CONF.style] shadow dom style. Is only used when\n * `CONF.template` is defined\n * @property {S} [CONF.state] Initial component state.\n * @property {function(S,S|null,Lib0Component):void} [CONF.onStateChange] Called when\n * the state changes.\n * @property {Object} [CONF.childStates] maps from\n * CSS-selector to transformer function. The first element that matches the\n * CSS-selector receives state updates via the transformer function.\n * @property {Object} [CONF.attrs]\n * attrs-keys and state-keys should be camelCase, but the DOM uses kebap-case. I.e.\n * `attrs = { myAttr: 4 }` is represeted as `` in the DOM\n * @property {Object):boolean|void>} [CONF.listeners] Maps from dom-event-name\n * to event listener.\n * @property {function(S, S, Lib0Component):Object} [CONF.slots] Fill slots\n * automatically when state changes. Maps from slot-name to slot-html.\n */\n\n/**\n * @template T\n * @param {string} name\n * @param {CONF} cnf\n * @return {typeof Lib0Component}\n */\nexport const createComponent = (name, { template, style = '', state: defaultState, onStateChange = () => {}, childStates = { }, attrs = {}, listeners = {}, slots = () => ({}) }) => {\n /**\n * Maps from camelCase attribute name to kebap-case attribute name.\n * @type {Object}\n */\n const normalizedAttrs = {}\n for (const key in attrs) {\n normalizedAttrs[string.fromCamelCase(key, '-')] = key\n }\n const templateElement = template\n ? /** @type {HTMLTemplateElement} */ (dom.parseElement(`\n \n `))\n : null\n\n class _Lib0Component extends HTMLElement {\n /**\n * @param {T} [state]\n */\n constructor (state) {\n super()\n /**\n * @type {Array<{d:Lib0Component, s:function(any, any):Object}>}\n */\n this._childStates = []\n /**\n * @type {Object}\n */\n this._slots = {}\n this._init = false\n /**\n * @type {any}\n */\n this._internal = {}\n /**\n * @type {any}\n */\n this.state = state || null\n this.connected = false\n // init shadow dom\n if (templateElement) {\n const shadow = /** @type {ShadowRoot} */ (this.attachShadow({ mode: 'open' }))\n shadow.appendChild(templateElement.content.cloneNode(true))\n // fill child states\n for (const key in childStates) {\n this._childStates.push({\n d: /** @type {Lib0Component} */ (dom.querySelector(/** @type {any} */ (shadow), key)),\n s: childStates[key]\n })\n }\n }\n dom.emitCustomEvent(this, upgradedEventName, { bubbles: true })\n }\n\n connectedCallback () {\n this.connected = true\n if (!this._init) {\n this._init = true\n const shadow = this.shadowRoot\n if (shadow) {\n dom.addEventListener(shadow, upgradedEventName, event => {\n this.setState(this.state, true)\n event.stopPropagation()\n })\n }\n /**\n * @type {Object}\n */\n const startState = this.state || object.assign({}, defaultState)\n if (attrs) {\n for (const key in attrs) {\n const normalizedKey = string.fromCamelCase(key, '-')\n const val = parseAttrVal(this.getAttribute(normalizedKey), attrs[key])\n if (val) {\n startState[key] = val\n }\n }\n }\n // add event listeners\n for (const key in listeners) {\n dom.addEventListener(shadow || this, key, event => {\n if (listeners[key](/** @type {CustomEvent} */ (event), this) !== false) {\n event.stopPropagation()\n event.preventDefault()\n return false\n }\n })\n }\n // first setState call\n this.state = null\n this.setState(startState)\n }\n dom.emitCustomEvent(/** @type {any} */ (this.shadowRoot || this), connectedEventName, { bubbles: true })\n }\n\n disconnectedCallback () {\n this.connected = false\n dom.emitCustomEvent(/** @type {any} */ (this.shadowRoot || this), disconnectedEventName, { bubbles: true })\n this.setState(null)\n }\n\n static get observedAttributes () {\n return object.keys(normalizedAttrs)\n }\n\n /**\n * @param {string} name\n * @param {string} oldVal\n * @param {string} newVal\n *\n * @private\n */\n attributeChangedCallback (name, oldVal, newVal) {\n const curState = /** @type {any} */ (this.state)\n const camelAttrName = normalizedAttrs[name]\n const type = attrs[camelAttrName]\n const parsedVal = parseAttrVal(newVal, type)\n if (curState && (type !== 'json' || json.stringify(curState[camelAttrName]) !== newVal) && curState[camelAttrName] !== parsedVal && !number.isNaN(parsedVal)) {\n this.updateState({ [camelAttrName]: parsedVal })\n }\n }\n\n /**\n * @param {any} stateUpdate\n */\n updateState (stateUpdate) {\n this.setState(object.assign({}, this.state, stateUpdate))\n }\n\n /**\n * @param {any} state\n */\n setState (state, forceStateUpdates = false) {\n const prevState = this.state\n this.state = state\n if (this._init && (!func.equalityFlat(state, prevState) || forceStateUpdates)) {\n // fill slots\n if (state) {\n const slotElems = slots(state, prevState, this)\n for (const key in slotElems) {\n const slotContent = slotElems[key]\n if (this._slots[key] !== slotContent) {\n this._slots[key] = slotContent\n const currentSlots = /** @type {Array} */ (key !== 'default' ? array.from(dom.querySelectorAll(this, `[slot=\"${key}\"]`)) : array.from(this.childNodes).filter(/** @param {any} child */ child => !dom.checkNodeType(child, dom.ELEMENT_NODE) || !child.hasAttribute('slot')))\n currentSlots.slice(1).map(dom.remove)\n const nextSlot = dom.parseFragment(slotContent)\n if (key !== 'default') {\n array.from(nextSlot.children).forEach(c => c.setAttribute('slot', key))\n }\n if (currentSlots.length > 0) {\n dom.replaceWith(currentSlots[0], nextSlot)\n } else {\n dom.appendChild(this, nextSlot)\n }\n }\n }\n }\n onStateChange(state, prevState, this)\n if (state != null) {\n this._childStates.forEach(cnf => {\n const d = cnf.d\n if (d.updateState) {\n d.updateState(cnf.s(state, this))\n }\n })\n }\n for (const key in attrs) {\n const normalizedKey = string.fromCamelCase(key, '-')\n if (state == null) {\n this.removeAttribute(normalizedKey)\n } else {\n const stateVal = state[key]\n const attrsType = attrs[key]\n if (!prevState || prevState[key] !== stateVal) {\n if (attrsType === 'bool') {\n if (stateVal) {\n this.setAttribute(normalizedKey, '')\n } else {\n this.removeAttribute(normalizedKey)\n }\n } else if (stateVal == null && (attrsType === 'string' || attrsType === 'number')) {\n this.removeAttribute(normalizedKey)\n } else {\n this.setAttribute(normalizedKey, encodeAttrVal(stateVal, attrsType))\n }\n }\n }\n }\n }\n }\n }\n define(name, _Lib0Component)\n // @ts-ignore\n return _Lib0Component\n}\n\n/**\n * @param {function} definer function that defines a component when executed\n */\nexport const createComponentDefiner = definer => {\n /**\n * @type {any}\n */\n let defined = null\n return () => {\n if (!defined) {\n defined = definer()\n }\n return defined\n }\n}\n\nexport const defineListComponent = createComponentDefiner(() => {\n const ListItem = createComponent('lib0-list-item', {\n template: '',\n slots: state => ({\n content: `
${state}
`\n })\n })\n return createComponent('lib0-list', {\n state: { list: /** @type {Array} */ ([]), Item: ListItem },\n onStateChange: (state, prevState, component) => {\n if (state == null) {\n return\n }\n const { list = /** @type {Array} */ ([]), Item = ListItem } = state\n // @todo deep compare here by providing another parameter to simpleDiffArray\n let { index, remove, insert } = diff.simpleDiffArray(prevState ? prevState.list : [], list, func.equalityFlat)\n if (remove === 0 && insert.length === 0) {\n return\n }\n let child = /** @type {Lib0Component} */ (component.firstChild)\n while (index-- > 0) {\n child = /** @type {Lib0Component} */ (child.nextElementSibling)\n }\n let insertStart = 0\n while (insertStart < insert.length && remove-- > 0) {\n // update existing state\n child.setState(insert[insertStart++])\n child = /** @type {Lib0Component} */ (child.nextElementSibling)\n }\n while (remove-- > 0) {\n // remove remaining\n const prevChild = child\n child = /** @type {Lib0Component} */ (child.nextElementSibling)\n component.removeChild(prevChild)\n }\n // insert remaining\n component.insertBefore(dom.fragment(insert.slice(insertStart).map(/** @param {any} insState */ insState => {\n const el = new Item()\n el.setState(insState)\n return el\n })), child)\n }\n })\n})\n\nexport const defineLazyLoadingComponent = createComponentDefiner(() => createComponent('lib0-lazy', {\n state: /** @type {{component:null|String,import:null|function():Promise,state:null|object}} */ ({\n component: null, import: null, state: null\n }),\n attrs: {\n component: 'string'\n },\n onStateChange: ({ component, state, import: getImport }, prevState, componentEl) => {\n if (component !== null) {\n if (getImport) {\n getImport()\n }\n if (!prevState || component !== prevState.component) {\n const el = /** @type {any} */ (dom.createElement(component))\n componentEl.innerHTML = ''\n componentEl.insertBefore(el, null)\n }\n const el = /** @type {any} */ (componentEl.firstElementChild)\n // @todo generalize setting state and check if setState is defined\n if (el.setState) {\n el.setState(state)\n }\n }\n }\n}))\n"],"names":["json.stringify","json.parse","string.fromCamelCase","dom.parseElement","dom.querySelector","dom.emitCustomEvent","dom.addEventListener","object.assign","object.keys","number.isNaN","func.equalityFlat","array.from","dom.querySelectorAll","dom.checkNodeType","dom.ELEMENT_NODE","dom.remove","dom.parseFragment","dom.replaceWith","dom.appendChild","diff.simpleDiffArray","dom.fragment","dom.createElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAgBA;AACA;AACA;AACA;AACY,MAAC,QAAQ,GAAG,eAAc;AACtC;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,KAAK,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAC;AACjF;AACA;AACA;AACA;AACA;AACY,MAAC,WAAW,GAAG,IAAI,IAAI,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAC;AAC7D;AACA,MAAM,iBAAiB,GAAG,WAAU;AACpC,MAAM,kBAAkB,GAAG,YAAW;AACtC,MAAM,qBAAqB,GAAG,eAAc;AAC5C;AACA;AACA;AACA;AACO,MAAM,aAAa,SAAS,WAAW,CAAC;AAC/C;AACA;AACA;AACA,EAAE,WAAW,CAAC,CAAC,KAAK,EAAE;AACtB,IAAI,KAAK,GAAE;AACX;AACA;AACA;AACA,IAAI,IAAI,CAAC,KAAK,uBAAuB,KAAK,EAAC;AAC3C;AACA;AACA;AACA,IAAI,IAAI,CAAC,SAAS,GAAG,GAAE;AACvB,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,EAAE,QAAQ,CAAC,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,EAAE,EAAE;AAChD;AACA;AACA;AACA;AAC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AS,GAAG,GAAE;AAClC,QAAQ,WAAW,CAAC,YAAY,CAAC,EAAE,EAAE,IAAI,EAAC;AAC1C,OAAO;AACP,MAAM,MAAM,EAAE,uBAAuB,WAAW,CAAC,iBAAiB,EAAC;AACnE;AACA,MAAM,IAAI,EAAE,CAAC,QAAQ,EAAE;AACvB,QAAQ,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAC;AAC1B,OAAO;AACP,KAAK;AACL,GAAG;AACH,CAAC,CAAC;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/component.d.ts b/yjs-poll/node_modules/lib0/dist/component.d.ts deleted file mode 100644 index 8108665..0000000 --- a/yjs-poll/node_modules/lib0/dist/component.d.ts +++ /dev/null @@ -1,86 +0,0 @@ -/** - * @type {CustomElementRegistry} - */ -export const registry: CustomElementRegistry; -export function define(name: string, constr: any, opts?: ElementDefinitionOptions): void; -export function whenDefined(name: string): Promise; -/** - * @template S - */ -export class Lib0Component extends HTMLElement { - /** - * @param {S} [state] - */ - constructor(state?: S); - /** - * @type {S|null} - */ - state: S | null; - /** - * @type {any} - */ - _internal: any; - /** - * @param {S} _state - * @param {boolean} [_forceStateUpdate] Force that the state is rerendered even if state didn't change - */ - setState(_state: S, _forceStateUpdate?: boolean): void; - /** - * @param {any} _stateUpdate - */ - updateState(_stateUpdate: any): void; -} -export function createComponent(name: string, { template, style, state: defaultState, onStateChange, childStates, attrs, listeners, slots }: CONF): typeof Lib0Component; -export function createComponentDefiner(definer: Function): () => any; -export function defineListComponent(): any; -export function defineLazyLoadingComponent(): any; -export type CONF = { - /** - * Template for the shadow dom. - */ - template?: string | null | undefined; - /** - * shadow dom style. Is only used when - * `CONF.template` is defined - */ - style?: string | undefined; - /** - * Initial component state. - */ - state?: S | undefined; - /** - * Called when - * the state changes. - */ - onStateChange?: ((arg0: S, arg1: S | null, arg2: Lib0Component) => void) | undefined; - /** - * maps from - * CSS-selector to transformer function. The first element that matches the - * CSS-selector receives state updates via the transformer function. - */ - childStates?: { - [x: string]: (arg0: any, arg1: any) => Object; - } | undefined; - /** - * attrs-keys and state-keys should be camelCase, but the DOM uses kebap-case. I.e. - * `attrs = { myAttr: 4 }` is represeted as `` in the DOM - */ - attrs?: { - [x: string]: "string" | "number" | "json" | "bool"; - } | undefined; - /** - * Maps from dom-event-name - * to event listener. - */ - listeners?: { - [x: string]: (arg0: CustomEvent, arg1: Lib0Component) => boolean | void; - } | undefined; - /** - * Fill slots - * automatically when state changes. Maps from slot-name to slot-html. - */ - slots?: ((arg0: S, arg1: S, arg2: Lib0Component) => { - [x: string]: string; - }) | undefined; -}; -//# sourceMappingURL=component.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/component.d.ts.map b/yjs-poll/node_modules/lib0/dist/component.d.ts.map deleted file mode 100644 index d812115..0000000 --- a/yjs-poll/node_modules/lib0/dist/component.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../component.js"],"names":[],"mappings":"AAiBA;;GAEG;AACH,uBAFU,qBAAqB,CAEO;AAO/B,6BAJI,MAAM,UACN,GAAG,SACH,wBAAwB,QAE8C;AAM1E,kCAHI,MAAM,GACL,OAAO,CAAC,wBAAwB,CAAC,CAEgB;AAM7D;;GAEG;AACH,2BAFa,CAAC;IAGZ;;OAEG;IACH,oBAFW,CAAC,EAYX;IARC;;OAEG;IACH,OAFU,CAAC,GAAC,IAAI,CAEuB;IACvC;;OAEG;IACH,WAFU,GAAG,CAEM;IAGrB;;;OAGG;IACH,iBAHW,CAAC,sBACD,OAAO,QAE4B;IAE9C;;QAEI;IACJ,0BAFY,GAAG,QAEe;CAC/B;AA6DM,gCALM,CAAC,QACH,MAAM,iGACN,IAAI,CAAC,CAAC,CAAC,GACN,OAAO,aAAa,CAuM/B;AAKM,qEAWN;AANQ,2CAKN;AALM,kDAKN;iBA9OU,CAAC;;;;;;;;;;;;;;;;;;4BAMS,CAAC,QAAC,CAAC,GAAC,IAAI,QAAC,aAAa,CAAC,CAAC,CAAC,KAAE,IAAI;;;;;;;4BAEjB,GAAG,QAAE,GAAG,KAAE,MAAM;;;;;;;;;;;;;;4BAMf,WAAW,QAAE,aAAa,CAAC,GAAG,CAAC,KAAE,OAAO,GAAC,IAAI;;;;;;oBAE5D,CAAC,QAAE,CAAC,QAAE,aAAa,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/conditions-f5c0c102.cjs b/yjs-poll/node_modules/lib0/dist/conditions-f5c0c102.cjs deleted file mode 100644 index 262c8cc..0000000 --- a/yjs-poll/node_modules/lib0/dist/conditions-f5c0c102.cjs +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -/** - * Often used conditions. - * - * @module conditions - */ - -/** - * @template T - * @param {T|null|undefined} v - * @return {T|null} - */ -/* c8 ignore next */ -const undefinedToNull = v => v === undefined ? null : v; - -var conditions = /*#__PURE__*/Object.freeze({ - __proto__: null, - undefinedToNull: undefinedToNull -}); - -exports.conditions = conditions; -exports.undefinedToNull = undefinedToNull; -//# sourceMappingURL=conditions-f5c0c102.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/conditions-f5c0c102.cjs.map b/yjs-poll/node_modules/lib0/dist/conditions-f5c0c102.cjs.map deleted file mode 100644 index fea384d..0000000 --- a/yjs-poll/node_modules/lib0/dist/conditions-f5c0c102.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"conditions-f5c0c102.cjs","sources":["../conditions.js"],"sourcesContent":["/**\n * Often used conditions.\n *\n * @module conditions\n */\n\n/**\n * @template T\n * @param {T|null|undefined} v\n * @return {T|null}\n */\n/* c8 ignore next */\nexport const undefinedToNull = v => v === undefined ? null : v\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,eAAe,GAAG,CAAC,IAAI,CAAC,KAAK,SAAS,GAAG,IAAI,GAAG;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/conditions.cjs b/yjs-poll/node_modules/lib0/dist/conditions.cjs deleted file mode 100644 index 789d383..0000000 --- a/yjs-poll/node_modules/lib0/dist/conditions.cjs +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var conditions = require('./conditions-f5c0c102.cjs'); - - - -exports.undefinedToNull = conditions.undefinedToNull; -//# sourceMappingURL=conditions.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/conditions.cjs.map b/yjs-poll/node_modules/lib0/dist/conditions.cjs.map deleted file mode 100644 index 1f545ee..0000000 --- a/yjs-poll/node_modules/lib0/dist/conditions.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"conditions.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/conditions.d.ts b/yjs-poll/node_modules/lib0/dist/conditions.d.ts deleted file mode 100644 index 0ed4306..0000000 --- a/yjs-poll/node_modules/lib0/dist/conditions.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export function undefinedToNull(v: T | null | undefined): T | null; -//# sourceMappingURL=conditions.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/conditions.d.ts.map b/yjs-poll/node_modules/lib0/dist/conditions.d.ts.map deleted file mode 100644 index 846b836..0000000 --- a/yjs-poll/node_modules/lib0/dist/conditions.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"conditions.d.ts","sourceRoot":"","sources":["../conditions.js"],"names":[],"mappings":"AAYO,gCALM,CAAC,KACH,CAAC,GAAC,IAAI,GAAC,SAAS,GACf,CAAC,GAAC,IAAI,CAG4C"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/crypto.test.d.ts b/yjs-poll/node_modules/lib0/dist/crypto.test.d.ts deleted file mode 100644 index 050692d..0000000 --- a/yjs-poll/node_modules/lib0/dist/crypto.test.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export function testJwt(_tc: t.TestCase): Promise; -export function testEncryption(tc: t.TestCase): Promise; -export function testReapeatEncryption(tc: t.TestCase): Promise; -export function testImportExport(tc: t.TestCase): Promise; -export function testEncryptionPerformance(tc: t.TestCase): Promise; -export function testConsistentKeyGeneration(_tc: t.TestCase): Promise; -export function testSigning(tc: t.TestCase): Promise; -import * as t from './testing.js'; -//# sourceMappingURL=crypto.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/crypto.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/crypto.test.d.ts.map deleted file mode 100644 index 1bac65c..0000000 --- a/yjs-poll/node_modules/lib0/dist/crypto.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"crypto.test.d.ts","sourceRoot":"","sources":["../crypto.test.js"],"names":[],"mappings":"AAYO,6BAFI,CAAC,CAAC,QAAQ,iBA8BpB;AAKM,mCAFI,CAAC,CAAC,QAAQ,iBAoCpB;AAKM,0CAFI,CAAC,CAAC,QAAQ,iBA8BpB;AAKM,qCAFI,CAAC,CAAC,QAAQ,iBAgDpB;AAKM,8CAFI,CAAC,CAAC,QAAQ,iBAwCpB;AAKM,iDAFI,CAAC,CAAC,QAAQ,iBA2EpB;AAKM,gCAFI,CAAC,CAAC,QAAQ,iBAapB;mBAvSkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/crypto/aes-gcm.d.ts b/yjs-poll/node_modules/lib0/dist/crypto/aes-gcm.d.ts deleted file mode 100644 index 2120545..0000000 --- a/yjs-poll/node_modules/lib0/dist/crypto/aes-gcm.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export function encrypt(key: CryptoKey, data: Uint8Array): Promise>; -export function decrypt(key: CryptoKey, data: Uint8Array): PromiseLike; -export function importKeyJwk(jwk: any, { usages, extractable }?: { - usages?: Usages | undefined; - extractable?: boolean | undefined; -}): Promise; -export function importKeyRaw(raw: Uint8Array, { usages, extractable }?: { - usages?: Usages | undefined; - extractable?: boolean | undefined; -}): Promise; -export function deriveKey(secret: Uint8Array | string, salt: Uint8Array | string, { extractable, usages }?: { - extractable?: boolean | undefined; - usages?: Usages | undefined; -}): Promise; -export type Usages = Array<"encrypt" | "decrypt">; -export { exportKeyJwk, exportKeyRaw } from "./common.js"; -//# sourceMappingURL=aes-gcm.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/crypto/aes-gcm.d.ts.map b/yjs-poll/node_modules/lib0/dist/crypto/aes-gcm.d.ts.map deleted file mode 100644 index 2b78179..0000000 --- a/yjs-poll/node_modules/lib0/dist/crypto/aes-gcm.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"aes-gcm.d.ts","sourceRoot":"","sources":["../../crypto/aes-gcm.js"],"names":[],"mappings":"AAuBO,6BAHI,SAAS,QACT,UAAU,CAAC,WAAW,CAAC,oCAkBjC;AAWM,6BAJI,SAAS,QACT,UAAU,CAAC,WAAW,CAAC,GACtB,WAAW,CAAC,UAAU,CAAC,CAclC;AAaM,kCALI,GAAG,4BAEX;IAAsB,MAAM;IACL,WAAW;CAAC,sBAQrC;AAUM,kCALI,UAAU,CAAC,WAAW,CAAC,4BAE/B;IAAsB,MAAM;IACL,WAAW;CAAC,sBAG0D;AAmBzF,kCANI,UAAU,CAAC,WAAW,CAAC,GAAC,MAAM,QAC9B,UAAU,CAAC,WAAW,CAAC,GAAC,MAAM,4BAEtC;IAAuB,WAAW;IACZ,MAAM;CAAC,sBAsB7B;qBAxHU,KAAK,CAAC,SAAS,GAAC,SAAS,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/crypto/common.d.ts b/yjs-poll/node_modules/lib0/dist/crypto/common.d.ts deleted file mode 100644 index 75106c9..0000000 --- a/yjs-poll/node_modules/lib0/dist/crypto/common.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function exportKeyJwk(key: CryptoKey): Promise; -export function exportKeyRaw(key: CryptoKey): Promise>; -//# sourceMappingURL=common.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/crypto/common.d.ts.map b/yjs-poll/node_modules/lib0/dist/crypto/common.d.ts.map deleted file mode 100644 index 23671f9..0000000 --- a/yjs-poll/node_modules/lib0/dist/crypto/common.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../crypto/common.js"],"names":[],"mappings":"AAKO,kCAFI,SAAS,uBAMnB;AAQM,kCAHI,SAAS,GACR,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAG6B"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/crypto/ecdsa.d.ts b/yjs-poll/node_modules/lib0/dist/crypto/ecdsa.d.ts deleted file mode 100644 index 5ebdfe1..0000000 --- a/yjs-poll/node_modules/lib0/dist/crypto/ecdsa.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export function sign(key: CryptoKey, data: Uint8Array): PromiseLike>; -export function verify(key: CryptoKey, signature: Uint8Array, data: Uint8Array): PromiseLike; -export function generateKeyPair({ extractable, usages }?: { - extractable?: boolean | undefined; - usages?: Usages | undefined; -}): Promise; -export function importKeyJwk(jwk: any, { extractable, usages }?: { - extractable?: boolean | undefined; - usages?: Usages | undefined; -}): Promise; -export function importKeyRaw(raw: any, { extractable, usages }?: { - extractable?: boolean | undefined; - usages?: Usages | undefined; -}): Promise; -export type Usages = Array<"sign" | "verify">; -export { exportKeyJwk, exportKeyRaw } from "./common.js"; -//# sourceMappingURL=ecdsa.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/crypto/ecdsa.d.ts.map b/yjs-poll/node_modules/lib0/dist/crypto/ecdsa.d.ts.map deleted file mode 100644 index 1295e2c..0000000 --- a/yjs-poll/node_modules/lib0/dist/crypto/ecdsa.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ecdsa.d.ts","sourceRoot":"","sources":["../../crypto/ecdsa.js"],"names":[],"mappings":"AA8BO,0BAJI,SAAS,QACT,UAAU,CAAC,WAAW,CAAC,GACtB,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAOA;AAYzC,4BALI,SAAS,aACT,UAAU,CAAC,WAAW,CAAC,QACvB,UAAU,CAAC,WAAW,CAAC,GACtB,WAAW,CAAC,OAAO,CAAC,CAQ7B;AAaI,0DAHJ;IAAuB,WAAW;IACZ,MAAM;CAAC,0BAO7B;AAQI,kCALI,GAAG,4BAEX;IAAuB,WAAW;IACZ,MAAM;CAAC,sBAQ/B;AAUM,kCALI,GAAG,4BAEX;IAAuB,WAAW;IACZ,MAAM;CAAC,sBAGkD;qBAxFrE,KAAK,CAAC,MAAM,GAAC,QAAQ,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/crypto/jwt.d.ts b/yjs-poll/node_modules/lib0/dist/crypto/jwt.d.ts deleted file mode 100644 index 0447def..0000000 --- a/yjs-poll/node_modules/lib0/dist/crypto/jwt.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export function encodeJwt(privateKey: CryptoKey, payload: Object): PromiseLike; -export function verifyJwt(publicKey: CryptoKey, jwt: string): Promise<{ - header: any; - payload: any; -}>; -export function unsafeDecode(jwt: string): { - header: any; - payload: any; -}; -//# sourceMappingURL=jwt.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/crypto/jwt.d.ts.map b/yjs-poll/node_modules/lib0/dist/crypto/jwt.d.ts.map deleted file mode 100644 index 1ac8dfd..0000000 --- a/yjs-poll/node_modules/lib0/dist/crypto/jwt.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../crypto/jwt.js"],"names":[],"mappings":"AAqBO,sCAHI,SAAS,WACT,MAAM,uBAgBhB;AAMM,qCAHI,SAAS,OACT,MAAM;;;GAiBhB;AAOM,kCAFI,MAAM;;;EAQhB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/crypto/rsa-oaep.d.ts b/yjs-poll/node_modules/lib0/dist/crypto/rsa-oaep.d.ts deleted file mode 100644 index b8bf3e9..0000000 --- a/yjs-poll/node_modules/lib0/dist/crypto/rsa-oaep.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export { exportKeyJwk } from "./common.js"; -export function encrypt(key: CryptoKey, data: Uint8Array): PromiseLike>; -export function decrypt(key: CryptoKey, data: Uint8Array): PromiseLike; -export function generateKeyPair({ extractable, usages }?: { - extractable?: boolean | undefined; - usages?: Usages | undefined; -}): Promise; -export function importKeyJwk(jwk: any, { extractable, usages }?: { - extractable?: boolean | undefined; - usages?: Usages | undefined; -}): Promise; -export type Usages = Array<"encrypt" | "decrypt">; -//# sourceMappingURL=rsa-oaep.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/crypto/rsa-oaep.d.ts.map b/yjs-poll/node_modules/lib0/dist/crypto/rsa-oaep.d.ts.map deleted file mode 100644 index 1f83434..0000000 --- a/yjs-poll/node_modules/lib0/dist/crypto/rsa-oaep.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rsa-oaep.d.ts","sourceRoot":"","sources":["../../crypto/rsa-oaep.js"],"names":[],"mappings":";AAuBO,6BAJI,SAAS,QACT,UAAU,CAAC,WAAW,CAAC,GACtB,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CASZ;AAW7B,6BAJI,SAAS,QACT,UAAU,CAAC,WAAW,CAAC,GACtB,WAAW,CAAC,UAAU,CAAC,CASG;AAQ/B,0DAJJ;IAAuB,WAAW;IACZ,MAAM;CAC5B,GAAS,OAAO,CAAC,aAAa,CAAC,CAY/B;AAQI,kCALI,GAAG,4BAEX;IAAuB,WAAW;IACZ,MAAM;CAAC,sBAQ/B;qBAxEY,KAAK,CAAC,SAAS,GAAC,SAAS,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/decoding-76e75827.cjs b/yjs-poll/node_modules/lib0/dist/decoding-76e75827.cjs deleted file mode 100644 index 175342d..0000000 --- a/yjs-poll/node_modules/lib0/dist/decoding-76e75827.cjs +++ /dev/null @@ -1,795 +0,0 @@ -'use strict'; - -var binary = require('./binary-ac8e39e2.cjs'); -var math = require('./math-96d5e8c4.cjs'); -var number = require('./number-1fb57bba.cjs'); -var string = require('./string-fddc5f8b.cjs'); -var error = require('./error-0c1f634f.cjs'); -var encoding = require('./encoding-1a745c43.cjs'); - -/** - * Efficient schema-less binary decoding with support for variable length encoding. - * - * Use [lib0/decoding] with [lib0/encoding]. Every encoding function has a corresponding decoding function. - * - * Encodes numbers in little-endian order (least to most significant byte order) - * and is compatible with Golang's binary encoding (https://golang.org/pkg/encoding/binary/) - * which is also used in Protocol Buffers. - * - * ```js - * // encoding step - * const encoder = encoding.createEncoder() - * encoding.writeVarUint(encoder, 256) - * encoding.writeVarString(encoder, 'Hello world!') - * const buf = encoding.toUint8Array(encoder) - * ``` - * - * ```js - * // decoding step - * const decoder = decoding.createDecoder(buf) - * decoding.readVarUint(decoder) // => 256 - * decoding.readVarString(decoder) // => 'Hello world!' - * decoding.hasContent(decoder) // => false - all data is read - * ``` - * - * @module decoding - */ - -const errorUnexpectedEndOfArray = error.create('Unexpected end of array'); -const errorIntegerOutOfRange = error.create('Integer out of Range'); - -/** - * A Decoder handles the decoding of an Uint8Array. - * @template {ArrayBufferLike} [Buf=ArrayBufferLike] - */ -class Decoder { - /** - * @param {Uint8Array} uint8Array Binary data to decode - */ - constructor (uint8Array) { - /** - * Decoding target. - * - * @type {Uint8Array} - */ - this.arr = uint8Array; - /** - * Current decoding position. - * - * @type {number} - */ - this.pos = 0; - } -} - -/** - * @function - * @template {ArrayBufferLike} Buf - * @param {Uint8Array} uint8Array - * @return {Decoder} - */ -const createDecoder = uint8Array => new Decoder(uint8Array); - -/** - * @function - * @param {Decoder} decoder - * @return {boolean} - */ -const hasContent = decoder => decoder.pos !== decoder.arr.length; - -/** - * Clone a decoder instance. - * Optionally set a new position parameter. - * - * @function - * @param {Decoder} decoder The decoder instance - * @param {number} [newPos] Defaults to current position - * @return {Decoder} A clone of `decoder` - */ -const clone = (decoder, newPos = decoder.pos) => { - const _decoder = createDecoder(decoder.arr); - _decoder.pos = newPos; - return _decoder -}; - -/** - * Create an Uint8Array view of the next `len` bytes and advance the position by `len`. - * - * Important: The Uint8Array still points to the underlying ArrayBuffer. Make sure to discard the result as soon as possible to prevent any memory leaks. - * Use `buffer.copyUint8Array` to copy the result into a new Uint8Array. - * - * @function - * @template {ArrayBufferLike} Buf - * @param {Decoder} decoder The decoder instance - * @param {number} len The length of bytes to read - * @return {Uint8Array} - */ -const readUint8Array = (decoder, len) => { - const view = new Uint8Array(decoder.arr.buffer, decoder.pos + decoder.arr.byteOffset, len); - decoder.pos += len; - return view -}; - -/** - * Read variable length Uint8Array. - * - * Important: The Uint8Array still points to the underlying ArrayBuffer. Make sure to discard the result as soon as possible to prevent any memory leaks. - * Use `buffer.copyUint8Array` to copy the result into a new Uint8Array. - * - * @function - * @template {ArrayBufferLike} Buf - * @param {Decoder} decoder - * @return {Uint8Array} - */ -const readVarUint8Array = decoder => readUint8Array(decoder, readVarUint(decoder)); - -/** - * Read the rest of the content as an ArrayBuffer - * @function - * @param {Decoder} decoder - * @return {Uint8Array} - */ -const readTailAsUint8Array = decoder => readUint8Array(decoder, decoder.arr.length - decoder.pos); - -/** - * Skip one byte, jump to the next position. - * @function - * @param {Decoder} decoder The decoder instance - * @return {number} The next position - */ -const skip8 = decoder => decoder.pos++; - -/** - * Read one byte as unsigned integer. - * @function - * @param {Decoder} decoder The decoder instance - * @return {number} Unsigned 8-bit integer - */ -const readUint8 = decoder => decoder.arr[decoder.pos++]; - -/** - * Read 2 bytes as unsigned integer. - * - * @function - * @param {Decoder} decoder - * @return {number} An unsigned integer. - */ -const readUint16 = decoder => { - const uint = - decoder.arr[decoder.pos] + - (decoder.arr[decoder.pos + 1] << 8); - decoder.pos += 2; - return uint -}; - -/** - * Read 4 bytes as unsigned integer. - * - * @function - * @param {Decoder} decoder - * @return {number} An unsigned integer. - */ -const readUint32 = decoder => { - const uint = - (decoder.arr[decoder.pos] + - (decoder.arr[decoder.pos + 1] << 8) + - (decoder.arr[decoder.pos + 2] << 16) + - (decoder.arr[decoder.pos + 3] << 24)) >>> 0; - decoder.pos += 4; - return uint -}; - -/** - * Read 4 bytes as unsigned integer in big endian order. - * (most significant byte first) - * - * @function - * @param {Decoder} decoder - * @return {number} An unsigned integer. - */ -const readUint32BigEndian = decoder => { - const uint = - (decoder.arr[decoder.pos + 3] + - (decoder.arr[decoder.pos + 2] << 8) + - (decoder.arr[decoder.pos + 1] << 16) + - (decoder.arr[decoder.pos] << 24)) >>> 0; - decoder.pos += 4; - return uint -}; - -/** - * Look ahead without incrementing the position - * to the next byte and read it as unsigned integer. - * - * @function - * @param {Decoder} decoder - * @return {number} An unsigned integer. - */ -const peekUint8 = decoder => decoder.arr[decoder.pos]; - -/** - * Look ahead without incrementing the position - * to the next byte and read it as unsigned integer. - * - * @function - * @param {Decoder} decoder - * @return {number} An unsigned integer. - */ -const peekUint16 = decoder => - decoder.arr[decoder.pos] + - (decoder.arr[decoder.pos + 1] << 8); - -/** - * Look ahead without incrementing the position - * to the next byte and read it as unsigned integer. - * - * @function - * @param {Decoder} decoder - * @return {number} An unsigned integer. - */ -const peekUint32 = decoder => ( - decoder.arr[decoder.pos] + - (decoder.arr[decoder.pos + 1] << 8) + - (decoder.arr[decoder.pos + 2] << 16) + - (decoder.arr[decoder.pos + 3] << 24) -) >>> 0; - -/** - * Read unsigned integer (32bit) with variable length. - * 1/8th of the storage is used as encoding overhead. - * * numbers < 2^7 is stored in one bytlength - * * numbers < 2^14 is stored in two bylength - * - * @function - * @param {Decoder} decoder - * @return {number} An unsigned integer.length - */ -const readVarUint = decoder => { - let num = 0; - let mult = 1; - const len = decoder.arr.length; - while (decoder.pos < len) { - const r = decoder.arr[decoder.pos++]; - // num = num | ((r & binary.BITS7) << len) - num = num + (r & binary.BITS7) * mult; // shift $r << (7*#iterations) and add it to num - mult *= 128; // next iteration, shift 7 "more" to the left - if (r < binary.BIT8) { - return num - } - /* c8 ignore start */ - if (num > number.MAX_SAFE_INTEGER) { - throw errorIntegerOutOfRange - } - /* c8 ignore stop */ - } - throw errorUnexpectedEndOfArray -}; - -/** - * Read signed integer (32bit) with variable length. - * 1/8th of the storage is used as encoding overhead. - * * numbers < 2^7 is stored in one bytlength - * * numbers < 2^14 is stored in two bylength - * @todo This should probably create the inverse ~num if number is negative - but this would be a breaking change. - * - * @function - * @param {Decoder} decoder - * @return {number} An unsigned integer.length - */ -const readVarInt = decoder => { - let r = decoder.arr[decoder.pos++]; - let num = r & binary.BITS6; - let mult = 64; - const sign = (r & binary.BIT7) > 0 ? -1 : 1; - if ((r & binary.BIT8) === 0) { - // don't continue reading - return sign * num - } - const len = decoder.arr.length; - while (decoder.pos < len) { - r = decoder.arr[decoder.pos++]; - // num = num | ((r & binary.BITS7) << len) - num = num + (r & binary.BITS7) * mult; - mult *= 128; - if (r < binary.BIT8) { - return sign * num - } - /* c8 ignore start */ - if (num > number.MAX_SAFE_INTEGER) { - throw errorIntegerOutOfRange - } - /* c8 ignore stop */ - } - throw errorUnexpectedEndOfArray -}; - -/** - * Look ahead and read varUint without incrementing position - * - * @function - * @param {Decoder} decoder - * @return {number} - */ -const peekVarUint = decoder => { - const pos = decoder.pos; - const s = readVarUint(decoder); - decoder.pos = pos; - return s -}; - -/** - * Look ahead and read varUint without incrementing position - * - * @function - * @param {Decoder} decoder - * @return {number} - */ -const peekVarInt = decoder => { - const pos = decoder.pos; - const s = readVarInt(decoder); - decoder.pos = pos; - return s -}; - -/** - * We don't test this function anymore as we use native decoding/encoding by default now. - * Better not modify this anymore.. - * - * Transforming utf8 to a string is pretty expensive. The code performs 10x better - * when String.fromCodePoint is fed with all characters as arguments. - * But most environments have a maximum number of arguments per functions. - * For effiency reasons we apply a maximum of 10000 characters at once. - * - * @function - * @param {Decoder} decoder - * @return {String} The read String. - */ -/* c8 ignore start */ -const _readVarStringPolyfill = decoder => { - let remainingLen = readVarUint(decoder); - if (remainingLen === 0) { - return '' - } else { - let encodedString = String.fromCodePoint(readUint8(decoder)); // remember to decrease remainingLen - if (--remainingLen < 100) { // do not create a Uint8Array for small strings - while (remainingLen--) { - encodedString += String.fromCodePoint(readUint8(decoder)); - } - } else { - while (remainingLen > 0) { - const nextLen = remainingLen < 10000 ? remainingLen : 10000; - // this is dangerous, we create a fresh array view from the existing buffer - const bytes = decoder.arr.subarray(decoder.pos, decoder.pos + nextLen); - decoder.pos += nextLen; - // Starting with ES5.1 we can supply a generic array-like object as arguments - encodedString += String.fromCodePoint.apply(null, /** @type {any} */ (bytes)); - remainingLen -= nextLen; - } - } - return decodeURIComponent(escape(encodedString)) - } -}; -/* c8 ignore stop */ - -/** - * @function - * @param {Decoder} decoder - * @return {String} The read String - */ -const _readVarStringNative = decoder => - /** @type any */ (string.utf8TextDecoder).decode(readVarUint8Array(decoder)); - -/** - * Read string of variable length - * * varUint is used to store the length of the string - * - * @function - * @param {Decoder} decoder - * @return {String} The read String - * - */ -/* c8 ignore next */ -const readVarString = string.utf8TextDecoder ? _readVarStringNative : _readVarStringPolyfill; - -/** - * @param {Decoder} decoder - * @return {Uint8Array} - */ -const readTerminatedUint8Array = decoder => { - const encoder = encoding.createEncoder(); - let b; - while (true) { - b = readUint8(decoder); - if (b === 0) { - return encoding.toUint8Array(encoder) - } - if (b === 1) { - b = readUint8(decoder); - } - encoding.write(encoder, b); - } -}; - -/** - * @param {Decoder} decoder - * @return {string} - */ -const readTerminatedString = decoder => string.decodeUtf8(readTerminatedUint8Array(decoder)); - -/** - * Look ahead and read varString without incrementing position - * - * @function - * @param {Decoder} decoder - * @return {string} - */ -const peekVarString = decoder => { - const pos = decoder.pos; - const s = readVarString(decoder); - decoder.pos = pos; - return s -}; - -/** - * @param {Decoder} decoder - * @param {number} len - * @return {DataView} - */ -const readFromDataView = (decoder, len) => { - const dv = new DataView(decoder.arr.buffer, decoder.arr.byteOffset + decoder.pos, len); - decoder.pos += len; - return dv -}; - -/** - * @param {Decoder} decoder - */ -const readFloat32 = decoder => readFromDataView(decoder, 4).getFloat32(0, false); - -/** - * @param {Decoder} decoder - */ -const readFloat64 = decoder => readFromDataView(decoder, 8).getFloat64(0, false); - -/** - * @param {Decoder} decoder - */ -const readBigInt64 = decoder => /** @type {any} */ (readFromDataView(decoder, 8)).getBigInt64(0, false); - -/** - * @param {Decoder} decoder - */ -const readBigUint64 = decoder => /** @type {any} */ (readFromDataView(decoder, 8)).getBigUint64(0, false); - -/** - * @type {Array} - */ -const readAnyLookupTable = [ - decoder => undefined, // CASE 127: undefined - decoder => null, // CASE 126: null - readVarInt, // CASE 125: integer - readFloat32, // CASE 124: float32 - readFloat64, // CASE 123: float64 - readBigInt64, // CASE 122: bigint - decoder => false, // CASE 121: boolean (false) - decoder => true, // CASE 120: boolean (true) - readVarString, // CASE 119: string - decoder => { // CASE 118: object - const len = readVarUint(decoder); - /** - * @type {Object} - */ - const obj = {}; - for (let i = 0; i < len; i++) { - const key = readVarString(decoder); - obj[key] = readAny(decoder); - } - return obj - }, - decoder => { // CASE 117: array - const len = readVarUint(decoder); - const arr = []; - for (let i = 0; i < len; i++) { - arr.push(readAny(decoder)); - } - return arr - }, - readVarUint8Array // CASE 116: Uint8Array -]; - -/** - * @param {Decoder} decoder - */ -const readAny = decoder => readAnyLookupTable[127 - readUint8(decoder)](decoder); - -/** - * T must not be null. - * - * @template T - */ -class RleDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - * @param {function(Decoder):T} reader - */ - constructor (uint8Array, reader) { - super(uint8Array); - /** - * The reader - */ - this.reader = reader; - /** - * Current state - * @type {T|null} - */ - this.s = null; - this.count = 0; - } - - read () { - if (this.count === 0) { - this.s = this.reader(this); - if (hasContent(this)) { - this.count = readVarUint(this) + 1; // see encoder implementation for the reason why this is incremented - } else { - this.count = -1; // read the current value forever - } - } - this.count--; - return /** @type {T} */ (this.s) - } -} - -class IntDiffDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - * @param {number} start - */ - constructor (uint8Array, start) { - super(uint8Array); - /** - * Current state - * @type {number} - */ - this.s = start; - } - - /** - * @return {number} - */ - read () { - this.s += readVarInt(this); - return this.s - } -} - -class RleIntDiffDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - * @param {number} start - */ - constructor (uint8Array, start) { - super(uint8Array); - /** - * Current state - * @type {number} - */ - this.s = start; - this.count = 0; - } - - /** - * @return {number} - */ - read () { - if (this.count === 0) { - this.s += readVarInt(this); - if (hasContent(this)) { - this.count = readVarUint(this) + 1; // see encoder implementation for the reason why this is incremented - } else { - this.count = -1; // read the current value forever - } - } - this.count--; - return /** @type {number} */ (this.s) - } -} - -class UintOptRleDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - */ - constructor (uint8Array) { - super(uint8Array); - /** - * @type {number} - */ - this.s = 0; - this.count = 0; - } - - read () { - if (this.count === 0) { - this.s = readVarInt(this); - // if the sign is negative, we read the count too, otherwise count is 1 - const isNegative = math.isNegativeZero(this.s); - this.count = 1; - if (isNegative) { - this.s = -this.s; - this.count = readVarUint(this) + 2; - } - } - this.count--; - return /** @type {number} */ (this.s) - } -} - -class IncUintOptRleDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - */ - constructor (uint8Array) { - super(uint8Array); - /** - * @type {number} - */ - this.s = 0; - this.count = 0; - } - - read () { - if (this.count === 0) { - this.s = readVarInt(this); - // if the sign is negative, we read the count too, otherwise count is 1 - const isNegative = math.isNegativeZero(this.s); - this.count = 1; - if (isNegative) { - this.s = -this.s; - this.count = readVarUint(this) + 2; - } - } - this.count--; - return /** @type {number} */ (this.s++) - } -} - -class IntDiffOptRleDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - */ - constructor (uint8Array) { - super(uint8Array); - /** - * @type {number} - */ - this.s = 0; - this.count = 0; - this.diff = 0; - } - - /** - * @return {number} - */ - read () { - if (this.count === 0) { - const diff = readVarInt(this); - // if the first bit is set, we read more data - const hasCount = diff & 1; - this.diff = math.floor(diff / 2); // shift >> 1 - this.count = 1; - if (hasCount) { - this.count = readVarUint(this) + 2; - } - } - this.s += this.diff; - this.count--; - return this.s - } -} - -class StringDecoder { - /** - * @param {Uint8Array} uint8Array - */ - constructor (uint8Array) { - this.decoder = new UintOptRleDecoder(uint8Array); - this.str = readVarString(this.decoder); - /** - * @type {number} - */ - this.spos = 0; - } - - /** - * @return {string} - */ - read () { - const end = this.spos + this.decoder.read(); - const res = this.str.slice(this.spos, end); - this.spos = end; - return res - } -} - -var decoding = /*#__PURE__*/Object.freeze({ - __proto__: null, - Decoder: Decoder, - createDecoder: createDecoder, - hasContent: hasContent, - clone: clone, - readUint8Array: readUint8Array, - readVarUint8Array: readVarUint8Array, - readTailAsUint8Array: readTailAsUint8Array, - skip8: skip8, - readUint8: readUint8, - readUint16: readUint16, - readUint32: readUint32, - readUint32BigEndian: readUint32BigEndian, - peekUint8: peekUint8, - peekUint16: peekUint16, - peekUint32: peekUint32, - readVarUint: readVarUint, - readVarInt: readVarInt, - peekVarUint: peekVarUint, - peekVarInt: peekVarInt, - _readVarStringPolyfill: _readVarStringPolyfill, - _readVarStringNative: _readVarStringNative, - readVarString: readVarString, - readTerminatedUint8Array: readTerminatedUint8Array, - readTerminatedString: readTerminatedString, - peekVarString: peekVarString, - readFromDataView: readFromDataView, - readFloat32: readFloat32, - readFloat64: readFloat64, - readBigInt64: readBigInt64, - readBigUint64: readBigUint64, - readAny: readAny, - RleDecoder: RleDecoder, - IntDiffDecoder: IntDiffDecoder, - RleIntDiffDecoder: RleIntDiffDecoder, - UintOptRleDecoder: UintOptRleDecoder, - IncUintOptRleDecoder: IncUintOptRleDecoder, - IntDiffOptRleDecoder: IntDiffOptRleDecoder, - StringDecoder: StringDecoder -}); - -exports.Decoder = Decoder; -exports.IncUintOptRleDecoder = IncUintOptRleDecoder; -exports.IntDiffDecoder = IntDiffDecoder; -exports.IntDiffOptRleDecoder = IntDiffOptRleDecoder; -exports.RleDecoder = RleDecoder; -exports.RleIntDiffDecoder = RleIntDiffDecoder; -exports.StringDecoder = StringDecoder; -exports.UintOptRleDecoder = UintOptRleDecoder; -exports._readVarStringNative = _readVarStringNative; -exports._readVarStringPolyfill = _readVarStringPolyfill; -exports.clone = clone; -exports.createDecoder = createDecoder; -exports.decoding = decoding; -exports.hasContent = hasContent; -exports.peekUint16 = peekUint16; -exports.peekUint32 = peekUint32; -exports.peekUint8 = peekUint8; -exports.peekVarInt = peekVarInt; -exports.peekVarString = peekVarString; -exports.peekVarUint = peekVarUint; -exports.readAny = readAny; -exports.readBigInt64 = readBigInt64; -exports.readBigUint64 = readBigUint64; -exports.readFloat32 = readFloat32; -exports.readFloat64 = readFloat64; -exports.readFromDataView = readFromDataView; -exports.readTailAsUint8Array = readTailAsUint8Array; -exports.readTerminatedString = readTerminatedString; -exports.readTerminatedUint8Array = readTerminatedUint8Array; -exports.readUint16 = readUint16; -exports.readUint32 = readUint32; -exports.readUint32BigEndian = readUint32BigEndian; -exports.readUint8 = readUint8; -exports.readUint8Array = readUint8Array; -exports.readVarInt = readVarInt; -exports.readVarString = readVarString; -exports.readVarUint = readVarUint; -exports.readVarUint8Array = readVarUint8Array; -exports.skip8 = skip8; -//# sourceMappingURL=decoding-76e75827.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/decoding-76e75827.cjs.map b/yjs-poll/node_modules/lib0/dist/decoding-76e75827.cjs.map deleted file mode 100644 index 96eba52..0000000 --- a/yjs-poll/node_modules/lib0/dist/decoding-76e75827.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"decoding-76e75827.cjs","sources":["../decoding.js"],"sourcesContent":["/**\n * Efficient schema-less binary decoding with support for variable length encoding.\n *\n * Use [lib0/decoding] with [lib0/encoding]. Every encoding function has a corresponding decoding function.\n *\n * Encodes numbers in little-endian order (least to most significant byte order)\n * and is compatible with Golang's binary encoding (https://golang.org/pkg/encoding/binary/)\n * which is also used in Protocol Buffers.\n *\n * ```js\n * // encoding step\n * const encoder = encoding.createEncoder()\n * encoding.writeVarUint(encoder, 256)\n * encoding.writeVarString(encoder, 'Hello world!')\n * const buf = encoding.toUint8Array(encoder)\n * ```\n *\n * ```js\n * // decoding step\n * const decoder = decoding.createDecoder(buf)\n * decoding.readVarUint(decoder) // => 256\n * decoding.readVarString(decoder) // => 'Hello world!'\n * decoding.hasContent(decoder) // => false - all data is read\n * ```\n *\n * @module decoding\n */\n\nimport * as binary from './binary.js'\nimport * as math from './math.js'\nimport * as number from './number.js'\nimport * as string from './string.js'\nimport * as error from './error.js'\nimport * as encoding from './encoding.js'\n\nconst errorUnexpectedEndOfArray = error.create('Unexpected end of array')\nconst errorIntegerOutOfRange = error.create('Integer out of Range')\n\n/**\n * A Decoder handles the decoding of an Uint8Array.\n * @template {ArrayBufferLike} [Buf=ArrayBufferLike]\n */\nexport class Decoder {\n /**\n * @param {Uint8Array} uint8Array Binary data to decode\n */\n constructor (uint8Array) {\n /**\n * Decoding target.\n *\n * @type {Uint8Array}\n */\n this.arr = uint8Array\n /**\n * Current decoding position.\n *\n * @type {number}\n */\n this.pos = 0\n }\n}\n\n/**\n * @function\n * @template {ArrayBufferLike} Buf\n * @param {Uint8Array} uint8Array\n * @return {Decoder}\n */\nexport const createDecoder = uint8Array => new Decoder(uint8Array)\n\n/**\n * @function\n * @param {Decoder} decoder\n * @return {boolean}\n */\nexport const hasContent = decoder => decoder.pos !== decoder.arr.length\n\n/**\n * Clone a decoder instance.\n * Optionally set a new position parameter.\n *\n * @function\n * @param {Decoder} decoder The decoder instance\n * @param {number} [newPos] Defaults to current position\n * @return {Decoder} A clone of `decoder`\n */\nexport const clone = (decoder, newPos = decoder.pos) => {\n const _decoder = createDecoder(decoder.arr)\n _decoder.pos = newPos\n return _decoder\n}\n\n/**\n * Create an Uint8Array view of the next `len` bytes and advance the position by `len`.\n *\n * Important: The Uint8Array still points to the underlying ArrayBuffer. Make sure to discard the result as soon as possible to prevent any memory leaks.\n * Use `buffer.copyUint8Array` to copy the result into a new Uint8Array.\n *\n * @function\n * @template {ArrayBufferLike} Buf\n * @param {Decoder} decoder The decoder instance\n * @param {number} len The length of bytes to read\n * @return {Uint8Array}\n */\nexport const readUint8Array = (decoder, len) => {\n const view = new Uint8Array(decoder.arr.buffer, decoder.pos + decoder.arr.byteOffset, len)\n decoder.pos += len\n return view\n}\n\n/**\n * Read variable length Uint8Array.\n *\n * Important: The Uint8Array still points to the underlying ArrayBuffer. Make sure to discard the result as soon as possible to prevent any memory leaks.\n * Use `buffer.copyUint8Array` to copy the result into a new Uint8Array.\n *\n * @function\n * @template {ArrayBufferLike} Buf\n * @param {Decoder} decoder\n * @return {Uint8Array}\n */\nexport const readVarUint8Array = decoder => readUint8Array(decoder, readVarUint(decoder))\n\n/**\n * Read the rest of the content as an ArrayBuffer\n * @function\n * @param {Decoder} decoder\n * @return {Uint8Array}\n */\nexport const readTailAsUint8Array = decoder => readUint8Array(decoder, decoder.arr.length - decoder.pos)\n\n/**\n * Skip one byte, jump to the next position.\n * @function\n * @param {Decoder} decoder The decoder instance\n * @return {number} The next position\n */\nexport const skip8 = decoder => decoder.pos++\n\n/**\n * Read one byte as unsigned integer.\n * @function\n * @param {Decoder} decoder The decoder instance\n * @return {number} Unsigned 8-bit integer\n */\nexport const readUint8 = decoder => decoder.arr[decoder.pos++]\n\n/**\n * Read 2 bytes as unsigned integer.\n *\n * @function\n * @param {Decoder} decoder\n * @return {number} An unsigned integer.\n */\nexport const readUint16 = decoder => {\n const uint =\n decoder.arr[decoder.pos] +\n (decoder.arr[decoder.pos + 1] << 8)\n decoder.pos += 2\n return uint\n}\n\n/**\n * Read 4 bytes as unsigned integer.\n *\n * @function\n * @param {Decoder} decoder\n * @return {number} An unsigned integer.\n */\nexport const readUint32 = decoder => {\n const uint =\n (decoder.arr[decoder.pos] +\n (decoder.arr[decoder.pos + 1] << 8) +\n (decoder.arr[decoder.pos + 2] << 16) +\n (decoder.arr[decoder.pos + 3] << 24)) >>> 0\n decoder.pos += 4\n return uint\n}\n\n/**\n * Read 4 bytes as unsigned integer in big endian order.\n * (most significant byte first)\n *\n * @function\n * @param {Decoder} decoder\n * @return {number} An unsigned integer.\n */\nexport const readUint32BigEndian = decoder => {\n const uint =\n (decoder.arr[decoder.pos + 3] +\n (decoder.arr[decoder.pos + 2] << 8) +\n (decoder.arr[decoder.pos + 1] << 16) +\n (decoder.arr[decoder.pos] << 24)) >>> 0\n decoder.pos += 4\n return uint\n}\n\n/**\n * Look ahead without incrementing the position\n * to the next byte and read it as unsigned integer.\n *\n * @function\n * @param {Decoder} decoder\n * @return {number} An unsigned integer.\n */\nexport const peekUint8 = decoder => decoder.arr[decoder.pos]\n\n/**\n * Look ahead without incrementing the position\n * to the next byte and read it as unsigned integer.\n *\n * @function\n * @param {Decoder} decoder\n * @return {number} An unsigned integer.\n */\nexport const peekUint16 = decoder =>\n decoder.arr[decoder.pos] +\n (decoder.arr[decoder.pos + 1] << 8)\n\n/**\n * Look ahead without incrementing the position\n * to the next byte and read it as unsigned integer.\n *\n * @function\n * @param {Decoder} decoder\n * @return {number} An unsigned integer.\n */\nexport const peekUint32 = decoder => (\n decoder.arr[decoder.pos] +\n (decoder.arr[decoder.pos + 1] << 8) +\n (decoder.arr[decoder.pos + 2] << 16) +\n (decoder.arr[decoder.pos + 3] << 24)\n) >>> 0\n\n/**\n * Read unsigned integer (32bit) with variable length.\n * 1/8th of the storage is used as encoding overhead.\n * * numbers < 2^7 is stored in one bytlength\n * * numbers < 2^14 is stored in two bylength\n *\n * @function\n * @param {Decoder} decoder\n * @return {number} An unsigned integer.length\n */\nexport const readVarUint = decoder => {\n let num = 0\n let mult = 1\n const len = decoder.arr.length\n while (decoder.pos < len) {\n const r = decoder.arr[decoder.pos++]\n // num = num | ((r & binary.BITS7) << len)\n num = num + (r & binary.BITS7) * mult // shift $r << (7*#iterations) and add it to num\n mult *= 128 // next iteration, shift 7 \"more\" to the left\n if (r < binary.BIT8) {\n return num\n }\n /* c8 ignore start */\n if (num > number.MAX_SAFE_INTEGER) {\n throw errorIntegerOutOfRange\n }\n /* c8 ignore stop */\n }\n throw errorUnexpectedEndOfArray\n}\n\n/**\n * Read signed integer (32bit) with variable length.\n * 1/8th of the storage is used as encoding overhead.\n * * numbers < 2^7 is stored in one bytlength\n * * numbers < 2^14 is stored in two bylength\n * @todo This should probably create the inverse ~num if number is negative - but this would be a breaking change.\n *\n * @function\n * @param {Decoder} decoder\n * @return {number} An unsigned integer.length\n */\nexport const readVarInt = decoder => {\n let r = decoder.arr[decoder.pos++]\n let num = r & binary.BITS6\n let mult = 64\n const sign = (r & binary.BIT7) > 0 ? -1 : 1\n if ((r & binary.BIT8) === 0) {\n // don't continue reading\n return sign * num\n }\n const len = decoder.arr.length\n while (decoder.pos < len) {\n r = decoder.arr[decoder.pos++]\n // num = num | ((r & binary.BITS7) << len)\n num = num + (r & binary.BITS7) * mult\n mult *= 128\n if (r < binary.BIT8) {\n return sign * num\n }\n /* c8 ignore start */\n if (num > number.MAX_SAFE_INTEGER) {\n throw errorIntegerOutOfRange\n }\n /* c8 ignore stop */\n }\n throw errorUnexpectedEndOfArray\n}\n\n/**\n * Look ahead and read varUint without incrementing position\n *\n * @function\n * @param {Decoder} decoder\n * @return {number}\n */\nexport const peekVarUint = decoder => {\n const pos = decoder.pos\n const s = readVarUint(decoder)\n decoder.pos = pos\n return s\n}\n\n/**\n * Look ahead and read varUint without incrementing position\n *\n * @function\n * @param {Decoder} decoder\n * @return {number}\n */\nexport const peekVarInt = decoder => {\n const pos = decoder.pos\n const s = readVarInt(decoder)\n decoder.pos = pos\n return s\n}\n\n/**\n * We don't test this function anymore as we use native decoding/encoding by default now.\n * Better not modify this anymore..\n *\n * Transforming utf8 to a string is pretty expensive. The code performs 10x better\n * when String.fromCodePoint is fed with all characters as arguments.\n * But most environments have a maximum number of arguments per functions.\n * For effiency reasons we apply a maximum of 10000 characters at once.\n *\n * @function\n * @param {Decoder} decoder\n * @return {String} The read String.\n */\n/* c8 ignore start */\nexport const _readVarStringPolyfill = decoder => {\n let remainingLen = readVarUint(decoder)\n if (remainingLen === 0) {\n return ''\n } else {\n let encodedString = String.fromCodePoint(readUint8(decoder)) // remember to decrease remainingLen\n if (--remainingLen < 100) { // do not create a Uint8Array for small strings\n while (remainingLen--) {\n encodedString += String.fromCodePoint(readUint8(decoder))\n }\n } else {\n while (remainingLen > 0) {\n const nextLen = remainingLen < 10000 ? remainingLen : 10000\n // this is dangerous, we create a fresh array view from the existing buffer\n const bytes = decoder.arr.subarray(decoder.pos, decoder.pos + nextLen)\n decoder.pos += nextLen\n // Starting with ES5.1 we can supply a generic array-like object as arguments\n encodedString += String.fromCodePoint.apply(null, /** @type {any} */ (bytes))\n remainingLen -= nextLen\n }\n }\n return decodeURIComponent(escape(encodedString))\n }\n}\n/* c8 ignore stop */\n\n/**\n * @function\n * @param {Decoder} decoder\n * @return {String} The read String\n */\nexport const _readVarStringNative = decoder =>\n /** @type any */ (string.utf8TextDecoder).decode(readVarUint8Array(decoder))\n\n/**\n * Read string of variable length\n * * varUint is used to store the length of the string\n *\n * @function\n * @param {Decoder} decoder\n * @return {String} The read String\n *\n */\n/* c8 ignore next */\nexport const readVarString = string.utf8TextDecoder ? _readVarStringNative : _readVarStringPolyfill\n\n/**\n * @param {Decoder} decoder\n * @return {Uint8Array}\n */\nexport const readTerminatedUint8Array = decoder => {\n const encoder = encoding.createEncoder()\n let b\n while (true) {\n b = readUint8(decoder)\n if (b === 0) {\n return encoding.toUint8Array(encoder)\n }\n if (b === 1) {\n b = readUint8(decoder)\n }\n encoding.write(encoder, b)\n }\n}\n\n/**\n * @param {Decoder} decoder\n * @return {string}\n */\nexport const readTerminatedString = decoder => string.decodeUtf8(readTerminatedUint8Array(decoder))\n\n/**\n * Look ahead and read varString without incrementing position\n *\n * @function\n * @param {Decoder} decoder\n * @return {string}\n */\nexport const peekVarString = decoder => {\n const pos = decoder.pos\n const s = readVarString(decoder)\n decoder.pos = pos\n return s\n}\n\n/**\n * @param {Decoder} decoder\n * @param {number} len\n * @return {DataView}\n */\nexport const readFromDataView = (decoder, len) => {\n const dv = new DataView(decoder.arr.buffer, decoder.arr.byteOffset + decoder.pos, len)\n decoder.pos += len\n return dv\n}\n\n/**\n * @param {Decoder} decoder\n */\nexport const readFloat32 = decoder => readFromDataView(decoder, 4).getFloat32(0, false)\n\n/**\n * @param {Decoder} decoder\n */\nexport const readFloat64 = decoder => readFromDataView(decoder, 8).getFloat64(0, false)\n\n/**\n * @param {Decoder} decoder\n */\nexport const readBigInt64 = decoder => /** @type {any} */ (readFromDataView(decoder, 8)).getBigInt64(0, false)\n\n/**\n * @param {Decoder} decoder\n */\nexport const readBigUint64 = decoder => /** @type {any} */ (readFromDataView(decoder, 8)).getBigUint64(0, false)\n\n/**\n * @type {Array}\n */\nconst readAnyLookupTable = [\n decoder => undefined, // CASE 127: undefined\n decoder => null, // CASE 126: null\n readVarInt, // CASE 125: integer\n readFloat32, // CASE 124: float32\n readFloat64, // CASE 123: float64\n readBigInt64, // CASE 122: bigint\n decoder => false, // CASE 121: boolean (false)\n decoder => true, // CASE 120: boolean (true)\n readVarString, // CASE 119: string\n decoder => { // CASE 118: object\n const len = readVarUint(decoder)\n /**\n * @type {Object}\n */\n const obj = {}\n for (let i = 0; i < len; i++) {\n const key = readVarString(decoder)\n obj[key] = readAny(decoder)\n }\n return obj\n },\n decoder => { // CASE 117: array\n const len = readVarUint(decoder)\n const arr = []\n for (let i = 0; i < len; i++) {\n arr.push(readAny(decoder))\n }\n return arr\n },\n readVarUint8Array // CASE 116: Uint8Array\n]\n\n/**\n * @param {Decoder} decoder\n */\nexport const readAny = decoder => readAnyLookupTable[127 - readUint8(decoder)](decoder)\n\n/**\n * T must not be null.\n *\n * @template T\n */\nexport class RleDecoder extends Decoder {\n /**\n * @param {Uint8Array} uint8Array\n * @param {function(Decoder):T} reader\n */\n constructor (uint8Array, reader) {\n super(uint8Array)\n /**\n * The reader\n */\n this.reader = reader\n /**\n * Current state\n * @type {T|null}\n */\n this.s = null\n this.count = 0\n }\n\n read () {\n if (this.count === 0) {\n this.s = this.reader(this)\n if (hasContent(this)) {\n this.count = readVarUint(this) + 1 // see encoder implementation for the reason why this is incremented\n } else {\n this.count = -1 // read the current value forever\n }\n }\n this.count--\n return /** @type {T} */ (this.s)\n }\n}\n\nexport class IntDiffDecoder extends Decoder {\n /**\n * @param {Uint8Array} uint8Array\n * @param {number} start\n */\n constructor (uint8Array, start) {\n super(uint8Array)\n /**\n * Current state\n * @type {number}\n */\n this.s = start\n }\n\n /**\n * @return {number}\n */\n read () {\n this.s += readVarInt(this)\n return this.s\n }\n}\n\nexport class RleIntDiffDecoder extends Decoder {\n /**\n * @param {Uint8Array} uint8Array\n * @param {number} start\n */\n constructor (uint8Array, start) {\n super(uint8Array)\n /**\n * Current state\n * @type {number}\n */\n this.s = start\n this.count = 0\n }\n\n /**\n * @return {number}\n */\n read () {\n if (this.count === 0) {\n this.s += readVarInt(this)\n if (hasContent(this)) {\n this.count = readVarUint(this) + 1 // see encoder implementation for the reason why this is incremented\n } else {\n this.count = -1 // read the current value forever\n }\n }\n this.count--\n return /** @type {number} */ (this.s)\n }\n}\n\nexport class UintOptRleDecoder extends Decoder {\n /**\n * @param {Uint8Array} uint8Array\n */\n constructor (uint8Array) {\n super(uint8Array)\n /**\n * @type {number}\n */\n this.s = 0\n this.count = 0\n }\n\n read () {\n if (this.count === 0) {\n this.s = readVarInt(this)\n // if the sign is negative, we read the count too, otherwise count is 1\n const isNegative = math.isNegativeZero(this.s)\n this.count = 1\n if (isNegative) {\n this.s = -this.s\n this.count = readVarUint(this) + 2\n }\n }\n this.count--\n return /** @type {number} */ (this.s)\n }\n}\n\nexport class IncUintOptRleDecoder extends Decoder {\n /**\n * @param {Uint8Array} uint8Array\n */\n constructor (uint8Array) {\n super(uint8Array)\n /**\n * @type {number}\n */\n this.s = 0\n this.count = 0\n }\n\n read () {\n if (this.count === 0) {\n this.s = readVarInt(this)\n // if the sign is negative, we read the count too, otherwise count is 1\n const isNegative = math.isNegativeZero(this.s)\n this.count = 1\n if (isNegative) {\n this.s = -this.s\n this.count = readVarUint(this) + 2\n }\n }\n this.count--\n return /** @type {number} */ (this.s++)\n }\n}\n\nexport class IntDiffOptRleDecoder extends Decoder {\n /**\n * @param {Uint8Array} uint8Array\n */\n constructor (uint8Array) {\n super(uint8Array)\n /**\n * @type {number}\n */\n this.s = 0\n this.count = 0\n this.diff = 0\n }\n\n /**\n * @return {number}\n */\n read () {\n if (this.count === 0) {\n const diff = readVarInt(this)\n // if the first bit is set, we read more data\n const hasCount = diff & 1\n this.diff = math.floor(diff / 2) // shift >> 1\n this.count = 1\n if (hasCount) {\n this.count = readVarUint(this) + 2\n }\n }\n this.s += this.diff\n this.count--\n return this.s\n }\n}\n\nexport class StringDecoder {\n /**\n * @param {Uint8Array} uint8Array\n */\n constructor (uint8Array) {\n this.decoder = new UintOptRleDecoder(uint8Array)\n this.str = readVarString(this.decoder)\n /**\n * @type {number}\n */\n this.spos = 0\n }\n\n /**\n * @return {string}\n */\n read () {\n const end = this.spos + this.decoder.read()\n const res = this.str.slice(this.spos, end)\n this.spos = end\n return res\n }\n}\n"],"names":["error.create","binary.BITS7","binary.BIT8","number.MAX_SAFE_INTEGER","binary.BITS6","binary.BIT7","string.utf8TextDecoder","encoding.createEncoder","encoding.toUint8Array","encoding.write","string.decodeUtf8","math.isNegativeZero","math.floor"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA,MAAM,yBAAyB,GAAGA,YAAY,CAAC,yBAAyB,EAAC;AACzE,MAAM,sBAAsB,GAAGA,YAAY,CAAC,sBAAsB,EAAC;AACnE;AACA;AACA;AACA;AACA;AACO,MAAM,OAAO,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AAC,OAAO,EAAC;AAC1C;AACA;AACA;AACA,IAAI,IAAI,CAAC,IAAI,GAAG,EAAC;AACjB,GAAG;AACH;AACA;AACA;AACA;AACA,EAAE,IAAI,CAAC,GAAG;AACV,IAAI,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,GAAE;AAC/C,IAAI,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAC;AAC9C,IAAI,IAAI,CAAC,IAAI,GAAG,IAAG;AACnB,IAAI,OAAO,GAAG;AACd,GAAG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/decoding.cjs b/yjs-poll/node_modules/lib0/dist/decoding.cjs deleted file mode 100644 index 988b235..0000000 --- a/yjs-poll/node_modules/lib0/dist/decoding.cjs +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./binary-ac8e39e2.cjs'); -require('./math-96d5e8c4.cjs'); -require('./number-1fb57bba.cjs'); -require('./string-fddc5f8b.cjs'); -require('./error-0c1f634f.cjs'); -require('./encoding-1a745c43.cjs'); -var decoding = require('./decoding-76e75827.cjs'); -require('./array-78849c95.cjs'); -require('./set-5b47859e.cjs'); - - - -exports.Decoder = decoding.Decoder; -exports.IncUintOptRleDecoder = decoding.IncUintOptRleDecoder; -exports.IntDiffDecoder = decoding.IntDiffDecoder; -exports.IntDiffOptRleDecoder = decoding.IntDiffOptRleDecoder; -exports.RleDecoder = decoding.RleDecoder; -exports.RleIntDiffDecoder = decoding.RleIntDiffDecoder; -exports.StringDecoder = decoding.StringDecoder; -exports.UintOptRleDecoder = decoding.UintOptRleDecoder; -exports._readVarStringNative = decoding._readVarStringNative; -exports._readVarStringPolyfill = decoding._readVarStringPolyfill; -exports.clone = decoding.clone; -exports.createDecoder = decoding.createDecoder; -exports.hasContent = decoding.hasContent; -exports.peekUint16 = decoding.peekUint16; -exports.peekUint32 = decoding.peekUint32; -exports.peekUint8 = decoding.peekUint8; -exports.peekVarInt = decoding.peekVarInt; -exports.peekVarString = decoding.peekVarString; -exports.peekVarUint = decoding.peekVarUint; -exports.readAny = decoding.readAny; -exports.readBigInt64 = decoding.readBigInt64; -exports.readBigUint64 = decoding.readBigUint64; -exports.readFloat32 = decoding.readFloat32; -exports.readFloat64 = decoding.readFloat64; -exports.readFromDataView = decoding.readFromDataView; -exports.readTailAsUint8Array = decoding.readTailAsUint8Array; -exports.readTerminatedString = decoding.readTerminatedString; -exports.readTerminatedUint8Array = decoding.readTerminatedUint8Array; -exports.readUint16 = decoding.readUint16; -exports.readUint32 = decoding.readUint32; -exports.readUint32BigEndian = decoding.readUint32BigEndian; -exports.readUint8 = decoding.readUint8; -exports.readUint8Array = decoding.readUint8Array; -exports.readVarInt = decoding.readVarInt; -exports.readVarString = decoding.readVarString; -exports.readVarUint = decoding.readVarUint; -exports.readVarUint8Array = decoding.readVarUint8Array; -exports.skip8 = decoding.skip8; -//# sourceMappingURL=decoding.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/decoding.cjs.map b/yjs-poll/node_modules/lib0/dist/decoding.cjs.map deleted file mode 100644 index 85f4368..0000000 --- a/yjs-poll/node_modules/lib0/dist/decoding.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"decoding.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/decoding.d.ts b/yjs-poll/node_modules/lib0/dist/decoding.d.ts deleted file mode 100644 index 4eff347..0000000 --- a/yjs-poll/node_modules/lib0/dist/decoding.d.ts +++ /dev/null @@ -1,165 +0,0 @@ -/** - * A Decoder handles the decoding of an Uint8Array. - * @template {ArrayBufferLike} [Buf=ArrayBufferLike] - */ -export class Decoder { - /** - * @param {Uint8Array} uint8Array Binary data to decode - */ - constructor(uint8Array: Uint8Array); - /** - * Decoding target. - * - * @type {Uint8Array} - */ - arr: Uint8Array; - /** - * Current decoding position. - * - * @type {number} - */ - pos: number; -} -export function createDecoder(uint8Array: Uint8Array): Decoder; -export function hasContent(decoder: Decoder): boolean; -export function clone(decoder: Decoder, newPos?: number): Decoder; -export function readUint8Array(decoder: Decoder, len: number): Uint8Array; -export function readVarUint8Array(decoder: Decoder): Uint8Array; -export function readTailAsUint8Array(decoder: Decoder): Uint8Array; -export function skip8(decoder: Decoder): number; -export function readUint8(decoder: Decoder): number; -export function readUint16(decoder: Decoder): number; -export function readUint32(decoder: Decoder): number; -export function readUint32BigEndian(decoder: Decoder): number; -export function peekUint8(decoder: Decoder): number; -export function peekUint16(decoder: Decoder): number; -export function peekUint32(decoder: Decoder): number; -export function readVarUint(decoder: Decoder): number; -export function readVarInt(decoder: Decoder): number; -export function peekVarUint(decoder: Decoder): number; -export function peekVarInt(decoder: Decoder): number; -export function _readVarStringPolyfill(decoder: Decoder): string; -export function _readVarStringNative(decoder: Decoder): string; -export function readVarString(decoder: Decoder): string; -export function readTerminatedUint8Array(decoder: Decoder): Uint8Array; -export function readTerminatedString(decoder: Decoder): string; -export function peekVarString(decoder: Decoder): string; -export function readFromDataView(decoder: Decoder, len: number): DataView; -export function readFloat32(decoder: Decoder): number; -export function readFloat64(decoder: Decoder): number; -export function readBigInt64(decoder: Decoder): any; -export function readBigUint64(decoder: Decoder): any; -export function readAny(decoder: Decoder): any; -/** - * T must not be null. - * - * @template T - */ -export class RleDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - * @param {function(Decoder):T} reader - */ - constructor(uint8Array: Uint8Array, reader: (arg0: Decoder) => T); - /** - * The reader - */ - reader: (arg0: Decoder) => T; - /** - * Current state - * @type {T|null} - */ - s: T | null; - count: number; - read(): T; -} -export class IntDiffDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - * @param {number} start - */ - constructor(uint8Array: Uint8Array, start: number); - /** - * Current state - * @type {number} - */ - s: number; - /** - * @return {number} - */ - read(): number; -} -export class RleIntDiffDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - * @param {number} start - */ - constructor(uint8Array: Uint8Array, start: number); - /** - * Current state - * @type {number} - */ - s: number; - count: number; - /** - * @return {number} - */ - read(): number; -} -export class UintOptRleDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - */ - constructor(uint8Array: Uint8Array); - /** - * @type {number} - */ - s: number; - count: number; - read(): number; -} -export class IncUintOptRleDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - */ - constructor(uint8Array: Uint8Array); - /** - * @type {number} - */ - s: number; - count: number; - read(): number; -} -export class IntDiffOptRleDecoder extends Decoder { - /** - * @param {Uint8Array} uint8Array - */ - constructor(uint8Array: Uint8Array); - /** - * @type {number} - */ - s: number; - count: number; - diff: number; - /** - * @return {number} - */ - read(): number; -} -export class StringDecoder { - /** - * @param {Uint8Array} uint8Array - */ - constructor(uint8Array: Uint8Array); - decoder: UintOptRleDecoder; - str: string; - /** - * @type {number} - */ - spos: number; - /** - * @return {string} - */ - read(): string; -} -//# sourceMappingURL=decoding.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/decoding.d.ts.map b/yjs-poll/node_modules/lib0/dist/decoding.d.ts.map deleted file mode 100644 index e662563..0000000 --- a/yjs-poll/node_modules/lib0/dist/decoding.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"decoding.d.ts","sourceRoot":"","sources":["../decoding.js"],"names":[],"mappings":"AAsCA;;;GAGG;AACH,qBAFgC,GAAG,SAArB,eAAgB;IAG5B;;OAEG;IACH,wBAFW,UAAU,CAAC,GAAG,CAAC,EAezB;IAZC;;;;OAIG;IACH,KAFU,UAAU,CAAC,GAAG,CAAC,CA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AEqE;AAKhF,sCAFI,OAAO,OAE4F;AAKvG,uCAFI,OAAO,OAE8F;AAyCzG,iCAFI,OAAO,OAEqE;AAEvF;;;;GAIG;AACH,wBAFa,CAAC;IAGZ;;;OAGG;IACH,wBAHW,UAAU,UACV,CAAS,IAAO,EAAP,OAAO,KAAE,CAAC,EAc7B;IAVC;;OAEG;IACH,eAPkB,OAAO,KAAE,CAAC,CAOR;IACpB;;;OAGG;IACH,GAFU,CAAC,GAAC,IAAI,CAEH;IACb,cAAc;IAGhB,QAUoB,CAAC,CACpB;CACF;AAED;IACE;;;OAGG;IACH,wBAHW,UAAU,SACV,MAAM,EAShB;IALC;;;OAGG;IACH,GAFU,MAAM,CAEF;IAGhB;;OAEG;IACH,QAFY,MAAM,CAKjB;CACF;AAED;IACE;;;OAGG;IACH,wBAHW,UAAU,SACV,MAAM,EAUhB;IANC;;;OAGG;IACH,GAFU,MAAM,CAEF;IACd,cAAc;IAGhB;;OAEG;IACH,QAFY,MAAM,CAajB;CACF;AAED;IACE;;OAEG;IACH,wBAFW,UAAU,EASpB;IALC;;OAEG;IACH,GAFU,MAAM,CAEN;IACV,cAAc;IAGhB,QAYoB,MAAM,CACzB;CACF;AAED;IACE;;OAEG;IACH,wBAFW,UAAU,EASpB;IALC;;OAEG;IACH,GAFU,MAAM,CAEN;IACV,cAAc;IAGhB,QAYoB,MAAM,CACzB;CACF;AAED;IACE;;OAEG;IACH,wBAFW,UAAU,EAUpB;IANC;;OAEG;IACH,GAFU,MAAM,CAEN;IACV,cAAc;IACd,aAAa;IAGf;;OAEG;IACH,QAFY,MAAM,CAgBjB;CACF;AAED;IACE;;OAEG;IACH,wBAFW,UAAU,EASpB;IANC,2BAAgD;IAChD,YAAsC;IACtC;;OAEG;IACH,MAFU,MAAM,CAEH;IAGf;;OAEG;IACH,QAFY,MAAM,CAOjB;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/delta.cjs b/yjs-poll/node_modules/lib0/dist/delta.cjs deleted file mode 100644 index 3ca0986..0000000 --- a/yjs-poll/node_modules/lib0/dist/delta.cjs +++ /dev/null @@ -1,2412 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var list = require('./list.cjs'); -var object = require('./object-c0c9435b.cjs'); -var equality = require('./equality.cjs'); -var fingerprint = require('./fingerprint.cjs'); -var array$1 = require('./array-78849c95.cjs'); -var _function = require('./function-314580f7.cjs'); -var schema = require('./schema.cjs'); -var error = require('./error-0c1f634f.cjs'); -var math = require('./math-96d5e8c4.cjs'); -var rabin = require('./rabin.cjs'); -var encoding = require('./encoding-1a745c43.cjs'); -var buffer = require('./buffer-3e750729.cjs'); -var patience = require('./patience.cjs'); -var prng = require('./prng-37d48618.cjs'); -require('./set-5b47859e.cjs'); -require('./environment-1c97264d.cjs'); -require('./map-24d263c0.cjs'); -require('./string-fddc5f8b.cjs'); -require('./conditions-f5c0c102.cjs'); -require('./storage.cjs'); -require('./number-1fb57bba.cjs'); -require('./binary-ac8e39e2.cjs'); -require('./decoding-76e75827.cjs'); - -/** - * @beta this API is about to change - * - * ## Mutability - * - * Deltas are mutable by default. But references are often shared, by marking a Delta as "done". You - * may only modify deltas by applying other deltas to them. Casting a Delta to a DeltaBuilder - * manually, will likely modify "shared" state. - */ - -/** - * @typedef {{ - * insert?: string[] - * insertAt?: number - * delete?: string[] - * deleteAt?: number - * format?: Record - * formatAt?: number - * }} Attribution - */ - -/** - * @type {s.Schema} - */ -const $attribution = schema.$object({ - insert: schema.$array(schema.$string).optional, - insertAt: schema.$number.optional, - delete: schema.$array(schema.$string).optional, - deleteAt: schema.$number.optional, - format: schema.$record(schema.$string, schema.$array(schema.$string)).optional, - formatAt: schema.$number.optional -}); - -/** - * @typedef {s.Unwrap<$anyOp>} DeltaOps - */ - -/** - * @typedef {{ [key: string]: any }} FormattingAttributes - */ - -/** - * @typedef {{ - * type: 'delta', - * name?: string, - * attrs?: { [Key in string|number]: DeltaAttrOpJSON }, - * children?: Array - * }} DeltaJSON - */ - -/** - * @typedef {{ type: 'insert', insert: string|Array, format?: { [key: string]: any }, attribution?: Attribution } | { delete: number } | { type: 'retain', retain: number, format?: { [key:string]: any }, attribution?: Attribution } | { type: 'modify', value: object }} DeltaListOpJSON - */ - -/** - * @typedef {{ type: 'insert', value: any, prevValue?: any, attribution?: Attribution } | { type: 'delete', prevValue?: any, attribution?: Attribution } | { type: 'modify', value: DeltaJSON }} DeltaAttrOpJSON - */ - -/** - * @typedef {TextOp|InsertOp|DeleteOp|RetainOp|ModifyOp} ChildrenOpAny - */ - -/** - * @typedef {AttrInsertOp|AttrDeleteOp|AttrModifyOp} AttrOpAny - */ - -/** - * @typedef {ChildrenOpAny|AttrOpAny} _OpAny - */ - -/** - * @type {s.Schema} - */ -const $deltaMapChangeJson = schema.$union( - schema.$object({ type: schema.$literal('insert'), value: schema.$any, prevValue: schema.$any.optional, attribution: $attribution.optional }), - schema.$object({ type: schema.$literal('modify'), value: schema.$any }), - schema.$object({ type: schema.$literal('delete'), prevValue: schema.$any.optional, attribution: $attribution.optional }) -); - -/** - * @template {{[key:string]: any} | null} Attrs - * @param {Attrs} attrs - * @return {Attrs} - */ -const _cloneAttrs = attrs => attrs == null ? attrs : { ...attrs }; -/** - * @template {any} MaybeDelta - * @param {MaybeDelta} maybeDelta - * @return {MaybeDelta} - */ -const _markMaybeDeltaAsDone = maybeDelta => $deltaAny.check(maybeDelta) ? /** @type {MaybeDelta} */ (maybeDelta.done()) : maybeDelta; - -class TextOp extends list.ListNode { - /** - * @param {string} insert - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor (insert, format, attribution) { - super(); - // Whenever this is modified, make sure to clear _fingerprint - /** - * @readonly - * @type {string} - */ - this.insert = insert; - /** - * @readonly - * @type {FormattingAttributes|null} - */ - this.format = format; - this.attribution = attribution; - /** - * @type {string?} - */ - this._fingerprint = null; - } - - /** - * @param {string} newVal - */ - _updateInsert (newVal) { - // @ts-ignore - this.insert = newVal; - this._fingerprint = null; - } - - /** - * @return {'insert'} - */ - get type () { - return 'insert' - } - - get length () { - return this.insert.length - } - - get fingerprint () { - return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => { - encoding.writeVarUint(encoder, 0); // textOp type: 0 - encoding.writeVarString(encoder, this.insert); - encoding.writeAny(encoder, this.format); - }))) - } - - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} offset - * @param {number} len - */ - _splice (offset, len) { - this._fingerprint = null; - // @ts-ignore - this.insert = this.insert.slice(0, offset) + this.insert.slice(offset + len); - return this - } - - /** - * @return {DeltaListOpJSON} - */ - toJSON () { - const { insert, format, attribution } = this; - return object.assign(/** @type {{type: 'insert', insert: string}} */ ({ type: 'insert', insert }), format != null ? { format } : ({}), attribution != null ? { attribution } : ({})) - } - - /** - * @param {TextOp} other - */ - [equality.EqualityTraitSymbol] (other) { - return _function.equalityDeep(this.insert, other.insert) && _function.equalityDeep(this.format, other.format) && _function.equalityDeep(this.attribution, other.attribution) - } - - /** - * @return {TextOp} - */ - clone (start = 0, end = this.length) { - return new TextOp(this.insert.slice(start, end), _cloneAttrs(this.format), _cloneAttrs(this.attribution)) - } -} - -/** - * @template {fingerprintTrait.Fingerprintable} ArrayContent - */ -class InsertOp extends list.ListNode { - /** - * @param {Array} insert - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor (insert, format, attribution) { - super(); - /** - * @readonly - * @type {Array} - */ - this.insert = insert; - /** - * @readonly - * @type {FormattingAttributes?} - */ - this.format = format; - /** - * @readonly - * @type {Attribution?} - */ - this.attribution = attribution; - /** - * @type {string?} - */ - this._fingerprint = null; - } - - /** - * @param {ArrayContent} newVal - */ - _updateInsert (newVal) { - // @ts-ignore - this.insert = newVal; - this._fingerprint = null; - } - - /** - * @return {'insert'} - */ - get type () { - return 'insert' - } - - get length () { - return this.insert.length - } - - /** - * @param {number} i - * @return {Extract} - */ - _modValue (i) { - /** - * @type {any} - */ - let d = this.insert[i]; - this._fingerprint = null; - $deltaAny.expect(d); - if (d.isDone) { - // @ts-ignore - this.insert[i] = (d = clone(d)); - return d - } - return d - } - - get fingerprint () { - return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => { - encoding.writeVarUint(encoder, 1); // insertOp type: 1 - encoding.writeVarUint(encoder, this.insert.length); - this.insert.forEach(ins => { - encoding.writeVarString(encoder, fingerprint.fingerprint(ins)); - }); - encoding.writeAny(encoder, this.format); - }))) - } - - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} offset - * @param {number} len - */ - _splice (offset, len) { - this._fingerprint = null; - this.insert.splice(offset, len); - return this - } - - /** - * @return {DeltaListOpJSON} - */ - toJSON () { - const { insert, format, attribution } = this; - return object.assign({ type: /** @type {'insert'} */ ('insert'), insert: insert.map(ins => $deltaAny.check(ins) ? ins.toJSON() : ins) }, format ? { format } : ({}), attribution != null ? { attribution } : ({})) - } - - /** - * @param {InsertOp} other - */ - [equality.EqualityTraitSymbol] (other) { - return _function.equalityDeep(this.insert, other.insert) && _function.equalityDeep(this.format, other.format) && _function.equalityDeep(this.attribution, other.attribution) - } - - /** - * @return {InsertOp} - */ - clone (start = 0, end = this.length) { - return new InsertOp(this.insert.slice(start, end).map(_markMaybeDeltaAsDone), _cloneAttrs(this.format), _cloneAttrs(this.attribution)) - } -} - -/** - * @template {fingerprintTrait.Fingerprintable} [Children=never] - * @template {string} [Text=never] - */ -class DeleteOp extends list.ListNode { - /** - * @param {number} len - */ - constructor (len) { - super(); - this.delete = len; - /** - * @type {(Children|Text) extends never ? null : (Delta?)} - */ - this.prevValue = null; - /** - * @type {string|null} - */ - this._fingerprint = null; - } - - /** - * @return {'delete'} - */ - get type () { - return 'delete' - } - - get length () { - return 0 - } - - get fingerprint () { - return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => { - encoding.writeVarUint(encoder, 2); // deleteOp type: 2 - encoding.writeVarUint(encoder, this.delete); - }))) - } - - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} _offset - * @param {number} len - */ - _splice (_offset, len) { - this.prevValue = /** @type {any} */ (this.prevValue?.slice(_offset, len) || null); - this._fingerprint = null; - this.delete -= len; - return this - } - - /** - * @return {DeltaListOpJSON} - */ - toJSON () { - return { delete: this.delete } - } - - /** - * @param {DeleteOp} other - */ - [equality.EqualityTraitSymbol] (other) { - return this.delete === other.delete - } - - clone (start = 0, end = this.delete) { - return new DeleteOp(end - start) - } -} - -class RetainOp extends list.ListNode { - /** - * @param {number} retain - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor (retain, format, attribution) { - super(); - /** - * @readonly - * @type {number} - */ - this.retain = retain; - /** - * @readonly - * @type {FormattingAttributes?} - */ - this.format = format; - /** - * @readonly - * @type {Attribution?} - */ - this.attribution = attribution; - /** - * @type {string|null} - */ - this._fingerprint = null; - } - - /** - * @return {'retain'} - */ - get type () { - return 'retain' - } - - get length () { - return this.retain - } - - get fingerprint () { - return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => { - encoding.writeVarUint(encoder, 3); // retainOp type: 3 - encoding.writeVarUint(encoder, this.retain); - encoding.writeAny(encoder, this.format); - }))) - } - - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} _offset - * @param {number} len - */ - _splice (_offset, len) { - // @ts-ignore - this.retain -= len; - this._fingerprint = null; - return this - } - - /** - * @return {DeltaListOpJSON} - */ - toJSON () { - const { retain, format, attribution } = this; - return object.assign({ type: /** @type {'retain'} */ ('retain'), retain }, format ? { format } : {}, attribution != null ? { attribution } : {}) - } - - /** - * @param {RetainOp} other - */ - [equality.EqualityTraitSymbol] (other) { - return this.retain === other.retain && _function.equalityDeep(this.format, other.format) && _function.equalityDeep(this.attribution, other.attribution) - } - - clone (start = 0, end = this.retain) { - return new RetainOp(end - start, _cloneAttrs(this.format), _cloneAttrs(this.attribution)) - } -} - -/** - * Delta that can be applied on a YType Embed - * - * @template {DeltaAny} [DTypes=DeltaAny] - */ -class ModifyOp extends list.ListNode { - /** - * @param {DTypes} delta - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor (delta, format, attribution) { - super(); - /** - * @readonly - * @type {DTypes} - */ - this.value = delta; - /** - * @readonly - * @type {FormattingAttributes?} - */ - this.format = format; - /** - * @readonly - * @type {Attribution?} - */ - this.attribution = attribution; - /** - * @type {string|null} - */ - this._fingerprint = null; - } - - /** - * @return {'modify'} - */ - get type () { - return 'modify' - } - - get length () { - return 1 - } - - /** - * @type {DeltaBuilderAny} - */ - get _modValue () { - /** - * @type {any} - */ - const d = this.value; - this._fingerprint = null; - if (d.isDone) { - // @ts-ignore - return (this.value = clone(d)) - } - return d - } - - get fingerprint () { - // don't cache fingerprint because we don't know when delta changes - return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => { - encoding.writeVarUint(encoder, 4); // modifyOp type: 4 - encoding.writeVarString(encoder, this.value.fingerprint); - encoding.writeAny(encoder, this.format); - }))) - } - - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} _offset - * @param {number} _len - */ - _splice (_offset, _len) { - return this - } - - /** - * @return {DeltaListOpJSON} - */ - toJSON () { - const { value, attribution, format } = this; - return object.assign({ type: /** @type {'modify'} */ ('modify'), value: value.toJSON() }, format ? { format } : {}, attribution != null ? { attribution } : {}) - } - - /** - * @param {ModifyOp} other - */ - [equality.EqualityTraitSymbol] (other) { - return this.value[equality.EqualityTraitSymbol](other.value) && _function.equalityDeep(this.format, other.format) && _function.equalityDeep(this.attribution, other.attribution) - } - - /** - * @return {ModifyOp} - */ - clone () { - return new ModifyOp(/** @type {DTypes} */ (this.value.done()), _cloneAttrs(this.format), _cloneAttrs(this.attribution)) - } -} - -/** - * @template {fingerprintTrait.Fingerprintable} V - * @template {string|number} [K=any] - */ -class AttrInsertOp { - /** - * @param {K} key - * @param {V} value - * @param {V|undefined} prevValue - * @param {Attribution?} attribution - */ - constructor (key, value, prevValue, attribution) { - /** - * @readonly - * @type {K} - */ - this.key = key; - /** - * @readonly - * @type {V} - */ - this.value = value; - /** - * @readonly - * @type {V|undefined} - */ - this.prevValue = prevValue; - /** - * @readonly - * @type {Attribution?} - */ - this.attribution = attribution; - /** - * @type {string|null} - */ - this._fingerprint = null; - } - - /** - * @return {'insert'} - */ - get type () { return 'insert' } - - /** - * @type {DeltaBuilderAny} - */ - get _modValue () { - /** - * @type {any} - */ - const v = this.value; - this._fingerprint = null; - if ($deltaAny.check(v) && v.isDone) { - // @ts-ignore - return (this.value = clone(v)) - } - return v - } - - get fingerprint () { - return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => { - encoding.writeVarUint(encoder, 5); // map insert type: 5 - encoding.writeAny(encoder, this.key); - if ($deltaAny.check(this.value)) { - encoding.writeUint8(encoder, 0); - encoding.writeVarString(encoder, this.value.fingerprint); - } else { - encoding.writeUint8(encoder, 1); - encoding.writeAny(encoder, this.value); - } - }))) - } - - toJSON () { - const v = this.value; - const prevValue = this.prevValue; - const attribution = this.attribution; - return object.assign({ - type: this.type, - value: $deltaAny.check(v) ? v.toJSON() : v - }, attribution != null ? { attribution } : {}, prevValue !== undefined ? { prevValue } : {}) - } - - /** - * @param {AttrInsertOp} other - */ - [equality.EqualityTraitSymbol] (other) { - return this.key === other.key && _function.equalityDeep(this.value, other.value) && _function.equalityDeep(this.attribution, other.attribution) - } - - /** - * @return {AttrInsertOp} - */ - clone () { - return new AttrInsertOp(this.key, _markMaybeDeltaAsDone(this.value), _markMaybeDeltaAsDone(this.prevValue), _cloneAttrs(this.attribution)) - } -} - -/** - * @template V - * @template {string|number} [K=string] - */ -class AttrDeleteOp { - /** - * @param {K} key - * @param {V|undefined} prevValue - * @param {Attribution?} attribution - */ - constructor (key, prevValue, attribution) { - /** - * @type {K} - */ - this.key = key; - /** - * @type {V|undefined} - */ - this.prevValue = prevValue; - this.attribution = attribution; - /** - * @type {string|null} - */ - this._fingerprint = null; - } - - get value () { return undefined } - - /** - * @type {'delete'} - */ - get type () { return 'delete' } - - get fingerprint () { - return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => { - encoding.writeVarUint(encoder, 6); // map delete type: 6 - encoding.writeAny(encoder, this.key); - }))) - } - - /** - * @return {DeltaAttrOpJSON} - */ - toJSON () { - const { - type, attribution, prevValue - } = this; - return object.assign({ type }, attribution != null ? { attribution } : {}, prevValue !== undefined ? { prevValue } : {}) - } - - /** - * @param {AttrDeleteOp} other - */ - [equality.EqualityTraitSymbol] (other) { - return this.key === other.key && _function.equalityDeep(this.attribution, other.attribution) - } - - clone () { - return new AttrDeleteOp(this.key, _markMaybeDeltaAsDone(this.prevValue), _cloneAttrs(this.attribution)) - } -} - -/** - * @template {DeltaAny} [Modifier=DeltaAny] - * @template {string|number} [K=string] - */ -class AttrModifyOp { - /** - * @param {K} key - * @param {Modifier} delta - */ - constructor (key, delta) { - /** - * @readonly - * @type {K} - */ - this.key = key; - /** - * @readonly - * @type {Modifier} - */ - this.value = delta; - /** - * @type {string|null} - */ - this._fingerprint = null; - } - - /** - * @type {'modify'} - */ - get type () { return 'modify' } - - get fingerprint () { - return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => { - encoding.writeVarUint(encoder, 7); // map modify type: 7 - encoding.writeAny(encoder, this.key); - encoding.writeVarString(encoder, this.value.fingerprint); - }))) - } - - /** - * @return {DeltaBuilder} - */ - get _modValue () { - this._fingerprint = null; - if (this.value.isDone) { - // @ts-ignore - this.value = /** @type {any} */ (clone(this.value)); - } - // @ts-ignore - return this.value - } - - /** - * @return {DeltaAttrOpJSON} - */ - toJSON () { - return { - type: this.type, - value: this.value.toJSON() - } - } - - /** - * @param {AttrModifyOp} other - */ - [equality.EqualityTraitSymbol] (other) { - return this.key === other.key && this.value[equality.EqualityTraitSymbol](other.value) - } - - /** - * @return {AttrModifyOp} - */ - clone () { - return new AttrModifyOp(this.key, /** @type {Modifier} */ (this.value.done())) - } -} - -/** - * @type {s.Schema | DeleteOp>} - */ -const $deleteOp = schema.$custom(o => o != null && (o.constructor === DeleteOp || o.constructor === AttrDeleteOp)); - -/** - * @type {s.Schema | InsertOp>} - */ -const $insertOp = schema.$custom(o => o != null && (o.constructor === AttrInsertOp || o.constructor === InsertOp)); - -/** - * @template {fingerprintTrait.Fingerprintable} Content - * @param {s.Schema} $content - * @return {s.Schema | InsertOp>} - */ -const $insertOpWith = $content => schema.$custom(o => - o != null && ( - (o.constructor === AttrInsertOp && $content.check(/** @type {AttrInsertOp} */ (o).value)) || - (o.constructor === InsertOp && /** @type {InsertOp} */ (o).insert.every(ins => $content.check(ins))) - ) -); - -/** - * @type {s.Schema} - */ -const $textOp = schema.$constructedBy(TextOp); - -/** - * @type {s.Schema} - */ -const $retainOp = schema.$constructedBy(RetainOp); - -/** - * @type {s.Schema} - */ -const $modifyOp = schema.$custom(o => o != null && (o.constructor === AttrModifyOp || o.constructor === ModifyOp)); - -/** - * @template {DeltaAny} Modify - * @param {s.Schema} $content - * @return {s.Schema | ModifyOp>} - */ -const $modifyOpWith = $content => schema.$custom(o => - o != null && ( - (o.constructor === AttrModifyOp && $content.check(/** @type {AttrModifyOp} */ (o).value)) || - (o.constructor === ModifyOp && $content.check(/** @type {ModifyOp} */ (o).value)) - ) -); - -const $anyOp = schema.$union($insertOp, $deleteOp, $textOp, $modifyOp); - -/** - * @template {Array|string} C1 - * @template {Array|string} C2 - * @typedef {Extract> extends never - * ? never - * : (Array<(Extract> extends Array ? (unknown extends AC1 ? never : AC1) : never)>)} MergeListArrays - */ - -/** - * @template {{[Key in string|number]: any}} Attrs - * @template {string|number} Key - * @template {any} Val - * @typedef {{ [K in (Key | keyof Attrs)]: (unknown extends Attrs[K] ? never : Attrs[K]) | (Key extends K ? Val : never) }} AddToAttrs - */ - -/** - * @template {{[Key in string|number|symbol]: any}} Attrs - * @template {{[Key in string|number|symbol]: any}} NewAttrs - * @typedef {{ [K in (keyof NewAttrs | keyof Attrs)]: (unknown extends Attrs[K] ? never : Attrs[K]) | (unknown extends NewAttrs[K] ? never : NewAttrs[K]) }} MergeAttrs - */ - -/** - * @template X - * @typedef {0 extends (1 & X) ? null : X} _AnyToNull - */ - -/** - * @template {s.Schema>|null} Schema - * @typedef {_AnyToNull extends null ? Delta : (Schema extends s.Schema ? D : never)} AllowedDeltaFromSchema - */ - -/** - * @typedef {Delta} DeltaAny - */ -/** - * @typedef {DeltaBuilder} DeltaBuilderAny - */ - -/** - * @template {string} [NodeName=any] - * @template {{[k:string|number]:any}} [Attrs={}] - * @template {fingerprintTrait.Fingerprintable} [Children=never] - * @template {string} [Text=never] - * @template {s.Schema>|null} [Schema=any] - */ -class Delta { - /** - * @param {NodeName} [name] - * @param {Schema} [$schema] - */ - constructor (name, $schema) { - this.name = name || null; - this.$schema = $schema || null; - /** - * @type {{ [K in keyof Attrs]?: K extends string|number ? (AttrInsertOp|AttrDeleteOp|(Delta extends Attrs[K] ? AttrModifyOp,K> : never)) : never } - * & { [Symbol.iterator]: () => Iterator<{ [K in keyof Attrs]: K extends string|number ? (AttrInsertOp|AttrDeleteOp|(Delta extends Attrs[K] ? AttrModifyOp,K> : never)) : never }[keyof Attrs]> } - * } - */ - this.attrs = /** @type {any} */ ({ - * [Symbol.iterator] () { - for (const k in this) { - yield this[k]; - } - } - }); - - /** - * @type {list.List< - * RetainOp - * | DeleteOp - * | (Text extends never ? never : TextOp) - * | (Children extends never ? never : InsertOp) - * | (Delta extends Children ? ModifyOp>> : never) - * >} - */ - this.children = /** @type {any} */ (list.create()); - this.childCnt = 0; - /** - * @type {any} - */ - this.origin = null; - /** - * @type {string|null} - */ - this._fingerprint = null; - this.isDone = false; - } - - /** - * @type {string} - */ - get fingerprint () { - return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => { - encoding.writeUint32(encoder, 0xf2ae5680); // "magic number" that ensures that different types of content don't yield the same fingerprint - encoding.writeAny(encoder, this.name); - /** - * @type {Array} - */ - const keys = []; - for (const attr of this.attrs) { - keys.push(attr.key); - } - keys.sort((a, b) => { - const aIsString = schema.$string.check(a); - const bIsString = schema.$string.check(b); - // numbers first - // in ascending order - return (aIsString && bIsString) - ? a.localeCompare(b) - : (aIsString ? 1 : (bIsString ? -1 : (a - b))) - }); - encoding.writeVarUint(encoder, keys.length); - for (const key of keys) { - encoding.writeVarString(encoder, /** @type {any} */ (this.attrs[/** @type {keyof Attrs} */ (key)]).fingerprint); - } - encoding.writeVarUint(encoder, this.children.len); - for (const child of this.children) { - encoding.writeVarString(encoder, child.fingerprint); - } - return buffer.toBase64(rabin.fingerprint(rabin.StandardIrreducible128, encoding.toUint8Array(encoder))) - }))) - } - - [fingerprint.FingerprintTraitSymbol] () { - return this.fingerprint - } - - isEmpty () { - return object.isEmpty(this.attrs) && list.isEmpty(this.children) - } - - /** - * @return {DeltaJSON} - */ - toJSON () { - const name = this.name; - /** - * @type {any} - */ - const attrs = {}; - /** - * @type {any} - */ - const children = []; - for (const attr of this.attrs) { - attrs[attr.key] = attr.toJSON(); - } - this.children.forEach(val => { - children.push(val.toJSON()); - }); - return object.assign( - { type: /** @type {'delta'} */ ('delta') }, - (name != null ? { name } : {}), - (object.isEmpty(attrs) ? {} : { attrs }), - (children.length > 0 ? { children } : {}) - ) - } - - /** - * @param {Delta} other - * @return {boolean} - */ - equals (other) { - return this[equality.EqualityTraitSymbol](other) - } - - /** - * @param {any} other - * @return {boolean} - */ - [equality.EqualityTraitSymbol] (other) { - // @todo it is only necessary to compare finrerprints OR do a deep equality check (remove - // childCnt as well) - return this.name === other.name && _function.equalityDeep(this.attrs, other.attrs) && _function.equalityDeep(this.children, other.children) && this.childCnt === other.childCnt - } - - /** - * @return {DeltaBuilder} - */ - clone () { - return this.slice(0, this.childCnt) - } - - /** - * @param {number} start - * @param {number} end - * @return {DeltaBuilder} - */ - slice (start = 0, end = this.childCnt) { - const cpy = /** @type {DeltaAny} */ (new DeltaBuilder(/** @type {any} */ (this.name), this.$schema)); - cpy.origin = this.origin; - // copy attrs - for (const op of this.attrs) { - cpy.attrs[op.key] = /** @type {any} */ (op.clone()); - } - // copy children - const slicedLen = end - start; - let remainingLen = slicedLen; - /** - * @type {ChildrenOpAny?} - */ - let currNode = this.children.start; - let currNodeOffset = 0; - while (start > 0 && currNode != null) { - if (currNode.length <= start) { - start -= currNode.length; - currNode = currNode.next; - } else { - currNodeOffset = start; - start = 0; - } - } - if (currNodeOffset > 0 && currNode) { - const ncpy = currNode.clone(currNodeOffset, currNodeOffset + math.min(remainingLen, currNode.length - currNodeOffset)); - list.pushEnd(cpy.children, ncpy); - remainingLen -= ncpy.length; - currNode = currNode.next; - } - while (currNode != null && currNode.length <= remainingLen) { - list.pushEnd(cpy.children, currNode.clone()); - remainingLen -= currNode.length; - currNode = currNode.next; - } - if (currNode != null && remainingLen > 0) { - list.pushEnd(cpy.children, currNode.clone(0, remainingLen)); - remainingLen -= math.min(currNode.length, remainingLen); - } - cpy.childCnt = slicedLen - remainingLen; - // @ts-ignore - return cpy - } - - /** - * Mark this delta as done and perform some cleanup (e.g. remove appended retains without - * formats&attributions). In the future, there might be additional merge operations that can be - * performed to result in smaller deltas. Set `markAsDone=false` to only perform the cleanup. - * - * @return {Delta} - */ - done (markAsDone = true) { - if (!this.isDone) { - this.isDone = markAsDone; - const cs = this.children; - for (let end = cs.end; end !== null && $retainOp.check(end) && end.format == null && end.attribution == null; end = cs.end) { - this.childCnt -= end.length; - list.popEnd(cs); - } - } - return this - } -} - -/** - * @template {DeltaAny} D - * @param {D} d - * @return {D extends DeltaBuilder ? DeltaBuilder : never} - */ -const clone = d => /** @type {any} */ (d.slice(0, d.childCnt)); - -/** - * Try merging this op with the previous op - * @param {list.List} parent - * @param {InsertOp|RetainOp|DeleteOp|TextOp|ModifyOp} op - */ -const tryMergeWithPrev = (parent, op) => { - const prevOp = op.prev; - if ( - prevOp?.constructor !== op.constructor || - ( - (!$deleteOp.check(op) && !$modifyOp.check(op)) && (!_function.equalityDeep(op.format, /** @type {InsertOp} */ (prevOp).format) || !_function.equalityDeep(op.attribution, /** @type {InsertOp} */ (prevOp).attribution)) - ) - ) { - // constructor mismatch or format/attribution mismatch - return - } - // can be merged - if ($insertOp.check(op)) { - /** @type {InsertOp} */ (prevOp).insert.push(...op.insert); - } else if ($retainOp.check(op)) { - // @ts-ignore - /** @type {RetainOp} */ (prevOp).retain += op.retain; - } else if ($deleteOp.check(op)) { - /** @type {DeleteOp} */ (prevOp).delete += op.delete; - } else if ($textOp.check(op)) { - /** @type {TextOp} */ (prevOp)._updateInsert(/** @type {TextOp} */ (prevOp).insert + op.insert); - } else { - error.unexpectedCase(); - } - list.remove(parent, op); -}; - -/** - * Ensures that the delta can be edited. clears _fingerprint cache. - * - * @param {any} d - */ -const modDeltaCheck = d => { - if (d.isDone) { - /** - * You tried to modify a delta after it has been marked as "done". - */ - throw error.create("Readonly Delta can't be modified") - } - d._fingerprint = null; -}; - -/** - * @template {string} [NodeName=any] - * @template {{[key:string|number]:any}} [Attrs={}] - * @template {fingerprintTrait.Fingerprintable} [Children=never] - * @template {string} [Text=never] - * @template {s.Schema>|null} [Schema=any] - * @extends {Delta} - */ -class DeltaBuilder extends Delta { - /** - * @param {NodeName} [name] - * @param {Schema} [$schema] - */ - constructor (name, $schema) { - super(name, $schema); - /** - * @type {FormattingAttributes?} - */ - this.usedAttributes = null; - /** - * @type {Attribution?} - */ - this.usedAttribution = null; - } - - /** - * @param {Attribution?} attribution - */ - useAttribution (attribution) { - modDeltaCheck(this); - this.usedAttribution = attribution; - return this - } - - /** - * @param {FormattingAttributes?} attributes - * @return {this} - */ - useAttributes (attributes) { - modDeltaCheck(this); - this.usedAttributes = attributes; - return this - } - - /** - * @param {string} name - * @param {any} value - */ - updateUsedAttributes (name, value) { - modDeltaCheck(this); - if (value == null) { - this.usedAttributes = object.assign({}, this.usedAttributes); - delete this.usedAttributes?.[name]; - if (object.isEmpty(this.usedAttributes)) { - this.usedAttributes = null; - } - } else if (!_function.equalityDeep(this.usedAttributes?.[name], value)) { - this.usedAttributes = object.assign({}, this.usedAttributes); - this.usedAttributes[name] = value; - } - return this - } - - /** - * @template {keyof Attribution} NAME - * @param {NAME} name - * @param {Attribution[NAME]?} value - */ - updateUsedAttribution (name, value) { - modDeltaCheck(this); - if (value == null) { - this.usedAttribution = object.assign({}, this.usedAttribution); - delete this.usedAttribution?.[name]; - if (object.isEmpty(this.usedAttribution)) { - this.usedAttribution = null; - } - } else if (!_function.equalityDeep(this.usedAttribution?.[name], value)) { - this.usedAttribution = object.assign({}, this.usedAttribution); - this.usedAttribution[name] = value; - } - return this - } - - /** - * @template {AllowedDeltaFromSchema extends Delta ? ((Children extends never ? never : Array) | Text) : never} NewContent - * @param {NewContent} insert - * @param {FormattingAttributes?} [formatting] - * @param {Attribution?} [attribution] - * @return {DeltaBuilder< - * NodeName, - * Attrs, - * Exclude[number]|Children, - * (Extract|Text) extends never ? never : string, - * Schema - * >} - */ - insert (insert, formatting = null, attribution = null) { - modDeltaCheck(this); - const mergedAttributes = mergeAttrs(this.usedAttributes, formatting); - const mergedAttribution = mergeAttrs(this.usedAttribution, attribution); - /** - * @param {TextOp | InsertOp} lastOp - */ - const checkMergedEquals = lastOp => (mergedAttributes === lastOp.format || _function.equalityDeep(mergedAttributes, lastOp.format)) && (mergedAttribution === lastOp.attribution || _function.equalityDeep(mergedAttribution, lastOp.attribution)); - const end = this.children.end; - if (schema.$string.check(insert)) { - if ($textOp.check(end) && checkMergedEquals(end)) { - end._updateInsert(end.insert + insert); - } else if (insert.length > 0) { - list.pushEnd(this.children, new TextOp(insert, object.isEmpty(mergedAttributes) ? null : mergedAttributes, object.isEmpty(mergedAttribution) ? null : mergedAttribution)); - } - this.childCnt += insert.length; - } else if (array$1.isArray(insert)) { - if ($insertOp.check(end) && checkMergedEquals(end)) { - // @ts-ignore - end.insert.push(...insert); - end._fingerprint = null; - } else if (insert.length > 0) { - list.pushEnd(this.children, new InsertOp(insert, object.isEmpty(mergedAttributes) ? null : mergedAttributes, object.isEmpty(mergedAttribution) ? null : mergedAttribution)); - } - this.childCnt += insert.length; - } - return /** @type {any} */ (this) - } - - /** - * @template {AllowedDeltaFromSchema extends Delta ? Extract> : never} NewContent - * @param {NewContent} modify - * @param {FormattingAttributes?} formatting - * @param {Attribution?} attribution - * @return {DeltaBuilder< - * NodeName, - * Attrs, - * Exclude[number]|Children, - * (Extract|Text) extends string ? string : never, - * Schema - * >} - */ - modify (modify, formatting = null, attribution = null) { - modDeltaCheck(this); - const mergedAttributes = mergeAttrs(this.usedAttributes, formatting); - const mergedAttribution = mergeAttrs(this.usedAttribution, attribution); - list.pushEnd(this.children, new ModifyOp(modify, object.isEmpty(mergedAttributes) ? null : mergedAttributes, object.isEmpty(mergedAttribution) ? null : mergedAttribution)); - this.childCnt += 1; - return /** @type {any} */ (this) - } - - /** - * @param {number} len - * @param {FormattingAttributes?} [format] - * @param {Attribution?} [attribution] - */ - retain (len, format = null, attribution = null) { - modDeltaCheck(this); - const mergedFormats = mergeAttrs(this.usedAttributes, format); - const mergedAttribution = mergeAttrs(this.usedAttribution, attribution); - const lastOp = /** @type {RetainOp|InsertOp} */ (this.children.end); - if (lastOp instanceof RetainOp && _function.equalityDeep(mergedFormats, lastOp.format) && _function.equalityDeep(mergedAttribution, lastOp.attribution)) { - // @ts-ignore - lastOp.retain += len; - } else if (len > 0) { - list.pushEnd(this.children, new RetainOp(len, mergedFormats, mergedAttribution)); - } - this.childCnt += len; - return this - } - - /** - * @param {number} len - */ - delete (len) { - modDeltaCheck(this); - const lastOp = /** @type {DeleteOp|InsertOp} */ (this.children.end); - if (lastOp instanceof DeleteOp) { - lastOp.delete += len; - } else if (len > 0) { - list.pushEnd(this.children, new DeleteOp(len)); - } - this.childCnt += len; - return this - } - - /** - * @template {AllowedDeltaFromSchema extends Delta ? (keyof Attrs) : never} Key - * @template {AllowedDeltaFromSchema extends Delta ? (Attrs[Key]) : never} Val - * @param {Key} key - * @param {Val} val - * @param {Attribution?} attribution - * @param {Val|undefined} [prevValue] - * @return {DeltaBuilder< - * NodeName, - * { [K in keyof AddToAttrs]: AddToAttrs[K] }, - * Children, - * Text, - * Schema - * >} - */ - set (key, val, attribution = null, prevValue) { - modDeltaCheck(this); - this.attrs[key] = /** @type {any} */ (new AttrInsertOp(key, val, prevValue, mergeAttrs(this.usedAttribution, attribution))); - return /** @type {any} */ (this) - } - - /** - * @template {AllowedDeltaFromSchema extends Delta ? Attrs : never} NewAttrs - * @param {NewAttrs} attrs - * @param {Attribution?} attribution - * @return {DeltaBuilder< - * NodeName, - * { [K in keyof MergeAttrs]: MergeAttrs[K] }, - * Children, - * Text, - * Schema - * >} - */ - setMany (attrs, attribution = null) { - modDeltaCheck(this); - for (const k in attrs) { - this.set(/** @type {any} */ (k), attrs[k], attribution); - } - return /** @type {any} */ (this) - } - - /** - * @template {AllowedDeltaFromSchema extends Delta ? keyof As : never} Key - * @param {Key} key - * @param {Attribution?} attribution - * @param {any} [prevValue] - * @return {DeltaBuilder< - * NodeName, - * { [K in keyof AddToAttrs]: AddToAttrs[K] }, - * Children, - * Text, - * Schema - * >} - */ - unset (key, attribution = null, prevValue) { - modDeltaCheck(this); - this.attrs[key] = /** @type {any} */ (new AttrDeleteOp(key, prevValue, mergeAttrs(this.usedAttribution, attribution))); - return /** @type {any} */ (this) - } - - /** - * @template {AllowedDeltaFromSchema extends Delta ? { [K in keyof As]: Extract> extends never ? never : K }[keyof As] : never} Key - * @template {AllowedDeltaFromSchema extends Delta ? Extract> : never} D - * @param {Key} key - * @param {D} modify - * @return {DeltaBuilder< - * NodeName, - * { [K in keyof AddToAttrs]: AddToAttrs[K] }, - * Children, - * Text, - * Schema - * >} - */ - update (key, modify) { - modDeltaCheck(this); - this.attrs[key] = /** @type {any} */ (new AttrModifyOp(key, modify)); - return /** @type {any} */ (this) - } - - /** - * @param {Delta} other - */ - apply (other) { - modDeltaCheck(this); - this.$schema?.expect(other); - // apply attrs - for (const op of other.attrs) { - const c = /** @type {AttrInsertOp|AttrDeleteOp|AttrModifyOp} */ (this.attrs[op.key]); - if ($modifyOp.check(op)) { - if ($deltaAny.check(c?.value)) { - c._modValue.apply(op.value); - } else { - // then this is a simple modify - // @ts-ignore - this.attrs[op.key] = op.clone(); - } - } else if ($insertOp.check(op)) { - // @ts-ignore - op.prevValue = c?.value; - // @ts-ignore - this.attrs[op.key] = op.clone(); - } else if ($deleteOp.check(op)) { - op.prevValue = c?.value; - delete this.attrs[op.key]; - } - } - // apply children - /** - * @type {ChildrenOpAny?} - */ - let opsI = this.children.start; - let offset = 0; - /** - * At the end, we will try to merge this op, and op.next op with their respective previous op. - * - * Hence, anytime an op is cloned, deleted, or inserted (anytime list.* api is used) we must add - * an op to maybeMergeable. - * - * @type {Array|RetainOp|DeleteOp|TextOp|ModifyOp>} - */ - const maybeMergeable = []; - /** - * @template {InsertOp|RetainOp|DeleteOp|TextOp|ModifyOp|null} OP - * @param {OP} op - * @return {OP} - */ - const scheduleForMerge = op => { - op && maybeMergeable.push(op); - return op - }; - other.children.forEach(op => { - if ($textOp.check(op) || $insertOp.check(op)) { - if (offset === 0) { - list.insertBetween(this.children, opsI == null ? this.children.end : opsI.prev, opsI, scheduleForMerge(op.clone())); - } else { - // @todo inmplement "splitHelper" and "insertHelper" - I'm splitting all the time and - // forget to update opsI - if (opsI == null) error.unexpectedCase(); - const cpy = scheduleForMerge(opsI.clone(offset)); - opsI._splice(offset, opsI.length - offset); - list.insertBetween(this.children, opsI, opsI.next || null, cpy); - list.insertBetween(this.children, opsI, cpy || null, scheduleForMerge(op.clone())); - opsI = cpy; - offset = 0; - } - this.childCnt += op.insert.length; - } else if ($retainOp.check(op)) { - let retainLen = op.length; - - if (offset > 0 && opsI != null && op.format != null && !$deleteOp.check(opsI) && !object.every(op.format, (v, k) => _function.equalityDeep(v, /** @type {InsertOp|RetainOp|ModifyOp} */ (opsI).format?.[k] || null))) { - // need to split current op - const cpy = scheduleForMerge(opsI.clone(offset)); - opsI._splice(offset, opsI.length - offset); - list.insertBetween(this.children, opsI, opsI.next || null, cpy); - opsI = cpy; - offset = 0; - } - - while (opsI != null && opsI.length - offset <= retainLen) { - op.format != null && updateOpFormat(opsI, op.format); - retainLen -= opsI.length - offset; - opsI = opsI?.next || null; - offset = 0; - } - - if (opsI != null) { - if (op.format != null && retainLen > 0) { - // split current op and apply format - const cpy = scheduleForMerge(opsI.clone(retainLen)); - opsI._splice(retainLen, opsI.length - retainLen); - list.insertBetween(this.children, opsI, opsI.next || null, cpy); - updateOpFormat(opsI, op.format); - opsI = cpy; - } else { - offset += retainLen; - } - } else if (retainLen > 0) { - list.pushEnd(this.children, scheduleForMerge(new RetainOp(retainLen, op.format, op.attribution))); - this.childCnt += retainLen; - } - } else if ($deleteOp.check(op)) { - let remainingLen = op.delete; - while (remainingLen > 0) { - if (opsI == null) { - list.pushEnd(this.children, scheduleForMerge(new DeleteOp(remainingLen))); - this.childCnt += remainingLen; - break - } else if (opsI instanceof DeleteOp) { - const delLen = opsI.length - offset; - // the same content can't be deleted twice, remove duplicated deletes - if (delLen >= remainingLen) { - offset = 0; - opsI = opsI.next; - } else { - offset += remainingLen; - } - remainingLen -= delLen; - } else { // insert / embed / retain / modify ⇒ replace - // case1: delete o fully - // case2: delete some part of beginning - // case3: delete some part of end - // case4: delete some part of center - const delLen = math.min(opsI.length - offset, remainingLen); - this.childCnt -= delLen; - if (opsI.length === delLen) { - // case 1 - offset = 0; - scheduleForMerge(opsI.next); - list.remove(this.children, opsI); - opsI = opsI.next; - } else if (offset === 0) { - // case 2 - offset = 0; - opsI._splice(0, delLen); - } else if (offset + delLen === opsI.length) { - // case 3 - opsI._splice(offset, delLen); - offset = 0; - opsI = opsI.next; - } else { - // case 4 - opsI._splice(offset, delLen); - } - remainingLen -= delLen; - } - } - } else if ($modifyOp.check(op)) { - if (opsI == null) { - list.pushEnd(this.children, op.clone()); - this.childCnt += 1; - return - } - if ($modifyOp.check(opsI)) { - opsI._modValue.apply(op.value); - } else if ($insertOp.check(opsI)) { - opsI._modValue(offset).apply(op.value); - } else if ($retainOp.check(opsI)) { - if (offset > 0) { - const cpy = scheduleForMerge(opsI.clone(0, offset)); // skipped len - opsI._splice(0, offset); // new remainder - list.insertBetween(this.children, opsI.prev, opsI, cpy); // insert skipped len - offset = 0; - } - list.insertBetween(this.children, opsI.prev, opsI, scheduleForMerge(op.clone())); // insert skipped len - if (opsI.length === 1) { - list.remove(this.children, opsI); - } else { - opsI._splice(0, 1); - scheduleForMerge(opsI); - } - } else if ($deleteOp.check(opsI)) ; else { - error.unexpectedCase(); - } - } else { - error.unexpectedCase(); - } - }); - maybeMergeable.forEach(op => { - // check if this is still integrated - if (op.prev?.next === op) { - tryMergeWithPrev(this.children, op); - op.next && tryMergeWithPrev(this.children, op.next); - } - }); - return this - } - - /** - * @param {DeltaAny} other - * @param {boolean} priority - */ - rebase (other, priority) { - modDeltaCheck(this); - /** - * Rebase attributes - * - * - insert vs delete ⇒ insert takes precedence - * - insert vs modify ⇒ insert takes precedence - * - insert vs insert ⇒ priority decides - * - delete vs modify ⇒ delete takes precedence - * - delete vs delete ⇒ current delete op is removed because item has already been deleted - * - modify vs modify ⇒ rebase using priority - */ - for (const op of this.attrs) { - if ($insertOp.check(op)) { - if ($insertOp.check(other.attrs[op.key]) && !priority) { - delete this.attrs[op.key]; - } - } else if ($deleteOp.check(op)) { - const otherOp = other.attrs[/** @type {any} */ (op.key)]; - if ($insertOp.check(otherOp)) { - delete this.attrs[otherOp.key]; - } - } else if ($modifyOp.check(op)) { - const otherOp = other.attrs[/** @type {any} */ (op.key)]; - if (otherOp == null) ; else if ($modifyOp.check(otherOp)) { - op._modValue.rebase(otherOp.value, priority); - } else { - delete this.attrs[otherOp.key]; - } - } - } - /** - * Rebase children. - * - * Precedence: insert with higher priority comes first. Op with less priority is transformed to - * be inserted later. - * - * @todo always check if inser OR text - */ - /** - * @type {ChildrenOpAny?} - */ - let currChild = this.children.start; - let currOffset = 0; - /** - * @type {ChildrenOpAny?} - */ - let otherChild = other.children.start; - let otherOffset = 0; - while (currChild != null && otherChild != null) { - if ($insertOp.check(currChild) || $textOp.check(currChild)) { - /** - * Transforming *insert*. If other is.. - * - insert: transform based on priority - * - retain/delete/modify: transform next op against other - */ - if ($insertOp.check(otherChild) || $modifyOp.check(otherChild) || $textOp.check(otherChild)) { - if (!priority) { - list.insertBetween(this.children, currChild.prev, currChild, new RetainOp(otherChild.length, null, null)); - this.childCnt += otherChild.length; - // curr is transformed against other, transform curr against next - otherOffset = otherChild.length; - } else { - // curr stays as is, transform next op - currOffset = currChild.length; - } - } else { // otherChild = delete | retain | modify - curr stays as is, transform next op - currOffset = currChild.length; - } - } else if ($modifyOp.check(currChild)) { - /** - * Transforming *modify*. If other is.. - * - insert: adjust position - * - modify: rebase curr modify on other modify - * - delete: remove modify - * - retain: adjust offset - */ - if ($insertOp.check(otherChild) || $textOp.check(otherChild)) { - // @todo: with all list changes (retain insertions, removal), try to merge the surrounding - // ops later - list.insertBetween(this.children, currChild.prev, currChild, new RetainOp(otherChild.length, null, null)); - this.childCnt += otherChild.length; - // curr is transformed against other, transform curr against next - otherOffset = otherChild.length; - } else { - if ($modifyOp.check(otherChild)) { - /** @type {any} */ (currChild.value).rebase(otherChild, priority); - } else if ($deleteOp.check(otherChild)) { - list.remove(this.children, currChild); - this.childCnt -= 1; - } - currOffset += 1; - otherOffset += 1; - } - } else { // DeleteOp | RetainOp - const maxCommonLen = math.min(currChild.length - currOffset, otherChild.length - otherOffset); - /** - * Transforming *retain* OR *delete*. If other is.. - * - retain / modify: adjust offsets - * - delete: shorten curr op - * - insert: split curr op and insert retain - */ - if ($retainOp.check(otherChild) || $modifyOp.check(otherChild)) { - currOffset += maxCommonLen; - otherOffset += maxCommonLen; - } else if ($deleteOp.check(otherChild)) { - if ($retainOp.check(currChild)) { - // @ts-ignore - currChild.retain -= maxCommonLen; - } else if ($deleteOp.check(currChild)) { - currChild.delete -= maxCommonLen; - } - this.childCnt -= maxCommonLen; - } else { // insert/text.check(currOp) - if (currOffset > 0) { - const leftPart = currChild.clone(currOffset); - list.insertBetween(this.children, currChild.prev, currChild, leftPart); - currChild._splice(currOffset, currChild.length - currOffset); - currOffset = 0; - } - list.insertBetween(this.children, currChild.prev, currChild, new RetainOp(otherChild.length, null, null)); - this.childCnt += otherChild.length; - otherOffset = otherChild.length; - } - } - if (currOffset >= currChild.length) { - currChild = currChild.next; - currOffset = 0; - } - if (otherOffset >= otherChild.length) { - otherChild = otherChild.next; - otherOffset = 0; - } - } - return this - } - - /** - * Same as doing `delta.rebase(other.inverse())`, without creating a temporary delta. - * - * @param {DeltaAny} other - * @param {boolean} priority - */ - rebaseOnInverse (other, priority) { - modDeltaCheck(this); - // @todo - console.info('method rebaseOnInverse unimplemented'); - return this - } - - /** - * Append child ops from one op to the other. - * - * delta.create().insert('a').append(delta.create().insert('b')) // => insert "ab" - * - * @template {DeltaAny} OtherDelta - * @param {OtherDelta} other - * @return {CastToDelta extends Delta ? DeltaBuilder : never} - */ - append (other) { - const children = this.children; - const prevLast = children.end; - // @todo Investigate. Above is a typescript issue. It is necessary to cast OtherDelta to a Delta first before - // inferring type, otherwise Children will contain Text. - for (const child of other.children) { - list.pushEnd(children, child.clone()); - } - this.childCnt += other.childCnt; - prevLast?.next && tryMergeWithPrev(children, prevLast.next); - // @ts-ignore - return this - } -} - -/** - * @param {ChildrenOpAny} op - * @param {{[k:string]:any}} formatUpdate - */ -const updateOpFormat = (op, formatUpdate) => { - if (!$deleteOp.check(op)) { - // apply formatting attributes - for (const k in formatUpdate) { - const v = formatUpdate[k]; - if (v != null || $retainOp.check(op)) { - // never modify formats - /** @type {any} */ (op).format = object.assign({}, op.format, { [k]: v }); - } else if (op.format != null) { - const { [k]: _, ...rest } = op.format - ;/** @type {any} */ (op).format = rest; - } - } - } -}; - -/** - * @template {DeltaAny} D - * @typedef {D extends DeltaBuilder ? Delta : D} CastToDelta - */ - -/** - * @template {string} NodeName - * @template {{ [key: string|number]: any }} [Attrs={}] - * @template {fingerprintTrait.Fingerprintable|never} [Children=never] - * @template {string|never} [Text=never] - * @typedef {Delta|RecursiveDelta,Text>} RecursiveDelta - */ - -/** - * @template {string} Name - * @template {{[k:string|number]:any}} Attrs - * @template {fingerprintTrait.Fingerprintable} Children - * @template {boolean} HasText - * @template {{ [k:string]:any }} Formats - * @template {boolean} Recursive - * @extends {s.Schema : never), - * HasText extends true ? string : never, - * any>>} - */ -class $Delta extends schema.Schema { - /** - * @param {s.Schema} $name - * @param {s.Schema} $attrs - * @param {s.Schema} $children - * @param {HasText} hasText - * @param {s.Schema} $formats - * @param {Recursive} recursive - */ - constructor ($name, $attrs, $children, hasText, $formats, recursive) { - super(); - const $attrsPartial = schema.$$object.check($attrs) ? $attrs.partial : $attrs; - if (recursive) { - // @ts-ignore - $children = schema.$union($children, this); - } - this.shape = { $name, $attrs: $attrsPartial, $children, hasText, $formats }; - } - - /** - * @param {any} o - * @param {s.ValidationError} [err] - * @return {o is Delta< - * Name, - * Attrs, - * Children|(Recursive extends true ? RecursiveDelta : never), - * HasText extends true ? string : never, - * any>} - */ - check (o, err = undefined) { - const { $name, $attrs, $children, hasText, $formats } = this.shape; - if (!(o instanceof Delta)) { - err?.extend(null, 'Delta', o?.constructor.name, 'Constructor match failed'); - } else if (o.name != null && !$name.check(o.name, err)) { - err?.extend('Delta.name', $name.toString(), o.name, 'Unexpected node name'); - } else if (list.toArray(o.children).some(c => (!hasText && $textOp.check(c)) || (hasText && $textOp.check(c) && c.format != null && !$formats.check(c.format)) || ($insertOp.check(c) && !c.insert.every(ins => $children.check(ins))))) { - err?.extend('Delta.children', '', '', 'Children don\'t match the schema'); - } else if (object.some(o.attrs, (op, k) => $insertOp.check(op) && !$attrs.check({ [k]: op.value }, err))) { - err?.extend('Delta.attrs', '', '', 'Attrs don\'t match the schema'); - } else { - return true - } - return false - } -} - -/** - * @template {s.Schema|string|Array} [NodeNameSchema=s.Schema] - * @template {s.Schema<{ [key: string|number]: any }>|{ [key:string|number]:any }} [AttrsSchema=s.Schema<{}>] - * @template {any} [ChildrenSchema=s.Schema] - * @template {boolean} [HasText=false] - * @template {boolean} [Recursive=false] - * @template {{ [k:string]:any }} [Formats={[k:string]:any}] - * @param {object} opts - * @param {NodeNameSchema?} [opts.name] - * @param {AttrsSchema?} [opts.attrs] What key-value pairs are included. - * @param {ChildrenSchema?} [opts.children] The type of content in `insertOp` - * @param {HasText} [opts.text] Whether this delta contains text using `textOp` - * @param {Formats} [opts.formats] - * @param {Recursive} [opts.recursive] - * @return {[s.Unwrap>,s.Unwrap>,s.Unwrap>] extends [infer NodeName, infer Attrs, infer Children] ? s.Schema : never), - * HasText extends true ? string : never - * >> : never} - */ -const $delta = ({ name, attrs, children, text, formats, recursive }) => /** @type {any} */ (new $Delta( - name == null ? schema.$any : schema.$(name), - /** @type {any} */ (attrs == null ? schema.$object({}) : schema.$(attrs)), - /** @type {any} */ (children == null ? schema.$never : schema.$(children)), - text ?? false, - formats == null ? schema.$any : schema.$(formats), - recursive ?? false -)); - -const $$delta = schema.$constructedBy($Delta); - -/** - * @todo remove this - * - * @template {s.Schema|string|Array} [NodeNameSchema=s.Schema] - * @template {s.Schema<{ [key: string|number]: any }>|{ [key:string|number]:any }} [AttrsSchema=s.Schema<{}>] - * @template {any} [ChildrenSchema=s.Schema] - * @template {boolean} [HasText=false] - * @template {boolean} [Recursive=false] - * @param {object} opts - * @param {NodeNameSchema?} [opts.name] - * @param {AttrsSchema?} [opts.attrs] - * @param {ChildrenSchema?} [opts.children] - * @param {HasText} [opts.text] - * @param {Recursive} [opts.recursive] - * @return {[s.Unwrap>,s.Unwrap>,s.Unwrap>] extends [infer NodeName, infer Attrs, infer Children] ? s.Schema : never), - * HasText extends true ? string : never - * >> : never} - */ -const _$delta = ({ name, attrs, children, text, recursive }) => { - /** - * @type {s.Schema>} - */ - let $arrContent = children == null ? schema.$never : schema.$array(schema.$(children)); - const $name = name == null ? schema.$any : schema.$(name); - const $attrsPartial = attrs == null ? schema.$object({}) : (schema.$$record.check(attrs) ? attrs : /** @type {any} */ (schema.$(attrs)).partial); - const $d = schema.$instanceOf(Delta, /** @param {Delta} d */ d => { - if ( - !$name.check(d.name) || - object.some(d.attrs, - (op, k) => $insertOp.check(op) && !$attrsPartial.check({ [k]: op.value }) - ) - ) return false - for (const op of d.children) { - if ((!text && $textOp.check(op)) || ($insertOp.check(op) && !$arrContent.check(op.insert))) { - return false - } - } - return true - }); - if (recursive) { - $arrContent = children == null ? schema.$array($d) : schema.$array(schema.$(children), $d); - } - return /** @type {any} */ ($d) -}; - -/** - * @type {s.Schema} - */ -const $deltaAny = /** @type {any} */ (schema.$instanceOf(Delta)); - -/** - * @type {s.Schema} - */ -const $deltaBuilderAny = /** @type {any} */ (schema.$instanceOf(DeltaBuilder)); - -/** - * Helper function to merge attribution and attributes. The latter input "wins". - * - * @template {{ [key: string]: any }} T - * @param {T | null} a - * @param {T | null} b - */ -const mergeAttrs = (a, b) => object.isEmpty(a) - ? (object.isEmpty(b) ? null : b) - : (object.isEmpty(b) ? a : object.assign({}, a, b)); - -/** - * @template {DeltaAny|null} D - * @param {D} a - * @param {D} b - * @return {D} - */ -const mergeDeltas = (a, b) => { - if (a != null && b != null) { - const c = clone(a); - c.apply(b); - return /** @type {any} */ (c) - } - return a == null ? b : (a || null) -}; - -/** - * @template {DeltaAny} D - * @param {prng.PRNG} gen - * @param {s.Schema} $d - * @return {D extends Delta ? DeltaBuilder : never} - */ -const random = (gen, $d) => { - const { $name, $attrs, $children, hasText, $formats: $formats_ } = /** @type {$Delta} */ (/** @type {any} */ ($d)).shape; - const d = schema.$$any.check($name) ? create($deltaAny) : create(schema.random(gen, $name), $deltaAny); - const $formats = schema.$$any.check($formats_) ? schema.$null : $formats_; - prng.bool(gen) && d.setMany(schema.random(gen, $attrs)); - for (let i = prng.uint32(gen, 0, 5); i > 0; i--) { - if (hasText && prng.bool(gen)) { - d.insert(prng.word(gen), schema.random(gen, $formats)); - } else if (!schema.$$never.check($children)) { - /** - * @type {Array} - */ - const ins = []; - let insN = prng.int32(gen, 0, 5); - while (insN--) { - ins.push(schema.random(gen, $children)); - } - d.insert(ins, schema.random(gen, $formats)); - } - } - return /** @type {any} */ (d) -}; - -/** - * @overload - * @return {DeltaBuilder} - */ -/** - * @template {string} NodeName - * @overload - * @param {NodeName} nodeName - * @return {DeltaBuilder} - */ -/** - * @template {string} NodeName - * @template {s.Schema} Schema - * @overload - * @param {NodeName} nodeName - * @param {Schema} schema - * @return {Schema extends s.Schema> ? DeltaBuilder : never} - */ -/** - * @template {s.Schema} Schema - * @overload - * @param {Schema} schema - * @return {Schema extends s.Schema> ? DeltaBuilder : never} - */ -/** - * @template {string|null} NodeName - * @template {{[k:string|number]:any}|null} Attrs - * @template {Array|string} [Children=never] - * @overload - * @param {NodeName} nodeName - * @param {Attrs} attrs - * @param {Children} [children] - * @return {DeltaBuilder< - * NodeName extends null ? any : NodeName, - * Attrs extends null ? {} : Attrs, - * Extract> extends Array ? (unknown extends Ac ? never : Ac) : never, - * Extract, - * null - * >} - */ -/** - * @param {string|s.Schema} [nodeNameOrSchema] - * @param {{[K:string|number]:any}|s.Schema} [attrsOrSchema] - * @param {(Array|string)} [children] - * @return {DeltaBuilder} - */ -const create = (nodeNameOrSchema, attrsOrSchema, children) => { - const nodeName = /** @type {any} */ (schema.$string.check(nodeNameOrSchema) ? nodeNameOrSchema : null); - const schema$1 = /** @type {any} */ (schema.$$schema.check(nodeNameOrSchema) ? nodeNameOrSchema : (schema.$$schema.check(attrsOrSchema) ? attrsOrSchema : null)); - const d = /** @type {DeltaBuilder} */ (new DeltaBuilder(nodeName, schema$1)); - if (schema.$objectAny.check(attrsOrSchema)) { - d.setMany(attrsOrSchema); - } - children && d.insert(children); - return d -}; - -// DELTA TEXT - -/** - * @template {fingerprintTrait.Fingerprintable} [Embeds=never] - * @typedef {Delta} TextDelta - */ - -/** - * @template {fingerprintTrait.Fingerprintable} [Embeds=never] - * @typedef {DeltaBuilder} TextDeltaBuilder - */ - -/** - * @template {Array>} [$Embeds=any] - * @param {$Embeds} $embeds - * @return {s.Schema extends null ? never : ($Embeds extends Array> ? $C : never)>>} - */ -const $text = (...$embeds) => /** @type {any} */ ($delta({ children: schema.$union(...$embeds), text: true })); -const $textOnly = $text(); - -/** - * @template {s.Schema>} [Schema=s.Schema>] - * @param {Schema} [$schema] - * @return {Schema extends s.Schema> ? DeltaBuilder : never} - */ -const text = $schema => /** @type {any} */ (create($schema || $textOnly)); - -/** - * @template {fingerprintTrait.Fingerprintable} Children - * @typedef {Delta} ArrayDelta - */ - -/** - * @template {fingerprintTrait.Fingerprintable} Children - * @typedef {DeltaBuilder} ArrayDeltaBuilder - */ - -/** - * @template {any|s.Schema} $Children - * @param {$Children} [$children] - * @return {s.Schema>>>} - */ -const $array = $children => /** @type {any} */ ($delta({ children: $children })); - -/** - * @template {s.Schema>} [$Schema=never] - * @param {$Schema} $schema - * @return {$Schema extends never ? ArrayDeltaBuilder : DeltaBuilder} - */ -const array = $schema => /** @type {any} */ ($schema ? create($schema) : create()); - -/** - * @template {{ [K: string|number]: any }} Attrs - * @typedef {Delta} MapDelta - */ - -/** - * @template {{ [K: string|number]: any }} Attrs - * @typedef {DeltaBuilder} MapDeltaBuilder - */ - -/** - * @template {{ [K: string|number]: any }} $Attrs - * @param {s.Schema<$Attrs>} $attrs - * @return {s.Schema>} - */ -const $map = $attrs => /** @type {any} */ ($delta({ attrs: $attrs })); - -/** - * @template {s.Schema>|undefined} [$Schema=undefined] - * @param {$Schema} [$schema] - * @return {$Schema extends s.Schema> ? DeltaBuilder : MapDeltaBuilder<{}>} - */ -const map = $schema => /** @type {any} */ (create(/** @type {any} */ ($schema))); - -/** - * @template {DeltaAny} D - * @param {D} d1 - * @param {NoInfer} d2 - * @return {D extends Delta ? DeltaBuilder : never} - */ -const diff = (d1, d2) => { - /** - * @type {DeltaBuilderAny} - */ - const d = create(); - if (d1.fingerprint !== d2.fingerprint) { - let left1 = d1.children.start; - let left2 = d2.children.start; - let right1 = d1.children.end; - let right2 = d2.children.end; - let commonPrefixOffset = 0; - // perform a patience sort - // 1) remove common prefix and suffix - while (left1 != null && left1.fingerprint === left2?.fingerprint) { - if (!$deleteOp.check(left1)) { - commonPrefixOffset += left1.length; - } - left1 = left1.next; - left2 = left2.next; - } - while (right1 !== null && right1 !== left1 && right1.fingerprint === right2?.fingerprint) { - right1 = right1.prev; - right2 = right2.prev; - } - /** - * @type {Array} - */ - const ops1 = []; - /** - * @type {Array} - */ - const ops2 = []; - while (left1 !== null && left1 !== right1?.next) { - ops1.push(left1); - left1 = left1.next; - } - while (left2 !== null && left2 !== right2?.next) { - ops2.push(left2); - left2 = left2.next; - } - const fprints1 = ops1.map(op => op.fingerprint); - const fprints2 = ops2.map(op => op.fingerprint); - const changeset = patience.diff(fprints1, fprints2); - d.retain(commonPrefixOffset); - for (let i = 0, lastIndex1 = 0, currIndexOffset2 = 0; i < changeset.length; i++) { - const change = changeset[i]; - d.retain(change.index - lastIndex1); - // insert minimal diff at curred position in d - /** - * - * @todo it would be better if these would be slices of delta (an actual delta) - * - * @param {ChildrenOpAny[]} opsIs - * @param {ChildrenOpAny[]} opsShould - */ - const diffAndApply = (opsIs, opsShould) => { - const d = create(); - // @todo unoptimized implementation. Convert content to array and diff that based on - // generated fingerprints. We probably could do better and cache more information. - // - benchmark - // - cache fingerprints in ops - /** - * @type {Array} - */ - const isContent = opsIs.flatMap(op => $insertOp.check(op) ? op.insert : ($textOp.check(op) ? op.insert.split('') : error.unexpectedCase())); - /** - * @type {Array} - */ - const shouldContent = opsShould.flatMap(op => $insertOp.check(op) ? op.insert : ($textOp.check(op) ? op.insert.split('') : error.unexpectedCase())); - const isContentFingerprinted = isContent.map(c => schema.$string.check(c) ? c : fingerprint.fingerprint(c)); - const shouldContentFingerprinted = shouldContent.map(c => schema.$string.check(c) ? c : fingerprint.fingerprint(c)); - const hasFormatting = opsIs.some(op => !$deleteOp.check(op) && op.format != null) || opsShould.some(op => !$deleteOp.check(op) && op.format != null); - /** - * @type {{ index: number, insert: Array, remove: Array }[]} - */ - const cdiff = patience.diff(isContentFingerprinted, shouldContentFingerprinted); - // overwrite fingerprinted content with actual content - for (let i = 0, adj = 0; i < cdiff.length; i++) { - const cd = cdiff[i]; - cd.remove = isContent.slice(cd.index, cd.index + cd.remove.length); - cd.insert = shouldContent.slice(cd.index + adj, cd.index + adj + cd.insert.length); - adj += cd.insert.length - cd.remove.length; - } - for (let i = 0, lastIndex = 0; i < cdiff.length; i++) { - const cd = cdiff[i]; - d.retain(cd.index - lastIndex); - lastIndex = cd.index; - let cdii = 0; - let cdri = 0; - // try to match as much content as possible, preferring to skip over non-deltas - for (; cdii < cd.insert.length && cdri < cd.remove.length;) { - const a = cd.insert[cdii]; - const b = cd.remove[cdri]; - if ($deltaAny.check(a) && $deltaAny.check(b) && a.name === b.name) { - d.modify(diff(b, a)); - cdii++; - cdri++; - } else if ($deltaAny.check(b)) { - d.insert(schema.$string.check(a) ? a : [a]); - cdii++; - } else { - d.delete(1); - cdri++; - } - } - for (; cdii < cd.insert.length; cdii++) { - const a = cd.insert[cdii]; - d.insert(schema.$string.check(a) ? a : [a]); - } - d.delete(cd.remove.length - cdri); - } - // create the diff for formatting - if (hasFormatting) { - const formattingDiff = create(); - // update opsIs with content diff. then we can figure out the formatting diff. - const isUpdated = create(); - // copy opsIs to fresh delta - opsIs.forEach(op => { - isUpdated.childCnt += op.length; - list.pushEnd(isUpdated.children, op.clone()); - }); - isUpdated.apply(d); - let shouldI = 0; - let shouldOffset = 0; - let isOp = isUpdated.children.start; - let isOffset = 0; - while (shouldI < opsShould.length && isOp != null) { - const shouldOp = opsShould[shouldI]; - if (!$deleteOp.check(shouldOp) && !$deleteOp.check(isOp)) { - const isFormat = isOp.format; - const minForward = math.min(shouldOp.length - shouldOffset, isOp.length - isOffset); - shouldOffset += minForward; - isOffset += minForward; - if (_function.equalityDeep(shouldOp.format, isFormat)) { - formattingDiff.retain(minForward); - } else { - /** - * @type {FormattingAttributes} - */ - const fupdate = {}; - shouldOp.format != null && object.forEach(shouldOp.format, (v, k) => { - if (!_function.equalityDeep(v, isFormat?.[k] || null)) { - fupdate[k] = v; - } - }); - isFormat && object.forEach(isFormat, (_, k) => { - if (shouldOp?.format?.[k] === undefined) { - fupdate[k] = null; - } - }); - formattingDiff.retain(minForward, fupdate); - } - // update offset and iterators - if (shouldOffset >= shouldOp.length) { - shouldI++; - shouldOffset = 0; - } - if (isOffset >= isOp.length) { - isOp = isOp.next; - isOffset = 0; - } - } - } - d.apply(formattingDiff); - } - return d - }; - const subd = diffAndApply(ops1.slice(change.index, change.index + change.remove.length), ops2.slice(change.index + currIndexOffset2, change.index + currIndexOffset2 + change.insert.length)); - d.append(subd); - lastIndex1 = change.index + change.remove.length; - currIndexOffset2 += change.insert.length - change.remove.length; - } - for (const attr2 of d2.attrs) { - const attr1 = d1.attrs[attr2.key]; - if (attr1 == null || (attr1.fingerprint !== attr2.fingerprint)) { - /* c8 ignore else */ - if ($insertOp.check(attr2)) { - d.set(attr2.key, attr2.value); - } else { - /* c8 ignore next 2 */ - error.unexpectedCase(); - } - } - } - for (const attr1 of d1.attrs) { - if (d2.attrs[attr1.key] == null) { - d.unset(attr1.key); - } - } - } - return /** @type {any} */ (d.done(false)) -}; - -exports.$$delta = $$delta; -exports.$Delta = $Delta; -exports.$anyOp = $anyOp; -exports.$array = $array; -exports.$attribution = $attribution; -exports.$deleteOp = $deleteOp; -exports.$delta = $delta; -exports.$deltaAny = $deltaAny; -exports.$deltaBuilderAny = $deltaBuilderAny; -exports.$deltaMapChangeJson = $deltaMapChangeJson; -exports.$insertOp = $insertOp; -exports.$insertOpWith = $insertOpWith; -exports.$map = $map; -exports.$modifyOp = $modifyOp; -exports.$modifyOpWith = $modifyOpWith; -exports.$retainOp = $retainOp; -exports.$text = $text; -exports.$textOnly = $textOnly; -exports.$textOp = $textOp; -exports.AttrDeleteOp = AttrDeleteOp; -exports.AttrInsertOp = AttrInsertOp; -exports.AttrModifyOp = AttrModifyOp; -exports.DeleteOp = DeleteOp; -exports.Delta = Delta; -exports.DeltaBuilder = DeltaBuilder; -exports.InsertOp = InsertOp; -exports.ModifyOp = ModifyOp; -exports.RetainOp = RetainOp; -exports.TextOp = TextOp; -exports._$delta = _$delta; -exports.array = array; -exports.clone = clone; -exports.create = create; -exports.diff = diff; -exports.map = map; -exports.mergeAttrs = mergeAttrs; -exports.mergeDeltas = mergeDeltas; -exports.random = random; -exports.text = text; -//# sourceMappingURL=delta.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/delta.cjs.map b/yjs-poll/node_modules/lib0/dist/delta.cjs.map deleted file mode 100644 index 0846bbc..0000000 --- a/yjs-poll/node_modules/lib0/dist/delta.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"delta.cjs","sources":["../delta/delta.js"],"sourcesContent":["/**\n * @beta this API is about to change\n *\n * ## Mutability\n *\n * Deltas are mutable by default. But references are often shared, by marking a Delta as \"done\". You\n * may only modify deltas by applying other deltas to them. Casting a Delta to a DeltaBuilder\n * manually, will likely modify \"shared\" state.\n */\n\nimport * as list from '../list.js'\nimport * as object from '../object.js'\nimport * as equalityTrait from '../trait/equality.js'\nimport * as fingerprintTrait from '../trait/fingerprint.js'\nimport * as arr from '../array.js'\nimport * as fun from '../function.js'\nimport * as s from '../schema.js'\nimport * as error from '../error.js'\nimport * as math from '../math.js'\nimport * as rabin from '../hash/rabin.js'\nimport * as encoding from '../encoding.js'\nimport * as buffer from '../buffer.js'\nimport * as patience from '../diff/patience.js'\nimport * as prng from '../prng.js'\n\n/**\n * @typedef {{\n * insert?: string[]\n * insertAt?: number\n * delete?: string[]\n * deleteAt?: number\n * format?: Record\n * formatAt?: number\n * }} Attribution\n */\n\n/**\n * @type {s.Schema}\n */\nexport const $attribution = s.$object({\n insert: s.$array(s.$string).optional,\n insertAt: s.$number.optional,\n delete: s.$array(s.$string).optional,\n deleteAt: s.$number.optional,\n format: s.$record(s.$string, s.$array(s.$string)).optional,\n formatAt: s.$number.optional\n})\n\n/**\n * @typedef {s.Unwrap<$anyOp>} DeltaOps\n */\n\n/**\n * @typedef {{ [key: string]: any }} FormattingAttributes\n */\n\n/**\n * @typedef {{\n * type: 'delta',\n * name?: string,\n * attrs?: { [Key in string|number]: DeltaAttrOpJSON },\n * children?: Array\n * }} DeltaJSON\n */\n\n/**\n * @typedef {{ type: 'insert', insert: string|Array, format?: { [key: string]: any }, attribution?: Attribution } | { delete: number } | { type: 'retain', retain: number, format?: { [key:string]: any }, attribution?: Attribution } | { type: 'modify', value: object }} DeltaListOpJSON\n */\n\n/**\n * @typedef {{ type: 'insert', value: any, prevValue?: any, attribution?: Attribution } | { type: 'delete', prevValue?: any, attribution?: Attribution } | { type: 'modify', value: DeltaJSON }} DeltaAttrOpJSON\n */\n\n/**\n * @typedef {TextOp|InsertOp|DeleteOp|RetainOp|ModifyOp} ChildrenOpAny\n */\n\n/**\n * @typedef {AttrInsertOp|AttrDeleteOp|AttrModifyOp} AttrOpAny\n */\n\n/**\n * @typedef {ChildrenOpAny|AttrOpAny} _OpAny\n */\n\n/**\n * @type {s.Schema}\n */\nexport const $deltaMapChangeJson = s.$union(\n s.$object({ type: s.$literal('insert'), value: s.$any, prevValue: s.$any.optional, attribution: $attribution.optional }),\n s.$object({ type: s.$literal('modify'), value: s.$any }),\n s.$object({ type: s.$literal('delete'), prevValue: s.$any.optional, attribution: $attribution.optional })\n)\n\n/**\n * @template {{[key:string]: any} | null} Attrs\n * @param {Attrs} attrs\n * @return {Attrs}\n */\nconst _cloneAttrs = attrs => attrs == null ? attrs : { ...attrs }\n/**\n * @template {any} MaybeDelta\n * @param {MaybeDelta} maybeDelta\n * @return {MaybeDelta}\n */\nconst _markMaybeDeltaAsDone = maybeDelta => $deltaAny.check(maybeDelta) ? /** @type {MaybeDelta} */ (maybeDelta.done()) : maybeDelta\n\nexport class TextOp extends list.ListNode {\n /**\n * @param {string} insert\n * @param {FormattingAttributes|null} format\n * @param {Attribution?} attribution\n */\n constructor (insert, format, attribution) {\n super()\n // Whenever this is modified, make sure to clear _fingerprint\n /**\n * @readonly\n * @type {string}\n */\n this.insert = insert\n /**\n * @readonly\n * @type {FormattingAttributes|null}\n */\n this.format = format\n this.attribution = attribution\n /**\n * @type {string?}\n */\n this._fingerprint = null\n }\n\n /**\n * @param {string} newVal\n */\n _updateInsert (newVal) {\n // @ts-ignore\n this.insert = newVal\n this._fingerprint = null\n }\n\n /**\n * @return {'insert'}\n */\n get type () {\n return 'insert'\n }\n\n get length () {\n return this.insert.length\n }\n\n get fingerprint () {\n return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => {\n encoding.writeVarUint(encoder, 0) // textOp type: 0\n encoding.writeVarString(encoder, this.insert)\n encoding.writeAny(encoder, this.format)\n })))\n }\n\n /**\n * Remove a part of the operation (similar to Array.splice)\n *\n * @param {number} offset\n * @param {number} len\n */\n _splice (offset, len) {\n this._fingerprint = null\n // @ts-ignore\n this.insert = this.insert.slice(0, offset) + this.insert.slice(offset + len)\n return this\n }\n\n /**\n * @return {DeltaListOpJSON}\n */\n toJSON () {\n const { insert, format, attribution } = this\n return object.assign(/** @type {{type: 'insert', insert: string}} */ ({ type: 'insert', insert }), format != null ? { format } : ({}), attribution != null ? { attribution } : ({}))\n }\n\n /**\n * @param {TextOp} other\n */\n [equalityTrait.EqualityTraitSymbol] (other) {\n return fun.equalityDeep(this.insert, other.insert) && fun.equalityDeep(this.format, other.format) && fun.equalityDeep(this.attribution, other.attribution)\n }\n\n /**\n * @return {TextOp}\n */\n clone (start = 0, end = this.length) {\n return new TextOp(this.insert.slice(start, end), _cloneAttrs(this.format), _cloneAttrs(this.attribution))\n }\n}\n\n/**\n * @template {fingerprintTrait.Fingerprintable} ArrayContent\n */\nexport class InsertOp extends list.ListNode {\n /**\n * @param {Array} insert\n * @param {FormattingAttributes|null} format\n * @param {Attribution?} attribution\n */\n constructor (insert, format, attribution) {\n super()\n /**\n * @readonly\n * @type {Array}\n */\n this.insert = insert\n /**\n * @readonly\n * @type {FormattingAttributes?}\n */\n this.format = format\n /**\n * @readonly\n * @type {Attribution?}\n */\n this.attribution = attribution\n /**\n * @type {string?}\n */\n this._fingerprint = null\n }\n\n /**\n * @param {ArrayContent} newVal\n */\n _updateInsert (newVal) {\n // @ts-ignore\n this.insert = newVal\n this._fingerprint = null\n }\n\n /**\n * @return {'insert'}\n */\n get type () {\n return 'insert'\n }\n\n get length () {\n return this.insert.length\n }\n\n /**\n * @param {number} i\n * @return {Extract}\n */\n _modValue (i) {\n /**\n * @type {any}\n */\n let d = this.insert[i]\n this._fingerprint = null\n $deltaAny.expect(d)\n if (d.isDone) {\n // @ts-ignore\n this.insert[i] = (d = clone(d))\n return d\n }\n return d\n }\n\n get fingerprint () {\n return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => {\n encoding.writeVarUint(encoder, 1) // insertOp type: 1\n encoding.writeVarUint(encoder, this.insert.length)\n this.insert.forEach(ins => {\n encoding.writeVarString(encoder, fingerprintTrait.fingerprint(ins))\n })\n encoding.writeAny(encoder, this.format)\n })))\n }\n\n /**\n * Remove a part of the operation (similar to Array.splice)\n *\n * @param {number} offset\n * @param {number} len\n */\n _splice (offset, len) {\n this._fingerprint = null\n this.insert.splice(offset, len)\n return this\n }\n\n /**\n * @return {DeltaListOpJSON}\n */\n toJSON () {\n const { insert, format, attribution } = this\n return object.assign({ type: /** @type {'insert'} */ ('insert'), insert: insert.map(ins => $deltaAny.check(ins) ? ins.toJSON() : ins) }, format ? { format } : ({}), attribution != null ? { attribution } : ({}))\n }\n\n /**\n * @param {InsertOp} other\n */\n [equalityTrait.EqualityTraitSymbol] (other) {\n return fun.equalityDeep(this.insert, other.insert) && fun.equalityDeep(this.format, other.format) && fun.equalityDeep(this.attribution, other.attribution)\n }\n\n /**\n * @return {InsertOp}\n */\n clone (start = 0, end = this.length) {\n return new InsertOp(this.insert.slice(start, end).map(_markMaybeDeltaAsDone), _cloneAttrs(this.format), _cloneAttrs(this.attribution))\n }\n}\n\n/**\n * @template {fingerprintTrait.Fingerprintable} [Children=never]\n * @template {string} [Text=never]\n */\nexport class DeleteOp extends list.ListNode {\n /**\n * @param {number} len\n */\n constructor (len) {\n super()\n this.delete = len\n /**\n * @type {(Children|Text) extends never ? null : (Delta?)}\n */\n this.prevValue = null\n /**\n * @type {string|null}\n */\n this._fingerprint = null\n }\n\n /**\n * @return {'delete'}\n */\n get type () {\n return 'delete'\n }\n\n get length () {\n return 0\n }\n\n get fingerprint () {\n return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => {\n encoding.writeVarUint(encoder, 2) // deleteOp type: 2\n encoding.writeVarUint(encoder, this.delete)\n })))\n }\n\n /**\n * Remove a part of the operation (similar to Array.splice)\n *\n * @param {number} _offset\n * @param {number} len\n */\n _splice (_offset, len) {\n this.prevValue = /** @type {any} */ (this.prevValue?.slice(_offset, len) || null)\n this._fingerprint = null\n this.delete -= len\n return this\n }\n\n /**\n * @return {DeltaListOpJSON}\n */\n toJSON () {\n return { delete: this.delete }\n }\n\n /**\n * @param {DeleteOp} other\n */\n [equalityTrait.EqualityTraitSymbol] (other) {\n return this.delete === other.delete\n }\n\n clone (start = 0, end = this.delete) {\n return new DeleteOp(end - start)\n }\n}\n\nexport class RetainOp extends list.ListNode {\n /**\n * @param {number} retain\n * @param {FormattingAttributes|null} format\n * @param {Attribution?} attribution\n */\n constructor (retain, format, attribution) {\n super()\n /**\n * @readonly\n * @type {number}\n */\n this.retain = retain\n /**\n * @readonly\n * @type {FormattingAttributes?}\n */\n this.format = format\n /**\n * @readonly\n * @type {Attribution?}\n */\n this.attribution = attribution\n /**\n * @type {string|null}\n */\n this._fingerprint = null\n }\n\n /**\n * @return {'retain'}\n */\n get type () {\n return 'retain'\n }\n\n get length () {\n return this.retain\n }\n\n get fingerprint () {\n return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => {\n encoding.writeVarUint(encoder, 3) // retainOp type: 3\n encoding.writeVarUint(encoder, this.retain)\n encoding.writeAny(encoder, this.format)\n })))\n }\n\n /**\n * Remove a part of the operation (similar to Array.splice)\n *\n * @param {number} _offset\n * @param {number} len\n */\n _splice (_offset, len) {\n // @ts-ignore\n this.retain -= len\n this._fingerprint = null\n return this\n }\n\n /**\n * @return {DeltaListOpJSON}\n */\n toJSON () {\n const { retain, format, attribution } = this\n return object.assign({ type: /** @type {'retain'} */ ('retain'), retain }, format ? { format } : {}, attribution != null ? { attribution } : {})\n }\n\n /**\n * @param {RetainOp} other\n */\n [equalityTrait.EqualityTraitSymbol] (other) {\n return this.retain === other.retain && fun.equalityDeep(this.format, other.format) && fun.equalityDeep(this.attribution, other.attribution)\n }\n\n clone (start = 0, end = this.retain) {\n return new RetainOp(end - start, _cloneAttrs(this.format), _cloneAttrs(this.attribution))\n }\n}\n\n/**\n * Delta that can be applied on a YType Embed\n *\n * @template {DeltaAny} [DTypes=DeltaAny]\n */\nexport class ModifyOp extends list.ListNode {\n /**\n * @param {DTypes} delta\n * @param {FormattingAttributes|null} format\n * @param {Attribution?} attribution\n */\n constructor (delta, format, attribution) {\n super()\n /**\n * @readonly\n * @type {DTypes}\n */\n this.value = delta\n /**\n * @readonly\n * @type {FormattingAttributes?}\n */\n this.format = format\n /**\n * @readonly\n * @type {Attribution?}\n */\n this.attribution = attribution\n /**\n * @type {string|null}\n */\n this._fingerprint = null\n }\n\n /**\n * @return {'modify'}\n */\n get type () {\n return 'modify'\n }\n\n get length () {\n return 1\n }\n\n /**\n * @type {DeltaBuilderAny}\n */\n get _modValue () {\n /**\n * @type {any}\n */\n const d = this.value\n this._fingerprint = null\n if (d.isDone) {\n // @ts-ignore\n return (this.value = clone(d))\n }\n return d\n }\n\n get fingerprint () {\n // don't cache fingerprint because we don't know when delta changes\n return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => {\n encoding.writeVarUint(encoder, 4) // modifyOp type: 4\n encoding.writeVarString(encoder, this.value.fingerprint)\n encoding.writeAny(encoder, this.format)\n })))\n }\n\n /**\n * Remove a part of the operation (similar to Array.splice)\n *\n * @param {number} _offset\n * @param {number} _len\n */\n _splice (_offset, _len) {\n return this\n }\n\n /**\n * @return {DeltaListOpJSON}\n */\n toJSON () {\n const { value, attribution, format } = this\n return object.assign({ type: /** @type {'modify'} */ ('modify'), value: value.toJSON() }, format ? { format } : {}, attribution != null ? { attribution } : {})\n }\n\n /**\n * @param {ModifyOp} other\n */\n [equalityTrait.EqualityTraitSymbol] (other) {\n return this.value[equalityTrait.EqualityTraitSymbol](other.value) && fun.equalityDeep(this.format, other.format) && fun.equalityDeep(this.attribution, other.attribution)\n }\n\n /**\n * @return {ModifyOp}\n */\n clone () {\n return new ModifyOp(/** @type {DTypes} */ (this.value.done()), _cloneAttrs(this.format), _cloneAttrs(this.attribution))\n }\n}\n\n/**\n * @template {fingerprintTrait.Fingerprintable} V\n * @template {string|number} [K=any]\n */\nexport class AttrInsertOp {\n /**\n * @param {K} key\n * @param {V} value\n * @param {V|undefined} prevValue\n * @param {Attribution?} attribution\n */\n constructor (key, value, prevValue, attribution) {\n /**\n * @readonly\n * @type {K}\n */\n this.key = key\n /**\n * @readonly\n * @type {V}\n */\n this.value = value\n /**\n * @readonly\n * @type {V|undefined}\n */\n this.prevValue = prevValue\n /**\n * @readonly\n * @type {Attribution?}\n */\n this.attribution = attribution\n /**\n * @type {string|null}\n */\n this._fingerprint = null\n }\n\n /**\n * @return {'insert'}\n */\n get type () { return 'insert' }\n\n /**\n * @type {DeltaBuilderAny}\n */\n get _modValue () {\n /**\n * @type {any}\n */\n const v = this.value\n this._fingerprint = null\n if ($deltaAny.check(v) && v.isDone) {\n // @ts-ignore\n return (this.value = clone(v))\n }\n return v\n }\n\n get fingerprint () {\n return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => {\n encoding.writeVarUint(encoder, 5) // map insert type: 5\n encoding.writeAny(encoder, this.key)\n if ($deltaAny.check(this.value)) {\n encoding.writeUint8(encoder, 0)\n encoding.writeVarString(encoder, this.value.fingerprint)\n } else {\n encoding.writeUint8(encoder, 1)\n encoding.writeAny(encoder, this.value)\n }\n })))\n }\n\n toJSON () {\n const v = this.value\n const prevValue = this.prevValue\n const attribution = this.attribution\n return object.assign({\n type: this.type,\n value: $deltaAny.check(v) ? v.toJSON() : v\n }, attribution != null ? { attribution } : {}, prevValue !== undefined ? { prevValue } : {})\n }\n\n /**\n * @param {AttrInsertOp} other\n */\n [equalityTrait.EqualityTraitSymbol] (other) {\n return this.key === other.key && fun.equalityDeep(this.value, other.value) && fun.equalityDeep(this.attribution, other.attribution)\n }\n\n /**\n * @return {AttrInsertOp}\n */\n clone () {\n return new AttrInsertOp(this.key, _markMaybeDeltaAsDone(this.value), _markMaybeDeltaAsDone(this.prevValue), _cloneAttrs(this.attribution))\n }\n}\n\n/**\n * @template V\n * @template {string|number} [K=string]\n */\nexport class AttrDeleteOp {\n /**\n * @param {K} key\n * @param {V|undefined} prevValue\n * @param {Attribution?} attribution\n */\n constructor (key, prevValue, attribution) {\n /**\n * @type {K}\n */\n this.key = key\n /**\n * @type {V|undefined}\n */\n this.prevValue = prevValue\n this.attribution = attribution\n /**\n * @type {string|null}\n */\n this._fingerprint = null\n }\n\n get value () { return undefined }\n\n /**\n * @type {'delete'}\n */\n get type () { return 'delete' }\n\n get fingerprint () {\n return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => {\n encoding.writeVarUint(encoder, 6) // map delete type: 6\n encoding.writeAny(encoder, this.key)\n })))\n }\n\n /**\n * @return {DeltaAttrOpJSON}\n */\n toJSON () {\n const {\n type, attribution, prevValue\n } = this\n return object.assign({ type }, attribution != null ? { attribution } : {}, prevValue !== undefined ? { prevValue } : {})\n }\n\n /**\n * @param {AttrDeleteOp} other\n */\n [equalityTrait.EqualityTraitSymbol] (other) {\n return this.key === other.key && fun.equalityDeep(this.attribution, other.attribution)\n }\n\n clone () {\n return new AttrDeleteOp(this.key, _markMaybeDeltaAsDone(this.prevValue), _cloneAttrs(this.attribution))\n }\n}\n\n/**\n * @template {DeltaAny} [Modifier=DeltaAny]\n * @template {string|number} [K=string]\n */\nexport class AttrModifyOp {\n /**\n * @param {K} key\n * @param {Modifier} delta\n */\n constructor (key, delta) {\n /**\n * @readonly\n * @type {K}\n */\n this.key = key\n /**\n * @readonly\n * @type {Modifier}\n */\n this.value = delta\n /**\n * @type {string|null}\n */\n this._fingerprint = null\n }\n\n /**\n * @type {'modify'}\n */\n get type () { return 'modify' }\n\n get fingerprint () {\n return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => {\n encoding.writeVarUint(encoder, 7) // map modify type: 7\n encoding.writeAny(encoder, this.key)\n encoding.writeVarString(encoder, this.value.fingerprint)\n })))\n }\n\n /**\n * @return {DeltaBuilder}\n */\n get _modValue () {\n this._fingerprint = null\n if (this.value.isDone) {\n // @ts-ignore\n this.value = /** @type {any} */ (clone(this.value))\n }\n // @ts-ignore\n return this.value\n }\n\n /**\n * @return {DeltaAttrOpJSON}\n */\n toJSON () {\n return {\n type: this.type,\n value: this.value.toJSON()\n }\n }\n\n /**\n * @param {AttrModifyOp} other\n */\n [equalityTrait.EqualityTraitSymbol] (other) {\n return this.key === other.key && this.value[equalityTrait.EqualityTraitSymbol](other.value)\n }\n\n /**\n * @return {AttrModifyOp}\n */\n clone () {\n return new AttrModifyOp(this.key, /** @type {Modifier} */ (this.value.done()))\n }\n}\n\n/**\n * @type {s.Schema | DeleteOp>}\n */\nexport const $deleteOp = s.$custom(o => o != null && (o.constructor === DeleteOp || o.constructor === AttrDeleteOp))\n\n/**\n * @type {s.Schema | InsertOp>}\n */\nexport const $insertOp = s.$custom(o => o != null && (o.constructor === AttrInsertOp || o.constructor === InsertOp))\n\n/**\n * @template {fingerprintTrait.Fingerprintable} Content\n * @param {s.Schema} $content\n * @return {s.Schema | InsertOp>}\n */\nexport const $insertOpWith = $content => s.$custom(o =>\n o != null && (\n (o.constructor === AttrInsertOp && $content.check(/** @type {AttrInsertOp} */ (o).value)) ||\n (o.constructor === InsertOp && /** @type {InsertOp} */ (o).insert.every(ins => $content.check(ins)))\n )\n)\n\n/**\n * @type {s.Schema}\n */\nexport const $textOp = s.$constructedBy(TextOp)\n\n/**\n * @type {s.Schema}\n */\nexport const $retainOp = s.$constructedBy(RetainOp)\n\n/**\n * @type {s.Schema}\n */\nexport const $modifyOp = s.$custom(o => o != null && (o.constructor === AttrModifyOp || o.constructor === ModifyOp))\n\n/**\n * @template {DeltaAny} Modify\n * @param {s.Schema} $content\n * @return {s.Schema | ModifyOp>}\n */\nexport const $modifyOpWith = $content => s.$custom(o =>\n o != null && (\n (o.constructor === AttrModifyOp && $content.check(/** @type {AttrModifyOp} */ (o).value)) ||\n (o.constructor === ModifyOp && $content.check(/** @type {ModifyOp} */ (o).value))\n )\n)\n\nexport const $anyOp = s.$union($insertOp, $deleteOp, $textOp, $modifyOp)\n\n/**\n * @template {Array|string} C1\n * @template {Array|string} C2\n * @typedef {Extract> extends never\n * ? never\n * : (Array<(Extract> extends Array ? (unknown extends AC1 ? never : AC1) : never)>)} MergeListArrays\n */\n\n/**\n * @template {{[Key in string|number]: any}} Attrs\n * @template {string|number} Key\n * @template {any} Val\n * @typedef {{ [K in (Key | keyof Attrs)]: (unknown extends Attrs[K] ? never : Attrs[K]) | (Key extends K ? Val : never) }} AddToAttrs\n */\n\n/**\n * @template {{[Key in string|number|symbol]: any}} Attrs\n * @template {{[Key in string|number|symbol]: any}} NewAttrs\n * @typedef {{ [K in (keyof NewAttrs | keyof Attrs)]: (unknown extends Attrs[K] ? never : Attrs[K]) | (unknown extends NewAttrs[K] ? never : NewAttrs[K]) }} MergeAttrs\n */\n\n/**\n * @template X\n * @typedef {0 extends (1 & X) ? null : X} _AnyToNull\n */\n\n/**\n * @template {s.Schema>|null} Schema\n * @typedef {_AnyToNull extends null ? Delta : (Schema extends s.Schema ? D : never)} AllowedDeltaFromSchema\n */\n\n/**\n * @typedef {Delta} DeltaAny\n */\n/**\n * @typedef {DeltaBuilder} DeltaBuilderAny\n */\n\n/**\n * @template {string} [NodeName=any]\n * @template {{[k:string|number]:any}} [Attrs={}]\n * @template {fingerprintTrait.Fingerprintable} [Children=never]\n * @template {string} [Text=never]\n * @template {s.Schema>|null} [Schema=any]\n */\nexport class Delta {\n /**\n * @param {NodeName} [name]\n * @param {Schema} [$schema]\n */\n constructor (name, $schema) {\n this.name = name || null\n this.$schema = $schema || null\n /**\n * @type {{ [K in keyof Attrs]?: K extends string|number ? (AttrInsertOp|AttrDeleteOp|(Delta extends Attrs[K] ? AttrModifyOp,K> : never)) : never }\n * & { [Symbol.iterator]: () => Iterator<{ [K in keyof Attrs]: K extends string|number ? (AttrInsertOp|AttrDeleteOp|(Delta extends Attrs[K] ? AttrModifyOp,K> : never)) : never }[keyof Attrs]> }\n * }\n */\n this.attrs = /** @type {any} */ ({\n * [Symbol.iterator] () {\n for (const k in this) {\n yield this[k]\n }\n }\n })\n\n /**\n * @type {list.List<\n * RetainOp\n * | DeleteOp\n * | (Text extends never ? never : TextOp)\n * | (Children extends never ? never : InsertOp)\n * | (Delta extends Children ? ModifyOp>> : never)\n * >}\n */\n this.children = /** @type {any} */ (list.create())\n this.childCnt = 0\n /**\n * @type {any}\n */\n this.origin = null\n /**\n * @type {string|null}\n */\n this._fingerprint = null\n this.isDone = false\n }\n\n /**\n * @type {string}\n */\n get fingerprint () {\n return this._fingerprint || (this._fingerprint = buffer.toBase64(encoding.encode(encoder => {\n encoding.writeUint32(encoder, 0xf2ae5680) // \"magic number\" that ensures that different types of content don't yield the same fingerprint\n encoding.writeAny(encoder, this.name)\n /**\n * @type {Array}\n */\n const keys = []\n for (const attr of this.attrs) {\n keys.push(attr.key)\n }\n keys.sort((a, b) => {\n const aIsString = s.$string.check(a)\n const bIsString = s.$string.check(b)\n // numbers first\n // in ascending order\n return (aIsString && bIsString)\n ? a.localeCompare(b)\n : (aIsString ? 1 : (bIsString ? -1 : (a - b)))\n })\n encoding.writeVarUint(encoder, keys.length)\n for (const key of keys) {\n encoding.writeVarString(encoder, /** @type {any} */ (this.attrs[/** @type {keyof Attrs} */ (key)]).fingerprint)\n }\n encoding.writeVarUint(encoder, this.children.len)\n for (const child of this.children) {\n encoding.writeVarString(encoder, child.fingerprint)\n }\n return buffer.toBase64(rabin.fingerprint(rabin.StandardIrreducible128, encoding.toUint8Array(encoder)))\n })))\n }\n\n [fingerprintTrait.FingerprintTraitSymbol] () {\n return this.fingerprint\n }\n\n isEmpty () {\n return object.isEmpty(this.attrs) && list.isEmpty(this.children)\n }\n\n /**\n * @return {DeltaJSON}\n */\n toJSON () {\n const name = this.name\n /**\n * @type {any}\n */\n const attrs = {}\n /**\n * @type {any}\n */\n const children = []\n for (const attr of this.attrs) {\n attrs[attr.key] = attr.toJSON()\n }\n this.children.forEach(val => {\n children.push(val.toJSON())\n })\n return object.assign(\n { type: /** @type {'delta'} */ ('delta') },\n (name != null ? { name } : {}),\n (object.isEmpty(attrs) ? {} : { attrs }),\n (children.length > 0 ? { children } : {})\n )\n }\n\n /**\n * @param {Delta} other\n * @return {boolean}\n */\n equals (other) {\n return this[equalityTrait.EqualityTraitSymbol](other)\n }\n\n /**\n * @param {any} other\n * @return {boolean}\n */\n [equalityTrait.EqualityTraitSymbol] (other) {\n // @todo it is only necessary to compare finrerprints OR do a deep equality check (remove\n // childCnt as well)\n return this.name === other.name && fun.equalityDeep(this.attrs, other.attrs) && fun.equalityDeep(this.children, other.children) && this.childCnt === other.childCnt\n }\n\n /**\n * @return {DeltaBuilder}\n */\n clone () {\n return this.slice(0, this.childCnt)\n }\n\n /**\n * @param {number} start\n * @param {number} end\n * @return {DeltaBuilder}\n */\n slice (start = 0, end = this.childCnt) {\n const cpy = /** @type {DeltaAny} */ (new DeltaBuilder(/** @type {any} */ (this.name), this.$schema))\n cpy.origin = this.origin\n // copy attrs\n for (const op of this.attrs) {\n cpy.attrs[op.key] = /** @type {any} */ (op.clone())\n }\n // copy children\n const slicedLen = end - start\n let remainingLen = slicedLen\n /**\n * @type {ChildrenOpAny?}\n */\n let currNode = this.children.start\n let currNodeOffset = 0\n while (start > 0 && currNode != null) {\n if (currNode.length <= start) {\n start -= currNode.length\n currNode = currNode.next\n } else {\n currNodeOffset = start\n start = 0\n }\n }\n if (currNodeOffset > 0 && currNode) {\n const ncpy = currNode.clone(currNodeOffset, currNodeOffset + math.min(remainingLen, currNode.length - currNodeOffset))\n list.pushEnd(cpy.children, ncpy)\n remainingLen -= ncpy.length\n currNode = currNode.next\n }\n while (currNode != null && currNode.length <= remainingLen) {\n list.pushEnd(cpy.children, currNode.clone())\n remainingLen -= currNode.length\n currNode = currNode.next\n }\n if (currNode != null && remainingLen > 0) {\n list.pushEnd(cpy.children, currNode.clone(0, remainingLen))\n remainingLen -= math.min(currNode.length, remainingLen)\n }\n cpy.childCnt = slicedLen - remainingLen\n // @ts-ignore\n return cpy\n }\n\n /**\n * Mark this delta as done and perform some cleanup (e.g. remove appended retains without\n * formats&attributions). In the future, there might be additional merge operations that can be\n * performed to result in smaller deltas. Set `markAsDone=false` to only perform the cleanup.\n *\n * @return {Delta}\n */\n done (markAsDone = true) {\n if (!this.isDone) {\n this.isDone = markAsDone\n const cs = this.children\n for (let end = cs.end; end !== null && $retainOp.check(end) && end.format == null && end.attribution == null; end = cs.end) {\n this.childCnt -= end.length\n list.popEnd(cs)\n }\n }\n return this\n }\n}\n\n/**\n * @template {DeltaAny} D\n * @param {D} d\n * @return {D extends DeltaBuilder ? DeltaBuilder : never}\n */\nexport const clone = d => /** @type {any} */ (d.slice(0, d.childCnt))\n\n/**\n * Try merging this op with the previous op\n * @param {list.List} parent\n * @param {InsertOp|RetainOp|DeleteOp|TextOp|ModifyOp} op\n */\nconst tryMergeWithPrev = (parent, op) => {\n const prevOp = op.prev\n if (\n prevOp?.constructor !== op.constructor ||\n (\n (!$deleteOp.check(op) && !$modifyOp.check(op)) && (!fun.equalityDeep(op.format, /** @type {InsertOp} */ (prevOp).format) || !fun.equalityDeep(op.attribution, /** @type {InsertOp} */ (prevOp).attribution))\n )\n ) {\n // constructor mismatch or format/attribution mismatch\n return\n }\n // can be merged\n if ($insertOp.check(op)) {\n /** @type {InsertOp} */ (prevOp).insert.push(...op.insert)\n } else if ($retainOp.check(op)) {\n // @ts-ignore\n /** @type {RetainOp} */ (prevOp).retain += op.retain\n } else if ($deleteOp.check(op)) {\n /** @type {DeleteOp} */ (prevOp).delete += op.delete\n } else if ($textOp.check(op)) {\n /** @type {TextOp} */ (prevOp)._updateInsert(/** @type {TextOp} */ (prevOp).insert + op.insert)\n } else {\n error.unexpectedCase()\n }\n list.remove(parent, op)\n}\n\n/**\n * Ensures that the delta can be edited. clears _fingerprint cache.\n *\n * @param {any} d\n */\nconst modDeltaCheck = d => {\n if (d.isDone) {\n /**\n * You tried to modify a delta after it has been marked as \"done\".\n */\n throw error.create(\"Readonly Delta can't be modified\")\n }\n d._fingerprint = null\n}\n\n/**\n * @template {string} [NodeName=any]\n * @template {{[key:string|number]:any}} [Attrs={}]\n * @template {fingerprintTrait.Fingerprintable} [Children=never]\n * @template {string} [Text=never]\n * @template {s.Schema>|null} [Schema=any]\n * @extends {Delta}\n */\nexport class DeltaBuilder extends Delta {\n /**\n * @param {NodeName} [name]\n * @param {Schema} [$schema]\n */\n constructor (name, $schema) {\n super(name, $schema)\n /**\n * @type {FormattingAttributes?}\n */\n this.usedAttributes = null\n /**\n * @type {Attribution?}\n */\n this.usedAttribution = null\n }\n\n /**\n * @param {Attribution?} attribution\n */\n useAttribution (attribution) {\n modDeltaCheck(this)\n this.usedAttribution = attribution\n return this\n }\n\n /**\n * @param {FormattingAttributes?} attributes\n * @return {this}\n */\n useAttributes (attributes) {\n modDeltaCheck(this)\n this.usedAttributes = attributes\n return this\n }\n\n /**\n * @param {string} name\n * @param {any} value\n */\n updateUsedAttributes (name, value) {\n modDeltaCheck(this)\n if (value == null) {\n this.usedAttributes = object.assign({}, this.usedAttributes)\n delete this.usedAttributes?.[name]\n if (object.isEmpty(this.usedAttributes)) {\n this.usedAttributes = null\n }\n } else if (!fun.equalityDeep(this.usedAttributes?.[name], value)) {\n this.usedAttributes = object.assign({}, this.usedAttributes)\n this.usedAttributes[name] = value\n }\n return this\n }\n\n /**\n * @template {keyof Attribution} NAME\n * @param {NAME} name\n * @param {Attribution[NAME]?} value\n */\n updateUsedAttribution (name, value) {\n modDeltaCheck(this)\n if (value == null) {\n this.usedAttribution = object.assign({}, this.usedAttribution)\n delete this.usedAttribution?.[name]\n if (object.isEmpty(this.usedAttribution)) {\n this.usedAttribution = null\n }\n } else if (!fun.equalityDeep(this.usedAttribution?.[name], value)) {\n this.usedAttribution = object.assign({}, this.usedAttribution)\n this.usedAttribution[name] = value\n }\n return this\n }\n\n /**\n * @template {AllowedDeltaFromSchema extends Delta ? ((Children extends never ? never : Array) | Text) : never} NewContent\n * @param {NewContent} insert\n * @param {FormattingAttributes?} [formatting]\n * @param {Attribution?} [attribution]\n * @return {DeltaBuilder<\n * NodeName,\n * Attrs,\n * Exclude[number]|Children,\n * (Extract|Text) extends never ? never : string,\n * Schema\n * >}\n */\n insert (insert, formatting = null, attribution = null) {\n modDeltaCheck(this)\n const mergedAttributes = mergeAttrs(this.usedAttributes, formatting)\n const mergedAttribution = mergeAttrs(this.usedAttribution, attribution)\n /**\n * @param {TextOp | InsertOp} lastOp\n */\n const checkMergedEquals = lastOp => (mergedAttributes === lastOp.format || fun.equalityDeep(mergedAttributes, lastOp.format)) && (mergedAttribution === lastOp.attribution || fun.equalityDeep(mergedAttribution, lastOp.attribution))\n const end = this.children.end\n if (s.$string.check(insert)) {\n if ($textOp.check(end) && checkMergedEquals(end)) {\n end._updateInsert(end.insert + insert)\n } else if (insert.length > 0) {\n list.pushEnd(this.children, new TextOp(insert, object.isEmpty(mergedAttributes) ? null : mergedAttributes, object.isEmpty(mergedAttribution) ? null : mergedAttribution))\n }\n this.childCnt += insert.length\n } else if (arr.isArray(insert)) {\n if ($insertOp.check(end) && checkMergedEquals(end)) {\n // @ts-ignore\n end.insert.push(...insert)\n end._fingerprint = null\n } else if (insert.length > 0) {\n list.pushEnd(this.children, new InsertOp(insert, object.isEmpty(mergedAttributes) ? null : mergedAttributes, object.isEmpty(mergedAttribution) ? null : mergedAttribution))\n }\n this.childCnt += insert.length\n }\n return /** @type {any} */ (this)\n }\n\n /**\n * @template {AllowedDeltaFromSchema extends Delta ? Extract> : never} NewContent\n * @param {NewContent} modify\n * @param {FormattingAttributes?} formatting\n * @param {Attribution?} attribution\n * @return {DeltaBuilder<\n * NodeName,\n * Attrs,\n * Exclude[number]|Children,\n * (Extract|Text) extends string ? string : never,\n * Schema\n * >}\n */\n modify (modify, formatting = null, attribution = null) {\n modDeltaCheck(this)\n const mergedAttributes = mergeAttrs(this.usedAttributes, formatting)\n const mergedAttribution = mergeAttrs(this.usedAttribution, attribution)\n list.pushEnd(this.children, new ModifyOp(modify, object.isEmpty(mergedAttributes) ? null : mergedAttributes, object.isEmpty(mergedAttribution) ? null : mergedAttribution))\n this.childCnt += 1\n return /** @type {any} */ (this)\n }\n\n /**\n * @param {number} len\n * @param {FormattingAttributes?} [format]\n * @param {Attribution?} [attribution]\n */\n retain (len, format = null, attribution = null) {\n modDeltaCheck(this)\n const mergedFormats = mergeAttrs(this.usedAttributes, format)\n const mergedAttribution = mergeAttrs(this.usedAttribution, attribution)\n const lastOp = /** @type {RetainOp|InsertOp} */ (this.children.end)\n if (lastOp instanceof RetainOp && fun.equalityDeep(mergedFormats, lastOp.format) && fun.equalityDeep(mergedAttribution, lastOp.attribution)) {\n // @ts-ignore\n lastOp.retain += len\n } else if (len > 0) {\n list.pushEnd(this.children, new RetainOp(len, mergedFormats, mergedAttribution))\n }\n this.childCnt += len\n return this\n }\n\n /**\n * @param {number} len\n */\n delete (len) {\n modDeltaCheck(this)\n const lastOp = /** @type {DeleteOp|InsertOp} */ (this.children.end)\n if (lastOp instanceof DeleteOp) {\n lastOp.delete += len\n } else if (len > 0) {\n list.pushEnd(this.children, new DeleteOp(len))\n }\n this.childCnt += len\n return this\n }\n\n /**\n * @template {AllowedDeltaFromSchema extends Delta ? (keyof Attrs) : never} Key\n * @template {AllowedDeltaFromSchema extends Delta ? (Attrs[Key]) : never} Val\n * @param {Key} key\n * @param {Val} val\n * @param {Attribution?} attribution\n * @param {Val|undefined} [prevValue]\n * @return {DeltaBuilder<\n * NodeName,\n * { [K in keyof AddToAttrs]: AddToAttrs[K] },\n * Children,\n * Text,\n * Schema\n * >}\n */\n set (key, val, attribution = null, prevValue) {\n modDeltaCheck(this)\n this.attrs[key] = /** @type {any} */ (new AttrInsertOp(key, val, prevValue, mergeAttrs(this.usedAttribution, attribution)))\n return /** @type {any} */ (this)\n }\n\n /**\n * @template {AllowedDeltaFromSchema extends Delta ? Attrs : never} NewAttrs\n * @param {NewAttrs} attrs\n * @param {Attribution?} attribution\n * @return {DeltaBuilder<\n * NodeName,\n * { [K in keyof MergeAttrs]: MergeAttrs[K] },\n * Children,\n * Text,\n * Schema\n * >}\n */\n setMany (attrs, attribution = null) {\n modDeltaCheck(this)\n for (const k in attrs) {\n this.set(/** @type {any} */ (k), attrs[k], attribution)\n }\n return /** @type {any} */ (this)\n }\n\n /**\n * @template {AllowedDeltaFromSchema extends Delta ? keyof As : never} Key\n * @param {Key} key\n * @param {Attribution?} attribution\n * @param {any} [prevValue]\n * @return {DeltaBuilder<\n * NodeName,\n * { [K in keyof AddToAttrs]: AddToAttrs[K] },\n * Children,\n * Text,\n * Schema\n * >}\n */\n unset (key, attribution = null, prevValue) {\n modDeltaCheck(this)\n this.attrs[key] = /** @type {any} */ (new AttrDeleteOp(key, prevValue, mergeAttrs(this.usedAttribution, attribution)))\n return /** @type {any} */ (this)\n }\n\n /**\n * @template {AllowedDeltaFromSchema extends Delta ? { [K in keyof As]: Extract> extends never ? never : K }[keyof As] : never} Key\n * @template {AllowedDeltaFromSchema extends Delta ? Extract> : never} D\n * @param {Key} key\n * @param {D} modify\n * @return {DeltaBuilder<\n * NodeName,\n * { [K in keyof AddToAttrs]: AddToAttrs[K] },\n * Children,\n * Text,\n * Schema\n * >}\n */\n update (key, modify) {\n modDeltaCheck(this)\n this.attrs[key] = /** @type {any} */ (new AttrModifyOp(key, modify))\n return /** @type {any} */ (this)\n }\n\n /**\n * @param {Delta} other\n */\n apply (other) {\n modDeltaCheck(this)\n this.$schema?.expect(other)\n // apply attrs\n for (const op of other.attrs) {\n const c = /** @type {AttrInsertOp|AttrDeleteOp|AttrModifyOp} */ (this.attrs[op.key])\n if ($modifyOp.check(op)) {\n if ($deltaAny.check(c?.value)) {\n c._modValue.apply(op.value)\n } else {\n // then this is a simple modify\n // @ts-ignore\n this.attrs[op.key] = op.clone()\n }\n } else if ($insertOp.check(op)) {\n // @ts-ignore\n op.prevValue = c?.value\n // @ts-ignore\n this.attrs[op.key] = op.clone()\n } else if ($deleteOp.check(op)) {\n op.prevValue = c?.value\n delete this.attrs[op.key]\n }\n }\n // apply children\n /**\n * @type {ChildrenOpAny?}\n */\n let opsI = this.children.start\n let offset = 0\n /**\n * At the end, we will try to merge this op, and op.next op with their respective previous op.\n *\n * Hence, anytime an op is cloned, deleted, or inserted (anytime list.* api is used) we must add\n * an op to maybeMergeable.\n *\n * @type {Array|RetainOp|DeleteOp|TextOp|ModifyOp>}\n */\n const maybeMergeable = []\n /**\n * @template {InsertOp|RetainOp|DeleteOp|TextOp|ModifyOp|null} OP\n * @param {OP} op\n * @return {OP}\n */\n const scheduleForMerge = op => {\n op && maybeMergeable.push(op)\n return op\n }\n other.children.forEach(op => {\n if ($textOp.check(op) || $insertOp.check(op)) {\n if (offset === 0) {\n list.insertBetween(this.children, opsI == null ? this.children.end : opsI.prev, opsI, scheduleForMerge(op.clone()))\n } else {\n // @todo inmplement \"splitHelper\" and \"insertHelper\" - I'm splitting all the time and\n // forget to update opsI\n if (opsI == null) error.unexpectedCase()\n const cpy = scheduleForMerge(opsI.clone(offset))\n opsI._splice(offset, opsI.length - offset)\n list.insertBetween(this.children, opsI, opsI.next || null, cpy)\n list.insertBetween(this.children, opsI, cpy || null, scheduleForMerge(op.clone()))\n opsI = cpy\n offset = 0\n }\n this.childCnt += op.insert.length\n } else if ($retainOp.check(op)) {\n let retainLen = op.length\n\n if (offset > 0 && opsI != null && op.format != null && !$deleteOp.check(opsI) && !object.every(op.format, (v, k) => fun.equalityDeep(v, /** @type {InsertOp|RetainOp|ModifyOp} */ (opsI).format?.[k] || null))) {\n // need to split current op\n const cpy = scheduleForMerge(opsI.clone(offset))\n opsI._splice(offset, opsI.length - offset)\n list.insertBetween(this.children, opsI, opsI.next || null, cpy)\n opsI = cpy\n offset = 0\n }\n\n while (opsI != null && opsI.length - offset <= retainLen) {\n op.format != null && updateOpFormat(opsI, op.format)\n retainLen -= opsI.length - offset\n opsI = opsI?.next || null\n offset = 0\n }\n\n if (opsI != null) {\n if (op.format != null && retainLen > 0) {\n // split current op and apply format\n const cpy = scheduleForMerge(opsI.clone(retainLen))\n opsI._splice(retainLen, opsI.length - retainLen)\n list.insertBetween(this.children, opsI, opsI.next || null, cpy)\n updateOpFormat(opsI, op.format)\n opsI = cpy\n } else {\n offset += retainLen\n }\n } else if (retainLen > 0) {\n list.pushEnd(this.children, scheduleForMerge(new RetainOp(retainLen, op.format, op.attribution)))\n this.childCnt += retainLen\n }\n } else if ($deleteOp.check(op)) {\n let remainingLen = op.delete\n while (remainingLen > 0) {\n if (opsI == null) {\n list.pushEnd(this.children, scheduleForMerge(new DeleteOp(remainingLen)))\n this.childCnt += remainingLen\n break\n } else if (opsI instanceof DeleteOp) {\n const delLen = opsI.length - offset\n // the same content can't be deleted twice, remove duplicated deletes\n if (delLen >= remainingLen) {\n offset = 0\n opsI = opsI.next\n } else {\n offset += remainingLen\n }\n remainingLen -= delLen\n } else { // insert / embed / retain / modify ⇒ replace\n // case1: delete o fully\n // case2: delete some part of beginning\n // case3: delete some part of end\n // case4: delete some part of center\n const delLen = math.min(opsI.length - offset, remainingLen)\n this.childCnt -= delLen\n if (opsI.length === delLen) {\n // case 1\n offset = 0\n scheduleForMerge(opsI.next)\n list.remove(this.children, opsI)\n opsI = opsI.next\n } else if (offset === 0) {\n // case 2\n offset = 0\n opsI._splice(0, delLen)\n } else if (offset + delLen === opsI.length) {\n // case 3\n opsI._splice(offset, delLen)\n offset = 0\n opsI = opsI.next\n } else {\n // case 4\n opsI._splice(offset, delLen)\n }\n remainingLen -= delLen\n }\n }\n } else if ($modifyOp.check(op)) {\n if (opsI == null) {\n list.pushEnd(this.children, op.clone())\n this.childCnt += 1\n return\n }\n if ($modifyOp.check(opsI)) {\n opsI._modValue.apply(op.value)\n } else if ($insertOp.check(opsI)) {\n opsI._modValue(offset).apply(op.value)\n } else if ($retainOp.check(opsI)) {\n if (offset > 0) {\n const cpy = scheduleForMerge(opsI.clone(0, offset)) // skipped len\n opsI._splice(0, offset) // new remainder\n list.insertBetween(this.children, opsI.prev, opsI, cpy) // insert skipped len\n offset = 0\n }\n list.insertBetween(this.children, opsI.prev, opsI, scheduleForMerge(op.clone())) // insert skipped len\n if (opsI.length === 1) {\n list.remove(this.children, opsI)\n } else {\n opsI._splice(0, 1)\n scheduleForMerge(opsI)\n }\n } else if ($deleteOp.check(opsI)) {\n // nop\n } else {\n error.unexpectedCase()\n }\n } else {\n error.unexpectedCase()\n }\n })\n maybeMergeable.forEach(op => {\n // check if this is still integrated\n if (op.prev?.next === op) {\n tryMergeWithPrev(this.children, op)\n op.next && tryMergeWithPrev(this.children, op.next)\n }\n })\n return this\n }\n\n /**\n * @param {DeltaAny} other\n * @param {boolean} priority\n */\n rebase (other, priority) {\n modDeltaCheck(this)\n /**\n * Rebase attributes\n *\n * - insert vs delete ⇒ insert takes precedence\n * - insert vs modify ⇒ insert takes precedence\n * - insert vs insert ⇒ priority decides\n * - delete vs modify ⇒ delete takes precedence\n * - delete vs delete ⇒ current delete op is removed because item has already been deleted\n * - modify vs modify ⇒ rebase using priority\n */\n for (const op of this.attrs) {\n if ($insertOp.check(op)) {\n if ($insertOp.check(other.attrs[op.key]) && !priority) {\n delete this.attrs[op.key]\n }\n } else if ($deleteOp.check(op)) {\n const otherOp = other.attrs[/** @type {any} */ (op.key)]\n if ($insertOp.check(otherOp)) {\n delete this.attrs[otherOp.key]\n }\n } else if ($modifyOp.check(op)) {\n const otherOp = other.attrs[/** @type {any} */ (op.key)]\n if (otherOp == null) {\n // nop\n } else if ($modifyOp.check(otherOp)) {\n op._modValue.rebase(otherOp.value, priority)\n } else {\n delete this.attrs[otherOp.key]\n }\n }\n }\n /**\n * Rebase children.\n *\n * Precedence: insert with higher priority comes first. Op with less priority is transformed to\n * be inserted later.\n *\n * @todo always check if inser OR text\n */\n /**\n * @type {ChildrenOpAny?}\n */\n let currChild = this.children.start\n let currOffset = 0\n /**\n * @type {ChildrenOpAny?}\n */\n let otherChild = other.children.start\n let otherOffset = 0\n while (currChild != null && otherChild != null) {\n if ($insertOp.check(currChild) || $textOp.check(currChild)) {\n /**\n * Transforming *insert*. If other is..\n * - insert: transform based on priority\n * - retain/delete/modify: transform next op against other\n */\n if ($insertOp.check(otherChild) || $modifyOp.check(otherChild) || $textOp.check(otherChild)) {\n if (!priority) {\n list.insertBetween(this.children, currChild.prev, currChild, new RetainOp(otherChild.length, null, null))\n this.childCnt += otherChild.length\n // curr is transformed against other, transform curr against next\n otherOffset = otherChild.length\n } else {\n // curr stays as is, transform next op\n currOffset = currChild.length\n }\n } else { // otherChild = delete | retain | modify - curr stays as is, transform next op\n currOffset = currChild.length\n }\n } else if ($modifyOp.check(currChild)) {\n /**\n * Transforming *modify*. If other is..\n * - insert: adjust position\n * - modify: rebase curr modify on other modify\n * - delete: remove modify\n * - retain: adjust offset\n */\n if ($insertOp.check(otherChild) || $textOp.check(otherChild)) {\n // @todo: with all list changes (retain insertions, removal), try to merge the surrounding\n // ops later\n list.insertBetween(this.children, currChild.prev, currChild, new RetainOp(otherChild.length, null, null))\n this.childCnt += otherChild.length\n // curr is transformed against other, transform curr against next\n otherOffset = otherChild.length\n } else {\n if ($modifyOp.check(otherChild)) {\n /** @type {any} */ (currChild.value).rebase(otherChild, priority)\n } else if ($deleteOp.check(otherChild)) {\n list.remove(this.children, currChild)\n this.childCnt -= 1\n }\n currOffset += 1\n otherOffset += 1\n }\n } else { // DeleteOp | RetainOp\n const maxCommonLen = math.min(currChild.length - currOffset, otherChild.length - otherOffset)\n /**\n * Transforming *retain* OR *delete*. If other is..\n * - retain / modify: adjust offsets\n * - delete: shorten curr op\n * - insert: split curr op and insert retain\n */\n if ($retainOp.check(otherChild) || $modifyOp.check(otherChild)) {\n currOffset += maxCommonLen\n otherOffset += maxCommonLen\n } else if ($deleteOp.check(otherChild)) {\n if ($retainOp.check(currChild)) {\n // @ts-ignore\n currChild.retain -= maxCommonLen\n } else if ($deleteOp.check(currChild)) {\n currChild.delete -= maxCommonLen\n }\n this.childCnt -= maxCommonLen\n } else { // insert/text.check(currOp)\n if (currOffset > 0) {\n const leftPart = currChild.clone(currOffset)\n list.insertBetween(this.children, currChild.prev, currChild, leftPart)\n currChild._splice(currOffset, currChild.length - currOffset)\n currOffset = 0\n }\n list.insertBetween(this.children, currChild.prev, currChild, new RetainOp(otherChild.length, null, null))\n this.childCnt += otherChild.length\n otherOffset = otherChild.length\n }\n }\n if (currOffset >= currChild.length) {\n currChild = currChild.next\n currOffset = 0\n }\n if (otherOffset >= otherChild.length) {\n otherChild = otherChild.next\n otherOffset = 0\n }\n }\n return this\n }\n\n /**\n * Same as doing `delta.rebase(other.inverse())`, without creating a temporary delta.\n *\n * @param {DeltaAny} other\n * @param {boolean} priority\n */\n rebaseOnInverse (other, priority) {\n modDeltaCheck(this)\n // @todo\n console.info('method rebaseOnInverse unimplemented')\n return this\n }\n\n /**\n * Append child ops from one op to the other.\n *\n * delta.create().insert('a').append(delta.create().insert('b')) // => insert \"ab\"\n *\n * @template {DeltaAny} OtherDelta\n * @param {OtherDelta} other\n * @return {CastToDelta extends Delta ? DeltaBuilder : never}\n */\n append (other) {\n const children = this.children\n const prevLast = children.end\n // @todo Investigate. Above is a typescript issue. It is necessary to cast OtherDelta to a Delta first before\n // inferring type, otherwise Children will contain Text.\n for (const child of other.children) {\n list.pushEnd(children, child.clone())\n }\n this.childCnt += other.childCnt\n prevLast?.next && tryMergeWithPrev(children, prevLast.next)\n // @ts-ignore\n return this\n }\n}\n\n/**\n * @param {ChildrenOpAny} op\n * @param {{[k:string]:any}} formatUpdate\n */\nconst updateOpFormat = (op, formatUpdate) => {\n if (!$deleteOp.check(op)) {\n // apply formatting attributes\n for (const k in formatUpdate) {\n const v = formatUpdate[k]\n if (v != null || $retainOp.check(op)) {\n // never modify formats\n /** @type {any} */ (op).format = object.assign({}, op.format, { [k]: v })\n } else if (op.format != null) {\n const { [k]: _, ...rest } = op.format\n ;/** @type {any} */ (op).format = rest\n }\n }\n }\n}\n\n/**\n * @template {DeltaAny} D\n * @typedef {D extends DeltaBuilder ? Delta : D} CastToDelta\n */\n\n/**\n * @template {string} NodeName\n * @template {{ [key: string|number]: any }} [Attrs={}]\n * @template {fingerprintTrait.Fingerprintable|never} [Children=never]\n * @template {string|never} [Text=never]\n * @typedef {Delta|RecursiveDelta,Text>} RecursiveDelta\n */\n\n/**\n * @template {string} Name\n * @template {{[k:string|number]:any}} Attrs\n * @template {fingerprintTrait.Fingerprintable} Children\n * @template {boolean} HasText\n * @template {{ [k:string]:any }} Formats\n * @template {boolean} Recursive\n * @extends {s.Schema : never),\n * HasText extends true ? string : never,\n * any>>}\n */\nexport class $Delta extends s.Schema {\n /**\n * @param {s.Schema} $name\n * @param {s.Schema} $attrs\n * @param {s.Schema} $children\n * @param {HasText} hasText\n * @param {s.Schema} $formats\n * @param {Recursive} recursive\n */\n constructor ($name, $attrs, $children, hasText, $formats, recursive) {\n super()\n const $attrsPartial = s.$$object.check($attrs) ? $attrs.partial : $attrs\n if (recursive) {\n // @ts-ignore\n $children = s.$union($children, this)\n }\n this.shape = { $name, $attrs: $attrsPartial, $children, hasText, $formats }\n }\n\n /**\n * @param {any} o\n * @param {s.ValidationError} [err]\n * @return {o is Delta<\n * Name,\n * Attrs,\n * Children|(Recursive extends true ? RecursiveDelta : never),\n * HasText extends true ? string : never,\n * any>}\n */\n check (o, err = undefined) {\n const { $name, $attrs, $children, hasText, $formats } = this.shape\n if (!(o instanceof Delta)) {\n err?.extend(null, 'Delta', o?.constructor.name, 'Constructor match failed')\n } else if (o.name != null && !$name.check(o.name, err)) {\n err?.extend('Delta.name', $name.toString(), o.name, 'Unexpected node name')\n } else if (list.toArray(o.children).some(c => (!hasText && $textOp.check(c)) || (hasText && $textOp.check(c) && c.format != null && !$formats.check(c.format)) || ($insertOp.check(c) && !c.insert.every(ins => $children.check(ins))))) {\n err?.extend('Delta.children', '', '', 'Children don\\'t match the schema')\n } else if (object.some(o.attrs, (op, k) => $insertOp.check(op) && !$attrs.check({ [k]: op.value }, err))) {\n err?.extend('Delta.attrs', '', '', 'Attrs don\\'t match the schema')\n } else {\n return true\n }\n return false\n }\n}\n\n/**\n * @template {s.Schema|string|Array} [NodeNameSchema=s.Schema]\n * @template {s.Schema<{ [key: string|number]: any }>|{ [key:string|number]:any }} [AttrsSchema=s.Schema<{}>]\n * @template {any} [ChildrenSchema=s.Schema]\n * @template {boolean} [HasText=false]\n * @template {boolean} [Recursive=false]\n * @template {{ [k:string]:any }} [Formats={[k:string]:any}]\n * @param {object} opts\n * @param {NodeNameSchema?} [opts.name]\n * @param {AttrsSchema?} [opts.attrs] What key-value pairs are included.\n * @param {ChildrenSchema?} [opts.children] The type of content in `insertOp`\n * @param {HasText} [opts.text] Whether this delta contains text using `textOp`\n * @param {Formats} [opts.formats]\n * @param {Recursive} [opts.recursive]\n * @return {[s.Unwrap>,s.Unwrap>,s.Unwrap>] extends [infer NodeName, infer Attrs, infer Children] ? s.Schema : never),\n * HasText extends true ? string : never\n * >> : never}\n */\nexport const $delta = ({ name, attrs, children, text, formats, recursive }) => /** @type {any} */ (new $Delta(\n name == null ? s.$any : s.$(name),\n /** @type {any} */ (attrs == null ? s.$object({}) : s.$(attrs)),\n /** @type {any} */ (children == null ? s.$never : s.$(children)),\n text ?? false,\n formats == null ? s.$any : s.$(formats),\n recursive ?? false\n))\n\nexport const $$delta = s.$constructedBy($Delta)\n\n/**\n * @todo remove this\n *\n * @template {s.Schema|string|Array} [NodeNameSchema=s.Schema]\n * @template {s.Schema<{ [key: string|number]: any }>|{ [key:string|number]:any }} [AttrsSchema=s.Schema<{}>]\n * @template {any} [ChildrenSchema=s.Schema]\n * @template {boolean} [HasText=false]\n * @template {boolean} [Recursive=false]\n * @param {object} opts\n * @param {NodeNameSchema?} [opts.name]\n * @param {AttrsSchema?} [opts.attrs]\n * @param {ChildrenSchema?} [opts.children]\n * @param {HasText} [opts.text]\n * @param {Recursive} [opts.recursive]\n * @return {[s.Unwrap>,s.Unwrap>,s.Unwrap>] extends [infer NodeName, infer Attrs, infer Children] ? s.Schema : never),\n * HasText extends true ? string : never\n * >> : never}\n */\nexport const _$delta = ({ name, attrs, children, text, recursive }) => {\n /**\n * @type {s.Schema>}\n */\n let $arrContent = children == null ? s.$never : s.$array(s.$(children))\n const $name = name == null ? s.$any : s.$(name)\n const $attrsPartial = attrs == null ? s.$object({}) : (s.$$record.check(attrs) ? attrs : /** @type {any} */ (s.$(attrs)).partial)\n const $d = s.$instanceOf(Delta, /** @param {Delta} d */ d => {\n if (\n !$name.check(d.name) ||\n object.some(d.attrs,\n (op, k) => $insertOp.check(op) && !$attrsPartial.check({ [k]: op.value })\n )\n ) return false\n for (const op of d.children) {\n if ((!text && $textOp.check(op)) || ($insertOp.check(op) && !$arrContent.check(op.insert))) {\n return false\n }\n }\n return true\n })\n if (recursive) {\n $arrContent = children == null ? s.$array($d) : s.$array(s.$(children), $d)\n }\n return /** @type {any} */ ($d)\n}\n\n/**\n * @type {s.Schema}\n */\nexport const $deltaAny = /** @type {any} */ (s.$instanceOf(Delta))\n\n/**\n * @type {s.Schema}\n */\nexport const $deltaBuilderAny = /** @type {any} */ (s.$instanceOf(DeltaBuilder))\n\n/**\n * Helper function to merge attribution and attributes. The latter input \"wins\".\n *\n * @template {{ [key: string]: any }} T\n * @param {T | null} a\n * @param {T | null} b\n */\nexport const mergeAttrs = (a, b) => object.isEmpty(a)\n ? (object.isEmpty(b) ? null : b)\n : (object.isEmpty(b) ? a : object.assign({}, a, b))\n\n/**\n * @template {DeltaAny|null} D\n * @param {D} a\n * @param {D} b\n * @return {D}\n */\nexport const mergeDeltas = (a, b) => {\n if (a != null && b != null) {\n const c = clone(a)\n c.apply(b)\n return /** @type {any} */ (c)\n }\n return a == null ? b : (a || null)\n}\n\n/**\n * @template {DeltaAny} D\n * @param {prng.PRNG} gen\n * @param {s.Schema} $d\n * @return {D extends Delta ? DeltaBuilder : never}\n */\nexport const random = (gen, $d) => {\n const { $name, $attrs, $children, hasText, $formats: $formats_ } = /** @type {$Delta} */ (/** @type {any} */ ($d)).shape\n const d = s.$$any.check($name) ? create($deltaAny) : create(s.random(gen, $name), $deltaAny)\n const $formats = s.$$any.check($formats_) ? s.$null : $formats_\n prng.bool(gen) && d.setMany(s.random(gen, $attrs))\n for (let i = prng.uint32(gen, 0, 5); i > 0; i--) {\n if (hasText && prng.bool(gen)) {\n d.insert(prng.word(gen), s.random(gen, $formats))\n } else if (!s.$$never.check($children)) {\n /**\n * @type {Array}\n */\n const ins = []\n let insN = prng.int32(gen, 0, 5)\n while (insN--) {\n ins.push(s.random(gen, $children))\n }\n d.insert(ins, s.random(gen, $formats))\n }\n }\n return /** @type {any} */ (d)\n}\n\n/**\n * @overload\n * @return {DeltaBuilder}\n */\n/**\n * @template {string} NodeName\n * @overload\n * @param {NodeName} nodeName\n * @return {DeltaBuilder}\n */\n/**\n * @template {string} NodeName\n * @template {s.Schema} Schema\n * @overload\n * @param {NodeName} nodeName\n * @param {Schema} schema\n * @return {Schema extends s.Schema> ? DeltaBuilder : never}\n */\n/**\n * @template {s.Schema} Schema\n * @overload\n * @param {Schema} schema\n * @return {Schema extends s.Schema> ? DeltaBuilder : never}\n */\n/**\n * @template {string|null} NodeName\n * @template {{[k:string|number]:any}|null} Attrs\n * @template {Array|string} [Children=never]\n * @overload\n * @param {NodeName} nodeName\n * @param {Attrs} attrs\n * @param {Children} [children]\n * @return {DeltaBuilder<\n * NodeName extends null ? any : NodeName,\n * Attrs extends null ? {} : Attrs,\n * Extract> extends Array ? (unknown extends Ac ? never : Ac) : never,\n * Extract,\n * null\n * >}\n */\n/**\n * @param {string|s.Schema} [nodeNameOrSchema]\n * @param {{[K:string|number]:any}|s.Schema} [attrsOrSchema]\n * @param {(Array|string)} [children]\n * @return {DeltaBuilder}\n */\nexport const create = (nodeNameOrSchema, attrsOrSchema, children) => {\n const nodeName = /** @type {any} */ (s.$string.check(nodeNameOrSchema) ? nodeNameOrSchema : null)\n const schema = /** @type {any} */ (s.$$schema.check(nodeNameOrSchema) ? nodeNameOrSchema : (s.$$schema.check(attrsOrSchema) ? attrsOrSchema : null))\n const d = /** @type {DeltaBuilder} */ (new DeltaBuilder(nodeName, schema))\n if (s.$objectAny.check(attrsOrSchema)) {\n d.setMany(attrsOrSchema)\n }\n children && d.insert(children)\n return d\n}\n\n// DELTA TEXT\n\n/**\n * @template {fingerprintTrait.Fingerprintable} [Embeds=never]\n * @typedef {Delta} TextDelta\n */\n\n/**\n * @template {fingerprintTrait.Fingerprintable} [Embeds=never]\n * @typedef {DeltaBuilder} TextDeltaBuilder\n */\n\n/**\n * @template {Array>} [$Embeds=any]\n * @param {$Embeds} $embeds\n * @return {s.Schema extends null ? never : ($Embeds extends Array> ? $C : never)>>}\n */\nexport const $text = (...$embeds) => /** @type {any} */ ($delta({ children: s.$union(...$embeds), text: true }))\nexport const $textOnly = $text()\n\n/**\n * @template {s.Schema>} [Schema=s.Schema>]\n * @param {Schema} [$schema]\n * @return {Schema extends s.Schema> ? DeltaBuilder : never}\n */\nexport const text = $schema => /** @type {any} */ (create($schema || $textOnly))\n\n/**\n * @template {fingerprintTrait.Fingerprintable} Children\n * @typedef {Delta} ArrayDelta\n */\n\n/**\n * @template {fingerprintTrait.Fingerprintable} Children\n * @typedef {DeltaBuilder} ArrayDeltaBuilder\n */\n\n/**\n * @template {any|s.Schema} $Children\n * @param {$Children} [$children]\n * @return {s.Schema>>>}\n */\nexport const $array = $children => /** @type {any} */ ($delta({ children: $children }))\n\n/**\n * @template {s.Schema>} [$Schema=never]\n * @param {$Schema} $schema\n * @return {$Schema extends never ? ArrayDeltaBuilder : DeltaBuilder}\n */\nexport const array = $schema => /** @type {any} */ ($schema ? create($schema) : create())\n\n/**\n * @template {{ [K: string|number]: any }} Attrs\n * @typedef {Delta} MapDelta\n */\n\n/**\n * @template {{ [K: string|number]: any }} Attrs\n * @typedef {DeltaBuilder} MapDeltaBuilder\n */\n\n/**\n * @template {{ [K: string|number]: any }} $Attrs\n * @param {s.Schema<$Attrs>} $attrs\n * @return {s.Schema>}\n */\nexport const $map = $attrs => /** @type {any} */ ($delta({ attrs: $attrs }))\n\n/**\n * @template {s.Schema>|undefined} [$Schema=undefined]\n * @param {$Schema} [$schema]\n * @return {$Schema extends s.Schema> ? DeltaBuilder : MapDeltaBuilder<{}>}\n */\nexport const map = $schema => /** @type {any} */ (create(/** @type {any} */ ($schema)))\n\n/**\n * @template {DeltaAny} D\n * @param {D} d1\n * @param {NoInfer} d2\n * @return {D extends Delta ? DeltaBuilder : never}\n */\nexport const diff = (d1, d2) => {\n /**\n * @type {DeltaBuilderAny}\n */\n const d = create()\n if (d1.fingerprint !== d2.fingerprint) {\n let left1 = d1.children.start\n let left2 = d2.children.start\n let right1 = d1.children.end\n let right2 = d2.children.end\n let commonPrefixOffset = 0\n // perform a patience sort\n // 1) remove common prefix and suffix\n while (left1 != null && left1.fingerprint === left2?.fingerprint) {\n if (!$deleteOp.check(left1)) {\n commonPrefixOffset += left1.length\n }\n left1 = left1.next\n left2 = left2.next\n }\n while (right1 !== null && right1 !== left1 && right1.fingerprint === right2?.fingerprint) {\n right1 = right1.prev\n right2 = right2.prev\n }\n /**\n * @type {Array}\n */\n const ops1 = []\n /**\n * @type {Array}\n */\n const ops2 = []\n while (left1 !== null && left1 !== right1?.next) {\n ops1.push(left1)\n left1 = left1.next\n }\n while (left2 !== null && left2 !== right2?.next) {\n ops2.push(left2)\n left2 = left2.next\n }\n const fprints1 = ops1.map(op => op.fingerprint)\n const fprints2 = ops2.map(op => op.fingerprint)\n const changeset = patience.diff(fprints1, fprints2)\n d.retain(commonPrefixOffset)\n for (let i = 0, lastIndex1 = 0, currIndexOffset2 = 0; i < changeset.length; i++) {\n const change = changeset[i]\n d.retain(change.index - lastIndex1)\n // insert minimal diff at curred position in d\n /**\n *\n * @todo it would be better if these would be slices of delta (an actual delta)\n *\n * @param {ChildrenOpAny[]} opsIs\n * @param {ChildrenOpAny[]} opsShould\n */\n const diffAndApply = (opsIs, opsShould) => {\n const d = create()\n // @todo unoptimized implementation. Convert content to array and diff that based on\n // generated fingerprints. We probably could do better and cache more information.\n // - benchmark\n // - cache fingerprints in ops\n /**\n * @type {Array}\n */\n const isContent = opsIs.flatMap(op => $insertOp.check(op) ? op.insert : ($textOp.check(op) ? op.insert.split('') : error.unexpectedCase()))\n /**\n * @type {Array}\n */\n const shouldContent = opsShould.flatMap(op => $insertOp.check(op) ? op.insert : ($textOp.check(op) ? op.insert.split('') : error.unexpectedCase()))\n const isContentFingerprinted = isContent.map(c => s.$string.check(c) ? c : fingerprintTrait.fingerprint(c))\n const shouldContentFingerprinted = shouldContent.map(c => s.$string.check(c) ? c : fingerprintTrait.fingerprint(c))\n const hasFormatting = opsIs.some(op => !$deleteOp.check(op) && op.format != null) || opsShould.some(op => !$deleteOp.check(op) && op.format != null)\n /**\n * @type {{ index: number, insert: Array, remove: Array }[]}\n */\n const cdiff = patience.diff(isContentFingerprinted, shouldContentFingerprinted)\n // overwrite fingerprinted content with actual content\n for (let i = 0, adj = 0; i < cdiff.length; i++) {\n const cd = cdiff[i]\n cd.remove = isContent.slice(cd.index, cd.index + cd.remove.length)\n cd.insert = shouldContent.slice(cd.index + adj, cd.index + adj + cd.insert.length)\n adj += cd.insert.length - cd.remove.length\n }\n for (let i = 0, lastIndex = 0; i < cdiff.length; i++) {\n const cd = cdiff[i]\n d.retain(cd.index - lastIndex)\n lastIndex = cd.index\n let cdii = 0\n let cdri = 0\n // try to match as much content as possible, preferring to skip over non-deltas\n for (; cdii < cd.insert.length && cdri < cd.remove.length;) {\n const a = cd.insert[cdii]\n const b = cd.remove[cdri]\n if ($deltaAny.check(a) && $deltaAny.check(b) && a.name === b.name) {\n d.modify(diff(b, a))\n cdii++\n cdri++\n } else if ($deltaAny.check(b)) {\n d.insert(s.$string.check(a) ? a : [a])\n cdii++\n } else {\n d.delete(1)\n cdri++\n }\n }\n for (; cdii < cd.insert.length; cdii++) {\n const a = cd.insert[cdii]\n d.insert(s.$string.check(a) ? a : [a])\n }\n d.delete(cd.remove.length - cdri)\n }\n // create the diff for formatting\n if (hasFormatting) {\n const formattingDiff = create()\n // update opsIs with content diff. then we can figure out the formatting diff.\n const isUpdated = create()\n // copy opsIs to fresh delta\n opsIs.forEach(op => {\n isUpdated.childCnt += op.length\n list.pushEnd(isUpdated.children, op.clone())\n })\n isUpdated.apply(d)\n let shouldI = 0\n let shouldOffset = 0\n let isOp = isUpdated.children.start\n let isOffset = 0\n while (shouldI < opsShould.length && isOp != null) {\n const shouldOp = opsShould[shouldI]\n if (!$deleteOp.check(shouldOp) && !$deleteOp.check(isOp)) {\n const isFormat = isOp.format\n const minForward = math.min(shouldOp.length - shouldOffset, isOp.length - isOffset)\n shouldOffset += minForward\n isOffset += minForward\n if (fun.equalityDeep(shouldOp.format, isFormat)) {\n formattingDiff.retain(minForward)\n } else {\n /**\n * @type {FormattingAttributes}\n */\n const fupdate = {}\n shouldOp.format != null && object.forEach(shouldOp.format, (v, k) => {\n if (!fun.equalityDeep(v, isFormat?.[k] || null)) {\n fupdate[k] = v\n }\n })\n isFormat && object.forEach(isFormat, (_, k) => {\n if (shouldOp?.format?.[k] === undefined) {\n fupdate[k] = null\n }\n })\n formattingDiff.retain(minForward, fupdate)\n }\n // update offset and iterators\n if (shouldOffset >= shouldOp.length) {\n shouldI++\n shouldOffset = 0\n }\n if (isOffset >= isOp.length) {\n isOp = isOp.next\n isOffset = 0\n }\n }\n }\n d.apply(formattingDiff)\n }\n return d\n }\n const subd = diffAndApply(ops1.slice(change.index, change.index + change.remove.length), ops2.slice(change.index + currIndexOffset2, change.index + currIndexOffset2 + change.insert.length))\n d.append(subd)\n lastIndex1 = change.index + change.remove.length\n currIndexOffset2 += change.insert.length - change.remove.length\n }\n for (const attr2 of d2.attrs) {\n const attr1 = d1.attrs[attr2.key]\n if (attr1 == null || (attr1.fingerprint !== attr2.fingerprint)) {\n /* c8 ignore else */\n if ($insertOp.check(attr2)) {\n d.set(attr2.key, attr2.value)\n } else {\n /* c8 ignore next 2 */\n error.unexpectedCase()\n }\n }\n }\n for (const attr1 of d1.attrs) {\n if (d2.attrs[attr1.key] == null) {\n d.unset(attr1.key)\n }\n }\n }\n return /** @type {any} */ (d.done(false))\n}\n"],"names":["s.$object","s.$array","s.$string","s.$number","s.$record","s.$union","s.$literal","s.$any","list.ListNode","buffer.toBase64","encoding.encode","encoding.writeVarUint","encoding.writeVarString","encoding.writeAny","object.assign","equalityTrait.EqualityTraitSymbol","fun.equalityDeep","fingerprintTrait.fingerprint","encoding.writeUint8","s.$custom","s.$constructedBy","list.create","encoding.writeUint32","rabin.fingerprint","rabin.StandardIrreducible128","encoding.toUint8Array","fingerprintTrait.FingerprintTraitSymbol","object.isEmpty","list.isEmpty","math.min","list.pushEnd","list.popEnd","error.unexpectedCase","list.remove","error.create","arr.isArray","list.insertBetween","object.every","s.Schema","s.$$object","list.toArray","object.some","s.$","s.$never","s.$$record","s.$instanceOf","s.$$any","s.random","s.$null","prng.bool","prng.uint32","prng.word","s.$$never","prng.int32","schema","s.$$schema","s.$objectAny","patience.diff","object.forEach"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,YAAY,GAAGA,cAAS,CAAC;AACtC,EAAE,MAAM,EAAEC,aAAQ,CAACC,cAA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ACf;AACA,UAAU1B,oBAAoB,GAAE;AAChC,SAAS;AACT,OAAO;AACP,KAAK;AACL,IAAI,KAAK,MAAM,KAAK,IAAI,EAAE,CAAC,KAAK,EAAE;AAClC,MAAM,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE;AACvC,QAAQ,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAC;AAC1B,OAAO;AACP,KAAK;AACL,GAAG;AACH,EAAE,2BAA2B,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/delta/binding.d.ts b/yjs-poll/node_modules/lib0/dist/delta/binding.d.ts deleted file mode 100644 index 5bf528f..0000000 --- a/yjs-poll/node_modules/lib0/dist/delta/binding.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -/** - * @template T - * @typedef {import('../schema.js').Schema} Schema - */ -/** - * @template {delta.AbstractDelta} DeltaA - * @template {delta.AbstractDelta} DeltaB - */ -export class Binding { - /** - * @param {RDT} a - * @param {RDT} b - * @param {dt.Template} template - */ - constructor(a: RDT, b: RDT, template: dt.Template); - /** - * @type {dt.Transformer} - */ - t: dt.Transformer; - a: RDT; - b: RDT; - _mux: mux.mutex; - _achanged: (delta: DeltaA) => void; - _bchanged: (delta: DeltaB) => void; - destroy: () => void; -} -export function bind>(a: RDT, b: RDT ? DeltaB : never>, template: dt.Template): Binding ? DeltaB : never>; -export function deltaRDT($delta: Schema): DeltaRDT; -export const $domDelta: any; -export function domRDT(dom: Element): DomRDT>; -export type Schema = import("../schema.js").Schema; -/** - * Abstract Interface for a delta-based Replicated Data Type. - */ -export type RDT = ObservableV2<{ - "change": (delta: Delta) => void; - "destroy": (rdt: RDT) => void; -}> & { - update: (delta: Delta) => any; - destroy: () => void; -}; -export type DomDelta = delta.RecursiveNode; -import * as delta from './delta.js'; -import * as dt from './t3.test.js'; -import * as mux from '../mutex.js'; -/** - * @template {delta.AbstractDelta} Delta - * @implements RDT - * @extends {ObservableV2<{ change: (delta: Delta) => void, 'destroy': (rdt:DeltaRDT)=>void }>} - */ -declare class DeltaRDT extends ObservableV2<{ - change: (delta: Delta) => void; - destroy: (rdt: DeltaRDT) => void; -}> implements RDT { - /** - * @param {Schema} $delta - */ - constructor($delta: Schema); - $delta: s.Schema; - /** - * @type {Delta?} - */ - state: Delta | null; - _mux: mux.mutex; - /** - * @param {Delta} delta - */ - update: (delta: Delta) => any; -} -/** - * @typedef {delta.RecursiveNode} DomDelta - */ -/** - * @template {DomDelta} [D=DomDelta] - * @implements RDT - * @extends {ObservableV2<{ change: (delta: D)=>void, destroy: (rdt:DomRDT)=>void }>}>} - */ -declare class DomRDT> extends ObservableV2<{ - change: (delta: D) => void; - destroy: (rdt: DomRDT) => void; -}> implements RDT { - /** - * @param {Element} observedNode - */ - constructor(observedNode: Element); - observedNode: Element; - _mux: mux.mutex; - observer: MutationObserver; - /** - * @param {MutationRecord[]} mutations - */ - _mutationHandler: (mutations: MutationRecord[]) => any; - /** - * @param {D} delta - */ - update: (delta: D) => void; -} -import { ObservableV2 } from '../observable.js'; -import * as s from '../schema.js'; -export {}; -//# sourceMappingURL=binding.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/delta/binding.d.ts.map b/yjs-poll/node_modules/lib0/dist/delta/binding.d.ts.map deleted file mode 100644 index d865fff..0000000 --- a/yjs-poll/node_modules/lib0/dist/delta/binding.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"binding.d.ts","sourceRoot":"","sources":["../../delta/binding.js"],"names":[],"mappings":"AAeA;;;GAGG;AAEH;;;GAGG;AACH,qBAHmC,MAAM,SAA3B,KAAK,CAAC,aAAc,EACC,MAAM,SAA3B,KAAK,CAAC,aAAc;IAGhC;;;;OAIG;IACH,eAJW,GAAG,CAAC,MAAM,CAAC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AAC,MAAM,EAAE;IAAE,CAAC,GAAG,EAAC,MAAM,GAAG,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,IAAI,CAAC;uBAnTxD,YAAY;oBACf,cAAc;qBAMb,aAAa;AAsElC;;;;GAIG;AACH,uBAJmC,KAAK,SAA1B,KAAK,CAAC,aAAc;YAEE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI;aAAa,CAAC,GAAG,EAAC,QAAQ,CAAC,KAAK,CAAC,KAAG,IAAI;cADnF,GAAG,CAAC,KAAK;IAItB;;OAEG;IACH,oBAFW,MAAM,CAAC,KAAK,CAAC,EAUvB;IANC,wBAAoB;IACpB;;OAEG;IACH,OAFU,KAAK,OAAC,CAEC;IACjB,gBAA6B;IAG/B;;OAEG;IACH,SAAS,OAFE,KAEG,SAOZ;CAMH;AAkMD;;GAEG;AAEH;;;;GAIG;AACH,qBAJyB,CAAC,SAAZ,QAAS;;;YAEa,CAAC,KAAK,EAAE,CAAC,KAAG,IAAI;aAAW,CAAC,GAAG,EAAC,MAAM,CAAC,CAAC,CAAC,KAAG,IAAI;cADrE,GAAG,CAAC,CAAC;IAIlB;;OAEG;IACH,0BAFW,OAAO,EAajB;IATC,sBAAgC;IAChC,gBAA6B;IAC7B,2BAA2D;IAS7D;;OAEG;IACH,mBAAmB,WAFR,cAAc,EAEG,SAGxB;IAEJ;;OAEG;IACH,SAAS,OAFE,CAEG,UAWb;CAOF;6BA1W4B,kBAAkB;mBAS5B,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/delta/binding.test.d.ts b/yjs-poll/node_modules/lib0/dist/delta/binding.test.d.ts deleted file mode 100644 index eae1385..0000000 --- a/yjs-poll/node_modules/lib0/dist/delta/binding.test.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function testBinding(): void; -export function testDomBindingBasics(): void; -export function testDomBindingBackAndForth(): void; -export function testDataToDom(): void; -//# sourceMappingURL=binding.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/delta/binding.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/delta/binding.test.d.ts.map deleted file mode 100644 index 35b9b93..0000000 --- a/yjs-poll/node_modules/lib0/dist/delta/binding.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"binding.test.d.ts","sourceRoot":"","sources":["../../delta/binding.test.js"],"names":[],"mappings":"AAUO,oCAcN;AAEM,6CAcN;AAEM,mDAkCN;AAEM,sCAiBN"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/delta/delta-pitch.test.d.ts b/yjs-poll/node_modules/lib0/dist/delta/delta-pitch.test.d.ts deleted file mode 100644 index 1d4291c..0000000 --- a/yjs-poll/node_modules/lib0/dist/delta/delta-pitch.test.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function testDeltaBasics(_tc: t.TestCase): void; -export function testDeltaBasicSchema(_tc: t.TestCase): void; -export function testDeltaValues(_tc: t.TestCase): void; -import * as t from 'lib0/testing'; -//# sourceMappingURL=delta-pitch.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/delta/delta-pitch.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/delta/delta-pitch.test.d.ts.map deleted file mode 100644 index 16331c3..0000000 --- a/yjs-poll/node_modules/lib0/dist/delta/delta-pitch.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"delta-pitch.test.d.ts","sourceRoot":"","sources":["../../delta/delta-pitch.test.js"],"names":[],"mappings":"AAmCO,qCAFI,CAAC,CAAC,QAAQ,QAWpB;AAmBM,0CAFI,CAAC,CAAC,QAAQ,QAWpB;AAYM,qCAFI,CAAC,CAAC,QAAQ,QAwBpB;mBAzGkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/delta/delta.d.ts b/yjs-poll/node_modules/lib0/dist/delta/delta.d.ts deleted file mode 100644 index 2f11094..0000000 --- a/yjs-poll/node_modules/lib0/dist/delta/delta.d.ts +++ /dev/null @@ -1,1008 +0,0 @@ -/** - * @typedef {{ - * insert?: string[] - * insertAt?: number - * delete?: string[] - * deleteAt?: number - * format?: Record - * formatAt?: number - * }} Attribution - */ -/** - * @type {s.Schema} - */ -export const $attribution: s.Schema; -/** - * @typedef {s.Unwrap<$anyOp>} DeltaOps - */ -/** - * @typedef {{ [key: string]: any }} FormattingAttributes - */ -/** - * @typedef {{ - * type: 'delta', - * name?: string, - * attrs?: { [Key in string|number]: DeltaAttrOpJSON }, - * children?: Array - * }} DeltaJSON - */ -/** - * @typedef {{ type: 'insert', insert: string|Array, format?: { [key: string]: any }, attribution?: Attribution } | { delete: number } | { type: 'retain', retain: number, format?: { [key:string]: any }, attribution?: Attribution } | { type: 'modify', value: object }} DeltaListOpJSON - */ -/** - * @typedef {{ type: 'insert', value: any, prevValue?: any, attribution?: Attribution } | { type: 'delete', prevValue?: any, attribution?: Attribution } | { type: 'modify', value: DeltaJSON }} DeltaAttrOpJSON - */ -/** - * @typedef {TextOp|InsertOp|DeleteOp|RetainOp|ModifyOp} ChildrenOpAny - */ -/** - * @typedef {AttrInsertOp|AttrDeleteOp|AttrModifyOp} AttrOpAny - */ -/** - * @typedef {ChildrenOpAny|AttrOpAny} _OpAny - */ -/** - * @type {s.Schema} - */ -export const $deltaMapChangeJson: s.Schema; -export class TextOp extends list.ListNode { - /** - * @param {string} insert - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor(insert: string, format: FormattingAttributes | null, attribution: Attribution | null); - /** - * @readonly - * @type {string} - */ - readonly insert: string; - /** - * @readonly - * @type {FormattingAttributes|null} - */ - readonly format: FormattingAttributes | null; - attribution: Attribution | null; - /** - * @type {string?} - */ - _fingerprint: string | null; - /** - * @param {string} newVal - */ - _updateInsert(newVal: string): void; - /** - * @return {'insert'} - */ - get type(): "insert"; - get length(): number; - get fingerprint(): string; - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} offset - * @param {number} len - */ - _splice(offset: number, len: number): this; - /** - * @return {DeltaListOpJSON} - */ - toJSON(): DeltaListOpJSON; - /** - * @return {TextOp} - */ - clone(start?: number, end?: number): TextOp; - /** - * @param {TextOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: TextOp): boolean; -} -/** - * @template {fingerprintTrait.Fingerprintable} ArrayContent - */ -export class InsertOp extends list.ListNode { - /** - * @param {Array} insert - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor(insert: Array, format: FormattingAttributes | null, attribution: Attribution | null); - /** - * @readonly - * @type {Array} - */ - readonly insert: Array; - /** - * @readonly - * @type {FormattingAttributes?} - */ - readonly format: FormattingAttributes | null; - /** - * @readonly - * @type {Attribution?} - */ - readonly attribution: Attribution | null; - /** - * @type {string?} - */ - _fingerprint: string | null; - /** - * @param {ArrayContent} newVal - */ - _updateInsert(newVal: ArrayContent): void; - /** - * @return {'insert'} - */ - get type(): "insert"; - get length(): number; - /** - * @param {number} i - * @return {Extract} - */ - _modValue(i: number): Extract; - get fingerprint(): string; - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} offset - * @param {number} len - */ - _splice(offset: number, len: number): this; - /** - * @return {DeltaListOpJSON} - */ - toJSON(): DeltaListOpJSON; - /** - * @return {InsertOp} - */ - clone(start?: number, end?: number): InsertOp; - /** - * @param {InsertOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: InsertOp): boolean; -} -/** - * @template {fingerprintTrait.Fingerprintable} [Children=never] - * @template {string} [Text=never] - */ -export class DeleteOp extends list.ListNode { - /** - * @param {number} len - */ - constructor(len: number); - delete: number; - /** - * @type {(Children|Text) extends never ? null : (Delta?)} - */ - prevValue: (Children | Text) extends never ? null : (Delta | null); - /** - * @type {string|null} - */ - _fingerprint: string | null; - /** - * @return {'delete'} - */ - get type(): "delete"; - get length(): number; - get fingerprint(): string; - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} _offset - * @param {number} len - */ - _splice(_offset: number, len: number): this; - /** - * @return {DeltaListOpJSON} - */ - toJSON(): DeltaListOpJSON; - clone(start?: number, end?: number): DeleteOp; - /** - * @param {DeleteOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: DeleteOp): boolean; -} -export class RetainOp extends list.ListNode { - /** - * @param {number} retain - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor(retain: number, format: FormattingAttributes | null, attribution: Attribution | null); - /** - * @readonly - * @type {number} - */ - readonly retain: number; - /** - * @readonly - * @type {FormattingAttributes?} - */ - readonly format: FormattingAttributes | null; - /** - * @readonly - * @type {Attribution?} - */ - readonly attribution: Attribution | null; - /** - * @type {string|null} - */ - _fingerprint: string | null; - /** - * @return {'retain'} - */ - get type(): "retain"; - get length(): number; - get fingerprint(): string; - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} _offset - * @param {number} len - */ - _splice(_offset: number, len: number): this; - /** - * @return {DeltaListOpJSON} - */ - toJSON(): DeltaListOpJSON; - clone(start?: number, end?: number): RetainOp; - /** - * @param {RetainOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: RetainOp): boolean; -} -/** - * Delta that can be applied on a YType Embed - * - * @template {DeltaAny} [DTypes=DeltaAny] - */ -export class ModifyOp extends list.ListNode { - /** - * @param {DTypes} delta - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor(delta: DTypes, format: FormattingAttributes | null, attribution: Attribution | null); - /** - * @readonly - * @type {DTypes} - */ - readonly value: DTypes; - /** - * @readonly - * @type {FormattingAttributes?} - */ - readonly format: FormattingAttributes | null; - /** - * @readonly - * @type {Attribution?} - */ - readonly attribution: Attribution | null; - /** - * @type {string|null} - */ - _fingerprint: string | null; - /** - * @return {'modify'} - */ - get type(): "modify"; - get length(): number; - /** - * @type {DeltaBuilderAny} - */ - get _modValue(): DeltaBuilderAny; - get fingerprint(): string; - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} _offset - * @param {number} _len - */ - _splice(_offset: number, _len: number): this; - /** - * @return {DeltaListOpJSON} - */ - toJSON(): DeltaListOpJSON; - /** - * @return {ModifyOp} - */ - clone(): ModifyOp; - /** - * @param {ModifyOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: ModifyOp): boolean; -} -/** - * @template {fingerprintTrait.Fingerprintable} V - * @template {string|number} [K=any] - */ -export class AttrInsertOp { - /** - * @param {K} key - * @param {V} value - * @param {V|undefined} prevValue - * @param {Attribution?} attribution - */ - constructor(key: K, value: V, prevValue: V | undefined, attribution: Attribution | null); - /** - * @readonly - * @type {K} - */ - readonly key: K; - /** - * @readonly - * @type {V} - */ - readonly value: V; - /** - * @readonly - * @type {V|undefined} - */ - readonly prevValue: V | undefined; - /** - * @readonly - * @type {Attribution?} - */ - readonly attribution: Attribution | null; - /** - * @type {string|null} - */ - _fingerprint: string | null; - /** - * @return {'insert'} - */ - get type(): "insert"; - /** - * @type {DeltaBuilderAny} - */ - get _modValue(): DeltaBuilderAny; - get fingerprint(): string; - toJSON(): { - type: "insert"; - value: V | DeltaJSON; - } & (({ - attribution: Attribution; - } | { - attribution?: undefined; - }) & ({ - prevValue: V & {}; - } | { - prevValue?: undefined; - })); - /** - * @return {AttrInsertOp} - */ - clone(): AttrInsertOp; - /** - * @param {AttrInsertOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: AttrInsertOp): boolean; -} -/** - * @template V - * @template {string|number} [K=string] - */ -export class AttrDeleteOp { - /** - * @param {K} key - * @param {V|undefined} prevValue - * @param {Attribution?} attribution - */ - constructor(key: K, prevValue: V | undefined, attribution: Attribution | null); - /** - * @type {K} - */ - key: K; - /** - * @type {V|undefined} - */ - prevValue: V | undefined; - attribution: Attribution | null; - /** - * @type {string|null} - */ - _fingerprint: string | null; - get value(): undefined; - /** - * @type {'delete'} - */ - get type(): "delete"; - get fingerprint(): string; - /** - * @return {DeltaAttrOpJSON} - */ - toJSON(): DeltaAttrOpJSON; - clone(): AttrDeleteOp; - /** - * @param {AttrDeleteOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: AttrDeleteOp): boolean; -} -/** - * @template {DeltaAny} [Modifier=DeltaAny] - * @template {string|number} [K=string] - */ -export class AttrModifyOp { - /** - * @param {K} key - * @param {Modifier} delta - */ - constructor(key: K, delta: Modifier); - /** - * @readonly - * @type {K} - */ - readonly key: K; - /** - * @readonly - * @type {Modifier} - */ - readonly value: Modifier; - /** - * @type {string|null} - */ - _fingerprint: string | null; - /** - * @type {'modify'} - */ - get type(): "modify"; - get fingerprint(): string; - /** - * @return {DeltaBuilder} - */ - get _modValue(): DeltaBuilder; - /** - * @return {DeltaAttrOpJSON} - */ - toJSON(): DeltaAttrOpJSON; - /** - * @return {AttrModifyOp} - */ - clone(): AttrModifyOp; - /** - * @param {AttrModifyOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: AttrModifyOp): boolean; -} -/** - * @type {s.Schema | DeleteOp>} - */ -export const $deleteOp: s.Schema | DeleteOp>; -/** - * @type {s.Schema | InsertOp>} - */ -export const $insertOp: s.Schema | InsertOp>; -export function $insertOpWith($content: s.Schema): s.Schema | InsertOp>; -/** - * @type {s.Schema} - */ -export const $textOp: s.Schema; -/** - * @type {s.Schema} - */ -export const $retainOp: s.Schema; -/** - * @type {s.Schema} - */ -export const $modifyOp: s.Schema; -export function $modifyOpWith($content: s.Schema): s.Schema | ModifyOp>; -export const $anyOp: s.Schema | InsertOp | AttrDeleteOp | DeleteOp | TextOp | AttrModifyOp | ModifyOp>; -/** - * @template {Array|string} C1 - * @template {Array|string} C2 - * @typedef {Extract> extends never - * ? never - * : (Array<(Extract> extends Array ? (unknown extends AC1 ? never : AC1) : never)>)} MergeListArrays - */ -/** - * @template {{[Key in string|number]: any}} Attrs - * @template {string|number} Key - * @template {any} Val - * @typedef {{ [K in (Key | keyof Attrs)]: (unknown extends Attrs[K] ? never : Attrs[K]) | (Key extends K ? Val : never) }} AddToAttrs - */ -/** - * @template {{[Key in string|number|symbol]: any}} Attrs - * @template {{[Key in string|number|symbol]: any}} NewAttrs - * @typedef {{ [K in (keyof NewAttrs | keyof Attrs)]: (unknown extends Attrs[K] ? never : Attrs[K]) | (unknown extends NewAttrs[K] ? never : NewAttrs[K]) }} MergeAttrs - */ -/** - * @template X - * @typedef {0 extends (1 & X) ? null : X} _AnyToNull - */ -/** - * @template {s.Schema>|null} Schema - * @typedef {_AnyToNull extends null ? Delta : (Schema extends s.Schema ? D : never)} AllowedDeltaFromSchema - */ -/** - * @typedef {Delta} DeltaAny - */ -/** - * @typedef {DeltaBuilder} DeltaBuilderAny - */ -/** - * @template {string} [NodeName=any] - * @template {{[k:string|number]:any}} [Attrs={}] - * @template {fingerprintTrait.Fingerprintable} [Children=never] - * @template {string} [Text=never] - * @template {s.Schema>|null} [Schema=any] - */ -export class Delta> | null = any> { - /** - * @param {NodeName} [name] - * @param {Schema} [$schema] - */ - constructor(name?: NodeName, $schema?: Schema); - name: NodeName | null; - $schema: NonNullable | null; - /** - * @type {{ [K in keyof Attrs]?: K extends string|number ? (AttrInsertOp|AttrDeleteOp|(Delta extends Attrs[K] ? AttrModifyOp,K> : never)) : never } - * & { [Symbol.iterator]: () => Iterator<{ [K in keyof Attrs]: K extends string|number ? (AttrInsertOp|AttrDeleteOp|(Delta extends Attrs[K] ? AttrModifyOp,K> : never)) : never }[keyof Attrs]> } - * } - */ - attrs: { [K in keyof Attrs]?: K extends string | number ? (AttrInsertOp | AttrDeleteOp | (Delta extends Attrs[K] ? AttrModifyOp, K> : never)) : never; } & { - [Symbol.iterator]: () => Iterator<{ [K in keyof Attrs]: K extends string | number ? (AttrInsertOp | AttrDeleteOp | (Delta extends Attrs[K] ? AttrModifyOp, K> : never)) : never; }[keyof Attrs]>; - }; - /** - * @type {list.List< - * RetainOp - * | DeleteOp - * | (Text extends never ? never : TextOp) - * | (Children extends never ? never : InsertOp) - * | (Delta extends Children ? ModifyOp>> : never) - * >} - */ - children: list.List) | (Delta extends Children ? ModifyOp>> : never)>; - childCnt: number; - /** - * @type {any} - */ - origin: any; - /** - * @type {string|null} - */ - _fingerprint: string | null; - isDone: boolean; - /** - * @type {string} - */ - get fingerprint(): string; - isEmpty(): boolean; - /** - * @return {DeltaJSON} - */ - toJSON(): DeltaJSON; - /** - * @param {Delta} other - * @return {boolean} - */ - equals(other: Delta): boolean; - /** - * @return {DeltaBuilder} - */ - clone(): DeltaBuilder; - /** - * @param {number} start - * @param {number} end - * @return {DeltaBuilder} - */ - slice(start?: number, end?: number): DeltaBuilder; - /** - * Mark this delta as done and perform some cleanup (e.g. remove appended retains without - * formats&attributions). In the future, there might be additional merge operations that can be - * performed to result in smaller deltas. Set `markAsDone=false` to only perform the cleanup. - * - * @return {Delta} - */ - done(markAsDone?: boolean): Delta; - [fingerprintTrait.FingerprintTraitSymbol](): string; - /** - * @param {any} other - * @return {boolean} - */ - [equalityTrait.EqualityTraitSymbol](other: any): boolean; -} -export function clone(d: D): D extends DeltaBuilder ? DeltaBuilder : never; -/** - * @template {string} [NodeName=any] - * @template {{[key:string|number]:any}} [Attrs={}] - * @template {fingerprintTrait.Fingerprintable} [Children=never] - * @template {string} [Text=never] - * @template {s.Schema>|null} [Schema=any] - * @extends {Delta} - */ -export class DeltaBuilder> | null = any> extends Delta { - /** - * @type {FormattingAttributes?} - */ - usedAttributes: FormattingAttributes | null; - /** - * @type {Attribution?} - */ - usedAttribution: Attribution | null; - /** - * @param {Attribution?} attribution - */ - useAttribution(attribution: Attribution | null): this; - /** - * @param {FormattingAttributes?} attributes - * @return {this} - */ - useAttributes(attributes: FormattingAttributes | null): this; - /** - * @param {string} name - * @param {any} value - */ - updateUsedAttributes(name: string, value: any): this; - /** - * @template {keyof Attribution} NAME - * @param {NAME} name - * @param {Attribution[NAME]?} value - */ - updateUsedAttribution(name: NAME, value: Attribution[NAME] | null): this; - /** - * @template {AllowedDeltaFromSchema extends Delta ? ((Children extends never ? never : Array) | Text) : never} NewContent - * @param {NewContent} insert - * @param {FormattingAttributes?} [formatting] - * @param {Attribution?} [attribution] - * @return {DeltaBuilder< - * NodeName, - * Attrs, - * Exclude[number]|Children, - * (Extract|Text) extends never ? never : string, - * Schema - * >} - */ - insert extends Delta ? ((Children_1 extends never ? never : Array) | Text_1) : never>(insert: NewContent, formatting?: FormattingAttributes | null, attribution?: Attribution | null): DeltaBuilder[number] | Children, (Extract | Text) extends never ? never : string, Schema>; - /** - * @template {AllowedDeltaFromSchema extends Delta ? Extract> : never} NewContent - * @param {NewContent} modify - * @param {FormattingAttributes?} formatting - * @param {Attribution?} attribution - * @return {DeltaBuilder< - * NodeName, - * Attrs, - * Exclude[number]|Children, - * (Extract|Text) extends string ? string : never, - * Schema - * >} - */ - modify extends Delta ? Extract> : never>(modify: NewContent, formatting?: FormattingAttributes | null, attribution?: Attribution | null): DeltaBuilder[number] | Children, (Extract | Text) extends string ? string : never, Schema>; - /** - * @param {number} len - * @param {FormattingAttributes?} [format] - * @param {Attribution?} [attribution] - */ - retain(len: number, format?: FormattingAttributes | null, attribution?: Attribution | null): this; - /** - * @param {number} len - */ - delete(len: number): this; - /** - * @template {AllowedDeltaFromSchema extends Delta ? (keyof Attrs) : never} Key - * @template {AllowedDeltaFromSchema extends Delta ? (Attrs[Key]) : never} Val - * @param {Key} key - * @param {Val} val - * @param {Attribution?} attribution - * @param {Val|undefined} [prevValue] - * @return {DeltaBuilder< - * NodeName, - * { [K in keyof AddToAttrs]: AddToAttrs[K] }, - * Children, - * Text, - * Schema - * >} - */ - set extends Delta ? (keyof Attrs_1) : never, Val extends AllowedDeltaFromSchema extends Delta ? (Attrs_1[Key]) : never>(key: Key, val: Val, attribution?: Attribution | null, prevValue?: Val | undefined): DeltaBuilder]: AddToAttrs[K]; }, Children, Text, Schema>; - /** - * @template {AllowedDeltaFromSchema extends Delta ? Attrs : never} NewAttrs - * @param {NewAttrs} attrs - * @param {Attribution?} attribution - * @return {DeltaBuilder< - * NodeName, - * { [K in keyof MergeAttrs]: MergeAttrs[K] }, - * Children, - * Text, - * Schema - * >} - */ - setMany extends Delta ? Attrs_1 : never>(attrs: NewAttrs, attribution?: Attribution | null): DeltaBuilder]: MergeAttrs[K]; }, Children, Text, Schema>; - /** - * @template {AllowedDeltaFromSchema extends Delta ? keyof As : never} Key - * @param {Key} key - * @param {Attribution?} attribution - * @param {any} [prevValue] - * @return {DeltaBuilder< - * NodeName, - * { [K in keyof AddToAttrs]: AddToAttrs[K] }, - * Children, - * Text, - * Schema - * >} - */ - unset extends Delta ? keyof As : never>(key: Key, attribution?: Attribution | null, prevValue?: any): DeltaBuilder]: AddToAttrs[K]; }, Children, Text, Schema>; - /** - * @template {AllowedDeltaFromSchema extends Delta ? { [K in keyof As]: Extract> extends never ? never : K }[keyof As] : never} Key - * @template {AllowedDeltaFromSchema extends Delta ? Extract> : never} D - * @param {Key} key - * @param {D} modify - * @return {DeltaBuilder< - * NodeName, - * { [K in keyof AddToAttrs]: AddToAttrs[K] }, - * Children, - * Text, - * Schema - * >} - */ - update extends Delta ? { [K in keyof As]: Extract> extends never ? never : K; }[keyof As] : never, D extends AllowedDeltaFromSchema extends Delta ? Extract> : never>(key: Key, modify: D): DeltaBuilder]: AddToAttrs[K]; }, Children, Text, Schema>; - /** - * @param {Delta} other - */ - apply(other: Delta): this; - /** - * @param {DeltaAny} other - * @param {boolean} priority - */ - rebase(other: DeltaAny, priority: boolean): this; - /** - * Same as doing `delta.rebase(other.inverse())`, without creating a temporary delta. - * - * @param {DeltaAny} other - * @param {boolean} priority - */ - rebaseOnInverse(other: DeltaAny, priority: boolean): this; - /** - * Append child ops from one op to the other. - * - * delta.create().insert('a').append(delta.create().insert('b')) // => insert "ab" - * - * @template {DeltaAny} OtherDelta - * @param {OtherDelta} other - * @return {CastToDelta extends Delta ? DeltaBuilder : never} - */ - append(other: OtherDelta): CastToDelta extends Delta ? DeltaBuilder : never; -} -/** - * @template {DeltaAny} D - * @typedef {D extends DeltaBuilder ? Delta : D} CastToDelta - */ -/** - * @template {string} NodeName - * @template {{ [key: string|number]: any }} [Attrs={}] - * @template {fingerprintTrait.Fingerprintable|never} [Children=never] - * @template {string|never} [Text=never] - * @typedef {Delta|RecursiveDelta,Text>} RecursiveDelta - */ -/** - * @template {string} Name - * @template {{[k:string|number]:any}} Attrs - * @template {fingerprintTrait.Fingerprintable} Children - * @template {boolean} HasText - * @template {{ [k:string]:any }} Formats - * @template {boolean} Recursive - * @extends {s.Schema : never), - * HasText extends true ? string : never, - * any>>} - */ -export class $Delta extends s.Schema : never), HasText extends true ? string : never, any>> { - /** - * @param {s.Schema} $name - * @param {s.Schema} $attrs - * @param {s.Schema} $children - * @param {HasText} hasText - * @param {s.Schema} $formats - * @param {Recursive} recursive - */ - constructor($name: s.Schema, $attrs: s.Schema, $children: s.Schema, hasText: HasText, $formats: s.Schema, recursive: Recursive); - shape: { - $name: s.Schema; - $attrs: s.Schema | s.Schema; - [key: number]: s.Schema; - [key: symbol]: s.Schema; - }>>>; - $children: s.Schema; - hasText: HasText; - $formats: s.Schema; - }; -} -export function $delta | string | Array = s.Schema, AttrsSchema extends s.Schema<{ - [key: string | number]: any; -}> | { - [key: string | number]: any; -} = s.Schema<{}>, ChildrenSchema extends unknown = s.Schema, HasText extends boolean = false, Recursive extends boolean = false, Formats extends { - [k: string]: any; -} = { - [k: string]: any; -}>({ name, attrs, children, text, formats, recursive }: { - name?: NodeNameSchema | null | undefined; - attrs?: AttrsSchema | null | undefined; - children?: ChildrenSchema | null | undefined; - text?: HasText | undefined; - formats?: Formats | undefined; - recursive?: Recursive | undefined; -}): [s.Unwrap>, s.Unwrap>, s.Unwrap>] extends [infer NodeName_1, infer Attrs_1, infer Children_1] ? s.Schema : never), HasText extends true ? string : never>> : never; -export const $$delta: s.Schema<$Delta>; -export function _$delta | string | Array = s.Schema, AttrsSchema extends s.Schema<{ - [key: string | number]: any; -}> | { - [key: string | number]: any; -} = s.Schema<{}>, ChildrenSchema extends unknown = s.Schema, HasText extends boolean = false, Recursive extends boolean = false>({ name, attrs, children, text, recursive }: { - name?: NodeNameSchema | null | undefined; - attrs?: AttrsSchema | null | undefined; - children?: ChildrenSchema | null | undefined; - text?: HasText | undefined; - recursive?: Recursive | undefined; -}): [s.Unwrap>, s.Unwrap>, s.Unwrap>] extends [infer NodeName_1, infer Attrs_1, infer Children_1] ? s.Schema : never), HasText extends true ? string : never>> : never; -/** - * @type {s.Schema} - */ -export const $deltaAny: s.Schema; -/** - * @type {s.Schema} - */ -export const $deltaBuilderAny: s.Schema; -export function mergeAttrs(a: T | null, b: T | null): T | null; -export function mergeDeltas(a: D, b: D): D; -export function random(gen: prng.PRNG, $d: s.Schema): D extends Delta ? DeltaBuilder : never; -/** - * @overload - * @return {DeltaBuilder} - */ -export function create(): DeltaBuilder; -/** - * @template {string} NodeName - * @overload - * @param {NodeName} nodeName - * @return {DeltaBuilder} - */ -export function create(nodeName: NodeName): DeltaBuilder; -/** - * @template {string} NodeName - * @template {s.Schema} Schema - * @overload - * @param {NodeName} nodeName - * @param {Schema} schema - * @return {Schema extends s.Schema> ? DeltaBuilder : never} - */ -export function create>(nodeName: NodeName, schema: Schema): Schema extends s.Schema> ? DeltaBuilder : never; -/** - * @template {s.Schema} Schema - * @overload - * @param {Schema} schema - * @return {Schema extends s.Schema> ? DeltaBuilder : never} - */ -export function create>(schema: Schema): Schema extends s.Schema> ? DeltaBuilder : never; -/** - * @template {string|null} NodeName - * @template {{[k:string|number]:any}|null} Attrs - * @template {Array|string} [Children=never] - * @overload - * @param {NodeName} nodeName - * @param {Attrs} attrs - * @param {Children} [children] - * @return {DeltaBuilder< - * NodeName extends null ? any : NodeName, - * Attrs extends null ? {} : Attrs, - * Extract> extends Array ? (unknown extends Ac ? never : Ac) : never, - * Extract, - * null - * >} - */ -export function create | string = never>(nodeName: NodeName, attrs: Attrs, children?: Children | undefined): DeltaBuilder> extends Array ? (unknown extends Ac ? never : Ac) : never, Extract, null>; -export function $text<$Embeds extends Array> = any>(...$embeds: $Embeds): s.Schema extends null ? never : ($Embeds extends Array> ? $C : never)>>; -export const $textOnly: s.Schema>; -export function text> = s.Schema>>($schema?: Schema_1): Schema_1 extends s.Schema> ? DeltaBuilder : never; -export function $array<$Children extends unknown>($children?: $Children): s.Schema>>>; -export function array<$Schema extends s.Schema> = never>($schema: $Schema): $Schema extends never ? ArrayDeltaBuilder : DeltaBuilder; -export function $map<$Attrs extends { - [K: string | number]: any; -}>($attrs: s.Schema<$Attrs>): s.Schema>; -export function map<$Schema extends s.Schema> | undefined = undefined>($schema?: $Schema): $Schema extends s.Schema> ? DeltaBuilder : MapDeltaBuilder<{}>; -export function diff(d1: D, d2: NoInfer): D extends Delta ? DeltaBuilder : never; -export type Attribution = { - insert?: string[]; - insertAt?: number; - delete?: string[]; - deleteAt?: number; - format?: Record; - formatAt?: number; -}; -export type DeltaOps = s.Unwrap | InsertOp | AttrDeleteOp | DeleteOp | TextOp | AttrModifyOp | ModifyOp>>; -export type FormattingAttributes = { - [key: string]: any; -}; -export type DeltaJSON = { - type: "delta"; - name?: string; - attrs?: { [Key in string | number]: DeltaAttrOpJSON; }; - children?: Array; -}; -export type DeltaListOpJSON = { - type: "insert"; - insert: string | Array; - format?: { - [key: string]: any; - }; - attribution?: Attribution; -} | { - delete: number; -} | { - type: "retain"; - retain: number; - format?: { - [key: string]: any; - }; - attribution?: Attribution; -} | { - type: "modify"; - value: object; -}; -export type DeltaAttrOpJSON = { - type: "insert"; - value: any; - prevValue?: any; - attribution?: Attribution; -} | { - type: "delete"; - prevValue?: any; - attribution?: Attribution; -} | { - type: "modify"; - value: DeltaJSON; -}; -export type ChildrenOpAny = TextOp | InsertOp | DeleteOp | RetainOp | ModifyOp; -export type AttrOpAny = AttrInsertOp | AttrDeleteOp | AttrModifyOp; -export type _OpAny = ChildrenOpAny | AttrOpAny; -export type MergeListArrays | string, C2 extends Array | string> = Extract> extends never ? never : (Array<(Extract> extends Array ? (unknown extends AC1 ? never : AC1) : never)>); -export type AddToAttrs = { [K in (Key | keyof Attrs_1)]: (unknown extends Attrs_1[K] ? never : Attrs_1[K]) | (Key extends K ? Val : never); }; -export type MergeAttrs = { [K in (keyof NewAttrs | keyof Attrs_1)]: (unknown extends Attrs_1[K] ? never : Attrs_1[K]) | (unknown extends NewAttrs[K] ? never : NewAttrs[K]); }; -export type _AnyToNull = 0 extends (1 & X) ? null : X; -export type AllowedDeltaFromSchema> | null> = _AnyToNull extends null ? Delta : (Schema_1 extends s.Schema ? D : never); -export type DeltaAny = Delta; -export type DeltaBuilderAny = DeltaBuilder; -export type CastToDelta = D extends DeltaBuilder ? Delta : D; -export type RecursiveDelta = Delta | RecursiveDelta, Text>; -export type TextDelta = Delta; -export type TextDeltaBuilder = DeltaBuilder; -export type ArrayDelta = Delta; -export type ArrayDeltaBuilder = DeltaBuilder; -export type MapDelta = Delta; -export type MapDeltaBuilder = DeltaBuilder; -import * as s from '../schema.js'; -import * as list from '../list.js'; -import * as equalityTrait from '../trait/equality.js'; -import * as fingerprintTrait from '../trait/fingerprint.js'; -import * as prng from '../prng.js'; -//# sourceMappingURL=delta.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/delta/delta.d.ts.map b/yjs-poll/node_modules/lib0/dist/delta/delta.d.ts.map deleted file mode 100644 index 635d23a..0000000 --- a/yjs-poll/node_modules/lib0/dist/delta/delta.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"delta.d.ts","sourceRoot":"","sources":["../../delta/delta.js"],"names":[],"mappings":"AAyBA;;;;;;;;;GASG;AAEH;;GAEG;AACH,2BAFU,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAS7B;AAEF;;GAEG;AAEH;;GAEG;AAEH;;;;;;;GAOG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AACH,kCAFU,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAMlC;AAeD;IACE;;;;OAIG;IACH,oBAJW,MAAM,UACN,oBAAoB,GAAC,IAAI,eACzB,WAAW,OAAC,EAoBtB;IAfC;;;OAGG;IACH,iBAFU,MAAM,CAEI;IACpB;;;OAGG;IACH,iBAFU,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G,EAAC,OAAK,EAAC,KAAK,EAAC,KAAK,CAAC;4CAI5B;IAAG,CAAC,CAAC,EAAE,MAAM,GAAC,MAAM,GAAG,GAAG,CAAA;CAAG,IAC7B,YAAY,CAAC,GAAG,EAAC,OAAK,EAAC,KAAK,EAAC,KAAK,CAAC;mBAnlE7B,cAAc;sBANX,YAAY;+BAEH,sBAAsB;kCACnB,yBAAyB;sBAUrC,YAAY"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/delta/delta.test.d.ts b/yjs-poll/node_modules/lib0/dist/delta/delta.test.d.ts deleted file mode 100644 index ceb757e..0000000 --- a/yjs-poll/node_modules/lib0/dist/delta/delta.test.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -export function testDeltaBasicApi(_tc: t.TestCase): void; -export function testDeltaValues(_tc: t.TestCase): void; -export function testDeltaBasicCases(): void; -export function testDeltaArrayBasics(): void; -export function testAssignability(): void; -export function testText(): void; -export function testDelta(_tc: t.TestCase): void; -export function testDeltaMerging(_tc: t.TestCase): void; -export function testUseAttributes(_tc: t.TestCase): void; -export function testUseAttribution(_tc: t.TestCase): void; -export function testMapTyping(): void; -export function testMapDeltaBasics(_tc: t.TestCase): void; -export function testMapDeltaModify(_tc: t.TestCase): void; -export function testMapDelta(_tc: t.TestCase): void; -export function testRepeatRebaseMergeDeltas(tc: t.TestCase): void; -export function testNodeDelta(_tc: t.TestCase): void; -export function testRecursiveNode(): void; -export function testSimplifiedDeltaSchemaDefinition(): void; -export function testDiffing(): void; -export function testDiffingCommonPreSuffix(): void; -export function testSlice(): void; -export function testRepeatRandomListDiff(tc: t.TestCase): void; -export function testRepeatRandomMapDiff(tc: t.TestCase): void; -export function testDeltaAppend(_tc: t.TestCase): void; -export function testDeltaDiffWithFormatting(): void; -export function testDeltaDiffWithFormatting2(): void; -export function testDeltaDiffIssue1(): void; -import * as t from 'lib0/testing'; -//# sourceMappingURL=delta.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/delta/delta.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/delta/delta.test.d.ts.map deleted file mode 100644 index 07fa814..0000000 --- a/yjs-poll/node_modules/lib0/dist/delta/delta.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"delta.test.d.ts","sourceRoot":"","sources":["../../delta/delta.test.js"],"names":[],"mappings":"AAqCO,uCAFI,CAAC,CAAC,QAAQ,QAWpB;AAYM,qCAFI,CAAC,CAAC,QAAQ,QAwBpB;AAEM,4CA2BN;AAEM,6CAMN;AAKM,0CAkJN;AAEM,iCAWN;AAKM,+BAFI,CAAC,CAAC,QAAQ,QAKpB;AAKM,sCAFI,CAAC,CAAC,QAAQ,QAYpB;AAKM,uCAFI,CAAC,CAAC,QAAQ,QAuBpB;AAKM,wCAFI,CAAC,CAAC,QAAQ,QAsBpB;AAEM,sCAaN;AAKM,wCAFI,CAAC,CAAC,QAAQ,QA4BpB;AAKM,wCAFI,CAAC,CAAC,QAAQ,QA2CpB;AAKM,kCAFI,CAAC,CAAC,QAAQ,QAqDpB;AAKM,gDAFI,CAAC,CAAC,QAAQ,QAoEpB;AAKM,mCAFI,CAAC,CAAC,QAAQ,QAiCpB;AAEM,0CAmBN;AAEM,4DAIN;AAEM,oCAMN;AAEM,mDAMN;AAEM,kCAGN;AAKM,6CAFI,CAAC,CAAC,QAAQ,QAWpB;AAKM,4CAFI,CAAC,CAAC,QAAQ,QAWpB;AAKM,qCAFI,CAAC,CAAC,QAAQ,QAQpB;AAEM,oDAKN;AAEM,qDAKN;AAEM,4CAQN;mBAjtBkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/delta/t3.test.d.ts b/yjs-poll/node_modules/lib0/dist/delta/t3.test.d.ts deleted file mode 100644 index b449d55..0000000 --- a/yjs-poll/node_modules/lib0/dist/delta/t3.test.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -export function transformResult(a: DeltaA, b: DeltaB): TransformResult; -export const transformResultEmpty: TransformResult; -export type TransformResult = { - a: DeltaA | null; - b: DeltaB | null; -}; -export type DeltaTransformer = (t: { - a: DeltaA | null; - b: DeltaB | null; -}) => ({ - a: DeltaA | null; - b: DeltaB | null; -}); -export type Transform = { - applyA: (da: DeltaA) => TransformResult; - applyB: (db: DeltaB) => TransformResult; -}; -import * as delta from './delta.js'; -//# sourceMappingURL=t3.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/delta/t3.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/delta/t3.test.d.ts.map deleted file mode 100644 index dc1e002..0000000 --- a/yjs-poll/node_modules/lib0/dist/delta/t3.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"t3.test.d.ts","sourceRoot":"","sources":["../../delta/t3.test.js"],"names":[],"mappings":"AAoBO,gCAN4B,MAAM,SAA3B,KAAK,CAAC,YAAY,OAAE,EACC,MAAM,SAA3B,KAAK,CAAC,YAAY,OAAE,KACvB,MAAM,KACN,MAAM,GACL,eAAe,CAAC,MAAM,OAAC,EAAC,MAAM,OAAC,CAAC,CAEO;AACnD,+DAA+D;4BAbnC,MAAM,SAApB,KAAK,CAAC,KAAK,OAAE,EACC,MAAM,SAApB,KAAK,CAAC,KAAK,OAAE,IACd;IAAE,CAAC,EAAE,MAAM,OAAC,CAAC;IAAC,CAAC,EAAE,MAAM,OAAC,CAAA;CAAE;6BAiBT,MAAM,SAAtB,KAAK,CAAC,QAAS,EACC,MAAM,SAAtB,KAAK,CAAC,QAAS,IAChB,CAAC,CAAC,EAAC;IAAC,CAAC,EAAC,MAAM,OAAC,CAAC;IAAA,CAAC,EAAC,MAAM,OAAC,CAAA;CAAC,KAAG,CAAC;IAAC,CAAC,EAAC,MAAM,OAAC,CAAC;IAAA,CAAC,EAAC,MAAM,OAAC,CAAA;CAAC,CAAC;sBA2GpC,MAAM,SAAnB,KAAK,CAAC,KAAM,EACC,MAAM,SAAnB,KAAK,CAAC,KAAM,IACb;IAAE,MAAM,EAAE,CAAC,EAAE,EAAC,MAAM,KAAG,eAAe,CAAC,MAAM,EAAC,MAAM,CAAC,CAAC;IAAC,MAAM,EAAE,CAAC,EAAE,EAAC,MAAM,KAAG,eAAe,CAAC,MAAM,EAAC,MAAM,CAAC,CAAA;CAAE;uBAvIlG,YAAY"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/diff-9d236524.cjs b/yjs-poll/node_modules/lib0/dist/diff-9d236524.cjs deleted file mode 100644 index 56ab6ed..0000000 --- a/yjs-poll/node_modules/lib0/dist/diff-9d236524.cjs +++ /dev/null @@ -1,162 +0,0 @@ -'use strict'; - -var _function = require('./function-314580f7.cjs'); - -/** - * Efficient diffs. - * - * @module diff - */ - -/** - * A SimpleDiff describes a change on a String. - * - * ```js - * console.log(a) // the old value - * console.log(b) // the updated value - * // Apply changes of diff (pseudocode) - * a.remove(diff.index, diff.remove) // Remove `diff.remove` characters - * a.insert(diff.index, diff.insert) // Insert `diff.insert` - * a === b // values match - * ``` - * - * @template {string|Array} T - * @typedef {Object} SimpleDiff - * @property {Number} index The index where changes were applied - * @property {Number} remove The number of characters to delete starting - * at `index`. - * @property {T} insert The new text to insert at `index` after applying - */ - -const highSurrogateRegex = /[\uD800-\uDBFF]/; -const lowSurrogateRegex = /[\uDC00-\uDFFF]/; - -/** - * Create a diff between two strings. This diff implementation is highly - * efficient, but not very sophisticated. - * - * @function - * - * @param {string} a The old version of the string - * @param {string} b The updated version of the string - * @return {SimpleDiff} The diff description. - */ -const simpleDiffString = (a, b) => { - let left = 0; // number of same characters counting from left - let right = 0; // number of same characters counting from right - while (left < a.length && left < b.length && a[left] === b[left]) { - left++; - } - // If the last same character is a high surrogate, we need to rollback to the previous character - if (left > 0 && highSurrogateRegex.test(a[left - 1])) left--; - while (right + left < a.length && right + left < b.length && a[a.length - right - 1] === b[b.length - right - 1]) { - right++; - } - // If the last same character is a low surrogate, we need to rollback to the previous character - if (right > 0 && lowSurrogateRegex.test(a[a.length - right])) right--; - return { - index: left, - remove: a.length - left - right, - insert: b.slice(left, b.length - right) - } -}; - -/** - * @todo Remove in favor of simpleDiffString - * @deprecated - */ -const simpleDiff = simpleDiffString; - -/** - * Create a diff between two arrays. This diff implementation is highly - * efficient, but not very sophisticated. - * - * Note: This is basically the same function as above. Another function was created so that the runtime - * can better optimize these function calls. - * - * @function - * @template T - * - * @param {Array} a The old version of the array - * @param {Array} b The updated version of the array - * @param {function(T, T):boolean} [compare] - * @return {SimpleDiff>} The diff description. - */ -const simpleDiffArray = (a, b, compare = _function.equalityStrict) => { - let left = 0; // number of same characters counting from left - let right = 0; // number of same characters counting from right - while (left < a.length && left < b.length && compare(a[left], b[left])) { - left++; - } - while (right + left < a.length && right + left < b.length && compare(a[a.length - right - 1], b[b.length - right - 1])) { - right++; - } - return { - index: left, - remove: a.length - left - right, - insert: b.slice(left, b.length - right) - } -}; - -/** - * Diff text and try to diff at the current cursor position. - * - * @param {string} a - * @param {string} b - * @param {number} cursor This should refer to the current left cursor-range position - */ -const simpleDiffStringWithCursor = (a, b, cursor) => { - let left = 0; // number of same characters counting from left - let right = 0; // number of same characters counting from right - // Iterate left to the right until we find a changed character - // First iteration considers the current cursor position - while ( - left < a.length && - left < b.length && - a[left] === b[left] && - left < cursor - ) { - left++; - } - // If the last same character is a high surrogate, we need to rollback to the previous character - if (left > 0 && highSurrogateRegex.test(a[left - 1])) left--; - // Iterate right to the left until we find a changed character - while ( - right + left < a.length && - right + left < b.length && - a[a.length - right - 1] === b[b.length - right - 1] - ) { - right++; - } - // If the last same character is a low surrogate, we need to rollback to the previous character - if (right > 0 && lowSurrogateRegex.test(a[a.length - right])) right--; - // Try to iterate left further to the right without caring about the current cursor position - while ( - right + left < a.length && - right + left < b.length && - a[left] === b[left] - ) { - left++; - } - if (left > 0 && highSurrogateRegex.test(a[left - 1])) left--; - return { - index: left, - remove: a.length - left - right, - insert: b.slice(left, b.length - right) - } -}; - -var diff = /*#__PURE__*/Object.freeze({ - __proto__: null, - simpleDiffString: simpleDiffString, - simpleDiff: simpleDiff, - simpleDiffArray: simpleDiffArray, - simpleDiffStringWithCursor: simpleDiffStringWithCursor -}); - -exports.diff = diff; -exports.simpleDiff = simpleDiff; -exports.simpleDiffArray = simpleDiffArray; -exports.simpleDiffString = simpleDiffString; -exports.simpleDiffStringWithCursor = simpleDiffStringWithCursor; -//# sourceMappingURL=diff-9d236524.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/diff-9d236524.cjs.map b/yjs-poll/node_modules/lib0/dist/diff-9d236524.cjs.map deleted file mode 100644 index de12614..0000000 --- a/yjs-poll/node_modules/lib0/dist/diff-9d236524.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"diff-9d236524.cjs","sources":["../diff.js"],"sourcesContent":["/**\n * Efficient diffs.\n *\n * @module diff\n */\n\nimport { equalityStrict } from './function.js'\n\n/**\n * A SimpleDiff describes a change on a String.\n *\n * ```js\n * console.log(a) // the old value\n * console.log(b) // the updated value\n * // Apply changes of diff (pseudocode)\n * a.remove(diff.index, diff.remove) // Remove `diff.remove` characters\n * a.insert(diff.index, diff.insert) // Insert `diff.insert`\n * a === b // values match\n * ```\n *\n * @template {string|Array} T\n * @typedef {Object} SimpleDiff\n * @property {Number} index The index where changes were applied\n * @property {Number} remove The number of characters to delete starting\n * at `index`.\n * @property {T} insert The new text to insert at `index` after applying\n */\n\nconst highSurrogateRegex = /[\\uD800-\\uDBFF]/\nconst lowSurrogateRegex = /[\\uDC00-\\uDFFF]/\n\n/**\n * Create a diff between two strings. This diff implementation is highly\n * efficient, but not very sophisticated.\n *\n * @function\n *\n * @param {string} a The old version of the string\n * @param {string} b The updated version of the string\n * @return {SimpleDiff} The diff description.\n */\nexport const simpleDiffString = (a, b) => {\n let left = 0 // number of same characters counting from left\n let right = 0 // number of same characters counting from right\n while (left < a.length && left < b.length && a[left] === b[left]) {\n left++\n }\n // If the last same character is a high surrogate, we need to rollback to the previous character\n if (left > 0 && highSurrogateRegex.test(a[left - 1])) left--\n while (right + left < a.length && right + left < b.length && a[a.length - right - 1] === b[b.length - right - 1]) {\n right++\n }\n // If the last same character is a low surrogate, we need to rollback to the previous character\n if (right > 0 && lowSurrogateRegex.test(a[a.length - right])) right--\n return {\n index: left,\n remove: a.length - left - right,\n insert: b.slice(left, b.length - right)\n }\n}\n\n/**\n * @todo Remove in favor of simpleDiffString\n * @deprecated\n */\nexport const simpleDiff = simpleDiffString\n\n/**\n * Create a diff between two arrays. This diff implementation is highly\n * efficient, but not very sophisticated.\n *\n * Note: This is basically the same function as above. Another function was created so that the runtime\n * can better optimize these function calls.\n *\n * @function\n * @template T\n *\n * @param {Array} a The old version of the array\n * @param {Array} b The updated version of the array\n * @param {function(T, T):boolean} [compare]\n * @return {SimpleDiff>} The diff description.\n */\nexport const simpleDiffArray = (a, b, compare = equalityStrict) => {\n let left = 0 // number of same characters counting from left\n let right = 0 // number of same characters counting from right\n while (left < a.length && left < b.length && compare(a[left], b[left])) {\n left++\n }\n while (right + left < a.length && right + left < b.length && compare(a[a.length - right - 1], b[b.length - right - 1])) {\n right++\n }\n return {\n index: left,\n remove: a.length - left - right,\n insert: b.slice(left, b.length - right)\n }\n}\n\n/**\n * Diff text and try to diff at the current cursor position.\n *\n * @param {string} a\n * @param {string} b\n * @param {number} cursor This should refer to the current left cursor-range position\n */\nexport const simpleDiffStringWithCursor = (a, b, cursor) => {\n let left = 0 // number of same characters counting from left\n let right = 0 // number of same characters counting from right\n // Iterate left to the right until we find a changed character\n // First iteration considers the current cursor position\n while (\n left < a.length &&\n left < b.length &&\n a[left] === b[left] &&\n left < cursor\n ) {\n left++\n }\n // If the last same character is a high surrogate, we need to rollback to the previous character\n if (left > 0 && highSurrogateRegex.test(a[left - 1])) left--\n // Iterate right to the left until we find a changed character\n while (\n right + left < a.length &&\n right + left < b.length &&\n a[a.length - right - 1] === b[b.length - right - 1]\n ) {\n right++\n }\n // If the last same character is a low surrogate, we need to rollback to the previous character\n if (right > 0 && lowSurrogateRegex.test(a[a.length - right])) right--\n // Try to iterate left further to the right without caring about the current cursor position\n while (\n right + left < a.length &&\n right + left < b.length &&\n a[left] === b[left]\n ) {\n left++\n }\n if (left > 0 && highSurrogateRegex.test(a[left - 1])) left--\n return {\n index: left,\n remove: a.length - left - right,\n insert: b.slice(left, b.length - right)\n }\n}\n"],"names":["equalityStrict"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,kBAAkB,GAAG,kBAAiB;AAC5C,MAAM,iBAAiB,GAAG,kBAAiB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,gBAAgB,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC1C,EAAE,IAAI,IAAI,GAAG,EAAC;AACd,EAAE,IAAI,KAAK,GAAG,EAAC;AACf,EAAE,OAAO,IAAI,GAAG,CAAC,CAAC,MAAM,IAAI,IAAI,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE;AACpE,IAAI,IAAI,GAAE;AACV,GAAG;AACH;AACA,EAAE,IAAI,IAAI,GAAG,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,GAAE;AAC9D,EAAE,OAAO,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,IAAI,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,GAAG,CAAC,CAAC,EAAE;AACpH,IAAI,KAAK,GAAE;AACX,GAAG;AACH;AACA,EAAE,IAAI,KAAK,GAAG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K,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM;AAC3B,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;AACvB,IAAI;AACJ,IAAI,IAAI,GAAE;AACV,GAAG;AACH,EAAE,IAAI,IAAI,GAAG,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,GAAE;AAC9D,EAAE,OAAO;AACT,IAAI,KAAK,EAAE,IAAI;AACf,IAAI,MAAM,EAAE,CAAC,CAAC,MAAM,GAAG,IAAI,GAAG,KAAK;AACnC,IAAI,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC;AAC3C,GAAG;AACH;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/diff.cjs b/yjs-poll/node_modules/lib0/dist/diff.cjs deleted file mode 100644 index 0896a87..0000000 --- a/yjs-poll/node_modules/lib0/dist/diff.cjs +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./function-314580f7.cjs'); -var diff = require('./diff-9d236524.cjs'); -require('./array-78849c95.cjs'); -require('./set-5b47859e.cjs'); -require('./object-c0c9435b.cjs'); -require('./equality.cjs'); - - - -exports.simpleDiff = diff.simpleDiff; -exports.simpleDiffArray = diff.simpleDiffArray; -exports.simpleDiffString = diff.simpleDiffString; -exports.simpleDiffStringWithCursor = diff.simpleDiffStringWithCursor; -//# sourceMappingURL=diff.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/diff.cjs.map b/yjs-poll/node_modules/lib0/dist/diff.cjs.map deleted file mode 100644 index 2a5df78..0000000 --- a/yjs-poll/node_modules/lib0/dist/diff.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"diff.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/diff.d.ts b/yjs-poll/node_modules/lib0/dist/diff.d.ts deleted file mode 100644 index 290daec..0000000 --- a/yjs-poll/node_modules/lib0/dist/diff.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -export function simpleDiffString(a: string, b: string): SimpleDiff; -export function simpleDiff(a: string, b: string): SimpleDiff; -export function simpleDiffArray(a: Array, b: Array, compare?: (arg0: T, arg1: T) => boolean): SimpleDiff>; -export function simpleDiffStringWithCursor(a: string, b: string, cursor: number): { - index: number; - remove: number; - insert: string; -}; -/** - * A SimpleDiff describes a change on a String. - * - * ```js - * console.log(a) // the old value - * console.log(b) // the updated value - * // Apply changes of diff (pseudocode) - * a.remove(diff.index, diff.remove) // Remove `diff.remove` characters - * a.insert(diff.index, diff.insert) // Insert `diff.insert` - * a === b // values match - * ``` - */ -export type SimpleDiff> = { - /** - * The index where changes were applied - */ - index: number; - /** - * The number of characters to delete starting - * at `index`. - */ - remove: number; - /** - * The new text to insert at `index` after applying - */ - insert: T; -}; -//# sourceMappingURL=diff.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/diff.d.ts.map b/yjs-poll/node_modules/lib0/dist/diff.d.ts.map deleted file mode 100644 index 5e3aa18..0000000 --- a/yjs-poll/node_modules/lib0/dist/diff.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../diff.js"],"names":[],"mappings":"AAyCO,oCAJI,MAAM,KACN,MAAM,GACL,UAAU,CAAC,MAAM,CAAC,CAoB7B;AAlBM,8BAJI,MAAM,KACN,MAAM,GACL,UAAU,CAAC,MAAM,CAAC,CAoB7B;AAuBM,gCAPM,CAAC,KAEH,KAAK,CAAC,CAAC,CAAC,KACR,KAAK,CAAC,CAAC,CAAC,YACR,CAAS,IAAC,EAAD,CAAC,EAAE,IAAC,EAAD,CAAC,KAAE,OAAO,GACrB,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAgB/B;AASM,8CAJI,MAAM,KACN,MAAM,UACN,MAAM;;;;EAyChB;;;;;;;;;;;;;uBA5HgC,CAAC,SAApB,MAAM,GAAC,KAAK,CAAC,GAAG,CAAE;;;;;;;;;;;;;YAKlB,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/diff.test.d.ts b/yjs-poll/node_modules/lib0/dist/diff.test.d.ts deleted file mode 100644 index 5df670c..0000000 --- a/yjs-poll/node_modules/lib0/dist/diff.test.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export function testDiffing(tc: t.TestCase): void; -export function testRepeatDiffing(tc: t.TestCase): void; -export function testSimpleDiffWithCursor(tc: t.TestCase): void; -export function testArrayDiffing(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=diff.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/diff.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/diff.test.d.ts.map deleted file mode 100644 index d7a8c5f..0000000 --- a/yjs-poll/node_modules/lib0/dist/diff.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"diff.test.d.ts","sourceRoot":"","sources":["../diff.test.js"],"names":[],"mappings":"AA0BO,gCAFI,CAAC,CAAC,QAAQ,QAmBpB;AAKM,sCAFI,CAAC,CAAC,QAAQ,QAQpB;AAKM,6CAFI,CAAC,CAAC,QAAQ,QA4CpB;AAKM,qCAFI,CAAC,CAAC,QAAQ,QAQpB;mBA7GkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/diff/patience.d.ts b/yjs-poll/node_modules/lib0/dist/diff/patience.d.ts deleted file mode 100644 index bb84468..0000000 --- a/yjs-poll/node_modules/lib0/dist/diff/patience.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -export function diff(as: Array, bs: Array): Array<{ - index: number; - remove: Array; - insert: Array; -}>; -export function diffSplitBy(a: string, b: string, _regexp: RegExp | string): { - index: number; - remove: string; - insert: string; -}[]; -export function diffAuto(a: string, b: string): { - insert: string; - remove: string; - index: number; -}[]; -//# sourceMappingURL=patience.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/diff/patience.d.ts.map b/yjs-poll/node_modules/lib0/dist/diff/patience.d.ts.map deleted file mode 100644 index 306eaee..0000000 --- a/yjs-poll/node_modules/lib0/dist/diff/patience.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"patience.d.ts","sourceRoot":"","sources":["../../diff/patience.js"],"names":[],"mappings":"AAoBO,yBAJI,KAAK,CAAC,MAAM,CAAC,MACb,KAAK,CAAC,MAAM,CAAC,GACZ,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CAAC,CAAC,CAShF;AAOM,+BAJI,MAAM,KACN,MAAM,WACN,MAAM,GAAC,MAAM;;;;IAqBvB;AAWM,4BAHI,MAAM,KACN,MAAM;;;;IASP"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/diff/patience.test.d.ts b/yjs-poll/node_modules/lib0/dist/diff/patience.test.d.ts deleted file mode 100644 index 7633a91..0000000 --- a/yjs-poll/node_modules/lib0/dist/diff/patience.test.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function testDiffing(_tc: t.TestCase): void; -export function testRepeatRandomWordReplace(tc: t.TestCase): void; -import * as t from '../testing.js'; -//# sourceMappingURL=patience.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/diff/patience.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/diff/patience.test.d.ts.map deleted file mode 100644 index a5842fa..0000000 --- a/yjs-poll/node_modules/lib0/dist/diff/patience.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"patience.test.d.ts","sourceRoot":"","sources":["../../diff/patience.test.js"],"names":[],"mappings":"AAmBO,iCAFI,CAAC,CAAC,QAAQ,QAwGpB;AAKM,gDAFI,CAAC,CAAC,QAAQ,QAgDpB;mBA3KkB,eAAe"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/dom-7e625b09.cjs b/yjs-poll/node_modules/lib0/dist/dom-7e625b09.cjs deleted file mode 100644 index 9f6df5b..0000000 --- a/yjs-poll/node_modules/lib0/dist/dom-7e625b09.cjs +++ /dev/null @@ -1,371 +0,0 @@ -'use strict'; - -var pair = require('./pair-ab022bc3.cjs'); -var map = require('./map-24d263c0.cjs'); -var schema = require('./schema.cjs'); - -/* eslint-env browser */ - -/* c8 ignore start */ -/** - * @type {Document} - */ -const doc = /** @type {Document} */ (typeof document !== 'undefined' ? document : {}); - -/** - * @param {string} name - * @return {HTMLElement} - */ -const createElement = name => doc.createElement(name); - -/** - * @return {DocumentFragment} - */ -const createDocumentFragment = () => doc.createDocumentFragment(); - -/** - * @type {$.Schema} - */ -const $fragment = schema.$custom(el => el.nodeType === DOCUMENT_FRAGMENT_NODE); - -/** - * @param {string} text - * @return {Text} - */ -const createTextNode = text => doc.createTextNode(text); - -const domParser = /** @type {DOMParser} */ (typeof DOMParser !== 'undefined' ? new DOMParser() : null); - -/** - * @param {HTMLElement} el - * @param {string} name - * @param {Object} opts - */ -const emitCustomEvent = (el, name, opts) => el.dispatchEvent(new CustomEvent(name, opts)); - -/** - * @param {Element} el - * @param {Array>} attrs Array of key-value pairs - * @return {Element} - */ -const setAttributes = (el, attrs) => { - pair.forEach(attrs, (key, value) => { - if (value === false) { - el.removeAttribute(key); - } else if (value === true) { - el.setAttribute(key, ''); - } else { - // @ts-ignore - el.setAttribute(key, value); - } - }); - return el -}; - -/** - * @param {Element} el - * @param {Map} attrs Array of key-value pairs - * @return {Element} - */ -const setAttributesMap = (el, attrs) => { - attrs.forEach((value, key) => { el.setAttribute(key, value); }); - return el -}; - -/** - * @param {Array|HTMLCollection} children - * @return {DocumentFragment} - */ -const fragment = children => { - const fragment = createDocumentFragment(); - for (let i = 0; i < children.length; i++) { - appendChild(fragment, children[i]); - } - return fragment -}; - -/** - * @param {Element} parent - * @param {Array} nodes - * @return {Element} - */ -const append = (parent, nodes) => { - appendChild(parent, fragment(nodes)); - return parent -}; - -/** - * @param {HTMLElement} el - */ -const remove = el => el.remove(); - -/** - * @param {EventTarget} el - * @param {string} name - * @param {EventListener} f - */ -const addEventListener = (el, name, f) => el.addEventListener(name, f); - -/** - * @param {EventTarget} el - * @param {string} name - * @param {EventListener} f - */ -const removeEventListener = (el, name, f) => el.removeEventListener(name, f); - -/** - * @param {Node} node - * @param {Array>} listeners - * @return {Node} - */ -const addEventListeners = (node, listeners) => { - pair.forEach(listeners, (name, f) => addEventListener(node, name, f)); - return node -}; - -/** - * @param {Node} node - * @param {Array>} listeners - * @return {Node} - */ -const removeEventListeners = (node, listeners) => { - pair.forEach(listeners, (name, f) => removeEventListener(node, name, f)); - return node -}; - -/** - * @param {string} name - * @param {Array|pair.Pair>} attrs Array of key-value pairs - * @param {Array} children - * @return {Element} - */ -const element = (name, attrs = [], children = []) => - append(setAttributes(createElement(name), attrs), children); - -/** - * @type {$.Schema} - */ -const $element = schema.$custom(el => el.nodeType === ELEMENT_NODE); - -/** - * @param {number} width - * @param {number} height - */ -const canvas = (width, height) => { - const c = /** @type {HTMLCanvasElement} */ (createElement('canvas')); - c.height = height; - c.width = width; - return c -}; - -/** - * @param {string} t - * @return {Text} - */ -const text = createTextNode; - -/** - * @type {$.Schema} - */ -const $text = schema.$custom(el => el.nodeType === TEXT_NODE); - -/** - * @param {pair.Pair} pair - */ -const pairToStyleString = pair => `${pair.left}:${pair.right};`; - -/** - * @param {Array>} pairs - * @return {string} - */ -const pairsToStyleString = pairs => pairs.map(pairToStyleString).join(''); - -/** - * @param {Map} m - * @return {string} - */ -const mapToStyleString = m => map.map(m, (value, key) => `${key}:${value};`).join(''); - -/** - * @todo should always query on a dom element - * - * @param {HTMLElement|ShadowRoot} el - * @param {string} query - * @return {HTMLElement | null} - */ -const querySelector = (el, query) => el.querySelector(query); - -/** - * @param {HTMLElement|ShadowRoot} el - * @param {string} query - * @return {NodeListOf} - */ -const querySelectorAll = (el, query) => el.querySelectorAll(query); - -/** - * @param {string} id - * @return {HTMLElement} - */ -const getElementById = id => /** @type {HTMLElement} */ (doc.getElementById(id)); - -/** - * @param {string} html - * @return {HTMLElement} - */ -const _parse = html => domParser.parseFromString(`${html}`, 'text/html').body; - -/** - * @param {string} html - * @return {DocumentFragment} - */ -const parseFragment = html => fragment(/** @type {any} */ (_parse(html).childNodes)); - -/** - * @param {string} html - * @return {HTMLElement} - */ -const parseElement = html => /** @type HTMLElement */ (_parse(html).firstElementChild); - -/** - * @param {HTMLElement} oldEl - * @param {HTMLElement|DocumentFragment} newEl - */ -const replaceWith = (oldEl, newEl) => oldEl.replaceWith(newEl); - -/** - * @param {HTMLElement} parent - * @param {HTMLElement} el - * @param {Node|null} ref - * @return {HTMLElement} - */ -const insertBefore = (parent, el, ref) => parent.insertBefore(el, ref); - -/** - * @param {Node} parent - * @param {Node} child - * @return {Node} - */ -const appendChild = (parent, child) => parent.appendChild(child); - -const ELEMENT_NODE = doc.ELEMENT_NODE; -const TEXT_NODE = doc.TEXT_NODE; -const CDATA_SECTION_NODE = doc.CDATA_SECTION_NODE; -const COMMENT_NODE = doc.COMMENT_NODE; -const DOCUMENT_NODE = doc.DOCUMENT_NODE; -const DOCUMENT_TYPE_NODE = doc.DOCUMENT_TYPE_NODE; -const DOCUMENT_FRAGMENT_NODE = doc.DOCUMENT_FRAGMENT_NODE; - -/** - * @type {$.Schema} - */ -const $node = schema.$custom(el => el.nodeType === DOCUMENT_NODE); - -/** - * @param {any} node - * @param {number} type - */ -const checkNodeType = (node, type) => node.nodeType === type; - -/** - * @param {Node} parent - * @param {HTMLElement} child - */ -const isParentOf = (parent, child) => { - let p = child.parentNode; - while (p && p !== parent) { - p = p.parentNode; - } - return p === parent -}; -/* c8 ignore stop */ - -var dom = /*#__PURE__*/Object.freeze({ - __proto__: null, - doc: doc, - createElement: createElement, - createDocumentFragment: createDocumentFragment, - $fragment: $fragment, - createTextNode: createTextNode, - domParser: domParser, - emitCustomEvent: emitCustomEvent, - setAttributes: setAttributes, - setAttributesMap: setAttributesMap, - fragment: fragment, - append: append, - remove: remove, - addEventListener: addEventListener, - removeEventListener: removeEventListener, - addEventListeners: addEventListeners, - removeEventListeners: removeEventListeners, - element: element, - $element: $element, - canvas: canvas, - text: text, - $text: $text, - pairToStyleString: pairToStyleString, - pairsToStyleString: pairsToStyleString, - mapToStyleString: mapToStyleString, - querySelector: querySelector, - querySelectorAll: querySelectorAll, - getElementById: getElementById, - parseFragment: parseFragment, - parseElement: parseElement, - replaceWith: replaceWith, - insertBefore: insertBefore, - appendChild: appendChild, - ELEMENT_NODE: ELEMENT_NODE, - TEXT_NODE: TEXT_NODE, - CDATA_SECTION_NODE: CDATA_SECTION_NODE, - COMMENT_NODE: COMMENT_NODE, - DOCUMENT_NODE: DOCUMENT_NODE, - DOCUMENT_TYPE_NODE: DOCUMENT_TYPE_NODE, - DOCUMENT_FRAGMENT_NODE: DOCUMENT_FRAGMENT_NODE, - $node: $node, - checkNodeType: checkNodeType, - isParentOf: isParentOf -}); - -exports.$element = $element; -exports.$fragment = $fragment; -exports.$node = $node; -exports.$text = $text; -exports.CDATA_SECTION_NODE = CDATA_SECTION_NODE; -exports.COMMENT_NODE = COMMENT_NODE; -exports.DOCUMENT_FRAGMENT_NODE = DOCUMENT_FRAGMENT_NODE; -exports.DOCUMENT_NODE = DOCUMENT_NODE; -exports.DOCUMENT_TYPE_NODE = DOCUMENT_TYPE_NODE; -exports.ELEMENT_NODE = ELEMENT_NODE; -exports.TEXT_NODE = TEXT_NODE; -exports.addEventListener = addEventListener; -exports.addEventListeners = addEventListeners; -exports.append = append; -exports.appendChild = appendChild; -exports.canvas = canvas; -exports.checkNodeType = checkNodeType; -exports.createDocumentFragment = createDocumentFragment; -exports.createElement = createElement; -exports.createTextNode = createTextNode; -exports.doc = doc; -exports.dom = dom; -exports.domParser = domParser; -exports.element = element; -exports.emitCustomEvent = emitCustomEvent; -exports.fragment = fragment; -exports.getElementById = getElementById; -exports.insertBefore = insertBefore; -exports.isParentOf = isParentOf; -exports.mapToStyleString = mapToStyleString; -exports.pairToStyleString = pairToStyleString; -exports.pairsToStyleString = pairsToStyleString; -exports.parseElement = parseElement; -exports.parseFragment = parseFragment; -exports.querySelector = querySelector; -exports.querySelectorAll = querySelectorAll; -exports.remove = remove; -exports.removeEventListener = removeEventListener; -exports.removeEventListeners = removeEventListeners; -exports.replaceWith = replaceWith; -exports.setAttributes = setAttributes; -exports.setAttributesMap = setAttributesMap; -exports.text = text; -//# sourceMappingURL=dom-7e625b09.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/dom-7e625b09.cjs.map b/yjs-poll/node_modules/lib0/dist/dom-7e625b09.cjs.map deleted file mode 100644 index 7575ff8..0000000 --- a/yjs-poll/node_modules/lib0/dist/dom-7e625b09.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dom-7e625b09.cjs","sources":["../dom.js"],"sourcesContent":["/* eslint-env browser */\n\n/**\n * Utility module to work with the DOM.\n *\n * @module dom\n */\n\nimport * as pair from './pair.js'\nimport * as map from './map.js'\nimport * as $ from './schema.js'\n\n/* c8 ignore start */\n/**\n * @type {Document}\n */\nexport const doc = /** @type {Document} */ (typeof document !== 'undefined' ? document : {})\n\n/**\n * @param {string} name\n * @return {HTMLElement}\n */\nexport const createElement = name => doc.createElement(name)\n\n/**\n * @return {DocumentFragment}\n */\nexport const createDocumentFragment = () => doc.createDocumentFragment()\n\n/**\n * @type {$.Schema}\n */\nexport const $fragment = $.$custom(el => el.nodeType === DOCUMENT_FRAGMENT_NODE)\n\n/**\n * @param {string} text\n * @return {Text}\n */\nexport const createTextNode = text => doc.createTextNode(text)\n\nexport const domParser = /** @type {DOMParser} */ (typeof DOMParser !== 'undefined' ? new DOMParser() : null)\n\n/**\n * @param {HTMLElement} el\n * @param {string} name\n * @param {Object} opts\n */\nexport const emitCustomEvent = (el, name, opts) => el.dispatchEvent(new CustomEvent(name, opts))\n\n/**\n * @param {Element} el\n * @param {Array>} attrs Array of key-value pairs\n * @return {Element}\n */\nexport const setAttributes = (el, attrs) => {\n pair.forEach(attrs, (key, value) => {\n if (value === false) {\n el.removeAttribute(key)\n } else if (value === true) {\n el.setAttribute(key, '')\n } else {\n // @ts-ignore\n el.setAttribute(key, value)\n }\n })\n return el\n}\n\n/**\n * @param {Element} el\n * @param {Map} attrs Array of key-value pairs\n * @return {Element}\n */\nexport const setAttributesMap = (el, attrs) => {\n attrs.forEach((value, key) => { el.setAttribute(key, value) })\n return el\n}\n\n/**\n * @param {Array|HTMLCollection} children\n * @return {DocumentFragment}\n */\nexport const fragment = children => {\n const fragment = createDocumentFragment()\n for (let i = 0; i < children.length; i++) {\n appendChild(fragment, children[i])\n }\n return fragment\n}\n\n/**\n * @param {Element} parent\n * @param {Array} nodes\n * @return {Element}\n */\nexport const append = (parent, nodes) => {\n appendChild(parent, fragment(nodes))\n return parent\n}\n\n/**\n * @param {HTMLElement} el\n */\nexport const remove = el => el.remove()\n\n/**\n * @param {EventTarget} el\n * @param {string} name\n * @param {EventListener} f\n */\nexport const addEventListener = (el, name, f) => el.addEventListener(name, f)\n\n/**\n * @param {EventTarget} el\n * @param {string} name\n * @param {EventListener} f\n */\nexport const removeEventListener = (el, name, f) => el.removeEventListener(name, f)\n\n/**\n * @param {Node} node\n * @param {Array>} listeners\n * @return {Node}\n */\nexport const addEventListeners = (node, listeners) => {\n pair.forEach(listeners, (name, f) => addEventListener(node, name, f))\n return node\n}\n\n/**\n * @param {Node} node\n * @param {Array>} listeners\n * @return {Node}\n */\nexport const removeEventListeners = (node, listeners) => {\n pair.forEach(listeners, (name, f) => removeEventListener(node, name, f))\n return node\n}\n\n/**\n * @param {string} name\n * @param {Array|pair.Pair>} attrs Array of key-value pairs\n * @param {Array} children\n * @return {Element}\n */\nexport const element = (name, attrs = [], children = []) =>\n append(setAttributes(createElement(name), attrs), children)\n\n/**\n * @type {$.Schema}\n */\nexport const $element = $.$custom(el => el.nodeType === ELEMENT_NODE)\n\n/**\n * @param {number} width\n * @param {number} height\n */\nexport const canvas = (width, height) => {\n const c = /** @type {HTMLCanvasElement} */ (createElement('canvas'))\n c.height = height\n c.width = width\n return c\n}\n\n/**\n * @param {string} t\n * @return {Text}\n */\nexport const text = createTextNode\n\n/**\n * @type {$.Schema}\n */\nexport const $text = $.$custom(el => el.nodeType === TEXT_NODE)\n\n/**\n * @param {pair.Pair} pair\n */\nexport const pairToStyleString = pair => `${pair.left}:${pair.right};`\n\n/**\n * @param {Array>} pairs\n * @return {string}\n */\nexport const pairsToStyleString = pairs => pairs.map(pairToStyleString).join('')\n\n/**\n * @param {Map} m\n * @return {string}\n */\nexport const mapToStyleString = m => map.map(m, (value, key) => `${key}:${value};`).join('')\n\n/**\n * @todo should always query on a dom element\n *\n * @param {HTMLElement|ShadowRoot} el\n * @param {string} query\n * @return {HTMLElement | null}\n */\nexport const querySelector = (el, query) => el.querySelector(query)\n\n/**\n * @param {HTMLElement|ShadowRoot} el\n * @param {string} query\n * @return {NodeListOf}\n */\nexport const querySelectorAll = (el, query) => el.querySelectorAll(query)\n\n/**\n * @param {string} id\n * @return {HTMLElement}\n */\nexport const getElementById = id => /** @type {HTMLElement} */ (doc.getElementById(id))\n\n/**\n * @param {string} html\n * @return {HTMLElement}\n */\nconst _parse = html => domParser.parseFromString(`${html}`, 'text/html').body\n\n/**\n * @param {string} html\n * @return {DocumentFragment}\n */\nexport const parseFragment = html => fragment(/** @type {any} */ (_parse(html).childNodes))\n\n/**\n * @param {string} html\n * @return {HTMLElement}\n */\nexport const parseElement = html => /** @type HTMLElement */ (_parse(html).firstElementChild)\n\n/**\n * @param {HTMLElement} oldEl\n * @param {HTMLElement|DocumentFragment} newEl\n */\nexport const replaceWith = (oldEl, newEl) => oldEl.replaceWith(newEl)\n\n/**\n * @param {HTMLElement} parent\n * @param {HTMLElement} el\n * @param {Node|null} ref\n * @return {HTMLElement}\n */\nexport const insertBefore = (parent, el, ref) => parent.insertBefore(el, ref)\n\n/**\n * @param {Node} parent\n * @param {Node} child\n * @return {Node}\n */\nexport const appendChild = (parent, child) => parent.appendChild(child)\n\nexport const ELEMENT_NODE = doc.ELEMENT_NODE\nexport const TEXT_NODE = doc.TEXT_NODE\nexport const CDATA_SECTION_NODE = doc.CDATA_SECTION_NODE\nexport const COMMENT_NODE = doc.COMMENT_NODE\nexport const DOCUMENT_NODE = doc.DOCUMENT_NODE\nexport const DOCUMENT_TYPE_NODE = doc.DOCUMENT_TYPE_NODE\nexport const DOCUMENT_FRAGMENT_NODE = doc.DOCUMENT_FRAGMENT_NODE\n\n/**\n * @type {$.Schema}\n */\nexport const $node = $.$custom(el => el.nodeType === DOCUMENT_NODE)\n\n/**\n * @param {any} node\n * @param {number} type\n */\nexport const checkNodeType = (node, type) => node.nodeType === type\n\n/**\n * @param {Node} parent\n * @param {HTMLElement} child\n */\nexport const isParentOf = (parent, child) => {\n let p = child.parentNode\n while (p && p !== parent) {\n p = p.parentNode\n }\n return p === parent\n}\n/* c8 ignore stop */\n"],"names":["$.$custom","pair.forEach","map.map"],"mappings":";;;;;;AAAA;AAWA;AACA;AACA;AACA;AACA;AACY,MAAC,GAAG,4BAA4B,OAAO,QAAQ,KAAK,WAAW,GAAG,QAAQ,GAAG,EAAE,EAAC;AAC5F;AACA;AACA;AACA;AACA;AACY,MAAC,aAAa,GAAG,IAAI,IAAI,GAAG,CAAC,aAAa,CAAC,IAAI,EAAC;AAC5D;AACA;AACA;AACA;AACY,MAAC,sBAAsB,GAAG,MAAM,GAAG,CAAC,sBAAsB,GAAE;AACxE;AACA;AACA;AACA;AACY,MAAC,SAAS,GAAGA,cAAS,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,KAAK,sBAAsB,EAAC;AAChF;AACA;AACA;AACA;AACA;AACY,MA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GAAG,GAAG,CAAC,mBAAkB;AAC5C,MAAC,YAAY,GAAG,GAAG,CAAC,aAAY;AAChC,MAAC,aAAa,GAAG,GAAG,CAAC,cAAa;AAClC,MAAC,kBAAkB,GAAG,GAAG,CAAC,mBAAkB;AAC5C,MAAC,sBAAsB,GAAG,GAAG,CAAC,uBAAsB;AAChE;AACA;AACA;AACA;AACY,MAAC,KAAK,GAAGF,cAAS,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,KAAK,aAAa,EAAC;AACnE;AACA;AACA;AACA;AACA;AACY,MAAC,aAAa,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC,QAAQ,KAAK,KAAI;AACnE;AACA;AACA;AACA;AACA;AACY,MAAC,UAAU,GAAG,CAAC,MAAM,EAAE,KAAK,KAAK;AAC7C,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC,WAAU;AAC1B,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,MAAM,EAAE;AAC5B,IAAI,CAAC,GAAG,CAAC,CAAC,WAAU;AACpB,GAAG;AACH,EAAE,OAAO,CAAC,KAAK,MAAM;AACrB,EAAC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/dom.cjs b/yjs-poll/node_modules/lib0/dist/dom.cjs deleted file mode 100644 index ad46360..0000000 --- a/yjs-poll/node_modules/lib0/dist/dom.cjs +++ /dev/null @@ -1,71 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./pair-ab022bc3.cjs'); -require('./map-24d263c0.cjs'); -require('./schema.cjs'); -var dom = require('./dom-7e625b09.cjs'); -require('./object-c0c9435b.cjs'); -require('./equality.cjs'); -require('./array-78849c95.cjs'); -require('./set-5b47859e.cjs'); -require('./error-0c1f634f.cjs'); -require('./environment-1c97264d.cjs'); -require('./string-fddc5f8b.cjs'); -require('./conditions-f5c0c102.cjs'); -require('./storage.cjs'); -require('./function-314580f7.cjs'); -require('./prng-37d48618.cjs'); -require('./binary-ac8e39e2.cjs'); -require('./math-96d5e8c4.cjs'); -require('./buffer-3e750729.cjs'); -require('./encoding-1a745c43.cjs'); -require('./number-1fb57bba.cjs'); -require('./decoding-76e75827.cjs'); - - - -exports.$element = dom.$element; -exports.$fragment = dom.$fragment; -exports.$node = dom.$node; -exports.$text = dom.$text; -exports.CDATA_SECTION_NODE = dom.CDATA_SECTION_NODE; -exports.COMMENT_NODE = dom.COMMENT_NODE; -exports.DOCUMENT_FRAGMENT_NODE = dom.DOCUMENT_FRAGMENT_NODE; -exports.DOCUMENT_NODE = dom.DOCUMENT_NODE; -exports.DOCUMENT_TYPE_NODE = dom.DOCUMENT_TYPE_NODE; -exports.ELEMENT_NODE = dom.ELEMENT_NODE; -exports.TEXT_NODE = dom.TEXT_NODE; -exports.addEventListener = dom.addEventListener; -exports.addEventListeners = dom.addEventListeners; -exports.append = dom.append; -exports.appendChild = dom.appendChild; -exports.canvas = dom.canvas; -exports.checkNodeType = dom.checkNodeType; -exports.createDocumentFragment = dom.createDocumentFragment; -exports.createElement = dom.createElement; -exports.createTextNode = dom.createTextNode; -exports.doc = dom.doc; -exports.domParser = dom.domParser; -exports.element = dom.element; -exports.emitCustomEvent = dom.emitCustomEvent; -exports.fragment = dom.fragment; -exports.getElementById = dom.getElementById; -exports.insertBefore = dom.insertBefore; -exports.isParentOf = dom.isParentOf; -exports.mapToStyleString = dom.mapToStyleString; -exports.pairToStyleString = dom.pairToStyleString; -exports.pairsToStyleString = dom.pairsToStyleString; -exports.parseElement = dom.parseElement; -exports.parseFragment = dom.parseFragment; -exports.querySelector = dom.querySelector; -exports.querySelectorAll = dom.querySelectorAll; -exports.remove = dom.remove; -exports.removeEventListener = dom.removeEventListener; -exports.removeEventListeners = dom.removeEventListeners; -exports.replaceWith = dom.replaceWith; -exports.setAttributes = dom.setAttributes; -exports.setAttributesMap = dom.setAttributesMap; -exports.text = dom.text; -//# sourceMappingURL=dom.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/dom.cjs.map b/yjs-poll/node_modules/lib0/dist/dom.cjs.map deleted file mode 100644 index 36267b1..0000000 --- a/yjs-poll/node_modules/lib0/dist/dom.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dom.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/dom.d.ts b/yjs-poll/node_modules/lib0/dist/dom.d.ts deleted file mode 100644 index e71a664..0000000 --- a/yjs-poll/node_modules/lib0/dist/dom.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @type {Document} - */ -export const doc: Document; -export function createElement(name: string): HTMLElement; -export function createDocumentFragment(): DocumentFragment; -/** - * @type {$.Schema} - */ -export const $fragment: $.Schema; -export function createTextNode(text: string): Text; -export const domParser: DOMParser; -export function emitCustomEvent(el: HTMLElement, name: string, opts: Object): boolean; -export function setAttributes(el: Element, attrs: Array>): Element; -export function setAttributesMap(el: Element, attrs: Map): Element; -export function fragment(children: Array | HTMLCollection): DocumentFragment; -export function append(parent: Element, nodes: Array): Element; -export function remove(el: HTMLElement): void; -export function addEventListener(el: EventTarget, name: string, f: EventListener): void; -export function removeEventListener(el: EventTarget, name: string, f: EventListener): void; -export function addEventListeners(node: Node, listeners: Array>): Node; -export function removeEventListeners(node: Node, listeners: Array>): Node; -export function element(name: string, attrs?: Array | pair.Pair>, children?: Array): Element; -/** - * @type {$.Schema} - */ -export const $element: $.Schema; -export function canvas(width: number, height: number): HTMLCanvasElement; -export function text(text: string): Text; -/** - * @type {$.Schema} - */ -export const $text: $.Schema; -export function pairToStyleString(pair: pair.Pair): string; -export function pairsToStyleString(pairs: Array>): string; -export function mapToStyleString(m: Map): string; -export function querySelector(el: HTMLElement | ShadowRoot, query: string): HTMLElement | null; -export function querySelectorAll(el: HTMLElement | ShadowRoot, query: string): NodeListOf; -export function getElementById(id: string): HTMLElement; -export function parseFragment(html: string): DocumentFragment; -export function parseElement(html: string): HTMLElement; -export function replaceWith(oldEl: HTMLElement, newEl: HTMLElement | DocumentFragment): void; -export function insertBefore(parent: HTMLElement, el: HTMLElement, ref: Node | null): HTMLElement; -export function appendChild(parent: Node, child: Node): Node; -export const ELEMENT_NODE: 1; -export const TEXT_NODE: 3; -export const CDATA_SECTION_NODE: 4; -export const COMMENT_NODE: 8; -export const DOCUMENT_NODE: 9; -export const DOCUMENT_TYPE_NODE: 10; -export const DOCUMENT_FRAGMENT_NODE: 11; -/** - * @type {$.Schema} - */ -export const $node: $.Schema; -export function checkNodeType(node: any, type: number): boolean; -export function isParentOf(parent: Node, child: HTMLElement): boolean; -import * as $ from './schema.js'; -import * as pair from './pair.js'; -//# sourceMappingURL=dom.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/dom.d.ts.map b/yjs-poll/node_modules/lib0/dist/dom.d.ts.map deleted file mode 100644 index e5532cd..0000000 --- a/yjs-poll/node_modules/lib0/dist/dom.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../dom.js"],"names":[],"mappings":"AAaA;;GAEG;AACH,kBAFU,QAAQ,CAE0E;AAMrF,oCAHI,MAAM,GACL,WAAW,CAEqC;AAKrD,0CAFK,gBAAgB,CAE4C;AAExE;;GAEG;AACH,wBAFU,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAE4C;AAMzE,qCAHI,MAAM,GACL,IAAI,CAE8C;AAE9D,wBAAoC,SAAS,CAAgE;AAOtG,oCAJI,WAAW,QACX,MAAM,QACN,MAAM,WAE+E;AAOzF,kCAJI,OAAO,SACP,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAC,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AAM,CAAC,GACjB,MAAM,CAE0E;AASrF,kCAJI,WAAW,GAAC,UAAU,SACtB,MAAM,GACL,WAAW,GAAG,IAAI,CAEqC;AAO5D,qCAJI,WAAW,GAAC,UAAU,SACtB,MAAM,GACL,UAAU,CAAC,WAAW,CAAC,CAEsC;AAMlE,mCAHI,MAAM,GACL,WAAW,CAEgE;AAYhF,oCAHI,MAAM,GACL,gBAAgB,CAE+D;AAMpF,mCAHI,MAAM,GACL,WAAW,CAEsE;AAMtF,mCAHI,WAAW,SACX,WAAW,GAAC,gBAAgB,QAE8B;AAQ9D,qCALI,WAAW,MACX,WAAW,OACX,IAAI,GAAC,IAAI,GACR,WAAW,CAEsD;AAOtE,oCAJI,IAAI,SACJ,IAAI,GACH,IAAI,CAEuD;AAEvE,6BAA4C;AAC5C,0BAAsC;AACtC,mCAAwD;AACxD,6BAA4C;AAC5C,8BAA8C;AAC9C,oCAAwD;AACxD,wCAAgE;AAEhE;;GAEG;AACH,oBAFU,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAE2C;AAM5D,oCAHI,GAAG,QACH,MAAM,WAEkD;AAM5D,mCAHI,IAAI,SACJ,WAAW,WAQrB;mBAhRkB,aAAa;sBAFV,WAAW"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/ecdsa.cjs b/yjs-poll/node_modules/lib0/dist/ecdsa.cjs deleted file mode 100644 index d5b528e..0000000 --- a/yjs-poll/node_modules/lib0/dist/ecdsa.cjs +++ /dev/null @@ -1,130 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var webcrypto = require('lib0/webcrypto'); -var common = require('./common.cjs'); - -function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n["default"] = e; - return Object.freeze(n); -} - -var webcrypto__namespace = /*#__PURE__*/_interopNamespace(webcrypto); - -/** - * ECDSA is an asymmetric key for signing - */ - -/** - * @typedef {Array<'sign'|'verify'>} Usages - */ - -/** - * @type {Usages} - */ -const defaultUsages = ['sign', 'verify']; - -const defaultSignAlgorithm = { - name: 'ECDSA', - hash: 'SHA-384' -}; - -/** - * @experimental The API is not final! - * - * Sign a message - * - * @param {CryptoKey} key - * @param {Uint8Array} data - * @return {PromiseLike>} signature - */ -const sign = (key, data) => - webcrypto__namespace.subtle.sign( - defaultSignAlgorithm, - key, - data - ).then(signature => new Uint8Array(signature)); - -/** - * @experimental The API is not final! - * - * Sign a message - * - * @param {CryptoKey} key - * @param {Uint8Array} signature - * @param {Uint8Array} data - * @return {PromiseLike} signature - */ -const verify = (key, signature, data) => - webcrypto__namespace.subtle.verify( - defaultSignAlgorithm, - key, - signature, - data - ); - -const defaultKeyAlgorithm = { - name: 'ECDSA', - namedCurve: 'P-384' -}; - -/* c8 ignore next */ -/** - * @param {Object} opts - * @param {boolean} [opts.extractable] - * @param {Usages} [opts.usages] - */ -const generateKeyPair = ({ extractable = false, usages = defaultUsages } = {}) => - webcrypto__namespace.subtle.generateKey( - defaultKeyAlgorithm, - extractable, - usages - ); - -/** - * @param {any} jwk - * @param {Object} opts - * @param {boolean} [opts.extractable] - * @param {Usages} [opts.usages] - */ -const importKeyJwk = (jwk, { extractable = false, usages } = {}) => { - if (usages == null) { - /* c8 ignore next 2 */ - usages = jwk.key_ops || defaultUsages; - } - return webcrypto__namespace.subtle.importKey('jwk', jwk, defaultKeyAlgorithm, extractable, /** @type {Usages} */ (usages)) -}; - -/** - * Only suited for importing public keys. - * - * @param {any} raw - * @param {Object} opts - * @param {boolean} [opts.extractable] - * @param {Usages} [opts.usages] - */ -const importKeyRaw = (raw, { extractable = false, usages = defaultUsages } = {}) => - webcrypto__namespace.subtle.importKey('raw', raw, defaultKeyAlgorithm, extractable, usages); - -exports.exportKeyJwk = common.exportKeyJwk; -exports.exportKeyRaw = common.exportKeyRaw; -exports.generateKeyPair = generateKeyPair; -exports.importKeyJwk = importKeyJwk; -exports.importKeyRaw = importKeyRaw; -exports.sign = sign; -exports.verify = verify; -//# sourceMappingURL=ecdsa.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/ecdsa.cjs.map b/yjs-poll/node_modules/lib0/dist/ecdsa.cjs.map deleted file mode 100644 index 1cda5d4..0000000 --- a/yjs-poll/node_modules/lib0/dist/ecdsa.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ecdsa.cjs","sources":["../crypto/ecdsa.js"],"sourcesContent":["/**\n * ECDSA is an asymmetric key for signing\n */\n\nimport * as webcrypto from 'lib0/webcrypto'\nexport { exportKeyJwk, exportKeyRaw } from './common.js'\n\n/**\n * @typedef {Array<'sign'|'verify'>} Usages\n */\n\n/**\n * @type {Usages}\n */\nconst defaultUsages = ['sign', 'verify']\n\nconst defaultSignAlgorithm = {\n name: 'ECDSA',\n hash: 'SHA-384'\n}\n\n/**\n * @experimental The API is not final!\n *\n * Sign a message\n *\n * @param {CryptoKey} key\n * @param {Uint8Array} data\n * @return {PromiseLike>} signature\n */\nexport const sign = (key, data) =>\n webcrypto.subtle.sign(\n defaultSignAlgorithm,\n key,\n data\n ).then(signature => new Uint8Array(signature))\n\n/**\n * @experimental The API is not final!\n *\n * Sign a message\n *\n * @param {CryptoKey} key\n * @param {Uint8Array} signature\n * @param {Uint8Array} data\n * @return {PromiseLike} signature\n */\nexport const verify = (key, signature, data) =>\n webcrypto.subtle.verify(\n defaultSignAlgorithm,\n key,\n signature,\n data\n )\n\nconst defaultKeyAlgorithm = {\n name: 'ECDSA',\n namedCurve: 'P-384'\n}\n\n/* c8 ignore next */\n/**\n * @param {Object} opts\n * @param {boolean} [opts.extractable]\n * @param {Usages} [opts.usages]\n */\nexport const generateKeyPair = ({ extractable = false, usages = defaultUsages } = {}) =>\n webcrypto.subtle.generateKey(\n defaultKeyAlgorithm,\n extractable,\n usages\n )\n\n/**\n * @param {any} jwk\n * @param {Object} opts\n * @param {boolean} [opts.extractable]\n * @param {Usages} [opts.usages]\n */\nexport const importKeyJwk = (jwk, { extractable = false, usages } = {}) => {\n if (usages == null) {\n /* c8 ignore next 2 */\n usages = jwk.key_ops || defaultUsages\n }\n return webcrypto.subtle.importKey('jwk', jwk, defaultKeyAlgorithm, extractable, /** @type {Usages} */ (usages))\n}\n\n/**\n * Only suited for importing public keys.\n *\n * @param {any} raw\n * @param {Object} opts\n * @param {boolean} [opts.extractable]\n * @param {Usages} [opts.usages]\n */\nexport const importKeyRaw = (raw, { extractable = false, usages = defaultUsages } = {}) =>\n webcrypto.subtle.importKey('raw', raw, defaultKeyAlgorithm, extractable, usages)\n"],"names":["webcrypto"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAC;AACxC;AACA,MAAM,oBAAoB,GAAG;AAC7B,EAAE,IAAI,EAAE,OAAO;AACf,EAAE,IAAI,EAAE,SAAS;AACjB,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,IAAI,GAAG,CAAC,GAAG,EAAE,IAAI;AAC9B,EAAEA,oBAAS,CAAC,MAAM,CAAC,IAAI;AACvB,IAAI,oBAAoB;AACxB,IAAI,GAAG;AACP,IAAI,IAAI;AACR,GAAG,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,UAAU,CAAC,SAAS,CAAC,EAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI;AAC3C,EAAEA,oBAAS,CAAC,MAAM,CAAC,MAAM;AACzB,IAAI,oBAAoB;AACxB,IAAI,GAAG;AACP,IAAI,SAAS;AACb,IAAI,IAAI;AACR,IAAG;AACH;AACA,MAAM,mBAAmB,GAAG;AAC5B,EAAE,IAAI,EAAE,OAAO;AACf,EAAE,UAAU,EAAE,OAAO;AACrB,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,eAAe,GAAG,CAAC,EAAE,WAAW,GAAG,KAAK,EAAE,MAAM,GAAG,aAAa,EAAE,GAAG,EAAE;AACpF,EAAEA,oBAAS,CAAC,MAAM,CAAC,WAAW;AAC9B,IAAI,mBAAmB;AACvB,IAAI,WAAW;AACf,IAAI,MAAM;AACV,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,YAAY,GAAG,CAAC,GAAG,EAAE,EAAE,WAAW,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK;AAC3E,EAAE,IAAI,MAAM,IAAI,IAAI,EAAE;AACtB;AACA,IAAI,MAAM,GAAG,GAAG,CAAC,OAAO,IAAI,cAAa;AACzC,GAAG;AACH,EAAE,OAAOA,oBAAS,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,mBAAmB,EAAE,WAAW,yBAAyB,MAAM,EAAE;AACjH,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,YAAY,GAAG,CAAC,GAAG,EAAE,EAAE,WAAW,GAAG,KAAK,EAAE,MAAM,GAAG,aAAa,EAAE,GAAG,EAAE;AACtF,EAAEA,oBAAS,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/encoding-1a745c43.cjs b/yjs-poll/node_modules/lib0/dist/encoding-1a745c43.cjs deleted file mode 100644 index 705a008..0000000 --- a/yjs-poll/node_modules/lib0/dist/encoding-1a745c43.cjs +++ /dev/null @@ -1,1025 +0,0 @@ -'use strict'; - -var math = require('./math-96d5e8c4.cjs'); -var number = require('./number-1fb57bba.cjs'); -var binary = require('./binary-ac8e39e2.cjs'); -var string = require('./string-fddc5f8b.cjs'); -var array = require('./array-78849c95.cjs'); - -/** - * Efficient schema-less binary encoding with support for variable length encoding. - * - * Use [lib0/encoding] with [lib0/decoding]. Every encoding function has a corresponding decoding function. - * - * Encodes numbers in little-endian order (least to most significant byte order) - * and is compatible with Golang's binary encoding (https://golang.org/pkg/encoding/binary/) - * which is also used in Protocol Buffers. - * - * ```js - * // encoding step - * const encoder = encoding.createEncoder() - * encoding.writeVarUint(encoder, 256) - * encoding.writeVarString(encoder, 'Hello world!') - * const buf = encoding.toUint8Array(encoder) - * ``` - * - * ```js - * // decoding step - * const decoder = decoding.createDecoder(buf) - * decoding.readVarUint(decoder) // => 256 - * decoding.readVarString(decoder) // => 'Hello world!' - * decoding.hasContent(decoder) // => false - all data is read - * ``` - * - * @module encoding - */ - -/** - * A BinaryEncoder handles the encoding to an Uint8Array. - */ -class Encoder { - constructor () { - this.cpos = 0; - this.cbuf = new Uint8Array(100); - /** - * @type {Array} - */ - this.bufs = []; - } -} - -/** - * @function - * @return {Encoder} - */ -const createEncoder = () => new Encoder(); - -/** - * @param {function(Encoder):void} f - */ -const encode = (f) => { - const encoder = createEncoder(); - f(encoder); - return toUint8Array(encoder) -}; - -/** - * The current length of the encoded data. - * - * @function - * @param {Encoder} encoder - * @return {number} - */ -const length = encoder => { - let len = encoder.cpos; - for (let i = 0; i < encoder.bufs.length; i++) { - len += encoder.bufs[i].length; - } - return len -}; - -/** - * Check whether encoder is empty. - * - * @function - * @param {Encoder} encoder - * @return {boolean} - */ -const hasContent = encoder => encoder.cpos > 0 || encoder.bufs.length > 0; - -/** - * Transform to Uint8Array. - * - * @function - * @param {Encoder} encoder - * @return {Uint8Array} The created ArrayBuffer. - */ -const toUint8Array = encoder => { - const uint8arr = new Uint8Array(length(encoder)); - let curPos = 0; - for (let i = 0; i < encoder.bufs.length; i++) { - const d = encoder.bufs[i]; - uint8arr.set(d, curPos); - curPos += d.length; - } - uint8arr.set(new Uint8Array(encoder.cbuf.buffer, 0, encoder.cpos), curPos); - return uint8arr -}; - -/** - * Verify that it is possible to write `len` bytes wtihout checking. If - * necessary, a new Buffer with the required length is attached. - * - * @param {Encoder} encoder - * @param {number} len - */ -const verifyLen = (encoder, len) => { - const bufferLen = encoder.cbuf.length; - if (bufferLen - encoder.cpos < len) { - encoder.bufs.push(new Uint8Array(encoder.cbuf.buffer, 0, encoder.cpos)); - encoder.cbuf = new Uint8Array(math.max(bufferLen, len) * 2); - encoder.cpos = 0; - } -}; - -/** - * Write one byte to the encoder. - * - * @function - * @param {Encoder} encoder - * @param {number} num The byte that is to be encoded. - */ -const write = (encoder, num) => { - const bufferLen = encoder.cbuf.length; - if (encoder.cpos === bufferLen) { - encoder.bufs.push(encoder.cbuf); - encoder.cbuf = new Uint8Array(bufferLen * 2); - encoder.cpos = 0; - } - encoder.cbuf[encoder.cpos++] = num; -}; - -/** - * Write one byte at a specific position. - * Position must already be written (i.e. encoder.length > pos) - * - * @function - * @param {Encoder} encoder - * @param {number} pos Position to which to write data - * @param {number} num Unsigned 8-bit integer - */ -const set = (encoder, pos, num) => { - let buffer = null; - // iterate all buffers and adjust position - for (let i = 0; i < encoder.bufs.length && buffer === null; i++) { - const b = encoder.bufs[i]; - if (pos < b.length) { - buffer = b; // found buffer - } else { - pos -= b.length; - } - } - if (buffer === null) { - // use current buffer - buffer = encoder.cbuf; - } - buffer[pos] = num; -}; - -/** - * Write one byte as an unsigned integer. - * - * @function - * @param {Encoder} encoder - * @param {number} num The number that is to be encoded. - */ -const writeUint8 = write; - -/** - * Write one byte as an unsigned Integer at a specific location. - * - * @function - * @param {Encoder} encoder - * @param {number} pos The location where the data will be written. - * @param {number} num The number that is to be encoded. - */ -const setUint8 = set; - -/** - * Write two bytes as an unsigned integer. - * - * @function - * @param {Encoder} encoder - * @param {number} num The number that is to be encoded. - */ -const writeUint16 = (encoder, num) => { - write(encoder, num & binary.BITS8); - write(encoder, (num >>> 8) & binary.BITS8); -}; -/** - * Write two bytes as an unsigned integer at a specific location. - * - * @function - * @param {Encoder} encoder - * @param {number} pos The location where the data will be written. - * @param {number} num The number that is to be encoded. - */ -const setUint16 = (encoder, pos, num) => { - set(encoder, pos, num & binary.BITS8); - set(encoder, pos + 1, (num >>> 8) & binary.BITS8); -}; - -/** - * Write two bytes as an unsigned integer - * - * @function - * @param {Encoder} encoder - * @param {number} num The number that is to be encoded. - */ -const writeUint32 = (encoder, num) => { - for (let i = 0; i < 4; i++) { - write(encoder, num & binary.BITS8); - num >>>= 8; - } -}; - -/** - * Write two bytes as an unsigned integer in big endian order. - * (most significant byte first) - * - * @function - * @param {Encoder} encoder - * @param {number} num The number that is to be encoded. - */ -const writeUint32BigEndian = (encoder, num) => { - for (let i = 3; i >= 0; i--) { - write(encoder, (num >>> (8 * i)) & binary.BITS8); - } -}; - -/** - * Write two bytes as an unsigned integer at a specific location. - * - * @function - * @param {Encoder} encoder - * @param {number} pos The location where the data will be written. - * @param {number} num The number that is to be encoded. - */ -const setUint32 = (encoder, pos, num) => { - for (let i = 0; i < 4; i++) { - set(encoder, pos + i, num & binary.BITS8); - num >>>= 8; - } -}; - -/** - * Write a variable length unsigned integer. Max encodable integer is 2^53. - * - * @function - * @param {Encoder} encoder - * @param {number} num The number that is to be encoded. - */ -const writeVarUint = (encoder, num) => { - while (num > binary.BITS7) { - write(encoder, binary.BIT8 | (binary.BITS7 & num)); - num = math.floor(num / 128); // shift >>> 7 - } - write(encoder, binary.BITS7 & num); -}; - -/** - * Write a variable length integer. - * - * We use the 7th bit instead for signaling that this is a negative number. - * - * @function - * @param {Encoder} encoder - * @param {number} num The number that is to be encoded. - */ -const writeVarInt = (encoder, num) => { - const isNegative = math.isNegativeZero(num); - if (isNegative) { - num = -num; - } - // |- whether to continue reading |- whether is negative |- number - write(encoder, (num > binary.BITS6 ? binary.BIT8 : 0) | (isNegative ? binary.BIT7 : 0) | (binary.BITS6 & num)); - num = math.floor(num / 64); // shift >>> 6 - // We don't need to consider the case of num === 0 so we can use a different - // pattern here than above. - while (num > 0) { - write(encoder, (num > binary.BITS7 ? binary.BIT8 : 0) | (binary.BITS7 & num)); - num = math.floor(num / 128); // shift >>> 7 - } -}; - -/** - * A cache to store strings temporarily - */ -const _strBuffer = new Uint8Array(30000); -const _maxStrBSize = _strBuffer.length / 3; - -/** - * Write a variable length string. - * - * @function - * @param {Encoder} encoder - * @param {String} str The string that is to be encoded. - */ -const _writeVarStringNative = (encoder, str) => { - if (str.length < _maxStrBSize) { - // We can encode the string into the existing buffer - /* c8 ignore next */ - const written = string.utf8TextEncoder.encodeInto(str, _strBuffer).written || 0; - writeVarUint(encoder, written); - for (let i = 0; i < written; i++) { - write(encoder, _strBuffer[i]); - } - } else { - writeVarUint8Array(encoder, string.encodeUtf8(str)); - } -}; - -/** - * Write a variable length string. - * - * @function - * @param {Encoder} encoder - * @param {String} str The string that is to be encoded. - */ -const _writeVarStringPolyfill = (encoder, str) => { - const encodedString = unescape(encodeURIComponent(str)); - const len = encodedString.length; - writeVarUint(encoder, len); - for (let i = 0; i < len; i++) { - write(encoder, /** @type {number} */ (encodedString.codePointAt(i))); - } -}; - -/** - * Write a variable length string. - * - * @function - * @param {Encoder} encoder - * @param {String} str The string that is to be encoded. - */ -/* c8 ignore next */ -const writeVarString = (string.utf8TextEncoder && /** @type {any} */ (string.utf8TextEncoder).encodeInto) ? _writeVarStringNative : _writeVarStringPolyfill; - -/** - * Write a string terminated by a special byte sequence. This is not very performant and is - * generally discouraged. However, the resulting byte arrays are lexiographically ordered which - * makes this a nice feature for databases. - * - * The string will be encoded using utf8 and then terminated and escaped using writeTerminatingUint8Array. - * - * @function - * @param {Encoder} encoder - * @param {String} str The string that is to be encoded. - */ -const writeTerminatedString = (encoder, str) => - writeTerminatedUint8Array(encoder, string.encodeUtf8(str)); - -/** - * Write a terminating Uint8Array. Note that this is not performant and is generally - * discouraged. There are few situations when this is needed. - * - * We use 0x0 as a terminating character. 0x1 serves as an escape character for 0x0 and 0x1. - * - * Example: [0,1,2] is encoded to [1,0,1,1,2,0]. 0x0, and 0x1 needed to be escaped using 0x1. Then - * the result is terminated using the 0x0 character. - * - * This is basically how many systems implement null terminated strings. However, we use an escape - * character 0x1 to avoid issues and potenial attacks on our database (if this is used as a key - * encoder for NoSql databases). - * - * @function - * @param {Encoder} encoder - * @param {Uint8Array} buf The string that is to be encoded. - */ -const writeTerminatedUint8Array = (encoder, buf) => { - for (let i = 0; i < buf.length; i++) { - const b = buf[i]; - if (b === 0 || b === 1) { - write(encoder, 1); - } - write(encoder, buf[i]); - } - write(encoder, 0); -}; - -/** - * Write the content of another Encoder. - * - * @TODO: can be improved! - * - Note: Should consider that when appending a lot of small Encoders, we should rather clone than referencing the old structure. - * Encoders start with a rather big initial buffer. - * - * @function - * @param {Encoder} encoder The enUint8Arr - * @param {Encoder} append The BinaryEncoder to be written. - */ -const writeBinaryEncoder = (encoder, append) => writeUint8Array(encoder, toUint8Array(append)); - -/** - * Append fixed-length Uint8Array to the encoder. - * - * @function - * @param {Encoder} encoder - * @param {Uint8Array} uint8Array - */ -const writeUint8Array = (encoder, uint8Array) => { - const bufferLen = encoder.cbuf.length; - const cpos = encoder.cpos; - const leftCopyLen = math.min(bufferLen - cpos, uint8Array.length); - const rightCopyLen = uint8Array.length - leftCopyLen; - encoder.cbuf.set(uint8Array.subarray(0, leftCopyLen), cpos); - encoder.cpos += leftCopyLen; - if (rightCopyLen > 0) { - // Still something to write, write right half.. - // Append new buffer - encoder.bufs.push(encoder.cbuf); - // must have at least size of remaining buffer - encoder.cbuf = new Uint8Array(math.max(bufferLen * 2, rightCopyLen)); - // copy array - encoder.cbuf.set(uint8Array.subarray(leftCopyLen)); - encoder.cpos = rightCopyLen; - } -}; - -/** - * Append an Uint8Array to Encoder. - * - * @function - * @param {Encoder} encoder - * @param {Uint8Array} uint8Array - */ -const writeVarUint8Array = (encoder, uint8Array) => { - writeVarUint(encoder, uint8Array.byteLength); - writeUint8Array(encoder, uint8Array); -}; - -/** - * Create an DataView of the next `len` bytes. Use it to write data after - * calling this function. - * - * ```js - * // write float32 using DataView - * const dv = writeOnDataView(encoder, 4) - * dv.setFloat32(0, 1.1) - * // read float32 using DataView - * const dv = readFromDataView(encoder, 4) - * dv.getFloat32(0) // => 1.100000023841858 (leaving it to the reader to find out why this is the correct result) - * ``` - * - * @param {Encoder} encoder - * @param {number} len - * @return {DataView} - */ -const writeOnDataView = (encoder, len) => { - verifyLen(encoder, len); - const dview = new DataView(encoder.cbuf.buffer, encoder.cpos, len); - encoder.cpos += len; - return dview -}; - -/** - * @param {Encoder} encoder - * @param {number} num - */ -const writeFloat32 = (encoder, num) => writeOnDataView(encoder, 4).setFloat32(0, num, false); - -/** - * @param {Encoder} encoder - * @param {number} num - */ -const writeFloat64 = (encoder, num) => writeOnDataView(encoder, 8).setFloat64(0, num, false); - -/** - * @param {Encoder} encoder - * @param {bigint} num - */ -const writeBigInt64 = (encoder, num) => /** @type {any} */ (writeOnDataView(encoder, 8)).setBigInt64(0, num, false); - -/** - * @param {Encoder} encoder - * @param {bigint} num - */ -const writeBigUint64 = (encoder, num) => /** @type {any} */ (writeOnDataView(encoder, 8)).setBigUint64(0, num, false); - -const floatTestBed = new DataView(new ArrayBuffer(4)); -/** - * Check if a number can be encoded as a 32 bit float. - * - * @param {number} num - * @return {boolean} - */ -const isFloat32 = num => { - floatTestBed.setFloat32(0, num); - return floatTestBed.getFloat32(0) === num -}; - -/** - * @typedef {Array} AnyEncodableArray - */ - -/** - * @typedef {undefined|null|number|bigint|boolean|string|{[k:string]:AnyEncodable}|AnyEncodableArray|Uint8Array} AnyEncodable - */ - -/** - * Encode data with efficient binary format. - * - * Differences to JSON: - * • Transforms data to a binary format (not to a string) - * • Encodes undefined, NaN, and ArrayBuffer (these can't be represented in JSON) - * • Numbers are efficiently encoded either as a variable length integer, as a - * 32 bit float, as a 64 bit float, or as a 64 bit bigint. - * - * Encoding table: - * - * | Data Type | Prefix | Encoding Method | Comment | - * | ------------------- | -------- | ------------------ | ------- | - * | undefined | 127 | | Functions, symbol, and everything that cannot be identified is encoded as undefined | - * | null | 126 | | | - * | integer | 125 | writeVarInt | Only encodes 32 bit signed integers | - * | float32 | 124 | writeFloat32 | | - * | float64 | 123 | writeFloat64 | | - * | bigint | 122 | writeBigInt64 | | - * | boolean (false) | 121 | | True and false are different data types so we save the following byte | - * | boolean (true) | 120 | | - 0b01111000 so the last bit determines whether true or false | - * | string | 119 | writeVarString | | - * | object | 118 | custom | Writes {length} then {length} key-value pairs | - * | array | 117 | custom | Writes {length} then {length} json values | - * | Uint8Array | 116 | writeVarUint8Array | We use Uint8Array for any kind of binary data | - * - * Reasons for the decreasing prefix: - * We need the first bit for extendability (later we may want to encode the - * prefix with writeVarUint). The remaining 7 bits are divided as follows: - * [0-30] the beginning of the data range is used for custom purposes - * (defined by the function that uses this library) - * [31-127] the end of the data range is used for data encoding by - * lib0/encoding.js - * - * @param {Encoder} encoder - * @param {AnyEncodable} data - */ -const writeAny = (encoder, data) => { - switch (typeof data) { - case 'string': - // TYPE 119: STRING - write(encoder, 119); - writeVarString(encoder, data); - break - case 'number': - if (number.isInteger(data) && math.abs(data) <= binary.BITS31) { - // TYPE 125: INTEGER - write(encoder, 125); - writeVarInt(encoder, data); - } else if (isFloat32(data)) { - // TYPE 124: FLOAT32 - write(encoder, 124); - writeFloat32(encoder, data); - } else { - // TYPE 123: FLOAT64 - write(encoder, 123); - writeFloat64(encoder, data); - } - break - case 'bigint': - // TYPE 122: BigInt - write(encoder, 122); - writeBigInt64(encoder, data); - break - case 'object': - if (data === null) { - // TYPE 126: null - write(encoder, 126); - } else if (array.isArray(data)) { - // TYPE 117: Array - write(encoder, 117); - writeVarUint(encoder, data.length); - for (let i = 0; i < data.length; i++) { - writeAny(encoder, data[i]); - } - } else if (data instanceof Uint8Array) { - // TYPE 116: ArrayBuffer - write(encoder, 116); - writeVarUint8Array(encoder, data); - } else { - // TYPE 118: Object - write(encoder, 118); - const keys = Object.keys(data); - writeVarUint(encoder, keys.length); - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; - writeVarString(encoder, key); - writeAny(encoder, data[key]); - } - } - break - case 'boolean': - // TYPE 120/121: boolean (true/false) - write(encoder, data ? 120 : 121); - break - default: - // TYPE 127: undefined - write(encoder, 127); - } -}; - -/** - * Now come a few stateful encoder that have their own classes. - */ - -/** - * Basic Run Length Encoder - a basic compression implementation. - * - * Encodes [1,1,1,7] to [1,3,7,1] (3 times 1, 1 time 7). This encoder might do more harm than good if there are a lot of values that are not repeated. - * - * It was originally used for image compression. Cool .. article http://csbruce.com/cbm/transactor/pdfs/trans_v7_i06.pdf - * - * @note T must not be null! - * - * @template T - */ -class RleEncoder extends Encoder { - /** - * @param {function(Encoder, T):void} writer - */ - constructor (writer) { - super(); - /** - * The writer - */ - this.w = writer; - /** - * Current state - * @type {T|null} - */ - this.s = null; - this.count = 0; - } - - /** - * @param {T} v - */ - write (v) { - if (this.s === v) { - this.count++; - } else { - if (this.count > 0) { - // flush counter, unless this is the first value (count = 0) - writeVarUint(this, this.count - 1); // since count is always > 0, we can decrement by one. non-standard encoding ftw - } - this.count = 1; - // write first value - this.w(this, v); - this.s = v; - } - } -} - -/** - * Basic diff decoder using variable length encoding. - * - * Encodes the values [3, 1100, 1101, 1050, 0] to [3, 1097, 1, -51, -1050] using writeVarInt. - */ -class IntDiffEncoder extends Encoder { - /** - * @param {number} start - */ - constructor (start) { - super(); - /** - * Current state - * @type {number} - */ - this.s = start; - } - - /** - * @param {number} v - */ - write (v) { - writeVarInt(this, v - this.s); - this.s = v; - } -} - -/** - * A combination of IntDiffEncoder and RleEncoder. - * - * Basically first writes the IntDiffEncoder and then counts duplicate diffs using RleEncoding. - * - * Encodes the values [1,1,1,2,3,4,5,6] as [1,1,0,2,1,5] (RLE([1,0,0,1,1,1,1,1]) ⇒ RleIntDiff[1,1,0,2,1,5]) - */ -class RleIntDiffEncoder extends Encoder { - /** - * @param {number} start - */ - constructor (start) { - super(); - /** - * Current state - * @type {number} - */ - this.s = start; - this.count = 0; - } - - /** - * @param {number} v - */ - write (v) { - if (this.s === v && this.count > 0) { - this.count++; - } else { - if (this.count > 0) { - // flush counter, unless this is the first value (count = 0) - writeVarUint(this, this.count - 1); // since count is always > 0, we can decrement by one. non-standard encoding ftw - } - this.count = 1; - // write first value - writeVarInt(this, v - this.s); - this.s = v; - } - } -} - -/** - * @param {UintOptRleEncoder} encoder - */ -const flushUintOptRleEncoder = encoder => { - if (encoder.count > 0) { - // flush counter, unless this is the first value (count = 0) - // case 1: just a single value. set sign to positive - // case 2: write several values. set sign to negative to indicate that there is a length coming - writeVarInt(encoder.encoder, encoder.count === 1 ? encoder.s : -encoder.s); - if (encoder.count > 1) { - writeVarUint(encoder.encoder, encoder.count - 2); // since count is always > 1, we can decrement by one. non-standard encoding ftw - } - } -}; - -/** - * Optimized Rle encoder that does not suffer from the mentioned problem of the basic Rle encoder. - * - * Internally uses VarInt encoder to write unsigned integers. If the input occurs multiple times, we write - * write it as a negative number. The UintOptRleDecoder then understands that it needs to read a count. - * - * Encodes [1,2,3,3,3] as [1,2,-3,3] (once 1, once 2, three times 3) - */ -class UintOptRleEncoder { - constructor () { - this.encoder = new Encoder(); - /** - * @type {number} - */ - this.s = 0; - this.count = 0; - } - - /** - * @param {number} v - */ - write (v) { - if (this.s === v) { - this.count++; - } else { - flushUintOptRleEncoder(this); - this.count = 1; - this.s = v; - } - } - - /** - * Flush the encoded state and transform this to a Uint8Array. - * - * Note that this should only be called once. - */ - toUint8Array () { - flushUintOptRleEncoder(this); - return toUint8Array(this.encoder) - } -} - -/** - * Increasing Uint Optimized RLE Encoder - * - * The RLE encoder counts the number of same occurences of the same value. - * The IncUintOptRle encoder counts if the value increases. - * I.e. 7, 8, 9, 10 will be encoded as [-7, 4]. 1, 3, 5 will be encoded - * as [1, 3, 5]. - */ -class IncUintOptRleEncoder { - constructor () { - this.encoder = new Encoder(); - /** - * @type {number} - */ - this.s = 0; - this.count = 0; - } - - /** - * @param {number} v - */ - write (v) { - if (this.s + this.count === v) { - this.count++; - } else { - flushUintOptRleEncoder(this); - this.count = 1; - this.s = v; - } - } - - /** - * Flush the encoded state and transform this to a Uint8Array. - * - * Note that this should only be called once. - */ - toUint8Array () { - flushUintOptRleEncoder(this); - return toUint8Array(this.encoder) - } -} - -/** - * @param {IntDiffOptRleEncoder} encoder - */ -const flushIntDiffOptRleEncoder = encoder => { - if (encoder.count > 0) { - // 31 bit making up the diff | wether to write the counter - // const encodedDiff = encoder.diff << 1 | (encoder.count === 1 ? 0 : 1) - const encodedDiff = encoder.diff * 2 + (encoder.count === 1 ? 0 : 1); - // flush counter, unless this is the first value (count = 0) - // case 1: just a single value. set first bit to positive - // case 2: write several values. set first bit to negative to indicate that there is a length coming - writeVarInt(encoder.encoder, encodedDiff); - if (encoder.count > 1) { - writeVarUint(encoder.encoder, encoder.count - 2); // since count is always > 1, we can decrement by one. non-standard encoding ftw - } - } -}; - -/** - * A combination of the IntDiffEncoder and the UintOptRleEncoder. - * - * The count approach is similar to the UintDiffOptRleEncoder, but instead of using the negative bitflag, it encodes - * in the LSB whether a count is to be read. Therefore this Encoder only supports 31 bit integers! - * - * Encodes [1, 2, 3, 2] as [3, 1, 6, -1] (more specifically [(1 << 1) | 1, (3 << 0) | 0, -1]) - * - * Internally uses variable length encoding. Contrary to normal UintVar encoding, the first byte contains: - * * 1 bit that denotes whether the next value is a count (LSB) - * * 1 bit that denotes whether this value is negative (MSB - 1) - * * 1 bit that denotes whether to continue reading the variable length integer (MSB) - * - * Therefore, only five bits remain to encode diff ranges. - * - * Use this Encoder only when appropriate. In most cases, this is probably a bad idea. - */ -class IntDiffOptRleEncoder { - constructor () { - this.encoder = new Encoder(); - /** - * @type {number} - */ - this.s = 0; - this.count = 0; - this.diff = 0; - } - - /** - * @param {number} v - */ - write (v) { - if (this.diff === v - this.s) { - this.s = v; - this.count++; - } else { - flushIntDiffOptRleEncoder(this); - this.count = 1; - this.diff = v - this.s; - this.s = v; - } - } - - /** - * Flush the encoded state and transform this to a Uint8Array. - * - * Note that this should only be called once. - */ - toUint8Array () { - flushIntDiffOptRleEncoder(this); - return toUint8Array(this.encoder) - } -} - -/** - * Optimized String Encoder. - * - * Encoding many small strings in a simple Encoder is not very efficient. The function call to decode a string takes some time and creates references that must be eventually deleted. - * In practice, when decoding several million small strings, the GC will kick in more and more often to collect orphaned string objects (or maybe there is another reason?). - * - * This string encoder solves the above problem. All strings are concatenated and written as a single string using a single encoding call. - * - * The lengths are encoded using a UintOptRleEncoder. - */ -class StringEncoder { - constructor () { - /** - * @type {Array} - */ - this.sarr = []; - this.s = ''; - this.lensE = new UintOptRleEncoder(); - } - - /** - * @param {string} string - */ - write (string) { - this.s += string; - if (this.s.length > 19) { - this.sarr.push(this.s); - this.s = ''; - } - this.lensE.write(string.length); - } - - toUint8Array () { - const encoder = new Encoder(); - this.sarr.push(this.s); - this.s = ''; - writeVarString(encoder, this.sarr.join('')); - writeUint8Array(encoder, this.lensE.toUint8Array()); - return toUint8Array(encoder) - } -} - -var encoding = /*#__PURE__*/Object.freeze({ - __proto__: null, - Encoder: Encoder, - createEncoder: createEncoder, - encode: encode, - length: length, - hasContent: hasContent, - toUint8Array: toUint8Array, - verifyLen: verifyLen, - write: write, - set: set, - writeUint8: writeUint8, - setUint8: setUint8, - writeUint16: writeUint16, - setUint16: setUint16, - writeUint32: writeUint32, - writeUint32BigEndian: writeUint32BigEndian, - setUint32: setUint32, - writeVarUint: writeVarUint, - writeVarInt: writeVarInt, - _writeVarStringNative: _writeVarStringNative, - _writeVarStringPolyfill: _writeVarStringPolyfill, - writeVarString: writeVarString, - writeTerminatedString: writeTerminatedString, - writeTerminatedUint8Array: writeTerminatedUint8Array, - writeBinaryEncoder: writeBinaryEncoder, - writeUint8Array: writeUint8Array, - writeVarUint8Array: writeVarUint8Array, - writeOnDataView: writeOnDataView, - writeFloat32: writeFloat32, - writeFloat64: writeFloat64, - writeBigInt64: writeBigInt64, - writeBigUint64: writeBigUint64, - writeAny: writeAny, - RleEncoder: RleEncoder, - IntDiffEncoder: IntDiffEncoder, - RleIntDiffEncoder: RleIntDiffEncoder, - UintOptRleEncoder: UintOptRleEncoder, - IncUintOptRleEncoder: IncUintOptRleEncoder, - IntDiffOptRleEncoder: IntDiffOptRleEncoder, - StringEncoder: StringEncoder -}); - -exports.Encoder = Encoder; -exports.IncUintOptRleEncoder = IncUintOptRleEncoder; -exports.IntDiffEncoder = IntDiffEncoder; -exports.IntDiffOptRleEncoder = IntDiffOptRleEncoder; -exports.RleEncoder = RleEncoder; -exports.RleIntDiffEncoder = RleIntDiffEncoder; -exports.StringEncoder = StringEncoder; -exports.UintOptRleEncoder = UintOptRleEncoder; -exports._writeVarStringNative = _writeVarStringNative; -exports._writeVarStringPolyfill = _writeVarStringPolyfill; -exports.createEncoder = createEncoder; -exports.encode = encode; -exports.encoding = encoding; -exports.hasContent = hasContent; -exports.length = length; -exports.set = set; -exports.setUint16 = setUint16; -exports.setUint32 = setUint32; -exports.setUint8 = setUint8; -exports.toUint8Array = toUint8Array; -exports.verifyLen = verifyLen; -exports.write = write; -exports.writeAny = writeAny; -exports.writeBigInt64 = writeBigInt64; -exports.writeBigUint64 = writeBigUint64; -exports.writeBinaryEncoder = writeBinaryEncoder; -exports.writeFloat32 = writeFloat32; -exports.writeFloat64 = writeFloat64; -exports.writeOnDataView = writeOnDataView; -exports.writeTerminatedString = writeTerminatedString; -exports.writeTerminatedUint8Array = writeTerminatedUint8Array; -exports.writeUint16 = writeUint16; -exports.writeUint32 = writeUint32; -exports.writeUint32BigEndian = writeUint32BigEndian; -exports.writeUint8 = writeUint8; -exports.writeUint8Array = writeUint8Array; -exports.writeVarInt = writeVarInt; -exports.writeVarString = writeVarString; -exports.writeVarUint = writeVarUint; -exports.writeVarUint8Array = writeVarUint8Array; -//# sourceMappingURL=encoding-1a745c43.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/encoding-1a745c43.cjs.map b/yjs-poll/node_modules/lib0/dist/encoding-1a745c43.cjs.map deleted file mode 100644 index d071bbb..0000000 --- a/yjs-poll/node_modules/lib0/dist/encoding-1a745c43.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"encoding-1a745c43.cjs","sources":["../encoding.js"],"sourcesContent":["/**\n * Efficient schema-less binary encoding with support for variable length encoding.\n *\n * Use [lib0/encoding] with [lib0/decoding]. Every encoding function has a corresponding decoding function.\n *\n * Encodes numbers in little-endian order (least to most significant byte order)\n * and is compatible with Golang's binary encoding (https://golang.org/pkg/encoding/binary/)\n * which is also used in Protocol Buffers.\n *\n * ```js\n * // encoding step\n * const encoder = encoding.createEncoder()\n * encoding.writeVarUint(encoder, 256)\n * encoding.writeVarString(encoder, 'Hello world!')\n * const buf = encoding.toUint8Array(encoder)\n * ```\n *\n * ```js\n * // decoding step\n * const decoder = decoding.createDecoder(buf)\n * decoding.readVarUint(decoder) // => 256\n * decoding.readVarString(decoder) // => 'Hello world!'\n * decoding.hasContent(decoder) // => false - all data is read\n * ```\n *\n * @module encoding\n */\n\nimport * as math from './math.js'\nimport * as number from './number.js'\nimport * as binary from './binary.js'\nimport * as string from './string.js'\nimport * as array from './array.js'\n\n/**\n * A BinaryEncoder handles the encoding to an Uint8Array.\n */\nexport class Encoder {\n constructor () {\n this.cpos = 0\n this.cbuf = new Uint8Array(100)\n /**\n * @type {Array}\n */\n this.bufs = []\n }\n}\n\n/**\n * @function\n * @return {Encoder}\n */\nexport const createEncoder = () => new Encoder()\n\n/**\n * @param {function(Encoder):void} f\n */\nexport const encode = (f) => {\n const encoder = createEncoder()\n f(encoder)\n return toUint8Array(encoder)\n}\n\n/**\n * The current length of the encoded data.\n *\n * @function\n * @param {Encoder} encoder\n * @return {number}\n */\nexport const length = encoder => {\n let len = encoder.cpos\n for (let i = 0; i < encoder.bufs.length; i++) {\n len += encoder.bufs[i].length\n }\n return len\n}\n\n/**\n * Check whether encoder is empty.\n *\n * @function\n * @param {Encoder} encoder\n * @return {boolean}\n */\nexport const hasContent = encoder => encoder.cpos > 0 || encoder.bufs.length > 0\n\n/**\n * Transform to Uint8Array.\n *\n * @function\n * @param {Encoder} encoder\n * @return {Uint8Array} The created ArrayBuffer.\n */\nexport const toUint8Array = encoder => {\n const uint8arr = new Uint8Array(length(encoder))\n let curPos = 0\n for (let i = 0; i < encoder.bufs.length; i++) {\n const d = encoder.bufs[i]\n uint8arr.set(d, curPos)\n curPos += d.length\n }\n uint8arr.set(new Uint8Array(encoder.cbuf.buffer, 0, encoder.cpos), curPos)\n return uint8arr\n}\n\n/**\n * Verify that it is possible to write `len` bytes wtihout checking. If\n * necessary, a new Buffer with the required length is attached.\n *\n * @param {Encoder} encoder\n * @param {number} len\n */\nexport const verifyLen = (encoder, len) => {\n const bufferLen = encoder.cbuf.length\n if (bufferLen - encoder.cpos < len) {\n encoder.bufs.push(new Uint8Array(encoder.cbuf.buffer, 0, encoder.cpos))\n encoder.cbuf = new Uint8Array(math.max(bufferLen, len) * 2)\n encoder.cpos = 0\n }\n}\n\n/**\n * Write one byte to the encoder.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The byte that is to be encoded.\n */\nexport const write = (encoder, num) => {\n const bufferLen = encoder.cbuf.length\n if (encoder.cpos === bufferLen) {\n encoder.bufs.push(encoder.cbuf)\n encoder.cbuf = new Uint8Array(bufferLen * 2)\n encoder.cpos = 0\n }\n encoder.cbuf[encoder.cpos++] = num\n}\n\n/**\n * Write one byte at a specific position.\n * Position must already be written (i.e. encoder.length > pos)\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} pos Position to which to write data\n * @param {number} num Unsigned 8-bit integer\n */\nexport const set = (encoder, pos, num) => {\n let buffer = null\n // iterate all buffers and adjust position\n for (let i = 0; i < encoder.bufs.length && buffer === null; i++) {\n const b = encoder.bufs[i]\n if (pos < b.length) {\n buffer = b // found buffer\n } else {\n pos -= b.length\n }\n }\n if (buffer === null) {\n // use current buffer\n buffer = encoder.cbuf\n }\n buffer[pos] = num\n}\n\n/**\n * Write one byte as an unsigned integer.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The number that is to be encoded.\n */\nexport const writeUint8 = write\n\n/**\n * Write one byte as an unsigned Integer at a specific location.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} pos The location where the data will be written.\n * @param {number} num The number that is to be encoded.\n */\nexport const setUint8 = set\n\n/**\n * Write two bytes as an unsigned integer.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The number that is to be encoded.\n */\nexport const writeUint16 = (encoder, num) => {\n write(encoder, num & binary.BITS8)\n write(encoder, (num >>> 8) & binary.BITS8)\n}\n/**\n * Write two bytes as an unsigned integer at a specific location.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} pos The location where the data will be written.\n * @param {number} num The number that is to be encoded.\n */\nexport const setUint16 = (encoder, pos, num) => {\n set(encoder, pos, num & binary.BITS8)\n set(encoder, pos + 1, (num >>> 8) & binary.BITS8)\n}\n\n/**\n * Write two bytes as an unsigned integer\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The number that is to be encoded.\n */\nexport const writeUint32 = (encoder, num) => {\n for (let i = 0; i < 4; i++) {\n write(encoder, num & binary.BITS8)\n num >>>= 8\n }\n}\n\n/**\n * Write two bytes as an unsigned integer in big endian order.\n * (most significant byte first)\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The number that is to be encoded.\n */\nexport const writeUint32BigEndian = (encoder, num) => {\n for (let i = 3; i >= 0; i--) {\n write(encoder, (num >>> (8 * i)) & binary.BITS8)\n }\n}\n\n/**\n * Write two bytes as an unsigned integer at a specific location.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} pos The location where the data will be written.\n * @param {number} num The number that is to be encoded.\n */\nexport const setUint32 = (encoder, pos, num) => {\n for (let i = 0; i < 4; i++) {\n set(encoder, pos + i, num & binary.BITS8)\n num >>>= 8\n }\n}\n\n/**\n * Write a variable length unsigned integer. Max encodable integer is 2^53.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The number that is to be encoded.\n */\nexport const writeVarUint = (encoder, num) => {\n while (num > binary.BITS7) {\n write(encoder, binary.BIT8 | (binary.BITS7 & num))\n num = math.floor(num / 128) // shift >>> 7\n }\n write(encoder, binary.BITS7 & num)\n}\n\n/**\n * Write a variable length integer.\n *\n * We use the 7th bit instead for signaling that this is a negative number.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The number that is to be encoded.\n */\nexport const writeVarInt = (encoder, num) => {\n const isNegative = math.isNegativeZero(num)\n if (isNegative) {\n num = -num\n }\n // |- whether to continue reading |- whether is negative |- number\n write(encoder, (num > binary.BITS6 ? binary.BIT8 : 0) | (isNegative ? binary.BIT7 : 0) | (binary.BITS6 & num))\n num = math.floor(num / 64) // shift >>> 6\n // We don't need to consider the case of num === 0 so we can use a different\n // pattern here than above.\n while (num > 0) {\n write(encoder, (num > binary.BITS7 ? binary.BIT8 : 0) | (binary.BITS7 & num))\n num = math.floor(num / 128) // shift >>> 7\n }\n}\n\n/**\n * A cache to store strings temporarily\n */\nconst _strBuffer = new Uint8Array(30000)\nconst _maxStrBSize = _strBuffer.length / 3\n\n/**\n * Write a variable length string.\n *\n * @function\n * @param {Encoder} encoder\n * @param {String} str The string that is to be encoded.\n */\nexport const _writeVarStringNative = (encoder, str) => {\n if (str.length < _maxStrBSize) {\n // We can encode the string into the existing buffer\n /* c8 ignore next */\n const written = string.utf8TextEncoder.encodeInto(str, _strBuffer).written || 0\n writeVarUint(encoder, written)\n for (let i = 0; i < written; i++) {\n write(encoder, _strBuffer[i])\n }\n } else {\n writeVarUint8Array(encoder, string.encodeUtf8(str))\n }\n}\n\n/**\n * Write a variable length string.\n *\n * @function\n * @param {Encoder} encoder\n * @param {String} str The string that is to be encoded.\n */\nexport const _writeVarStringPolyfill = (encoder, str) => {\n const encodedString = unescape(encodeURIComponent(str))\n const len = encodedString.length\n writeVarUint(encoder, len)\n for (let i = 0; i < len; i++) {\n write(encoder, /** @type {number} */ (encodedString.codePointAt(i)))\n }\n}\n\n/**\n * Write a variable length string.\n *\n * @function\n * @param {Encoder} encoder\n * @param {String} str The string that is to be encoded.\n */\n/* c8 ignore next */\nexport const writeVarString = (string.utf8TextEncoder && /** @type {any} */ (string.utf8TextEncoder).encodeInto) ? _writeVarStringNative : _writeVarStringPolyfill\n\n/**\n * Write a string terminated by a special byte sequence. This is not very performant and is\n * generally discouraged. However, the resulting byte arrays are lexiographically ordered which\n * makes this a nice feature for databases.\n *\n * The string will be encoded using utf8 and then terminated and escaped using writeTerminatingUint8Array.\n *\n * @function\n * @param {Encoder} encoder\n * @param {String} str The string that is to be encoded.\n */\nexport const writeTerminatedString = (encoder, str) =>\n writeTerminatedUint8Array(encoder, string.encodeUtf8(str))\n\n/**\n * Write a terminating Uint8Array. Note that this is not performant and is generally\n * discouraged. There are few situations when this is needed.\n *\n * We use 0x0 as a terminating character. 0x1 serves as an escape character for 0x0 and 0x1.\n *\n * Example: [0,1,2] is encoded to [1,0,1,1,2,0]. 0x0, and 0x1 needed to be escaped using 0x1. Then\n * the result is terminated using the 0x0 character.\n *\n * This is basically how many systems implement null terminated strings. However, we use an escape\n * character 0x1 to avoid issues and potenial attacks on our database (if this is used as a key\n * encoder for NoSql databases).\n *\n * @function\n * @param {Encoder} encoder\n * @param {Uint8Array} buf The string that is to be encoded.\n */\nexport const writeTerminatedUint8Array = (encoder, buf) => {\n for (let i = 0; i < buf.length; i++) {\n const b = buf[i]\n if (b === 0 || b === 1) {\n write(encoder, 1)\n }\n write(encoder, buf[i])\n }\n write(encoder, 0)\n}\n\n/**\n * Write the content of another Encoder.\n *\n * @TODO: can be improved!\n * - Note: Should consider that when appending a lot of small Encoders, we should rather clone than referencing the old structure.\n * Encoders start with a rather big initial buffer.\n *\n * @function\n * @param {Encoder} encoder The enUint8Arr\n * @param {Encoder} append The BinaryEncoder to be written.\n */\nexport const writeBinaryEncoder = (encoder, append) => writeUint8Array(encoder, toUint8Array(append))\n\n/**\n * Append fixed-length Uint8Array to the encoder.\n *\n * @function\n * @param {Encoder} encoder\n * @param {Uint8Array} uint8Array\n */\nexport const writeUint8Array = (encoder, uint8Array) => {\n const bufferLen = encoder.cbuf.length\n const cpos = encoder.cpos\n const leftCopyLen = math.min(bufferLen - cpos, uint8Array.length)\n const rightCopyLen = uint8Array.length - leftCopyLen\n encoder.cbuf.set(uint8Array.subarray(0, leftCopyLen), cpos)\n encoder.cpos += leftCopyLen\n if (rightCopyLen > 0) {\n // Still something to write, write right half..\n // Append new buffer\n encoder.bufs.push(encoder.cbuf)\n // must have at least size of remaining buffer\n encoder.cbuf = new Uint8Array(math.max(bufferLen * 2, rightCopyLen))\n // copy array\n encoder.cbuf.set(uint8Array.subarray(leftCopyLen))\n encoder.cpos = rightCopyLen\n }\n}\n\n/**\n * Append an Uint8Array to Encoder.\n *\n * @function\n * @param {Encoder} encoder\n * @param {Uint8Array} uint8Array\n */\nexport const writeVarUint8Array = (encoder, uint8Array) => {\n writeVarUint(encoder, uint8Array.byteLength)\n writeUint8Array(encoder, uint8Array)\n}\n\n/**\n * Create an DataView of the next `len` bytes. Use it to write data after\n * calling this function.\n *\n * ```js\n * // write float32 using DataView\n * const dv = writeOnDataView(encoder, 4)\n * dv.setFloat32(0, 1.1)\n * // read float32 using DataView\n * const dv = readFromDataView(encoder, 4)\n * dv.getFloat32(0) // => 1.100000023841858 (leaving it to the reader to find out why this is the correct result)\n * ```\n *\n * @param {Encoder} encoder\n * @param {number} len\n * @return {DataView}\n */\nexport const writeOnDataView = (encoder, len) => {\n verifyLen(encoder, len)\n const dview = new DataView(encoder.cbuf.buffer, encoder.cpos, len)\n encoder.cpos += len\n return dview\n}\n\n/**\n * @param {Encoder} encoder\n * @param {number} num\n */\nexport const writeFloat32 = (encoder, num) => writeOnDataView(encoder, 4).setFloat32(0, num, false)\n\n/**\n * @param {Encoder} encoder\n * @param {number} num\n */\nexport const writeFloat64 = (encoder, num) => writeOnDataView(encoder, 8).setFloat64(0, num, false)\n\n/**\n * @param {Encoder} encoder\n * @param {bigint} num\n */\nexport const writeBigInt64 = (encoder, num) => /** @type {any} */ (writeOnDataView(encoder, 8)).setBigInt64(0, num, false)\n\n/**\n * @param {Encoder} encoder\n * @param {bigint} num\n */\nexport const writeBigUint64 = (encoder, num) => /** @type {any} */ (writeOnDataView(encoder, 8)).setBigUint64(0, num, false)\n\nconst floatTestBed = new DataView(new ArrayBuffer(4))\n/**\n * Check if a number can be encoded as a 32 bit float.\n *\n * @param {number} num\n * @return {boolean}\n */\nconst isFloat32 = num => {\n floatTestBed.setFloat32(0, num)\n return floatTestBed.getFloat32(0) === num\n}\n\n/**\n * @typedef {Array} AnyEncodableArray\n */\n\n/**\n * @typedef {undefined|null|number|bigint|boolean|string|{[k:string]:AnyEncodable}|AnyEncodableArray|Uint8Array} AnyEncodable\n */\n\n/**\n * Encode data with efficient binary format.\n *\n * Differences to JSON:\n * • Transforms data to a binary format (not to a string)\n * • Encodes undefined, NaN, and ArrayBuffer (these can't be represented in JSON)\n * • Numbers are efficiently encoded either as a variable length integer, as a\n * 32 bit float, as a 64 bit float, or as a 64 bit bigint.\n *\n * Encoding table:\n *\n * | Data Type | Prefix | Encoding Method | Comment |\n * | ------------------- | -------- | ------------------ | ------- |\n * | undefined | 127 | | Functions, symbol, and everything that cannot be identified is encoded as undefined |\n * | null | 126 | | |\n * | integer | 125 | writeVarInt | Only encodes 32 bit signed integers |\n * | float32 | 124 | writeFloat32 | |\n * | float64 | 123 | writeFloat64 | |\n * | bigint | 122 | writeBigInt64 | |\n * | boolean (false) | 121 | | True and false are different data types so we save the following byte |\n * | boolean (true) | 120 | | - 0b01111000 so the last bit determines whether true or false |\n * | string | 119 | writeVarString | |\n * | object | 118 | custom | Writes {length} then {length} key-value pairs |\n * | array | 117 | custom | Writes {length} then {length} json values |\n * | Uint8Array | 116 | writeVarUint8Array | We use Uint8Array for any kind of binary data |\n *\n * Reasons for the decreasing prefix:\n * We need the first bit for extendability (later we may want to encode the\n * prefix with writeVarUint). The remaining 7 bits are divided as follows:\n * [0-30] the beginning of the data range is used for custom purposes\n * (defined by the function that uses this library)\n * [31-127] the end of the data range is used for data encoding by\n * lib0/encoding.js\n *\n * @param {Encoder} encoder\n * @param {AnyEncodable} data\n */\nexport const writeAny = (encoder, data) => {\n switch (typeof data) {\n case 'string':\n // TYPE 119: STRING\n write(encoder, 119)\n writeVarString(encoder, data)\n break\n case 'number':\n if (number.isInteger(data) && math.abs(data) <= binary.BITS31) {\n // TYPE 125: INTEGER\n write(encoder, 125)\n writeVarInt(encoder, data)\n } else if (isFloat32(data)) {\n // TYPE 124: FLOAT32\n write(encoder, 124)\n writeFloat32(encoder, data)\n } else {\n // TYPE 123: FLOAT64\n write(encoder, 123)\n writeFloat64(encoder, data)\n }\n break\n case 'bigint':\n // TYPE 122: BigInt\n write(encoder, 122)\n writeBigInt64(encoder, data)\n break\n case 'object':\n if (data === null) {\n // TYPE 126: null\n write(encoder, 126)\n } else if (array.isArray(data)) {\n // TYPE 117: Array\n write(encoder, 117)\n writeVarUint(encoder, data.length)\n for (let i = 0; i < data.length; i++) {\n writeAny(encoder, data[i])\n }\n } else if (data instanceof Uint8Array) {\n // TYPE 116: ArrayBuffer\n write(encoder, 116)\n writeVarUint8Array(encoder, data)\n } else {\n // TYPE 118: Object\n write(encoder, 118)\n const keys = Object.keys(data)\n writeVarUint(encoder, keys.length)\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i]\n writeVarString(encoder, key)\n writeAny(encoder, data[key])\n }\n }\n break\n case 'boolean':\n // TYPE 120/121: boolean (true/false)\n write(encoder, data ? 120 : 121)\n break\n default:\n // TYPE 127: undefined\n write(encoder, 127)\n }\n}\n\n/**\n * Now come a few stateful encoder that have their own classes.\n */\n\n/**\n * Basic Run Length Encoder - a basic compression implementation.\n *\n * Encodes [1,1,1,7] to [1,3,7,1] (3 times 1, 1 time 7). This encoder might do more harm than good if there are a lot of values that are not repeated.\n *\n * It was originally used for image compression. Cool .. article http://csbruce.com/cbm/transactor/pdfs/trans_v7_i06.pdf\n *\n * @note T must not be null!\n *\n * @template T\n */\nexport class RleEncoder extends Encoder {\n /**\n * @param {function(Encoder, T):void} writer\n */\n constructor (writer) {\n super()\n /**\n * The writer\n */\n this.w = writer\n /**\n * Current state\n * @type {T|null}\n */\n this.s = null\n this.count = 0\n }\n\n /**\n * @param {T} v\n */\n write (v) {\n if (this.s === v) {\n this.count++\n } else {\n if (this.count > 0) {\n // flush counter, unless this is the first value (count = 0)\n writeVarUint(this, this.count - 1) // since count is always > 0, we can decrement by one. non-standard encoding ftw\n }\n this.count = 1\n // write first value\n this.w(this, v)\n this.s = v\n }\n }\n}\n\n/**\n * Basic diff decoder using variable length encoding.\n *\n * Encodes the values [3, 1100, 1101, 1050, 0] to [3, 1097, 1, -51, -1050] using writeVarInt.\n */\nexport class IntDiffEncoder extends Encoder {\n /**\n * @param {number} start\n */\n constructor (start) {\n super()\n /**\n * Current state\n * @type {number}\n */\n this.s = start\n }\n\n /**\n * @param {number} v\n */\n write (v) {\n writeVarInt(this, v - this.s)\n this.s = v\n }\n}\n\n/**\n * A combination of IntDiffEncoder and RleEncoder.\n *\n * Basically first writes the IntDiffEncoder and then counts duplicate diffs using RleEncoding.\n *\n * Encodes the values [1,1,1,2,3,4,5,6] as [1,1,0,2,1,5] (RLE([1,0,0,1,1,1,1,1]) ⇒ RleIntDiff[1,1,0,2,1,5])\n */\nexport class RleIntDiffEncoder extends Encoder {\n /**\n * @param {number} start\n */\n constructor (start) {\n super()\n /**\n * Current state\n * @type {number}\n */\n this.s = start\n this.count = 0\n }\n\n /**\n * @param {number} v\n */\n write (v) {\n if (this.s === v && this.count > 0) {\n this.count++\n } else {\n if (this.count > 0) {\n // flush counter, unless this is the first value (count = 0)\n writeVarUint(this, this.count - 1) // since count is always > 0, we can decrement by one. non-standard encoding ftw\n }\n this.count = 1\n // write first value\n writeVarInt(this, v - this.s)\n this.s = v\n }\n }\n}\n\n/**\n * @param {UintOptRleEncoder} encoder\n */\nconst flushUintOptRleEncoder = encoder => {\n if (encoder.count > 0) {\n // flush counter, unless this is the first value (count = 0)\n // case 1: just a single value. set sign to positive\n // case 2: write several values. set sign to negative to indicate that there is a length coming\n writeVarInt(encoder.encoder, encoder.count === 1 ? encoder.s : -encoder.s)\n if (encoder.count > 1) {\n writeVarUint(encoder.encoder, encoder.count - 2) // since count is always > 1, we can decrement by one. non-standard encoding ftw\n }\n }\n}\n\n/**\n * Optimized Rle encoder that does not suffer from the mentioned problem of the basic Rle encoder.\n *\n * Internally uses VarInt encoder to write unsigned integers. If the input occurs multiple times, we write\n * write it as a negative number. The UintOptRleDecoder then understands that it needs to read a count.\n *\n * Encodes [1,2,3,3,3] as [1,2,-3,3] (once 1, once 2, three times 3)\n */\nexport class UintOptRleEncoder {\n constructor () {\n this.encoder = new Encoder()\n /**\n * @type {number}\n */\n this.s = 0\n this.count = 0\n }\n\n /**\n * @param {number} v\n */\n write (v) {\n if (this.s === v) {\n this.count++\n } else {\n flushUintOptRleEncoder(this)\n this.count = 1\n this.s = v\n }\n }\n\n /**\n * Flush the encoded state and transform this to a Uint8Array.\n *\n * Note that this should only be called once.\n */\n toUint8Array () {\n flushUintOptRleEncoder(this)\n return toUint8Array(this.encoder)\n }\n}\n\n/**\n * Increasing Uint Optimized RLE Encoder\n *\n * The RLE encoder counts the number of same occurences of the same value.\n * The IncUintOptRle encoder counts if the value increases.\n * I.e. 7, 8, 9, 10 will be encoded as [-7, 4]. 1, 3, 5 will be encoded\n * as [1, 3, 5].\n */\nexport class IncUintOptRleEncoder {\n constructor () {\n this.encoder = new Encoder()\n /**\n * @type {number}\n */\n this.s = 0\n this.count = 0\n }\n\n /**\n * @param {number} v\n */\n write (v) {\n if (this.s + this.count === v) {\n this.count++\n } else {\n flushUintOptRleEncoder(this)\n this.count = 1\n this.s = v\n }\n }\n\n /**\n * Flush the encoded state and transform this to a Uint8Array.\n *\n * Note that this should only be called once.\n */\n toUint8Array () {\n flushUintOptRleEncoder(this)\n return toUint8Array(this.encoder)\n }\n}\n\n/**\n * @param {IntDiffOptRleEncoder} encoder\n */\nconst flushIntDiffOptRleEncoder = encoder => {\n if (encoder.count > 0) {\n // 31 bit making up the diff | wether to write the counter\n // const encodedDiff = encoder.diff << 1 | (encoder.count === 1 ? 0 : 1)\n const encodedDiff = encoder.diff * 2 + (encoder.count === 1 ? 0 : 1)\n // flush counter, unless this is the first value (count = 0)\n // case 1: just a single value. set first bit to positive\n // case 2: write several values. set first bit to negative to indicate that there is a length coming\n writeVarInt(encoder.encoder, encodedDiff)\n if (encoder.count > 1) {\n writeVarUint(encoder.encoder, encoder.count - 2) // since count is always > 1, we can decrement by one. non-standard encoding ftw\n }\n }\n}\n\n/**\n * A combination of the IntDiffEncoder and the UintOptRleEncoder.\n *\n * The count approach is similar to the UintDiffOptRleEncoder, but instead of using the negative bitflag, it encodes\n * in the LSB whether a count is to be read. Therefore this Encoder only supports 31 bit integers!\n *\n * Encodes [1, 2, 3, 2] as [3, 1, 6, -1] (more specifically [(1 << 1) | 1, (3 << 0) | 0, -1])\n *\n * Internally uses variable length encoding. Contrary to normal UintVar encoding, the first byte contains:\n * * 1 bit that denotes whether the next value is a count (LSB)\n * * 1 bit that denotes whether this value is negative (MSB - 1)\n * * 1 bit that denotes whether to continue reading the variable length integer (MSB)\n *\n * Therefore, only five bits remain to encode diff ranges.\n *\n * Use this Encoder only when appropriate. In most cases, this is probably a bad idea.\n */\nexport class IntDiffOptRleEncoder {\n constructor () {\n this.encoder = new Encoder()\n /**\n * @type {number}\n */\n this.s = 0\n this.count = 0\n this.diff = 0\n }\n\n /**\n * @param {number} v\n */\n write (v) {\n if (this.diff === v - this.s) {\n this.s = v\n this.count++\n } else {\n flushIntDiffOptRleEncoder(this)\n this.count = 1\n this.diff = v - this.s\n this.s = v\n }\n }\n\n /**\n * Flush the encoded state and transform this to a Uint8Array.\n *\n * Note that this should only be called once.\n */\n toUint8Array () {\n flushIntDiffOptRleEncoder(this)\n return toUint8Array(this.encoder)\n }\n}\n\n/**\n * Optimized String Encoder.\n *\n * Encoding many small strings in a simple Encoder is not very efficient. The function call to decode a string takes some time and creates references that must be eventually deleted.\n * In practice, when decoding several million small strings, the GC will kick in more and more often to collect orphaned string objects (or maybe there is another reason?).\n *\n * This string encoder solves the above problem. All strings are concatenated and written as a single string using a single encoding call.\n *\n * The lengths are encoded using a UintOptRleEncoder.\n */\nexport class StringEncoder {\n constructor () {\n /**\n * @type {Array}\n */\n this.sarr = []\n this.s = ''\n this.lensE = new UintOptRleEncoder()\n }\n\n /**\n * @param {string} string\n */\n write (string) {\n this.s += string\n if (this.s.length > 19) {\n this.sarr.push(this.s)\n this.s = ''\n }\n this.lensE.write(string.length)\n }\n\n toUint8Array () {\n const encoder = new Encoder()\n this.sarr.push(this.s)\n this.s = ''\n writeVarString(encoder, this.sarr.join(''))\n writeUint8Array(encoder, this.lensE.toUint8Array())\n return toUint8Array(encoder)\n }\n}\n"],"names":["math.max","binary.BITS8","binary.BITS7","binary.BIT8","math.floor","math.isNegativeZero","binary.BITS6","binary.BIT7","string.utf8TextEncoder","string.encodeUtf8","math.min","number.isInteger","math.abs","binary.BITS31","array.isArray"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACO,MAAM,OAAO,CAAC;AACrB,EAAE,WAAW,CAAC,GAAG;AACjB,IAAI,IAAI,CAAC,IAAI,GAAG,EAAC;AACjB,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,UAAU,CAAC,GAAG,EAAC;AACnC;AACA;AACA;AACA,IAAI,IAAI,CAAC,IAAI,GAAG,GAAE;AAClB,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACA;AACY,MAAC,aAAa,GAAG,MAAM,IAAI,OAAO,GAAE;AAChD;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,CAAC,CAAC,KAAK;AAC7B,EAAE,MA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ding.cjs b/yjs-poll/node_modules/lib0/dist/encoding.cjs deleted file mode 100644 index d3aec26..0000000 --- a/yjs-poll/node_modules/lib0/dist/encoding.cjs +++ /dev/null @@ -1,54 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./math-96d5e8c4.cjs'); -require('./number-1fb57bba.cjs'); -require('./binary-ac8e39e2.cjs'); -require('./string-fddc5f8b.cjs'); -require('./array-78849c95.cjs'); -var encoding = require('./encoding-1a745c43.cjs'); -require('./set-5b47859e.cjs'); - - - -exports.Encoder = encoding.Encoder; -exports.IncUintOptRleEncoder = encoding.IncUintOptRleEncoder; -exports.IntDiffEncoder = encoding.IntDiffEncoder; -exports.IntDiffOptRleEncoder = encoding.IntDiffOptRleEncoder; -exports.RleEncoder = encoding.RleEncoder; -exports.RleIntDiffEncoder = encoding.RleIntDiffEncoder; -exports.StringEncoder = encoding.StringEncoder; -exports.UintOptRleEncoder = encoding.UintOptRleEncoder; -exports._writeVarStringNative = encoding._writeVarStringNative; -exports._writeVarStringPolyfill = encoding._writeVarStringPolyfill; -exports.createEncoder = encoding.createEncoder; -exports.encode = encoding.encode; -exports.hasContent = encoding.hasContent; -exports.length = encoding.length; -exports.set = encoding.set; -exports.setUint16 = encoding.setUint16; -exports.setUint32 = encoding.setUint32; -exports.setUint8 = encoding.setUint8; -exports.toUint8Array = encoding.toUint8Array; -exports.verifyLen = encoding.verifyLen; -exports.write = encoding.write; -exports.writeAny = encoding.writeAny; -exports.writeBigInt64 = encoding.writeBigInt64; -exports.writeBigUint64 = encoding.writeBigUint64; -exports.writeBinaryEncoder = encoding.writeBinaryEncoder; -exports.writeFloat32 = encoding.writeFloat32; -exports.writeFloat64 = encoding.writeFloat64; -exports.writeOnDataView = encoding.writeOnDataView; -exports.writeTerminatedString = encoding.writeTerminatedString; -exports.writeTerminatedUint8Array = encoding.writeTerminatedUint8Array; -exports.writeUint16 = encoding.writeUint16; -exports.writeUint32 = encoding.writeUint32; -exports.writeUint32BigEndian = encoding.writeUint32BigEndian; -exports.writeUint8 = encoding.writeUint8; -exports.writeUint8Array = encoding.writeUint8Array; -exports.writeVarInt = encoding.writeVarInt; -exports.writeVarString = encoding.writeVarString; -exports.writeVarUint = encoding.writeVarUint; -exports.writeVarUint8Array = encoding.writeVarUint8Array; -//# sourceMappingURL=encoding.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/encoding.cjs.map b/yjs-poll/node_modules/lib0/dist/encoding.cjs.map deleted file mode 100644 index 4f4b002..0000000 --- a/yjs-poll/node_modules/lib0/dist/encoding.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"encoding.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/encoding.d.ts b/yjs-poll/node_modules/lib0/dist/encoding.d.ts deleted file mode 100644 index 574ca97..0000000 --- a/yjs-poll/node_modules/lib0/dist/encoding.d.ts +++ /dev/null @@ -1,235 +0,0 @@ -/** - * A BinaryEncoder handles the encoding to an Uint8Array. - */ -export class Encoder { - cpos: number; - cbuf: Uint8Array; - /** - * @type {Array} - */ - bufs: Array; -} -export function createEncoder(): Encoder; -export function encode(f: (arg0: Encoder) => void): Uint8Array; -export function length(encoder: Encoder): number; -export function hasContent(encoder: Encoder): boolean; -export function toUint8Array(encoder: Encoder): Uint8Array; -export function verifyLen(encoder: Encoder, len: number): void; -export function write(encoder: Encoder, num: number): void; -export function set(encoder: Encoder, pos: number, num: number): void; -export function writeUint8(encoder: Encoder, num: number): void; -export function setUint8(encoder: Encoder, pos: number, num: number): void; -export function writeUint16(encoder: Encoder, num: number): void; -export function setUint16(encoder: Encoder, pos: number, num: number): void; -export function writeUint32(encoder: Encoder, num: number): void; -export function writeUint32BigEndian(encoder: Encoder, num: number): void; -export function setUint32(encoder: Encoder, pos: number, num: number): void; -export function writeVarUint(encoder: Encoder, num: number): void; -export function writeVarInt(encoder: Encoder, num: number): void; -export function _writeVarStringNative(encoder: Encoder, str: string): void; -export function _writeVarStringPolyfill(encoder: Encoder, str: string): void; -export function writeVarString(encoder: Encoder, str: string): void; -export function writeTerminatedString(encoder: Encoder, str: string): void; -export function writeTerminatedUint8Array(encoder: Encoder, buf: Uint8Array): void; -export function writeBinaryEncoder(encoder: Encoder, append: Encoder): void; -export function writeUint8Array(encoder: Encoder, uint8Array: Uint8Array): void; -export function writeVarUint8Array(encoder: Encoder, uint8Array: Uint8Array): void; -export function writeOnDataView(encoder: Encoder, len: number): DataView; -export function writeFloat32(encoder: Encoder, num: number): void; -export function writeFloat64(encoder: Encoder, num: number): void; -export function writeBigInt64(encoder: Encoder, num: bigint): any; -export function writeBigUint64(encoder: Encoder, num: bigint): any; -export function writeAny(encoder: Encoder, data: AnyEncodable): void; -/** - * Now come a few stateful encoder that have their own classes. - */ -/** - * Basic Run Length Encoder - a basic compression implementation. - * - * Encodes [1,1,1,7] to [1,3,7,1] (3 times 1, 1 time 7). This encoder might do more harm than good if there are a lot of values that are not repeated. - * - * It was originally used for image compression. Cool .. article http://csbruce.com/cbm/transactor/pdfs/trans_v7_i06.pdf - * - * @note T must not be null! - * - * @template T - */ -export class RleEncoder extends Encoder { - /** - * @param {function(Encoder, T):void} writer - */ - constructor(writer: (arg0: Encoder, arg1: T) => void); - /** - * The writer - */ - w: (arg0: Encoder, arg1: T) => void; - /** - * Current state - * @type {T|null} - */ - s: T | null; - count: number; - /** - * @param {T} v - */ - write(v: T): void; -} -/** - * Basic diff decoder using variable length encoding. - * - * Encodes the values [3, 1100, 1101, 1050, 0] to [3, 1097, 1, -51, -1050] using writeVarInt. - */ -export class IntDiffEncoder extends Encoder { - /** - * @param {number} start - */ - constructor(start: number); - /** - * Current state - * @type {number} - */ - s: number; - /** - * @param {number} v - */ - write(v: number): void; -} -/** - * A combination of IntDiffEncoder and RleEncoder. - * - * Basically first writes the IntDiffEncoder and then counts duplicate diffs using RleEncoding. - * - * Encodes the values [1,1,1,2,3,4,5,6] as [1,1,0,2,1,5] (RLE([1,0,0,1,1,1,1,1]) ⇒ RleIntDiff[1,1,0,2,1,5]) - */ -export class RleIntDiffEncoder extends Encoder { - /** - * @param {number} start - */ - constructor(start: number); - /** - * Current state - * @type {number} - */ - s: number; - count: number; - /** - * @param {number} v - */ - write(v: number): void; -} -/** - * Optimized Rle encoder that does not suffer from the mentioned problem of the basic Rle encoder. - * - * Internally uses VarInt encoder to write unsigned integers. If the input occurs multiple times, we write - * write it as a negative number. The UintOptRleDecoder then understands that it needs to read a count. - * - * Encodes [1,2,3,3,3] as [1,2,-3,3] (once 1, once 2, three times 3) - */ -export class UintOptRleEncoder { - encoder: Encoder; - /** - * @type {number} - */ - s: number; - count: number; - /** - * @param {number} v - */ - write(v: number): void; - /** - * Flush the encoded state and transform this to a Uint8Array. - * - * Note that this should only be called once. - */ - toUint8Array(): Uint8Array; -} -/** - * Increasing Uint Optimized RLE Encoder - * - * The RLE encoder counts the number of same occurences of the same value. - * The IncUintOptRle encoder counts if the value increases. - * I.e. 7, 8, 9, 10 will be encoded as [-7, 4]. 1, 3, 5 will be encoded - * as [1, 3, 5]. - */ -export class IncUintOptRleEncoder { - encoder: Encoder; - /** - * @type {number} - */ - s: number; - count: number; - /** - * @param {number} v - */ - write(v: number): void; - /** - * Flush the encoded state and transform this to a Uint8Array. - * - * Note that this should only be called once. - */ - toUint8Array(): Uint8Array; -} -/** - * A combination of the IntDiffEncoder and the UintOptRleEncoder. - * - * The count approach is similar to the UintDiffOptRleEncoder, but instead of using the negative bitflag, it encodes - * in the LSB whether a count is to be read. Therefore this Encoder only supports 31 bit integers! - * - * Encodes [1, 2, 3, 2] as [3, 1, 6, -1] (more specifically [(1 << 1) | 1, (3 << 0) | 0, -1]) - * - * Internally uses variable length encoding. Contrary to normal UintVar encoding, the first byte contains: - * * 1 bit that denotes whether the next value is a count (LSB) - * * 1 bit that denotes whether this value is negative (MSB - 1) - * * 1 bit that denotes whether to continue reading the variable length integer (MSB) - * - * Therefore, only five bits remain to encode diff ranges. - * - * Use this Encoder only when appropriate. In most cases, this is probably a bad idea. - */ -export class IntDiffOptRleEncoder { - encoder: Encoder; - /** - * @type {number} - */ - s: number; - count: number; - diff: number; - /** - * @param {number} v - */ - write(v: number): void; - /** - * Flush the encoded state and transform this to a Uint8Array. - * - * Note that this should only be called once. - */ - toUint8Array(): Uint8Array; -} -/** - * Optimized String Encoder. - * - * Encoding many small strings in a simple Encoder is not very efficient. The function call to decode a string takes some time and creates references that must be eventually deleted. - * In practice, when decoding several million small strings, the GC will kick in more and more often to collect orphaned string objects (or maybe there is another reason?). - * - * This string encoder solves the above problem. All strings are concatenated and written as a single string using a single encoding call. - * - * The lengths are encoded using a UintOptRleEncoder. - */ -export class StringEncoder { - /** - * @type {Array} - */ - sarr: Array; - s: string; - lensE: UintOptRleEncoder; - /** - * @param {string} string - */ - write(string: string): void; - toUint8Array(): Uint8Array; -} -export type AnyEncodableArray = Array; -export type AnyEncodable = undefined | null | number | bigint | boolean | string | { - [k: string]: AnyEncodable; -} | AnyEncodableArray | Uint8Array; -//# sourceMappingURL=encoding.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/encoding.d.ts.map b/yjs-poll/node_modules/lib0/dist/encoding.d.ts.map deleted file mode 100644 index 44bfcf6..0000000 --- a/yjs-poll/node_modules/lib0/dist/encoding.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../encoding.js"],"names":[],"mappings":"AAkCA;;GAEG;AACH;IAEI,aAAa;IACb,8BAA+B;IAC/B;;OAEG;IACH,MAFU,KAAK,CAAC,UAAU,CAAC,CAEb;CAEjB;AAMM,iCAFK,OAAO,CAE6B;AAKzC,0BAFI,CAAS,IAAO,EAAP,OAAO,KAAE,IAAI,2BAMhC;AASM,gCAHI,OAAO,GACN,MAAM,CAQjB;AASM,oCAHI,OAAO,GACN,OAAO,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,GAAC,iBAAiB,GAAC,UAAU"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/encoding.test.d.ts b/yjs-poll/node_modules/lib0/dist/encoding.test.d.ts deleted file mode 100644 index 83f548f..0000000 --- a/yjs-poll/node_modules/lib0/dist/encoding.test.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -export function testGolangBinaryEncodingCompatibility(): void; -export function testVerifyLen(): void; -export function testStringEncodingPerformanceNativeVsPolyfill(): void; -export function testDecodingPerformanceNativeVsPolyfill(): void; -export function testStringDecodingPerformance(): void; -export function testAnyEncodeUnknowns(_tc: t.TestCase): void; -export function testAnyEncodeDate(_tc: t.TestCase): void; -export function testEncodeMax32bitUint(_tc: t.TestCase): void; -export function testVarUintEncoding(_tc: t.TestCase): void; -export function testVarIntEncoding(_tc: t.TestCase): void; -export function testRepeatVarUintEncoding(tc: t.TestCase): void; -export function testRepeatVarUintEncoding53bit(tc: t.TestCase): void; -export function testRepeatVarIntEncoding(tc: t.TestCase): void; -export function testRepeatVarIntEncoding53bit(tc: t.TestCase): void; -export function testRepeanntAnyEncoding(tc: t.TestCase): void; -export function testRepeatPeekVarUintEncoding(tc: t.TestCase): void; -export function testRepeatPeekVarIntEncoding(tc: t.TestCase): void; -export function testAnyVsJsonEncoding(tc: t.TestCase): void; -export function testStringEncoding(_tc: t.TestCase): void; -export function testRepeatStringEncoding(tc: t.TestCase): void; -export function testSetMethods(_tc: t.TestCase): void; -export function testRepeatRandomWrites(tc: t.TestCase): void; -export function testWriteUint8ArrayOverflow(_tc: t.TestCase): void; -export function testSetOnOverflow(_tc: t.TestCase): void; -export function testCloneDecoder(_tc: t.TestCase): void; -export function testWriteBinaryEncoder(_tc: t.TestCase): void; -export function testOverflowStringDecoding(tc: t.TestCase): void; -export function testRleEncoder(_tc: t.TestCase): void; -export function testRleIntDiffEncoder(_tc: t.TestCase): void; -export function testUintOptRleEncoder(_tc: t.TestCase): void; -export function testIncUintOptRleEncoder(_tc: t.TestCase): void; -export function testIntDiffRleEncoder(_tc: t.TestCase): void; -export function testIntEncoders(tc: t.TestCase): void; -export function testIntDiffEncoder(_tc: t.TestCase): void; -export function testStringDecoder(tc: t.TestCase): void; -export function testLargeNumberEncoding(tc: t.TestCase): void; -export function testInvalidVarIntEncoding(_tc: t.TestCase): void; -export function testTerminatedEncodering(_tc: t.TestCase): void; -export type EncodingPair = { - read: (arg0: decoding.Decoder) => any; - write: (arg0: encoding.Encoder, arg1: any) => void; - gen: (arg0: prng.PRNG) => any; - compare: (arg0: any, arg1: any) => boolean; - name: string; -}; -import * as t from './testing.js'; -import * as decoding from './decoding.js'; -import * as encoding from './encoding.js'; -import * as prng from './prng.js'; -//# sourceMappingURL=encoding.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/encoding.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/encoding.test.d.ts.map deleted file mode 100644 index 887f658..0000000 --- a/yjs-poll/node_modules/lib0/dist/encoding.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"encoding.test.d.ts","sourceRoot":"","sources":["../encoding.test.js"],"names":[],"mappings":"AA6CO,8DAkCN;AAwCM,sCAQN;AAEM,sEA2CN;AAEM,gEAoDN;AAEM,sDAiDN;AAKM,2CAFI,CAAC,CAAC,QAAQ,QAapB;AAKM,uCAFI,CAAC,CAAC,QAAQ,QAIpB;AAKM,4CAFI,CAAC,CAAC,QAAQ,QAIpB;AAKM,yCAFI,CAAC,CAAC,QAAQ,QASpB;AAKM,wCAFI,CAAC,CAAC,QAAQ,QAUpB;AAKM,8CAFI,CAAC,CAAC,QAAQ,QAKpB;AAKM,mDAFI,CAAC,CAAC,QAAQ,QAKpB;AAKM,6CAFI,CAAC,CAAC,QAAQ,QAKpB;AAKM,kDAFI,CAAC,CAAC,QAAQ,QAKpB;AAKM,4CAFI,CAAC,CAAC,QAAQ,QAKpB;AAKM,kDAFI,CAAC,CAAC,QAAQ,QAKpB;AAKM,iDAFI,CAAC,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modules/lib0/dist/environment-1c97264d.cjs b/yjs-poll/node_modules/lib0/dist/environment-1c97264d.cjs deleted file mode 100644 index 6e456f4..0000000 --- a/yjs-poll/node_modules/lib0/dist/environment-1c97264d.cjs +++ /dev/null @@ -1,180 +0,0 @@ -'use strict'; - -var map = require('./map-24d263c0.cjs'); -var string = require('./string-fddc5f8b.cjs'); -var conditions = require('./conditions-f5c0c102.cjs'); -var storage = require('./storage.cjs'); -var _function = require('./function-314580f7.cjs'); - -/** - * Isomorphic module to work access the environment (query params, env variables). - * - * @module environment - */ - -/* c8 ignore next 2 */ -// @ts-ignore -const isNode = typeof process !== 'undefined' && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]'; - -/* c8 ignore next */ -const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && !isNode; -/* c8 ignore next 3 */ -const isMac = typeof navigator !== 'undefined' - ? /Mac/.test(navigator.platform) - : false; - -/** - * @type {Map} - */ -let params; - -/* c8 ignore start */ -const computeParams = () => { - if (params === undefined) { - if (isNode) { - params = map.create(); - const pargs = process.argv; - let currParamName = null; - for (let i = 0; i < pargs.length; i++) { - const parg = pargs[i]; - if (parg[0] === '-') { - if (currParamName !== null) { - params.set(currParamName, ''); - } - currParamName = parg; - } else { - if (currParamName !== null) { - params.set(currParamName, parg); - currParamName = null; - } - } - } - if (currParamName !== null) { - params.set(currParamName, ''); - } - // in ReactNative for example this would not be true (unless connected to the Remote Debugger) - } else if (typeof location === 'object') { - params = map.create(); // eslint-disable-next-line no-undef - (location.search || '?').slice(1).split('&').forEach((kv) => { - if (kv.length !== 0) { - const [key, value] = kv.split('='); - params.set(`--${string.fromCamelCase(key, '-')}`, value); - params.set(`-${string.fromCamelCase(key, '-')}`, value); - } - }); - } else { - params = map.create(); - } - } - return params -}; -/* c8 ignore stop */ - -/** - * @param {string} name - * @return {boolean} - */ -/* c8 ignore next */ -const hasParam = (name) => computeParams().has(name); - -/** - * @param {string} name - * @param {string} defaultVal - * @return {string} - */ -/* c8 ignore next 2 */ -const getParam = (name, defaultVal) => - computeParams().get(name) || defaultVal; - -/** - * @param {string} name - * @return {string|null} - */ -/* c8 ignore next 4 */ -const getVariable = (name) => - isNode - ? conditions.undefinedToNull(process.env[name.toUpperCase().replaceAll('-', '_')]) - : conditions.undefinedToNull(storage.varStorage.getItem(name)); - -/** - * @param {string} name - * @return {string|null} - */ -/* c8 ignore next 2 */ -const getConf = (name) => - computeParams().get('--' + name) || getVariable(name); - -/** - * @param {string} name - * @return {string} - */ -/* c8 ignore next 5 */ -const ensureConf = (name) => { - const c = getConf(name); - if (c == null) throw new Error(`Expected configuration "${name.toUpperCase().replaceAll('-', '_')}"`) - return c -}; - -/** - * @param {string} name - * @return {boolean} - */ -/* c8 ignore next 2 */ -const hasConf = (name) => - hasParam('--' + name) || getVariable(name) !== null; - -/* c8 ignore next */ -const production = hasConf('production'); - -/* c8 ignore next 2 */ -const forceColor = isNode && - _function.isOneOf(process.env.FORCE_COLOR, ['true', '1', '2']); - -/* c8 ignore start */ -/** - * Color is enabled by default if the terminal supports it. - * - * Explicitly enable color using `--color` parameter - * Disable color using `--no-color` parameter or using `NO_COLOR=1` environment variable. - * `FORCE_COLOR=1` enables color and takes precedence over all. - */ -const supportsColor = forceColor || ( - !hasParam('--no-colors') && // @todo deprecate --no-colors - !hasConf('no-color') && - (!isNode || process.stdout.isTTY) && ( - !isNode || - hasParam('--color') || - getVariable('COLORTERM') !== null || - (getVariable('TERM') || '').includes('color') - ) -); -/* c8 ignore stop */ - -var environment = /*#__PURE__*/Object.freeze({ - __proto__: null, - isNode: isNode, - isBrowser: isBrowser, - isMac: isMac, - hasParam: hasParam, - getParam: getParam, - getVariable: getVariable, - getConf: getConf, - ensureConf: ensureConf, - hasConf: hasConf, - production: production, - supportsColor: supportsColor -}); - -exports.ensureConf = ensureConf; -exports.environment = environment; -exports.getConf = getConf; -exports.getParam = getParam; -exports.getVariable = getVariable; -exports.hasConf = hasConf; -exports.hasParam = hasParam; -exports.isBrowser = isBrowser; -exports.isMac = isMac; -exports.isNode = isNode; -exports.production = production; -exports.supportsColor = supportsColor; -//# sourceMappingURL=environment-1c97264d.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/environment-1c97264d.cjs.map b/yjs-poll/node_modules/lib0/dist/environment-1c97264d.cjs.map deleted file mode 100644 index 2f9deb3..0000000 --- a/yjs-poll/node_modules/lib0/dist/environment-1c97264d.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"environment-1c97264d.cjs","sources":["../environment.js"],"sourcesContent":["/**\n * Isomorphic module to work access the environment (query params, env variables).\n *\n * @module environment\n */\n\nimport * as map from './map.js'\nimport * as string from './string.js'\nimport * as conditions from './conditions.js'\nimport * as storage from './storage.js'\nimport * as f from './function.js'\n\n/* c8 ignore next 2 */\n// @ts-ignore\nexport const isNode = typeof process !== 'undefined' && process.release && /node|io\\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]'\n\n/* c8 ignore next */\nexport const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && !isNode\n/* c8 ignore next 3 */\nexport const isMac = typeof navigator !== 'undefined'\n ? /Mac/.test(navigator.platform)\n : false\n\n/**\n * @type {Map}\n */\nlet params\nconst args = []\n\n/* c8 ignore start */\nconst computeParams = () => {\n if (params === undefined) {\n if (isNode) {\n params = map.create()\n const pargs = process.argv\n let currParamName = null\n for (let i = 0; i < pargs.length; i++) {\n const parg = pargs[i]\n if (parg[0] === '-') {\n if (currParamName !== null) {\n params.set(currParamName, '')\n }\n currParamName = parg\n } else {\n if (currParamName !== null) {\n params.set(currParamName, parg)\n currParamName = null\n } else {\n args.push(parg)\n }\n }\n }\n if (currParamName !== null) {\n params.set(currParamName, '')\n }\n // in ReactNative for example this would not be true (unless connected to the Remote Debugger)\n } else if (typeof location === 'object') {\n params = map.create(); // eslint-disable-next-line no-undef\n (location.search || '?').slice(1).split('&').forEach((kv) => {\n if (kv.length !== 0) {\n const [key, value] = kv.split('=')\n params.set(`--${string.fromCamelCase(key, '-')}`, value)\n params.set(`-${string.fromCamelCase(key, '-')}`, value)\n }\n })\n } else {\n params = map.create()\n }\n }\n return params\n}\n/* c8 ignore stop */\n\n/**\n * @param {string} name\n * @return {boolean}\n */\n/* c8 ignore next */\nexport const hasParam = (name) => computeParams().has(name)\n\n/**\n * @param {string} name\n * @param {string} defaultVal\n * @return {string}\n */\n/* c8 ignore next 2 */\nexport const getParam = (name, defaultVal) =>\n computeParams().get(name) || defaultVal\n\n/**\n * @param {string} name\n * @return {string|null}\n */\n/* c8 ignore next 4 */\nexport const getVariable = (name) =>\n isNode\n ? conditions.undefinedToNull(process.env[name.toUpperCase().replaceAll('-', '_')])\n : conditions.undefinedToNull(storage.varStorage.getItem(name))\n\n/**\n * @param {string} name\n * @return {string|null}\n */\n/* c8 ignore next 2 */\nexport const getConf = (name) =>\n computeParams().get('--' + name) || getVariable(name)\n\n/**\n * @param {string} name\n * @return {string}\n */\n/* c8 ignore next 5 */\nexport const ensureConf = (name) => {\n const c = getConf(name)\n if (c == null) throw new Error(`Expected configuration \"${name.toUpperCase().replaceAll('-', '_')}\"`)\n return c\n}\n\n/**\n * @param {string} name\n * @return {boolean}\n */\n/* c8 ignore next 2 */\nexport const hasConf = (name) =>\n hasParam('--' + name) || getVariable(name) !== null\n\n/* c8 ignore next */\nexport const production = hasConf('production')\n\n/* c8 ignore next 2 */\nconst forceColor = isNode &&\n f.isOneOf(process.env.FORCE_COLOR, ['true', '1', '2'])\n\n/* c8 ignore start */\n/**\n * Color is enabled by default if the terminal supports it.\n *\n * Explicitly enable color using `--color` parameter\n * Disable color using `--no-color` parameter or using `NO_COLOR=1` environment variable.\n * `FORCE_COLOR=1` enables color and takes precedence over all.\n */\nexport const supportsColor = forceColor || (\n !hasParam('--no-colors') && // @todo deprecate --no-colors\n !hasConf('no-color') &&\n (!isNode || process.stdout.isTTY) && (\n !isNode ||\n hasParam('--color') ||\n getVariable('COLORTERM') !== null ||\n (getVariable('TERM') || '').includes('color')\n )\n)\n/* c8 ignore stop */\n"],"names":["map.create","string.fromCamelCase","conditions.undefinedToNull","storage.varStorage","f.isOneOf"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACY,MAAC,MAAM,GAAG,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,OAAO,KAAK,WAAW,GAAG,OAAO,GAAG,CAAC,CAAC,KAAK,mBAAkB;AAC1N;AACA;AACY,MAAC,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,CAAC,OAAM;AACpG;AACY,MAAC,KAAK,GAAG,OAAO,SAAS,KAAK,WAAW;AACrD,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;AAClC,IAAI,MAAK;AACT;AACA;AACA;AACA;AACA,IAAI,OAAM;AAEV;AACA;AACA,MAAM,aAAa,GAAG,MAAM;AAC5B,EAAE,IAAI,MAAM,KAAK,SAAS,EAAE;AAC5B,IAAI,IAAI,MAAM,EAAE;AAChB,MAAM,MAAM,GAAGA,UAAU,GAAE;AAC3B,MAAM,MAAM,KAAK,GAAG,OAAO,CAAC,KAAI;AAChC,MAAM,IAAI,aAAa,GAAG,KAAI;AAC9B,MAAM,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC7C,QAAQ,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,EAAC;AAC7B,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;AAC7B,UAAU,IAAI,aAAa,KAAK,IAAI,EAAE;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AACA,MAAM,UAAU,GAAG,MAAM;AACzB,EAAEC,iBAAS,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,EAAC;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,aAAa,GAAG,UAAU;AACvC,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC;AAC1B,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC;AACtB,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;AACnC,IAAI,CAAC,MAAM;AACX,IAAI,QAAQ,CAAC,SAAS,CAAC;AACvB,IAAI,WAAW,CAAC,WAAW,CAAC,KAAK,IAAI;AACrC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,OAAO,CAAC;AACjD,GAAG;AACH,EAAC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/environment.cjs b/yjs-poll/node_modules/lib0/dist/environment.cjs deleted file mode 100644 index dc0c842..0000000 --- a/yjs-poll/node_modules/lib0/dist/environment.cjs +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./map-24d263c0.cjs'); -require('./string-fddc5f8b.cjs'); -require('./conditions-f5c0c102.cjs'); -require('./storage.cjs'); -require('./function-314580f7.cjs'); -var environment = require('./environment-1c97264d.cjs'); -require('./array-78849c95.cjs'); -require('./set-5b47859e.cjs'); -require('./object-c0c9435b.cjs'); -require('./equality.cjs'); - - - -exports.ensureConf = environment.ensureConf; -exports.getConf = environment.getConf; -exports.getParam = environment.getParam; -exports.getVariable = environment.getVariable; -exports.hasConf = environment.hasConf; -exports.hasParam = environment.hasParam; -exports.isBrowser = environment.isBrowser; -exports.isMac = environment.isMac; -exports.isNode = environment.isNode; -exports.production = environment.production; -exports.supportsColor = environment.supportsColor; -//# sourceMappingURL=environment.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/environment.cjs.map b/yjs-poll/node_modules/lib0/dist/environment.cjs.map deleted file mode 100644 index 8bb5bc4..0000000 --- a/yjs-poll/node_modules/lib0/dist/environment.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"environment.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/environment.d.ts b/yjs-poll/node_modules/lib0/dist/environment.d.ts deleted file mode 100644 index 9366538..0000000 --- a/yjs-poll/node_modules/lib0/dist/environment.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -export const isNode: boolean; -export const isBrowser: boolean; -export const isMac: boolean; -export function hasParam(name: string): boolean; -export function getParam(name: string, defaultVal: string): string; -export function getVariable(name: string): string | null; -export function getConf(name: string): string | null; -export function ensureConf(name: string): string; -export function hasConf(name: string): boolean; -export const production: boolean; -/** - * Color is enabled by default if the terminal supports it. - * - * Explicitly enable color using `--color` parameter - * Disable color using `--no-color` parameter or using `NO_COLOR=1` environment variable. - * `FORCE_COLOR=1` enables color and takes precedence over all. - */ -export const supportsColor: boolean; -//# sourceMappingURL=environment.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/environment.d.ts.map b/yjs-poll/node_modules/lib0/dist/environment.d.ts.map deleted file mode 100644 index 642f36d..0000000 --- a/yjs-poll/node_modules/lib0/dist/environment.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../environment.js"],"names":[],"mappings":"AAcA,6BAA0N;AAG1N,gCAAoG;AAEpG,4BAES;AAyDF,+BAJI,MAAM,GACL,OAAO,CAGwC;AAQpD,+BALI,MAAM,cACN,MAAM,GACL,MAAM,CAIuB;AAOlC,kCAJI,MAAM,GACL,MAAM,GAAC,IAAI,CAM2C;AAO3D,8BAJI,MAAM,GACL,MAAM,GAAC,IAAI,CAIgC;AAOhD,iCAJI,MAAM,GACL,MAAM,CAOjB;AAOM,8BAJI,MAAM,GACL,OAAO,CAIkC;AAGrD,iCAA+C;AAO/C;;;;;;GAMG;AACH,oCASC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/equality.cjs b/yjs-poll/node_modules/lib0/dist/equality.cjs deleted file mode 100644 index dc7d131..0000000 --- a/yjs-poll/node_modules/lib0/dist/equality.cjs +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -const EqualityTraitSymbol = Symbol('Equality'); - -/** - * @typedef {{ [EqualityTraitSymbol]:(other:EqualityTrait)=>boolean }} EqualityTrait - */ - -/** - * - * Utility function to compare any two objects. - * - * Note that it is expected that the first parameter is more specific than the latter one. - * - * @example js - * class X { [traits.EqualityTraitSymbol] (other) { return other === this } } - * class X2 { [traits.EqualityTraitSymbol] (other) { return other === this }, x2 () { return 2 } } - * // this is fine - * traits.equals(new X2(), new X()) - * // this is not, because the left type is less specific than the right one - * traits.equals(new X(), new X2()) - * - * @template {EqualityTrait} T - * @param {NoInfer} a - * @param {T} b - * @return {boolean} - */ -const equals = (a, b) => a === b || !!a?.[EqualityTraitSymbol]?.(b) || false; - -exports.EqualityTraitSymbol = EqualityTraitSymbol; -exports.equals = equals; -//# sourceMappingURL=equality.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/equality.cjs.map b/yjs-poll/node_modules/lib0/dist/equality.cjs.map deleted file mode 100644 index 8c7d72a..0000000 --- a/yjs-poll/node_modules/lib0/dist/equality.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"equality.cjs","sources":["../trait/equality.js"],"sourcesContent":["export const EqualityTraitSymbol = Symbol('Equality')\n\n/**\n * @typedef {{ [EqualityTraitSymbol]:(other:EqualityTrait)=>boolean }} EqualityTrait\n */\n\n/**\n *\n * Utility function to compare any two objects.\n *\n * Note that it is expected that the first parameter is more specific than the latter one.\n *\n * @example js\n * class X { [traits.EqualityTraitSymbol] (other) { return other === this } }\n * class X2 { [traits.EqualityTraitSymbol] (other) { return other === this }, x2 () { return 2 } }\n * // this is fine\n * traits.equals(new X2(), new X())\n * // this is not, because the left type is less specific than the right one\n * traits.equals(new X(), new X2())\n *\n * @template {EqualityTrait} T\n * @param {NoInfer} a\n * @param {T} b\n * @return {boolean}\n */\nexport const equals = (a, b) => a === b || !!a?.[EqualityTraitSymbol]?.(b) || false\n"],"names":[],"mappings":";;;;AAAY,MAAC,mBAAmB,GAAG,MAAM,CAAC,UAAU,EAAC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC,IAAI;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/error-0c1f634f.cjs b/yjs-poll/node_modules/lib0/dist/error-0c1f634f.cjs deleted file mode 100644 index e0a8429..0000000 --- a/yjs-poll/node_modules/lib0/dist/error-0c1f634f.cjs +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; - -/** - * Error helpers. - * - * @module error - */ - -/** - * @param {string} s - * @return {Error} - */ -/* c8 ignore next */ -const create = s => new Error(s); - -/** - * @throws {Error} - * @return {never} - */ -/* c8 ignore next 3 */ -const methodUnimplemented = () => { - throw create('Method unimplemented') -}; - -/** - * @throws {Error} - * @return {never} - */ -/* c8 ignore next 3 */ -const unexpectedCase = () => { - throw create('Unexpected case') -}; - -/** - * @param {boolean} property - * @return {asserts property is true} - */ -const assert = property => { if (!property) throw create('Assert failed') }; - -var error = /*#__PURE__*/Object.freeze({ - __proto__: null, - create: create, - methodUnimplemented: methodUnimplemented, - unexpectedCase: unexpectedCase, - assert: assert -}); - -exports.assert = assert; -exports.create = create; -exports.error = error; -exports.methodUnimplemented = methodUnimplemented; -exports.unexpectedCase = unexpectedCase; -//# sourceMappingURL=error-0c1f634f.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/error-0c1f634f.cjs.map b/yjs-poll/node_modules/lib0/dist/error-0c1f634f.cjs.map deleted file mode 100644 index 63f2a92..0000000 --- a/yjs-poll/node_modules/lib0/dist/error-0c1f634f.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"error-0c1f634f.cjs","sources":["../error.js"],"sourcesContent":["/**\n * Error helpers.\n *\n * @module error\n */\n\n/**\n * @param {string} s\n * @return {Error}\n */\n/* c8 ignore next */\nexport const create = s => new Error(s)\n\n/**\n * @throws {Error}\n * @return {never}\n */\n/* c8 ignore next 3 */\nexport const methodUnimplemented = () => {\n throw create('Method unimplemented')\n}\n\n/**\n * @throws {Error}\n * @return {never}\n */\n/* c8 ignore next 3 */\nexport const unexpectedCase = () => {\n throw create('Unexpected case')\n}\n\n/**\n * @param {boolean} property\n * @return {asserts property is true}\n */\nexport const assert = property => { if (!property) throw create('Assert failed') }\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,EAAC;AACvC;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,mBAAmB,GAAG,MAAM;AACzC,EAAE,MAAM,MAAM,CAAC,sBAAsB,CAAC;AACtC,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAG,MAAM;AACpC,EAAE,MAAM,MAAM,CAAC,iBAAiB,CAAC;AACjC,EAAC;AACD;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,QAAQ,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,MAAM,CAAC,eAAe,CAAC;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/error.cjs b/yjs-poll/node_modules/lib0/dist/error.cjs deleted file mode 100644 index 022e218..0000000 --- a/yjs-poll/node_modules/lib0/dist/error.cjs +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var error = require('./error-0c1f634f.cjs'); - - - -exports.assert = error.assert; -exports.create = error.create; -exports.methodUnimplemented = error.methodUnimplemented; -exports.unexpectedCase = error.unexpectedCase; -//# sourceMappingURL=error.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/error.cjs.map b/yjs-poll/node_modules/lib0/dist/error.cjs.map deleted file mode 100644 index a024bec..0000000 --- a/yjs-poll/node_modules/lib0/dist/error.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"error.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/error.d.ts b/yjs-poll/node_modules/lib0/dist/error.d.ts deleted file mode 100644 index e60d1b1..0000000 --- a/yjs-poll/node_modules/lib0/dist/error.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function create(s: string): Error; -export function methodUnimplemented(): never; -export function unexpectedCase(): never; -export function assert(property: boolean): asserts property is true; -//# sourceMappingURL=error.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/error.d.ts.map b/yjs-poll/node_modules/lib0/dist/error.d.ts.map deleted file mode 100644 index 9b25e95..0000000 --- a/yjs-poll/node_modules/lib0/dist/error.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../error.js"],"names":[],"mappings":"AAWO,0BAJI,MAAM,GACL,KAAK,CAGsB;AAOhC,uCAHK,KAAK,CAKhB;AAOM,kCAHK,KAAK,CAKhB;AAMM,iCAHI,OAAO,GACN,QAAQ,QAAQ,IAAI,IAAI,CAE8C"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/eventloop-a0168106.cjs b/yjs-poll/node_modules/lib0/dist/eventloop-a0168106.cjs deleted file mode 100644 index 313cb9e..0000000 --- a/yjs-poll/node_modules/lib0/dist/eventloop-a0168106.cjs +++ /dev/null @@ -1,151 +0,0 @@ -'use strict'; - -var time = require('./time-d8438852.cjs'); - -/* global requestIdleCallback, requestAnimationFrame, cancelIdleCallback, cancelAnimationFrame */ - -/** - * Utility module to work with EcmaScript's event loop. - * - * @module eventloop - */ - -/** - * @type {Array} - */ -let queue = []; - -const _runQueue = () => { - for (let i = 0; i < queue.length; i++) { - queue[i](); - } - queue = []; -}; - -/** - * @param {function():void} f - */ -const enqueue = f => { - queue.push(f); - if (queue.length === 1) { - setTimeout(_runQueue, 0); - } -}; - -/** - * @typedef {Object} TimeoutObject - * @property {function} TimeoutObject.destroy - */ - -/** - * @param {function(number):void} clearFunction - */ -const createTimeoutClass = clearFunction => class TT { - /** - * @param {number} timeoutId - */ - constructor (timeoutId) { - this._ = timeoutId; - } - - destroy () { - clearFunction(this._); - } -}; - -const Timeout = createTimeoutClass(clearTimeout); - -/** - * @param {number} timeout - * @param {function} callback - * @return {TimeoutObject} - */ -const timeout = (timeout, callback) => new Timeout(setTimeout(callback, timeout)); - -const Interval = createTimeoutClass(clearInterval); - -/** - * @param {number} timeout - * @param {function} callback - * @return {TimeoutObject} - */ -const interval = (timeout, callback) => new Interval(setInterval(callback, timeout)); - -/* c8 ignore next */ -const Animation = createTimeoutClass(arg => typeof requestAnimationFrame !== 'undefined' && cancelAnimationFrame(arg)); - -/** - * @param {function(number):void} cb - * @return {TimeoutObject} - */ -/* c8 ignore next */ -const animationFrame = cb => typeof requestAnimationFrame === 'undefined' ? timeout(0, cb) : new Animation(requestAnimationFrame(cb)); - -/* c8 ignore next */ -// @ts-ignore -const Idle = createTimeoutClass(arg => typeof cancelIdleCallback !== 'undefined' && cancelIdleCallback(arg)); - -/** - * Note: this is experimental and is probably only useful in browsers. - * - * @param {function} cb - * @return {TimeoutObject} - */ -/* c8 ignore next 2 */ -// @ts-ignore -const idleCallback = cb => typeof requestIdleCallback !== 'undefined' ? new Idle(requestIdleCallback(cb)) : timeout(1000, cb); - -/** - * @param {number} timeout Timeout of the debounce action - * @param {number} triggerAfter Optional. Trigger callback after a certain amount of time - * without waiting for debounce. - */ -const createDebouncer = (timeout, triggerAfter = -1) => { - let timer = -1; - /** - * @type {number?} - */ - let lastCall = null; - /** - * @param {((...args: any)=>void)?} cb function to trigger after debounce. If null, it will reset the - * debounce. - */ - return cb => { - clearTimeout(timer); - if (cb) { - if (triggerAfter >= 0) { - const now = time.getUnixTime(); - if (lastCall === null) lastCall = now; - if (now - lastCall > triggerAfter) { - lastCall = null; - timer = /** @type {any} */ (setTimeout(cb, 0)); - return - } - } - timer = /** @type {any} */ (setTimeout(() => { lastCall = null; cb(); }, timeout)); - } else { - lastCall = null; - } - } -}; - -var eventloop = /*#__PURE__*/Object.freeze({ - __proto__: null, - enqueue: enqueue, - timeout: timeout, - interval: interval, - Animation: Animation, - animationFrame: animationFrame, - idleCallback: idleCallback, - createDebouncer: createDebouncer -}); - -exports.Animation = Animation; -exports.animationFrame = animationFrame; -exports.createDebouncer = createDebouncer; -exports.enqueue = enqueue; -exports.eventloop = eventloop; -exports.idleCallback = idleCallback; -exports.interval = interval; -exports.timeout = timeout; -//# sourceMappingURL=eventloop-a0168106.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/eventloop-a0168106.cjs.map b/yjs-poll/node_modules/lib0/dist/eventloop-a0168106.cjs.map deleted file mode 100644 index 08f5a44..0000000 --- a/yjs-poll/node_modules/lib0/dist/eventloop-a0168106.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"eventloop-a0168106.cjs","sources":["../eventloop.js"],"sourcesContent":["/* global requestIdleCallback, requestAnimationFrame, cancelIdleCallback, cancelAnimationFrame */\n\nimport * as time from './time.js'\n\n/**\n * Utility module to work with EcmaScript's event loop.\n *\n * @module eventloop\n */\n\n/**\n * @type {Array}\n */\nlet queue = []\n\nconst _runQueue = () => {\n for (let i = 0; i < queue.length; i++) {\n queue[i]()\n }\n queue = []\n}\n\n/**\n * @param {function():void} f\n */\nexport const enqueue = f => {\n queue.push(f)\n if (queue.length === 1) {\n setTimeout(_runQueue, 0)\n }\n}\n\n/**\n * @typedef {Object} TimeoutObject\n * @property {function} TimeoutObject.destroy\n */\n\n/**\n * @param {function(number):void} clearFunction\n */\nconst createTimeoutClass = clearFunction => class TT {\n /**\n * @param {number} timeoutId\n */\n constructor (timeoutId) {\n this._ = timeoutId\n }\n\n destroy () {\n clearFunction(this._)\n }\n}\n\nconst Timeout = createTimeoutClass(clearTimeout)\n\n/**\n * @param {number} timeout\n * @param {function} callback\n * @return {TimeoutObject}\n */\nexport const timeout = (timeout, callback) => new Timeout(setTimeout(callback, timeout))\n\nconst Interval = createTimeoutClass(clearInterval)\n\n/**\n * @param {number} timeout\n * @param {function} callback\n * @return {TimeoutObject}\n */\nexport const interval = (timeout, callback) => new Interval(setInterval(callback, timeout))\n\n/* c8 ignore next */\nexport const Animation = createTimeoutClass(arg => typeof requestAnimationFrame !== 'undefined' && cancelAnimationFrame(arg))\n\n/**\n * @param {function(number):void} cb\n * @return {TimeoutObject}\n */\n/* c8 ignore next */\nexport const animationFrame = cb => typeof requestAnimationFrame === 'undefined' ? timeout(0, cb) : new Animation(requestAnimationFrame(cb))\n\n/* c8 ignore next */\n// @ts-ignore\nconst Idle = createTimeoutClass(arg => typeof cancelIdleCallback !== 'undefined' && cancelIdleCallback(arg))\n\n/**\n * Note: this is experimental and is probably only useful in browsers.\n *\n * @param {function} cb\n * @return {TimeoutObject}\n */\n/* c8 ignore next 2 */\n// @ts-ignore\nexport const idleCallback = cb => typeof requestIdleCallback !== 'undefined' ? new Idle(requestIdleCallback(cb)) : timeout(1000, cb)\n\n/**\n * @param {number} timeout Timeout of the debounce action\n * @param {number} triggerAfter Optional. Trigger callback after a certain amount of time\n * without waiting for debounce.\n */\nexport const createDebouncer = (timeout, triggerAfter = -1) => {\n let timer = -1\n /**\n * @type {number?}\n */\n let lastCall = null\n /**\n * @param {((...args: any)=>void)?} cb function to trigger after debounce. If null, it will reset the\n * debounce.\n */\n return cb => {\n clearTimeout(timer)\n if (cb) {\n if (triggerAfter >= 0) {\n const now = time.getUnixTime()\n if (lastCall === null) lastCall = now\n if (now - lastCall > triggerAfter) {\n lastCall = null\n timer = /** @type {any} */ (setTimeout(cb, 0))\n return\n }\n }\n timer = /** @type {any} */ (setTimeout(() => { lastCall = null; cb() }, timeout))\n } else {\n lastCall = null\n }\n }\n}\n"],"names":["time.getUnixTime"],"mappings":";;;;AAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,KAAK,GAAG,GAAE;AACd;AACA,MAAM,SAAS,GAAG,MAAM;AACxB,EAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACzC,IAAI,KAAK,CAAC,CAAC,CAAC,GAAE;AACd,GAAG;AACH,EAAE,KAAK,GAAG,GAAE;AACZ,EAAC;AACD;AACA;AACA;AACA;AACY,MAAC,OAAO,GAAG,CAAC,IAAI;AAC5B,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,EAAC;AACf,EAAE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;AAC1B,IAAI,UAAU,CAAC,SAAS,EAAE,CAAC,EAAC;AAC5B,GAAG;AACH,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,kBAAkB,GAAG,aAAa,IAAI,MAAM,EAAE,CAAC;AACrD;AACA;AACA;AACA,EAAE,WAAW,CAAC,CAAC,SAAS,EAAE;AAC1B,IAAI,IAAI,CAAC,CAAC,GAAG,UAAS;AACtB,GAAG;AACH;AACA,EAAE,OAAO,CAAC,GAAG;AACb,IAAI,aAAa,CAAC,I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AAG,CAAC,EAAC;AAChB;AACA;AACA;AACA,EAAE,IAAI,QAAQ,GAAG,KAAI;AACrB;AACA;AACA;AACA;AACA,EAAE,OAAO,EAAE,IAAI;AACf,IAAI,YAAY,CAAC,KAAK,EAAC;AACvB,IAAI,IAAI,EAAE,EAAE;AACZ,MAAM,IAAI,YAAY,IAAI,CAAC,EAAE;AAC7B,QAAQ,MAAM,GAAG,GAAGA,gBAAgB,GAAE;AACtC,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,QAAQ,GAAG,IAAG;AAC7C,QAAQ,IAAI,GAAG,GAAG,QAAQ,GAAG,YAAY,EAAE;AAC3C,UAAU,QAAQ,GAAG,KAAI;AACzB,UAAU,KAAK,uBAAuB,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,EAAC;AACxD,UAAU,MAAM;AAChB,SAAS;AACT,OAAO;AACP,MAAM,KAAK,uBAAuB,UAAU,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC,CAAC,EAAE,GAAE,EAAE,EAAE,OAAO,CAAC,EAAC;AACvF,KAAK,MAAM;AACX,MAAM,QAAQ,GAAG,KAAI;AACrB,KAAK;AACL,GAAG;AACH;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/eventloop.cjs b/yjs-poll/node_modules/lib0/dist/eventloop.cjs deleted file mode 100644 index b53bf14..0000000 --- a/yjs-poll/node_modules/lib0/dist/eventloop.cjs +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./time-d8438852.cjs'); -var eventloop = require('./eventloop-a0168106.cjs'); -require('./metric.cjs'); -require('./math-96d5e8c4.cjs'); - - - -exports.Animation = eventloop.Animation; -exports.animationFrame = eventloop.animationFrame; -exports.createDebouncer = eventloop.createDebouncer; -exports.enqueue = eventloop.enqueue; -exports.idleCallback = eventloop.idleCallback; -exports.interval = eventloop.interval; -exports.timeout = eventloop.timeout; -//# sourceMappingURL=eventloop.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/eventloop.cjs.map b/yjs-poll/node_modules/lib0/dist/eventloop.cjs.map deleted file mode 100644 index 0227967..0000000 --- a/yjs-poll/node_modules/lib0/dist/eventloop.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"eventloop.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/eventloop.d.ts b/yjs-poll/node_modules/lib0/dist/eventloop.d.ts deleted file mode 100644 index 73d266a..0000000 --- a/yjs-poll/node_modules/lib0/dist/eventloop.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -export function enqueue(f: () => void): void; -export function timeout(timeout: number, callback: Function): TimeoutObject; -export function interval(timeout: number, callback: Function): TimeoutObject; -export const Animation: { - new (timeoutId: number): { - _: number; - destroy(): void; - }; -}; -export function animationFrame(cb: (arg0: number) => void): TimeoutObject; -export function idleCallback(cb: Function): TimeoutObject; -export function createDebouncer(timeout: number, triggerAfter?: number): (cb: ((...args: any) => void) | null) => void; -export type TimeoutObject = { - destroy: Function; -}; -//# sourceMappingURL=eventloop.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/eventloop.d.ts.map b/yjs-poll/node_modules/lib0/dist/eventloop.d.ts.map deleted file mode 100644 index 900ed9e..0000000 --- a/yjs-poll/node_modules/lib0/dist/eventloop.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"eventloop.d.ts","sourceRoot":"","sources":["../eventloop.js"],"names":[],"mappings":"AAyBO,2BAFI,MAAW,IAAI,QAOzB;AA8BM,iCAJI,MAAM,uBAEL,aAAa,CAE+D;AASjF,kCAJI,MAAM,uBAEL,aAAa,CAEkE;AAG3F;oBA9Ba,MAAM;;;;EA8B0G;AAOtH,mCAJI,CAAS,IAAM,EAAN,MAAM,KAAE,IAAI,GACpB,aAAa,CAGmH;AAcrI,4CAJK,aAAa,CAI2G;AAO7H,yCAJI,MAAM,iBACN,MAAM,IAaR,IAHI,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,KAAG,IAAI,CAAC,OAGxB,UAiBV"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/eventloop.test.d.ts b/yjs-poll/node_modules/lib0/dist/eventloop.test.d.ts deleted file mode 100644 index a5ff2f2..0000000 --- a/yjs-poll/node_modules/lib0/dist/eventloop.test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export function testEventloopOrder(_tc: t.TestCase): Promise<[void, void]>; -export function testTimeout(_tc: t.TestCase): Promise; -export function testInterval(_tc: t.TestCase): Promise; -export function testAnimationFrame(_tc: t.TestCase): Promise; -export function testIdleCallback(_tc: t.TestCase): Promise; -export function testDebouncer(_tc: t.TestCase): Promise; -export function testDebouncerTriggerAfter(_tc: t.TestCase): Promise; -export function testDebouncerClear(_tc: t.TestCase): Promise; -import * as t from './testing.js'; -//# sourceMappingURL=eventloop.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/eventloop.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/eventloop.test.d.ts.map deleted file mode 100644 index b4c3cc1..0000000 --- a/yjs-poll/node_modules/lib0/dist/eventloop.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"eventloop.test.d.ts","sourceRoot":"","sources":["../eventloop.test.js"],"names":[],"mappings":"AAOO,wCAFI,CAAC,CAAC,QAAQ,yBAkBpB;AAKM,iCAFI,CAAC,CAAC,QAAQ,iBAYpB;AAKM,kCAFI,CAAC,CAAC,QAAQ,iBAepB;AAKM,wCAFI,CAAC,CAAC,QAAQ,iBAOpB;AAKM,sCAFI,CAAC,CAAC,QAAQ,iBAMpB;AAKM,mCAFI,CAAC,CAAC,QAAQ,iBAcpB;AAKM,+CAFI,CAAC,CAAC,QAAQ,iBAyBpB;AAKM,wCAFI,CAAC,CAAC,QAAQ,iBAyBpB;mBAnJkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/fingerprint.cjs b/yjs-poll/node_modules/lib0/dist/fingerprint.cjs deleted file mode 100644 index eb7305f..0000000 --- a/yjs-poll/node_modules/lib0/dist/fingerprint.cjs +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var encoding = require('./encoding-1a745c43.cjs'); -var rabin = require('./rabin.cjs'); -var buffer = require('./buffer-3e750729.cjs'); -require('./math-96d5e8c4.cjs'); -require('./number-1fb57bba.cjs'); -require('./binary-ac8e39e2.cjs'); -require('./string-fddc5f8b.cjs'); -require('./array-78849c95.cjs'); -require('./set-5b47859e.cjs'); -require('./map-24d263c0.cjs'); -require('./environment-1c97264d.cjs'); -require('./conditions-f5c0c102.cjs'); -require('./storage.cjs'); -require('./function-314580f7.cjs'); -require('./object-c0c9435b.cjs'); -require('./equality.cjs'); -require('./decoding-76e75827.cjs'); -require('./error-0c1f634f.cjs'); - -const FingerprintTraitSymbol = Symbol('Fingerprint'); - -/** - * When implementing this trait, it is recommended to write some sort of "magic number" first to - * ensure that different types of objects don't have the same fingerprint. - * - * The recommended pracice is to generate a random u32 number as your magic number. e.g. using - * `console.log(random.uint32().toString(16))` - * - * @typedef {{ [FingerprintTraitSymbol]:()=>string } | import('../encoding.js').AnyEncodable} Fingerprintable - */ - -/** - * @param {Fingerprintable} a - * @return {string} - */ -const fingerprint = a => (a != null && /** @type {any} */ (a)[FingerprintTraitSymbol]?.()) || buffer.toBase64(rabin.fingerprint(rabin.StandardIrreducible128, encoding.encode(encoder => { encoding.writeUint32(encoder, 0x8de1c475); encoding.writeAny(encoder, a); }))); - -exports.FingerprintTraitSymbol = FingerprintTraitSymbol; -exports.fingerprint = fingerprint; -//# sourceMappingURL=fingerprint.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/fingerprint.cjs.map b/yjs-poll/node_modules/lib0/dist/fingerprint.cjs.map deleted file mode 100644 index d29864b..0000000 --- a/yjs-poll/node_modules/lib0/dist/fingerprint.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fingerprint.cjs","sources":["../trait/fingerprint.js"],"sourcesContent":["import * as encoding from '../encoding.js'\nimport * as rabin from '../hash/rabin.js'\nimport * as buffer from '../buffer.js'\n\nexport const FingerprintTraitSymbol = Symbol('Fingerprint')\n\n/**\n * When implementing this trait, it is recommended to write some sort of \"magic number\" first to\n * ensure that different types of objects don't have the same fingerprint.\n *\n * The recommended pracice is to generate a random u32 number as your magic number. e.g. using\n * `console.log(random.uint32().toString(16))`\n *\n * @typedef {{ [FingerprintTraitSymbol]:()=>string } | import('../encoding.js').AnyEncodable} Fingerprintable\n */\n\n/**\n * @param {Fingerprintable} a\n * @return {string}\n */\nexport const fingerprint = a => (a != null && /** @type {any} */ (a)[FingerprintTraitSymbol]?.()) || buffer.toBase64(rabin.fingerprint(rabin.StandardIrreducible128, encoding.encode(encoder => { encoding.writeUint32(encoder, 0x8de1c475); encoding.writeAny(encoder, a) })))\n"],"names":["buffer.toBase64","rabin.fingerprint","rabin.StandardIrreducible128","encoding.encode","encoding.writeUint32","encoding.writeAny"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAIY,MAAC,sBAAsB,GAAG,MAAM,CAAC,aAAa,EAAC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,WAAW,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,uBAAuB,CAAC,CAAC,EAAE,sBAAsB,CAAC,IAAI,KAAKA,eAAe,CAACC,iBAAiB,CAACC,4BAA4B,EAAEC,eAAe,CAAC,OAAO,IAAI,EAAEC,oBAAoB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAACC,iBAAiB,CAAC,OAAO,EAAE,CAAC,EAAC,EAAE,CAAC,CAAC;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/function-314580f7.cjs b/yjs-poll/node_modules/lib0/dist/function-314580f7.cjs deleted file mode 100644 index a4336f0..0000000 --- a/yjs-poll/node_modules/lib0/dist/function-314580f7.cjs +++ /dev/null @@ -1,223 +0,0 @@ -'use strict'; - -var array = require('./array-78849c95.cjs'); -var object = require('./object-c0c9435b.cjs'); -var equality = require('./equality.cjs'); - -/** - * Common functions and function call helpers. - * - * @module function - */ - -/** - * Calls all functions in `fs` with args. Only throws after all functions were called. - * - * @param {Array} fs - * @param {Array} args - */ -const callAll = (fs, args, i = 0) => { - try { - for (; i < fs.length; i++) { - fs[i](...args); - } - } finally { - if (i < fs.length) { - callAll(fs, args, i + 1); - } - } -}; - -const nop = () => {}; - -/** - * @template T - * @param {function():T} f - * @return {T} - */ -const apply = f => f(); - -/** - * @template A - * - * @param {A} a - * @return {A} - */ -const id = a => a; - -/** - * @template T - * - * @param {T} a - * @param {T} b - * @return {boolean} - */ -const equalityStrict = (a, b) => a === b; - -/** - * @template T - * - * @param {Array|object} a - * @param {Array|object} b - * @return {boolean} - */ -const equalityFlat = (a, b) => a === b || (a != null && b != null && a.constructor === b.constructor && ((array.isArray(a) && array.equalFlat(a, /** @type {Array} */ (b))) || (typeof a === 'object' && object.equalFlat(a, b)))); - -/* c8 ignore start */ - -/** - * @param {any} a - * @param {any} b - * @return {boolean} - */ -const equalityDeep = (a, b) => { - if (a === b) { - return true - } - if (a == null || b == null || (a.constructor !== b.constructor && (a.constructor || Object) !== (b.constructor || Object))) { - return false - } - if (a[equality.EqualityTraitSymbol] != null) { - return a[equality.EqualityTraitSymbol](b) - } - switch (a.constructor) { - case ArrayBuffer: - a = new Uint8Array(a); - b = new Uint8Array(b); - // eslint-disable-next-line no-fallthrough - case Uint8Array: { - if (a.byteLength !== b.byteLength) { - return false - } - for (let i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false - } - } - break - } - case Set: { - if (a.size !== b.size) { - return false - } - for (const value of a) { - if (!b.has(value)) { - return false - } - } - break - } - case Map: { - if (a.size !== b.size) { - return false - } - for (const key of a.keys()) { - if (!b.has(key) || !equalityDeep(a.get(key), b.get(key))) { - return false - } - } - break - } - case undefined: - case Object: - if (object.size(a) !== object.size(b)) { - return false - } - for (const key in a) { - if (!object.hasProperty(a, key) || !equalityDeep(a[key], b[key])) { - return false - } - } - break - case Array: - if (a.length !== b.length) { - return false - } - for (let i = 0; i < a.length; i++) { - if (!equalityDeep(a[i], b[i])) { - return false - } - } - break - default: - return false - } - return true -}; - -/** - * @template V - * @template {V} OPTS - * - * @param {V} value - * @param {Array} options - */ -// @ts-ignore -const isOneOf = (value, options) => options.includes(value); -/* c8 ignore stop */ - -const isArray = array.isArray; - -/** - * @param {any} s - * @return {s is String} - */ -const isString = (s) => s && s.constructor === String; - -/** - * @param {any} n - * @return {n is Number} - */ -const isNumber = n => n != null && n.constructor === Number; - -/** - * @template {abstract new (...args: any) => any} TYPE - * @param {any} n - * @param {TYPE} T - * @return {n is InstanceType} - */ -const is = (n, T) => n && n.constructor === T; - -/** - * @template {abstract new (...args: any) => any} TYPE - * @param {TYPE} T - */ -const isTemplate = (T) => - /** - * @param {any} n - * @return {n is InstanceType} - **/ - n => n && n.constructor === T; - -var _function = /*#__PURE__*/Object.freeze({ - __proto__: null, - callAll: callAll, - nop: nop, - apply: apply, - id: id, - equalityStrict: equalityStrict, - equalityFlat: equalityFlat, - equalityDeep: equalityDeep, - isOneOf: isOneOf, - isArray: isArray, - isString: isString, - isNumber: isNumber, - is: is, - isTemplate: isTemplate -}); - -exports._function = _function; -exports.apply = apply; -exports.callAll = callAll; -exports.equalityDeep = equalityDeep; -exports.equalityFlat = equalityFlat; -exports.equalityStrict = equalityStrict; -exports.id = id; -exports.is = is; -exports.isArray = isArray; -exports.isNumber = isNumber; -exports.isOneOf = isOneOf; -exports.isString = isString; -exports.isTemplate = isTemplate; -exports.nop = nop; -//# sourceMappingURL=function-314580f7.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/function-314580f7.cjs.map b/yjs-poll/node_modules/lib0/dist/function-314580f7.cjs.map deleted file mode 100644 index 886a689..0000000 --- a/yjs-poll/node_modules/lib0/dist/function-314580f7.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"function-314580f7.cjs","sources":["../function.js"],"sourcesContent":["/**\n * Common functions and function call helpers.\n *\n * @module function\n */\n\nimport * as array from './array.js'\nimport * as object from './object.js'\nimport * as equalityTrait from './trait/equality.js'\n\n/**\n * Calls all functions in `fs` with args. Only throws after all functions were called.\n *\n * @param {Array} fs\n * @param {Array} args\n */\nexport const callAll = (fs, args, i = 0) => {\n try {\n for (; i < fs.length; i++) {\n fs[i](...args)\n }\n } finally {\n if (i < fs.length) {\n callAll(fs, args, i + 1)\n }\n }\n}\n\nexport const nop = () => {}\n\n/**\n * @template T\n * @param {function():T} f\n * @return {T}\n */\nexport const apply = f => f()\n\n/**\n * @template A\n *\n * @param {A} a\n * @return {A}\n */\nexport const id = a => a\n\n/**\n * @template T\n *\n * @param {T} a\n * @param {T} b\n * @return {boolean}\n */\nexport const equalityStrict = (a, b) => a === b\n\n/**\n * @template T\n *\n * @param {Array|object} a\n * @param {Array|object} b\n * @return {boolean}\n */\nexport const equalityFlat = (a, b) => a === b || (a != null && b != null && a.constructor === b.constructor && ((array.isArray(a) && array.equalFlat(a, /** @type {Array} */ (b))) || (typeof a === 'object' && object.equalFlat(a, b))))\n\n/* c8 ignore start */\n\n/**\n * @param {any} a\n * @param {any} b\n * @return {boolean}\n */\nexport const equalityDeep = (a, b) => {\n if (a === b) {\n return true\n }\n if (a == null || b == null || (a.constructor !== b.constructor && (a.constructor || Object) !== (b.constructor || Object))) {\n return false\n }\n if (a[equalityTrait.EqualityTraitSymbol] != null) {\n return a[equalityTrait.EqualityTraitSymbol](b)\n }\n switch (a.constructor) {\n case ArrayBuffer:\n a = new Uint8Array(a)\n b = new Uint8Array(b)\n // eslint-disable-next-line no-fallthrough\n case Uint8Array: {\n if (a.byteLength !== b.byteLength) {\n return false\n }\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false\n }\n }\n break\n }\n case Set: {\n if (a.size !== b.size) {\n return false\n }\n for (const value of a) {\n if (!b.has(value)) {\n return false\n }\n }\n break\n }\n case Map: {\n if (a.size !== b.size) {\n return false\n }\n for (const key of a.keys()) {\n if (!b.has(key) || !equalityDeep(a.get(key), b.get(key))) {\n return false\n }\n }\n break\n }\n case undefined:\n case Object:\n if (object.size(a) !== object.size(b)) {\n return false\n }\n for (const key in a) {\n if (!object.hasProperty(a, key) || !equalityDeep(a[key], b[key])) {\n return false\n }\n }\n break\n case Array:\n if (a.length !== b.length) {\n return false\n }\n for (let i = 0; i < a.length; i++) {\n if (!equalityDeep(a[i], b[i])) {\n return false\n }\n }\n break\n default:\n return false\n }\n return true\n}\n\n/**\n * @template V\n * @template {V} OPTS\n *\n * @param {V} value\n * @param {Array} options\n */\n// @ts-ignore\nexport const isOneOf = (value, options) => options.includes(value)\n/* c8 ignore stop */\n\nexport const isArray = array.isArray\n\n/**\n * @param {any} s\n * @return {s is String}\n */\nexport const isString = (s) => s && s.constructor === String\n\n/**\n * @param {any} n\n * @return {n is Number}\n */\nexport const isNumber = n => n != null && n.constructor === Number\n\n/**\n * @template {abstract new (...args: any) => any} TYPE\n * @param {any} n\n * @param {TYPE} T\n * @return {n is InstanceType}\n */\nexport const is = (n, T) => n && n.constructor === T\n\n/**\n * @template {abstract new (...args: any) => any} TYPE\n * @param {TYPE} T\n */\nexport const isTemplate = (T) =>\n /**\n * @param {any} n\n * @return {n is InstanceType}\n **/\n n => n && n.constructor === T\n"],"names":["array.isArray","array.equalFlat","object.equalFlat","equalityTrait.EqualityTraitSymbol","object.size","object.hasProperty"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,OAAO,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,KAAK;AAC5C,EAAE,IAAI;AACN,IAAI,OAA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AACP,MAAM,KAAK;AACX,IAAI;AACJ,MAAM,OAAO,KAAK;AAClB,GAAG;AACH,EAAE,OAAO,IAAI;AACb,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,OAAO,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAC;AAClE;AACA;AACY,MAAC,OAAO,GAAGL,cAAa;AACpC;AACA;AACA;AACA;AACA;AACY,MAAC,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,WAAW,KAAK,OAAM;AAC5D;AACA;AACA;AACA;AACA;AACY,MAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,WAAW,KAAK,OAAM;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,WAAW,KAAK,EAAC;AACpD;AACA;AACA;AACA;AACA;AACY,MAAC,UAAU,GAAG,CAAC,CAAC;AAC5B;AACA;AACA;AACA;AACA,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/function.cjs b/yjs-poll/node_modules/lib0/dist/function.cjs deleted file mode 100644 index 54c3daa..0000000 --- a/yjs-poll/node_modules/lib0/dist/function.cjs +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./array-78849c95.cjs'); -require('./object-c0c9435b.cjs'); -require('./equality.cjs'); -var _function = require('./function-314580f7.cjs'); -require('./set-5b47859e.cjs'); - - - -exports.apply = _function.apply; -exports.callAll = _function.callAll; -exports.equalityDeep = _function.equalityDeep; -exports.equalityFlat = _function.equalityFlat; -exports.equalityStrict = _function.equalityStrict; -exports.id = _function.id; -exports.is = _function.is; -exports.isArray = _function.isArray; -exports.isNumber = _function.isNumber; -exports.isOneOf = _function.isOneOf; -exports.isString = _function.isString; -exports.isTemplate = _function.isTemplate; -exports.nop = _function.nop; -//# sourceMappingURL=function.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/function.cjs.map b/yjs-poll/node_modules/lib0/dist/function.cjs.map deleted file mode 100644 index 52c4808..0000000 --- a/yjs-poll/node_modules/lib0/dist/function.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"function.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/function.d.ts b/yjs-poll/node_modules/lib0/dist/function.d.ts deleted file mode 100644 index 1bd353e..0000000 --- a/yjs-poll/node_modules/lib0/dist/function.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -export function callAll(fs: Array, args: Array, i?: number): void; -export function nop(): void; -export function apply(f: () => T): T; -export function id
(a: A): A; -export function equalityStrict(a: T, b: T): boolean; -export function equalityFlat(a: Array | object, b: Array | object): boolean; -export function equalityDeep(a: any, b: any): boolean; -export function isOneOf(value: V, options: Array): boolean; -export const isArray: (arg: any) => arg is any[]; -export function isString(s: any): s is string; -export function isNumber(n: any): n is number; -export function is any>(n: any, T: TYPE): n is InstanceType; -export function isTemplate any>(T: TYPE): ( -/** - * @param {any} n - * @return {n is InstanceType} - **/ -n: any) => n is InstanceType; -//# sourceMappingURL=function.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/function.d.ts.map b/yjs-poll/node_modules/lib0/dist/function.d.ts.map deleted file mode 100644 index 9638b0d..0000000 --- a/yjs-poll/node_modules/lib0/dist/function.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../function.js"],"names":[],"mappings":"AAgBO,4BAHI,KAAK,UAAU,QACf,KAAK,CAAC,GAAG,CAAC,oBAYpB;AAEM,4BAAoB;AAOpB,sBAJM,CAAC,KACH,MAAW,CAAC,GACX,CAAC,CAEgB;AAQtB,mBALM,CAAC,KAEH,CAAC,GACA,CAAC,CAEW;AASjB,+BANM,CAAC,KAEH,CAAC,KACD,CAAC,GACA,OAAO,CAE4B;AASxC,6BANM,CAAC,KAEH,KAAK,CAAC,CAAC,CAAC,GAAC,MAAM,KACf,KAAK,CAAC,CAAC,CAAC,GAAC,MAAM,GACd,OAAO,CAEyN;AASrO,gCAJI,GAAG,KACH,GAAG,GACF,OAAO,CA2ElB;AAUM,wBAPM,CAAC,EACG,IAAI,SAAP,CAAE,SAEL,CAAC,WACD,KAAK,CAAC,IAAI,CAAC,WAG4C;AAGlE,iDAAoC;AAM7B,4BAHI,GAAG,GACF,CAAC,UAAU,CAEqC;AAMrD,4BAHI,GAAG,GACF,CAAC,UAAU,CAE2C;AAQ3D,mBAL2C,IAAI,SAAxC,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,KAAK,GAAI,KACtC,GAAG,KACH,IAAI,GACH,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,CAEiB;AAM7C,2BAH2C,IAAI,SAAxC,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,KAAK,GAAI,KACtC,IAAI;AAGb;;;IAGI;AACJ,GAHW,GAGV,KAFW,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,CAEN"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/function.test.d.ts b/yjs-poll/node_modules/lib0/dist/function.test.d.ts deleted file mode 100644 index 8d7b277..0000000 --- a/yjs-poll/node_modules/lib0/dist/function.test.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function testBasics(_tc: t.TestCase): void; -export function testCallAll(_tc: t.TestCase): void; -export function testDeepEquality(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=function.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/function.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/function.test.d.ts.map deleted file mode 100644 index e2a1d49..0000000 --- a/yjs-poll/node_modules/lib0/dist/function.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"function.test.d.ts","sourceRoot":"","sources":["../function.test.js"],"names":[],"mappings":"AAMO,gCAFI,CAAC,CAAC,QAAQ,QA+CpB;AAKM,iCAFI,CAAC,CAAC,QAAQ,QAuBpB;AAKM,sCAFI,CAAC,CAAC,QAAQ,QAkEpB;mBAjJkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/hash/rabin-gf2-polynomial.d.ts b/yjs-poll/node_modules/lib0/dist/hash/rabin-gf2-polynomial.d.ts deleted file mode 100644 index d6d03d6..0000000 --- a/yjs-poll/node_modules/lib0/dist/hash/rabin-gf2-polynomial.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * This is a GF2 Polynomial abstraction that is not meant for production! - * - * It is easy to understand and it's correctness is as obvious as possible. It can be used to verify - * efficient implementations of algorithms on GF2. - */ -export class GF2Polynomial { - /** - * @type {Set} - */ - degrees: Set; -} -export function createFromBytes(bytes: Uint8Array): GF2Polynomial; -export function toUint8Array(p: GF2Polynomial, byteLength?: number): Uint8Array; -export function createFromUint(uint: number): GF2Polynomial; -export function createRandom(degree: number): GF2Polynomial; -export function getHighestDegree(p: GF2Polynomial): number; -export function addInto(p1: GF2Polynomial, p2: GF2Polynomial): void; -export function orInto(p1: GF2Polynomial, p2: GF2Polynomial): void; -export function add(p1: GF2Polynomial, p2: GF2Polynomial): GF2Polynomial; -export function clone(p: GF2Polynomial): GF2Polynomial; -export function addDegreeInto(p: GF2Polynomial, degree: number): void; -export function multiply(p1: GF2Polynomial, p2: GF2Polynomial): GF2Polynomial; -export function shiftLeft(p: GF2Polynomial, shift: number): GF2Polynomial; -export function mod(p1: GF2Polynomial, p2: GF2Polynomial): GF2Polynomial; -export function modPow(p: GF2Polynomial, e: number, m: GF2Polynomial): GF2Polynomial; -export function gcd(p1: GF2Polynomial, p2: GF2Polynomial): GF2Polynomial; -export function equals(p1: GF2Polynomial, p2: GF2Polynomial): boolean; -export function isIrreducibleBenOr(p: GF2Polynomial): boolean; -export function createIrreducible(degree: number): GF2Polynomial; -export function fingerprint(buf: Uint8Array, m: GF2Polynomial): Uint8Array; -export class RabinPolynomialEncoder { - /** - * @param {GF2Polynomial} m The irreducible polynomial - */ - constructor(m: GF2Polynomial); - fingerprint: GF2Polynomial; - m: GF2Polynomial; - /** - * @param {number} b - */ - write(b: number): void; - getFingerprint(): Uint8Array; -} -//# sourceMappingURL=rabin-gf2-polynomial.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/hash/rabin-gf2-polynomial.d.ts.map b/yjs-poll/node_modules/lib0/dist/hash/rabin-gf2-polynomial.d.ts.map deleted file mode 100644 index 4fa40ef..0000000 --- a/yjs-poll/node_modules/lib0/dist/hash/rabin-gf2-polynomial.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rabin-gf2-polynomial.d.ts","sourceRoot":"","sources":["../../hash/rabin-gf2-polynomial.js"],"names":[],"mappings":"AAqBA;;;;;GAKG;AACH;IAEI;;QAEI;IACJ,SAFW,GAAG,CAAC,MAAM,CAAC,CAEE;CAE3B;AAOM,uCAFI,UAAU,iBAcpB;AAQM,gCAHI,aAAa,eACb,MAAM,2BAahB;AAOM,qCAFI,MAAM,iBAQhB;AAOM,qCAFI,MAAM,iBAYhB;AAMM,oCAHI,aAAa,UAG2D;AAU5E,4BAHI,aAAa,MACb,aAAa,QAUvB;AAUM,2BAHI,aAAa,MACb,aAAa,QAMvB;AAUM,wBAHI,aAAa,MACb,aAAa,iBAevB;AASM,yBAFI,aAAa,iBAMvB;AAUM,iCAHI,aAAa,UACb,MAAM,QAQhB;AAQM,6BAHI,aAAa,MACb,aAAa,iBAUvB;AAQM,6BAHI,aAAa,SACb,MAAM,iBAShB;AAQM,wBAHI,aAAa,MACb,aAAa,iBAavB;AAWM,0BAJI,aAAa,KACb,MAAM,KACN,aAAa,iBAcvB;AAQM,wBAHI,aAAa,MACb,aAAa,iBASvB;AAQM,2BAHI,aAAa,MACb,aAAa,WAQvB;AAgCM,sCAFI,aAAa,WAYvB;AAKM,0CAFI,MAAM,iBAOhB;AAQM,iCAHI,UAAU,KACV,aAAa,2BAE0G;AAElI;IACE;;OAEG;IACH,eAFW,aAAa,EAKvB;IAFC,2BAAsC;IACtC,iBAAU;IAGZ;;OAEG;IACH,SAFW,MAAM,QAOhB;IAED,0CAEC;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/hash/rabin-uncached.d.ts b/yjs-poll/node_modules/lib0/dist/hash/rabin-uncached.d.ts deleted file mode 100644 index 5adc6e2..0000000 --- a/yjs-poll/node_modules/lib0/dist/hash/rabin-uncached.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -export class RabinUncachedEncoder { - /** - * @param {Uint8Array} m assert(m[0] === 1) - */ - constructor(m: Uint8Array); - m: Uint8Array; - blen: number; - bs: Uint8Array; - /** - * This describes the position of the most significant byte (starts with 0 and increases with - * shift) - */ - bpos: number; - /** - * Add/Xor/Substract bytes. - * - * Discards bytes that are out of range. - * @todo put this in function or inline - * - * @param {Uint8Array} cs - */ - add(cs: Uint8Array): void; - /** - * @param {number} byte - */ - write(byte: number): void; - getFingerprint(): Uint8Array; -} -//# sourceMappingURL=rabin-uncached.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/hash/rabin-uncached.d.ts.map b/yjs-poll/node_modules/lib0/dist/hash/rabin-uncached.d.ts.map deleted file mode 100644 index 07e69c2..0000000 --- a/yjs-poll/node_modules/lib0/dist/hash/rabin-uncached.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rabin-uncached.d.ts","sourceRoot":"","sources":["../../hash/rabin-uncached.js"],"names":[],"mappings":"AAUA;IACE;;OAEG;IACH,eAFW,UAAU,EAWpB;IARC,+BAAU;IACV,aAAwB;IACxB,4BAAmC;IACnC;;;OAGG;IACH,aAAa;IAGf;;;;;;;OAOG;IACH,QAFW,UAAU,QAQpB;IAED;;OAEG;IACH,YAFW,MAAM,QAgBhB;IAED,0CAMC;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/hash/rabin.d.ts b/yjs-poll/node_modules/lib0/dist/hash/rabin.d.ts deleted file mode 100644 index cd3061a..0000000 --- a/yjs-poll/node_modules/lib0/dist/hash/rabin.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -export const StandardIrreducible8: Uint8Array; -export const StandardIrreducible16: Uint8Array; -export const StandardIrreducible32: Uint8Array; -export const StandardIrreducible64: Uint8Array; -export const StandardIrreducible128: Uint8Array; -export class RabinEncoder { - /** - * @param {Uint8Array} m assert(m[0] === 1) - */ - constructor(m: Uint8Array); - m: Uint8Array; - blen: number; - bs: Uint8Array; - cache: Uint8Array; - /** - * This describes the position of the most significant byte (starts with 0 and increases with - * shift) - */ - bpos: number; - /** - * @param {number} byte - */ - write(byte: number): void; - getFingerprint(): Uint8Array; -} -export function fingerprint(irreducible: Uint8Array, data: Uint8Array): Uint8Array; -//# sourceMappingURL=rabin.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/hash/rabin.d.ts.map b/yjs-poll/node_modules/lib0/dist/hash/rabin.d.ts.map deleted file mode 100644 index c8d2659..0000000 --- a/yjs-poll/node_modules/lib0/dist/hash/rabin.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rabin.d.ts","sourceRoot":"","sources":["../../hash/rabin.js"],"names":[],"mappings":"AAUA,2DAA4D;AAC5D,4DAAkE;AAClE,4DAA4E;AAC5E,4DAA+F;AAC/F,6DAAmI;AAmCnI;IACE;;OAEG;IACH,eAFW,UAAU,EAYpB;IATC,+BAAU;IACV,aAAwB;IACxB,4BAAmC;IACnC,+BAA2B;IAC3B;;;OAGG;IACH,aAAa;IAGf;;OAEG;IACH,YAFW,MAAM,QAYhB;IAED,0CAMC;CACF;AAMM,yCAHI,UAAU,QACV,UAAU,2BAQpB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/hash/rabin.test.d.ts b/yjs-poll/node_modules/lib0/dist/hash/rabin.test.d.ts deleted file mode 100644 index 6ed6dd5..0000000 --- a/yjs-poll/node_modules/lib0/dist/hash/rabin.test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export function testPolynomialBasics(_tc: t.TestCase): void; -export function testIrreducibleInput(_tc: t.TestCase): void; -export function testIrreducibleSpread(_tc: t.TestCase): void; -export function testGenerateIrreducibles(_tc: t.TestCase): void; -export function testFingerprintCompatiblity(tc: t.TestCase): void; -export function testConflicts(tc: t.TestCase): void; -import * as t from '../testing.js'; -//# sourceMappingURL=rabin.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/hash/rabin.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/hash/rabin.test.d.ts.map deleted file mode 100644 index aa81148..0000000 --- a/yjs-poll/node_modules/lib0/dist/hash/rabin.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rabin.test.d.ts","sourceRoot":"","sources":["../../hash/rabin.test.js"],"names":[],"mappings":"AAaO,0CAFI,CAAC,CAAC,QAAQ,QASpB;AAKM,0CAFI,CAAC,CAAC,QAAQ,QAapB;AAKM,2CAFI,CAAC,CAAC,QAAQ,QASpB;AAwBM,8CAFI,CAAC,CAAC,QAAQ,QAyBpB;AAmGM,gDAFI,CAAC,CAAC,QAAQ,QAQpB;AAKM,kCAFI,CAAC,CAAC,QAAQ,QA4BpB;mBAvOkB,eAAe"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/hash/sha256.d.ts b/yjs-poll/node_modules/lib0/dist/hash/sha256.d.ts deleted file mode 100644 index b3014a7..0000000 --- a/yjs-poll/node_modules/lib0/dist/hash/sha256.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export function digest(data: Uint8Array): Uint8Array; -//# sourceMappingURL=sha256.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/hash/sha256.d.ts.map b/yjs-poll/node_modules/lib0/dist/hash/sha256.d.ts.map deleted file mode 100644 index 64428a3..0000000 --- a/yjs-poll/node_modules/lib0/dist/hash/sha256.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha256.d.ts","sourceRoot":"","sources":["../../hash/sha256.js"],"names":[],"mappings":"AA+KO,6BAFI,UAAU,2BAEkC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/hash/sha256.node.d.ts b/yjs-poll/node_modules/lib0/dist/hash/sha256.node.d.ts deleted file mode 100644 index e5e6591..0000000 --- a/yjs-poll/node_modules/lib0/dist/hash/sha256.node.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export function digest(data: Uint8Array): Buffer; -//# sourceMappingURL=sha256.node.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/hash/sha256.node.d.ts.map b/yjs-poll/node_modules/lib0/dist/hash/sha256.node.d.ts.map deleted file mode 100644 index 6b3af1b..0000000 --- a/yjs-poll/node_modules/lib0/dist/hash/sha256.node.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha256.node.d.ts","sourceRoot":"","sources":["../../hash/sha256.node.js"],"names":[],"mappings":"AAKO,6BAFI,UAAU,2BAMpB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/hash/sha256.test.d.ts b/yjs-poll/node_modules/lib0/dist/hash/sha256.test.d.ts deleted file mode 100644 index 39fc538..0000000 --- a/yjs-poll/node_modules/lib0/dist/hash/sha256.test.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function testSelfReferencingHash(_tc: t.TestCase): void; -export function testSha256Basics(_tc: t.TestCase): Promise; -export function testLargeValue(_tc: t.TestCase): Promise; -export function testRepeatSha256Hashing(tc: t.TestCase): Promise; -export function testBenchmarkSha256(_tc: t.TestCase): Promise; -import * as t from '../testing.js'; -//# sourceMappingURL=sha256.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/hash/sha256.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/hash/sha256.test.d.ts.map deleted file mode 100644 index 3174ccd..0000000 --- a/yjs-poll/node_modules/lib0/dist/hash/sha256.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha256.test.d.ts","sourceRoot":"","sources":["../../hash/sha256.test.js"],"names":[],"mappings":"AAcO,6CAFI,CAAC,CAAC,QAAQ,QAKpB;AAKM,sCAFI,CAAC,CAAC,QAAQ,iBA2BpB;AAOM,oCAFI,CAAC,CAAC,QAAQ,iBA4BpB;AAKM,4CAFI,CAAC,CAAC,QAAQ,iBAQpB;AAKM,yCAFI,CAAC,CAAC,QAAQ,iBAmDpB;mBAjJkB,eAAe"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/index.cjs b/yjs-poll/node_modules/lib0/dist/index.cjs deleted file mode 100644 index 0070288..0000000 --- a/yjs-poll/node_modules/lib0/dist/index.cjs +++ /dev/null @@ -1,99 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var array = require('./array-78849c95.cjs'); -var binary = require('./binary-ac8e39e2.cjs'); -var broadcastchannel = require('./broadcastchannel-aca4f606.cjs'); -var buffer = require('./buffer-3e750729.cjs'); -var conditions = require('./conditions-f5c0c102.cjs'); -var decoding = require('./decoding-76e75827.cjs'); -var diff = require('./diff-9d236524.cjs'); -var dom = require('./dom-7e625b09.cjs'); -var encoding = require('./encoding-1a745c43.cjs'); -var environment = require('./environment-1c97264d.cjs'); -var error = require('./error-0c1f634f.cjs'); -var eventloop = require('./eventloop-a0168106.cjs'); -var _function = require('./function-314580f7.cjs'); -var indexeddb = require('./indexeddb-46d1e737.cjs'); -var iterator = require('./iterator-9fc627c1.cjs'); -var json = require('./json-092190a1.cjs'); -var log = require('lib0/logging'); -var map = require('./map-24d263c0.cjs'); -var math = require('./math-96d5e8c4.cjs'); -var mutex = require('./mutex-63f09c81.cjs'); -var number = require('./number-1fb57bba.cjs'); -var object = require('./object-c0c9435b.cjs'); -var pair = require('./pair-ab022bc3.cjs'); -var prng = require('./prng-37d48618.cjs'); -var promise = require('./promise-cda7b9bb.cjs'); -var set = require('./set-5b47859e.cjs'); -var sort = require('./sort-812cc211.cjs'); -var statistics = require('./statistics-65f6114b.cjs'); -var string = require('./string-fddc5f8b.cjs'); -var symbol = require('./symbol-9c439012.cjs'); -var time = require('./time-d8438852.cjs'); -var tree = require('./tree-9f3c8837.cjs'); -var websocket = require('./websocket-b073d0fc.cjs'); -require('./storage.cjs'); -require('./schema.cjs'); -require('./equality.cjs'); -require('./metric.cjs'); -require('./observable.cjs'); - -function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n["default"] = e; - return Object.freeze(n); -} - -var log__namespace = /*#__PURE__*/_interopNamespace(log); - - - -exports.array = array.array; -exports.binary = binary.binary; -exports.broadcastchannel = broadcastchannel.broadcastchannel; -exports.buffer = buffer.buffer; -exports.conditions = conditions.conditions; -exports.decoding = decoding.decoding; -exports.diff = diff.diff; -exports.dom = dom.dom; -exports.encoding = encoding.encoding; -exports.environment = environment.environment; -exports.error = error.error; -exports.eventloop = eventloop.eventloop; -exports.func = _function._function; -exports.indexeddb = indexeddb.indexeddb; -exports.iterator = iterator.iterator; -exports.json = json.json; -exports.logging = log__namespace; -exports.map = map.map$1; -exports.math = math.math; -exports.mutex = mutex.mutex; -exports.number = number.number; -exports.object = object.object; -exports.pair = pair.pair; -exports.prng = prng.prng; -exports.promise = promise.promise; -exports.set = set.set; -exports.sort = sort.sort; -exports.statistics = statistics.statistics; -exports.string = string.string; -exports.symbol = symbol.symbol; -exports.time = time.time; -exports.tree = tree.tree; -exports.websocket = websocket.websocket; -//# sourceMappingURL=index.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/index.cjs.map b/yjs-poll/node_modules/lib0/dist/index.cjs.map deleted file mode 100644 index 76ec6b1..0000000 --- a/yjs-poll/node_modules/lib0/dist/index.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/index.d.ts b/yjs-poll/node_modules/lib0/dist/index.d.ts deleted file mode 100644 index 8aa3ac2..0000000 --- a/yjs-poll/node_modules/lib0/dist/index.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import * as array from './array.js'; -import * as binary from './binary.js'; -import * as broadcastchannel from './broadcastchannel.js'; -import * as buffer from './buffer.js'; -import * as conditions from './conditions.js'; -import * as decoding from './decoding.js'; -import * as diff from './diff.js'; -import * as dom from './dom.js'; -import * as encoding from './encoding.js'; -import * as environment from './environment.js'; -import * as error from './error.js'; -import * as eventloop from './eventloop.js'; -import * as func from './function.js'; -import * as indexeddb from './indexeddb.js'; -import * as iterator from './iterator.js'; -import * as json from './json.js'; -import * as logging from 'lib0/logging'; -import * as map from './map.js'; -import * as math from './math.js'; -import * as mutex from './mutex.js'; -import * as number from './number.js'; -import * as object from './object.js'; -import * as pair from './pair.js'; -import * as prng from './prng.js'; -import * as promise from './promise.js'; -import * as set from './set.js'; -import * as sort from './sort.js'; -import * as statistics from './statistics.js'; -import * as string from './string.js'; -import * as symbol from './symbol.js'; -import * as time from './time.js'; -import * as tree from './tree.js'; -import * as websocket from './websocket.js'; -export { array, binary, broadcastchannel, buffer, conditions, decoding, diff, dom, encoding, environment, error, eventloop, func, indexeddb, iterator, json, logging, map, math, mutex, number, object, pair, prng, promise, set, sort, statistics, string, symbol, time, tree, websocket }; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/index.d.ts.map b/yjs-poll/node_modules/lib0/dist/index.d.ts.map deleted file mode 100644 index d84038f..0000000 --- a/yjs-poll/node_modules/lib0/dist/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":"uBAQuB,YAAY;wBACX,aAAa;kCACH,uBAAuB;wBACjC,aAAa;4BACT,iBAAiB;0BACnB,eAAe;sBACnB,WAAW;qBACZ,UAAU;0BACL,eAAe;6BACZ,kBAAkB;uBACxB,YAAY;2BACR,gBAAgB;sBAErB,eAAe;2BACV,gBAAgB;0BACjB,eAAe;sBACnB,WAAW;yBACR,cAAc;qBAClB,UAAU;sBACT,WAAW;uBACV,YAAY;wBACX,aAAa;wBACb,aAAa;sBACf,WAAW;sBACX,WAAW;yBACR,cAAc;qBAElB,UAAU;sBACT,WAAW;4BACL,iBAAiB;wBACrB,aAAa;wBACb,aAAa;sBAEf,WAAW;sBACX,WAAW;2BACN,gBAAgB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/indexeddb-46d1e737.cjs b/yjs-poll/node_modules/lib0/dist/indexeddb-46d1e737.cjs deleted file mode 100644 index 8d8fb7d..0000000 --- a/yjs-poll/node_modules/lib0/dist/indexeddb-46d1e737.cjs +++ /dev/null @@ -1,311 +0,0 @@ -'use strict'; - -var promise = require('./promise-cda7b9bb.cjs'); -var error = require('./error-0c1f634f.cjs'); - -/* eslint-env browser */ - -/* c8 ignore start */ - -/** - * IDB Request to Promise transformer - * - * @param {IDBRequest} request - * @return {Promise} - */ -const rtop = request => promise.create((resolve, reject) => { - // @ts-ignore - request.onerror = event => reject(new Error(event.target.error)); - // @ts-ignore - request.onsuccess = event => resolve(event.target.result); -}); - -/** - * @param {string} name - * @param {function(IDBDatabase):any} initDB Called when the database is first created - * @return {Promise} - */ -const openDB = (name, initDB) => promise.create((resolve, reject) => { - const request = indexedDB.open(name); - /** - * @param {any} event - */ - request.onupgradeneeded = event => initDB(event.target.result); - /** - * @param {any} event - */ - request.onerror = event => reject(error.create(event.target.error)); - /** - * @param {any} event - */ - request.onsuccess = event => { - /** - * @type {IDBDatabase} - */ - const db = event.target.result; - db.onversionchange = () => { db.close(); }; - resolve(db); - }; -}); - -/** - * @param {string} name - */ -const deleteDB = name => rtop(indexedDB.deleteDatabase(name)); - -/** - * @param {IDBDatabase} db - * @param {Array|Array>} definitions - */ -const createStores = (db, definitions) => definitions.forEach(d => - // @ts-ignore - db.createObjectStore.apply(db, d) -); - -/** - * @param {IDBDatabase} db - * @param {Array} stores - * @param {"readwrite"|"readonly"} [access] - * @return {Array} - */ -const transact = (db, stores, access = 'readwrite') => { - const transaction = db.transaction(stores, access); - return stores.map(store => getStore(transaction, store)) -}; - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange} [range] - * @return {Promise} - */ -const count = (store, range) => - rtop(store.count(range)); - -/** - * @param {IDBObjectStore} store - * @param {String | number | ArrayBuffer | Date | Array } key - * @return {Promise>} - */ -const get = (store, key) => - rtop(store.get(key)); - -/** - * @param {IDBObjectStore} store - * @param {String | number | ArrayBuffer | Date | IDBKeyRange | Array } key - */ -const del = (store, key) => - rtop(store.delete(key)); - -/** - * @param {IDBObjectStore} store - * @param {String | number | ArrayBuffer | Date | boolean} item - * @param {String | number | ArrayBuffer | Date | Array} [key] - */ -const put = (store, item, key) => - rtop(store.put(item, key)); - -/** - * @param {IDBObjectStore} store - * @param {String | number | ArrayBuffer | Date | boolean} item - * @param {String | number | ArrayBuffer | Date | Array} key - * @return {Promise} - */ -const add = (store, item, key) => - rtop(store.add(item, key)); - -/** - * @param {IDBObjectStore} store - * @param {String | number | ArrayBuffer | Date} item - * @return {Promise} Returns the generated key - */ -const addAutoKey = (store, item) => - rtop(store.add(item)); - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange} [range] - * @param {number} [limit] - * @return {Promise>} - */ -const getAll = (store, range, limit) => - rtop(store.getAll(range, limit)); - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange} [range] - * @param {number} [limit] - * @return {Promise>} - */ -const getAllKeys = (store, range, limit) => - rtop(store.getAllKeys(range, limit)); - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange|null} query - * @param {'next'|'prev'|'nextunique'|'prevunique'} direction - * @return {Promise} - */ -const queryFirst = (store, query, direction) => { - /** - * @type {any} - */ - let first = null; - return iterateKeys(store, query, key => { - first = key; - return false - }, direction).then(() => first) -}; - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange?} [range] - * @return {Promise} - */ -const getLastKey = (store, range = null) => queryFirst(store, range, 'prev'); - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange?} [range] - * @return {Promise} - */ -const getFirstKey = (store, range = null) => queryFirst(store, range, 'next'); - -/** - * @typedef KeyValuePair - * @type {Object} - * @property {any} k key - * @property {any} v Value - */ - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange} [range] - * @param {number} [limit] - * @return {Promise>} - */ -const getAllKeysValues = (store, range, limit) => - // @ts-ignore - promise.all([getAllKeys(store, range, limit), getAll(store, range, limit)]).then(([ks, vs]) => ks.map((k, i) => ({ k, v: vs[i] }))); - -/** - * @param {any} request - * @param {function(IDBCursorWithValue):void|boolean|Promise} f - * @return {Promise} - */ -const iterateOnRequest = (request, f) => promise.create((resolve, reject) => { - request.onerror = reject; - /** - * @param {any} event - */ - request.onsuccess = async event => { - const cursor = event.target.result; - if (cursor === null || (await f(cursor)) === false) { - return resolve() - } - cursor.continue(); - }; -}); - -/** - * Iterate on keys and values - * @param {IDBObjectStore} store - * @param {IDBKeyRange|null} keyrange - * @param {function(any,any):void|boolean|Promise} f Callback that receives (value, key) - * @param {'next'|'prev'|'nextunique'|'prevunique'} direction - */ -const iterate = (store, keyrange, f, direction = 'next') => - iterateOnRequest(store.openCursor(keyrange, direction), cursor => f(cursor.value, cursor.key)); - -/** - * Iterate on the keys (no values) - * - * @param {IDBObjectStore} store - * @param {IDBKeyRange|null} keyrange - * @param {function(any):void|boolean|Promise} f callback that receives the key - * @param {'next'|'prev'|'nextunique'|'prevunique'} direction - */ -const iterateKeys = (store, keyrange, f, direction = 'next') => - iterateOnRequest(store.openKeyCursor(keyrange, direction), cursor => f(cursor.key)); - -/** - * Open store from transaction - * @param {IDBTransaction} t - * @param {String} store - * @returns {IDBObjectStore} - */ -const getStore = (t, store) => t.objectStore(store); - -/** - * @param {any} lower - * @param {any} upper - * @param {boolean} lowerOpen - * @param {boolean} upperOpen - */ -const createIDBKeyRangeBound = (lower, upper, lowerOpen, upperOpen) => IDBKeyRange.bound(lower, upper, lowerOpen, upperOpen); - -/** - * @param {any} upper - * @param {boolean} upperOpen - */ -const createIDBKeyRangeUpperBound = (upper, upperOpen) => IDBKeyRange.upperBound(upper, upperOpen); - -/** - * @param {any} lower - * @param {boolean} lowerOpen - */ -const createIDBKeyRangeLowerBound = (lower, lowerOpen) => IDBKeyRange.lowerBound(lower, lowerOpen); - -/* c8 ignore stop */ - -var indexeddb = /*#__PURE__*/Object.freeze({ - __proto__: null, - rtop: rtop, - openDB: openDB, - deleteDB: deleteDB, - createStores: createStores, - transact: transact, - count: count, - get: get, - del: del, - put: put, - add: add, - addAutoKey: addAutoKey, - getAll: getAll, - getAllKeys: getAllKeys, - queryFirst: queryFirst, - getLastKey: getLastKey, - getFirstKey: getFirstKey, - getAllKeysValues: getAllKeysValues, - iterate: iterate, - iterateKeys: iterateKeys, - getStore: getStore, - createIDBKeyRangeBound: createIDBKeyRangeBound, - createIDBKeyRangeUpperBound: createIDBKeyRangeUpperBound, - createIDBKeyRangeLowerBound: createIDBKeyRangeLowerBound -}); - -exports.add = add; -exports.addAutoKey = addAutoKey; -exports.count = count; -exports.createIDBKeyRangeBound = createIDBKeyRangeBound; -exports.createIDBKeyRangeLowerBound = createIDBKeyRangeLowerBound; -exports.createIDBKeyRangeUpperBound = createIDBKeyRangeUpperBound; -exports.createStores = createStores; -exports.del = del; -exports.deleteDB = deleteDB; -exports.get = get; -exports.getAll = getAll; -exports.getAllKeys = getAllKeys; -exports.getAllKeysValues = getAllKeysValues; -exports.getFirstKey = getFirstKey; -exports.getLastKey = getLastKey; -exports.getStore = getStore; -exports.indexeddb = indexeddb; -exports.iterate = iterate; -exports.iterateKeys = iterateKeys; -exports.openDB = openDB; -exports.put = put; -exports.queryFirst = queryFirst; -exports.rtop = rtop; -exports.transact = transact; -//# sourceMappingURL=indexeddb-46d1e737.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/indexeddb-46d1e737.cjs.map b/yjs-poll/node_modules/lib0/dist/indexeddb-46d1e737.cjs.map deleted file mode 100644 index 3e9056c..0000000 --- a/yjs-poll/node_modules/lib0/dist/indexeddb-46d1e737.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"indexeddb-46d1e737.cjs","sources":["../indexeddb.js"],"sourcesContent":["/* eslint-env browser */\n\n/**\n * Helpers to work with IndexedDB.\n *\n * @module indexeddb\n */\n\nimport * as promise from './promise.js'\nimport * as error from './error.js'\n\n/* c8 ignore start */\n\n/**\n * IDB Request to Promise transformer\n *\n * @param {IDBRequest} request\n * @return {Promise}\n */\nexport const rtop = request => promise.create((resolve, reject) => {\n // @ts-ignore\n request.onerror = event => reject(new Error(event.target.error))\n // @ts-ignore\n request.onsuccess = event => resolve(event.target.result)\n})\n\n/**\n * @param {string} name\n * @param {function(IDBDatabase):any} initDB Called when the database is first created\n * @return {Promise}\n */\nexport const openDB = (name, initDB) => promise.create((resolve, reject) => {\n const request = indexedDB.open(name)\n /**\n * @param {any} event\n */\n request.onupgradeneeded = event => initDB(event.target.result)\n /**\n * @param {any} event\n */\n request.onerror = event => reject(error.create(event.target.error))\n /**\n * @param {any} event\n */\n request.onsuccess = event => {\n /**\n * @type {IDBDatabase}\n */\n const db = event.target.result\n db.onversionchange = () => { db.close() }\n resolve(db)\n }\n})\n\n/**\n * @param {string} name\n */\nexport const deleteDB = name => rtop(indexedDB.deleteDatabase(name))\n\n/**\n * @param {IDBDatabase} db\n * @param {Array|Array>} definitions\n */\nexport const createStores = (db, definitions) => definitions.forEach(d =>\n // @ts-ignore\n db.createObjectStore.apply(db, d)\n)\n\n/**\n * @param {IDBDatabase} db\n * @param {Array} stores\n * @param {\"readwrite\"|\"readonly\"} [access]\n * @return {Array}\n */\nexport const transact = (db, stores, access = 'readwrite') => {\n const transaction = db.transaction(stores, access)\n return stores.map(store => getStore(transaction, store))\n}\n\n/**\n * @param {IDBObjectStore} store\n * @param {IDBKeyRange} [range]\n * @return {Promise}\n */\nexport const count = (store, range) =>\n rtop(store.count(range))\n\n/**\n * @param {IDBObjectStore} store\n * @param {String | number | ArrayBuffer | Date | Array } key\n * @return {Promise>}\n */\nexport const get = (store, key) =>\n rtop(store.get(key))\n\n/**\n * @param {IDBObjectStore} store\n * @param {String | number | ArrayBuffer | Date | IDBKeyRange | Array } key\n */\nexport const del = (store, key) =>\n rtop(store.delete(key))\n\n/**\n * @param {IDBObjectStore} store\n * @param {String | number | ArrayBuffer | Date | boolean} item\n * @param {String | number | ArrayBuffer | Date | Array} [key]\n */\nexport const put = (store, item, key) =>\n rtop(store.put(item, key))\n\n/**\n * @param {IDBObjectStore} store\n * @param {String | number | ArrayBuffer | Date | boolean} item\n * @param {String | number | ArrayBuffer | Date | Array} key\n * @return {Promise}\n */\nexport const add = (store, item, key) =>\n rtop(store.add(item, key))\n\n/**\n * @param {IDBObjectStore} store\n * @param {String | number | ArrayBuffer | Date} item\n * @return {Promise} Returns the generated key\n */\nexport const addAutoKey = (store, item) =>\n rtop(store.add(item))\n\n/**\n * @param {IDBObjectStore} store\n * @param {IDBKeyRange} [range]\n * @param {number} [limit]\n * @return {Promise>}\n */\nexport const getAll = (store, range, limit) =>\n rtop(store.getAll(range, limit))\n\n/**\n * @param {IDBObjectStore} store\n * @param {IDBKeyRange} [range]\n * @param {number} [limit]\n * @return {Promise>}\n */\nexport const getAllKeys = (store, range, limit) =>\n rtop(store.getAllKeys(range, limit))\n\n/**\n * @param {IDBObjectStore} store\n * @param {IDBKeyRange|null} query\n * @param {'next'|'prev'|'nextunique'|'prevunique'} direction\n * @return {Promise}\n */\nexport const queryFirst = (store, query, direction) => {\n /**\n * @type {any}\n */\n let first = null\n return iterateKeys(store, query, key => {\n first = key\n return false\n }, direction).then(() => first)\n}\n\n/**\n * @param {IDBObjectStore} store\n * @param {IDBKeyRange?} [range]\n * @return {Promise}\n */\nexport const getLastKey = (store, range = null) => queryFirst(store, range, 'prev')\n\n/**\n * @param {IDBObjectStore} store\n * @param {IDBKeyRange?} [range]\n * @return {Promise}\n */\nexport const getFirstKey = (store, range = null) => queryFirst(store, range, 'next')\n\n/**\n * @typedef KeyValuePair\n * @type {Object}\n * @property {any} k key\n * @property {any} v Value\n */\n\n/**\n * @param {IDBObjectStore} store\n * @param {IDBKeyRange} [range]\n * @param {number} [limit]\n * @return {Promise>}\n */\nexport const getAllKeysValues = (store, range, limit) =>\n // @ts-ignore\n promise.all([getAllKeys(store, range, limit), getAll(store, range, limit)]).then(([ks, vs]) => ks.map((k, i) => ({ k, v: vs[i] })))\n\n/**\n * @param {any} request\n * @param {function(IDBCursorWithValue):void|boolean|Promise} f\n * @return {Promise}\n */\nconst iterateOnRequest = (request, f) => promise.create((resolve, reject) => {\n request.onerror = reject\n /**\n * @param {any} event\n */\n request.onsuccess = async event => {\n const cursor = event.target.result\n if (cursor === null || (await f(cursor)) === false) {\n return resolve()\n }\n cursor.continue()\n }\n})\n\n/**\n * Iterate on keys and values\n * @param {IDBObjectStore} store\n * @param {IDBKeyRange|null} keyrange\n * @param {function(any,any):void|boolean|Promise} f Callback that receives (value, key)\n * @param {'next'|'prev'|'nextunique'|'prevunique'} direction\n */\nexport const iterate = (store, keyrange, f, direction = 'next') =>\n iterateOnRequest(store.openCursor(keyrange, direction), cursor => f(cursor.value, cursor.key))\n\n/**\n * Iterate on the keys (no values)\n *\n * @param {IDBObjectStore} store\n * @param {IDBKeyRange|null} keyrange\n * @param {function(any):void|boolean|Promise} f callback that receives the key\n * @param {'next'|'prev'|'nextunique'|'prevunique'} direction\n */\nexport const iterateKeys = (store, keyrange, f, direction = 'next') =>\n iterateOnRequest(store.openKeyCursor(keyrange, direction), cursor => f(cursor.key))\n\n/**\n * Open store from transaction\n * @param {IDBTransaction} t\n * @param {String} store\n * @returns {IDBObjectStore}\n */\nexport const getStore = (t, store) => t.objectStore(store)\n\n/**\n * @param {any} lower\n * @param {any} upper\n * @param {boolean} lowerOpen\n * @param {boolean} upperOpen\n */\nexport const createIDBKeyRangeBound = (lower, upper, lowerOpen, upperOpen) => IDBKeyRange.bound(lower, upper, lowerOpen, upperOpen)\n\n/**\n * @param {any} upper\n * @param {boolean} upperOpen\n */\nexport const createIDBKeyRangeUpperBound = (upper, upperOpen) => IDBKeyRange.upperBound(upper, upperOpen)\n\n/**\n * @param {any} lower\n * @param {boolean} lowerOpen\n */\nexport const createIDBKeyRangeLowerBound = (lower, lowerOpen) => IDBKeyRange.lowerBound(lower, lowerOpen)\n\n/* c8 ignore stop */\n"],"names":["promise.create","error.create","promise.all"],"mappings":";;;;;AAAA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,IAAI,GAAG,OAAO,IAAIA,cAAc,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AACnE;AACA,EAAE,OAAO,CAAC,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAC;AAClE;AACA,EAAE,OAAO,CAAC,SAAS,GAAG,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAC;AAC3D,CAAC,EAAC;AACF;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,KAAKA,cAAc,C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E,KAAK,EAAE,SAAS,EAAE,SAAS,EAAC;AACnI;AACA;AACA;AACA;AACA;AACY,MAAC,2BAA2B,GAAG,CAAC,KAAK,EAAE,SAAS,KAAK,WAAW,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,EAAC;AACzG;AACA;AACA;AACA;AACA;AACY,MAAC,2BAA2B,GAAG,CAAC,KAAK,EAAE,SAAS,KAAK,WAAW,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,EAAC;AACzG;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/indexeddb.cjs b/yjs-poll/node_modules/lib0/dist/indexeddb.cjs deleted file mode 100644 index 86fca31..0000000 --- a/yjs-poll/node_modules/lib0/dist/indexeddb.cjs +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./promise-cda7b9bb.cjs'); -require('./error-0c1f634f.cjs'); -var indexeddb = require('./indexeddb-46d1e737.cjs'); -require('./time-d8438852.cjs'); -require('./metric.cjs'); -require('./math-96d5e8c4.cjs'); - - - -exports.add = indexeddb.add; -exports.addAutoKey = indexeddb.addAutoKey; -exports.count = indexeddb.count; -exports.createIDBKeyRangeBound = indexeddb.createIDBKeyRangeBound; -exports.createIDBKeyRangeLowerBound = indexeddb.createIDBKeyRangeLowerBound; -exports.createIDBKeyRangeUpperBound = indexeddb.createIDBKeyRangeUpperBound; -exports.createStores = indexeddb.createStores; -exports.del = indexeddb.del; -exports.deleteDB = indexeddb.deleteDB; -exports.get = indexeddb.get; -exports.getAll = indexeddb.getAll; -exports.getAllKeys = indexeddb.getAllKeys; -exports.getAllKeysValues = indexeddb.getAllKeysValues; -exports.getFirstKey = indexeddb.getFirstKey; -exports.getLastKey = indexeddb.getLastKey; -exports.getStore = indexeddb.getStore; -exports.iterate = indexeddb.iterate; -exports.iterateKeys = indexeddb.iterateKeys; -exports.openDB = indexeddb.openDB; -exports.put = indexeddb.put; -exports.queryFirst = indexeddb.queryFirst; -exports.rtop = indexeddb.rtop; -exports.transact = indexeddb.transact; -//# sourceMappingURL=indexeddb.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/indexeddb.cjs.map b/yjs-poll/node_modules/lib0/dist/indexeddb.cjs.map deleted file mode 100644 index 5bfcf7f..0000000 --- a/yjs-poll/node_modules/lib0/dist/indexeddb.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"indexeddb.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/indexeddb.d.ts b/yjs-poll/node_modules/lib0/dist/indexeddb.d.ts deleted file mode 100644 index fe7148e..0000000 --- a/yjs-poll/node_modules/lib0/dist/indexeddb.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -export function rtop(request: IDBRequest): Promise; -export function openDB(name: string, initDB: (arg0: IDBDatabase) => any): Promise; -export function deleteDB(name: string): Promise; -export function createStores(db: IDBDatabase, definitions: Array | Array>): void; -export function transact(db: IDBDatabase, stores: Array, access?: "readwrite" | "readonly"): Array; -export function count(store: IDBObjectStore, range?: IDBKeyRange): Promise; -export function get(store: IDBObjectStore, key: string | number | ArrayBuffer | Date | Array): Promise>; -export function del(store: IDBObjectStore, key: string | number | ArrayBuffer | Date | IDBKeyRange | Array): Promise; -export function put(store: IDBObjectStore, item: string | number | ArrayBuffer | Date | boolean, key?: string | number | ArrayBuffer | Date | Array): Promise; -export function add(store: IDBObjectStore, item: string | number | ArrayBuffer | Date | boolean, key: string | number | ArrayBuffer | Date | Array): Promise; -export function addAutoKey(store: IDBObjectStore, item: string | number | ArrayBuffer | Date): Promise; -export function getAll(store: IDBObjectStore, range?: IDBKeyRange, limit?: number): Promise>; -export function getAllKeys(store: IDBObjectStore, range?: IDBKeyRange, limit?: number): Promise>; -export function queryFirst(store: IDBObjectStore, query: IDBKeyRange | null, direction: "next" | "prev" | "nextunique" | "prevunique"): Promise; -export function getLastKey(store: IDBObjectStore, range?: IDBKeyRange | null): Promise; -export function getFirstKey(store: IDBObjectStore, range?: IDBKeyRange | null): Promise; -export function getAllKeysValues(store: IDBObjectStore, range?: IDBKeyRange, limit?: number): Promise>; -export function iterate(store: IDBObjectStore, keyrange: IDBKeyRange | null, f: (arg0: any, arg1: any) => void | boolean | Promise, direction?: "next" | "prev" | "nextunique" | "prevunique"): Promise; -export function iterateKeys(store: IDBObjectStore, keyrange: IDBKeyRange | null, f: (arg0: any) => void | boolean | Promise, direction?: "next" | "prev" | "nextunique" | "prevunique"): Promise; -export function getStore(t: IDBTransaction, store: string): IDBObjectStore; -export function createIDBKeyRangeBound(lower: any, upper: any, lowerOpen: boolean, upperOpen: boolean): IDBKeyRange; -export function createIDBKeyRangeUpperBound(upper: any, upperOpen: boolean): IDBKeyRange; -export function createIDBKeyRangeLowerBound(lower: any, lowerOpen: boolean): IDBKeyRange; -export type KeyValuePair = { - /** - * key - */ - k: any; - /** - * Value - */ - v: any; -}; -//# sourceMappingURL=indexeddb.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/indexeddb.d.ts.map b/yjs-poll/node_modules/lib0/dist/indexeddb.d.ts.map deleted file mode 100644 index 3a81bb3..0000000 --- a/yjs-poll/node_modules/lib0/dist/indexeddb.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"indexeddb.d.ts","sourceRoot":"","sources":["../indexeddb.js"],"names":[],"mappings":"AAmBO,8BAHI,UAAU,GACT,OAAO,CAAC,GAAG,CAAC,CAOtB;AAOK,6BAJI,MAAM,UACN,CAAS,IAAW,EAAX,WAAW,KAAE,GAAG,GACxB,OAAO,CAAC,WAAW,CAAC,CAuB9B;AAKK,+BAFI,MAAM,gBAEmD;AAM7D,iCAHI,WAAW,eACX,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,GAAC,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,YAAY,GAAC,YAAY,GACtC,OAAO,CAAC,GAAG,CAAC,CAWvB;AAOM,kCAJI,cAAc,UACd,WAAW,OAAC,GACX,OAAO,CAAC,GAAG,CAAC,CAE2D;AAO5E,mCAJI,cAAc,UACd,WAAW,OAAC,GACX,OAAO,CAAC,GAAG,CAAC,CAE4D;AAe7E,wCALI,cAAc,UACd,WAAW,UACX,MAAM,GACL,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAI6F;AA4B9H,+BALI,cAAc,YACd,WAAW,GAAC,IAAI,KAChB,CAAS,IAAG,EAAH,GAAG,EAAC,IAAG,EAAH,GAAG,KAAE,IAAI,GAAC,OAAO,GAAC,OAAO,CAAC,IAAI,GAAC,OAAO,CAAC,cACpD,MAAM,GAAC,MAAM,GAAC,YAAY,GAAC,YAAY,iBAG8C;AAUzF,mCALI,cAAc,YACd,WAAW,GAAC,IAAI,KAChB,CAAS,IAAG,EAAH,GAAG,KAAE,IAAI,GAAC,OAAO,GAAC,OAAO,CAAC,IAAI,GAAC,OAAO,CAAC,cAChD,MAAM,GAAC,MAAM,GAAC,YAAY,GAAC,YAAY,iBAGmC;AAQ9E,4BAJI,cAAc,kBAEZ,cAAc,CAE+B;AAQnD,8CALI,GAAG,SACH,GAAG,aACH,OAAO,aACP,OAAO,eAEiH;AAM5H,mDAHI,GAAG,aACH,OAAO,eAEuF;AAMlG,mDAHI,GAAG,aACH,OAAO,eAEuF;;;;;OAhF3F,GAAG;;;;OACH,GAAG"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/indexeddb.test.d.ts b/yjs-poll/node_modules/lib0/dist/indexeddb.test.d.ts deleted file mode 100644 index e45d0c9..0000000 --- a/yjs-poll/node_modules/lib0/dist/indexeddb.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testRetrieveElements(): Promise; -export function testBlocked(): Promise; -//# sourceMappingURL=indexeddb.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/indexeddb.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/indexeddb.test.d.ts.map deleted file mode 100644 index ecfbc2d..0000000 --- a/yjs-poll/node_modules/lib0/dist/indexeddb.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"indexeddb.test.d.ts","sourceRoot":"","sources":["../indexeddb.test.js"],"names":[],"mappings":"AAyBO,sDAoEN;AAGM,6CAWN"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/indexeddbV2.cjs b/yjs-poll/node_modules/lib0/dist/indexeddbV2.cjs deleted file mode 100644 index 577e952..0000000 --- a/yjs-poll/node_modules/lib0/dist/indexeddbV2.cjs +++ /dev/null @@ -1,288 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var pledge = require('./pledge.cjs'); -require('./queue.cjs'); -require('./object-c0c9435b.cjs'); -require('./equality.cjs'); - -/* eslint-env browser */ - -/* c8 ignore start */ - -/** - * IDB Request to Pledge transformer - * - * @param {pledge.PledgeInstance} p - * @param {IDBRequest} request - */ -const bindPledge = (p, request) => { - // @ts-ignore - request.onerror = event => p.cancel(event.target.error); - // @ts-ignore - request.onsuccess = event => p.resolve(event.target.result); -}; - -/** - * @param {string} name - * @param {function(IDBDatabase):any} initDB Called when the database is first created - * @return {pledge.PledgeInstance} - */ -const openDB = (name, initDB) => { - /** - * @type {pledge.PledgeInstance} - */ - const p = pledge.create(); - const request = indexedDB.open(name); - /** - * @param {any} event - */ - request.onupgradeneeded = event => initDB(event.target.result); - /** - * @param {any} event - */ - request.onerror = event => p.cancel(event.target.error); - /** - * @param {any} event - */ - request.onsuccess = event => { - /** - * @type {IDBDatabase} - */ - const db = event.target.result; - db.onversionchange = () => { db.close(); }; - p.resolve(db); - }; - return p -}; - -/** - * @param {pledge.Pledge} name - * @return {pledge.PledgeInstance} - */ -const deleteDB = name => pledge.createWithDependencies((p, name) => bindPledge(p, indexedDB.deleteDatabase(name)), name); - -/** - * @param {IDBDatabase} db - * @param {Array|Array>} definitions - */ -const createStores = (db, definitions) => definitions.forEach(d => - // @ts-ignore - db.createObjectStore.apply(db, d) -); - -/** - * @param {pledge.Pledge} db - * @param {pledge.Pledge>} stores - * @param {"readwrite"|"readonly"} [access] - * @return {pledge.Pledge>} - */ -const transact = (db, stores, access = 'readwrite') => pledge.createWithDependencies((p, db, stores) => { - const transaction = db.transaction(stores, access); - p.resolve(stores.map(store => getStore(transaction, store))); -}, db, stores); - -/** - * @param {IDBObjectStore} store - * @param {pledge.Pledge} [range] - * @return {pledge.PledgeInstance} - */ -const count = (store, range) => pledge.createWithDependencies((p, store, range) => bindPledge(p, store.count(range)), store, range); - -/** - * @param {pledge.Pledge} store - * @param {pledge.Pledge>} key - * @return {pledge.PledgeInstance>} - */ -const get = (store, key) => pledge.createWithDependencies((p, store, key) => bindPledge(p, store.get(key)), store, key); - -/** - * @param {pledge.Pledge} store - * @param {String | number | ArrayBuffer | Date | IDBKeyRange | Array } key - */ -const del = (store, key) => pledge.createWithDependencies((p, store, key) => bindPledge(p, store.delete(key)), store, key); - -/** - * @param {pledge.Pledge} store - * @param {String | number | ArrayBuffer | Date | boolean} item - * @param {String | number | ArrayBuffer | Date | Array} [key] - */ -const put = (store, item, key) => pledge.createWithDependencies((p, store, item, key) => bindPledge(p, store.put(item, key)), store, item, key); - -/** - * @param {pledge.Pledge} store - * @param {String | number | ArrayBuffer | Date | boolean} item - * @param {String | number | ArrayBuffer | Date | Array} key - * @return {pledge.PledgeInstance} - */ -const add = (store, item, key) => pledge.createWithDependencies((p, store, item, key) => bindPledge(p, store.add(item, key)), store, item, key); - -/** - * @param {pledge.Pledge} store - * @param {String | number | ArrayBuffer | Date} item - * @return {pledge.PledgeInstance} Returns the generated key - */ -const addAutoKey = (store, item) => pledge.createWithDependencies((p, store, item) => bindPledge(p, store.add(item)), store, item); - -/** - * @param {pledge.Pledge} store - * @param {IDBKeyRange} [range] - * @param {number} [limit] - * @return {pledge.PledgeInstance>} - */ -const getAll = (store, range, limit) => pledge.createWithDependencies((p, store, range, limit) => bindPledge(p, store.getAll(range, limit)), store, range, limit); - -/** - * @param {pledge.Pledge} store - * @param {IDBKeyRange} [range] - * @param {number} [limit] - * @return {pledge.PledgeInstance>} - */ -const getAllKeys = (store, range, limit) => pledge.createWithDependencies((p, store, range, limit) => bindPledge(p, store.getAllKeys(range, limit)), store, range, limit); - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange|null} query - * @param {'next'|'prev'|'nextunique'|'prevunique'} direction - * @return {pledge.PledgeInstance} - */ -const queryFirst = (store, query, direction) => { - /** - * @type {any} - */ - let first = null; - return iterateKeys(store, query, key => { - first = key; - return false - }, direction).map(() => first) -}; - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange?} [range] - * @return {pledge.PledgeInstance} - */ -const getLastKey = (store, range = null) => queryFirst(store, range, 'prev'); - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange?} [range] - * @return {pledge.PledgeInstance} - */ -const getFirstKey = (store, range = null) => queryFirst(store, range, 'next'); - -/** - * @typedef KeyValuePair - * @type {Object} - * @property {any} k key - * @property {any} v Value - */ - -/** - * @param {pledge.Pledge} store - * @param {pledge.Pledge} [range] - * @param {pledge.Pledge} [limit] - * @return {pledge.PledgeInstance>} - */ -const getAllKeysValues = (store, range, limit) => pledge.createWithDependencies((p, store, range, limit) => { - pledge.all([getAllKeys(store, range, limit), getAll(store, range, limit)]).map(([ks, vs]) => ks.map((k, i) => ({ k, v: vs[i] }))).whenResolved(p.resolve.bind(p)); -}, store, range, limit); - -/** - * @param {pledge.PledgeInstance} p - * @param {any} request - * @param {function(IDBCursorWithValue):void|boolean|Promise} f - */ -const iterateOnRequest = (p, request, f) => { - request.onerror = p.cancel.bind(p); - /** - * @param {any} event - */ - request.onsuccess = async event => { - const cursor = event.target.result; - if (cursor === null || (await f(cursor)) === false) { - p.resolve(undefined); - return - } - cursor.continue(); - }; -}; - -/** - * Iterate on keys and values - * @param {pledge.Pledge} store - * @param {pledge.Pledge} keyrange - * @param {function(any,any):void|boolean|Promise} f Callback that receives (value, key) - * @param {'next'|'prev'|'nextunique'|'prevunique'} direction - */ -const iterate = (store, keyrange, f, direction = 'next') => pledge.createWithDependencies((p, store, keyrange) => { - iterateOnRequest(p, store.openCursor(keyrange, direction), cursor => f(cursor.value, cursor.key)); -}, store, keyrange); - -/** - * Iterate on the keys (no values) - * - * @param {pledge.Pledge} store - * @param {pledge.Pledge} keyrange - * @param {function(any):void|boolean|Promise} f callback that receives the key - * @param {'next'|'prev'|'nextunique'|'prevunique'} direction - */ -const iterateKeys = (store, keyrange, f, direction = 'next') => pledge.createWithDependencies((p, store, keyrange) => { - iterateOnRequest(p, store.openKeyCursor(keyrange, direction), cursor => f(cursor.key)); -}, store, keyrange); - -/** - * Open store from transaction - * @param {IDBTransaction} t - * @param {String} store - * @returns {IDBObjectStore} - */ -const getStore = (t, store) => t.objectStore(store); - -/** - * @param {any} lower - * @param {any} upper - * @param {boolean} lowerOpen - * @param {boolean} upperOpen - */ -const createIDBKeyRangeBound = (lower, upper, lowerOpen, upperOpen) => IDBKeyRange.bound(lower, upper, lowerOpen, upperOpen); - -/** - * @param {any} upper - * @param {boolean} upperOpen - */ -const createIDBKeyRangeUpperBound = (upper, upperOpen) => IDBKeyRange.upperBound(upper, upperOpen); - -/** - * @param {any} lower - * @param {boolean} lowerOpen - */ -const createIDBKeyRangeLowerBound = (lower, lowerOpen) => IDBKeyRange.lowerBound(lower, lowerOpen); - -/* c8 ignore stop */ - -exports.add = add; -exports.addAutoKey = addAutoKey; -exports.bindPledge = bindPledge; -exports.count = count; -exports.createIDBKeyRangeBound = createIDBKeyRangeBound; -exports.createIDBKeyRangeLowerBound = createIDBKeyRangeLowerBound; -exports.createIDBKeyRangeUpperBound = createIDBKeyRangeUpperBound; -exports.createStores = createStores; -exports.del = del; -exports.deleteDB = deleteDB; -exports.get = get; -exports.getAll = getAll; -exports.getAllKeys = getAllKeys; -exports.getAllKeysValues = getAllKeysValues; -exports.getFirstKey = getFirstKey; -exports.getLastKey = getLastKey; -exports.getStore = getStore; -exports.iterate = iterate; -exports.iterateKeys = iterateKeys; -exports.openDB = openDB; -exports.put = put; -exports.queryFirst = queryFirst; -exports.transact = transact; -//# sourceMappingURL=indexeddbV2.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/indexeddbV2.cjs.map b/yjs-poll/node_modules/lib0/dist/indexeddbV2.cjs.map deleted file mode 100644 index b3e94a7..0000000 --- a/yjs-poll/node_modules/lib0/dist/indexeddbV2.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"indexeddbV2.cjs","sources":["../indexeddbV2.js"],"sourcesContent":["/* eslint-env browser */\n\n/**\n * Helpers to work with IndexedDB.\n * This is an experimental implementation using Pledge instead of Promise.\n *\n * @experimental\n *\n * @module indexeddbv2\n */\n\nimport * as pledge from './pledge.js'\n\n/* c8 ignore start */\n\n/**\n * IDB Request to Pledge transformer\n *\n * @param {pledge.PledgeInstance} p\n * @param {IDBRequest} request\n */\nexport const bindPledge = (p, request) => {\n // @ts-ignore\n request.onerror = event => p.cancel(event.target.error)\n // @ts-ignore\n request.onsuccess = event => p.resolve(event.target.result)\n}\n\n/**\n * @param {string} name\n * @param {function(IDBDatabase):any} initDB Called when the database is first created\n * @return {pledge.PledgeInstance}\n */\nexport const openDB = (name, initDB) => {\n /**\n * @type {pledge.PledgeInstance}\n */\n const p = pledge.create()\n const request = indexedDB.open(name)\n /**\n * @param {any} event\n */\n request.onupgradeneeded = event => initDB(event.target.result)\n /**\n * @param {any} event\n */\n request.onerror = event => p.cancel(event.target.error)\n /**\n * @param {any} event\n */\n request.onsuccess = event => {\n /**\n * @type {IDBDatabase}\n */\n const db = event.target.result\n db.onversionchange = () => { db.close() }\n p.resolve(db)\n }\n return p\n}\n\n/**\n * @param {pledge.Pledge} name\n * @return {pledge.PledgeInstance}\n */\nexport const deleteDB = name => pledge.createWithDependencies((p, name) => bindPledge(p, indexedDB.deleteDatabase(name)), name)\n\n/**\n * @param {IDBDatabase} db\n * @param {Array|Array>} definitions\n */\nexport const createStores = (db, definitions) => definitions.forEach(d =>\n // @ts-ignore\n db.createObjectStore.apply(db, d)\n)\n\n/**\n * @param {pledge.Pledge} db\n * @param {pledge.Pledge>} stores\n * @param {\"readwrite\"|\"readonly\"} [access]\n * @return {pledge.Pledge>}\n */\nexport const transact = (db, stores, access = 'readwrite') => pledge.createWithDependencies((p, db, stores) => {\n const transaction = db.transaction(stores, access)\n p.resolve(stores.map(store => getStore(transaction, store)))\n}, db, stores)\n\n/**\n * @param {IDBObjectStore} store\n * @param {pledge.Pledge} [range]\n * @return {pledge.PledgeInstance}\n */\nexport const count = (store, range) => pledge.createWithDependencies((p, store, range) => bindPledge(p, store.count(range)), store, range)\n\n/**\n * @param {pledge.Pledge} store\n * @param {pledge.Pledge>} key\n * @return {pledge.PledgeInstance>}\n */\nexport const get = (store, key) => pledge.createWithDependencies((p, store, key) => bindPledge(p, store.get(key)), store, key)\n\n/**\n * @param {pledge.Pledge} store\n * @param {String | number | ArrayBuffer | Date | IDBKeyRange | Array } key\n */\nexport const del = (store, key) => pledge.createWithDependencies((p, store, key) => bindPledge(p, store.delete(key)), store, key)\n\n/**\n * @param {pledge.Pledge} store\n * @param {String | number | ArrayBuffer | Date | boolean} item\n * @param {String | number | ArrayBuffer | Date | Array} [key]\n */\nexport const put = (store, item, key) => pledge.createWithDependencies((p, store, item, key) => bindPledge(p, store.put(item, key)), store, item, key)\n\n/**\n * @param {pledge.Pledge} store\n * @param {String | number | ArrayBuffer | Date | boolean} item\n * @param {String | number | ArrayBuffer | Date | Array} key\n * @return {pledge.PledgeInstance}\n */\nexport const add = (store, item, key) => pledge.createWithDependencies((p, store, item, key) => bindPledge(p, store.add(item, key)), store, item, key)\n\n/**\n * @param {pledge.Pledge} store\n * @param {String | number | ArrayBuffer | Date} item\n * @return {pledge.PledgeInstance} Returns the generated key\n */\nexport const addAutoKey = (store, item) => pledge.createWithDependencies((p, store, item) => bindPledge(p, store.add(item)), store, item)\n\n/**\n * @param {pledge.Pledge} store\n * @param {IDBKeyRange} [range]\n * @param {number} [limit]\n * @return {pledge.PledgeInstance>}\n */\nexport const getAll = (store, range, limit) => pledge.createWithDependencies((p, store, range, limit) => bindPledge(p, store.getAll(range, limit)), store, range, limit)\n\n/**\n * @param {pledge.Pledge} store\n * @param {IDBKeyRange} [range]\n * @param {number} [limit]\n * @return {pledge.PledgeInstance>}\n */\nexport const getAllKeys = (store, range, limit) => pledge.createWithDependencies((p, store, range, limit) => bindPledge(p, store.getAllKeys(range, limit)), store, range, limit)\n\n/**\n * @param {IDBObjectStore} store\n * @param {IDBKeyRange|null} query\n * @param {'next'|'prev'|'nextunique'|'prevunique'} direction\n * @return {pledge.PledgeInstance}\n */\nexport const queryFirst = (store, query, direction) => {\n /**\n * @type {any}\n */\n let first = null\n return iterateKeys(store, query, key => {\n first = key\n return false\n }, direction).map(() => first)\n}\n\n/**\n * @param {IDBObjectStore} store\n * @param {IDBKeyRange?} [range]\n * @return {pledge.PledgeInstance}\n */\nexport const getLastKey = (store, range = null) => queryFirst(store, range, 'prev')\n\n/**\n * @param {IDBObjectStore} store\n * @param {IDBKeyRange?} [range]\n * @return {pledge.PledgeInstance}\n */\nexport const getFirstKey = (store, range = null) => queryFirst(store, range, 'next')\n\n/**\n * @typedef KeyValuePair\n * @type {Object}\n * @property {any} k key\n * @property {any} v Value\n */\n\n/**\n * @param {pledge.Pledge} store\n * @param {pledge.Pledge} [range]\n * @param {pledge.Pledge} [limit]\n * @return {pledge.PledgeInstance>}\n */\nexport const getAllKeysValues = (store, range, limit) => pledge.createWithDependencies((p, store, range, limit) => {\n pledge.all([getAllKeys(store, range, limit), getAll(store, range, limit)]).map(([ks, vs]) => ks.map((k, i) => ({ k, v: vs[i] }))).whenResolved(p.resolve.bind(p))\n}, store, range, limit)\n\n/**\n * @param {pledge.PledgeInstance} p\n * @param {any} request\n * @param {function(IDBCursorWithValue):void|boolean|Promise} f\n */\nconst iterateOnRequest = (p, request, f) => {\n request.onerror = p.cancel.bind(p)\n /**\n * @param {any} event\n */\n request.onsuccess = async event => {\n const cursor = event.target.result\n if (cursor === null || (await f(cursor)) === false) {\n p.resolve(undefined)\n return\n }\n cursor.continue()\n }\n}\n\n/**\n * Iterate on keys and values\n * @param {pledge.Pledge} store\n * @param {pledge.Pledge} keyrange\n * @param {function(any,any):void|boolean|Promise} f Callback that receives (value, key)\n * @param {'next'|'prev'|'nextunique'|'prevunique'} direction\n */\nexport const iterate = (store, keyrange, f, direction = 'next') => pledge.createWithDependencies((p, store, keyrange) => {\n iterateOnRequest(p, store.openCursor(keyrange, direction), cursor => f(cursor.value, cursor.key))\n}, store, keyrange)\n\n/**\n * Iterate on the keys (no values)\n *\n * @param {pledge.Pledge} store\n * @param {pledge.Pledge} keyrange\n * @param {function(any):void|boolean|Promise} f callback that receives the key\n * @param {'next'|'prev'|'nextunique'|'prevunique'} direction\n */\nexport const iterateKeys = (store, keyrange, f, direction = 'next') => pledge.createWithDependencies((p, store, keyrange) => {\n iterateOnRequest(p, store.openKeyCursor(keyrange, direction), cursor => f(cursor.key))\n}, store, keyrange)\n\n/**\n * Open store from transaction\n * @param {IDBTransaction} t\n * @param {String} store\n * @returns {IDBObjectStore}\n */\nexport const getStore = (t, store) => t.objectStore(store)\n\n/**\n * @param {any} lower\n * @param {any} upper\n * @param {boolean} lowerOpen\n * @param {boolean} upperOpen\n */\nexport const createIDBKeyRangeBound = (lower, upper, lowerOpen, upperOpen) => IDBKeyRange.bound(lower, upper, lowerOpen, upperOpen)\n\n/**\n * @param {any} upper\n * @param {boolean} upperOpen\n */\nexport const createIDBKeyRangeUpperBound = (upper, upperOpen) => IDBKeyRange.upperBound(upper, upperOpen)\n\n/**\n * @param {any} lower\n * @param {boolean} lowerOpen\n */\nexport const createIDBKeyRangeLowerBound = (lower, lowerOpen) => IDBKeyRange.lowerBound(lower, lowerOpen)\n\n/* c8 ignore stop */\n"],"names":["pledge.create","pledge.createWithDependencies","p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AAM,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,EAAC;AACnG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAC;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,WAAW,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,GAAG,MAAM,KAAKA,6BAA6B,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,KAAK;AAC7H,EAAE,gBAAgB,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAC;AACxF,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAC;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,WAAW,CAAC,KAAK,EAAC;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,sBAAsB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,KAAK,WAAW,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAC;AACnI;AACA;AACA;AACA;AACA;AACY,MAAC,2BAA2B,GAAG,CAAC,KAAK,EAAE,SAAS,KAAK,WAAW,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,EAAC;AACzG;AACA;AACA;AACA;AACA;AACY,MAAC,2BAA2B,GAAG,CAAC,KAAK,EAAE,SAAS,KAAK,WAAW,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,EAAC;AACzG;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/indexeddbV2.d.ts b/yjs-poll/node_modules/lib0/dist/indexeddbV2.d.ts deleted file mode 100644 index 0b104d9..0000000 --- a/yjs-poll/node_modules/lib0/dist/indexeddbV2.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -export function bindPledge(p: pledge.PledgeInstance, request: IDBRequest): void; -export function openDB(name: string, initDB: (arg0: IDBDatabase) => any): pledge.PledgeInstance; -export function deleteDB(name: pledge.Pledge): pledge.PledgeInstance; -export function createStores(db: IDBDatabase, definitions: Array | Array>): void; -export function transact(db: pledge.Pledge, stores: pledge.Pledge>, access?: "readwrite" | "readonly"): pledge.Pledge>; -export function count(store: IDBObjectStore, range?: pledge.Pledge): pledge.PledgeInstance; -export function get(store: pledge.Pledge, key: pledge.Pledge>): pledge.PledgeInstance>; -export function del(store: pledge.Pledge, key: string | number | ArrayBuffer | Date | IDBKeyRange | Array): pledge.PledgeInstance; -export function put(store: pledge.Pledge, item: string | number | ArrayBuffer | Date | boolean, key?: string | number | ArrayBuffer | Date | Array): pledge.PledgeInstance; -export function add(store: pledge.Pledge, item: string | number | ArrayBuffer | Date | boolean, key: string | number | ArrayBuffer | Date | Array): pledge.PledgeInstance; -export function addAutoKey(store: pledge.Pledge, item: string | number | ArrayBuffer | Date): pledge.PledgeInstance; -export function getAll(store: pledge.Pledge, range?: IDBKeyRange, limit?: number): pledge.PledgeInstance>; -export function getAllKeys(store: pledge.Pledge, range?: IDBKeyRange, limit?: number): pledge.PledgeInstance>; -export function queryFirst(store: IDBObjectStore, query: IDBKeyRange | null, direction: "next" | "prev" | "nextunique" | "prevunique"): pledge.PledgeInstance; -export function getLastKey(store: IDBObjectStore, range?: IDBKeyRange | null): pledge.PledgeInstance; -export function getFirstKey(store: IDBObjectStore, range?: IDBKeyRange | null): pledge.PledgeInstance; -export function getAllKeysValues(store: pledge.Pledge, range?: pledge.Pledge, limit?: pledge.Pledge): pledge.PledgeInstance>; -export function iterate(store: pledge.Pledge, keyrange: pledge.Pledge, f: (arg0: any, arg1: any) => void | boolean | Promise, direction?: "next" | "prev" | "nextunique" | "prevunique"): pledge.PledgeInstance; -export function iterateKeys(store: pledge.Pledge, keyrange: pledge.Pledge, f: (arg0: any) => void | boolean | Promise, direction?: "next" | "prev" | "nextunique" | "prevunique"): pledge.PledgeInstance; -export function getStore(t: IDBTransaction, store: string): IDBObjectStore; -export function createIDBKeyRangeBound(lower: any, upper: any, lowerOpen: boolean, upperOpen: boolean): IDBKeyRange; -export function createIDBKeyRangeUpperBound(upper: any, upperOpen: boolean): IDBKeyRange; -export function createIDBKeyRangeLowerBound(lower: any, lowerOpen: boolean): IDBKeyRange; -export type KeyValuePair = { - /** - * key - */ - k: any; - /** - * Value - */ - v: any; -}; -import * as pledge from './pledge.js'; -//# sourceMappingURL=indexeddbV2.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/indexeddbV2.d.ts.map b/yjs-poll/node_modules/lib0/dist/indexeddbV2.d.ts.map deleted file mode 100644 index b1abe0f..0000000 --- a/yjs-poll/node_modules/lib0/dist/indexeddbV2.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"indexeddbV2.d.ts","sourceRoot":"","sources":["../indexeddbV2.js"],"names":[],"mappings":"AAqBO,8BAHI,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,WAC1B,UAAU,QAOpB;AAOM,6BAJI,MAAM,UACN,CAAS,IAAW,EAAX,WAAW,KAAE,GAAG,GACxB,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CA4B7C;AAMM,+BAHI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GACpB,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAEwF;AAMxH,iCAHI,WAAW,eACX,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,GAAC,KAAK,CAAC,MAAM,GAAC,wBAAwB,GAAC,SAAS,CAAC,CAAC,QAK/E;AAQM,6BALI,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,UAC1B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,WAC5B,WAAW,GAAC,UAAU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D,MAAM,GAAC,MAAM,GAAC,YAAY,GAAC,YAAY,qCAI/B;AAQZ,4BAJI,cAAc,kBAEZ,cAAc,CAE+B;AAQnD,8CALI,GAAG,SACH,GAAG,aACH,OAAO,aACP,OAAO,eAEiH;AAM5H,mDAHI,GAAG,aACH,OAAO,eAEuF;AAMlG,mDAHI,GAAG,aACH,OAAO,eAEuF;;;;;OAnF3F,GAAG;;;;OACH,GAAG;;wBAzKO,aAAa"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/indexeddbV2.test.d.ts b/yjs-poll/node_modules/lib0/dist/indexeddbV2.test.d.ts deleted file mode 100644 index c61e1a6..0000000 --- a/yjs-poll/node_modules/lib0/dist/indexeddbV2.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testRetrieveElements(): Promise; -export function testBlocked(): Promise; -//# sourceMappingURL=indexeddbV2.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/indexeddbV2.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/indexeddbV2.test.d.ts.map deleted file mode 100644 index d90b7c6..0000000 --- a/yjs-poll/node_modules/lib0/dist/indexeddbV2.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"indexeddbV2.test.d.ts","sourceRoot":"","sources":["../indexeddbV2.test.js"],"names":[],"mappings":"AA0BO,sDAoEN;AAGM,6CAgBN"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/isomorphic.cjs b/yjs-poll/node_modules/lib0/dist/isomorphic.cjs deleted file mode 100644 index 4663b38..0000000 --- a/yjs-poll/node_modules/lib0/dist/isomorphic.cjs +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var isomorphic_js = require('isomorphic.js'); - - - -Object.defineProperty(exports, 'cryptoRandomBuffer', { - enumerable: true, - get: function () { return isomorphic_js.cryptoRandomBuffer; } -}); -Object.defineProperty(exports, 'performance', { - enumerable: true, - get: function () { return isomorphic_js.performance; } -}); -//# sourceMappingURL=isomorphic.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/isomorphic.cjs.map b/yjs-poll/node_modules/lib0/dist/isomorphic.cjs.map deleted file mode 100644 index 76549af..0000000 --- a/yjs-poll/node_modules/lib0/dist/isomorphic.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"isomorphic.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/iterator-9fc627c1.cjs b/yjs-poll/node_modules/lib0/dist/iterator-9fc627c1.cjs deleted file mode 100644 index 96af2b9..0000000 --- a/yjs-poll/node_modules/lib0/dist/iterator-9fc627c1.cjs +++ /dev/null @@ -1,78 +0,0 @@ -'use strict'; - -/** - * Utility module to create and manipulate Iterators. - * - * @module iterator - */ - -/** - * @template T,R - * @param {Iterator} iterator - * @param {function(T):R} f - * @return {IterableIterator} - */ -const mapIterator = (iterator, f) => ({ - [Symbol.iterator] () { - return this - }, - // @ts-ignore - next () { - const r = iterator.next(); - return { value: r.done ? undefined : f(r.value), done: r.done } - } -}); - -/** - * @template T - * @param {function():IteratorResult} next - * @return {IterableIterator} - */ -const createIterator = next => ({ - /** - * @return {IterableIterator} - */ - [Symbol.iterator] () { - return this - }, - // @ts-ignore - next -}); - -/** - * @template T - * @param {Iterator} iterator - * @param {function(T):boolean} filter - */ -const iteratorFilter = (iterator, filter) => createIterator(() => { - let res; - do { - res = iterator.next(); - } while (!res.done && !filter(res.value)) - return res -}); - -/** - * @template T,M - * @param {Iterator} iterator - * @param {function(T):M} fmap - */ -const iteratorMap = (iterator, fmap) => createIterator(() => { - const { done, value } = iterator.next(); - return { done, value: done ? undefined : fmap(value) } -}); - -var iterator = /*#__PURE__*/Object.freeze({ - __proto__: null, - mapIterator: mapIterator, - createIterator: createIterator, - iteratorFilter: iteratorFilter, - iteratorMap: iteratorMap -}); - -exports.createIterator = createIterator; -exports.iterator = iterator; -exports.iteratorFilter = iteratorFilter; -exports.iteratorMap = iteratorMap; -exports.mapIterator = mapIterator; -//# sourceMappingURL=iterator-9fc627c1.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/iterator-9fc627c1.cjs.map b/yjs-poll/node_modules/lib0/dist/iterator-9fc627c1.cjs.map deleted file mode 100644 index 39a3ded..0000000 --- a/yjs-poll/node_modules/lib0/dist/iterator-9fc627c1.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"iterator-9fc627c1.cjs","sources":["../iterator.js"],"sourcesContent":["/**\n * Utility module to create and manipulate Iterators.\n *\n * @module iterator\n */\n\n/**\n * @template T,R\n * @param {Iterator} iterator\n * @param {function(T):R} f\n * @return {IterableIterator}\n */\nexport const mapIterator = (iterator, f) => ({\n [Symbol.iterator] () {\n return this\n },\n // @ts-ignore\n next () {\n const r = iterator.next()\n return { value: r.done ? undefined : f(r.value), done: r.done }\n }\n})\n\n/**\n * @template T\n * @param {function():IteratorResult} next\n * @return {IterableIterator}\n */\nexport const createIterator = next => ({\n /**\n * @return {IterableIterator}\n */\n [Symbol.iterator] () {\n return this\n },\n // @ts-ignore\n next\n})\n\n/**\n * @template T\n * @param {Iterator} iterator\n * @param {function(T):boolean} filter\n */\nexport const iteratorFilter = (iterator, filter) => createIterator(() => {\n let res\n do {\n res = iterator.next()\n } while (!res.done && !filter(res.value))\n return res\n})\n\n/**\n * @template T,M\n * @param {Iterator} iterator\n * @param {function(T):M} fmap\n */\nexport const iteratorMap = (iterator, fmap) => createIterator(() => {\n const { done, value } = iterator.next()\n return { done, value: done ? undefined : fmap(value) }\n})\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,WAAW,GAAG,CAAC,QAAQ,EAAE,CAAC,MAAM;AAC7C,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG;AACvB,IAAI,OAAO,IAAI;AACf,GAAG;AACH;AACA,EAAE,IAAI,CAAC,GAAG;AACV,IAAI,MAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,GAAE;AAC7B,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;AACnE,GAAG;AACH,CAAC,EAAC;AACF;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAG,IAAI,KAAK;AACvC;AACA;AACA;AACA,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG;AACvB,IAAI,OAAO,IAAI;AACf,GAAG;AACH;AACA,EAAE,IAAI;AACN,CAAC,EAAC;AACF;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,cAAc,CAAC,MAAM;AACzE,EAAE,IAAI,IAAG;AACT,EAAE,GAAG;AACL,IAAI,GAAG,GAAG,QAAQ,CAAC,IAAI,GAAE;AACzB,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC3C,EAAE,OAAO,GAAG;AACZ,CAAC,EAAC;AACF;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,WAAW,GAAG,CAAC,QAAQ,EAAE,IAAI,KAAK,cAAc,CAAC,MAAM;AACpE,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC,IAAI,GAAE;AACzC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE;AACxD,CAAC;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/iterator.cjs b/yjs-poll/node_modules/lib0/dist/iterator.cjs deleted file mode 100644 index f09575e..0000000 --- a/yjs-poll/node_modules/lib0/dist/iterator.cjs +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var iterator = require('./iterator-9fc627c1.cjs'); - - - -exports.createIterator = iterator.createIterator; -exports.iteratorFilter = iterator.iteratorFilter; -exports.iteratorMap = iterator.iteratorMap; -exports.mapIterator = iterator.mapIterator; -//# sourceMappingURL=iterator.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/iterator.cjs.map b/yjs-poll/node_modules/lib0/dist/iterator.cjs.map deleted file mode 100644 index 298b3d0..0000000 --- a/yjs-poll/node_modules/lib0/dist/iterator.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"iterator.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/iterator.d.ts b/yjs-poll/node_modules/lib0/dist/iterator.d.ts deleted file mode 100644 index 91a2024..0000000 --- a/yjs-poll/node_modules/lib0/dist/iterator.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function mapIterator(iterator: Iterator, f: (arg0: T) => R): IterableIterator; -export function createIterator(next: () => IteratorResult): IterableIterator; -export function iteratorFilter(iterator: Iterator, filter: (arg0: T) => boolean): IterableIterator; -export function iteratorMap(iterator: Iterator, fmap: (arg0: T) => M): IterableIterator; -//# sourceMappingURL=iterator.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/iterator.d.ts.map b/yjs-poll/node_modules/lib0/dist/iterator.d.ts.map deleted file mode 100644 index 2529860..0000000 --- a/yjs-poll/node_modules/lib0/dist/iterator.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"iterator.d.ts","sourceRoot":"","sources":["../iterator.js"],"names":[],"mappings":"AAYO,4BALM,CAAC,EAAC,CAAC,YACL,QAAQ,CAAC,CAAC,CAAC,KACX,CAAS,IAAC,EAAD,CAAC,KAAE,CAAC,GACZ,gBAAgB,CAAC,CAAC,CAAC,CAW7B;AAOK,+BAJM,CAAC,QACH,MAAW,cAAc,CAAC,CAAC,CAAC,GAC3B,gBAAgB,CAAC,CAAC,CAAC,CAW7B;AAOK,+BAJM,CAAC,YACH,QAAQ,CAAC,CAAC,CAAC,UACX,CAAS,IAAC,EAAD,CAAC,KAAE,OAAO,uBAQ5B;AAOK,4BAJM,CAAC,EAAC,CAAC,YACL,QAAQ,CAAC,CAAC,CAAC,QACX,CAAS,IAAC,EAAD,CAAC,KAAE,CAAC,mCAKtB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/json-092190a1.cjs b/yjs-poll/node_modules/lib0/dist/json-092190a1.cjs deleted file mode 100644 index c68df3c..0000000 --- a/yjs-poll/node_modules/lib0/dist/json-092190a1.cjs +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; - -/** - * JSON utility functions. - * - * @module json - */ - -/** - * Transform JavaScript object to JSON. - * - * @param {any} object - * @return {string} - */ -const stringify = JSON.stringify; - -/** - * Parse JSON object. - * - * @param {string} json - * @return {any} - */ -const parse = JSON.parse; - -var json = /*#__PURE__*/Object.freeze({ - __proto__: null, - stringify: stringify, - parse: parse -}); - -exports.json = json; -exports.parse = parse; -exports.stringify = stringify; -//# sourceMappingURL=json-092190a1.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/json-092190a1.cjs.map b/yjs-poll/node_modules/lib0/dist/json-092190a1.cjs.map deleted file mode 100644 index a1f913e..0000000 --- a/yjs-poll/node_modules/lib0/dist/json-092190a1.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"json-092190a1.cjs","sources":["../json.js"],"sourcesContent":["/**\n * JSON utility functions.\n *\n * @module json\n */\n\n/**\n * Transform JavaScript object to JSON.\n *\n * @param {any} object\n * @return {string}\n */\nexport const stringify = JSON.stringify\n\n/**\n * Parse JSON object.\n *\n * @param {string} json\n * @return {any}\n */\nexport const parse = JSON.parse\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,SAAS,GAAG,IAAI,CAAC,UAAS;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,KAAK,GAAG,IAAI,CAAC;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/json.cjs b/yjs-poll/node_modules/lib0/dist/json.cjs deleted file mode 100644 index e660d4b..0000000 --- a/yjs-poll/node_modules/lib0/dist/json.cjs +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var json = require('./json-092190a1.cjs'); - - - -exports.parse = json.parse; -exports.stringify = json.stringify; -//# sourceMappingURL=json.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/json.cjs.map b/yjs-poll/node_modules/lib0/dist/json.cjs.map deleted file mode 100644 index c3dabfb..0000000 --- a/yjs-poll/node_modules/lib0/dist/json.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"json.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/json.d.ts b/yjs-poll/node_modules/lib0/dist/json.d.ts deleted file mode 100644 index 146362c..0000000 --- a/yjs-poll/node_modules/lib0/dist/json.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * JSON utility functions. - * - * @module json - */ -/** - * Transform JavaScript object to JSON. - * - * @param {any} object - * @return {string} - */ -export const stringify: { - (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string; - (value: any, replacer?: (number | string)[] | null, space?: string | number): string; -}; -/** - * Parse JSON object. - * - * @param {string} json - * @return {any} - */ -export const parse: (text: string, reviver?: (this: any, key: string, value: any) => any) => any; -//# sourceMappingURL=json.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/json.d.ts.map b/yjs-poll/node_modules/lib0/dist/json.d.ts.map deleted file mode 100644 index dce94de..0000000 --- a/yjs-poll/node_modules/lib0/dist/json.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../json.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH;;;EAAuC;AAEvC;;;;;GAKG;AACH,iGAA+B"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/jwt.cjs b/yjs-poll/node_modules/lib0/dist/jwt.cjs deleted file mode 100644 index f0c4172..0000000 --- a/yjs-poll/node_modules/lib0/dist/jwt.cjs +++ /dev/null @@ -1,96 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var error = require('./error-0c1f634f.cjs'); -var buffer = require('./buffer-3e750729.cjs'); -var string = require('./string-fddc5f8b.cjs'); -var json = require('./json-092190a1.cjs'); -var ecdsa = require('./ecdsa.cjs'); -var time = require('./time-d8438852.cjs'); -require('./environment-1c97264d.cjs'); -require('./map-24d263c0.cjs'); -require('./conditions-f5c0c102.cjs'); -require('./storage.cjs'); -require('./function-314580f7.cjs'); -require('./array-78849c95.cjs'); -require('./set-5b47859e.cjs'); -require('./object-c0c9435b.cjs'); -require('./equality.cjs'); -require('./math-96d5e8c4.cjs'); -require('./encoding-1a745c43.cjs'); -require('./number-1fb57bba.cjs'); -require('./binary-ac8e39e2.cjs'); -require('./decoding-76e75827.cjs'); -require('lib0/webcrypto'); -require('./common.cjs'); -require('./metric.cjs'); - -/** - * @param {Object} data - */ -const _stringify = data => buffer.toBase64UrlEncoded(string.encodeUtf8(json.stringify(data))); - -/** - * @param {string} base64url - */ -const _parse = base64url => json.parse(string.decodeUtf8(buffer.fromBase64UrlEncoded(base64url))); - -/** - * @param {CryptoKey} privateKey - * @param {Object} payload - */ -const encodeJwt = (privateKey, payload) => { - const { name: algName, namedCurve: algCurve } = /** @type {any} */ (privateKey.algorithm); - /* c8 ignore next 3 */ - if (algName !== 'ECDSA' || algCurve !== 'P-384') { - error.unexpectedCase(); - } - const header = { - alg: 'ES384', - typ: 'JWT' - }; - const jwt = _stringify(header) + '.' + _stringify(payload); - return ecdsa.sign(privateKey, string.encodeUtf8(jwt)).then(signature => - jwt + '.' + buffer.toBase64UrlEncoded(signature) - ) -}; - -/** - * @param {CryptoKey} publicKey - * @param {string} jwt - */ -const verifyJwt = async (publicKey, jwt) => { - const [headerBase64, payloadBase64, signatureBase64] = jwt.split('.'); - const verified = await ecdsa.verify(publicKey, buffer.fromBase64UrlEncoded(signatureBase64), string.encodeUtf8(headerBase64 + '.' + payloadBase64)); - /* c8 ignore next 3 */ - if (!verified) { - throw new Error('Invalid JWT') - } - const payload = _parse(payloadBase64); - if (payload.exp != null && time.getUnixTime() > payload.exp) { - throw new Error('Expired JWT') - } - return { - header: _parse(headerBase64), - payload - } -}; - -/** - * Decode a jwt without verifying it. Probably a bad idea to use this. Only use if you know the jwt was already verified! - * - * @param {string} jwt - */ -const unsafeDecode = jwt => { - const [headerBase64, payloadBase64] = jwt.split('.'); - return { - header: _parse(headerBase64), - payload: _parse(payloadBase64) - } -}; - -exports.encodeJwt = encodeJwt; -exports.unsafeDecode = unsafeDecode; -exports.verifyJwt = verifyJwt; -//# sourceMappingURL=jwt.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/jwt.cjs.map b/yjs-poll/node_modules/lib0/dist/jwt.cjs.map deleted file mode 100644 index 1050ef0..0000000 --- a/yjs-poll/node_modules/lib0/dist/jwt.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"jwt.cjs","sources":["../crypto/jwt.js"],"sourcesContent":["import * as error from '../error.js'\nimport * as buffer from '../buffer.js'\nimport * as string from '../string.js'\nimport * as json from '../json.js'\nimport * as ecdsa from '../crypto/ecdsa.js'\nimport * as time from '../time.js'\n\n/**\n * @param {Object} data\n */\nconst _stringify = data => buffer.toBase64UrlEncoded(string.encodeUtf8(json.stringify(data)))\n\n/**\n * @param {string} base64url\n */\nconst _parse = base64url => json.parse(string.decodeUtf8(buffer.fromBase64UrlEncoded(base64url)))\n\n/**\n * @param {CryptoKey} privateKey\n * @param {Object} payload\n */\nexport const encodeJwt = (privateKey, payload) => {\n const { name: algName, namedCurve: algCurve } = /** @type {any} */ (privateKey.algorithm)\n /* c8 ignore next 3 */\n if (algName !== 'ECDSA' || algCurve !== 'P-384') {\n error.unexpectedCase()\n }\n const header = {\n alg: 'ES384',\n typ: 'JWT'\n }\n const jwt = _stringify(header) + '.' + _stringify(payload)\n return ecdsa.sign(privateKey, string.encodeUtf8(jwt)).then(signature =>\n jwt + '.' + buffer.toBase64UrlEncoded(signature)\n )\n}\n\n/**\n * @param {CryptoKey} publicKey\n * @param {string} jwt\n */\nexport const verifyJwt = async (publicKey, jwt) => {\n const [headerBase64, payloadBase64, signatureBase64] = jwt.split('.')\n const verified = await ecdsa.verify(publicKey, buffer.fromBase64UrlEncoded(signatureBase64), string.encodeUtf8(headerBase64 + '.' + payloadBase64))\n /* c8 ignore next 3 */\n if (!verified) {\n throw new Error('Invalid JWT')\n }\n const payload = _parse(payloadBase64)\n if (payload.exp != null && time.getUnixTime() > payload.exp) {\n throw new Error('Expired JWT')\n }\n return {\n header: _parse(headerBase64),\n payload\n }\n}\n\n/**\n * Decode a jwt without verifying it. Probably a bad idea to use this. Only use if you know the jwt was already verified!\n *\n * @param {string} jwt\n */\nexport const unsafeDecode = jwt => {\n const [headerBase64, payloadBase64] = jwt.split('.')\n return {\n header: _parse(headerBase64),\n payload: _parse(payloadBase64)\n }\n}\n"],"names":["buffer.toBase64UrlEncoded","string.encodeUtf8","json.stringify","json.parse","string.decodeUtf8","buffer.fromBase64UrlEncoded","error.unexpectedCase","ecdsa.sign","ecdsa.verify","time.getUnixTime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA;AACA;AACA;AACA,MAAM,UAAU,GAAG,IAAI,IAAIA,yBAAyB,CAACC,iBAAiB,CAACC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAC;AAC7F;AACA;AACA;AACA;AACA,MAAM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AO,GAAG,MAAM,CAAC,aAAa,EAAC;AACvC,EAAE,IAAI,OAAO,CAAC,GAAG,IAAI,IAAI,IAAIQ,gBAAgB,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE;AAC/D,IAAI,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC;AAClC,GAAG;AACH,EAAE,OAAO;AACT,IAAI,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC;AAChC,IAAI,OAAO;AACX,GAAG;AACH,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,YAAY,GAAG,GAAG,IAAI;AACnC,EAAE,MAAM,CAAC,YAAY,EAAE,aAAa,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,EAAC;AACtD,EAAE,OAAO;AACT,IAAI,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC;AAChC,IAAI,OAAO,EAAE,MAAM,CAAC,aAAa,CAAC;AAClC,GAAG;AACH;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/list.cjs b/yjs-poll/node_modules/lib0/dist/list.cjs deleted file mode 100644 index f5da03b..0000000 --- a/yjs-poll/node_modules/lib0/dist/list.cjs +++ /dev/null @@ -1,266 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var _function = require('./function-314580f7.cjs'); -var error = require('./error-0c1f634f.cjs'); -var equality = require('./equality.cjs'); -require('./array-78849c95.cjs'); -require('./set-5b47859e.cjs'); -require('./object-c0c9435b.cjs'); - -class ListNode { - constructor () { - /** - * @type {this|null} - */ - this.next = null; - /** - * @type {this|null} - */ - this.prev = null; - } -} - -/** - * @template {ListNode} N - */ -class List { - constructor () { - /** - * @type {N | null} - */ - this.start = null; - /** - * @type {N | null} - */ - this.end = null; - this.len = 0; - } - - * [Symbol.iterator] () { - let n = this.start; - while (n) { - yield n; - n = n.next; - } - } - - toArray () { - return map(this, _function.id) - } - - /** - * @param {function(N):any} f - */ - forEach (f) { - forEach(this, f); - } - - /** - * @template M - * @param {function(N):M} f - * @return {Array} - */ - map (f) { - return map(this, f) - } - - /** - * @param {List} other - */ - [equality.EqualityTraitSymbol] (other) { - let n = this.start; - let m = other.start; - while (n && m) { - if (!equality.equals(n, m)) return false - n = n.next; - m = m.next; - } - return n === m // only true iff n == null && m == null - } -} - -/** - * @note The queue implementation is experimental and unfinished. - * Don't use this in production yet. - * - * @template {ListNode} N - * - * @return {List} - */ -const create = () => new List(); - -/** - * @template {ListNode} N - * - * @param {List} queue - */ -const isEmpty = queue => queue.start === null; - -/** - * Remove a single node from the queue. Only works with Queues that operate on Doubly-linked lists of nodes. - * - * @template {ListNode} N - * - * @param {List} list - * @param {N} node - */ -const remove = (list, node) => { - const prev = node.prev; - const next = node.next; - if (prev) { - prev.next = next; - } else { - list.start = next; - } - if (next) { - next.prev = prev; - } else { - list.end = prev; - } - list.len--; - return node -}; - -/** - * @deprecated @todo remove in next major release - */ -const removeNode = remove; - -/** - * @template {ListNode} N - * - * @param {List} queue - * @param {N| null} left - * @param {N| null} right - * @param {N} node - */ -const insertBetween = (queue, left, right, node) => { - /* c8 ignore start */ - if (left != null && left.next !== right) { - throw error.unexpectedCase() - } - /* c8 ignore stop */ - if (left) { - left.next = node; - } else { - queue.start = node; - } - if (right) { - right.prev = node; - } else { - queue.end = node; - } - node.prev = left; - node.next = right; - queue.len++; -}; - -/** - * Remove a single node from the queue. Only works with Queues that operate on Doubly-linked lists of nodes. - * - * @template {ListNode} N - * - * @param {List} queue - * @param {N} node - * @param {N} newNode - */ -const replace = (queue, node, newNode) => { - insertBetween(queue, node, node.next, newNode); - remove(queue, node); -}; - -/** - * @template {ListNode} N - * - * @param {List} queue - * @param {N} n - */ -const pushEnd = (queue, n) => - insertBetween(queue, queue.end, null, n); - -/** - * @template {ListNode} N - * - * @param {List} queue - * @param {N} n - */ -const pushFront = (queue, n) => - insertBetween(queue, null, queue.start, n); - -/** - * @template {ListNode} N - * - * @param {List} list - * @return {N| null} - */ -const popFront = list => - list.start ? removeNode(list, list.start) : null; - -/** - * @template {ListNode} N - * - * @param {List} list - * @return {N| null} - */ -const popEnd = list => - list.end ? removeNode(list, list.end) : null; - -/** - * @template {ListNode} N - * @template M - * - * @param {List} list - * @param {function(N):M} f - * @return {Array} - */ -const map = (list, f) => { - /** - * @type {Array} - */ - const arr = []; - let n = list.start; - while (n) { - arr.push(f(n)); - n = n.next; - } - return arr -}; - -/** - * @template {ListNode} N - * - * @param {List} list - */ -const toArray = list => map(list, _function.id); - -/** - * @template {ListNode} N - * @param {List} list - * @param {function(N):any} f - */ -const forEach = (list, f) => { - let n = list.start; - while (n) { - f(n); - n = n.next; - } -}; - -exports.List = List; -exports.ListNode = ListNode; -exports.create = create; -exports.forEach = forEach; -exports.insertBetween = insertBetween; -exports.isEmpty = isEmpty; -exports.map = map; -exports.popEnd = popEnd; -exports.popFront = popFront; -exports.pushEnd = pushEnd; -exports.pushFront = pushFront; -exports.remove = remove; -exports.removeNode = removeNode; -exports.replace = replace; -exports.toArray = toArray; -//# sourceMappingURL=list.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/list.cjs.map b/yjs-poll/node_modules/lib0/dist/list.cjs.map deleted file mode 100644 index 0d02aa8..0000000 --- a/yjs-poll/node_modules/lib0/dist/list.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"list.cjs","sources":["../list.js"],"sourcesContent":["import { id } from './function.js'\nimport * as error from './error.js'\nimport * as equalityTrait from './trait/equality.js'\nimport * as f from './function.js'\n\nexport class ListNode {\n constructor () {\n /**\n * @type {this|null}\n */\n this.next = null\n /**\n * @type {this|null}\n */\n this.prev = null\n }\n}\n\n/**\n * @template {ListNode} N\n */\nexport class List {\n constructor () {\n /**\n * @type {N | null}\n */\n this.start = null\n /**\n * @type {N | null}\n */\n this.end = null\n this.len = 0\n }\n\n * [Symbol.iterator] () {\n let n = this.start\n while (n) {\n yield n\n n = n.next\n }\n }\n\n toArray () {\n return map(this, f.id)\n }\n\n /**\n * @param {function(N):any} f\n */\n forEach (f) {\n forEach(this, f)\n }\n\n /**\n * @template M\n * @param {function(N):M} f\n * @return {Array}\n */\n map (f) {\n return map(this, f)\n }\n\n /**\n * @param {List} other\n */\n [equalityTrait.EqualityTraitSymbol] (other) {\n let n = this.start\n let m = other.start\n while (n && m) {\n if (!equalityTrait.equals(n, m)) return false\n n = n.next\n m = m.next\n }\n return n === m // only true iff n == null && m == null\n }\n}\n\n/**\n * @note The queue implementation is experimental and unfinished.\n * Don't use this in production yet.\n *\n * @template {ListNode} N\n *\n * @return {List}\n */\nexport const create = () => new List()\n\n/**\n * @template {ListNode} N\n *\n * @param {List} queue\n */\nexport const isEmpty = queue => queue.start === null\n\n/**\n * Remove a single node from the queue. Only works with Queues that operate on Doubly-linked lists of nodes.\n *\n * @template {ListNode} N\n *\n * @param {List} list\n * @param {N} node\n */\nexport const remove = (list, node) => {\n const prev = node.prev\n const next = node.next\n if (prev) {\n prev.next = next\n } else {\n list.start = next\n }\n if (next) {\n next.prev = prev\n } else {\n list.end = prev\n }\n list.len--\n return node\n}\n\n/**\n * @deprecated @todo remove in next major release\n */\nexport const removeNode = remove\n\n/**\n * @template {ListNode} N\n *\n * @param {List} queue\n * @param {N| null} left\n * @param {N| null} right\n * @param {N} node\n */\nexport const insertBetween = (queue, left, right, node) => {\n /* c8 ignore start */\n if (left != null && left.next !== right) {\n throw error.unexpectedCase()\n }\n /* c8 ignore stop */\n if (left) {\n left.next = node\n } else {\n queue.start = node\n }\n if (right) {\n right.prev = node\n } else {\n queue.end = node\n }\n node.prev = left\n node.next = right\n queue.len++\n}\n\n/**\n * Remove a single node from the queue. Only works with Queues that operate on Doubly-linked lists of nodes.\n *\n * @template {ListNode} N\n *\n * @param {List} queue\n * @param {N} node\n * @param {N} newNode\n */\nexport const replace = (queue, node, newNode) => {\n insertBetween(queue, node, node.next, newNode)\n remove(queue, node)\n}\n\n/**\n * @template {ListNode} N\n *\n * @param {List} queue\n * @param {N} n\n */\nexport const pushEnd = (queue, n) =>\n insertBetween(queue, queue.end, null, n)\n\n/**\n * @template {ListNode} N\n *\n * @param {List} queue\n * @param {N} n\n */\nexport const pushFront = (queue, n) =>\n insertBetween(queue, null, queue.start, n)\n\n/**\n * @template {ListNode} N\n *\n * @param {List} list\n * @return {N| null}\n */\nexport const popFront = list =>\n list.start ? removeNode(list, list.start) : null\n\n/**\n * @template {ListNode} N\n *\n * @param {List} list\n * @return {N| null}\n */\nexport const popEnd = list =>\n list.end ? removeNode(list, list.end) : null\n\n/**\n * @template {ListNode} N\n * @template M\n *\n * @param {List} list\n * @param {function(N):M} f\n * @return {Array}\n */\nexport const map = (list, f) => {\n /**\n * @type {Array}\n */\n const arr = []\n let n = list.start\n while (n) {\n arr.push(f(n))\n n = n.next\n }\n return arr\n}\n\n/**\n * @template {ListNode} N\n *\n * @param {List} list\n */\nexport const toArray = list => map(list, id)\n\n/**\n * @template {ListNode} N\n * @param {List} list\n * @param {function(N):any} f\n */\nexport const forEach = (list, f) => {\n let n = list.start\n while (n) {\n f(n)\n n = n.next\n }\n}\n"],"names":["f.id","equalityTrait.EqualityTraitSymbol","equalityTrait.equals","error.unexpectedCase","id"],"mappings":";;;;;;;;;;;AAKO,MAAM,QAAQ,CAAC;AACtB,EAAE,WAAW,CAAC,GAAG;AACjB;AACA;AACA;AACA,IAAI,IAAI,CAAC,IAAI,GAAG,KAAI;AACpB;AACA;AACA;AACA,IAAI,IAAI,CAAC,IAAI,GAAG,KAAI;AACpB,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACO,MAAM,IAAI,CAAC;AAClB,EAAE,WAAW,CAAC,GAAG;AACjB;AACA;AACA;AACA,IAAI,IAAI,CAAC,KAAK,GAAG,KAAI;AACrB;AACA;AACA;AACA,IAAI,IAAI,CAAC,GAAG,GAAG,KAAI;AACnB,IAAI,IAAI,CAAC,GAAG,GAAG,EAAC;AAChB,GAAG;AACH;AACA,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,GAAG;AACzB,IAAI,IAAI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;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,OAAO,GAAG,IAAI,IAAI,GAAG,CAAC,IAAI,EAAEC,YAAE,EAAC;AAC5C;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK;AACpC,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,MAAK;AACpB,EAAE,OAAO,CAAC,EAAE;AACZ,IAAI,CAAC,CAAC,CAAC,EAAC;AACR,IAAI,CAAC,GAAG,CAAC,CAAC,KAAI;AACd,GAAG;AACH;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/list.d.ts b/yjs-poll/node_modules/lib0/dist/list.d.ts deleted file mode 100644 index bd60710..0000000 --- a/yjs-poll/node_modules/lib0/dist/list.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -export class ListNode { - /** - * @type {this|null} - */ - next: this | null; - /** - * @type {this|null} - */ - prev: this | null; -} -/** - * @template {ListNode} N - */ -export class List { - /** - * @type {N | null} - */ - start: N | null; - /** - * @type {N | null} - */ - end: N | null; - len: number; - toArray(): N[]; - /** - * @param {function(N):any} f - */ - forEach(f: (arg0: N) => any): void; - /** - * @template M - * @param {function(N):M} f - * @return {Array} - */ - map(f: (arg0: N) => M): Array; - [Symbol.iterator](): Generator; - /** - * @param {List} other - */ - [equalityTrait.EqualityTraitSymbol](other: List): boolean; -} -export function create(): List; -export function isEmpty(queue: List): boolean; -export function remove(list: List, node: N): N; -export function removeNode(list: List, node: N): N; -export function insertBetween(queue: List, left: N | null, right: N | null, node: N): void; -export function replace(queue: List, node: N, newNode: N): void; -export function pushEnd(queue: List, n: N): void; -export function pushFront(queue: List, n: N): void; -export function popFront(list: List): N | null; -export function popEnd(list: List): N | null; -export function map(list: List, f: (arg0: N) => M): Array; -export function toArray(list: List): N[]; -export function forEach(list: List, f: (arg0: N) => any): void; -import * as equalityTrait from './trait/equality.js'; -//# sourceMappingURL=list.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/list.d.ts.map b/yjs-poll/node_modules/lib0/dist/list.d.ts.map deleted file mode 100644 index 3e9ba46..0000000 --- a/yjs-poll/node_modules/lib0/dist/list.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../list.js"],"names":[],"mappings":"AAKA;IAEI;;OAEG;IACH,MAFU,IAAI,GAAC,IAAI,CAEH;IAChB;;OAEG;IACH,MAFU,IAAI,GAAC,IAAI,CAEH;CAEnB;AAED;;GAEG;AACH,kBAFwB,CAAC,SAAX,QAAS;IAInB;;OAEG;IACH,OAFU,CAAC,GAAG,IAAI,CAED;IACjB;;OAEG;IACH,KAFU,CAAC,GAAG,IAAI,CAEH;IACf,YAAY;IAWd,eAEC;IAED;;OAEG;IACH,WAFW,CAAS,IAAC,EAAD,CAAC,KAAE,GAAG,QAIzB;IAED;;;;OAIG;IACH,IAJa,CAAC,KACH,CAAS,IAAC,EAAD,CAAC,KAAE,CAAC,GACZ,KAAK,CAAC,CAAC,CAAC,CAInB;IA1BD,iDAMC;IAsBD;;OAEG;IACH,2CAFW,IAAI,CAAC,GAAG,CAAC,WAWnB;CACF;AAUM,uBAJiB,CAAC,SAAX,QAAS,KAEX,IAAI,CAAC,CAAC,CAAC,CAEmB;AAO/B,wBAJiB,CAAC,SAAX,QAAS,SAEZ,IAAI,CAAC,CAAC,CAAC,WAEkC;AAU7C,uBALiB,CAAC,SAAX,QAAS,QAEZ,IAAI,CAAC,CAAC,CAAC,QACP,CAAC,KAiBX;AAfM,2BALiB,CAAC,SAAX,QAAS,QAEZ,IAAI,CAAC,CAAC,CAAC,QACP,CAAC,KAiBX;AAeM,8BAPiB,CAAC,SAAX,QAAS,SAEZ,IAAI,CAAC,CAAC,CAAC,QACP,CAAC,GAAE,IAAI,SACP,CAAC,GAAE,IAAI,QACP,CAAC,QAqBX;AAWM,wBANiB,CAAC,SAAX,QAAS,SAEZ,IAAI,CAAC,CAAC,CAAC,QACP,CAAC,WACD,CAAC,QAKX;AAQM,wBALiB,CAAC,SAAX,QAAS,SAEZ,IAAI,CAAC,CAAC,CAAC,KACP,CAAC,QAG8B;AAQnC,0BALiB,CAAC,SAAX,QAAS,SAEZ,IAAI,CAAC,CAAC,CAAC,KACP,CAAC,QAGgC;AAQrC,yBALiB,CAAC,SAAX,QAAS,QAEZ,IAAI,CAAC,CAAC,CAAC,GACN,CAAC,GAAE,IAAI,CAG+B;AAQ3C,uBALiB,CAAC,SAAX,QAAS,QAEZ,IAAI,CAAC,CAAC,CAAC,GACN,CAAC,GAAE,IAAI,CAG2B;AAUvC,oBAPiB,CAAC,SAAX,QAAS,EACV,CAAC,QAEH,IAAI,CAAC,CAAC,CAAC,KACP,CAAS,IAAC,EAAD,CAAC,KAAE,CAAC,GACZ,KAAK,CAAC,CAAC,CAAC,CAanB;AAOM,wBAJiB,CAAC,SAAX,QAAS,QAEZ,IAAI,CAAC,CAAC,CAAC,OAE0B;AAOrC,wBAJiB,CAAC,SAAX,QAAS,QACZ,IAAI,CAAC,CAAC,CAAC,KACP,CAAS,IAAC,EAAD,CAAC,KAAE,GAAG,QAQzB;+BAhP8B,qBAAqB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/list.test.d.ts b/yjs-poll/node_modules/lib0/dist/list.test.d.ts deleted file mode 100644 index 7227113..0000000 --- a/yjs-poll/node_modules/lib0/dist/list.test.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export function testAssignability(_tc: t.TestCase): void; -export function testEnqueueDequeue(_tc: t.TestCase): void; -export function testSelectivePop(_tc: t.TestCase): void; -export function testEquality(): void; -import * as t from './testing.js'; -//# sourceMappingURL=list.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/list.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/list.test.d.ts.map deleted file mode 100644 index e12f350..0000000 --- a/yjs-poll/node_modules/lib0/dist/list.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"list.test.d.ts","sourceRoot":"","sources":["../list.test.js"],"names":[],"mappings":"AA2BO,uCAFI,CAAC,CAAC,QAAQ,QAcpB;AAKM,wCAFI,CAAC,CAAC,QAAQ,QA8BpB;AAKM,sCAFI,CAAC,CAAC,QAAQ,QAiCpB;AAEM,qCAgBN;mBA9HkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/logging.cjs b/yjs-poll/node_modules/lib0/dist/logging.cjs deleted file mode 100644 index b5514b0..0000000 --- a/yjs-poll/node_modules/lib0/dist/logging.cjs +++ /dev/null @@ -1,428 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var environment = require('./environment-1c97264d.cjs'); -var set = require('./set-5b47859e.cjs'); -var pair = require('./pair-ab022bc3.cjs'); -var dom = require('./dom-7e625b09.cjs'); -var json = require('./json-092190a1.cjs'); -var map = require('./map-24d263c0.cjs'); -var eventloop = require('./eventloop-a0168106.cjs'); -var math = require('./math-96d5e8c4.cjs'); -var logging_common = require('./logging.common.cjs'); -require('./string-fddc5f8b.cjs'); -require('./array-78849c95.cjs'); -require('./conditions-f5c0c102.cjs'); -require('./storage.cjs'); -require('./function-314580f7.cjs'); -require('./object-c0c9435b.cjs'); -require('./equality.cjs'); -require('./schema.cjs'); -require('./error-0c1f634f.cjs'); -require('./prng-37d48618.cjs'); -require('./binary-ac8e39e2.cjs'); -require('./buffer-3e750729.cjs'); -require('./encoding-1a745c43.cjs'); -require('./number-1fb57bba.cjs'); -require('./decoding-76e75827.cjs'); -require('./time-d8438852.cjs'); -require('./metric.cjs'); -require('./symbol-9c439012.cjs'); - -/** - * Isomorphic logging module with support for colors! - * - * @module logging - */ - -/** - * @type {Object>} - */ -const _browserStyleMap = { - [logging_common.BOLD]: pair.create('font-weight', 'bold'), - [logging_common.UNBOLD]: pair.create('font-weight', 'normal'), - [logging_common.BLUE]: pair.create('color', 'blue'), - [logging_common.GREEN]: pair.create('color', 'green'), - [logging_common.GREY]: pair.create('color', 'grey'), - [logging_common.RED]: pair.create('color', 'red'), - [logging_common.PURPLE]: pair.create('color', 'purple'), - [logging_common.ORANGE]: pair.create('color', 'orange'), // not well supported in chrome when debugging node with inspector - TODO: deprecate - [logging_common.UNCOLOR]: pair.create('color', 'black') -}; - -/** - * @param {Array} args - * @return {Array} - */ -/* c8 ignore start */ -const computeBrowserLoggingArgs = (args) => { - if (args.length === 1 && args[0]?.constructor === Function) { - args = /** @type {Array} */ (/** @type {[function]} */ (args)[0]()); - } - const strBuilder = []; - const styles = []; - const currentStyle = map.create(); - /** - * @type {Array} - */ - let logArgs = []; - // try with formatting until we find something unsupported - let i = 0; - for (; i < args.length; i++) { - const arg = args[i]; - // @ts-ignore - const style = _browserStyleMap[arg]; - if (style !== undefined) { - currentStyle.set(style.left, style.right); - } else { - if (arg === undefined) { - break - } - if (arg.constructor === String || arg.constructor === Number) { - const style = dom.mapToStyleString(currentStyle); - if (i > 0 || style.length > 0) { - strBuilder.push('%c' + arg); - styles.push(style); - } else { - strBuilder.push(arg); - } - } else { - break - } - } - } - if (i > 0) { - // create logArgs with what we have so far - logArgs = styles; - logArgs.unshift(strBuilder.join('')); - } - // append the rest - for (; i < args.length; i++) { - const arg = args[i]; - if (!(arg instanceof Symbol)) { - logArgs.push(arg); - } - } - return logArgs -}; -/* c8 ignore stop */ - -/* c8 ignore start */ -const computeLoggingArgs = environment.supportsColor - ? computeBrowserLoggingArgs - : logging_common.computeNoColorLoggingArgs; -/* c8 ignore stop */ - -/** - * @param {Array} args - */ -const print = (...args) => { - console.log(...computeLoggingArgs(args)); - /* c8 ignore next */ - vconsoles.forEach((vc) => vc.print(args)); -}; - -/* c8 ignore start */ -/** - * @param {Array} args - */ -const warn = (...args) => { - console.warn(...computeLoggingArgs(args)); - args.unshift(logging_common.ORANGE); - vconsoles.forEach((vc) => vc.print(args)); -}; -/* c8 ignore stop */ - -/** - * @param {Error} err - */ -/* c8 ignore start */ -const printError = (err) => { - console.error(err); - vconsoles.forEach((vc) => vc.printError(err)); -}; -/* c8 ignore stop */ - -/** - * @param {string} url image location - * @param {number} height height of the image in pixel - */ -/* c8 ignore start */ -const printImg = (url, height) => { - if (environment.isBrowser) { - console.log( - '%c ', - `font-size: ${height}px; background-size: contain; background-repeat: no-repeat; background-image: url(${url})` - ); - // console.log('%c ', `font-size: ${height}x; background: url(${url}) no-repeat;`) - } - vconsoles.forEach((vc) => vc.printImg(url, height)); -}; -/* c8 ignore stop */ - -/** - * @param {string} base64 - * @param {number} height - */ -/* c8 ignore next 2 */ -const printImgBase64 = (base64, height) => - printImg(`data:image/gif;base64,${base64}`, height); - -/** - * @param {Array} args - */ -const group = (...args) => { - console.group(...computeLoggingArgs(args)); - /* c8 ignore next */ - vconsoles.forEach((vc) => vc.group(args)); -}; - -/** - * @param {Array} args - */ -const groupCollapsed = (...args) => { - console.groupCollapsed(...computeLoggingArgs(args)); - /* c8 ignore next */ - vconsoles.forEach((vc) => vc.groupCollapsed(args)); -}; - -const groupEnd = () => { - console.groupEnd(); - /* c8 ignore next */ - vconsoles.forEach((vc) => vc.groupEnd()); -}; - -/** - * @param {function():Node} createNode - */ -/* c8 ignore next 2 */ -const printDom = (createNode) => - vconsoles.forEach((vc) => vc.printDom(createNode())); - -/** - * @param {HTMLCanvasElement} canvas - * @param {number} height - */ -/* c8 ignore next 2 */ -const printCanvas = (canvas, height) => - printImg(canvas.toDataURL(), height); - -const vconsoles = set.create(); - -/** - * @param {Array} args - * @return {Array} - */ -/* c8 ignore start */ -const _computeLineSpans = (args) => { - const spans = []; - const currentStyle = new Map(); - // try with formatting until we find something unsupported - let i = 0; - for (; i < args.length; i++) { - let arg = args[i]; - // @ts-ignore - const style = _browserStyleMap[arg]; - if (style !== undefined) { - currentStyle.set(style.left, style.right); - } else { - if (arg === undefined) { - arg = 'undefined '; - } - if (arg.constructor === String || arg.constructor === Number) { - // @ts-ignore - const span = dom.element('span', [ - pair.create('style', dom.mapToStyleString(currentStyle)) - ], [dom.text(arg.toString())]); - if (span.innerHTML === '') { - span.innerHTML = ' '; - } - spans.push(span); - } else { - break - } - } - } - // append the rest - for (; i < args.length; i++) { - let content = args[i]; - if (!(content instanceof Symbol)) { - if (content.constructor !== String && content.constructor !== Number) { - content = ' ' + json.stringify(content) + ' '; - } - spans.push( - dom.element('span', [], [dom.text(/** @type {string} */ (content))]) - ); - } - } - return spans -}; -/* c8 ignore stop */ - -const lineStyle = - 'font-family:monospace;border-bottom:1px solid #e2e2e2;padding:2px;'; - -/* c8 ignore start */ -class VConsole { - /** - * @param {Element} dom - */ - constructor (dom) { - this.dom = dom; - /** - * @type {Element} - */ - this.ccontainer = this.dom; - this.depth = 0; - vconsoles.add(this); - } - - /** - * @param {Array} args - * @param {boolean} collapsed - */ - group (args, collapsed = false) { - eventloop.enqueue(() => { - const triangleDown = dom.element('span', [ - pair.create('hidden', collapsed), - pair.create('style', 'color:grey;font-size:120%;') - ], [dom.text('▼')]); - const triangleRight = dom.element('span', [ - pair.create('hidden', !collapsed), - pair.create('style', 'color:grey;font-size:125%;') - ], [dom.text('▶')]); - const content = dom.element( - 'div', - [pair.create( - 'style', - `${lineStyle};padding-left:${this.depth * 10}px` - )], - [triangleDown, triangleRight, dom.text(' ')].concat( - _computeLineSpans(args) - ) - ); - const nextContainer = dom.element('div', [ - pair.create('hidden', collapsed) - ]); - const nextLine = dom.element('div', [], [content, nextContainer]); - dom.append(this.ccontainer, [nextLine]); - this.ccontainer = nextContainer; - this.depth++; - // when header is clicked, collapse/uncollapse container - dom.addEventListener(content, 'click', (_event) => { - nextContainer.toggleAttribute('hidden'); - triangleDown.toggleAttribute('hidden'); - triangleRight.toggleAttribute('hidden'); - }); - }); - } - - /** - * @param {Array} args - */ - groupCollapsed (args) { - this.group(args, true); - } - - groupEnd () { - eventloop.enqueue(() => { - if (this.depth > 0) { - this.depth--; - // @ts-ignore - this.ccontainer = this.ccontainer.parentElement.parentElement; - } - }); - } - - /** - * @param {Array} args - */ - print (args) { - eventloop.enqueue(() => { - dom.append(this.ccontainer, [ - dom.element('div', [ - pair.create( - 'style', - `${lineStyle};padding-left:${this.depth * 10}px` - ) - ], _computeLineSpans(args)) - ]); - }); - } - - /** - * @param {Error} err - */ - printError (err) { - this.print([logging_common.RED, logging_common.BOLD, err.toString()]); - } - - /** - * @param {string} url - * @param {number} height - */ - printImg (url, height) { - eventloop.enqueue(() => { - dom.append(this.ccontainer, [ - dom.element('img', [ - pair.create('src', url), - pair.create('height', `${math.round(height * 1.5)}px`) - ]) - ]); - }); - } - - /** - * @param {Node} node - */ - printDom (node) { - eventloop.enqueue(() => { - dom.append(this.ccontainer, [node]); - }); - } - - destroy () { - eventloop.enqueue(() => { - vconsoles.delete(this); - }); - } -} -/* c8 ignore stop */ - -/** - * @param {Element} dom - */ -/* c8 ignore next */ -const createVConsole = (dom) => new VConsole(dom); - -/** - * @param {string} moduleName - * @return {function(...any):void} - */ -const createModuleLogger = (moduleName) => logging_common.createModuleLogger(print, moduleName); - -exports.BLUE = logging_common.BLUE; -exports.BOLD = logging_common.BOLD; -exports.GREEN = logging_common.GREEN; -exports.GREY = logging_common.GREY; -exports.ORANGE = logging_common.ORANGE; -exports.PURPLE = logging_common.PURPLE; -exports.RED = logging_common.RED; -exports.UNBOLD = logging_common.UNBOLD; -exports.UNCOLOR = logging_common.UNCOLOR; -exports.VConsole = VConsole; -exports.createModuleLogger = createModuleLogger; -exports.createVConsole = createVConsole; -exports.group = group; -exports.groupCollapsed = groupCollapsed; -exports.groupEnd = groupEnd; -exports.print = print; -exports.printCanvas = printCanvas; -exports.printDom = printDom; -exports.printError = printError; -exports.printImg = printImg; -exports.printImgBase64 = printImgBase64; -exports.vconsoles = vconsoles; -exports.warn = warn; -//# sourceMappingURL=logging.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/logging.cjs.map b/yjs-poll/node_modules/lib0/dist/logging.cjs.map deleted file mode 100644 index 6e86714..0000000 --- a/yjs-poll/node_modules/lib0/dist/logging.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logging.cjs","sources":["../logging.js"],"sourcesContent":["/**\n * Isomorphic logging module with support for colors!\n *\n * @module logging\n */\n\nimport * as env from './environment.js'\nimport * as set from './set.js'\nimport * as pair from './pair.js'\nimport * as dom from './dom.js'\nimport * as json from './json.js'\nimport * as map from './map.js'\nimport * as eventloop from './eventloop.js'\nimport * as math from './math.js'\nimport * as common from './logging.common.js'\n\nexport { BOLD, UNBOLD, BLUE, GREY, GREEN, RED, PURPLE, ORANGE, UNCOLOR } from './logging.common.js'\n\n/**\n * @type {Object>}\n */\nconst _browserStyleMap = {\n [common.BOLD]: pair.create('font-weight', 'bold'),\n [common.UNBOLD]: pair.create('font-weight', 'normal'),\n [common.BLUE]: pair.create('color', 'blue'),\n [common.GREEN]: pair.create('color', 'green'),\n [common.GREY]: pair.create('color', 'grey'),\n [common.RED]: pair.create('color', 'red'),\n [common.PURPLE]: pair.create('color', 'purple'),\n [common.ORANGE]: pair.create('color', 'orange'), // not well supported in chrome when debugging node with inspector - TODO: deprecate\n [common.UNCOLOR]: pair.create('color', 'black')\n}\n\n/**\n * @param {Array} args\n * @return {Array}\n */\n/* c8 ignore start */\nconst computeBrowserLoggingArgs = (args) => {\n if (args.length === 1 && args[0]?.constructor === Function) {\n args = /** @type {Array} */ (/** @type {[function]} */ (args)[0]())\n }\n const strBuilder = []\n const styles = []\n const currentStyle = map.create()\n /**\n * @type {Array}\n */\n let logArgs = []\n // try with formatting until we find something unsupported\n let i = 0\n for (; i < args.length; i++) {\n const arg = args[i]\n // @ts-ignore\n const style = _browserStyleMap[arg]\n if (style !== undefined) {\n currentStyle.set(style.left, style.right)\n } else {\n if (arg === undefined) {\n break\n }\n if (arg.constructor === String || arg.constructor === Number) {\n const style = dom.mapToStyleString(currentStyle)\n if (i > 0 || style.length > 0) {\n strBuilder.push('%c' + arg)\n styles.push(style)\n } else {\n strBuilder.push(arg)\n }\n } else {\n break\n }\n }\n }\n if (i > 0) {\n // create logArgs with what we have so far\n logArgs = styles\n logArgs.unshift(strBuilder.join(''))\n }\n // append the rest\n for (; i < args.length; i++) {\n const arg = args[i]\n if (!(arg instanceof Symbol)) {\n logArgs.push(arg)\n }\n }\n return logArgs\n}\n/* c8 ignore stop */\n\n/* c8 ignore start */\nconst computeLoggingArgs = env.supportsColor\n ? computeBrowserLoggingArgs\n : common.computeNoColorLoggingArgs\n/* c8 ignore stop */\n\n/**\n * @param {Array} args\n */\nexport const print = (...args) => {\n console.log(...computeLoggingArgs(args))\n /* c8 ignore next */\n vconsoles.forEach((vc) => vc.print(args))\n}\n\n/* c8 ignore start */\n/**\n * @param {Array} args\n */\nexport const warn = (...args) => {\n console.warn(...computeLoggingArgs(args))\n args.unshift(common.ORANGE)\n vconsoles.forEach((vc) => vc.print(args))\n}\n/* c8 ignore stop */\n\n/**\n * @param {Error} err\n */\n/* c8 ignore start */\nexport const printError = (err) => {\n console.error(err)\n vconsoles.forEach((vc) => vc.printError(err))\n}\n/* c8 ignore stop */\n\n/**\n * @param {string} url image location\n * @param {number} height height of the image in pixel\n */\n/* c8 ignore start */\nexport const printImg = (url, height) => {\n if (env.isBrowser) {\n console.log(\n '%c ',\n `font-size: ${height}px; background-size: contain; background-repeat: no-repeat; background-image: url(${url})`\n )\n // console.log('%c ', `font-size: ${height}x; background: url(${url}) no-repeat;`)\n }\n vconsoles.forEach((vc) => vc.printImg(url, height))\n}\n/* c8 ignore stop */\n\n/**\n * @param {string} base64\n * @param {number} height\n */\n/* c8 ignore next 2 */\nexport const printImgBase64 = (base64, height) =>\n printImg(`data:image/gif;base64,${base64}`, height)\n\n/**\n * @param {Array} args\n */\nexport const group = (...args) => {\n console.group(...computeLoggingArgs(args))\n /* c8 ignore next */\n vconsoles.forEach((vc) => vc.group(args))\n}\n\n/**\n * @param {Array} args\n */\nexport const groupCollapsed = (...args) => {\n console.groupCollapsed(...computeLoggingArgs(args))\n /* c8 ignore next */\n vconsoles.forEach((vc) => vc.groupCollapsed(args))\n}\n\nexport const groupEnd = () => {\n console.groupEnd()\n /* c8 ignore next */\n vconsoles.forEach((vc) => vc.groupEnd())\n}\n\n/**\n * @param {function():Node} createNode\n */\n/* c8 ignore next 2 */\nexport const printDom = (createNode) =>\n vconsoles.forEach((vc) => vc.printDom(createNode()))\n\n/**\n * @param {HTMLCanvasElement} canvas\n * @param {number} height\n */\n/* c8 ignore next 2 */\nexport const printCanvas = (canvas, height) =>\n printImg(canvas.toDataURL(), height)\n\nexport const vconsoles = set.create()\n\n/**\n * @param {Array} args\n * @return {Array}\n */\n/* c8 ignore start */\nconst _computeLineSpans = (args) => {\n const spans = []\n const currentStyle = new Map()\n // try with formatting until we find something unsupported\n let i = 0\n for (; i < args.length; i++) {\n let arg = args[i]\n // @ts-ignore\n const style = _browserStyleMap[arg]\n if (style !== undefined) {\n currentStyle.set(style.left, style.right)\n } else {\n if (arg === undefined) {\n arg = 'undefined '\n }\n if (arg.constructor === String || arg.constructor === Number) {\n // @ts-ignore\n const span = dom.element('span', [\n pair.create('style', dom.mapToStyleString(currentStyle))\n ], [dom.text(arg.toString())])\n if (span.innerHTML === '') {\n span.innerHTML = ' '\n }\n spans.push(span)\n } else {\n break\n }\n }\n }\n // append the rest\n for (; i < args.length; i++) {\n let content = args[i]\n if (!(content instanceof Symbol)) {\n if (content.constructor !== String && content.constructor !== Number) {\n content = ' ' + json.stringify(content) + ' '\n }\n spans.push(\n dom.element('span', [], [dom.text(/** @type {string} */ (content))])\n )\n }\n }\n return spans\n}\n/* c8 ignore stop */\n\nconst lineStyle =\n 'font-family:monospace;border-bottom:1px solid #e2e2e2;padding:2px;'\n\n/* c8 ignore start */\nexport class VConsole {\n /**\n * @param {Element} dom\n */\n constructor (dom) {\n this.dom = dom\n /**\n * @type {Element}\n */\n this.ccontainer = this.dom\n this.depth = 0\n vconsoles.add(this)\n }\n\n /**\n * @param {Array} args\n * @param {boolean} collapsed\n */\n group (args, collapsed = false) {\n eventloop.enqueue(() => {\n const triangleDown = dom.element('span', [\n pair.create('hidden', collapsed),\n pair.create('style', 'color:grey;font-size:120%;')\n ], [dom.text('▼')])\n const triangleRight = dom.element('span', [\n pair.create('hidden', !collapsed),\n pair.create('style', 'color:grey;font-size:125%;')\n ], [dom.text('▶')])\n const content = dom.element(\n 'div',\n [pair.create(\n 'style',\n `${lineStyle};padding-left:${this.depth * 10}px`\n )],\n [triangleDown, triangleRight, dom.text(' ')].concat(\n _computeLineSpans(args)\n )\n )\n const nextContainer = dom.element('div', [\n pair.create('hidden', collapsed)\n ])\n const nextLine = dom.element('div', [], [content, nextContainer])\n dom.append(this.ccontainer, [nextLine])\n this.ccontainer = nextContainer\n this.depth++\n // when header is clicked, collapse/uncollapse container\n dom.addEventListener(content, 'click', (_event) => {\n nextContainer.toggleAttribute('hidden')\n triangleDown.toggleAttribute('hidden')\n triangleRight.toggleAttribute('hidden')\n })\n })\n }\n\n /**\n * @param {Array} args\n */\n groupCollapsed (args) {\n this.group(args, true)\n }\n\n groupEnd () {\n eventloop.enqueue(() => {\n if (this.depth > 0) {\n this.depth--\n // @ts-ignore\n this.ccontainer = this.ccontainer.parentElement.parentElement\n }\n })\n }\n\n /**\n * @param {Array} args\n */\n print (args) {\n eventloop.enqueue(() => {\n dom.append(this.ccontainer, [\n dom.element('div', [\n pair.create(\n 'style',\n `${lineStyle};padding-left:${this.depth * 10}px`\n )\n ], _computeLineSpans(args))\n ])\n })\n }\n\n /**\n * @param {Error} err\n */\n printError (err) {\n this.print([common.RED, common.BOLD, err.toString()])\n }\n\n /**\n * @param {string} url\n * @param {number} height\n */\n printImg (url, height) {\n eventloop.enqueue(() => {\n dom.append(this.ccontainer, [\n dom.element('img', [\n pair.create('src', url),\n pair.create('height', `${math.round(height * 1.5)}px`)\n ])\n ])\n })\n }\n\n /**\n * @param {Node} node\n */\n printDom (node) {\n eventloop.enqueue(() => {\n dom.append(this.ccontainer, [node])\n })\n }\n\n destroy () {\n eventloop.enqueue(() => {\n vconsoles.delete(this)\n })\n }\n}\n/* c8 ignore stop */\n\n/**\n * @param {Element} dom\n */\n/* c8 ignore next */\nexport const createVConsole = (dom) => new VConsole(dom)\n\n/**\n * @param {string} moduleName\n * @return {function(...any):void}\n */\nexport const createModuleLogger = (moduleName) => common.createModuleLogger(print, moduleName)\n"],"names":["common.BOLD","pair.create","common.UNBOLD","common.BLUE","common.GREEN","common.GREY","common.RED","common.PURPLE","common.ORANGE","common.UNCOLOR","map.create","dom.mapToStyleString","env.supportsColor","common.computeNoColorLoggingArgs","env.isBrowser","set.create","dom.element","dom.text","json.stringify","eventloop.enqueue","dom.append","dom.addEventListener","math.round","common.createModuleLogger"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA,MAAM,gBAAgB,GAAG;AACzB,EAAE,CAACA,mBAAW,GAAGC,WAAW,CAAC,aAAa,EAAE,MAAM,CAAC;AACnD,EAAE,CAACC,qBAAa,GAAGD,WAAW,CAAC,aAAa,EAAE,QAAQ,CAAC;AACvD,EAAE,CAACE,mBAAW,GAAGF,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC;AAC7C,EAAE,CAACG,oBAAY,GAAGH,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC;AAC/C,EAAE,CAACI,mBAAW,GAAGJ,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC;AAC7C,EAAE,CAACK,kBAAU,GAAGL,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC;AAC3C,EAAE,CAACM,qBAAa,GAAGN,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC;AACjD,EAAE,CAACO,qBAAa,GAAGP,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC;AACjD,EAAE,CAACQ,sBAAc,GAAGR,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC;AACjD,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,yBAAyB,GAAG,CAAC,IAAI,KAAK;AAC5C,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CAAyB,CAAC,KAAK,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/logging.common.cjs b/yjs-poll/node_modules/lib0/dist/logging.common.cjs deleted file mode 100644 index 8bc2b26..0000000 --- a/yjs-poll/node_modules/lib0/dist/logging.common.cjs +++ /dev/null @@ -1,132 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var symbol = require('./symbol-9c439012.cjs'); -var time = require('./time-d8438852.cjs'); -var environment = require('./environment-1c97264d.cjs'); -var _function = require('./function-314580f7.cjs'); -var json = require('./json-092190a1.cjs'); -require('./metric.cjs'); -require('./math-96d5e8c4.cjs'); -require('./map-24d263c0.cjs'); -require('./string-fddc5f8b.cjs'); -require('./array-78849c95.cjs'); -require('./set-5b47859e.cjs'); -require('./conditions-f5c0c102.cjs'); -require('./storage.cjs'); -require('./object-c0c9435b.cjs'); -require('./equality.cjs'); - -const BOLD = symbol.create(); -const UNBOLD = symbol.create(); -const BLUE = symbol.create(); -const GREY = symbol.create(); -const GREEN = symbol.create(); -const RED = symbol.create(); -const PURPLE = symbol.create(); -const ORANGE = symbol.create(); -const UNCOLOR = symbol.create(); - -/* c8 ignore start */ -/** - * @param {Array} args - * @return {Array} - */ -const computeNoColorLoggingArgs = args => { - if (args.length === 1 && args[0]?.constructor === Function) { - args = /** @type {Array} */ (/** @type {[function]} */ (args)[0]()); - } - const strBuilder = []; - const logArgs = []; - // try with formatting until we find something unsupported - let i = 0; - for (; i < args.length; i++) { - const arg = args[i]; - if (arg === undefined) { - break - } else if (arg.constructor === String || arg.constructor === Number) { - strBuilder.push(arg); - } else if (arg.constructor === Object) { - break - } - } - if (i > 0) { - // create logArgs with what we have so far - logArgs.push(strBuilder.join('')); - } - // append the rest - for (; i < args.length; i++) { - const arg = args[i]; - if (!(arg instanceof Symbol)) { - logArgs.push(arg); - } - } - return logArgs -}; -/* c8 ignore stop */ - -const loggingColors = [GREEN, PURPLE, ORANGE, BLUE]; -let nextColor = 0; -let lastLoggingTime = time.getUnixTime(); - -/* c8 ignore start */ -/** - * @param {function(...any):void} _print - * @param {string} moduleName - * @return {function(...any):void} - */ -const createModuleLogger = (_print, moduleName) => { - const color = loggingColors[nextColor]; - const debugRegexVar = environment.getVariable('log'); - const doLogging = debugRegexVar !== null && - (debugRegexVar === '*' || debugRegexVar === 'true' || - new RegExp(debugRegexVar, 'gi').test(moduleName)); - nextColor = (nextColor + 1) % loggingColors.length; - moduleName += ': '; - return !doLogging - ? _function.nop - : (...args) => { - if (args.length === 1 && args[0]?.constructor === Function) { - args = args[0](); - } - const timeNow = time.getUnixTime(); - const timeDiff = timeNow - lastLoggingTime; - lastLoggingTime = timeNow; - _print( - color, - moduleName, - UNCOLOR, - ...args.map((arg) => { - if (arg != null && arg.constructor === Uint8Array) { - arg = Array.from(arg); - } - const t = typeof arg; - switch (t) { - case 'string': - case 'symbol': - return arg - default: { - return json.stringify(arg) - } - } - }), - color, - ' +' + timeDiff + 'ms' - ); - } -}; -/* c8 ignore stop */ - -exports.BLUE = BLUE; -exports.BOLD = BOLD; -exports.GREEN = GREEN; -exports.GREY = GREY; -exports.ORANGE = ORANGE; -exports.PURPLE = PURPLE; -exports.RED = RED; -exports.UNBOLD = UNBOLD; -exports.UNCOLOR = UNCOLOR; -exports.computeNoColorLoggingArgs = computeNoColorLoggingArgs; -exports.createModuleLogger = createModuleLogger; -//# sourceMappingURL=logging.common.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/logging.common.cjs.map b/yjs-poll/node_modules/lib0/dist/logging.common.cjs.map deleted file mode 100644 index a898cf0..0000000 --- a/yjs-poll/node_modules/lib0/dist/logging.common.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logging.common.cjs","sources":["../logging.common.js"],"sourcesContent":["import * as symbol from './symbol.js'\nimport * as time from './time.js'\nimport * as env from './environment.js'\nimport * as func from './function.js'\nimport * as json from './json.js'\n\nexport const BOLD = symbol.create()\nexport const UNBOLD = symbol.create()\nexport const BLUE = symbol.create()\nexport const GREY = symbol.create()\nexport const GREEN = symbol.create()\nexport const RED = symbol.create()\nexport const PURPLE = symbol.create()\nexport const ORANGE = symbol.create()\nexport const UNCOLOR = symbol.create()\n\n/* c8 ignore start */\n/**\n * @param {Array} args\n * @return {Array}\n */\nexport const computeNoColorLoggingArgs = args => {\n if (args.length === 1 && args[0]?.constructor === Function) {\n args = /** @type {Array} */ (/** @type {[function]} */ (args)[0]())\n }\n const strBuilder = []\n const logArgs = []\n // try with formatting until we find something unsupported\n let i = 0\n for (; i < args.length; i++) {\n const arg = args[i]\n if (arg === undefined) {\n break\n } else if (arg.constructor === String || arg.constructor === Number) {\n strBuilder.push(arg)\n } else if (arg.constructor === Object) {\n break\n }\n }\n if (i > 0) {\n // create logArgs with what we have so far\n logArgs.push(strBuilder.join(''))\n }\n // append the rest\n for (; i < args.length; i++) {\n const arg = args[i]\n if (!(arg instanceof Symbol)) {\n logArgs.push(arg)\n }\n }\n return logArgs\n}\n/* c8 ignore stop */\n\nconst loggingColors = [GREEN, PURPLE, ORANGE, BLUE]\nlet nextColor = 0\nlet lastLoggingTime = time.getUnixTime()\n\n/* c8 ignore start */\n/**\n * @param {function(...any):void} _print\n * @param {string} moduleName\n * @return {function(...any):void}\n */\nexport const createModuleLogger = (_print, moduleName) => {\n const color = loggingColors[nextColor]\n const debugRegexVar = env.getVariable('log')\n const doLogging = debugRegexVar !== null &&\n (debugRegexVar === '*' || debugRegexVar === 'true' ||\n new RegExp(debugRegexVar, 'gi').test(moduleName))\n nextColor = (nextColor + 1) % loggingColors.length\n moduleName += ': '\n return !doLogging\n ? func.nop\n : (...args) => {\n if (args.length === 1 && args[0]?.constructor === Function) {\n args = args[0]()\n }\n const timeNow = time.getUnixTime()\n const timeDiff = timeNow - lastLoggingTime\n lastLoggingTime = timeNow\n _print(\n color,\n moduleName,\n UNCOLOR,\n ...args.map((arg) => {\n if (arg != null && arg.constructor === Uint8Array) {\n arg = Array.from(arg)\n }\n const t = typeof arg\n switch (t) {\n case 'string':\n case 'symbol':\n return arg\n default: {\n return json.stringify(arg)\n }\n }\n }),\n color,\n ' +' + timeDiff + 'ms'\n )\n }\n}\n/* c8 ignore stop */\n"],"names":["symbol.create","time.getUnixTime","env.getVariable","func.nop","json.stringify"],"mappings":";;;;;;;;;;;;;;;;;;;;AAMY,MAAC,IAAI,GAAGA,aAAa,GAAE;AACvB,MAAC,MAAM,GAAGA,aAAa,GAAE;AACzB,MAAC,IAAI,GAAGA,aAAa,GAAE;AACvB,MAAC,IAAI,GAAGA,aAAa,GAAE;AACvB,MAAC,KAAK,GAAGA,aAAa,GAAE;AACxB,MAAC,GAAG,GAAGA,aAAa,GAAE;AACtB,MAAC,MAAM,GAAGA,aAAa,GAAE;AACzB,MAAC,MAAM,GAAGA,aAAa,GAAE;AACzB,MAAC,OAAO,GAAGA,aAAa,GAAE;AACtC;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,yBAAyB,GAAG,IAAI,IAAI;AACjD,EAAE,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,KAAK,QAAQ,EAAE;AAC9D,IAAI,IAAI,gFAAgF,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAC;AACpG,GAAG;AACH,EAAE,MAAM,UAAU,GAAG,GAAE;AACvB,EAAE,MAAM,OAAO,GAAG,GAAE;AACpB;AACA,EAAE,IAAI,CAAC,GAAG,EAAC;AACX,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC/B,IAAI,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,EAAC;AACvB,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE;AAC3B,MAAM,KAAK;AACX,KAAK,MAAM,IAAI,GAAG,CAAC,WAAW,KAAK,MAAM,IAAI,GAAG,CAAC,WAAW,KAAK,MAAM,EAAE;AACzE,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EAAE,OAAO,CAAC,SAAS;AACnB,MAAMC,aAAQ;AACd,MAAM,CAAC,GAAG,IAAI,KAAK;AACnB,QAAQ,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,KAAK,QAAQ,EAAE;AACpE,UAAU,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,GAAE;AAC1B,SAAS;AACT,QAAQ,MAAM,OAAO,GAAGF,gBAAgB,GAAE;AAC1C,QAAQ,MAAM,QAAQ,GAAG,OAAO,GAAG,gBAAe;AAClD,QAAQ,eAAe,GAAG,QAAO;AACjC,QAAQ,MAAM;AACd,UAAU,KAAK;AACf,UAAU,UAAU;AACpB,UAAU,OAAO;AACjB,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK;AAC/B,YAAY,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,CAAC,WAAW,KAAK,UAAU,EAAE;AAC/D,cAAc,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAC;AACnC,aAAa;AACb,YAAY,MAAM,CAAC,GAAG,OAAO,IAAG;AAChC,YAAY,QAAQ,CAAC;AACrB,cAAc,KAAK,QAAQ,CAAC;AAC5B,cAAc,KAAK,QAAQ;AAC3B,gBAAgB,OAAO,GAAG;AAC1B,cAAc,SAAS;AACvB,gBAAgB,OAAOG,cAAc,CAAC,GAAG,CAAC;AAC1C,eAAe;AACf,aAAa;AACb,WAAW,CAAC;AACZ,UAAU,KAAK;AACf,UAAU,IAAI,GAAG,QAAQ,GAAG,IAAI;AAChC,UAAS;AACT,OAAO;AACP,EAAC;AACD;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/logging.common.d.ts b/yjs-poll/node_modules/lib0/dist/logging.common.d.ts deleted file mode 100644 index f0489be..0000000 --- a/yjs-poll/node_modules/lib0/dist/logging.common.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -export const BOLD: symbol; -export const UNBOLD: symbol; -export const BLUE: symbol; -export const GREY: symbol; -export const GREEN: symbol; -export const RED: symbol; -export const PURPLE: symbol; -export const ORANGE: symbol; -export const UNCOLOR: symbol; -export function computeNoColorLoggingArgs(args: Array any)>): Array; -export function createModuleLogger(_print: (...args: any[]) => void, moduleName: string): (...args: any[]) => void; -//# sourceMappingURL=logging.common.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/logging.common.d.ts.map b/yjs-poll/node_modules/lib0/dist/logging.common.d.ts.map deleted file mode 100644 index 712b060..0000000 --- a/yjs-poll/node_modules/lib0/dist/logging.common.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logging.common.d.ts","sourceRoot":"","sources":["../logging.common.js"],"names":[],"mappings":"AAMA,0BAAmC;AACnC,4BAAqC;AACrC,0BAAmC;AACnC,0BAAmC;AACnC,2BAAoC;AACpC,yBAAkC;AAClC,4BAAqC;AACrC,4BAAqC;AACrC,6BAAsC;AAO/B,gDAHI,KAAK,CAAC,SAAS,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,IAAC,MAAW,GAAG,CAAA,CAAC,GAC1D,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,SAAS,CAAC,CAgChD;AAaM,2CAJI,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,IAAI,cACrB,MAAM,GACL,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,IAAI,CAyChC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/logging.d.ts b/yjs-poll/node_modules/lib0/dist/logging.d.ts deleted file mode 100644 index a768a17..0000000 --- a/yjs-poll/node_modules/lib0/dist/logging.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -export function print(...args: Array): void; -export function warn(...args: Array): void; -export function printError(err: Error): void; -export function printImg(url: string, height: number): void; -export function printImgBase64(base64: string, height: number): void; -export function group(...args: Array): void; -export function groupCollapsed(...args: Array): void; -export function groupEnd(): void; -export function printDom(createNode: () => Node): void; -export function printCanvas(canvas: HTMLCanvasElement, height: number): void; -export const vconsoles: Set; -export class VConsole { - /** - * @param {Element} dom - */ - constructor(dom: Element); - dom: Element; - /** - * @type {Element} - */ - ccontainer: Element; - depth: number; - /** - * @param {Array} args - * @param {boolean} collapsed - */ - group(args: Array, collapsed?: boolean): void; - /** - * @param {Array} args - */ - groupCollapsed(args: Array): void; - groupEnd(): void; - /** - * @param {Array} args - */ - print(args: Array): void; - /** - * @param {Error} err - */ - printError(err: Error): void; - /** - * @param {string} url - * @param {number} height - */ - printImg(url: string, height: number): void; - /** - * @param {Node} node - */ - printDom(node: Node): void; - destroy(): void; -} -export function createVConsole(dom: Element): VConsole; -export function createModuleLogger(moduleName: string): (...args: any[]) => void; -export { BOLD, UNBOLD, BLUE, GREY, GREEN, RED, PURPLE, ORANGE, UNCOLOR } from "./logging.common.js"; -//# sourceMappingURL=logging.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/logging.d.ts.map b/yjs-poll/node_modules/lib0/dist/logging.d.ts.map deleted file mode 100644 index e195ce2..0000000 --- a/yjs-poll/node_modules/lib0/dist/logging.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../logging.js"],"names":[],"mappings":"AAmGO,+BAFI,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAM5C;AAMM,8BAFI,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAM5C;AAOM,gCAHI,KAAK,QAMf;AAQM,8BAJI,MAAM,UACN,MAAM,QAYhB;AAQM,uCAJI,MAAM,UACN,MAAM,QAIoC;AAK9C,+BAFI,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAM5C;AAKM,wCAFI,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAM5C;AAEM,iCAIN;AAMM,qCAHI,MAAW,IAAI,QAI4B;AAO/C,oCAJI,iBAAiB,UACjB,MAAM,QAIqB;AAEtC,iCAAqC;AAwDrC;IACE;;OAEG;IACH,iBAFW,OAAO,EAUjB;IAPC,aAAc;IACd;;OAEG;IACH,YAFU,OAAO,CAES;IAC1B,cAAc;IAIhB;;;OAGG;IACH,YAHW,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,cAClC,OAAO,QAoCjB;IAED;;OAEG;IACH,qBAFW,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAI5C;IAED,iBAQC;IAED;;OAEG;IACH,YAFW,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAa5C;IAED;;OAEG;IACH,gBAFW,KAAK,QAIf;IAED;;;OAGG;IACH,cAHW,MAAM,UACN,MAAM,QAWhB;IAED;;OAEG;IACH,eAFW,IAAI,QAMd;IAED,gBAIC;CACF;AAOM,oCAHI,OAAO,YAGsC;AAMjD,+CAHI,MAAM,GACL,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,IAAI,CAE6D"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/logging.node.cjs b/yjs-poll/node_modules/lib0/dist/logging.node.cjs deleted file mode 100644 index c64ba3d..0000000 --- a/yjs-poll/node_modules/lib0/dist/logging.node.cjs +++ /dev/null @@ -1,203 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var environment = require('./environment-1c97264d.cjs'); -var logging_common = require('./logging.common.cjs'); -require('./map-24d263c0.cjs'); -require('./string-fddc5f8b.cjs'); -require('./array-78849c95.cjs'); -require('./set-5b47859e.cjs'); -require('./conditions-f5c0c102.cjs'); -require('./storage.cjs'); -require('./function-314580f7.cjs'); -require('./object-c0c9435b.cjs'); -require('./equality.cjs'); -require('./symbol-9c439012.cjs'); -require('./time-d8438852.cjs'); -require('./metric.cjs'); -require('./math-96d5e8c4.cjs'); -require('./json-092190a1.cjs'); - -/** - * Isomorphic logging module with support for colors! - * - * @module logging - */ - -const _nodeStyleMap = { - [logging_common.BOLD]: '\u001b[1m', - [logging_common.UNBOLD]: '\u001b[2m', - [logging_common.BLUE]: '\x1b[34m', - [logging_common.GREEN]: '\x1b[32m', - [logging_common.GREY]: '\u001b[37m', - [logging_common.RED]: '\x1b[31m', - [logging_common.PURPLE]: '\x1b[35m', - [logging_common.ORANGE]: '\x1b[38;5;208m', - [logging_common.UNCOLOR]: '\x1b[0m' -}; - -/* c8 ignore start */ -/** - * @param {Array>} args - * @return {Array} - */ -const computeNodeLoggingArgs = (args) => { - if (args.length === 1 && args[0]?.constructor === Function) { - args = /** @type {Array} */ (/** @type {[function]} */ (args)[0]()); - } - const strBuilder = []; - const logArgs = []; - // try with formatting until we find something unsupported - let i = 0; - for (; i < args.length; i++) { - const arg = args[i]; - // @ts-ignore - const style = _nodeStyleMap[arg]; - if (style !== undefined) { - strBuilder.push(style); - } else { - if (arg === undefined) { - break - } else if (arg.constructor === String || arg.constructor === Number) { - strBuilder.push(arg); - } else { - break - } - } - } - if (i > 0) { - // create logArgs with what we have so far - strBuilder.push('\x1b[0m'); - logArgs.push(strBuilder.join('')); - } - // append the rest - for (; i < args.length; i++) { - const arg = args[i]; - if (!(arg instanceof Symbol)) { - logArgs.push(arg); - } - } - return logArgs -}; -/* c8 ignore stop */ - -/* c8 ignore start */ -const computeLoggingArgs = environment.supportsColor - ? computeNodeLoggingArgs - : logging_common.computeNoColorLoggingArgs; -/* c8 ignore stop */ - -/** - * @param {Array} args - */ -const print = (...args) => { - console.log(...computeLoggingArgs(args)); -}; - -/* c8 ignore start */ -/** - * @param {Array} args - */ -const warn = (...args) => { - console.warn(...computeLoggingArgs(args)); -}; -/* c8 ignore stop */ - -/** - * @param {Error} err - */ -/* c8 ignore start */ -const printError = (err) => { - console.error(err); -}; -/* c8 ignore stop */ - -/** - * @param {string} _url image location - * @param {number} _height height of the image in pixel - */ -/* c8 ignore start */ -const printImg = (_url, _height) => { - // console.log('%c ', `font-size: ${height}x; background: url(${url}) no-repeat;`) -}; -/* c8 ignore stop */ - -/** - * @param {string} base64 - * @param {number} height - */ -/* c8 ignore next 2 */ -const printImgBase64 = (base64, height) => - printImg(); - -/** - * @param {Array} args - */ -/* c8 ignore next 3 */ -const group = (...args) => { - console.group(...computeLoggingArgs(args)); -}; - -/** - * @param {Array} args - */ -/* c8 ignore next 3 */ -const groupCollapsed = (...args) => { - console.groupCollapsed(...computeLoggingArgs(args)); -}; - -/* c8 ignore next 3 */ -const groupEnd = () => { - console.groupEnd(); -}; - -/** - * @param {function():Node} _createNode - */ -/* c8 ignore next 2 */ -const printDom = (_createNode) => {}; - -/** - * @param {HTMLCanvasElement} canvas - * @param {number} height - */ -/* c8 ignore next 2 */ -const printCanvas = (canvas, height) => - printImg(canvas.toDataURL()); - -/** - * @param {Element} _dom - */ -/* c8 ignore next */ -const createVConsole = (_dom) => {}; - -/** - * @param {string} moduleName - * @return {function(...any):void} - */ -/* c8 ignore next */ -const createModuleLogger = (moduleName) => logging_common.createModuleLogger(print, moduleName); - -exports.BLUE = logging_common.BLUE; -exports.BOLD = logging_common.BOLD; -exports.GREEN = logging_common.GREEN; -exports.GREY = logging_common.GREY; -exports.ORANGE = logging_common.ORANGE; -exports.PURPLE = logging_common.PURPLE; -exports.RED = logging_common.RED; -exports.UNBOLD = logging_common.UNBOLD; -exports.UNCOLOR = logging_common.UNCOLOR; -exports.createModuleLogger = createModuleLogger; -exports.createVConsole = createVConsole; -exports.group = group; -exports.groupCollapsed = groupCollapsed; -exports.groupEnd = groupEnd; -exports.print = print; -exports.printCanvas = printCanvas; -exports.printDom = printDom; -exports.printError = printError; -exports.printImg = printImg; -exports.printImgBase64 = printImgBase64; -exports.warn = warn; -//# sourceMappingURL=logging.node.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/logging.node.cjs.map b/yjs-poll/node_modules/lib0/dist/logging.node.cjs.map deleted file mode 100644 index ac495f3..0000000 --- a/yjs-poll/node_modules/lib0/dist/logging.node.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logging.node.cjs","sources":["../logging.node.js"],"sourcesContent":["/**\n * Isomorphic logging module with support for colors!\n *\n * @module logging\n */\n\nimport * as env from './environment.js'\nimport * as common from './logging.common.js'\n\nexport { BOLD, UNBOLD, BLUE, GREY, GREEN, RED, PURPLE, ORANGE, UNCOLOR } from './logging.common.js'\n\nconst _nodeStyleMap = {\n [common.BOLD]: '\\u001b[1m',\n [common.UNBOLD]: '\\u001b[2m',\n [common.BLUE]: '\\x1b[34m',\n [common.GREEN]: '\\x1b[32m',\n [common.GREY]: '\\u001b[37m',\n [common.RED]: '\\x1b[31m',\n [common.PURPLE]: '\\x1b[35m',\n [common.ORANGE]: '\\x1b[38;5;208m',\n [common.UNCOLOR]: '\\x1b[0m'\n}\n\n/* c8 ignore start */\n/**\n * @param {Array>} args\n * @return {Array}\n */\nconst computeNodeLoggingArgs = (args) => {\n if (args.length === 1 && args[0]?.constructor === Function) {\n args = /** @type {Array} */ (/** @type {[function]} */ (args)[0]())\n }\n const strBuilder = []\n const logArgs = []\n // try with formatting until we find something unsupported\n let i = 0\n for (; i < args.length; i++) {\n const arg = args[i]\n // @ts-ignore\n const style = _nodeStyleMap[arg]\n if (style !== undefined) {\n strBuilder.push(style)\n } else {\n if (arg === undefined) {\n break\n } else if (arg.constructor === String || arg.constructor === Number) {\n strBuilder.push(arg)\n } else {\n break\n }\n }\n }\n if (i > 0) {\n // create logArgs with what we have so far\n strBuilder.push('\\x1b[0m')\n logArgs.push(strBuilder.join(''))\n }\n // append the rest\n for (; i < args.length; i++) {\n const arg = args[i]\n if (!(arg instanceof Symbol)) {\n logArgs.push(arg)\n }\n }\n return logArgs\n}\n/* c8 ignore stop */\n\n/* c8 ignore start */\nconst computeLoggingArgs = env.supportsColor\n ? computeNodeLoggingArgs\n : common.computeNoColorLoggingArgs\n/* c8 ignore stop */\n\n/**\n * @param {Array} args\n */\nexport const print = (...args) => {\n console.log(...computeLoggingArgs(args))\n}\n\n/* c8 ignore start */\n/**\n * @param {Array} args\n */\nexport const warn = (...args) => {\n console.warn(...computeLoggingArgs(args))\n}\n/* c8 ignore stop */\n\n/**\n * @param {Error} err\n */\n/* c8 ignore start */\nexport const printError = (err) => {\n console.error(err)\n}\n/* c8 ignore stop */\n\n/**\n * @param {string} _url image location\n * @param {number} _height height of the image in pixel\n */\n/* c8 ignore start */\nexport const printImg = (_url, _height) => {\n // console.log('%c ', `font-size: ${height}x; background: url(${url}) no-repeat;`)\n}\n/* c8 ignore stop */\n\n/**\n * @param {string} base64\n * @param {number} height\n */\n/* c8 ignore next 2 */\nexport const printImgBase64 = (base64, height) =>\n printImg(`data:image/gif;base64,${base64}`, height)\n\n/**\n * @param {Array} args\n */\n/* c8 ignore next 3 */\nexport const group = (...args) => {\n console.group(...computeLoggingArgs(args))\n}\n\n/**\n * @param {Array} args\n */\n/* c8 ignore next 3 */\nexport const groupCollapsed = (...args) => {\n console.groupCollapsed(...computeLoggingArgs(args))\n}\n\n/* c8 ignore next 3 */\nexport const groupEnd = () => {\n console.groupEnd()\n}\n\n/**\n * @param {function():Node} _createNode\n */\n/* c8 ignore next 2 */\nexport const printDom = (_createNode) => {}\n\n/**\n * @param {HTMLCanvasElement} canvas\n * @param {number} height\n */\n/* c8 ignore next 2 */\nexport const printCanvas = (canvas, height) =>\n printImg(canvas.toDataURL(), height)\n\n/**\n * @param {Element} _dom\n */\n/* c8 ignore next */\nexport const createVConsole = (_dom) => {}\n\n/**\n * @param {string} moduleName\n * @return {function(...any):void}\n */\n/* c8 ignore next */\nexport const createModuleLogger = (moduleName) => common.createModuleLogger(print, moduleName)\n"],"names":["common.BOLD","common.UNBOLD","common.BLUE","common.GREEN","common.GREY","common.RED","common.PURPLE","common.ORANGE","common.UNCOLOR","env.supportsColor","common.computeNoColorLoggingArgs","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AAC,QAAQ,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK;AAC3C;AACA,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAG,CAAC,MAAM,EAAE,MAAM;AAC7C,EAAE,QAAQ,CAA0C,EAAC;AACrD;AACA;AACA;AACA;AACA;AACY,MAAC,KAAK,GAAG,CAAC,GAAG,IAAI,KAAK;AAClC,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,kBAAkB,CAAC,IAAI,CAAC,EAAC;AAC5C,EAAC;AACD;AACA;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAG,CAAC,GAAG,IAAI,KAAK;AAC3C,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC,IAAI,CAAC,EAAC;AACrD,EAAC;AACD;AACA;AACY,MAAC,QAAQ,GAAG,MAAM;AAC9B,EAAE,OAAO,CAAC,QAAQ,GAAE;AACpB,EAAC;AACD;AACA;AACA;AACA;AACA;AACY,MAAC,QAAQ,GAAG,CAAC,WAAW,KAAK,GAAE;AAC3C;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM;AAC1C,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAU,EAAC;AACtC;AACA;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAG,CAAC,IAAI,KAAK,GAAE;AAC1C;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,kBAAkB,GAAG,CAAC,UAAU,KAAKC,iCAAyB,CAAC,KAAK,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/logging.node.d.ts b/yjs-poll/node_modules/lib0/dist/logging.node.d.ts deleted file mode 100644 index 69edeeb..0000000 --- a/yjs-poll/node_modules/lib0/dist/logging.node.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -export function print(...args: Array): void; -export function warn(...args: Array): void; -export function printError(err: Error): void; -export function printImg(_url: string, _height: number): void; -export function printImgBase64(base64: string, height: number): void; -export function group(...args: Array): void; -export function groupCollapsed(...args: Array): void; -export function groupEnd(): void; -export function printDom(_createNode: () => Node): void; -export function printCanvas(canvas: HTMLCanvasElement, height: number): void; -export function createVConsole(_dom: Element): void; -export function createModuleLogger(moduleName: string): (...args: any[]) => void; -export { BOLD, UNBOLD, BLUE, GREY, GREEN, RED, PURPLE, ORANGE, UNCOLOR } from "./logging.common.js"; -//# sourceMappingURL=logging.node.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/logging.node.d.ts.map b/yjs-poll/node_modules/lib0/dist/logging.node.d.ts.map deleted file mode 100644 index 380ad71..0000000 --- a/yjs-poll/node_modules/lib0/dist/logging.node.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logging.node.d.ts","sourceRoot":"","sources":["../logging.node.js"],"names":[],"mappings":"AA6EO,+BAFI,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,SAAS,CAAC,QAItD;AAMM,8BAFI,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAI5C;AAOM,gCAHI,KAAK,QAKf;AAQM,+BAJI,MAAM,WACN,MAAM,QAKhB;AAQM,uCAJI,MAAM,UACN,MAAM,QAIoC;AAM9C,+BAHI,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAK5C;AAMM,wCAHI,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAK5C;AAGM,iCAEN;AAMM,sCAHI,MAAW,IAAI,QAGiB;AAOpC,oCAJI,iBAAiB,UACjB,MAAM,QAIqB;AAM/B,qCAHI,OAAO,QAGwB;AAOnC,+CAJI,MAAM,GACL,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,IAAI,CAG6D"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/logging.test.d.ts b/yjs-poll/node_modules/lib0/dist/logging.test.d.ts deleted file mode 100644 index 0bdf329..0000000 --- a/yjs-poll/node_modules/lib0/dist/logging.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testLogging(): void; -export function testModuleLogger(): void; -//# sourceMappingURL=logging.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/logging.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/logging.test.d.ts.map deleted file mode 100644 index 6c43710..0000000 --- a/yjs-poll/node_modules/lib0/dist/logging.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logging.test.d.ts","sourceRoot":"","sources":["../logging.test.js"],"names":[],"mappings":"AAEO,oCAgBN;AAEM,yCAON"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/map-24d263c0.cjs b/yjs-poll/node_modules/lib0/dist/map-24d263c0.cjs deleted file mode 100644 index e9f9146..0000000 --- a/yjs-poll/node_modules/lib0/dist/map-24d263c0.cjs +++ /dev/null @@ -1,139 +0,0 @@ -'use strict'; - -/** - * Utility module to work with key-value stores. - * - * @module map - */ - -/** - * @template K - * @template V - * @typedef {Map} GlobalMap - */ - -/** - * Creates a new Map instance. - * - * @function - * @return {Map} - * - * @function - */ -const create = () => new Map(); - -/** - * Copy a Map object into a fresh Map object. - * - * @function - * @template K,V - * @param {Map} m - * @return {Map} - */ -const copy = m => { - const r = create(); - m.forEach((v, k) => { r.set(k, v); }); - return r -}; - -/** - * Get map property. Create T if property is undefined and set T on map. - * - * ```js - * const listeners = map.setIfUndefined(events, 'eventName', set.create) - * listeners.add(listener) - * ``` - * - * @function - * @template {Map} MAP - * @template {MAP extends Map ? function():V : unknown} CF - * @param {MAP} map - * @param {MAP extends Map ? K : unknown} key - * @param {CF} createT - * @return {ReturnType} - */ -const setIfUndefined = (map, key, createT) => { - let set = map.get(key); - if (set === undefined) { - map.set(key, set = createT()); - } - return set -}; - -/** - * Creates an Array and populates it with the content of all key-value pairs using the `f(value, key)` function. - * - * @function - * @template K - * @template V - * @template R - * @param {Map} m - * @param {function(V,K):R} f - * @return {Array} - */ -const map = (m, f) => { - const res = []; - for (const [key, value] of m) { - res.push(f(value, key)); - } - return res -}; - -/** - * Tests whether any key-value pairs pass the test implemented by `f(value, key)`. - * - * @todo should rename to some - similarly to Array.some - * - * @function - * @template K - * @template V - * @param {Map} m - * @param {function(V,K):boolean} f - * @return {boolean} - */ -const any = (m, f) => { - for (const [key, value] of m) { - if (f(value, key)) { - return true - } - } - return false -}; - -/** - * Tests whether all key-value pairs pass the test implemented by `f(value, key)`. - * - * @function - * @template K - * @template V - * @param {Map} m - * @param {function(V,K):boolean} f - * @return {boolean} - */ -const all = (m, f) => { - for (const [key, value] of m) { - if (!f(value, key)) { - return false - } - } - return true -}; - -var map$1 = /*#__PURE__*/Object.freeze({ - __proto__: null, - create: create, - copy: copy, - setIfUndefined: setIfUndefined, - map: map, - any: any, - all: all -}); - -exports.all = all; -exports.any = any; -exports.copy = copy; -exports.create = create; -exports.map = map; -exports.map$1 = map$1; -exports.setIfUndefined = setIfUndefined; -//# sourceMappingURL=map-24d263c0.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/map-24d263c0.cjs.map b/yjs-poll/node_modules/lib0/dist/map-24d263c0.cjs.map deleted file mode 100644 index 990eff5..0000000 --- a/yjs-poll/node_modules/lib0/dist/map-24d263c0.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"map-24d263c0.cjs","sources":["../map.js"],"sourcesContent":["/**\n * Utility module to work with key-value stores.\n *\n * @module map\n */\n\n/**\n * @template K\n * @template V\n * @typedef {Map} GlobalMap\n */\n\n/**\n * Creates a new Map instance.\n *\n * @function\n * @return {Map}\n *\n * @function\n */\nexport const create = () => new Map()\n\n/**\n * Copy a Map object into a fresh Map object.\n *\n * @function\n * @template K,V\n * @param {Map} m\n * @return {Map}\n */\nexport const copy = m => {\n const r = create()\n m.forEach((v, k) => { r.set(k, v) })\n return r\n}\n\n/**\n * Get map property. Create T if property is undefined and set T on map.\n *\n * ```js\n * const listeners = map.setIfUndefined(events, 'eventName', set.create)\n * listeners.add(listener)\n * ```\n *\n * @function\n * @template {Map} MAP\n * @template {MAP extends Map ? function():V : unknown} CF\n * @param {MAP} map\n * @param {MAP extends Map ? K : unknown} key\n * @param {CF} createT\n * @return {ReturnType}\n */\nexport const setIfUndefined = (map, key, createT) => {\n let set = map.get(key)\n if (set === undefined) {\n map.set(key, set = createT())\n }\n return set\n}\n\n/**\n * Creates an Array and populates it with the content of all key-value pairs using the `f(value, key)` function.\n *\n * @function\n * @template K\n * @template V\n * @template R\n * @param {Map} m\n * @param {function(V,K):R} f\n * @return {Array}\n */\nexport const map = (m, f) => {\n const res = []\n for (const [key, value] of m) {\n res.push(f(value, key))\n }\n return res\n}\n\n/**\n * Tests whether any key-value pairs pass the test implemented by `f(value, key)`.\n *\n * @todo should rename to some - similarly to Array.some\n *\n * @function\n * @template K\n * @template V\n * @param {Map} m\n * @param {function(V,K):boolean} f\n * @return {boolean}\n */\nexport const any = (m, f) => {\n for (const [key, value] of m) {\n if (f(value, key)) {\n return true\n }\n }\n return false\n}\n\n/**\n * Tests whether all key-value pairs pass the test implemented by `f(value, key)`.\n *\n * @function\n * @template K\n * @template V\n * @param {Map} m\n * @param {function(V,K):boolean} f\n * @return {boolean}\n */\nexport const all = (m, f) => {\n for (const [key, value] of m) {\n if (!f(value, key)) {\n return false\n }\n }\n return true\n}\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,MAAM,IAAI,GAAG,GAAE;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,IAAI,GAAG,CAAC,IAAI;AACzB,EAAE,MAAM,CAAC,GAAG,MAAM,GAAE;AACpB,EAAE,CAAC,CAA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ACA;AACA;AACA;AACA;AACA;AACY,MAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC7B,EAAE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE;AAChC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE;AACxB,MAAM,OAAO,KAAK;AAClB,KAAK;AACL,GAAG;AACH,EAAE,OAAO,IAAI;AACb;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/map.cjs b/yjs-poll/node_modules/lib0/dist/map.cjs deleted file mode 100644 index 3542805..0000000 --- a/yjs-poll/node_modules/lib0/dist/map.cjs +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var map = require('./map-24d263c0.cjs'); - - - -exports.all = map.all; -exports.any = map.any; -exports.copy = map.copy; -exports.create = map.create; -exports.map = map.map; -exports.setIfUndefined = map.setIfUndefined; -//# sourceMappingURL=map.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/map.cjs.map b/yjs-poll/node_modules/lib0/dist/map.cjs.map deleted file mode 100644 index 26c68a0..0000000 --- a/yjs-poll/node_modules/lib0/dist/map.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"map.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/map.d.ts b/yjs-poll/node_modules/lib0/dist/map.d.ts deleted file mode 100644 index f1f216e..0000000 --- a/yjs-poll/node_modules/lib0/dist/map.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export function create(): Map; -export function copy(m: Map): Map; -export function setIfUndefined, CF extends MAP extends Map ? () => V : unknown>(map: MAP, key: MAP extends Map ? K : unknown, createT: CF): ReturnType; -export function map(m: Map, f: (arg0: V, arg1: K) => R): Array; -export function any(m: Map, f: (arg0: V, arg1: K) => boolean): boolean; -export function all(m: Map, f: (arg0: V, arg1: K) => boolean): boolean; -export type GlobalMap = Map; -//# sourceMappingURL=map.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/map.d.ts.map b/yjs-poll/node_modules/lib0/dist/map.d.ts.map deleted file mode 100644 index 64a9f60..0000000 --- a/yjs-poll/node_modules/lib0/dist/map.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../map.js"],"names":[],"mappings":"AAoBO,0BAJK,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAIY;AAU9B,qBAJM,CAAC,EAAC,CAAC,KACL,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,GACP,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,CAMnB;AAkBM,+BAPsB,GAAG,SAAlB,GAAG,CAAC,GAAG,EAAE,GAAG,CAAE,EACyC,EAAE,SAAzD,GAAG,SAAS,GAAG,CAAC,GAAG,EAAC,MAAM,CAAC,CAAC,GAAG,MAAW,CAAC,GAAG,OAAQ,OACzD,GAAG,OACH,GAAG,SAAS,GAAG,CAAC,MAAM,CAAC,EAAC,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO,WAC1C,EAAE,GACD,UAAU,CAAC,EAAE,CAAC,CAQzB;AAaM,oBAPM,CAAC,EACD,CAAC,EACD,CAAC,KACH,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,KACR,CAAS,IAAC,EAAD,CAAC,EAAC,IAAC,EAAD,CAAC,KAAE,CAAC,GACd,KAAK,CAAC,CAAC,CAAC,CAQnB;AAcM,oBANM,CAAC,EACD,CAAC,KACH,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,KACR,CAAS,IAAC,EAAD,CAAC,EAAC,IAAC,EAAD,CAAC,KAAE,OAAO,GACpB,OAAO,CASlB;AAYM,oBANM,CAAC,EACD,CAAC,KACH,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,KACR,CAAS,IAAC,EAAD,CAAC,EAAC,IAAC,EAAD,CAAC,KAAE,OAAO,GACpB,OAAO,CASlB;sBA9GY,CAAC,EACD,CAAC,IACD,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/map.test.d.ts b/yjs-poll/node_modules/lib0/dist/map.test.d.ts deleted file mode 100644 index ca8dbcc..0000000 --- a/yjs-poll/node_modules/lib0/dist/map.test.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function testMap(_tc: t.TestCase): void; -export function testTypeDefinitions(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=map.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/map.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/map.test.d.ts.map deleted file mode 100644 index a8cde1c..0000000 --- a/yjs-poll/node_modules/lib0/dist/map.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"map.test.d.ts","sourceRoot":"","sources":["../map.test.js"],"names":[],"mappings":"AAOO,6BAFI,CAAC,CAAC,QAAQ,QAsBpB;AAKM,yCAFI,CAAC,CAAC,QAAQ,QAwBpB;mBApDkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/math-96d5e8c4.cjs b/yjs-poll/node_modules/lib0/dist/math-96d5e8c4.cjs deleted file mode 100644 index 5ced2bc..0000000 --- a/yjs-poll/node_modules/lib0/dist/math-96d5e8c4.cjs +++ /dev/null @@ -1,103 +0,0 @@ -'use strict'; - -/** - * Common Math expressions. - * - * @module math - */ - -const floor = Math.floor; -const ceil = Math.ceil; -const abs = Math.abs; -const imul = Math.imul; -const round = Math.round; -const log10 = Math.log10; -const log2 = Math.log2; -const log = Math.log; -const sqrt = Math.sqrt; - -/** - * @function - * @param {number} a - * @param {number} b - * @return {number} The sum of a and b - */ -const add = (a, b) => a + b; - -/** - * @function - * @param {number} a - * @param {number} b - * @return {number} The smaller element of a and b - */ -const min = (a, b) => a < b ? a : b; - -/** - * @function - * @param {number} a - * @param {number} b - * @return {number} The bigger element of a and b - */ -const max = (a, b) => a > b ? a : b; - -const isNaN = Number.isNaN; - -const pow = Math.pow; -/** - * Base 10 exponential function. Returns the value of 10 raised to the power of pow. - * - * @param {number} exp - * @return {number} - */ -const exp10 = exp => Math.pow(10, exp); - -const sign = Math.sign; - -/** - * Check whether n is negative, while considering the -0 edge case. While `-0 < 0` is false, this - * function returns true for -0,-1,,.. and returns false for 0,1,2,... - * @param {number} n - * @return {boolean} Wether n is negative. This function also distinguishes between -0 and +0 - */ -const isNegativeZero = n => n !== 0 ? n < 0 : 1 / n < 0; - -var math = /*#__PURE__*/Object.freeze({ - __proto__: null, - floor: floor, - ceil: ceil, - abs: abs, - imul: imul, - round: round, - log10: log10, - log2: log2, - log: log, - sqrt: sqrt, - add: add, - min: min, - max: max, - isNaN: isNaN, - pow: pow, - exp10: exp10, - sign: sign, - isNegativeZero: isNegativeZero -}); - -exports.abs = abs; -exports.add = add; -exports.ceil = ceil; -exports.exp10 = exp10; -exports.floor = floor; -exports.imul = imul; -exports.isNaN = isNaN; -exports.isNegativeZero = isNegativeZero; -exports.log = log; -exports.log10 = log10; -exports.log2 = log2; -exports.math = math; -exports.max = max; -exports.min = min; -exports.pow = pow; -exports.round = round; -exports.sign = sign; -exports.sqrt = sqrt; -//# sourceMappingURL=math-96d5e8c4.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/math-96d5e8c4.cjs.map b/yjs-poll/node_modules/lib0/dist/math-96d5e8c4.cjs.map deleted file mode 100644 index 3581431..0000000 --- a/yjs-poll/node_modules/lib0/dist/math-96d5e8c4.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"math-96d5e8c4.cjs","sources":["../math.js"],"sourcesContent":["/**\n * Common Math expressions.\n *\n * @module math\n */\n\nexport const floor = Math.floor\nexport const ceil = Math.ceil\nexport const abs = Math.abs\nexport const imul = Math.imul\nexport const round = Math.round\nexport const log10 = Math.log10\nexport const log2 = Math.log2\nexport const log = Math.log\nexport const sqrt = Math.sqrt\n\n/**\n * @function\n * @param {number} a\n * @param {number} b\n * @return {number} The sum of a and b\n */\nexport const add = (a, b) => a + b\n\n/**\n * @function\n * @param {number} a\n * @param {number} b\n * @return {number} The smaller element of a and b\n */\nexport const min = (a, b) => a < b ? a : b\n\n/**\n * @function\n * @param {number} a\n * @param {number} b\n * @return {number} The bigger element of a and b\n */\nexport const max = (a, b) => a > b ? a : b\n\nexport const isNaN = Number.isNaN\n\nexport const pow = Math.pow\n/**\n * Base 10 exponential function. Returns the value of 10 raised to the power of pow.\n *\n * @param {number} exp\n * @return {number}\n */\nexport const exp10 = exp => Math.pow(10, exp)\n\nexport const sign = Math.sign\n\n/**\n * Check whether n is negative, while considering the -0 edge case. While `-0 < 0` is false, this\n * function returns true for -0,-1,,.. and returns false for 0,1,2,...\n * @param {number} n\n * @return {boolean} Wether n is negative. This function also distinguishes between -0 and +0\n */\nexport const isNegativeZero = n => n !== 0 ? n < 0 : 1 / n < 0\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,KAAK,GAAG,IAAI,CAAC,MAAK;AACnB,MAAC,IAAI,GAAG,IAAI,CAAC,KAAI;AACjB,MAAC,GAAG,GAAG,IAAI,CAAC,IAAG;AACf,MAAC,IAAI,GAAG,IAAI,CAAC,KAAI;AACjB,MAAC,KAAK,GAAG,IAAI,CAAC,MAAK;AACnB,MAAC,KAAK,GAAG,IAAI,CAAC,MAAK;AACnB,MAAC,IAAI,GAAG,IAAI,CAAC,KAAI;AACjB,MAAC,GAAG,GAAG,IAAI,CAAC,IAAG;AACf,MAAC,IAAI,GAAG,IAAI,CAAC,KAAI;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,EAAC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAC;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAC;AAC1C;AACY,MAAC,KAAK,GAAG,MAAM,CAAC,MAAK;AACjC;AACY,MAAC,GAAG,GAAG,IAAI,CAAC,IAAG;AAC3B;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,KAAK,GAAG,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,EAAC;AAC7C;AACY,MAAC,IAAI,GAAG,IAAI,CAAC,KAAI;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/math.cjs b/yjs-poll/node_modules/lib0/dist/math.cjs deleted file mode 100644 index 197d13c..0000000 --- a/yjs-poll/node_modules/lib0/dist/math.cjs +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var math = require('./math-96d5e8c4.cjs'); - - - -exports.abs = math.abs; -exports.add = math.add; -exports.ceil = math.ceil; -exports.exp10 = math.exp10; -exports.floor = math.floor; -exports.imul = math.imul; -exports.isNaN = math.isNaN; -exports.isNegativeZero = math.isNegativeZero; -exports.log = math.log; -exports.log10 = math.log10; -exports.log2 = math.log2; -exports.max = math.max; -exports.min = math.min; -exports.pow = math.pow; -exports.round = math.round; -exports.sign = math.sign; -exports.sqrt = math.sqrt; -//# sourceMappingURL=math.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/math.cjs.map b/yjs-poll/node_modules/lib0/dist/math.cjs.map deleted file mode 100644 index 3e597d7..0000000 --- a/yjs-poll/node_modules/lib0/dist/math.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"math.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/math.d.ts b/yjs-poll/node_modules/lib0/dist/math.d.ts deleted file mode 100644 index 7490f90..0000000 --- a/yjs-poll/node_modules/lib0/dist/math.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Common Math expressions. - * - * @module math - */ -export const floor: (x: number) => number; -export const ceil: (x: number) => number; -export const abs: (x: number) => number; -export const imul: (x: number, y: number) => number; -export const round: (x: number) => number; -export const log10: (x: number) => number; -export const log2: (x: number) => number; -export const log: (x: number) => number; -export const sqrt: (x: number) => number; -export function add(a: number, b: number): number; -export function min(a: number, b: number): number; -export function max(a: number, b: number): number; -export const isNaN: (number: unknown) => boolean; -export const pow: (x: number, y: number) => number; -export function exp10(exp: number): number; -export const sign: (x: number) => number; -export function isNegativeZero(n: number): boolean; -//# sourceMappingURL=math.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/math.d.ts.map b/yjs-poll/node_modules/lib0/dist/math.d.ts.map deleted file mode 100644 index db6fa61..0000000 --- a/yjs-poll/node_modules/lib0/dist/math.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../math.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,0CAA+B;AAC/B,yCAA6B;AAC7B,wCAA2B;AAC3B,oDAA6B;AAC7B,0CAA+B;AAC/B,0CAA+B;AAC/B,yCAA6B;AAC7B,wCAA2B;AAC3B,yCAA6B;AAQtB,uBAJI,MAAM,KACN,MAAM,GACL,MAAM,CAEgB;AAQ3B,uBAJI,MAAM,KACN,MAAM,GACL,MAAM,CAEwB;AAQnC,uBAJI,MAAM,KACN,MAAM,GACL,MAAM,CAEwB;AAE1C,iDAAiC;AAEjC,mDAA2B;AAOpB,2BAHI,MAAM,GACL,MAAM,CAE2B;AAE7C,yCAA6B;AAQtB,kCAHI,MAAM,GACL,OAAO,CAE2C"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/math.test.d.ts b/yjs-poll/node_modules/lib0/dist/math.test.d.ts deleted file mode 100644 index ff01d80..0000000 --- a/yjs-poll/node_modules/lib0/dist/math.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testMath(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=math.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/math.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/math.test.d.ts.map deleted file mode 100644 index 2d45428..0000000 --- a/yjs-poll/node_modules/lib0/dist/math.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"math.test.d.ts","sourceRoot":"","sources":["../math.test.js"],"names":[],"mappings":"AAOO,6BAFI,CAAC,CAAC,QAAQ,QA0BpB;mBA/BkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/metric.cjs b/yjs-poll/node_modules/lib0/dist/metric.cjs deleted file mode 100644 index d651b1f..0000000 --- a/yjs-poll/node_modules/lib0/dist/metric.cjs +++ /dev/null @@ -1,83 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var math = require('./math-96d5e8c4.cjs'); - -/** - * Utility module to convert metric values. - * - * @module metric - */ - -const yotta = 1e24; -const zetta = 1e21; -const exa = 1e18; -const peta = 1e15; -const tera = 1e12; -const giga = 1e9; -const mega = 1e6; -const kilo = 1e3; -const hecto = 1e2; -const deca = 10; -const deci = 0.1; -const centi = 0.01; -const milli = 1e-3; -const micro = 1e-6; -const nano = 1e-9; -const pico = 1e-12; -const femto = 1e-15; -const atto = 1e-18; -const zepto = 1e-21; -const yocto = 1e-24; - -const prefixUp = ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; -const prefixDown = ['', 'm', 'μ', 'n', 'p', 'f', 'a', 'z', 'y']; - -/** - * Calculate the metric prefix for a number. Assumes E.g. `prefix(1000) = { n: 1, prefix: 'k' }` - * - * @param {number} n - * @param {number} [baseMultiplier] Multiplier of the base (10^(3*baseMultiplier)). E.g. `convert(time, -3)` if time is already in milli seconds - * @return {{n:number,prefix:string}} - */ -const prefix = (n, baseMultiplier = 0) => { - const nPow = n === 0 ? 0 : math.log10(n); - let mult = 0; - while (nPow < mult * 3 && baseMultiplier > -8) { - baseMultiplier--; - mult--; - } - while (nPow >= 3 + mult * 3 && baseMultiplier < 8) { - baseMultiplier++; - mult++; - } - const prefix = baseMultiplier < 0 ? prefixDown[-baseMultiplier] : prefixUp[baseMultiplier]; - return { - n: math.round((mult > 0 ? n / math.exp10(mult * 3) : n * math.exp10(mult * -3)) * 1e12) / 1e12, - prefix - } -}; - -exports.atto = atto; -exports.centi = centi; -exports.deca = deca; -exports.deci = deci; -exports.exa = exa; -exports.femto = femto; -exports.giga = giga; -exports.hecto = hecto; -exports.kilo = kilo; -exports.mega = mega; -exports.micro = micro; -exports.milli = milli; -exports.nano = nano; -exports.peta = peta; -exports.pico = pico; -exports.prefix = prefix; -exports.tera = tera; -exports.yocto = yocto; -exports.yotta = yotta; -exports.zepto = zepto; -exports.zetta = zetta; -//# sourceMappingURL=metric.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/metric.cjs.map b/yjs-poll/node_modules/lib0/dist/metric.cjs.map deleted file mode 100644 index 7868cc0..0000000 --- a/yjs-poll/node_modules/lib0/dist/metric.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"metric.cjs","sources":["../metric.js"],"sourcesContent":["/**\n * Utility module to convert metric values.\n *\n * @module metric\n */\n\nimport * as math from './math.js'\n\nexport const yotta = 1e24\nexport const zetta = 1e21\nexport const exa = 1e18\nexport const peta = 1e15\nexport const tera = 1e12\nexport const giga = 1e9\nexport const mega = 1e6\nexport const kilo = 1e3\nexport const hecto = 1e2\nexport const deca = 10\nexport const deci = 0.1\nexport const centi = 0.01\nexport const milli = 1e-3\nexport const micro = 1e-6\nexport const nano = 1e-9\nexport const pico = 1e-12\nexport const femto = 1e-15\nexport const atto = 1e-18\nexport const zepto = 1e-21\nexport const yocto = 1e-24\n\nconst prefixUp = ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']\nconst prefixDown = ['', 'm', 'μ', 'n', 'p', 'f', 'a', 'z', 'y']\n\n/**\n * Calculate the metric prefix for a number. Assumes E.g. `prefix(1000) = { n: 1, prefix: 'k' }`\n *\n * @param {number} n\n * @param {number} [baseMultiplier] Multiplier of the base (10^(3*baseMultiplier)). E.g. `convert(time, -3)` if time is already in milli seconds\n * @return {{n:number,prefix:string}}\n */\nexport const prefix = (n, baseMultiplier = 0) => {\n const nPow = n === 0 ? 0 : math.log10(n)\n let mult = 0\n while (nPow < mult * 3 && baseMultiplier > -8) {\n baseMultiplier--\n mult--\n }\n while (nPow >= 3 + mult * 3 && baseMultiplier < 8) {\n baseMultiplier++\n mult++\n }\n const prefix = baseMultiplier < 0 ? prefixDown[-baseMultiplier] : prefixUp[baseMultiplier]\n return {\n n: math.round((mult > 0 ? n / math.exp10(mult * 3) : n * math.exp10(mult * -3)) * 1e12) / 1e12,\n prefix\n }\n}\n"],"names":["math.log10","math.round","math.exp10"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AAGA;AACY,MAAC,KAAK,GAAG,KAAI;AACb,MAAC,KAAK,GAAG,KAAI;AACb,MAAC,GAAG,GAAG,KAAI;AACX,MAAC,IAAI,GAAG,KAAI;AACZ,MAAC,IAAI,GAAG,KAAI;AACZ,MAAC,IAAI,GAAG,IAAG;AACX,MAAC,IAAI,GAAG,IAAG;AACX,MAAC,IAAI,GAAG,IAAG;AACX,MAAC,KAAK,GAAG,IAAG;AACZ,MAAC,IAAI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F,EAAE,OAAO;AACT,IAAI,CAAC,EAAEC,UAAU,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,GAAGC,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,GAAGA,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,IAAI;AAClG,IAAI,MAAM;AACV,GAAG;AACH;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/metric.d.ts b/yjs-poll/node_modules/lib0/dist/metric.d.ts deleted file mode 100644 index 144f43c..0000000 --- a/yjs-poll/node_modules/lib0/dist/metric.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -export const yotta: 1e+24; -export const zetta: 1e+21; -export const exa: 1000000000000000000; -export const peta: 1000000000000000; -export const tera: 1000000000000; -export const giga: 1000000000; -export const mega: 1000000; -export const kilo: 1000; -export const hecto: 100; -export const deca: 10; -export const deci: 0.1; -export const centi: 0.01; -export const milli: 0.001; -export const micro: 0.000001; -export const nano: 1e-9; -export const pico: 1e-12; -export const femto: 1e-15; -export const atto: 1e-18; -export const zepto: 1e-21; -export const yocto: 1e-24; -export function prefix(n: number, baseMultiplier?: number): { - n: number; - prefix: string; -}; -//# sourceMappingURL=metric.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/metric.d.ts.map b/yjs-poll/node_modules/lib0/dist/metric.d.ts.map deleted file mode 100644 index 8873adc..0000000 --- a/yjs-poll/node_modules/lib0/dist/metric.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"metric.d.ts","sourceRoot":"","sources":["../metric.js"],"names":[],"mappings":"AAQA,oBAAqB,KAAI,CAAA;AACzB,oBAAqB,KAAI,CAAA;AACzB,kBAAmB,mBAAI,CAAA;AACvB,mBAAoB,gBAAI,CAAA;AACxB,mBAAoB,aAAI,CAAA;AACxB,mBAAoB,UAAG,CAAA;AACvB,mBAAoB,OAAG,CAAA;AACvB,mBAAoB,IAAG,CAAA;AACvB,oBAAqB,GAAG,CAAA;AACxB,mBAAoB,EAAE,CAAA;AACtB,mBAAoB,GAAG,CAAA;AACvB,oBAAqB,IAAI,CAAA;AACzB,oBAAqB,KAAI,CAAA;AACzB,oBAAqB,QAAI,CAAA;AACzB,mBAAoB,IAAI,CAAA;AACxB,mBAAoB,KAAK,CAAA;AACzB,oBAAqB,KAAK,CAAA;AAC1B,mBAAoB,KAAK,CAAA;AACzB,oBAAqB,KAAK,CAAA;AAC1B,oBAAqB,KAAK,CAAA;AAYnB,0BAJI,MAAM,mBACN,MAAM,GACL;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,MAAM,EAAC,MAAM,CAAA;CAAC,CAkBnC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/metric.test.d.ts b/yjs-poll/node_modules/lib0/dist/metric.test.d.ts deleted file mode 100644 index 3672726..0000000 --- a/yjs-poll/node_modules/lib0/dist/metric.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testMetricPrefix(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=metric.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/metric.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/metric.test.d.ts.map deleted file mode 100644 index b5a2d84..0000000 --- a/yjs-poll/node_modules/lib0/dist/metric.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"metric.test.d.ts","sourceRoot":"","sources":["../metric.test.js"],"names":[],"mappings":"AAMO,qCAFI,CAAC,CAAC,QAAQ,QA8BpB;mBAlCkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/mutex-63f09c81.cjs b/yjs-poll/node_modules/lib0/dist/mutex-63f09c81.cjs deleted file mode 100644 index 5295d3d..0000000 --- a/yjs-poll/node_modules/lib0/dist/mutex-63f09c81.cjs +++ /dev/null @@ -1,54 +0,0 @@ -'use strict'; - -/** - * Mutual exclude for JavaScript. - * - * @module mutex - */ - -/** - * @callback mutex - * @param {function():void} cb Only executed when this mutex is not in the current stack - * @param {function():void} [elseCb] Executed when this mutex is in the current stack - */ - -/** - * Creates a mutual exclude function with the following property: - * - * ```js - * const mutex = createMutex() - * mutex(() => { - * // This function is immediately executed - * mutex(() => { - * // This function is not executed, as the mutex is already active. - * }) - * }) - * ``` - * - * @return {mutex} A mutual exclude function - * @public - */ -const createMutex = () => { - let token = true; - return (f, g) => { - if (token) { - token = false; - try { - f(); - } finally { - token = true; - } - } else if (g !== undefined) { - g(); - } - } -}; - -var mutex = /*#__PURE__*/Object.freeze({ - __proto__: null, - createMutex: createMutex -}); - -exports.createMutex = createMutex; -exports.mutex = mutex; -//# sourceMappingURL=mutex-63f09c81.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/mutex-63f09c81.cjs.map b/yjs-poll/node_modules/lib0/dist/mutex-63f09c81.cjs.map deleted file mode 100644 index 48c234b..0000000 --- a/yjs-poll/node_modules/lib0/dist/mutex-63f09c81.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mutex-63f09c81.cjs","sources":["../mutex.js"],"sourcesContent":["/**\n * Mutual exclude for JavaScript.\n *\n * @module mutex\n */\n\n/**\n * @callback mutex\n * @param {function():void} cb Only executed when this mutex is not in the current stack\n * @param {function():void} [elseCb] Executed when this mutex is in the current stack\n */\n\n/**\n * Creates a mutual exclude function with the following property:\n *\n * ```js\n * const mutex = createMutex()\n * mutex(() => {\n * // This function is immediately executed\n * mutex(() => {\n * // This function is not executed, as the mutex is already active.\n * })\n * })\n * ```\n *\n * @return {mutex} A mutual exclude function\n * @public\n */\nexport const createMutex = () => {\n let token = true\n return (f, g) => {\n if (token) {\n token = false\n try {\n f()\n } finally {\n token = true\n }\n } else if (g !== undefined) {\n g()\n }\n }\n}\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,WAAW,GAAG,MAAM;AACjC,EAAE,IAAI,KAAK,GAAG,KAAI;AAClB,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK;AACnB,IAAI,IAAI,KAAK,EAAE;AACf,MAAM,KAAK,GAAG,MAAK;AACnB,MAAM,IAAI;AACV,QAAQ,CAAC,GAAE;AACX,OAAO,SAAS;AAChB,QAAQ,KAAK,GAAG,KAAI;AACpB,OAAO;AACP,KAAK,MAAM,IAAI,CAAC,KAAK,SAAS,EAAE;AAChC,MAAM,CAAC,GAAE;AACT,KAAK;AACL,GAAG;AACH;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/mutex.cjs b/yjs-poll/node_modules/lib0/dist/mutex.cjs deleted file mode 100644 index db550c6..0000000 --- a/yjs-poll/node_modules/lib0/dist/mutex.cjs +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var mutex = require('./mutex-63f09c81.cjs'); - - - -exports.createMutex = mutex.createMutex; -//# sourceMappingURL=mutex.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/mutex.cjs.map b/yjs-poll/node_modules/lib0/dist/mutex.cjs.map deleted file mode 100644 index caa21ba..0000000 --- a/yjs-poll/node_modules/lib0/dist/mutex.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mutex.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/mutex.d.ts b/yjs-poll/node_modules/lib0/dist/mutex.d.ts deleted file mode 100644 index 92fd40f..0000000 --- a/yjs-poll/node_modules/lib0/dist/mutex.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function createMutex(): mutex; -export type mutex = (cb: () => void, elseCb?: (() => void) | undefined) => any; -//# sourceMappingURL=mutex.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/mutex.d.ts.map b/yjs-poll/node_modules/lib0/dist/mutex.d.ts.map deleted file mode 100644 index 2f72216..0000000 --- a/yjs-poll/node_modules/lib0/dist/mutex.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mutex.d.ts","sourceRoot":"","sources":["../mutex.js"],"names":[],"mappings":"AA4BO,+BAHK,KAAK,CAiBhB;yBAlCU,MAAW,IAAI,kBACJ,IAAI"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/mutex.test.d.ts b/yjs-poll/node_modules/lib0/dist/mutex.test.d.ts deleted file mode 100644 index d58484b..0000000 --- a/yjs-poll/node_modules/lib0/dist/mutex.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testMutex(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=mutex.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/mutex.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/mutex.test.d.ts.map deleted file mode 100644 index 8bd1937..0000000 --- a/yjs-poll/node_modules/lib0/dist/mutex.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mutex.test.d.ts","sourceRoot":"","sources":["../mutex.test.js"],"names":[],"mappings":"AAMO,+BAFI,CAAC,CAAC,QAAQ,QAmBpB;mBAvBkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/number-1fb57bba.cjs b/yjs-poll/node_modules/lib0/dist/number-1fb57bba.cjs deleted file mode 100644 index e30b2d5..0000000 --- a/yjs-poll/node_modules/lib0/dist/number-1fb57bba.cjs +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; - -var math = require('./math-96d5e8c4.cjs'); -var binary = require('./binary-ac8e39e2.cjs'); - -/** - * Utility helpers for working with numbers. - * - * @module number - */ - -const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER; -const MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER; - -const LOWEST_INT32 = 1 << 31; -const HIGHEST_INT32 = binary.BITS31; -const HIGHEST_UINT32 = binary.BITS32; - -/* c8 ignore next */ -const isInteger = Number.isInteger || (num => typeof num === 'number' && isFinite(num) && math.floor(num) === num); -const isNaN = Number.isNaN; -const parseInt = Number.parseInt; - -/** - * Count the number of "1" bits in an unsigned 32bit number. - * - * Super fun bitcount algorithm by Brian Kernighan. - * - * @param {number} n - */ -const countBits = n => { - n &= binary.BITS32; - let count = 0; - while (n) { - n &= (n - 1); - count++; - } - return count -}; - -var number = /*#__PURE__*/Object.freeze({ - __proto__: null, - MAX_SAFE_INTEGER: MAX_SAFE_INTEGER, - MIN_SAFE_INTEGER: MIN_SAFE_INTEGER, - LOWEST_INT32: LOWEST_INT32, - HIGHEST_INT32: HIGHEST_INT32, - HIGHEST_UINT32: HIGHEST_UINT32, - isInteger: isInteger, - isNaN: isNaN, - parseInt: parseInt, - countBits: countBits -}); - -exports.HIGHEST_INT32 = HIGHEST_INT32; -exports.HIGHEST_UINT32 = HIGHEST_UINT32; -exports.LOWEST_INT32 = LOWEST_INT32; -exports.MAX_SAFE_INTEGER = MAX_SAFE_INTEGER; -exports.MIN_SAFE_INTEGER = MIN_SAFE_INTEGER; -exports.countBits = countBits; -exports.isInteger = isInteger; -exports.isNaN = isNaN; -exports.number = number; -exports.parseInt = parseInt; -//# sourceMappingURL=number-1fb57bba.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/number-1fb57bba.cjs.map b/yjs-poll/node_modules/lib0/dist/number-1fb57bba.cjs.map deleted file mode 100644 index 61118ea..0000000 --- a/yjs-poll/node_modules/lib0/dist/number-1fb57bba.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"number-1fb57bba.cjs","sources":["../number.js"],"sourcesContent":["/**\n * Utility helpers for working with numbers.\n *\n * @module number\n */\n\nimport * as math from './math.js'\nimport * as binary from './binary.js'\n\nexport const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER\nexport const MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER\n\nexport const LOWEST_INT32 = 1 << 31\nexport const HIGHEST_INT32 = binary.BITS31\nexport const HIGHEST_UINT32 = binary.BITS32\n\n/* c8 ignore next */\nexport const isInteger = Number.isInteger || (num => typeof num === 'number' && isFinite(num) && math.floor(num) === num)\nexport const isNaN = Number.isNaN\nexport const parseInt = Number.parseInt\n\n/**\n * Count the number of \"1\" bits in an unsigned 32bit number.\n *\n * Super fun bitcount algorithm by Brian Kernighan.\n *\n * @param {number} n\n */\nexport const countBits = n => {\n n &= binary.BITS32\n let count = 0\n while (n) {\n n &= (n - 1)\n count++\n }\n return count\n}\n"],"names":["binary.BITS31","binary.BITS32","math.floor"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AAIA;AACY,MAAC,gBAAgB,GAAG,MAAM,CAAC,iBAAgB;AAC3C,MAAC,gBAAgB,GAAG,MAAM,CAAC,iBAAgB;AACvD;AACY,MAAC,YAAY,GAAG,CAAC,IAAI,GAAE;AACvB,MAAC,aAAa,GAAGA,cAAa;AAC9B,MAAC,cAAc,GAAGC,cAAa;AAC3C;AACA;AACY,MAAC,SAAS,GAAG,MAAM,CAAC,SAAS,KAAK,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAIC,UAAU,CAAC,GAAG,CAAC,KAAK,GAAG,EAAC;AAC7G,MAAC,KAAK,GAAG,MAAM,CAAC,MAAK;AACrB,MAAC,QAAQ,GAAG,MAAM,CAAC,SAAQ;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,SAAS,GAAG,CAAC,IAAI;AAC9B,EAAE,CAAC,IAAID,cAAa;AACpB,EAAE,IAAI,KAAK,GAAG,EAAC;AACf,EAAE,OAAO,CAAC,EAAE;AACZ,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAC;AAChB,IAAI,KAAK,GAAE;AACX,GAAG;AACH,EAAE,OAAO,KAAK;AACd;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/number.cjs b/yjs-poll/node_modules/lib0/dist/number.cjs deleted file mode 100644 index 45f184b..0000000 --- a/yjs-poll/node_modules/lib0/dist/number.cjs +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./math-96d5e8c4.cjs'); -require('./binary-ac8e39e2.cjs'); -var number = require('./number-1fb57bba.cjs'); - - - -exports.HIGHEST_INT32 = number.HIGHEST_INT32; -exports.HIGHEST_UINT32 = number.HIGHEST_UINT32; -exports.LOWEST_INT32 = number.LOWEST_INT32; -exports.MAX_SAFE_INTEGER = number.MAX_SAFE_INTEGER; -exports.MIN_SAFE_INTEGER = number.MIN_SAFE_INTEGER; -exports.countBits = number.countBits; -exports.isInteger = number.isInteger; -exports.isNaN = number.isNaN; -exports.parseInt = number.parseInt; -//# sourceMappingURL=number.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/number.cjs.map b/yjs-poll/node_modules/lib0/dist/number.cjs.map deleted file mode 100644 index 50fed4d..0000000 --- a/yjs-poll/node_modules/lib0/dist/number.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"number.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/number.d.ts b/yjs-poll/node_modules/lib0/dist/number.d.ts deleted file mode 100644 index 851ba98..0000000 --- a/yjs-poll/node_modules/lib0/dist/number.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export const MAX_SAFE_INTEGER: number; -export const MIN_SAFE_INTEGER: number; -export const LOWEST_INT32: number; -export const HIGHEST_INT32: number; -export const HIGHEST_UINT32: number; -export const isInteger: (number: unknown) => boolean; -export const isNaN: (number: unknown) => boolean; -export const parseInt: (string: string, radix?: number) => number; -export function countBits(n: number): number; -//# sourceMappingURL=number.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/number.d.ts.map b/yjs-poll/node_modules/lib0/dist/number.d.ts.map deleted file mode 100644 index a004c5c..0000000 --- a/yjs-poll/node_modules/lib0/dist/number.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../number.js"],"names":[],"mappings":"AASA,sCAAuD;AACvD,sCAAuD;AAEvD,kCAAmC;AACnC,mCAA0C;AAC1C,oCAA2C;AAG3C,qDAAyH;AACzH,iDAAiC;AACjC,kEAAuC;AAShC,6BAFI,MAAM,UAUhB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/number.test.d.ts b/yjs-poll/node_modules/lib0/dist/number.test.d.ts deleted file mode 100644 index 71df185..0000000 --- a/yjs-poll/node_modules/lib0/dist/number.test.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function testNumber(_tc: t.TestCase): void; -export function testShiftVsDivision(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=number.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/number.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/number.test.d.ts.map deleted file mode 100644 index 63fc50a..0000000 --- a/yjs-poll/node_modules/lib0/dist/number.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"number.test.d.ts","sourceRoot":"","sources":["../number.test.js"],"names":[],"mappings":"AAQO,gCAFI,CAAC,CAAC,QAAQ,QAiBpB;AAOM,wCAFI,CAAC,CAAC,QAAQ,QA6DpB;mBAzFkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/object-c0c9435b.cjs b/yjs-poll/node_modules/lib0/dist/object-c0c9435b.cjs deleted file mode 100644 index 6ec90d2..0000000 --- a/yjs-poll/node_modules/lib0/dist/object-c0c9435b.cjs +++ /dev/null @@ -1,212 +0,0 @@ -'use strict'; - -var equality = require('./equality.cjs'); - -/** - * Utility functions for working with EcmaScript objects. - * - * @module object - */ - -/** - * @return {Object} obj - */ -const create = () => Object.create(null); - -/** - * @param {any} o - * @return {o is { [k:string]:any }} - */ -const isObject = o => typeof o === 'object'; - -/** - * Object.assign - */ -const assign = Object.assign; - -/** - * @param {Object} obj - */ -const keys = Object.keys; - -/** - * @template V - * @param {{[key:string]: V}} obj - * @return {Array} - */ -const values = Object.values; - -/** - * @template V - * @param {{[k:string]:V}} obj - * @param {function(V,string):any} f - */ -const forEach = (obj, f) => { - for (const key in obj) { - f(obj[key], key); - } -}; - -/** - * @todo implement mapToArray & map - * - * @template R - * @param {Object} obj - * @param {function(any,string):R} f - * @return {Array} - */ -const map = (obj, f) => { - const results = []; - for (const key in obj) { - results.push(f(obj[key], key)); - } - return results -}; - -/** - * @deprecated use object.size instead - * @param {Object} obj - * @return {number} - */ -const length = obj => keys(obj).length; - -/** - * @param {Object} obj - * @return {number} - */ -const size = obj => keys(obj).length; - -/** - * @template {{ [key:string|number|symbol]: any }} T - * @param {T} obj - * @param {(v:T[keyof T],k:keyof T)=>boolean} f - * @return {boolean} - */ -const some = (obj, f) => { - for (const key in obj) { - if (f(obj[key], key)) { - return true - } - } - return false -}; - -/** - * @param {Object|null|undefined} obj - */ -const isEmpty = obj => { - // eslint-disable-next-line no-unreachable-loop - for (const _k in obj) { - return false - } - return true -}; - -/** - * @template {{ [key:string|number|symbol]: any }} T - * @param {T} obj - * @param {(v:T[keyof T],k:keyof T)=>boolean} f - * @return {boolean} - */ -const every = (obj, f) => { - for (const key in obj) { - if (!f(obj[key], key)) { - return false - } - } - return true -}; - -/** - * Calls `Object.prototype.hasOwnProperty`. - * - * @param {any} obj - * @param {string|number|symbol} key - * @return {boolean} - */ -const hasProperty = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key); - -/** - * @param {Object} a - * @param {Object} b - * @return {boolean} - */ -const equalFlat = (a, b) => a === b || (size(a) === size(b) && every(a, (val, key) => (val !== undefined || hasProperty(b, key)) && equality.equals(b[key], val))); - -/** - * Make an object immutable. This hurts performance and is usually not needed if you perform good - * coding practices. - */ -const freeze = Object.freeze; - -/** - * Make an object and all its children immutable. - * This *really* hurts performance and is usually not needed if you perform good coding practices. - * - * @template {any} T - * @param {T} o - * @return {Readonly} - */ -const deepFreeze = (o) => { - for (const key in o) { - const c = o[key]; - if (typeof c === 'object' || typeof c === 'function') { - deepFreeze(o[key]); - } - } - return freeze(o) -}; - -/** - * Get object property. Create T if property is undefined and set T on object. - * - * @function - * @template {object} KV - * @template {keyof KV} [K=keyof KV] - * @param {KV} o - * @param {K} key - * @param {() => KV[K]} createT - * @return {KV[K]} - */ -const setIfUndefined = (o, key, createT) => hasProperty(o, key) ? o[key] : (o[key] = createT()); - -var object = /*#__PURE__*/Object.freeze({ - __proto__: null, - create: create, - isObject: isObject, - assign: assign, - keys: keys, - values: values, - forEach: forEach, - map: map, - length: length, - size: size, - some: some, - isEmpty: isEmpty, - every: every, - hasProperty: hasProperty, - equalFlat: equalFlat, - freeze: freeze, - deepFreeze: deepFreeze, - setIfUndefined: setIfUndefined -}); - -exports.assign = assign; -exports.create = create; -exports.deepFreeze = deepFreeze; -exports.equalFlat = equalFlat; -exports.every = every; -exports.forEach = forEach; -exports.freeze = freeze; -exports.hasProperty = hasProperty; -exports.isEmpty = isEmpty; -exports.isObject = isObject; -exports.keys = keys; -exports.length = length; -exports.map = map; -exports.object = object; -exports.setIfUndefined = setIfUndefined; -exports.size = size; -exports.some = some; -exports.values = values; -//# sourceMappingURL=object-c0c9435b.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/object-c0c9435b.cjs.map b/yjs-poll/node_modules/lib0/dist/object-c0c9435b.cjs.map deleted file mode 100644 index 8d519f0..0000000 --- a/yjs-poll/node_modules/lib0/dist/object-c0c9435b.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"object-c0c9435b.cjs","sources":["../object.js"],"sourcesContent":["import * as equalityTrait from './trait/equality.js'\n\n/**\n * Utility functions for working with EcmaScript objects.\n *\n * @module object\n */\n\n/**\n * @return {Object} obj\n */\nexport const create = () => Object.create(null)\n\n/**\n * @param {any} o\n * @return {o is { [k:string]:any }}\n */\nexport const isObject = o => typeof o === 'object'\n\n/**\n * Object.assign\n */\nexport const assign = Object.assign\n\n/**\n * @param {Object} obj\n */\nexport const keys = Object.keys\n\n/**\n * @template V\n * @param {{[key:string]: V}} obj\n * @return {Array}\n */\nexport const values = Object.values\n\n/**\n * @template V\n * @param {{[k:string]:V}} obj\n * @param {function(V,string):any} f\n */\nexport const forEach = (obj, f) => {\n for (const key in obj) {\n f(obj[key], key)\n }\n}\n\n/**\n * @todo implement mapToArray & map\n *\n * @template R\n * @param {Object} obj\n * @param {function(any,string):R} f\n * @return {Array}\n */\nexport const map = (obj, f) => {\n const results = []\n for (const key in obj) {\n results.push(f(obj[key], key))\n }\n return results\n}\n\n/**\n * @deprecated use object.size instead\n * @param {Object} obj\n * @return {number}\n */\nexport const length = obj => keys(obj).length\n\n/**\n * @param {Object} obj\n * @return {number}\n */\nexport const size = obj => keys(obj).length\n\n/**\n * @template {{ [key:string|number|symbol]: any }} T\n * @param {T} obj\n * @param {(v:T[keyof T],k:keyof T)=>boolean} f\n * @return {boolean}\n */\nexport const some = (obj, f) => {\n for (const key in obj) {\n if (f(obj[key], key)) {\n return true\n }\n }\n return false\n}\n\n/**\n * @param {Object|null|undefined} obj\n */\nexport const isEmpty = obj => {\n // eslint-disable-next-line no-unreachable-loop\n for (const _k in obj) {\n return false\n }\n return true\n}\n\n/**\n * @template {{ [key:string|number|symbol]: any }} T\n * @param {T} obj\n * @param {(v:T[keyof T],k:keyof T)=>boolean} f\n * @return {boolean}\n */\nexport const every = (obj, f) => {\n for (const key in obj) {\n if (!f(obj[key], key)) {\n return false\n }\n }\n return true\n}\n\n/**\n * Calls `Object.prototype.hasOwnProperty`.\n *\n * @param {any} obj\n * @param {string|number|symbol} key\n * @return {boolean}\n */\nexport const hasProperty = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key)\n\n/**\n * @param {Object} a\n * @param {Object} b\n * @return {boolean}\n */\nexport const equalFlat = (a, b) => a === b || (size(a) === size(b) && every(a, (val, key) => (val !== undefined || hasProperty(b, key)) && equalityTrait.equals(b[key], val)))\n\n/**\n * Make an object immutable. This hurts performance and is usually not needed if you perform good\n * coding practices.\n */\nexport const freeze = Object.freeze\n\n/**\n * Make an object and all its children immutable.\n * This *really* hurts performance and is usually not needed if you perform good coding practices.\n *\n * @template {any} T\n * @param {T} o\n * @return {Readonly}\n */\nexport const deepFreeze = (o) => {\n for (const key in o) {\n const c = o[key]\n if (typeof c === 'object' || typeof c === 'function') {\n deepFreeze(o[key])\n }\n }\n return freeze(o)\n}\n\n/**\n * Get object property. Create T if property is undefined and set T on object.\n *\n * @function\n * @template {object} KV\n * @template {keyof KV} [K=keyof KV]\n * @param {KV} o\n * @param {K} key\n * @param {() => KV[K]} createT\n * @return {KV[K]}\n */\nexport const setIfUndefined = (o, key, createT) => hasProperty(o, key) ? o[key] : (o[key] = createT())\n"],"names":["equalityTrait.equals"],"mappings":";;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,EAAC;AAC/C;AACA;AACA;AACA;AACA;AACY,MAAC,QAAQ,GAAG,CAAC,IAAI,OAAO,CAAC,KAAK,SAAQ;AAClD;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,MAAM,CAAC,OAAM;AACnC;AACA;AACA;AACA;AACY,MAAC,IAAI,GAAG,MAAM,CAAC,KAAI;AAC/B;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,MAAM,CAAC,OAAM;AACnC;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,OAAO,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK;AACnC,EAAE,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE;AACzB,I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EAAE,GAAG,EAAE,OAAO,KAAK,WAAW,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/object.cjs b/yjs-poll/node_modules/lib0/dist/object.cjs deleted file mode 100644 index 7d3ad01..0000000 --- a/yjs-poll/node_modules/lib0/dist/object.cjs +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./equality.cjs'); -var object = require('./object-c0c9435b.cjs'); - - - -exports.assign = object.assign; -exports.create = object.create; -exports.deepFreeze = object.deepFreeze; -exports.equalFlat = object.equalFlat; -exports.every = object.every; -exports.forEach = object.forEach; -exports.freeze = object.freeze; -exports.hasProperty = object.hasProperty; -exports.isEmpty = object.isEmpty; -exports.isObject = object.isObject; -exports.keys = object.keys; -exports.length = object.length; -exports.map = object.map; -exports.setIfUndefined = object.setIfUndefined; -exports.size = object.size; -exports.some = object.some; -exports.values = object.values; -//# sourceMappingURL=object.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/object.cjs.map b/yjs-poll/node_modules/lib0/dist/object.cjs.map deleted file mode 100644 index e07c1fc..0000000 --- a/yjs-poll/node_modules/lib0/dist/object.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"object.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/object.d.ts b/yjs-poll/node_modules/lib0/dist/object.d.ts deleted file mode 100644 index 59f4dfe..0000000 --- a/yjs-poll/node_modules/lib0/dist/object.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -export function create(): { - [x: string]: any; -}; -export function isObject(o: any): o is { - [k: string]: any; -}; -/** - * Object.assign - */ -export const assign: { - (target: T, source: U): T & U; - (target: T, source1: U, source2: V_1): T & U & V_1; - (target: T, source1: U, source2: V_1, source3: W): T & U & V_1 & W; - (target: object, ...sources: any[]): any; -}; -/** - * @param {Object} obj - */ -export const keys: { - (o: object): string[]; - (o: {}): string[]; -}; -/** - * @template V - * @param {{[key:string]: V}} obj - * @return {Array} - */ -export const values: { - (o: { - [s: string]: T; - } | ArrayLike): T[]; - (o: {}): any[]; -}; -export function forEach(obj: { - [k: string]: V_1; -}, f: (arg0: V_1, arg1: string) => any): void; -export function map(obj: { - [x: string]: any; -}, f: (arg0: any, arg1: string) => R): Array; -export function length(obj: { - [x: string]: any; -}): number; -export function size(obj: { - [x: string]: any; -}): number; -export function some(obj: T, f: (v: T[keyof T], k: keyof T) => boolean): boolean; -export function isEmpty(obj: Object | null | undefined): boolean; -export function every(obj: T, f: (v: T[keyof T], k: keyof T) => boolean): boolean; -export function hasProperty(obj: any, key: string | number | symbol): boolean; -export function equalFlat(a: { - [x: string]: any; -}, b: { - [x: string]: any; -}): boolean; -/** - * Make an object immutable. This hurts performance and is usually not needed if you perform good - * coding practices. - */ -export const freeze: { - (f: T): T; - (o: T): Readonly; - (o: T): Readonly; -}; -export function deepFreeze(o: T): Readonly; -export function setIfUndefined(o: KV, key: K, createT: () => KV[K]): KV[K]; -//# sourceMappingURL=object.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/object.d.ts.map b/yjs-poll/node_modules/lib0/dist/object.d.ts.map deleted file mode 100644 index 64f66da..0000000 --- a/yjs-poll/node_modules/lib0/dist/object.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../object.js"],"names":[],"mappings":"AAWO;;EAAwC;AAMxC,4BAHI,GAAG,GACF,CAAC,IAAI;IAAE,CAAC,CAAC,EAAC,MAAM,GAAE,GAAG,CAAA;CAAE,CAEe;AAElD;;GAEG;AACH;;;;;EAAmC;AAEnC;;GAEG;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AC,CAEqF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/object.test.d.ts b/yjs-poll/node_modules/lib0/dist/object.test.d.ts deleted file mode 100644 index 9b50e5f..0000000 --- a/yjs-poll/node_modules/lib0/dist/object.test.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export function testEqualFlat(): void; -export function testObject(_tc: t.TestCase): void; -export function testFreeze(_tc: t.TestCase): void; -export function testSetifundefined(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=object.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/object.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/object.test.d.ts.map deleted file mode 100644 index 9e46160..0000000 --- a/yjs-poll/node_modules/lib0/dist/object.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"object.test.d.ts","sourceRoot":"","sources":["../object.test.js"],"names":[],"mappings":"AAIO,sCAEN;AAKM,gCAFI,CAAC,CAAC,QAAQ,QA4CpB;AAKM,gCAFI,CAAC,CAAC,QAAQ,QAuBpB;AAKM,wCAFI,CAAC,CAAC,QAAQ,QAgBpB;mBAlGkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/observable.cjs b/yjs-poll/node_modules/lib0/dist/observable.cjs deleted file mode 100644 index 2858686..0000000 --- a/yjs-poll/node_modules/lib0/dist/observable.cjs +++ /dev/null @@ -1,169 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var map = require('./map-24d263c0.cjs'); -var set = require('./set-5b47859e.cjs'); -var array = require('./array-78849c95.cjs'); - -/** - * Observable class prototype. - * - * @module observable - */ - -/** - * Handles named events. - * @experimental - * - * This is basically a (better typed) duplicate of Observable, which will replace Observable in the - * next release. - * - * @template {{[key in keyof EVENTS]: function(...any):void}} EVENTS - */ -class ObservableV2 { - constructor () { - /** - * Some desc. - * @type {Map>} - */ - this._observers = map.create(); - } - - /** - * @template {keyof EVENTS & string} NAME - * @param {NAME} name - * @param {EVENTS[NAME]} f - */ - on (name, f) { - map.setIfUndefined(this._observers, /** @type {string} */ (name), set.create).add(f); - return f - } - - /** - * @template {keyof EVENTS & string} NAME - * @param {NAME} name - * @param {EVENTS[NAME]} f - */ - once (name, f) { - /** - * @param {...any} args - */ - const _f = (...args) => { - this.off(name, /** @type {any} */ (_f)); - f(...args); - }; - this.on(name, /** @type {any} */ (_f)); - } - - /** - * @template {keyof EVENTS & string} NAME - * @param {NAME} name - * @param {EVENTS[NAME]} f - */ - off (name, f) { - const observers = this._observers.get(name); - if (observers !== undefined) { - observers.delete(f); - if (observers.size === 0) { - this._observers.delete(name); - } - } - } - - /** - * Emit a named event. All registered event listeners that listen to the - * specified name will receive the event. - * - * @todo This should catch exceptions - * - * @template {keyof EVENTS & string} NAME - * @param {NAME} name The event name. - * @param {Parameters} args The arguments that are applied to the event listener. - */ - emit (name, args) { - // copy all listeners to an array first to make sure that no event is emitted to listeners that are subscribed while the event handler is called. - return array.from((this._observers.get(name) || map.create()).values()).forEach(f => f(...args)) - } - - destroy () { - this._observers = map.create(); - } -} - -/* c8 ignore start */ -/** - * Handles named events. - * - * @deprecated - * @template N - */ -class Observable { - constructor () { - /** - * Some desc. - * @type {Map} - */ - this._observers = map.create(); - } - - /** - * @param {N} name - * @param {function} f - */ - on (name, f) { - map.setIfUndefined(this._observers, name, set.create).add(f); - } - - /** - * @param {N} name - * @param {function} f - */ - once (name, f) { - /** - * @param {...any} args - */ - const _f = (...args) => { - this.off(name, _f); - f(...args); - }; - this.on(name, _f); - } - - /** - * @param {N} name - * @param {function} f - */ - off (name, f) { - const observers = this._observers.get(name); - if (observers !== undefined) { - observers.delete(f); - if (observers.size === 0) { - this._observers.delete(name); - } - } - } - - /** - * Emit a named event. All registered event listeners that listen to the - * specified name will receive the event. - * - * @todo This should catch exceptions - * - * @param {N} name The event name. - * @param {Array} args The arguments that are applied to the event listener. - */ - emit (name, args) { - // copy all listeners to an array first to make sure that no event is emitted to listeners that are subscribed while the event handler is called. - return array.from((this._observers.get(name) || map.create()).values()).forEach(f => f(...args)) - } - - destroy () { - this._observers = map.create(); - } -} -/* c8 ignore end */ - -exports.Observable = Observable; -exports.ObservableV2 = ObservableV2; -//# sourceMappingURL=observable.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/observable.cjs.map b/yjs-poll/node_modules/lib0/dist/observable.cjs.map deleted file mode 100644 index 5579301..0000000 --- a/yjs-poll/node_modules/lib0/dist/observable.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"observable.cjs","sources":["../observable.js"],"sourcesContent":["/**\n * Observable class prototype.\n *\n * @module observable\n */\n\nimport * as map from './map.js'\nimport * as set from './set.js'\nimport * as array from './array.js'\n\n/**\n * Handles named events.\n * @experimental\n *\n * This is basically a (better typed) duplicate of Observable, which will replace Observable in the\n * next release.\n *\n * @template {{[key in keyof EVENTS]: function(...any):void}} EVENTS\n */\nexport class ObservableV2 {\n constructor () {\n /**\n * Some desc.\n * @type {Map>}\n */\n this._observers = map.create()\n }\n\n /**\n * @template {keyof EVENTS & string} NAME\n * @param {NAME} name\n * @param {EVENTS[NAME]} f\n */\n on (name, f) {\n map.setIfUndefined(this._observers, /** @type {string} */ (name), set.create).add(f)\n return f\n }\n\n /**\n * @template {keyof EVENTS & string} NAME\n * @param {NAME} name\n * @param {EVENTS[NAME]} f\n */\n once (name, f) {\n /**\n * @param {...any} args\n */\n const _f = (...args) => {\n this.off(name, /** @type {any} */ (_f))\n f(...args)\n }\n this.on(name, /** @type {any} */ (_f))\n }\n\n /**\n * @template {keyof EVENTS & string} NAME\n * @param {NAME} name\n * @param {EVENTS[NAME]} f\n */\n off (name, f) {\n const observers = this._observers.get(name)\n if (observers !== undefined) {\n observers.delete(f)\n if (observers.size === 0) {\n this._observers.delete(name)\n }\n }\n }\n\n /**\n * Emit a named event. All registered event listeners that listen to the\n * specified name will receive the event.\n *\n * @todo This should catch exceptions\n *\n * @template {keyof EVENTS & string} NAME\n * @param {NAME} name The event name.\n * @param {Parameters} args The arguments that are applied to the event listener.\n */\n emit (name, args) {\n // copy all listeners to an array first to make sure that no event is emitted to listeners that are subscribed while the event handler is called.\n return array.from((this._observers.get(name) || map.create()).values()).forEach(f => f(...args))\n }\n\n destroy () {\n this._observers = map.create()\n }\n}\n\n/* c8 ignore start */\n/**\n * Handles named events.\n *\n * @deprecated\n * @template N\n */\nexport class Observable {\n constructor () {\n /**\n * Some desc.\n * @type {Map}\n */\n this._observers = map.create()\n }\n\n /**\n * @param {N} name\n * @param {function} f\n */\n on (name, f) {\n map.setIfUndefined(this._observers, name, set.create).add(f)\n }\n\n /**\n * @param {N} name\n * @param {function} f\n */\n once (name, f) {\n /**\n * @param {...any} args\n */\n const _f = (...args) => {\n this.off(name, _f)\n f(...args)\n }\n this.on(name, _f)\n }\n\n /**\n * @param {N} name\n * @param {function} f\n */\n off (name, f) {\n const observers = this._observers.get(name)\n if (observers !== undefined) {\n observers.delete(f)\n if (observers.size === 0) {\n this._observers.delete(name)\n }\n }\n }\n\n /**\n * Emit a named event. All registered event listeners that listen to the\n * specified name will receive the event.\n *\n * @todo This should catch exceptions\n *\n * @param {N} name The event name.\n * @param {Array} args The arguments that are applied to the event listener.\n */\n emit (name, args) {\n // copy all listeners to an array first to make sure that no event is emitted to listeners that are subscribed while the event handler is called.\n return array.from((this._observers.get(name) || map.create()).values()).forEach(f => f(...args))\n }\n\n destroy () {\n this._observers = map.create()\n }\n}\n/* c8 ignore end */\n"],"names":["map.create","map.setIfUndefined","set.create","array.from"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,YAAY,CAAC;AAC1B,EAAE,WAAW,CAAC,GAAG;AACjB;AACA;AACA;AACA;AACA,IAAI,IAAI,CAAC,UAAU,GAAGA,UAAU,GAAE;AAClC,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,CAAC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A;AACA;AACA;AACA;AACA;AACA,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE;AACpB;AACA,IAAI,OAAOC,UAAU,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAIH,UAAU,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AACpG,GAAG;AACH;AACA,EAAE,OAAO,CAAC,GAAG;AACb,IAAI,IAAI,CAAC,UAAU,GAAGA,UAAU,GAAE;AAClC,GAAG;AACH,CAAC;AACD;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/observable.d.ts b/yjs-poll/node_modules/lib0/dist/observable.d.ts deleted file mode 100644 index 8d83170..0000000 --- a/yjs-poll/node_modules/lib0/dist/observable.d.ts +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Handles named events. - * @experimental - * - * This is basically a (better typed) duplicate of Observable, which will replace Observable in the - * next release. - * - * @template {{[key in keyof EVENTS]: function(...any):void}} EVENTS - */ -export class ObservableV2 void; }> { - /** - * Some desc. - * @type {Map>} - */ - _observers: Map>; - /** - * @template {keyof EVENTS & string} NAME - * @param {NAME} name - * @param {EVENTS[NAME]} f - */ - on(name: NAME, f: EVENTS[NAME]): EVENTS[NAME]; - /** - * @template {keyof EVENTS & string} NAME - * @param {NAME} name - * @param {EVENTS[NAME]} f - */ - once(name: NAME, f: EVENTS[NAME]): void; - /** - * @template {keyof EVENTS & string} NAME - * @param {NAME} name - * @param {EVENTS[NAME]} f - */ - off(name: NAME, f: EVENTS[NAME]): void; - /** - * Emit a named event. All registered event listeners that listen to the - * specified name will receive the event. - * - * @todo This should catch exceptions - * - * @template {keyof EVENTS & string} NAME - * @param {NAME} name The event name. - * @param {Parameters} args The arguments that are applied to the event listener. - */ - emit(name: NAME, args: Parameters): void; - destroy(): void; -} -/** - * Handles named events. - * - * @deprecated - * @template N - */ -export class Observable { - /** - * Some desc. - * @type {Map} - */ - _observers: Map; - /** - * @param {N} name - * @param {function} f - */ - on(name: N, f: Function): void; - /** - * @param {N} name - * @param {function} f - */ - once(name: N, f: Function): void; - /** - * @param {N} name - * @param {function} f - */ - off(name: N, f: Function): void; - /** - * Emit a named event. All registered event listeners that listen to the - * specified name will receive the event. - * - * @todo This should catch exceptions - * - * @param {N} name The event name. - * @param {Array} args The arguments that are applied to the event listener. - */ - emit(name: N, args: Array): void; - destroy(): void; -} -//# sourceMappingURL=observable.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/observable.d.ts.map b/yjs-poll/node_modules/lib0/dist/observable.d.ts.map deleted file mode 100644 index de50536..0000000 --- a/yjs-poll/node_modules/lib0/dist/observable.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"observable.d.ts","sourceRoot":"","sources":["../observable.js"],"names":[],"mappings":"AAUA;;;;;;;;GAQG;AACH,0BAF8D,MAAM,SAAvD,GAAG,GAAG,IAAI,MAAM,MAAM,GAAG,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,IAAI,GAAE;IAIzD;;;OAGG;IACH,YAFU,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAED;IAGhC;;;;OAIG;IACH,GAJqC,IAAI,SAA3B,MAAM,MAAM,GAAG,MAAO,QACzB,IAAI,KACJ,MAAM,CAAC,IAAI,CAAC,gBAKtB;IAED;;;;OAIG;IACH,KAJqC,IAAI,SAA3B,MAAM,MAAM,GAAG,MAAO,QACzB,IAAI,KACJ,MAAM,CAAC,IAAI,CAAC,QAWtB;IAED;;;;OAIG;IACH,IAJqC,IAAI,SAA3B,MAAM,MAAM,GAAG,MAAO,QACzB,IAAI,KACJ,MAAM,CAAC,IAAI,CAAC,QAUtB;IAED;;;;;;;;;OASG;IACH,KAJqC,IAAI,SAA3B,MAAM,MAAM,GAAG,MAAO,QACzB,IAAI,QACJ,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAKlC;IAED,gBAEC;CACF;AAGD;;;;;GAKG;AACH,wBAFa,CAAC;IAIV;;;OAGG;IACH,YAFU,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAES;IAGhC;;;OAGG;IACH,SAHW,CAAC,qBAKX;IAED;;;OAGG;IACH,WAHW,CAAC,qBAYX;IAED;;;OAGG;IACH,UAHW,CAAC,qBAWX;IAED;;;;;;;;OAQG;IACH,WAHW,CAAC,QACD,KAAK,CAAC,GAAG,CAAC,QAKpB;IAED,gBAEC;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/observable.test.d.ts b/yjs-poll/node_modules/lib0/dist/observable.test.d.ts deleted file mode 100644 index 895ebfe..0000000 --- a/yjs-poll/node_modules/lib0/dist/observable.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testTypedObservable(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=observable.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/observable.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/observable.test.d.ts.map deleted file mode 100644 index 0e8e333..0000000 --- a/yjs-poll/node_modules/lib0/dist/observable.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"observable.test.d.ts","sourceRoot":"","sources":["../observable.test.js"],"names":[],"mappings":"AAMO,yCAFI,CAAC,CAAC,QAAQ,QA6CpB;mBAjDkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/pair-ab022bc3.cjs b/yjs-poll/node_modules/lib0/dist/pair-ab022bc3.cjs deleted file mode 100644 index 1df371e..0000000 --- a/yjs-poll/node_modules/lib0/dist/pair-ab022bc3.cjs +++ /dev/null @@ -1,69 +0,0 @@ -'use strict'; - -/** - * Working with value pairs. - * - * @module pair - */ - -/** - * @template L,R - */ -class Pair { - /** - * @param {L} left - * @param {R} right - */ - constructor (left, right) { - this.left = left; - this.right = right; - } -} - -/** - * @template L,R - * @param {L} left - * @param {R} right - * @return {Pair} - */ -const create = (left, right) => new Pair(left, right); - -/** - * @template L,R - * @param {R} right - * @param {L} left - * @return {Pair} - */ -const createReversed = (right, left) => new Pair(left, right); - -/** - * @template L,R - * @param {Array>} arr - * @param {function(L, R):any} f - */ -const forEach = (arr, f) => arr.forEach(p => f(p.left, p.right)); - -/** - * @template L,R,X - * @param {Array>} arr - * @param {function(L, R):X} f - * @return {Array} - */ -const map = (arr, f) => arr.map(p => f(p.left, p.right)); - -var pair = /*#__PURE__*/Object.freeze({ - __proto__: null, - Pair: Pair, - create: create, - createReversed: createReversed, - forEach: forEach, - map: map -}); - -exports.Pair = Pair; -exports.create = create; -exports.createReversed = createReversed; -exports.forEach = forEach; -exports.map = map; -exports.pair = pair; -//# sourceMappingURL=pair-ab022bc3.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/pair-ab022bc3.cjs.map b/yjs-poll/node_modules/lib0/dist/pair-ab022bc3.cjs.map deleted file mode 100644 index 6b99924..0000000 --- a/yjs-poll/node_modules/lib0/dist/pair-ab022bc3.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pair-ab022bc3.cjs","sources":["../pair.js"],"sourcesContent":["/**\n * Working with value pairs.\n *\n * @module pair\n */\n\n/**\n * @template L,R\n */\nexport class Pair {\n /**\n * @param {L} left\n * @param {R} right\n */\n constructor (left, right) {\n this.left = left\n this.right = right\n }\n}\n\n/**\n * @template L,R\n * @param {L} left\n * @param {R} right\n * @return {Pair}\n */\nexport const create = (left, right) => new Pair(left, right)\n\n/**\n * @template L,R\n * @param {R} right\n * @param {L} left\n * @return {Pair}\n */\nexport const createReversed = (right, left) => new Pair(left, right)\n\n/**\n * @template L,R\n * @param {Array>} arr\n * @param {function(L, R):any} f\n */\nexport const forEach = (arr, f) => arr.forEach(p => f(p.left, p.right))\n\n/**\n * @template L,R,X\n * @param {Array>} arr\n * @param {function(L, R):X} f\n * @return {Array}\n */\nexport const map = (arr, f) => arr.map(p => f(p.left, p.right))\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,IAAI,CAAC;AAClB;AACA;AACA;AACA;AACA,EAAE,WAAW,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE;AAC5B,IAAI,IAAI,CAAC,IAAI,GAAG,KAAI;AACpB,IAAI,IAAI,CAAC,KAAK,GAAG,MAAK;AACtB,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAC;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAG,CAAC,KAAK,EAAE,IAAI,KAAK,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAC;AACpE;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,OAAO,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,EAAC;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/pair.cjs b/yjs-poll/node_modules/lib0/dist/pair.cjs deleted file mode 100644 index f16af58..0000000 --- a/yjs-poll/node_modules/lib0/dist/pair.cjs +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var pair = require('./pair-ab022bc3.cjs'); - - - -exports.Pair = pair.Pair; -exports.create = pair.create; -exports.createReversed = pair.createReversed; -exports.forEach = pair.forEach; -exports.map = pair.map; -//# sourceMappingURL=pair.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/pair.cjs.map b/yjs-poll/node_modules/lib0/dist/pair.cjs.map deleted file mode 100644 index 4ba3e24..0000000 --- a/yjs-poll/node_modules/lib0/dist/pair.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pair.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/pair.d.ts b/yjs-poll/node_modules/lib0/dist/pair.d.ts deleted file mode 100644 index 08c917d..0000000 --- a/yjs-poll/node_modules/lib0/dist/pair.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Working with value pairs. - * - * @module pair - */ -/** - * @template L,R - */ -export class Pair { - /** - * @param {L} left - * @param {R} right - */ - constructor(left: L, right: R); - left: L; - right: R; -} -export function create(left: L, right: R): Pair; -export function createReversed(right: R, left: L): Pair; -export function forEach(arr: Array>, f: (arg0: L, arg1: R) => any): void; -export function map(arr: Array>, f: (arg0: L, arg1: R) => X): Array; -//# sourceMappingURL=pair.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/pair.d.ts.map b/yjs-poll/node_modules/lib0/dist/pair.d.ts.map deleted file mode 100644 index d1f8095..0000000 --- a/yjs-poll/node_modules/lib0/dist/pair.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pair.d.ts","sourceRoot":"","sources":["../pair.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,kBAFa,CAAC,EAAC,CAAC;IAGd;;;OAGG;IACH,kBAHW,CAAC,SACD,CAAC,EAKX;IAFC,QAAgB;IAChB,SAAkB;CAErB;AAQM,uBALM,CAAC,EAAC,CAAC,QACL,CAAC,SACD,CAAC,GACA,IAAI,CAAC,CAAC,EAAC,CAAC,CAAC,CAEuC;AAQrD,+BALM,CAAC,EAAC,CAAC,SACL,CAAC,QACD,CAAC,GACA,IAAI,CAAC,CAAC,EAAC,CAAC,CAAC,CAE+C;AAO7D,wBAJM,CAAC,EAAC,CAAC,OACL,KAAK,CAAC,IAAI,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,KAChB,CAAS,IAAC,EAAD,CAAC,EAAE,IAAC,EAAD,CAAC,KAAE,GAAG,QAE0C;AAQhE,oBALM,CAAC,EAAC,CAAC,EAAC,CAAC,OACP,KAAK,CAAC,IAAI,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,KAChB,CAAS,IAAC,EAAD,CAAC,EAAE,IAAC,EAAD,CAAC,KAAE,CAAC,GACf,KAAK,CAAC,CAAC,CAAC,CAE2C"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/pair.test.d.ts b/yjs-poll/node_modules/lib0/dist/pair.test.d.ts deleted file mode 100644 index ab51b8b..0000000 --- a/yjs-poll/node_modules/lib0/dist/pair.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testPair(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=pair.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/pair.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/pair.test.d.ts.map deleted file mode 100644 index 340e4d2..0000000 --- a/yjs-poll/node_modules/lib0/dist/pair.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pair.test.d.ts","sourceRoot":"","sources":["../pair.test.js"],"names":[],"mappings":"AAOO,6BAFI,CAAC,CAAC,QAAQ,QAepB;mBApBkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/patience.cjs b/yjs-poll/node_modules/lib0/dist/patience.cjs deleted file mode 100644 index 44789f2..0000000 --- a/yjs-poll/node_modules/lib0/dist/patience.cjs +++ /dev/null @@ -1,236 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var map = require('./map-24d263c0.cjs'); -var math = require('./math-96d5e8c4.cjs'); -var array = require('./array-78849c95.cjs'); -require('./set-5b47859e.cjs'); - -/** - * A very simple diff algorithm. Slightly adapted to support splitting at different stages (e.g. - * first diff lines, then diff words) - * - * https://bramcohen.livejournal.com/73318.html - * - * @experiemantal This API will likely change. - */ - -/** - * Implementation of patience diff. Expects that content is pre-split (e.g. by newline). - * - * @param {Array} as - * @param {Array} bs - * @return {Array<{ index: number, remove: Array, insert: Array}>} changeset @todo should use delta instead - */ -const diff = (as, bs) => { - const { - middleAs, - middleBs, - commonPrefix - } = removeCommonPrefixAndSuffix(as, bs); - return lcs(middleAs, middleBs, commonPrefix) -}; - -/** - * @param {string} a - * @param {string} b - * @param {RegExp|string} _regexp - */ -const diffSplitBy = (a, b, _regexp) => { - const isStringSeparator = typeof _regexp === 'string'; - const separator = isStringSeparator ? _regexp : ''; - const regexp = isStringSeparator ? new RegExp(_regexp, 'g') : _regexp; - const as = splitByRegexp(a, regexp, !isStringSeparator); - const bs = splitByRegexp(b, regexp, !isStringSeparator); - const changes = diff(as, bs); - let prevSplitIndex = 0; - let prevStringIndex = 0; - return changes.map(change => { - for (; prevSplitIndex < change.index; prevSplitIndex++) { - prevStringIndex += as[prevSplitIndex].length; - } - return { - index: prevStringIndex, - remove: change.remove.join(separator), - insert: change.insert.join(separator) - } - }) -}; - -/** - * Sensible default for diffing strings using patience (it's fast though). - * - * Perform different types of patience diff on the content. Diff first by newline, then paragraphs, then by word - * (split by space, brackets, punctuation) - * - * @param {string} a - * @param {string} b - */ -const diffAuto = (a, b) => - diffSplitBy(a, b, '\n').map(d => - diffSplitBy(d.remove, d.insert, /\. |[a-zA-Z0-9]+|[. ()[\],;{}]/g).map(dd => ({ - insert: dd.insert, - remove: dd.remove, - index: dd.index + d.index - })) - ).flat(); - -/** - * @param {Array} as - * @param {Array} bs - */ -const removeCommonPrefixAndSuffix = (as, bs) => { - const commonLen = math.min(as.length, bs.length); - let commonPrefix = 0; - let commonSuffix = 0; - // match start - for (; commonPrefix < commonLen && as[commonPrefix] === bs[commonPrefix]; commonPrefix++) { /* nop */ } - // match end - for (; commonSuffix < commonLen - commonPrefix && as[as.length - 1 - commonSuffix] === bs[bs.length - 1 - commonSuffix]; commonSuffix++) { /* nop */ } - const middleAs = as.slice(commonPrefix, as.length - commonSuffix); - const middleBs = bs.slice(commonPrefix, bs.length - commonSuffix); - return { - middleAs, middleBs, commonPrefix, commonSuffix - } -}; - -/** - * Splits string by regex and returns all strings as an array. The matched parts are also returned. - * - * @param {string} str - * @param {RegExp} regexp - * @param {boolean} includeSeparator - */ -const splitByRegexp = (str, regexp, includeSeparator) => { - const matches = [...str.matchAll(regexp)]; - let prevIndex = 0; - /** - * @type {Array} - */ - const res = []; - matches.forEach(m => { - prevIndex < (m.index || 0) && res.push(str.slice(prevIndex, m.index)); - includeSeparator && res.push(m[0]); // is always non-empty - prevIndex = /** @type {number} */ (m.index) + m[0].length; - }); - const end = str.slice(prevIndex); - end.length > 0 && res.push(end); - return res -}; - -/** - * An item may have multiple occurances (not when matching unique entries). It also may have a - * reference to the stack of other items (from as to bs). - */ -class Item { - constructor () { - /** - * @type {Array} - */ - this.indexes = []; - /** - * The matching item from the other side - * @type {Item?} - */ - this.match = null; - /** - * For patience sort. Reference (index of the stack) to the previous pile. - * - * @type {Item?} - */ - this.ref = null; - } -} - -/** - * @param {Array} xs - */ -const partition = xs => { - /** - * @type {Map} - */ - const refs = map.create(); - xs.forEach((x, index) => { - map.setIfUndefined(refs, x, () => new Item()).indexes.push(index); - }); - return refs -}; - -/** - * Find the longest common subsequence of items using patience sort. - * - * @param {Array} as - * @param {Array} bs - * @param {number} indexAdjust - */ -const lcs = (as, bs, indexAdjust) => { - if (as.length === 0 && bs.length === 0) return [] - const aParts = partition(as); - const bParts = partition(bs); - /** - * @type {Array>} I.e. Array> - */ - const piles = []; - aParts.forEach((aItem, aKey) => { - // skip if no match or if either item is not unique - if (aItem.indexes.length > 1 || (aItem.match = bParts.get(aKey) || null) == null || aItem.match.indexes.length > 1) return - for (let i = 0; i < piles.length; i++) { - const pile = piles[i]; - if (aItem.match.indexes[0] < /** @type {Item} */ (pile[pile.length - 1].match).indexes[0]) { - pile.push(aItem); - if (i > 0) aItem.ref = array.last(piles[i - 1]); - return - } - } - piles.length > 0 && (aItem.ref = array.last(piles[piles.length - 1])); - piles.push([aItem]); - }); - /** - * References to all matched items - * - * @type {Array} - */ - const matches = []; - /** - * @type {Item?} - */ - let currPileItem = piles[piles.length - 1]?.[0]; - while (currPileItem != null) { - matches.push(currPileItem); - currPileItem = currPileItem.ref; - } - matches.reverse(); - // add pseude match (assume the string terminal always matches) - const pseudoA = new Item(); - const pseudoB = new Item(); - pseudoA.match = pseudoB; - pseudoA.indexes.push(as.length); - pseudoB.indexes.push(bs.length); - matches.push(pseudoA); - /** - * @type {Array<{ index: number, remove: Array, insert: Array}>} - */ - const changeset = []; - let diffAStart = 0; - let diffBStart = 0; - for (let i = 0; i < matches.length; i++) { - const m = matches[i]; - const delLength = m.indexes[0] - diffAStart; - const insLength = /** @type {Item} */ (m.match).indexes[0] - diffBStart; - if (delLength !== 0 || insLength !== 0) { - const stripped = removeCommonPrefixAndSuffix(as.slice(diffAStart, diffAStart + delLength), bs.slice(diffBStart, diffBStart + insLength)); - if (stripped.middleAs.length !== 0 || stripped.middleBs.length !== 0) { - changeset.push({ index: diffAStart + indexAdjust + stripped.commonPrefix, remove: stripped.middleAs, insert: stripped.middleBs }); - } - } - diffAStart = m.indexes[0] + 1; - diffBStart = /** @type {Item} */ (m.match).indexes[0] + 1; - } - return changeset -}; - -exports.diff = diff; -exports.diffAuto = diffAuto; -exports.diffSplitBy = diffSplitBy; -//# sourceMappingURL=patience.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/patience.cjs.map b/yjs-poll/node_modules/lib0/dist/patience.cjs.map deleted file mode 100644 index 875d1b2..0000000 --- a/yjs-poll/node_modules/lib0/dist/patience.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"patience.cjs","sources":["../diff/patience.js"],"sourcesContent":["/**\n * A very simple diff algorithm. Slightly adapted to support splitting at different stages (e.g.\n * first diff lines, then diff words)\n *\n * https://bramcohen.livejournal.com/73318.html\n *\n * @experiemantal This API will likely change.\n */\n\nimport * as map from '../map.js'\nimport * as math from '../math.js'\nimport * as array from '../array.js'\n\n/**\n * Implementation of patience diff. Expects that content is pre-split (e.g. by newline).\n *\n * @param {Array} as\n * @param {Array} bs\n * @return {Array<{ index: number, remove: Array, insert: Array}>} changeset @todo should use delta instead\n */\nexport const diff = (as, bs) => {\n const {\n middleAs,\n middleBs,\n commonPrefix\n } = removeCommonPrefixAndSuffix(as, bs)\n return lcs(middleAs, middleBs, commonPrefix)\n}\n\n/**\n * @param {string} a\n * @param {string} b\n * @param {RegExp|string} _regexp\n */\nexport const diffSplitBy = (a, b, _regexp) => {\n const isStringSeparator = typeof _regexp === 'string'\n const separator = isStringSeparator ? _regexp : ''\n const regexp = isStringSeparator ? new RegExp(_regexp, 'g') : _regexp\n const as = splitByRegexp(a, regexp, !isStringSeparator)\n const bs = splitByRegexp(b, regexp, !isStringSeparator)\n const changes = diff(as, bs)\n let prevSplitIndex = 0\n let prevStringIndex = 0\n return changes.map(change => {\n for (; prevSplitIndex < change.index; prevSplitIndex++) {\n prevStringIndex += as[prevSplitIndex].length\n }\n return {\n index: prevStringIndex,\n remove: change.remove.join(separator),\n insert: change.insert.join(separator)\n }\n })\n}\n\n/**\n * Sensible default for diffing strings using patience (it's fast though).\n *\n * Perform different types of patience diff on the content. Diff first by newline, then paragraphs, then by word\n * (split by space, brackets, punctuation)\n *\n * @param {string} a\n * @param {string} b\n */\nexport const diffAuto = (a, b) =>\n diffSplitBy(a, b, '\\n').map(d =>\n diffSplitBy(d.remove, d.insert, /\\. |[a-zA-Z0-9]+|[. ()[\\],;{}]/g).map(dd => ({\n insert: dd.insert,\n remove: dd.remove,\n index: dd.index + d.index\n }))\n ).flat()\n\n/**\n * @param {Array} as\n * @param {Array} bs\n */\nconst removeCommonPrefixAndSuffix = (as, bs) => {\n const commonLen = math.min(as.length, bs.length)\n let commonPrefix = 0\n let commonSuffix = 0\n // match start\n for (; commonPrefix < commonLen && as[commonPrefix] === bs[commonPrefix]; commonPrefix++) { /* nop */ }\n // match end\n for (; commonSuffix < commonLen - commonPrefix && as[as.length - 1 - commonSuffix] === bs[bs.length - 1 - commonSuffix]; commonSuffix++) { /* nop */ }\n const middleAs = as.slice(commonPrefix, as.length - commonSuffix)\n const middleBs = bs.slice(commonPrefix, bs.length - commonSuffix)\n return {\n middleAs, middleBs, commonPrefix, commonSuffix\n }\n}\n\n/**\n * Splits string by regex and returns all strings as an array. The matched parts are also returned.\n *\n * @param {string} str\n * @param {RegExp} regexp\n * @param {boolean} includeSeparator\n */\nconst splitByRegexp = (str, regexp, includeSeparator) => {\n const matches = [...str.matchAll(regexp)]\n let prevIndex = 0\n /**\n * @type {Array}\n */\n const res = []\n matches.forEach(m => {\n prevIndex < (m.index || 0) && res.push(str.slice(prevIndex, m.index))\n includeSeparator && res.push(m[0]) // is always non-empty\n prevIndex = /** @type {number} */ (m.index) + m[0].length\n })\n const end = str.slice(prevIndex)\n end.length > 0 && res.push(end)\n return res\n}\n\n/**\n * An item may have multiple occurances (not when matching unique entries). It also may have a\n * reference to the stack of other items (from as to bs).\n */\nclass Item {\n constructor () {\n /**\n * @type {Array}\n */\n this.indexes = []\n /**\n * The matching item from the other side\n * @type {Item?}\n */\n this.match = null\n /**\n * For patience sort. Reference (index of the stack) to the previous pile.\n *\n * @type {Item?}\n */\n this.ref = null\n }\n}\n\n/**\n * @param {Array} xs\n */\nconst partition = xs => {\n /**\n * @type {Map}\n */\n const refs = map.create()\n xs.forEach((x, index) => {\n map.setIfUndefined(refs, x, () => new Item()).indexes.push(index)\n })\n return refs\n}\n\n/**\n * Find the longest common subsequence of items using patience sort.\n *\n * @param {Array} as\n * @param {Array} bs\n * @param {number} indexAdjust\n */\nconst lcs = (as, bs, indexAdjust) => {\n if (as.length === 0 && bs.length === 0) return []\n const aParts = partition(as)\n const bParts = partition(bs)\n /**\n * @type {Array>} I.e. Array>\n */\n const piles = []\n aParts.forEach((aItem, aKey) => {\n // skip if no match or if either item is not unique\n if (aItem.indexes.length > 1 || (aItem.match = bParts.get(aKey) || null) == null || aItem.match.indexes.length > 1) return\n for (let i = 0; i < piles.length; i++) {\n const pile = piles[i]\n if (aItem.match.indexes[0] < /** @type {Item} */ (pile[pile.length - 1].match).indexes[0]) {\n pile.push(aItem)\n if (i > 0) aItem.ref = array.last(piles[i - 1])\n return\n }\n }\n piles.length > 0 && (aItem.ref = array.last(piles[piles.length - 1]))\n piles.push([aItem])\n })\n /**\n * References to all matched items\n *\n * @type {Array}\n */\n const matches = []\n /**\n * @type {Item?}\n */\n let currPileItem = piles[piles.length - 1]?.[0]\n while (currPileItem != null) {\n matches.push(currPileItem)\n currPileItem = currPileItem.ref\n }\n matches.reverse()\n // add pseude match (assume the string terminal always matches)\n const pseudoA = new Item()\n const pseudoB = new Item()\n pseudoA.match = pseudoB\n pseudoA.indexes.push(as.length)\n pseudoB.indexes.push(bs.length)\n matches.push(pseudoA)\n /**\n * @type {Array<{ index: number, remove: Array, insert: Array}>}\n */\n const changeset = []\n let diffAStart = 0\n let diffBStart = 0\n for (let i = 0; i < matches.length; i++) {\n const m = matches[i]\n const delLength = m.indexes[0] - diffAStart\n const insLength = /** @type {Item} */ (m.match).indexes[0] - diffBStart\n if (delLength !== 0 || insLength !== 0) {\n const stripped = removeCommonPrefixAndSuffix(as.slice(diffAStart, diffAStart + delLength), bs.slice(diffBStart, diffBStart + insLength))\n if (stripped.middleAs.length !== 0 || stripped.middleBs.length !== 0) {\n changeset.push({ index: diffAStart + indexAdjust + stripped.commonPrefix, remove: stripped.middleAs, insert: stripped.middleBs })\n }\n }\n diffAStart = m.indexes[0] + 1\n diffBStart = /** @type {Item} */ (m.match).indexes[0] + 1\n }\n return changeset\n}\n"],"names":["math.min","map.create","map.setIfUndefined","array.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AM,EAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,QAAQ,EAAE,EAAC;AACzI,OAAO;AACP,KAAK;AACL,IAAI,UAAU,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAC;AACjC,IAAI,UAAU,uBAAuB,CAAC,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,EAAC;AAC7D,GAAG;AACH,EAAE,OAAO,SAAS;AAClB;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/performance.cjs b/yjs-poll/node_modules/lib0/dist/performance.cjs deleted file mode 100644 index 641f4d7..0000000 --- a/yjs-poll/node_modules/lib0/dist/performance.cjs +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -/* eslint-env browser */ - -const measure = performance.measure.bind(performance); -const now = performance.now.bind(performance); -const mark = performance.mark.bind(performance); - -exports.mark = mark; -exports.measure = measure; -exports.now = now; -//# sourceMappingURL=performance.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/performance.cjs.map b/yjs-poll/node_modules/lib0/dist/performance.cjs.map deleted file mode 100644 index 072c415..0000000 --- a/yjs-poll/node_modules/lib0/dist/performance.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"performance.cjs","sources":["../performance.js"],"sourcesContent":["/* eslint-env browser */\n\nexport const measure = performance.measure.bind(performance)\nexport const now = performance.now.bind(performance)\nexport const mark = performance.mark.bind(performance)\n"],"names":[],"mappings":";;;;AAAA;AACA;AACY,MAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAC;AAChD,MAAC,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAC;AACxC,MAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/performance.d.ts b/yjs-poll/node_modules/lib0/dist/performance.d.ts deleted file mode 100644 index 0226088..0000000 --- a/yjs-poll/node_modules/lib0/dist/performance.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const measure: (measureName: string, startOrMeasureOptions?: string | PerformanceMeasureOptions, endMark?: string) => PerformanceMeasure; -export const now: () => DOMHighResTimeStamp; -export const mark: (markName: string, markOptions?: PerformanceMarkOptions) => PerformanceMark; -//# sourceMappingURL=performance.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/performance.d.ts.map b/yjs-poll/node_modules/lib0/dist/performance.d.ts.map deleted file mode 100644 index d5d5311..0000000 --- a/yjs-poll/node_modules/lib0/dist/performance.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"performance.d.ts","sourceRoot":"","sources":["../performance.js"],"names":[],"mappings":"AAEA,gJAA4D;AAC5D,4CAAoD;AACpD,+FAAsD"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/performance.node.cjs b/yjs-poll/node_modules/lib0/dist/performance.node.cjs deleted file mode 100644 index d097aa3..0000000 --- a/yjs-poll/node_modules/lib0/dist/performance.node.cjs +++ /dev/null @@ -1,36 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var node_perf_hooks = require('node:perf_hooks'); -var _function = require('./function-314580f7.cjs'); -var time = require('./time-d8438852.cjs'); -require('./array-78849c95.cjs'); -require('./set-5b47859e.cjs'); -require('./object-c0c9435b.cjs'); -require('./equality.cjs'); -require('./metric.cjs'); -require('./math-96d5e8c4.cjs'); - -/** - * @type {typeof performance.measure} - */ -/* c8 ignore next */ -const measure = node_perf_hooks.performance.measure ? node_perf_hooks.performance.measure.bind(node_perf_hooks.performance) : /** @type {any} */ (_function.nop); - -/** - * @type {typeof performance.now} - */ -/* c8 ignore next */ -const now = node_perf_hooks.performance.now ? node_perf_hooks.performance.now.bind(node_perf_hooks.performance) : time.getUnixTime; - -/** - * @type {typeof performance.mark} - */ -/* c8 ignore next */ -const mark = node_perf_hooks.performance.mark ? node_perf_hooks.performance.mark.bind(node_perf_hooks.performance) : /** @type {any} */ (_function.nop); - -exports.mark = mark; -exports.measure = measure; -exports.now = now; -//# sourceMappingURL=performance.node.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/performance.node.cjs.map b/yjs-poll/node_modules/lib0/dist/performance.node.cjs.map deleted file mode 100644 index 75c0c33..0000000 --- a/yjs-poll/node_modules/lib0/dist/performance.node.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"performance.node.cjs","sources":["../performance.node.js"],"sourcesContent":["import { performance } from 'node:perf_hooks'\nimport { nop } from './function.js'\nimport * as time from './time.js'\n\n/**\n * @type {typeof performance.measure}\n */\n/* c8 ignore next */\nexport const measure = performance.measure ? performance.measure.bind(performance) : /** @type {any} */ (nop)\n\n/**\n * @type {typeof performance.now}\n */\n/* c8 ignore next */\nexport const now = performance.now ? performance.now.bind(performance) : time.getUnixTime\n\n/**\n * @type {typeof performance.mark}\n */\n/* c8 ignore next */\nexport const mark = performance.mark ? performance.mark.bind(performance) : /** @type {any} */ (nop)\n"],"names":["performance","nop","time.getUnixTime"],"mappings":";;;;;;;;;;;;;;AAIA;AACA;AACA;AACA;AACY,MAAC,OAAO,GAAGA,2BAAW,CAAC,OAAO,GAAGA,2BAAW,CAAC,OAAO,CAAC,IAAI,CAACA,2BAAW,CAAC,uBAAuBC,aAAG,EAAC;AAC7G;AACA;AACA;AACA;AACA;AACY,MAAC,GAAG,GAAGD,2BAAW,CAAC,GAAG,GAAGA,2BAAW,CAAC,GAAG,CAAC,IAAI,CAACA,2BAAW,CAAC,GAAGE,iBAAgB;AACzF;AACA;AACA;AACA;AACA;AACY,MAAC,IAAI,GAAGF,2BAAW,CAAC,IAAI,GAAGA,2BAAW,CAAC,IAAI,CAAC,IAAI,CAACA,2BAAW,CAAC,uBAAuBC,aAAG;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/performance.node.d.ts b/yjs-poll/node_modules/lib0/dist/performance.node.d.ts deleted file mode 100644 index 4458270..0000000 --- a/yjs-poll/node_modules/lib0/dist/performance.node.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @type {typeof performance.measure} - */ -export const measure: typeof performance.measure; -/** - * @type {typeof performance.now} - */ -export const now: typeof performance.now; -/** - * @type {typeof performance.mark} - */ -export const mark: typeof performance.mark; -import { performance } from 'node:perf_hooks'; -//# sourceMappingURL=performance.node.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/performance.node.d.ts.map b/yjs-poll/node_modules/lib0/dist/performance.node.d.ts.map deleted file mode 100644 index 93f4ecb..0000000 --- a/yjs-poll/node_modules/lib0/dist/performance.node.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"performance.node.d.ts","sourceRoot":"","sources":["../performance.node.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH,sBAHU,OAAO,WAAW,CAAC,OAAO,CAGyE;AAE7G;;GAEG;AAEH,kBAHU,OAAO,WAAW,CAAC,GAAG,CAGyD;AAEzF;;GAEG;AAEH,mBAHU,OAAO,WAAW,CAAC,IAAI,CAGmE;4BApBxE,iBAAiB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/pledge.cjs b/yjs-poll/node_modules/lib0/dist/pledge.cjs deleted file mode 100644 index ee637e0..0000000 --- a/yjs-poll/node_modules/lib0/dist/pledge.cjs +++ /dev/null @@ -1,308 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var queue = require('./queue.cjs'); -var object = require('./object-c0c9435b.cjs'); -require('./equality.cjs'); - -/** - * @experimental Use of this module is not encouraged! - * This is just an experiment. - * @todo remove `c8 ignore` line once this is moved to "non-experimental" - */ - -/* c8 ignore start */ - -/** - * @type {queue.Queuevoid>>} - */ -const ctxFs = queue.create(); - -/** - * @param {() => void} f - */ -const runInGlobalContext = f => { - const isEmpty = queue.isEmpty(ctxFs); - queue.enqueue(ctxFs, new queue.QueueValue(f)); - if (isEmpty) { - while (!queue.isEmpty(ctxFs)) { - /** @type {queue.QueueValue<()=>{}>} */ (ctxFs.start).v(); - queue.dequeue(ctxFs); - } - } -}; - -/** - * @template V - * @typedef {V | PledgeInstance} Pledge - */ - -/** - * @template {any} Val - * @template {any} [CancelReason=Error] - */ -class PledgeInstance { - constructor () { - /** - * @type {Val | CancelReason | null} - */ - this._v = null; - this.isResolved = false; - /** - * @type {Array | null} - */ - this._whenResolved = []; - /** - * @type {Array | null} - */ - this._whenCanceled = []; - } - - get isDone () { - return this._whenResolved === null - } - - get isCanceled () { - return !this.isResolved && this._whenResolved === null - } - - /** - * @param {Val} v - */ - resolve (v) { - const whenResolved = this._whenResolved; - if (whenResolved === null) return - this._v = v; - this.isResolved = true; - this._whenResolved = null; - this._whenCanceled = null; - for (let i = 0; i < whenResolved.length; i++) { - whenResolved[i](v); - } - } - - /** - * @param {CancelReason} reason - */ - cancel (reason) { - const whenCanceled = this._whenCanceled; - if (whenCanceled === null) return - this._v = reason; - this._whenResolved = null; - this._whenCanceled = null; - for (let i = 0; i < whenCanceled.length; i++) { - whenCanceled[i](reason); - } - } - - /** - * @template R - * @param {function(Val):Pledge} f - * @return {PledgeInstance} - */ - map (f) { - /** - * @type {PledgeInstance} - */ - const p = new PledgeInstance(); - this.whenResolved(v => { - const result = f(v); - if (result instanceof PledgeInstance) { - if (result._whenResolved === null) { - result.resolve(/** @type {R} */ (result._v)); - } else { - result._whenResolved.push(p.resolve.bind(p)); - } - } else { - p.resolve(result); - } - }); - return p - } - - /** - * @param {function(Val):void} f - */ - whenResolved (f) { - if (this.isResolved) { - f(/** @type {Val} */ (this._v)); - } else { - this._whenResolved?.push(f); - } - } - - /** - * @param {(reason: CancelReason) => void} f - */ - whenCanceled (f) { - if (this.isCanceled) { - f(/** @type {CancelReason} */ (this._v)); - } else { - this._whenCanceled?.push(f); - } - } - - /** - * @return {Promise} - */ - promise () { - return new Promise((resolve, reject) => { - this.whenResolved(resolve); - this.whenCanceled(reject); - }) - } -} - -/** - * @template T - * @return {PledgeInstance} - */ -const create = () => new PledgeInstance(); - -/** - * @typedef {Array> | Object>} PledgeMap - */ - -/** - * @template {Pledge | PledgeMap} P - * @typedef {P extends PledgeMap ? { [K in keyof P]: P[K] extends Pledge ? V : P[K]} : (P extends Pledge ? V : never)} Resolved

- */ - -/** - * @todo Create a "resolveHelper" that will simplify creating indxeddbv2 functions. Double arguments - * are not necessary. - * - * @template V - * @template {Array>} DEPS - * @param {(p: PledgeInstance, ...deps: Resolved) => void} init - * @param {DEPS} deps - * @return {PledgeInstance} - */ -const createWithDependencies = (init, ...deps) => { - /** - * @type {PledgeInstance} - */ - const p = new PledgeInstance(); - // @ts-ignore @todo remove this - all(deps).whenResolved(ds => init(p, ...ds)); - return p -}; - -/** - * @template R - * @param {Pledge} p - * @param {function(R):void} f - */ -const whenResolved = (p, f) => { - if (p instanceof PledgeInstance) { - return p.whenResolved(f) - } - return f(p) -}; - -/** - * @template {Pledge} P - * @param {P} p - * @param {P extends PledgeInstance ? function(CancelReason):void : function(any):void} f - */ -const whenCanceled = (p, f) => { - if (p instanceof PledgeInstance) { - p.whenCanceled(f); - } -}; - -/** - * @template P - * @template Q - * @param {Pledge

} p - * @param {(r: P) => Q} f - * @return {Pledge} - */ -const map = (p, f) => { - if (p instanceof PledgeInstance) { - return p.map(f) - } - return f(p) -}; - -/** - * @template {PledgeMap} PS - * @param {PS} ps - * @return {PledgeInstance>} - */ -const all = ps => { - /** - * @type {any} - */ - const pall = create(); - /** - * @type {any} - */ - const result = ps instanceof Array ? new Array(ps.length) : {}; - let waitingPs = ps instanceof Array ? ps.length : object.size(ps); - for (const key in ps) { - const p = ps[key]; - whenResolved(p, r => { - result[key] = r; - if (--waitingPs === 0) { - // @ts-ignore - pall.resolve(result); - } - }); - } - return pall -}; - -/** - * @template Result - * @template {any} YieldResults - * @param {() => Generator | PledgeInstance, Result, any>} f - * @return {PledgeInstance} - */ -const coroutine = f => { - const p = create(); - const gen = f(); - /** - * @param {any} [yv] - */ - const handleGen = (yv) => { - const res = gen.next(yv); - if (res.done) { - p.resolve(res.value); - return - } - // @ts-ignore - whenCanceled(res.value, (reason) => { - gen.throw(reason); - }); - runInGlobalContext(() => - whenResolved(res.value, handleGen) - ); - }; - handleGen(); - return p -}; - -/** - * @param {number} timeout - * @return {PledgeInstance} - */ -const wait = timeout => { - const p = create(); - setTimeout(p.resolve.bind(p), timeout); - return p -}; - -/* c8 ignore end */ - -exports.PledgeInstance = PledgeInstance; -exports.all = all; -exports.coroutine = coroutine; -exports.create = create; -exports.createWithDependencies = createWithDependencies; -exports.map = map; -exports.wait = wait; -exports.whenCanceled = whenCanceled; -exports.whenResolved = whenResolved; -//# sourceMappingURL=pledge.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/pledge.cjs.map b/yjs-poll/node_modules/lib0/dist/pledge.cjs.map deleted file mode 100644 index aa7dd1c..0000000 --- a/yjs-poll/node_modules/lib0/dist/pledge.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pledge.cjs","sources":["../pledge.js"],"sourcesContent":["/**\n * @experimental Use of this module is not encouraged!\n * This is just an experiment.\n * @todo remove `c8 ignore` line once this is moved to \"non-experimental\"\n */\n\nimport * as queue from './queue.js'\nimport * as object from './object.js'\n\n/* c8 ignore start */\n\n/**\n * @type {queue.Queuevoid>>}\n */\nconst ctxFs = queue.create()\n\n/**\n * @param {() => void} f\n */\nconst runInGlobalContext = f => {\n const isEmpty = queue.isEmpty(ctxFs)\n queue.enqueue(ctxFs, new queue.QueueValue(f))\n if (isEmpty) {\n while (!queue.isEmpty(ctxFs)) {\n /** @type {queue.QueueValue<()=>{}>} */ (ctxFs.start).v()\n queue.dequeue(ctxFs)\n }\n }\n}\n\n/**\n * @template V\n * @typedef {V | PledgeInstance} Pledge\n */\n\n/**\n * @template {any} Val\n * @template {any} [CancelReason=Error]\n */\nexport class PledgeInstance {\n constructor () {\n /**\n * @type {Val | CancelReason | null}\n */\n this._v = null\n this.isResolved = false\n /**\n * @type {Array | null}\n */\n this._whenResolved = []\n /**\n * @type {Array | null}\n */\n this._whenCanceled = []\n }\n\n get isDone () {\n return this._whenResolved === null\n }\n\n get isCanceled () {\n return !this.isResolved && this._whenResolved === null\n }\n\n /**\n * @param {Val} v\n */\n resolve (v) {\n const whenResolved = this._whenResolved\n if (whenResolved === null) return\n this._v = v\n this.isResolved = true\n this._whenResolved = null\n this._whenCanceled = null\n for (let i = 0; i < whenResolved.length; i++) {\n whenResolved[i](v)\n }\n }\n\n /**\n * @param {CancelReason} reason\n */\n cancel (reason) {\n const whenCanceled = this._whenCanceled\n if (whenCanceled === null) return\n this._v = reason\n this._whenResolved = null\n this._whenCanceled = null\n for (let i = 0; i < whenCanceled.length; i++) {\n whenCanceled[i](reason)\n }\n }\n\n /**\n * @template R\n * @param {function(Val):Pledge} f\n * @return {PledgeInstance}\n */\n map (f) {\n /**\n * @type {PledgeInstance}\n */\n const p = new PledgeInstance()\n this.whenResolved(v => {\n const result = f(v)\n if (result instanceof PledgeInstance) {\n if (result._whenResolved === null) {\n result.resolve(/** @type {R} */ (result._v))\n } else {\n result._whenResolved.push(p.resolve.bind(p))\n }\n } else {\n p.resolve(result)\n }\n })\n return p\n }\n\n /**\n * @param {function(Val):void} f\n */\n whenResolved (f) {\n if (this.isResolved) {\n f(/** @type {Val} */ (this._v))\n } else {\n this._whenResolved?.push(f)\n }\n }\n\n /**\n * @param {(reason: CancelReason) => void} f\n */\n whenCanceled (f) {\n if (this.isCanceled) {\n f(/** @type {CancelReason} */ (this._v))\n } else {\n this._whenCanceled?.push(f)\n }\n }\n\n /**\n * @return {Promise}\n */\n promise () {\n return new Promise((resolve, reject) => {\n this.whenResolved(resolve)\n this.whenCanceled(reject)\n })\n }\n}\n\n/**\n * @template T\n * @return {PledgeInstance}\n */\nexport const create = () => new PledgeInstance()\n\n/**\n * @typedef {Array> | Object>} PledgeMap\n */\n\n/**\n * @template {Pledge | PledgeMap} P\n * @typedef {P extends PledgeMap ? { [K in keyof P]: P[K] extends Pledge ? V : P[K]} : (P extends Pledge ? V : never)} Resolved

\n */\n\n/**\n * @todo Create a \"resolveHelper\" that will simplify creating indxeddbv2 functions. Double arguments\n * are not necessary.\n *\n * @template V\n * @template {Array>} DEPS\n * @param {(p: PledgeInstance, ...deps: Resolved) => void} init\n * @param {DEPS} deps\n * @return {PledgeInstance}\n */\nexport const createWithDependencies = (init, ...deps) => {\n /**\n * @type {PledgeInstance}\n */\n const p = new PledgeInstance()\n // @ts-ignore @todo remove this\n all(deps).whenResolved(ds => init(p, ...ds))\n return p\n}\n\n/**\n * @template R\n * @param {Pledge} p\n * @param {function(R):void} f\n */\nexport const whenResolved = (p, f) => {\n if (p instanceof PledgeInstance) {\n return p.whenResolved(f)\n }\n return f(p)\n}\n\n/**\n * @template {Pledge} P\n * @param {P} p\n * @param {P extends PledgeInstance ? function(CancelReason):void : function(any):void} f\n */\nexport const whenCanceled = (p, f) => {\n if (p instanceof PledgeInstance) {\n p.whenCanceled(f)\n }\n}\n\n/**\n * @template P\n * @template Q\n * @param {Pledge

} p\n * @param {(r: P) => Q} f\n * @return {Pledge}\n */\nexport const map = (p, f) => {\n if (p instanceof PledgeInstance) {\n return p.map(f)\n }\n return f(p)\n}\n\n/**\n * @template {PledgeMap} PS\n * @param {PS} ps\n * @return {PledgeInstance>}\n */\nexport const all = ps => {\n /**\n * @type {any}\n */\n const pall = create()\n /**\n * @type {any}\n */\n const result = ps instanceof Array ? new Array(ps.length) : {}\n let waitingPs = ps instanceof Array ? ps.length : object.size(ps)\n for (const key in ps) {\n const p = ps[key]\n whenResolved(p, r => {\n result[key] = r\n if (--waitingPs === 0) {\n // @ts-ignore\n pall.resolve(result)\n }\n })\n }\n return pall\n}\n\n/**\n * @template Result\n * @template {any} YieldResults\n * @param {() => Generator | PledgeInstance, Result, any>} f\n * @return {PledgeInstance}\n */\nexport const coroutine = f => {\n const p = create()\n const gen = f()\n /**\n * @param {any} [yv]\n */\n const handleGen = (yv) => {\n const res = gen.next(yv)\n if (res.done) {\n p.resolve(res.value)\n return\n }\n // @ts-ignore\n whenCanceled(res.value, (reason) => {\n gen.throw(reason)\n })\n runInGlobalContext(() =>\n whenResolved(res.value, handleGen)\n )\n }\n handleGen()\n return p\n}\n\n/**\n * @param {number} timeout\n * @return {PledgeInstance}\n */\nexport const wait = timeout => {\n const p = create()\n setTimeout(p.resolve.bind(p), timeout)\n return p\n}\n\n/* c8 ignore end */\n"],"names":["queue.create","queue.isEmpty","queue.enqueue","queue.QueueValue","queue.dequeue","object.size"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,KAAK,GAAGA,YAAY,GAAE;AAC5B;AACA;AACA;AACA;AACA,MAAM,kBAAkB,GAAG,CAAC,IAAI;AAChC,EAAE,MAAM,OAAO,GAAGC,aAAa,CAAC,KAAK,EAAC;AACtC,EAAEC,aAAa,CAAC,KAAK,EAAE,IAAIC,gBAAgB,CAAC,CAAC,CAAC,EAAC;AAC/C,EAAE,IAAI,OAAO,EAAE;AACf,IAAI,OAAO,CAACF,aAAa,CAAC,KAAK,CAAC,EAAE;AAClC,8CAA8C,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,GAAE;AAC/D,MAAMG,aAAa,CAAC,KAAK,EAAC;AAC1B,KAAK;AACL,GAAG;AACH,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,cAAc,CAAC;AAC5B,EAAE,WAAW,CAAC,GAAG;AACjB;AACA;AACA;AACA,IAAI,IAAI,CAAC,EAAE,GAAG,KAAI;AAClB,IAAI,IAAI,CAAC,UAAU,GAAG,MAAK;AAC3B;AACA;AACA;AACA,IAAI,IAAI,CAAC,aAAa,GAAG,GAAE;AAC3B;AACA;AACA;AACA,IAAI,IAAI,CAAC,aAAa,GAAG,GAAE;A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AAY,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,MAAM,KAAK;AACxC,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,EAAC;AACvB,KAAK,EAAC;AACN,IAAI,kBAAkB,CAAC;AACvB,MAAM,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC;AACxC,MAAK;AACL,IAAG;AACH,EAAE,SAAS,GAAE;AACb,EAAE,OAAO,CAAC;AACV,EAAC;AACD;AACA;AACA;AACA;AACA;AACY,MAAC,IAAI,GAAG,OAAO,IAAI;AAC/B,EAAE,MAAM,CAAC,GAAG,MAAM,GAAE;AACpB,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAC;AACxC,EAAE,OAAO,CAAC;AACV,EAAC;AACD;AACA;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/pledge.d.ts b/yjs-poll/node_modules/lib0/dist/pledge.d.ts deleted file mode 100644 index c8dcfb7..0000000 --- a/yjs-poll/node_modules/lib0/dist/pledge.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * @template V - * @typedef {V | PledgeInstance} Pledge - */ -/** - * @template {any} Val - * @template {any} [CancelReason=Error] - */ -export class PledgeInstance { - /** - * @type {Val | CancelReason | null} - */ - _v: Val | CancelReason | null; - isResolved: boolean; - /** - * @type {Array | null} - */ - _whenResolved: Array<(arg0: Val) => void> | null; - /** - * @type {Array | null} - */ - _whenCanceled: Array<(arg0: CancelReason) => void> | null; - get isDone(): boolean; - get isCanceled(): boolean; - /** - * @param {Val} v - */ - resolve(v: Val): void; - /** - * @param {CancelReason} reason - */ - cancel(reason: CancelReason): void; - /** - * @template R - * @param {function(Val):Pledge} f - * @return {PledgeInstance} - */ - map(f: (arg0: Val) => Pledge): PledgeInstance; - /** - * @param {function(Val):void} f - */ - whenResolved(f: (arg0: Val) => void): void; - /** - * @param {(reason: CancelReason) => void} f - */ - whenCanceled(f: (reason: CancelReason) => void): void; - /** - * @return {Promise} - */ - promise(): Promise; -} -export function create(): PledgeInstance; -export function createWithDependencies>>(init: (p: PledgeInstance, ...deps: Resolved) => void, ...deps: DEPS): PledgeInstance; -export function whenResolved(p: Pledge, f: (arg0: R) => void): void; -export function whenCanceled

>(p: P, f: P extends PledgeInstance ? (arg0: CancelReason) => void : (arg0: any) => void): void; -export function map(p: Pledge

, f: (r: P) => Q): Pledge; -export function all(ps: PS): PledgeInstance>; -export function coroutine(f: () => Generator | PledgeInstance, Result, any>): PledgeInstance; -export function wait(timeout: number): PledgeInstance; -export type Pledge = V | PledgeInstance; -export type PledgeMap = Array> | { - [x: string]: Pledge; -}; -/** - *

- */ -export type Resolved

| PledgeMap> = P extends PledgeMap ? { [K in keyof P]: P[K] extends Pledge ? V : P[K]; } : (P extends Pledge ? V : never); -//# sourceMappingURL=pledge.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/pledge.d.ts.map b/yjs-poll/node_modules/lib0/dist/pledge.d.ts.map deleted file mode 100644 index 6d9c85c..0000000 --- a/yjs-poll/node_modules/lib0/dist/pledge.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pledge.d.ts","sourceRoot":"","sources":["../pledge.js"],"names":[],"mappings":"AA8BA;;;GAGG;AAEH;;;GAGG;AACH,4BAHmB,GAAG,kBACF,YAAY;IAI5B;;OAEG;IACH,IAFU,GAAG,GAAG,YAAY,GAAG,IAAI,CAErB;IACd,oBAAuB;IACvB;;OAEG;IACH,eAFU,KAAK,CAAC,CAAS,IAAG,EAAH,GAAG,KAAE,IAAI,CAAC,GAAG,IAAI,CAEnB;IACvB;;OAEG;IACH,eAFU,KAAK,CAAC,CAAS,IAAY,EAAZ,YAAY,KAAE,IAAI,CAAC,GAAG,IAAI,CAE5B;IAGzB,sBAEC;IAED,0BAEC;IAED;;OAEG;IACH,WAFW,GAAG,QAYb;IAED;;OAEG;IACH,eAFW,YAAY,QAW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C,YAAY,CAAC,GAAG,cAAc,CAAC,YAAY,EAAC,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,GACpF,cAAc,CAAC,MAAM,CAAC,CAwBjC;AAMM,8BAHI,MAAM,GACL,cAAc,CAAC,SAAS,CAAC,CAMpC;mBAlQY,CAAC,IACD,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC;wBA8HrB,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG;QAAO,MAAM,GAAC,MAAM,CAAC,OAAO,CAAC;CAAC;;;;qBAIzB,CAAC,SAA9B,MAAM,CAAC,OAAO,CAAC,GAAG,SAAU,IAC7B,CAAC,SAAS,SAAS,GAAG,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAC,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/pledge.test.d.ts b/yjs-poll/node_modules/lib0/dist/pledge.test.d.ts deleted file mode 100644 index 0398e18..0000000 --- a/yjs-poll/node_modules/lib0/dist/pledge.test.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export function testPledgeCoroutine(_tc: t.TestCase): Promise; -export function testPledgeVsPromisePerformanceTimeout(_tc: t.TestCase): Promise; -export function testPledgeVsPromisePerformanceResolved(_tc: t.TestCase): Promise; -export type MaybePromise = Promise | number; -import * as t from './testing.js'; -//# sourceMappingURL=pledge.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/pledge.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/pledge.test.d.ts.map deleted file mode 100644 index a319a0d..0000000 --- a/yjs-poll/node_modules/lib0/dist/pledge.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pledge.test.d.ts","sourceRoot":"","sources":["../pledge.test.js"],"names":[],"mappings":"AAOO,yCAFI,CAAC,CAAC,QAAQ,iBAepB;AAKM,2DAFI,CAAC,CAAC,QAAQ,iBAiBpB;AASM,4DAFI,CAAC,CAAC,QAAQ,iBAqCpB;2BAzCY,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM;mBA3ClB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/prng-37d48618.cjs b/yjs-poll/node_modules/lib0/dist/prng-37d48618.cjs deleted file mode 100644 index 021d210..0000000 --- a/yjs-poll/node_modules/lib0/dist/prng-37d48618.cjs +++ /dev/null @@ -1,387 +0,0 @@ -'use strict'; - -var binary = require('./binary-ac8e39e2.cjs'); -var string = require('./string-fddc5f8b.cjs'); -var math = require('./math-96d5e8c4.cjs'); -var buffer = require('./buffer-3e750729.cjs'); - -/** - * @module prng - */ - -/** - * Xorshift32 is a very simple but elegang PRNG with a period of `2^32-1`. - */ -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) - } -} - -/** - * @module prng - */ - -/** - * 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) - */ -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 -#include - -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; -} -*/ - -/** - * Fast Pseudo Random Number Generators. - * - * Given a seed a PRNG generates a sequence of numbers that cannot be reasonably predicted. - * Two PRNGs must generate the same random sequence of numbers if given the same seed. - * - * @module prng - */ - -/** - * Description of the function - * @callback generatorNext - * @return {number} A random float in the cange of [0,1) - */ - -/** - * A random type generator. - * - * @typedef {Object} PRNG - * @property {generatorNext} next Generate new number - */ -const DefaultPRNG = Xoroshiro128plus; - -/** - * Create a Xoroshiro128plus Pseudo-Random-Number-Generator. - * This is the fastest full-period generator passing BigCrush without systematic failures. - * But there are more PRNGs available in ./PRNG/. - * - * @param {number} seed A positive 32bit integer. Do not use negative numbers. - * @return {PRNG} - */ -const create = seed => new DefaultPRNG(seed); - -/** - * Generates a single random bool. - * - * @param {PRNG} gen A random number generator. - * @return {Boolean} A random boolean - */ -const bool = gen => (gen.next() >= 0.5); - -/** - * Generates a random integer with 53 bit resolution. - * - * @param {PRNG} gen A random number generator. - * @param {Number} min The lower bound of the allowed return values (inclusive). - * @param {Number} max The upper bound of the allowed return values (inclusive). - * @return {Number} A random integer on [min, max] - */ -const int53 = (gen, min, max) => math.floor(gen.next() * (max + 1 - min) + min); - -/** - * Generates a random integer with 53 bit resolution. - * - * @param {PRNG} gen A random number generator. - * @param {Number} min The lower bound of the allowed return values (inclusive). - * @param {Number} max The upper bound of the allowed return values (inclusive). - * @return {Number} A random integer on [min, max] - */ -const uint53 = (gen, min, max) => math.abs(int53(gen, min, max)); - -/** - * Generates a random integer with 32 bit resolution. - * - * @param {PRNG} gen A random number generator. - * @param {Number} min The lower bound of the allowed return values (inclusive). - * @param {Number} max The upper bound of the allowed return values (inclusive). - * @return {Number} A random integer on [min, max] - */ -const int32 = (gen, min, max) => math.floor(gen.next() * (max + 1 - min) + min); - -/** - * Generates a random integer with 53 bit resolution. - * - * @param {PRNG} gen A random number generator. - * @param {Number} min The lower bound of the allowed return values (inclusive). - * @param {Number} max The upper bound of the allowed return values (inclusive). - * @return {Number} A random integer on [min, max] - */ -const uint32 = (gen, min, max) => int32(gen, min, max) >>> 0; - -/** - * @deprecated - * Optimized version of prng.int32. It has the same precision as prng.int32, but should be preferred when - * openaring on smaller ranges. - * - * @param {PRNG} gen A random number generator. - * @param {Number} min The lower bound of the allowed return values (inclusive). - * @param {Number} max The upper bound of the allowed return values (inclusive). The max inclusive number is `binary.BITS31-1` - * @return {Number} A random integer on [min, max] - */ -const int31 = (gen, min, max) => int32(gen, min, max); - -/** - * Generates a random real on [0, 1) with 53 bit resolution. - * - * @param {PRNG} gen A random number generator. - * @return {Number} A random real number on [0, 1). - */ -const real53 = gen => gen.next(); // (((gen.next() >>> 5) * binary.BIT26) + (gen.next() >>> 6)) / MAX_SAFE_INTEGER - -/** - * Generates a random character from char code 32 - 126. I.e. Characters, Numbers, special characters, and Space: - * - * @param {PRNG} gen A random number generator. - * @return {string} - * - * (Space)!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[/]^_`abcdefghijklmnopqrstuvwxyz{|}~ - */ -const char = gen => string.fromCharCode(int31(gen, 32, 126)); - -/** - * @param {PRNG} gen - * @return {string} A single letter (a-z) - */ -const letter = gen => string.fromCharCode(int31(gen, 97, 122)); - -/** - * @param {PRNG} gen - * @param {number} [minLen=0] - * @param {number} [maxLen=20] - * @return {string} A random word (0-20 characters) without spaces consisting of letters (a-z) - */ -const word = (gen, minLen = 0, maxLen = 20) => { - const len = int31(gen, minLen, maxLen); - let str = ''; - for (let i = 0; i < len; i++) { - str += letter(gen); - } - return str -}; - -/** - * TODO: this function produces invalid runes. Does not cover all of utf16!! - * - * @param {PRNG} gen - * @return {string} - */ -const utf16Rune = gen => { - const codepoint = int31(gen, 0, 256); - return string.fromCodePoint(codepoint) -}; - -/** - * @param {PRNG} gen - * @param {number} [maxlen = 20] - */ -const utf16String = (gen, maxlen = 20) => { - const len = int31(gen, 0, maxlen); - let str = ''; - for (let i = 0; i < len; i++) { - str += utf16Rune(gen); - } - return str -}; - -/** - * Returns one element of a given array. - * - * @param {PRNG} gen A random number generator. - * @param {Array} array Non empty Array of possible values. - * @return {T} One of the values of the supplied Array. - * @template T - */ -const oneOf = (gen, array) => array[int31(gen, 0, array.length - 1)]; - -/** - * @param {PRNG} gen - * @param {number} len - * @return {Uint8Array} - */ -const uint8Array = (gen, len) => { - const buf = buffer.createUint8ArrayFromLen(len); - for (let i = 0; i < buf.length; i++) { - buf[i] = int32(gen, 0, binary.BITS8); - } - return buf -}; - -/* c8 ignore start */ -/** - * @param {PRNG} gen - * @param {number} len - * @return {Uint16Array} - */ -const uint16Array = (gen, len) => new Uint16Array(uint8Array(gen, len * 2).buffer); - -/** - * @param {PRNG} gen - * @param {number} len - * @return {Uint32Array} - */ -const uint32Array = (gen, len) => new Uint32Array(uint8Array(gen, len * 4).buffer); -/* c8 ignore stop */ - -var prng = /*#__PURE__*/Object.freeze({ - __proto__: null, - DefaultPRNG: DefaultPRNG, - create: create, - bool: bool, - int53: int53, - uint53: uint53, - int32: int32, - uint32: uint32, - int31: int31, - real53: real53, - char: char, - letter: letter, - word: word, - utf16Rune: utf16Rune, - utf16String: utf16String, - oneOf: oneOf, - uint8Array: uint8Array, - uint16Array: uint16Array, - uint32Array: uint32Array -}); - -exports.DefaultPRNG = DefaultPRNG; -exports.bool = bool; -exports.char = char; -exports.create = create; -exports.int31 = int31; -exports.int32 = int32; -exports.int53 = int53; -exports.letter = letter; -exports.oneOf = oneOf; -exports.prng = prng; -exports.real53 = real53; -exports.uint16Array = uint16Array; -exports.uint32 = uint32; -exports.uint32Array = uint32Array; -exports.uint53 = uint53; -exports.uint8Array = uint8Array; -exports.utf16Rune = utf16Rune; -exports.utf16String = utf16String; -exports.word = word; -//# sourceMappingURL=prng-37d48618.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/prng-37d48618.cjs.map b/yjs-poll/node_modules/lib0/dist/prng-37d48618.cjs.map deleted file mode 100644 index 48c3b12..0000000 --- a/yjs-poll/node_modules/lib0/dist/prng-37d48618.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"prng-37d48618.cjs","sources":["../prng/Xorshift32.js","../prng/Xoroshiro128plus.js","../prng.js"],"sourcesContent":["/**\n * @module prng\n */\n\nimport * as binary from '../binary.js'\n\n/**\n * Xorshift32 is a very simple but elegang PRNG with a period of `2^32-1`.\n */\nexport class Xorshift32 {\n /**\n * @param {number} seed Unsigned 32 bit number\n */\n constructor (seed) {\n this.seed = seed\n /**\n * @type {number}\n */\n this._state = seed\n }\n\n /**\n * Generate a random signed integer.\n *\n * @return {Number} A 32 bit signed integer.\n */\n next () {\n let x = this._state\n x ^= x << 13\n x ^= x >> 17\n x ^= x << 5\n this._state = x\n return (x >>> 0) / (binary.BITS32 + 1)\n }\n}\n","/**\n * @module prng\n */\n\nimport { Xorshift32 } from './Xorshift32.js'\nimport * as binary from '../binary.js'\n\n/**\n * This is a variant of xoroshiro128plus - the fastest full-period generator passing BigCrush without systematic failures.\n *\n * This implementation follows the idea of the original xoroshiro128plus implementation,\n * but is optimized for the JavaScript runtime. I.e.\n * * The operations are performed on 32bit integers (the original implementation works with 64bit values).\n * * The initial 128bit state is computed based on a 32bit seed and Xorshift32.\n * * This implementation returns two 32bit values based on the 64bit value that is computed by xoroshiro128plus.\n * Caution: The last addition step works slightly different than in the original implementation - the add carry of the\n * first 32bit addition is not carried over to the last 32bit.\n *\n * [Reference implementation](http://vigna.di.unimi.it/xorshift/xoroshiro128plus.c)\n */\nexport class Xoroshiro128plus {\n /**\n * @param {number} seed Unsigned 32 bit number\n */\n constructor (seed) {\n this.seed = seed\n // This is a variant of Xoroshiro128plus to fill the initial state\n const xorshift32 = new Xorshift32(seed)\n this.state = new Uint32Array(4)\n for (let i = 0; i < 4; i++) {\n this.state[i] = xorshift32.next() * binary.BITS32\n }\n this._fresh = true\n }\n\n /**\n * @return {number} Float/Double in [0,1)\n */\n next () {\n const state = this.state\n if (this._fresh) {\n this._fresh = false\n return ((state[0] + state[2]) >>> 0) / (binary.BITS32 + 1)\n } else {\n this._fresh = true\n const s0 = state[0]\n const s1 = state[1]\n const s2 = state[2] ^ s0\n const s3 = state[3] ^ s1\n // function js_rotl (x, k) {\n // k = k - 32\n // const x1 = x[0]\n // const x2 = x[1]\n // x[0] = x2 << k | x1 >>> (32 - k)\n // x[1] = x1 << k | x2 >>> (32 - k)\n // }\n // rotl(s0, 55) // k = 23 = 55 - 32; j = 9 = 32 - 23\n state[0] = (s1 << 23 | s0 >>> 9) ^ s2 ^ (s2 << 14 | s3 >>> 18)\n state[1] = (s0 << 23 | s1 >>> 9) ^ s3 ^ (s3 << 14)\n // rol(s1, 36) // k = 4 = 36 - 32; j = 23 = 32 - 9\n state[2] = s3 << 4 | s2 >>> 28\n state[3] = s2 << 4 | s3 >>> 28\n return (((state[1] + state[3]) >>> 0) / (binary.BITS32 + 1))\n }\n }\n}\n\n/*\n// Reference implementation\n// Source: http://vigna.di.unimi.it/xorshift/xoroshiro128plus.c\n// By David Blackman and Sebastiano Vigna\n// Who published the reference implementation under Public Domain (CC0)\n\n#include \n#include \n\nuint64_t s[2];\n\nstatic inline uint64_t rotl(const uint64_t x, int k) {\n return (x << k) | (x >> (64 - k));\n}\n\nuint64_t next(void) {\n const uint64_t s0 = s[0];\n uint64_t s1 = s[1];\n s1 ^= s0;\n s[0] = rotl(s0, 55) ^ s1 ^ (s1 << 14); // a, b\n s[1] = rotl(s1, 36); // c\n return (s[0] + s[1]) & 0xFFFFFFFF;\n}\n\nint main(void)\n{\n int i;\n s[0] = 1111 | (1337ul << 32);\n s[1] = 1234 | (9999ul << 32);\n\n printf(\"1000 outputs of genrand_int31()\\n\");\n for (i=0; i<100; i++) {\n printf(\"%10lu \", i);\n printf(\"%10lu \", next());\n printf(\"- %10lu \", s[0] >> 32);\n printf(\"%10lu \", (s[0] << 32) >> 32);\n printf(\"%10lu \", s[1] >> 32);\n printf(\"%10lu \", (s[1] << 32) >> 32);\n printf(\"\\n\");\n // if (i%5==4) printf(\"\\n\");\n }\n return 0;\n}\n*/\n","/**\n * Fast Pseudo Random Number Generators.\n *\n * Given a seed a PRNG generates a sequence of numbers that cannot be reasonably predicted.\n * Two PRNGs must generate the same random sequence of numbers if given the same seed.\n *\n * @module prng\n */\n\nimport * as binary from './binary.js'\nimport { fromCharCode, fromCodePoint } from './string.js'\nimport * as math from './math.js'\nimport { Xoroshiro128plus } from './prng/Xoroshiro128plus.js'\nimport * as buffer from './buffer.js'\n\n/**\n * Description of the function\n * @callback generatorNext\n * @return {number} A random float in the cange of [0,1)\n */\n\n/**\n * A random type generator.\n *\n * @typedef {Object} PRNG\n * @property {generatorNext} next Generate new number\n */\nexport const DefaultPRNG = Xoroshiro128plus\n\n/**\n * Create a Xoroshiro128plus Pseudo-Random-Number-Generator.\n * This is the fastest full-period generator passing BigCrush without systematic failures.\n * But there are more PRNGs available in ./PRNG/.\n *\n * @param {number} seed A positive 32bit integer. Do not use negative numbers.\n * @return {PRNG}\n */\nexport const create = seed => new DefaultPRNG(seed)\n\n/**\n * Generates a single random bool.\n *\n * @param {PRNG} gen A random number generator.\n * @return {Boolean} A random boolean\n */\nexport const bool = gen => (gen.next() >= 0.5)\n\n/**\n * Generates a random integer with 53 bit resolution.\n *\n * @param {PRNG} gen A random number generator.\n * @param {Number} min The lower bound of the allowed return values (inclusive).\n * @param {Number} max The upper bound of the allowed return values (inclusive).\n * @return {Number} A random integer on [min, max]\n */\nexport const int53 = (gen, min, max) => math.floor(gen.next() * (max + 1 - min) + min)\n\n/**\n * Generates a random integer with 53 bit resolution.\n *\n * @param {PRNG} gen A random number generator.\n * @param {Number} min The lower bound of the allowed return values (inclusive).\n * @param {Number} max The upper bound of the allowed return values (inclusive).\n * @return {Number} A random integer on [min, max]\n */\nexport const uint53 = (gen, min, max) => math.abs(int53(gen, min, max))\n\n/**\n * Generates a random integer with 32 bit resolution.\n *\n * @param {PRNG} gen A random number generator.\n * @param {Number} min The lower bound of the allowed return values (inclusive).\n * @param {Number} max The upper bound of the allowed return values (inclusive).\n * @return {Number} A random integer on [min, max]\n */\nexport const int32 = (gen, min, max) => math.floor(gen.next() * (max + 1 - min) + min)\n\n/**\n * Generates a random integer with 53 bit resolution.\n *\n * @param {PRNG} gen A random number generator.\n * @param {Number} min The lower bound of the allowed return values (inclusive).\n * @param {Number} max The upper bound of the allowed return values (inclusive).\n * @return {Number} A random integer on [min, max]\n */\nexport const uint32 = (gen, min, max) => int32(gen, min, max) >>> 0\n\n/**\n * @deprecated\n * Optimized version of prng.int32. It has the same precision as prng.int32, but should be preferred when\n * openaring on smaller ranges.\n *\n * @param {PRNG} gen A random number generator.\n * @param {Number} min The lower bound of the allowed return values (inclusive).\n * @param {Number} max The upper bound of the allowed return values (inclusive). The max inclusive number is `binary.BITS31-1`\n * @return {Number} A random integer on [min, max]\n */\nexport const int31 = (gen, min, max) => int32(gen, min, max)\n\n/**\n * Generates a random real on [0, 1) with 53 bit resolution.\n *\n * @param {PRNG} gen A random number generator.\n * @return {Number} A random real number on [0, 1).\n */\nexport const real53 = gen => gen.next() // (((gen.next() >>> 5) * binary.BIT26) + (gen.next() >>> 6)) / MAX_SAFE_INTEGER\n\n/**\n * Generates a random character from char code 32 - 126. I.e. Characters, Numbers, special characters, and Space:\n *\n * @param {PRNG} gen A random number generator.\n * @return {string}\n *\n * (Space)!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[/]^_`abcdefghijklmnopqrstuvwxyz{|}~\n */\nexport const char = gen => fromCharCode(int31(gen, 32, 126))\n\n/**\n * @param {PRNG} gen\n * @return {string} A single letter (a-z)\n */\nexport const letter = gen => fromCharCode(int31(gen, 97, 122))\n\n/**\n * @param {PRNG} gen\n * @param {number} [minLen=0]\n * @param {number} [maxLen=20]\n * @return {string} A random word (0-20 characters) without spaces consisting of letters (a-z)\n */\nexport const word = (gen, minLen = 0, maxLen = 20) => {\n const len = int31(gen, minLen, maxLen)\n let str = ''\n for (let i = 0; i < len; i++) {\n str += letter(gen)\n }\n return str\n}\n\n/**\n * TODO: this function produces invalid runes. Does not cover all of utf16!!\n *\n * @param {PRNG} gen\n * @return {string}\n */\nexport const utf16Rune = gen => {\n const codepoint = int31(gen, 0, 256)\n return fromCodePoint(codepoint)\n}\n\n/**\n * @param {PRNG} gen\n * @param {number} [maxlen = 20]\n */\nexport const utf16String = (gen, maxlen = 20) => {\n const len = int31(gen, 0, maxlen)\n let str = ''\n for (let i = 0; i < len; i++) {\n str += utf16Rune(gen)\n }\n return str\n}\n\n/**\n * Returns one element of a given array.\n *\n * @param {PRNG} gen A random number generator.\n * @param {Array} array Non empty Array of possible values.\n * @return {T} One of the values of the supplied Array.\n * @template T\n */\nexport const oneOf = (gen, array) => array[int31(gen, 0, array.length - 1)]\n\n/**\n * @param {PRNG} gen\n * @param {number} len\n * @return {Uint8Array}\n */\nexport const uint8Array = (gen, len) => {\n const buf = buffer.createUint8ArrayFromLen(len)\n for (let i = 0; i < buf.length; i++) {\n buf[i] = int32(gen, 0, binary.BITS8)\n }\n return buf\n}\n\n/* c8 ignore start */\n/**\n * @param {PRNG} gen\n * @param {number} len\n * @return {Uint16Array}\n */\nexport const uint16Array = (gen, len) => new Uint16Array(uint8Array(gen, len * 2).buffer)\n\n/**\n * @param {PRNG} gen\n * @param {number} len\n * @return {Uint32Array}\n */\nexport const uint32Array = (gen, len) => new Uint32Array(uint8Array(gen, len * 4).buffer)\n/* c8 ignore stop */\n"],"names":["binary.BITS32","math.floor","math.abs","fromCharCode","fromCodePoint","buffer.createUint8ArrayFromLen","binary.BITS8"],"mappings":";;;;;;;AAAA;AACA;AACA;AAGA;AACA;AACA;AACA;AACO,MAAM,UAAU,CAAC;AACxB;AAC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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,WAAW,GAAG,iBAAgB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,IAAI,IAAI,IAAI,WAAW,CAAC,IAAI,EAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,IAAI,GAAG,GAAG,KAAK,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,EAAC;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,KAAK,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,KAAKC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,EAAC;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,KAAKC,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAC;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,KAAK,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,KAAKD,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,EAAC;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,KAAK,CAAC,GAAG,EAAE,GA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,CAAC,CAAC,CAAC,MAAM,EAAC;AACzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/prng.cjs b/yjs-poll/node_modules/lib0/dist/prng.cjs deleted file mode 100644 index 4f80450..0000000 --- a/yjs-poll/node_modules/lib0/dist/prng.cjs +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./binary-ac8e39e2.cjs'); -require('./string-fddc5f8b.cjs'); -require('./math-96d5e8c4.cjs'); -var prng = require('./prng-37d48618.cjs'); -require('./buffer-3e750729.cjs'); -require('./array-78849c95.cjs'); -require('./set-5b47859e.cjs'); -require('./environment-1c97264d.cjs'); -require('./map-24d263c0.cjs'); -require('./conditions-f5c0c102.cjs'); -require('./storage.cjs'); -require('./function-314580f7.cjs'); -require('./object-c0c9435b.cjs'); -require('./equality.cjs'); -require('./encoding-1a745c43.cjs'); -require('./number-1fb57bba.cjs'); -require('./decoding-76e75827.cjs'); -require('./error-0c1f634f.cjs'); - - - -exports.DefaultPRNG = prng.DefaultPRNG; -exports.bool = prng.bool; -exports.char = prng.char; -exports.create = prng.create; -exports.int31 = prng.int31; -exports.int32 = prng.int32; -exports.int53 = prng.int53; -exports.letter = prng.letter; -exports.oneOf = prng.oneOf; -exports.real53 = prng.real53; -exports.uint16Array = prng.uint16Array; -exports.uint32 = prng.uint32; -exports.uint32Array = prng.uint32Array; -exports.uint53 = prng.uint53; -exports.uint8Array = prng.uint8Array; -exports.utf16Rune = prng.utf16Rune; -exports.utf16String = prng.utf16String; -exports.word = prng.word; -//# sourceMappingURL=prng.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/prng.cjs.map b/yjs-poll/node_modules/lib0/dist/prng.cjs.map deleted file mode 100644 index 4949942..0000000 --- a/yjs-poll/node_modules/lib0/dist/prng.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"prng.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/prng.d.ts b/yjs-poll/node_modules/lib0/dist/prng.d.ts deleted file mode 100644 index 77c666d..0000000 --- a/yjs-poll/node_modules/lib0/dist/prng.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Description of the function - * @callback generatorNext - * @return {number} A random float in the cange of [0,1) - */ -/** - * A random type generator. - * - * @typedef {Object} PRNG - * @property {generatorNext} next Generate new number - */ -export const DefaultPRNG: typeof Xoroshiro128plus; -export function create(seed: number): PRNG; -export function bool(gen: PRNG): boolean; -export function int53(gen: PRNG, min: number, max: number): number; -export function uint53(gen: PRNG, min: number, max: number): number; -export function int32(gen: PRNG, min: number, max: number): number; -export function uint32(gen: PRNG, min: number, max: number): number; -export function int31(gen: PRNG, min: number, max: number): number; -export function real53(gen: PRNG): number; -export function char(gen: PRNG): string; -export function letter(gen: PRNG): string; -export function word(gen: PRNG, minLen?: number, maxLen?: number): string; -export function utf16Rune(gen: PRNG): string; -export function utf16String(gen: PRNG, maxlen?: number): string; -export function oneOf(gen: PRNG, array: Array): T; -export function uint8Array(gen: PRNG, len: number): Uint8Array; -export function uint16Array(gen: PRNG, len: number): Uint16Array; -export function uint32Array(gen: PRNG, len: number): Uint32Array; -/** - * Description of the function - */ -export type generatorNext = () => number; -/** - * A random type generator. - */ -export type PRNG = { - /** - * Generate new number - */ - next: generatorNext; -}; -import { Xoroshiro128plus } from './prng/Xoroshiro128plus.js'; -//# sourceMappingURL=prng.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/prng.d.ts.map b/yjs-poll/node_modules/lib0/dist/prng.d.ts.map deleted file mode 100644 index 5babc5d..0000000 --- a/yjs-poll/node_modules/lib0/dist/prng.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"prng.d.ts","sourceRoot":"","sources":["../prng.js"],"names":[],"mappings":"AAeA;;;;GAIG;AAEH;;;;;GAKG;AACH,kDAA2C;AAUpC,6BAHI,MAAM,GACL,IAAI,CAEmC;AAQ5C,0BAHI,IAAI,WAG+B;AAUvC,2BALI,IAAI,oCAKuE;AAU/E,4BALI,IAAI,oCAKwD;AAUhE,2BALI,IAAI,oCAKuE;AAU/E,4BALI,IAAI,oCAKoD;AAY5D,2BALI,IAAI,oCAK6C;AAQrD,4BAHI,IAAI,UAGwB;AAUhC,0BALI,IAAI,GACH,MAAM,CAI0C;AAMrD,4BAHI,IAAI,GACH,MAAM,CAE4C;AAQvD,0BALI,IAAI,WACJ,MAAM,WACN,MAAM,GACL,MAAM,CASjB;AAQM,+BAHI,IAAI,GACH,MAAM,CAKjB;AAMM,iCAHI,IAAI,WACJ,MAAM,UAShB;AAUM,sBAFM,CAAC,OAHH,IAAI,SACJ,KAAK,CAAC,CAAC,CAAC,GACP,CAAC,CAG8D;AAOpE,gCAJI,IAAI,OACJ,MAAM,GACL,UAAU,CAAC,WAAW,CAAC,CAQlC;AAQM,iCAJI,IAAI,OACJ,MAAM,GACL,WAAW,CAEkE;AAOlF,iCAJI,IAAI,OACJ,MAAM,GACL,WAAW,CAEkE;;;;kCApL5E,MAAM;;;;;;;;UAOL,aAAa;;iCAbM,4BAA4B"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/prng.test.d.ts b/yjs-poll/node_modules/lib0/dist/prng.test.d.ts deleted file mode 100644 index dd69f9a..0000000 --- a/yjs-poll/node_modules/lib0/dist/prng.test.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export function testGeneratorXoroshiro128plus(tc: t.TestCase): void; -export function testGeneratorXorshift32(tc: t.TestCase): void; -export function testGeneratorMt19937(tc: t.TestCase): void; -export function testNumberDistributions(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=prng.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/prng.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/prng.test.d.ts.map deleted file mode 100644 index ca3eaca..0000000 --- a/yjs-poll/node_modules/lib0/dist/prng.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"prng.test.d.ts","sourceRoot":"","sources":["../prng.test.js"],"names":[],"mappings":"AA4LO,kDAFI,CAAC,CAAC,QAAQ,QAE2E;AAKzF,4CAFI,CAAC,CAAC,QAAQ,QAIpB;AAKM,yCAFI,CAAC,CAAC,QAAQ,QAIpB;AA2BM,4CAFI,CAAC,CAAC,QAAQ,QAOpB;mBAtOkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/prng/Mt19937.d.ts b/yjs-poll/node_modules/lib0/dist/prng/Mt19937.d.ts deleted file mode 100644 index 8b499e0..0000000 --- a/yjs-poll/node_modules/lib0/dist/prng/Mt19937.d.ts +++ /dev/null @@ -1,29 +0,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: number); - seed: number; - _state: Uint32Array; - _i: number; - /** - * Generate a random signed integer. - * - * @return {Number} A 32 bit signed integer. - */ - next(): number; -} -//# sourceMappingURL=Mt19937.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/prng/Mt19937.d.ts.map b/yjs-poll/node_modules/lib0/dist/prng/Mt19937.d.ts.map deleted file mode 100644 index b1d307f..0000000 --- a/yjs-poll/node_modules/lib0/dist/prng/Mt19937.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Mt19937.d.ts","sourceRoot":"","sources":["../../prng/Mt19937.js"],"names":[],"mappings":"AA8BA;;;;;;;;;;;;GAYG;AACH;IACE;;OAEG;IACH,kBAFW,MAAM,EAYhB;IATC,aAAgB;IAMhB,iCAAmB;IACnB,WAAW;IAIb;;;;OAIG;IACH,eAYC;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/prng/Xoroshiro128plus.d.ts b/yjs-poll/node_modules/lib0/dist/prng/Xoroshiro128plus.d.ts deleted file mode 100644 index 5f2f9fd..0000000 --- a/yjs-poll/node_modules/lib0/dist/prng/Xoroshiro128plus.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * 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; - _fresh: boolean; - /** - * @return {number} Float/Double in [0,1) - */ - next(): number; -} -//# sourceMappingURL=Xoroshiro128plus.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/prng/Xoroshiro128plus.d.ts.map b/yjs-poll/node_modules/lib0/dist/prng/Xoroshiro128plus.d.ts.map deleted file mode 100644 index ac920da..0000000 --- a/yjs-poll/node_modules/lib0/dist/prng/Xoroshiro128plus.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Xoroshiro128plus.d.ts","sourceRoot":"","sources":["../../prng/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"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/prng/Xorshift32.d.ts b/yjs-poll/node_modules/lib0/dist/prng/Xorshift32.d.ts deleted file mode 100644 index 436b8bc..0000000 --- a/yjs-poll/node_modules/lib0/dist/prng/Xorshift32.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/prng/Xorshift32.d.ts.map b/yjs-poll/node_modules/lib0/dist/prng/Xorshift32.d.ts.map deleted file mode 100644 index 0bf8199..0000000 --- a/yjs-poll/node_modules/lib0/dist/prng/Xorshift32.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Xorshift32.d.ts","sourceRoot":"","sources":["../../prng/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"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/promise-cda7b9bb.cjs b/yjs-poll/node_modules/lib0/dist/promise-cda7b9bb.cjs deleted file mode 100644 index e23a073..0000000 --- a/yjs-poll/node_modules/lib0/dist/promise-cda7b9bb.cjs +++ /dev/null @@ -1,145 +0,0 @@ -'use strict'; - -var time = require('./time-d8438852.cjs'); - -/** - * Utility helpers to work with promises. - * - * @module promise - */ - -/** - * @template T - * @callback PromiseResolve - * @param {T|PromiseLike} [result] - */ - -/** - * @template T - * @param {function(PromiseResolve,function(Error):void):any} f - * @return {Promise} - */ -const create = f => /** @type {Promise} */ (new Promise(f)); - -/** - * @param {function(function():void,function(Error):void):void} f - * @return {Promise} - */ -const createEmpty = f => new Promise(f); - -/** - * `Promise.all` wait for all promises in the array to resolve and return the result - * @template {unknown[] | []} PS - * - * @param {PS} ps - * @return {Promise<{ -readonly [P in keyof PS]: Awaited }>} - */ -const all = Promise.all.bind(Promise); - -/** - * @param {Error} [reason] - * @return {Promise} - */ -const reject = reason => Promise.reject(reason); - -/** - * @template T - * @param {T|void} res - * @return {Promise} - */ -const resolve = res => Promise.resolve(res); - -/** - * @template T - * @param {T} res - * @return {Promise} - */ -const resolveWith = res => Promise.resolve(res); - -/** - * @todo Next version, reorder parameters: check, [timeout, [intervalResolution]] - * @deprecated use untilAsync instead - * - * @param {number} timeout - * @param {function():boolean} check - * @param {number} [intervalResolution] - * @return {Promise} - */ -const until = (timeout, check, intervalResolution = 10) => create((resolve, reject) => { - const startTime = time.getUnixTime(); - const hasTimeout = timeout > 0; - const untilInterval = () => { - if (check()) { - clearInterval(intervalHandle); - resolve(); - } else if (hasTimeout) { - /* c8 ignore else */ - if (time.getUnixTime() - startTime > timeout) { - clearInterval(intervalHandle); - reject(new Error('Timeout')); - } - } - }; - const intervalHandle = setInterval(untilInterval, intervalResolution); -}); - -/** - * @param {()=>Promise|boolean} check - * @param {number} timeout - * @param {number} intervalResolution - * @return {Promise} - */ -const untilAsync = async (check, timeout = 0, intervalResolution = 10) => { - const startTime = time.getUnixTime(); - const noTimeout = timeout <= 0; - // eslint-disable-next-line no-unmodified-loop-condition - while (noTimeout || time.getUnixTime() - startTime <= timeout) { - if (await check()) return - await wait(intervalResolution); - } - throw new Error('Timeout') -}; - -/** - * @param {number} timeout - * @return {Promise} - */ -const wait = timeout => create((resolve, _reject) => setTimeout(resolve, timeout)); - -/** - * Checks if an object is a promise using ducktyping. - * - * Promises are often polyfilled, so it makes sense to add some additional guarantees if the user of this - * library has some insane environment where global Promise objects are overwritten. - * - * @param {any} p - * @return {boolean} - */ -const isPromise = p => p instanceof Promise || (p && p.then && p.catch && p.finally); - -var promise = /*#__PURE__*/Object.freeze({ - __proto__: null, - create: create, - createEmpty: createEmpty, - all: all, - reject: reject, - resolve: resolve, - resolveWith: resolveWith, - until: until, - untilAsync: untilAsync, - wait: wait, - isPromise: isPromise -}); - -exports.all = all; -exports.create = create; -exports.createEmpty = createEmpty; -exports.isPromise = isPromise; -exports.promise = promise; -exports.reject = reject; -exports.resolve = resolve; -exports.resolveWith = resolveWith; -exports.until = until; -exports.untilAsync = untilAsync; -exports.wait = wait; -//# sourceMappingURL=promise-cda7b9bb.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/promise-cda7b9bb.cjs.map b/yjs-poll/node_modules/lib0/dist/promise-cda7b9bb.cjs.map deleted file mode 100644 index 7c00208..0000000 --- a/yjs-poll/node_modules/lib0/dist/promise-cda7b9bb.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"promise-cda7b9bb.cjs","sources":["../promise.js"],"sourcesContent":["/**\n * Utility helpers to work with promises.\n *\n * @module promise\n */\n\nimport * as time from './time.js'\n\n/**\n * @template T\n * @callback PromiseResolve\n * @param {T|PromiseLike} [result]\n */\n\n/**\n * @template T\n * @param {function(PromiseResolve,function(Error):void):any} f\n * @return {Promise}\n */\nexport const create = f => /** @type {Promise} */ (new Promise(f))\n\n/**\n * @param {function(function():void,function(Error):void):void} f\n * @return {Promise}\n */\nexport const createEmpty = f => new Promise(f)\n\n/**\n * `Promise.all` wait for all promises in the array to resolve and return the result\n * @template {unknown[] | []} PS\n *\n * @param {PS} ps\n * @return {Promise<{ -readonly [P in keyof PS]: Awaited }>}\n */\nexport const all = Promise.all.bind(Promise)\n\n/**\n * @param {Error} [reason]\n * @return {Promise}\n */\nexport const reject = reason => Promise.reject(reason)\n\n/**\n * @template T\n * @param {T|void} res\n * @return {Promise}\n */\nexport const resolve = res => Promise.resolve(res)\n\n/**\n * @template T\n * @param {T} res\n * @return {Promise}\n */\nexport const resolveWith = res => Promise.resolve(res)\n\n/**\n * @todo Next version, reorder parameters: check, [timeout, [intervalResolution]]\n * @deprecated use untilAsync instead\n *\n * @param {number} timeout\n * @param {function():boolean} check\n * @param {number} [intervalResolution]\n * @return {Promise}\n */\nexport const until = (timeout, check, intervalResolution = 10) => create((resolve, reject) => {\n const startTime = time.getUnixTime()\n const hasTimeout = timeout > 0\n const untilInterval = () => {\n if (check()) {\n clearInterval(intervalHandle)\n resolve()\n } else if (hasTimeout) {\n /* c8 ignore else */\n if (time.getUnixTime() - startTime > timeout) {\n clearInterval(intervalHandle)\n reject(new Error('Timeout'))\n }\n }\n }\n const intervalHandle = setInterval(untilInterval, intervalResolution)\n})\n\n/**\n * @param {()=>Promise|boolean} check\n * @param {number} timeout\n * @param {number} intervalResolution\n * @return {Promise}\n */\nexport const untilAsync = async (check, timeout = 0, intervalResolution = 10) => {\n const startTime = time.getUnixTime()\n const noTimeout = timeout <= 0\n // eslint-disable-next-line no-unmodified-loop-condition\n while (noTimeout || time.getUnixTime() - startTime <= timeout) {\n if (await check()) return\n await wait(intervalResolution)\n }\n throw new Error('Timeout')\n}\n\n/**\n * @param {number} timeout\n * @return {Promise}\n */\nexport const wait = timeout => create((resolve, _reject) => setTimeout(resolve, timeout))\n\n/**\n * Checks if an object is a promise using ducktyping.\n *\n * Promises are often polyfilled, so it makes sense to add some additional guarantees if the user of this\n * library has some insane environment where global Promise objects are overwritten.\n *\n * @param {any} p\n * @return {boolean}\n */\nexport const isPromise = p => p instanceof Promise || (p && p.then && p.catch && p.finally)\n"],"names":["time.getUnixTime"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAA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CAAC,aAAa,EAAE,kBAAkB,EAAC;AACvE,CAAC,EAAC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,UAAU,GAAG,OAAO,KAAK,EAAE,OAAO,GAAG,CAAC,EAAE,kBAAkB,GAAG,EAAE,KAAK;AACjF,EAAE,MAAM,SAAS,GAAGA,gBAAgB,GAAE;AACtC,EAAE,MAAM,SAAS,GAAG,OAAO,IAAI,EAAC;AAChC;AACA,EAAE,OAAO,SAAS,IAAIA,gBAAgB,EAAE,GAAG,SAAS,IAAI,OAAO,EAAE;AACjE,IAAI,IAAI,MAAM,KAAK,EAAE,EAAE,MAAM;AAC7B,IAAI,MAAM,IAAI,CAAC,kBAAkB,EAAC;AAClC,GAAG;AACH,EAAE,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC;AAC5B,EAAC;AACD;AACA;AACA;AACA;AACA;AACY,MAAC,IAAI,GAAG,OAAO,IAAI,MAAM,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,EAAC;AACzF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,SAAS,GAAG,CAAC,IAAI,CAAC,YAAY,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/promise.cjs b/yjs-poll/node_modules/lib0/dist/promise.cjs deleted file mode 100644 index 3f8e54f..0000000 --- a/yjs-poll/node_modules/lib0/dist/promise.cjs +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./time-d8438852.cjs'); -var promise = require('./promise-cda7b9bb.cjs'); -require('./metric.cjs'); -require('./math-96d5e8c4.cjs'); - - - -exports.all = promise.all; -exports.create = promise.create; -exports.createEmpty = promise.createEmpty; -exports.isPromise = promise.isPromise; -exports.reject = promise.reject; -exports.resolve = promise.resolve; -exports.resolveWith = promise.resolveWith; -exports.until = promise.until; -exports.untilAsync = promise.untilAsync; -exports.wait = promise.wait; -//# sourceMappingURL=promise.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/promise.cjs.map b/yjs-poll/node_modules/lib0/dist/promise.cjs.map deleted file mode 100644 index af5ad36..0000000 --- a/yjs-poll/node_modules/lib0/dist/promise.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"promise.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/promise.d.ts b/yjs-poll/node_modules/lib0/dist/promise.d.ts deleted file mode 100644 index ccb4234..0000000 --- a/yjs-poll/node_modules/lib0/dist/promise.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -export function create(f: (arg0: PromiseResolve, arg1: (arg0: Error) => void) => any): Promise; -export function createEmpty(f: (arg0: () => void, arg1: (arg0: Error) => void) => void): Promise; -/** - * `Promise.all` wait for all promises in the array to resolve and return the result - * @template {unknown[] | []} PS - * - * @param {PS} ps - * @return {Promise<{ -readonly [P in keyof PS]: Awaited }>} - */ -export const all: { - (values: Iterable>): Promise[]>; - (values: T): Promise<{ -readonly [P in keyof T]: Awaited; }>; -}; -export function reject(reason?: Error): Promise; -export function resolve(res: T | void): Promise; -export function resolveWith(res: T): Promise; -export function until(timeout: number, check: () => boolean, intervalResolution?: number): Promise; -export function untilAsync(check: () => Promise | boolean, timeout?: number, intervalResolution?: number): Promise; -export function wait(timeout: number): Promise; -export function isPromise(p: any): boolean; -export type PromiseResolve = (result?: T | PromiseLike | undefined) => any; -//# sourceMappingURL=promise.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/promise.d.ts.map b/yjs-poll/node_modules/lib0/dist/promise.d.ts.map deleted file mode 100644 index 28dbe4f..0000000 --- a/yjs-poll/node_modules/lib0/dist/promise.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../promise.js"],"names":[],"mappings":"AAmBO,uBAJM,CAAC,KACH,CAAS,IAAiB,EAAjB,cAAc,CAAC,CAAC,CAAC,EAAC,IAAoB,EAApB,CAAS,IAAK,EAAL,KAAK,KAAE,IAAI,KAAE,GAAG,GACnD,OAAO,CAAC,CAAC,CAAC,CAE+C;AAM9D,+BAHI,CAAS,IAAe,EAAf,MAAW,IAAI,EAAC,IAAoB,EAApB,CAAS,IAAK,EAAL,KAAK,KAAE,IAAI,KAAE,IAAI,GAClD,OAAO,CAAC,IAAI,CAAC,CAEqB;AAE9C;;;;;;GAMG;AACH;;8DAwCM,CAAC;EAxCqC;AAMrC,gCAHI,KAAK,GACJ,OAAO,CAAC,KAAK,CAAC,CAE4B;AAO/C,wBAJM,CAAC,OACH,CAAC,GAAC,IAAI,GACL,OAAO,CAAC,CAAC,GAAC,IAAI,CAAC,CAEuB;AAO3C,4BAJM,CAAC,OACH,CAAC,GACA,OAAO,CAAC,CAAC,CAAC,CAEgC;AAW/C,+BALI,MAAM,SACN,MAAW,OAAO,uBAClB,MAAM,GACL,OAAO,CAAC,IAAI,CAAC,CAkBvB;AAQK,kCALI,MAAI,OAAO,CAAC,OAAO,CAAC,GAAC,OAAO,YAC5B,MAAM,uBACN,MAAM,GACL,OAAO,CAAC,IAAI,CAAC,CAWxB;AAMM,8BAHI,MAAM,GACL,OAAO,CAAC,SAAS,CAAC,CAE2D;AAWlF,6BAHI,GAAG,GACF,OAAO,CAEwE;2BA1G9E,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/promise.test.d.ts b/yjs-poll/node_modules/lib0/dist/promise.test.d.ts deleted file mode 100644 index aa230e1..0000000 --- a/yjs-poll/node_modules/lib0/dist/promise.test.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function testRepeatPromise(_tc: t.TestCase): Promise; -export function testispromise(_tc: t.TestCase): void; -export function testTypings(_tc: t.TestCase): Promise; -import * as t from './testing.js'; -//# sourceMappingURL=promise.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/promise.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/promise.test.d.ts.map deleted file mode 100644 index b9b9a0a..0000000 --- a/yjs-poll/node_modules/lib0/dist/promise.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"promise.test.d.ts","sourceRoot":"","sources":["../promise.test.js"],"names":[],"mappings":"AA6BO,uCAFI,CAAC,CAAC,QAAQ,iBAmBpB;AAKM,mCAFI,CAAC,CAAC,QAAQ,QAapB;AAKM,iCAFI,CAAC,CAAC,QAAQ,iBAapB;mBA7EkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/queue.cjs b/yjs-poll/node_modules/lib0/dist/queue.cjs deleted file mode 100644 index 9439270..0000000 --- a/yjs-poll/node_modules/lib0/dist/queue.cjs +++ /dev/null @@ -1,97 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -class QueueNode { - constructor () { - /** - * @type {QueueNode|null} - */ - this.next = null; - } -} - -/** - * @template V - */ -class QueueValue extends QueueNode { - /** - * @param {V} v - */ - constructor (v) { - super(); - this.v = v; - } -} - -/** - * @template {QueueNode} N - */ -class Queue { - constructor () { - /** - * @type {N | null} - */ - this.start = null; - /** - * @type {N | null} - */ - this.end = null; - } -} - -/** - * @note The queue implementation is experimental and unfinished. - * Don't use this in production yet. - * - * @template {QueueNode} N - * @return {Queue} - */ -const create = () => new Queue(); - -/** - * @param {Queue} queue - */ -const isEmpty = queue => queue.start === null; - -/** - * @template {Queue} Q - * @param {Q} queue - * @param {Q extends Queue ? N : never} n - */ -const enqueue = (queue, n) => { - if (queue.end !== null) { - queue.end.next = n; - queue.end = n; - } else { - queue.end = n; - queue.start = n; - } -}; - -/** - * @template {QueueNode} N - * @param {Queue} queue - * @return {N | null} - */ -const dequeue = queue => { - const n = queue.start; - if (n !== null) { - // @ts-ignore - queue.start = n.next; - if (queue.start === null) { - queue.end = null; - } - return n - } - return null -}; - -exports.Queue = Queue; -exports.QueueNode = QueueNode; -exports.QueueValue = QueueValue; -exports.create = create; -exports.dequeue = dequeue; -exports.enqueue = enqueue; -exports.isEmpty = isEmpty; -//# sourceMappingURL=queue.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/queue.cjs.map b/yjs-poll/node_modules/lib0/dist/queue.cjs.map deleted file mode 100644 index b6c47aa..0000000 --- a/yjs-poll/node_modules/lib0/dist/queue.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"queue.cjs","sources":["../queue.js"],"sourcesContent":["export class QueueNode {\n constructor () {\n /**\n * @type {QueueNode|null}\n */\n this.next = null\n }\n}\n\n/**\n * @template V\n */\nexport class QueueValue extends QueueNode {\n /**\n * @param {V} v\n */\n constructor (v) {\n super()\n this.v = v\n }\n}\n\n/**\n * @template {QueueNode} N\n */\nexport class Queue {\n constructor () {\n /**\n * @type {N | null}\n */\n this.start = null\n /**\n * @type {N | null}\n */\n this.end = null\n }\n}\n\n/**\n * @note The queue implementation is experimental and unfinished.\n * Don't use this in production yet.\n *\n * @template {QueueNode} N\n * @return {Queue}\n */\nexport const create = () => new Queue()\n\n/**\n * @param {Queue} queue\n */\nexport const isEmpty = queue => queue.start === null\n\n/**\n * @template {Queue} Q\n * @param {Q} queue\n * @param {Q extends Queue ? N : never} n\n */\nexport const enqueue = (queue, n) => {\n if (queue.end !== null) {\n queue.end.next = n\n queue.end = n\n } else {\n queue.end = n\n queue.start = n\n }\n}\n\n/**\n * @template {QueueNode} N\n * @param {Queue} queue\n * @return {N | null}\n */\nexport const dequeue = queue => {\n const n = queue.start\n if (n !== null) {\n // @ts-ignore\n queue.start = n.next\n if (queue.start === null) {\n queue.end = null\n }\n return n\n }\n return null\n}\n"],"names":[],"mappings":";;;;AAAO,MAAM,SAAS,CAAC;AACvB,EAAE,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C,CAAC,KAAI;AACxB,IAAI,IAAI,KAAK,CAAC,KAAK,KAAK,IAAI,EAAE;AAC9B,MAAM,KAAK,CAAC,GAAG,GAAG,KAAI;AACtB,KAAK;AACL,IAAI,OAAO,CAAC;AACZ,GAAG;AACH,EAAE,OAAO,IAAI;AACb;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/queue.d.ts b/yjs-poll/node_modules/lib0/dist/queue.d.ts deleted file mode 100644 index abba016..0000000 --- a/yjs-poll/node_modules/lib0/dist/queue.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -export class QueueNode { - /** - * @type {QueueNode|null} - */ - next: QueueNode | null; -} -/** - * @template V - */ -export class QueueValue extends QueueNode { - /** - * @param {V} v - */ - constructor(v: V); - v: V; -} -/** - * @template {QueueNode} N - */ -export class Queue { - /** - * @type {N | null} - */ - start: N | null; - /** - * @type {N | null} - */ - end: N | null; -} -export function create(): Queue; -export function isEmpty(queue: Queue): boolean; -export function enqueue>(queue: Q, n: Q extends Queue ? N : never): void; -export function dequeue(queue: Queue): N | null; -//# sourceMappingURL=queue.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/queue.d.ts.map b/yjs-poll/node_modules/lib0/dist/queue.d.ts.map deleted file mode 100644 index d9a6790..0000000 --- a/yjs-poll/node_modules/lib0/dist/queue.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../queue.js"],"names":[],"mappings":"AAAA;IAEI;;OAEG;IACH,MAFU,SAAS,GAAC,IAAI,CAER;CAEnB;AAED;;GAEG;AACH,wBAFa,CAAC;IAGZ;;OAEG;IACH,eAFW,CAAC,EAKX;IADC,KAAU;CAEb;AAED;;GAEG;AACH,mBAFyB,CAAC,SAAZ,SAAU;IAIpB;;OAEG;IACH,OAFU,CAAC,GAAG,IAAI,CAED;IACjB;;OAEG;IACH,KAFU,CAAC,GAAG,IAAI,CAEH;CAElB;AASM,uBAHkB,CAAC,SAAZ,SAAU,KACZ,KAAK,CAAC,CAAC,CAAC,CAEmB;AAKhC,+BAFI,KAAK,CAAC,GAAG,CAAC,WAE+B;AAO7C,wBAJmB,CAAC,SAAb,KAAK,CAAC,GAAG,CAAE,SACd,CAAC,KACD,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,QAU9C;AAOM,wBAJkB,CAAC,SAAZ,SAAU,SACb,KAAK,CAAC,CAAC,CAAC,GACP,CAAC,GAAG,IAAI,CAanB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/queue.test.d.ts b/yjs-poll/node_modules/lib0/dist/queue.test.d.ts deleted file mode 100644 index 7caa54d..0000000 --- a/yjs-poll/node_modules/lib0/dist/queue.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testEnqueueDequeue(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=queue.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/queue.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/queue.test.d.ts.map deleted file mode 100644 index df87497..0000000 --- a/yjs-poll/node_modules/lib0/dist/queue.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"queue.test.d.ts","sourceRoot":"","sources":["../queue.test.js"],"names":[],"mappings":"AAMO,wCAFI,CAAC,CAAC,QAAQ,QA8BpB;mBAlCkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/rabin-gf2-polynomial.cjs b/yjs-poll/node_modules/lib0/dist/rabin-gf2-polynomial.cjs deleted file mode 100644 index a0ff38f..0000000 --- a/yjs-poll/node_modules/lib0/dist/rabin-gf2-polynomial.cjs +++ /dev/null @@ -1,440 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var math = require('./math-96d5e8c4.cjs'); -var webcrypto = require('lib0/webcrypto'); -var array = require('./array-78849c95.cjs'); -var buffer = require('./buffer-3e750729.cjs'); -require('./set-5b47859e.cjs'); -require('./string-fddc5f8b.cjs'); -require('./environment-1c97264d.cjs'); -require('./map-24d263c0.cjs'); -require('./conditions-f5c0c102.cjs'); -require('./storage.cjs'); -require('./function-314580f7.cjs'); -require('./object-c0c9435b.cjs'); -require('./equality.cjs'); -require('./encoding-1a745c43.cjs'); -require('./number-1fb57bba.cjs'); -require('./binary-ac8e39e2.cjs'); -require('./decoding-76e75827.cjs'); -require('./error-0c1f634f.cjs'); - -function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n["default"] = e; - return Object.freeze(n); -} - -var webcrypto__namespace = /*#__PURE__*/_interopNamespace(webcrypto); - -/** - * The idea of the Rabin fingerprint algorithm is to represent the binary as a polynomial in a - * finite field (Galois Field G(2)). The polynomial will then be taken "modulo" by an irreducible - * polynomial of the desired size. - * - * This implementation is inefficient and is solely used to verify the actually performant - * implementation in `./rabin.js`. - * - * @module rabin-gf2-polynomial - */ - -/** - * @param {number} degree - */ -const _degreeToMinByteLength = degree => math.floor(degree / 8) + 1; - -/** - * This is a GF2 Polynomial abstraction that is not meant for production! - * - * It is easy to understand and it's correctness is as obvious as possible. It can be used to verify - * efficient implementations of algorithms on GF2. - */ -class GF2Polynomial { - constructor () { - /** - * @type {Set} - */ - this.degrees = new Set(); - } -} - -/** - * From Uint8Array (MSB). - * - * @param {Uint8Array} bytes - */ -const createFromBytes = bytes => { - const p = new GF2Polynomial(); - for (let bsi = bytes.length - 1, currDegree = 0; bsi >= 0; bsi--) { - const currByte = bytes[bsi]; - for (let i = 0; i < 8; i++) { - if (((currByte >>> i) & 1) === 1) { - p.degrees.add(currDegree); - } - currDegree++; - } - } - return p -}; - -/** - * Transform to Uint8Array (MSB). - * - * @param {GF2Polynomial} p - * @param {number} byteLength - */ -const toUint8Array = (p, byteLength = _degreeToMinByteLength(getHighestDegree(p))) => { - const buf = buffer.createUint8ArrayFromLen(byteLength); - /** - * @param {number} i - */ - const setBit = i => { - const bi = math.floor(i / 8); - buf[buf.length - 1 - bi] |= (1 << (i % 8)); - }; - p.degrees.forEach(setBit); - return buf -}; - -/** - * Create from unsigned integer (max 32bit uint) - read most-significant-byte first. - * - * @param {number} uint - */ -const createFromUint = uint => { - const buf = new Uint8Array(4); - for (let i = 0; i < 4; i++) { - buf[i] = uint >>> 8 * (3 - i); - } - return createFromBytes(buf) -}; - -/** - * Create a random polynomial of a specified degree. - * - * @param {number} degree - */ -const createRandom = degree => { - const bs = new Uint8Array(_degreeToMinByteLength(degree)); - webcrypto__namespace.getRandomValues(bs); - // Get first byte and explicitly set the bit of "degree" to 1 (the result must have the specified - // degree). - const firstByte = bs[0] | 1 << (degree % 8); - // Find out how many bits of the first byte need to be filled with zeros because they are >degree. - const zeros = 7 - (degree % 8); - bs[0] = ((firstByte << zeros) & 0xff) >>> zeros; - return createFromBytes(bs) -}; - -/** - * @param {GF2Polynomial} p - * @return number - */ -const getHighestDegree = p => array.fold(array.from(p.degrees), 0, math.max); - -/** - * Add (+) p2 int the p1 polynomial. - * - * Addition is defined as xor in F2. Substraction is equivalent to addition in F2. - * - * @param {GF2Polynomial} p1 - * @param {GF2Polynomial} p2 - */ -const addInto = (p1, p2) => { - p2.degrees.forEach(degree => { - if (p1.degrees.has(degree)) { - p1.degrees.delete(degree); - } else { - p1.degrees.add(degree); - } - }); -}; - -/** - * Or (|) p2 into the p1 polynomial. - * - * Addition is defined as xor in F2. Substraction is equivalent to addition in F2. - * - * @param {GF2Polynomial} p1 - * @param {GF2Polynomial} p2 - */ -const orInto = (p1, p2) => { - p2.degrees.forEach(degree => { - p1.degrees.add(degree); - }); -}; - -/** - * Add (+) p2 to the p1 polynomial. - * - * Addition is defined as xor in F2. Substraction is equivalent to addition in F2. - * - * @param {GF2Polynomial} p1 - * @param {GF2Polynomial} p2 - */ -const add = (p1, p2) => { - const result = new GF2Polynomial(); - p2.degrees.forEach(degree => { - if (!p1.degrees.has(degree)) { - result.degrees.add(degree); - } - }); - p1.degrees.forEach(degree => { - if (!p2.degrees.has(degree)) { - result.degrees.add(degree); - } - }); - return result -}; - -/** - * Add (+) p2 to the p1 polynomial. - * - * Addition is defined as xor in F2. Substraction is equivalent to addition in F2. - * - * @param {GF2Polynomial} p - */ -const clone = (p) => { - const result = new GF2Polynomial(); - p.degrees.forEach(d => result.degrees.add(d)); - return result -}; - -/** - * Add (+) p2 to the p1 polynomial. - * - * Addition is defined as xor in F2. Substraction is equivalent to addition in F2. - * - * @param {GF2Polynomial} p - * @param {number} degree - */ -const addDegreeInto = (p, degree) => { - if (p.degrees.has(degree)) { - p.degrees.delete(degree); - } else { - p.degrees.add(degree); - } -}; - -/** - * Multiply (•) p1 with p2 and store the result in p1. - * - * @param {GF2Polynomial} p1 - * @param {GF2Polynomial} p2 - */ -const multiply = (p1, p2) => { - const result = new GF2Polynomial(); - p1.degrees.forEach(degree1 => { - p2.degrees.forEach(degree2 => { - addDegreeInto(result, degree1 + degree2); - }); - }); - return result -}; - -/** - * Multiply (•) p1 with p2 and store the result in p1. - * - * @param {GF2Polynomial} p - * @param {number} shift - */ -const shiftLeft = (p, shift) => { - const result = new GF2Polynomial(); - p.degrees.forEach(degree => { - const r = degree + shift; - r >= 0 && result.degrees.add(r); - }); - return result -}; - -/** - * Computes p1 % p2. I.e. the remainder of p1/p2. - * - * @param {GF2Polynomial} p1 - * @param {GF2Polynomial} p2 - */ -const mod = (p1, p2) => { - const maxDeg1 = getHighestDegree(p1); - const maxDeg2 = getHighestDegree(p2); - const result = clone(p1); - for (let i = maxDeg1 - maxDeg2; i >= 0; i--) { - if (result.degrees.has(maxDeg2 + i)) { - const shifted = shiftLeft(p2, i); - addInto(result, shifted); - } - } - return result -}; - -/** - * Computes (p^e mod m). - * - * http://en.wikipedia.org/wiki/Modular_exponentiation - * - * @param {GF2Polynomial} p - * @param {number} e - * @param {GF2Polynomial} m - */ -const modPow = (p, e, m) => { - let result = ONE; - while (true) { - if ((e & 1) === 1) { - result = mod(multiply(result, p), m); - } - e >>>= 1; - if (e === 0) { - return result - } - p = mod(multiply(p, p), m); - } -}; - -/** - * Find the greatest common divisor using Euclid's Algorithm. - * - * @param {GF2Polynomial} p1 - * @param {GF2Polynomial} p2 - */ -const gcd = (p1, p2) => { - while (p2.degrees.size > 0) { - const modded = mod(p1, p2); - p1 = p2; - p2 = modded; - } - return p1 -}; - -/** - * true iff p1 equals p2 - * - * @param {GF2Polynomial} p1 - * @param {GF2Polynomial} p2 - */ -const equals = (p1, p2) => { - if (p1.degrees.size !== p2.degrees.size) return false - for (const d of p1.degrees) { - if (!p2.degrees.has(d)) return false - } - return true -}; - -const X = createFromBytes(new Uint8Array([2])); -const ONE = createFromBytes(new Uint8Array([1])); - -/** - * Computes ( x^(2^p) - x ) mod f - * - * (shamelessly copied from - * https://github.com/opendedup/rabinfingerprint/blob/master/src/org/rabinfingerprint/polynomial/Polynomial.java) - * - * @param {GF2Polynomial} f - * @param {number} p - */ -const reduceExponent = (f, p) => { - // compute (x^q^p mod f) - const q2p = math.pow(2, p); - const x2q2p = modPow(X, q2p, f); - // subtract (x mod f) - return mod(add(x2q2p, X), f) -}; - -/** - * BenOr Reducibility Test - * - * Tests and Constructions of Irreducible Polynomials over Finite Fields - * (1997) Shuhong Gao, Daniel Panario - * - * http://citeseer.ist.psu.edu/cache/papers/cs/27167/http:zSzzSzwww.math.clemson.eduzSzfacultyzSzGaozSzpaperszSzGP97a.pdf/gao97tests.pdf - * - * @param {GF2Polynomial} p - */ -const isIrreducibleBenOr = p => { - const degree = getHighestDegree(p); - for (let i = 1; i < degree / 2; i++) { - const b = reduceExponent(p, i); - const g = gcd(p, b); - if (!equals(g, ONE)) { - return false - } - } - return true -}; - -/** - * @param {number} degree - */ -const createIrreducible = degree => { - while (true) { - const p = createRandom(degree); - if (isIrreducibleBenOr(p)) return p - } -}; - -/** - * Create a fingerprint of buf using the irreducible polynomial m. - * - * @param {Uint8Array} buf - * @param {GF2Polynomial} m - */ -const fingerprint = (buf, m) => toUint8Array(mod(createFromBytes(buf), m), _degreeToMinByteLength(getHighestDegree(m) - 1)); - -class RabinPolynomialEncoder { - /** - * @param {GF2Polynomial} m The irreducible polynomial - */ - constructor (m) { - this.fingerprint = new GF2Polynomial(); - this.m = m; - } - - /** - * @param {number} b - */ - write (b) { - const bp = createFromBytes(new Uint8Array([b])); - const fingerprint = shiftLeft(this.fingerprint, 8); - orInto(fingerprint, bp); - this.fingerprint = mod(fingerprint, this.m); - } - - getFingerprint () { - return toUint8Array(this.fingerprint, _degreeToMinByteLength(getHighestDegree(this.m) - 1)) - } -} - -exports.GF2Polynomial = GF2Polynomial; -exports.RabinPolynomialEncoder = RabinPolynomialEncoder; -exports.add = add; -exports.addDegreeInto = addDegreeInto; -exports.addInto = addInto; -exports.clone = clone; -exports.createFromBytes = createFromBytes; -exports.createFromUint = createFromUint; -exports.createIrreducible = createIrreducible; -exports.createRandom = createRandom; -exports.equals = equals; -exports.fingerprint = fingerprint; -exports.gcd = gcd; -exports.getHighestDegree = getHighestDegree; -exports.isIrreducibleBenOr = isIrreducibleBenOr; -exports.mod = mod; -exports.modPow = modPow; -exports.multiply = multiply; -exports.orInto = orInto; -exports.shiftLeft = shiftLeft; -exports.toUint8Array = toUint8Array; -//# sourceMappingURL=rabin-gf2-polynomial.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/rabin-gf2-polynomial.cjs.map b/yjs-poll/node_modules/lib0/dist/rabin-gf2-polynomial.cjs.map deleted file mode 100644 index e191771..0000000 --- a/yjs-poll/node_modules/lib0/dist/rabin-gf2-polynomial.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rabin-gf2-polynomial.cjs","sources":["../hash/rabin-gf2-polynomial.js"],"sourcesContent":["/**\n * The idea of the Rabin fingerprint algorithm is to represent the binary as a polynomial in a\n * finite field (Galois Field G(2)). The polynomial will then be taken \"modulo\" by an irreducible\n * polynomial of the desired size.\n *\n * This implementation is inefficient and is solely used to verify the actually performant\n * implementation in `./rabin.js`.\n *\n * @module rabin-gf2-polynomial\n */\n\nimport * as math from '../math.js'\nimport * as webcrypto from 'lib0/webcrypto'\nimport * as array from '../array.js'\nimport * as buffer from '../buffer.js'\n\n/**\n * @param {number} degree\n */\nconst _degreeToMinByteLength = degree => math.floor(degree / 8) + 1\n\n/**\n * This is a GF2 Polynomial abstraction that is not meant for production!\n *\n * It is easy to understand and it's correctness is as obvious as possible. It can be used to verify\n * efficient implementations of algorithms on GF2.\n */\nexport class GF2Polynomial {\n constructor () {\n /**\n * @type {Set}\n */\n this.degrees = new Set()\n }\n}\n\n/**\n * From Uint8Array (MSB).\n *\n * @param {Uint8Array} bytes\n */\nexport const createFromBytes = bytes => {\n const p = new GF2Polynomial()\n for (let bsi = bytes.length - 1, currDegree = 0; bsi >= 0; bsi--) {\n const currByte = bytes[bsi]\n for (let i = 0; i < 8; i++) {\n if (((currByte >>> i) & 1) === 1) {\n p.degrees.add(currDegree)\n }\n currDegree++\n }\n }\n return p\n}\n\n/**\n * Transform to Uint8Array (MSB).\n *\n * @param {GF2Polynomial} p\n * @param {number} byteLength\n */\nexport const toUint8Array = (p, byteLength = _degreeToMinByteLength(getHighestDegree(p))) => {\n const buf = buffer.createUint8ArrayFromLen(byteLength)\n /**\n * @param {number} i\n */\n const setBit = i => {\n const bi = math.floor(i / 8)\n buf[buf.length - 1 - bi] |= (1 << (i % 8))\n }\n p.degrees.forEach(setBit)\n return buf\n}\n\n/**\n * Create from unsigned integer (max 32bit uint) - read most-significant-byte first.\n *\n * @param {number} uint\n */\nexport const createFromUint = uint => {\n const buf = new Uint8Array(4)\n for (let i = 0; i < 4; i++) {\n buf[i] = uint >>> 8 * (3 - i)\n }\n return createFromBytes(buf)\n}\n\n/**\n * Create a random polynomial of a specified degree.\n *\n * @param {number} degree\n */\nexport const createRandom = degree => {\n const bs = new Uint8Array(_degreeToMinByteLength(degree))\n webcrypto.getRandomValues(bs)\n // Get first byte and explicitly set the bit of \"degree\" to 1 (the result must have the specified\n // degree).\n const firstByte = bs[0] | 1 << (degree % 8)\n // Find out how many bits of the first byte need to be filled with zeros because they are >degree.\n const zeros = 7 - (degree % 8)\n bs[0] = ((firstByte << zeros) & 0xff) >>> zeros\n return createFromBytes(bs)\n}\n\n/**\n * @param {GF2Polynomial} p\n * @return number\n */\nexport const getHighestDegree = p => array.fold(array.from(p.degrees), 0, math.max)\n\n/**\n * Add (+) p2 int the p1 polynomial.\n *\n * Addition is defined as xor in F2. Substraction is equivalent to addition in F2.\n *\n * @param {GF2Polynomial} p1\n * @param {GF2Polynomial} p2\n */\nexport const addInto = (p1, p2) => {\n p2.degrees.forEach(degree => {\n if (p1.degrees.has(degree)) {\n p1.degrees.delete(degree)\n } else {\n p1.degrees.add(degree)\n }\n })\n}\n\n/**\n * Or (|) p2 into the p1 polynomial.\n *\n * Addition is defined as xor in F2. Substraction is equivalent to addition in F2.\n *\n * @param {GF2Polynomial} p1\n * @param {GF2Polynomial} p2\n */\nexport const orInto = (p1, p2) => {\n p2.degrees.forEach(degree => {\n p1.degrees.add(degree)\n })\n}\n\n/**\n * Add (+) p2 to the p1 polynomial.\n *\n * Addition is defined as xor in F2. Substraction is equivalent to addition in F2.\n *\n * @param {GF2Polynomial} p1\n * @param {GF2Polynomial} p2\n */\nexport const add = (p1, p2) => {\n const result = new GF2Polynomial()\n p2.degrees.forEach(degree => {\n if (!p1.degrees.has(degree)) {\n result.degrees.add(degree)\n }\n })\n p1.degrees.forEach(degree => {\n if (!p2.degrees.has(degree)) {\n result.degrees.add(degree)\n }\n })\n return result\n}\n\n/**\n * Add (+) p2 to the p1 polynomial.\n *\n * Addition is defined as xor in F2. Substraction is equivalent to addition in F2.\n *\n * @param {GF2Polynomial} p\n */\nexport const clone = (p) => {\n const result = new GF2Polynomial()\n p.degrees.forEach(d => result.degrees.add(d))\n return result\n}\n\n/**\n * Add (+) p2 to the p1 polynomial.\n *\n * Addition is defined as xor in F2. Substraction is equivalent to addition in F2.\n *\n * @param {GF2Polynomial} p\n * @param {number} degree\n */\nexport const addDegreeInto = (p, degree) => {\n if (p.degrees.has(degree)) {\n p.degrees.delete(degree)\n } else {\n p.degrees.add(degree)\n }\n}\n\n/**\n * Multiply (•) p1 with p2 and store the result in p1.\n *\n * @param {GF2Polynomial} p1\n * @param {GF2Polynomial} p2\n */\nexport const multiply = (p1, p2) => {\n const result = new GF2Polynomial()\n p1.degrees.forEach(degree1 => {\n p2.degrees.forEach(degree2 => {\n addDegreeInto(result, degree1 + degree2)\n })\n })\n return result\n}\n\n/**\n * Multiply (•) p1 with p2 and store the result in p1.\n *\n * @param {GF2Polynomial} p\n * @param {number} shift\n */\nexport const shiftLeft = (p, shift) => {\n const result = new GF2Polynomial()\n p.degrees.forEach(degree => {\n const r = degree + shift\n r >= 0 && result.degrees.add(r)\n })\n return result\n}\n\n/**\n * Computes p1 % p2. I.e. the remainder of p1/p2.\n *\n * @param {GF2Polynomial} p1\n * @param {GF2Polynomial} p2\n */\nexport const mod = (p1, p2) => {\n const maxDeg1 = getHighestDegree(p1)\n const maxDeg2 = getHighestDegree(p2)\n const result = clone(p1)\n for (let i = maxDeg1 - maxDeg2; i >= 0; i--) {\n if (result.degrees.has(maxDeg2 + i)) {\n const shifted = shiftLeft(p2, i)\n addInto(result, shifted)\n }\n }\n return result\n}\n\n/**\n * Computes (p^e mod m).\n *\n * http://en.wikipedia.org/wiki/Modular_exponentiation\n *\n * @param {GF2Polynomial} p\n * @param {number} e\n * @param {GF2Polynomial} m\n */\nexport const modPow = (p, e, m) => {\n let result = ONE\n while (true) {\n if ((e & 1) === 1) {\n result = mod(multiply(result, p), m)\n }\n e >>>= 1\n if (e === 0) {\n return result\n }\n p = mod(multiply(p, p), m)\n }\n}\n\n/**\n * Find the greatest common divisor using Euclid's Algorithm.\n *\n * @param {GF2Polynomial} p1\n * @param {GF2Polynomial} p2\n */\nexport const gcd = (p1, p2) => {\n while (p2.degrees.size > 0) {\n const modded = mod(p1, p2)\n p1 = p2\n p2 = modded\n }\n return p1\n}\n\n/**\n * true iff p1 equals p2\n *\n * @param {GF2Polynomial} p1\n * @param {GF2Polynomial} p2\n */\nexport const equals = (p1, p2) => {\n if (p1.degrees.size !== p2.degrees.size) return false\n for (const d of p1.degrees) {\n if (!p2.degrees.has(d)) return false\n }\n return true\n}\n\nconst X = createFromBytes(new Uint8Array([2]))\nconst ONE = createFromBytes(new Uint8Array([1]))\n\n/**\n * Computes ( x^(2^p) - x ) mod f\n *\n * (shamelessly copied from\n * https://github.com/opendedup/rabinfingerprint/blob/master/src/org/rabinfingerprint/polynomial/Polynomial.java)\n *\n * @param {GF2Polynomial} f\n * @param {number} p\n */\nconst reduceExponent = (f, p) => {\n // compute (x^q^p mod f)\n const q2p = math.pow(2, p)\n const x2q2p = modPow(X, q2p, f)\n // subtract (x mod f)\n return mod(add(x2q2p, X), f)\n}\n\n/**\n * BenOr Reducibility Test\n *\n * Tests and Constructions of Irreducible Polynomials over Finite Fields\n * (1997) Shuhong Gao, Daniel Panario\n *\n * http://citeseer.ist.psu.edu/cache/papers/cs/27167/http:zSzzSzwww.math.clemson.eduzSzfacultyzSzGaozSzpaperszSzGP97a.pdf/gao97tests.pdf\n *\n * @param {GF2Polynomial} p\n */\nexport const isIrreducibleBenOr = p => {\n const degree = getHighestDegree(p)\n for (let i = 1; i < degree / 2; i++) {\n const b = reduceExponent(p, i)\n const g = gcd(p, b)\n if (!equals(g, ONE)) {\n return false\n }\n }\n return true\n}\n\n/**\n * @param {number} degree\n */\nexport const createIrreducible = degree => {\n while (true) {\n const p = createRandom(degree)\n if (isIrreducibleBenOr(p)) return p\n }\n}\n\n/**\n * Create a fingerprint of buf using the irreducible polynomial m.\n *\n * @param {Uint8Array} buf\n * @param {GF2Polynomial} m\n */\nexport const fingerprint = (buf, m) => toUint8Array(mod(createFromBytes(buf), m), _degreeToMinByteLength(getHighestDegree(m) - 1))\n\nexport class RabinPolynomialEncoder {\n /**\n * @param {GF2Polynomial} m The irreducible polynomial\n */\n constructor (m) {\n this.fingerprint = new GF2Polynomial()\n this.m = m\n }\n\n /**\n * @param {number} b\n */\n write (b) {\n const bp = createFromBytes(new Uint8Array([b]))\n const fingerprint = shiftLeft(this.fingerprint, 8)\n orInto(fingerprint, bp)\n this.fingerprint = mod(fingerprint, this.m)\n }\n\n getFingerprint () {\n return toUint8Array(this.fingerprint, _degreeToMinByteLength(getHighestDegree(this.m) - 1))\n }\n}\n"],"names":["math.floor","buffer.createUint8ArrayFromLen","webcrypto","array.fold","array.from","math.max","math.pow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA,MAAM,sBAAsB,GAAG,MAAM,IAAIA,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,EAAC;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,aAAa,CAAC;AAC3B,EAAE,WAAW,CAAC,GAAG;AACjB;AACA;AACA;AACA,IAAI,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,GAAE;AAC5B,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,eAAe,GAAG,KAAK,IAAI;AACxC,EAAE,MAAM,CAAC,GAAG,IAAI,aAAa,GAAE;AAC/B,EAAE,KAAK,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,UAAU,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE;AACpE,IAAI,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,EAAC;AAC/B,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AAChC,MA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CAAC,CAAC;AAC/F,GAAG;AACH;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/rabin-uncached.cjs b/yjs-poll/node_modules/lib0/dist/rabin-uncached.cjs deleted file mode 100644 index 6232837..0000000 --- a/yjs-poll/node_modules/lib0/dist/rabin-uncached.cjs +++ /dev/null @@ -1,90 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var math = require('./math-96d5e8c4.cjs'); -var buffer = require('./buffer-3e750729.cjs'); -require('./string-fddc5f8b.cjs'); -require('./array-78849c95.cjs'); -require('./set-5b47859e.cjs'); -require('./environment-1c97264d.cjs'); -require('./map-24d263c0.cjs'); -require('./conditions-f5c0c102.cjs'); -require('./storage.cjs'); -require('./function-314580f7.cjs'); -require('./object-c0c9435b.cjs'); -require('./equality.cjs'); -require('./encoding-1a745c43.cjs'); -require('./number-1fb57bba.cjs'); -require('./binary-ac8e39e2.cjs'); -require('./decoding-76e75827.cjs'); -require('./error-0c1f634f.cjs'); - -/** - * It is not recommended to use this package. This is the uncached implementation of the rabin - * fingerprint algorithm. However, it can be used to verify the `rabin.js` implementation. - * - * @module rabin-uncached - */ - -class RabinUncachedEncoder { - /** - * @param {Uint8Array} m assert(m[0] === 1) - */ - constructor (m) { - this.m = m; - this.blen = m.byteLength; - this.bs = new Uint8Array(this.blen); - /** - * This describes the position of the most significant byte (starts with 0 and increases with - * shift) - */ - this.bpos = 0; - } - - /** - * Add/Xor/Substract bytes. - * - * Discards bytes that are out of range. - * @todo put this in function or inline - * - * @param {Uint8Array} cs - */ - add (cs) { - const copyLen = math.min(this.blen, cs.byteLength); - // copy from right to left until max is reached - for (let i = 0; i < copyLen; i++) { - this.bs[(this.bpos + this.blen - i - 1) % this.blen] ^= cs[cs.byteLength - i - 1]; - } - } - - /** - * @param {number} byte - */ - write (byte) { - // [0,m1,m2,b] - // x <- bpos - // Shift one byte to the left, add b - this.bs[this.bpos] = byte; - this.bpos = (this.bpos + 1) % this.blen; - // mod - for (let i = 7; i >= 0; i--) { - if (((this.bs[this.bpos] >>> i) & 1) === 1) { - this.add(buffer.shiftNBitsLeft(this.m, i)); - } - } - // if (this.bs[this.bpos] !== 0) { error.unexpectedCase() } - // assert(this.bs[this.bpos] === 0) - } - - getFingerprint () { - const result = new Uint8Array(this.blen - 1); - for (let i = 0; i < result.byteLength; i++) { - result[i] = this.bs[(this.bpos + i + 1) % this.blen]; - } - return result - } -} - -exports.RabinUncachedEncoder = RabinUncachedEncoder; -//# sourceMappingURL=rabin-uncached.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/rabin-uncached.cjs.map b/yjs-poll/node_modules/lib0/dist/rabin-uncached.cjs.map deleted file mode 100644 index 1734ea3..0000000 --- a/yjs-poll/node_modules/lib0/dist/rabin-uncached.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rabin-uncached.cjs","sources":["../hash/rabin-uncached.js"],"sourcesContent":["/**\n * It is not recommended to use this package. This is the uncached implementation of the rabin\n * fingerprint algorithm. However, it can be used to verify the `rabin.js` implementation.\n *\n * @module rabin-uncached\n */\n\nimport * as math from '../math.js'\nimport * as buffer from '../buffer.js'\n\nexport class RabinUncachedEncoder {\n /**\n * @param {Uint8Array} m assert(m[0] === 1)\n */\n constructor (m) {\n this.m = m\n this.blen = m.byteLength\n this.bs = new Uint8Array(this.blen)\n /**\n * This describes the position of the most significant byte (starts with 0 and increases with\n * shift)\n */\n this.bpos = 0\n }\n\n /**\n * Add/Xor/Substract bytes.\n *\n * Discards bytes that are out of range.\n * @todo put this in function or inline\n *\n * @param {Uint8Array} cs\n */\n add (cs) {\n const copyLen = math.min(this.blen, cs.byteLength)\n // copy from right to left until max is reached\n for (let i = 0; i < copyLen; i++) {\n this.bs[(this.bpos + this.blen - i - 1) % this.blen] ^= cs[cs.byteLength - i - 1]\n }\n }\n\n /**\n * @param {number} byte\n */\n write (byte) {\n // [0,m1,m2,b]\n // x <- bpos\n // Shift one byte to the left, add b\n this.bs[this.bpos] = byte\n this.bpos = (this.bpos + 1) % this.blen\n // mod\n for (let i = 7; i >= 0; i--) {\n if (((this.bs[this.bpos] >>> i) & 1) === 1) {\n this.add(buffer.shiftNBitsLeft(this.m, i))\n }\n }\n // if (this.bs[this.bpos] !== 0) { error.unexpectedCase() }\n // assert(this.bs[this.bpos] === 0)\n }\n\n getFingerprint () {\n const result = new Uint8Array(this.blen - 1)\n for (let i = 0; i < result.byteLength; i++) {\n result[i] = this.bs[(this.bpos + i + 1) % this.blen]\n }\n return result\n }\n}\n"],"names":["math.min","buffer.shiftNBitsLeft"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAIA;AACO,MAAM,oBAAoB,CAAC;AAClC;AACA;AACA;AACA,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE;AAClB,IAAI,IAAI,CAAC,CAAC,GAAG,EAAC;AACd,IAAI,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,WAAU;AAC5B,IAAI,IAAI,CAAC,EAAE,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,EAAC;AACvC;AACA;AACA;AACA;AACA,IAAI,IAAI,CAAC,IAAI,GAAG,EAAC;AACjB,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,GAAG,CAAC,CAAC,EAAE,EAAE;AACX,IAAI,MAAM,OAAO,GAAGA,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,EAAC;AACtD;AACA,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,EAAE,EAAE;AACtC,MAAM,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,UAAU,GAAG,CAAC,GAAG,CAAC,EAAC;AACvF,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE;AACf;AACA;AACA;AACA,IAAI,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,KAAI;AAC7B,IAAI,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,KAAI;AAC3C;AACA,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;AACjC,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;AAClD,QAAQ,IAAI,CAAC,GAAG,CAACC,qBAAqB,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC;AAClD,OAAO;AACP,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA,EAAE,cAAc,CAAC,GAAG;AACpB,IAAI,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,EAAC;AAChD,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE;AAChD,MAAM,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,EAAC;AAC1D,KAAK;AACL,IAAI,OAAO,MAAM;AACjB,GAAG;AACH;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/rabin.cjs b/yjs-poll/node_modules/lib0/dist/rabin.cjs deleted file mode 100644 index b8f2e5b..0000000 --- a/yjs-poll/node_modules/lib0/dist/rabin.cjs +++ /dev/null @@ -1,128 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var buffer = require('./buffer-3e750729.cjs'); -var map = require('./map-24d263c0.cjs'); -require('./string-fddc5f8b.cjs'); -require('./array-78849c95.cjs'); -require('./set-5b47859e.cjs'); -require('./environment-1c97264d.cjs'); -require('./conditions-f5c0c102.cjs'); -require('./storage.cjs'); -require('./function-314580f7.cjs'); -require('./object-c0c9435b.cjs'); -require('./equality.cjs'); -require('./math-96d5e8c4.cjs'); -require('./encoding-1a745c43.cjs'); -require('./number-1fb57bba.cjs'); -require('./binary-ac8e39e2.cjs'); -require('./decoding-76e75827.cjs'); -require('./error-0c1f634f.cjs'); - -/** - * @module rabin - * - * Very efficient & versatile fingerprint/hashing algorithm. However, it is not cryptographically - * secure. Well suited for fingerprinting. - */ - -const StandardIrreducible8 = new Uint8Array([1, 221]); -const StandardIrreducible16 = new Uint8Array([1, 244, 157]); -const StandardIrreducible32 = new Uint8Array([1, 149, 183, 205, 191]); -const StandardIrreducible64 = new Uint8Array([1, 133, 250, 114, 193, 250, 28, 193, 231]); -const StandardIrreducible128 = new Uint8Array([1, 94, 109, 166, 228, 6, 222, 102, 239, 27, 128, 184, 13, 50, 112, 169, 199]); - -/** - * Maps from a modulo to the precomputed values. - * - * @type {Map} - */ -const _precomputedFingerprintCache = new Map(); - -/** - * @param {Uint8Array} m - */ -const ensureCache = m => map.setIfUndefined(_precomputedFingerprintCache, buffer.toBase64(m), () => { - const byteLen = m.byteLength; - const cache = new Uint8Array(256 * byteLen); - // Use dynamic computing to compute the cached results. - // Starting values: cache(0) = 0; cache(1) = m - cache.set(m, byteLen); - for (let bit = 1; bit < 8; bit++) { - const mBitShifted = buffer.shiftNBitsLeft(m, bit); - const bitShifted = 1 << bit; - for (let j = 0; j < bitShifted; j++) { - // apply the shifted result (reducing the degree of the polynomial) - const msb = bitShifted | j; - const rest = msb ^ mBitShifted[0]; - for (let i = 0; i < byteLen; i++) { - // rest is already precomputed in the cache - cache[msb * byteLen + i] = cache[rest * byteLen + i] ^ mBitShifted[i]; - } - // if (cache[(bitShifted | j) * byteLen] !== (bitShifted | j)) { error.unexpectedCase() } - } - } - return cache -}); - -class RabinEncoder { - /** - * @param {Uint8Array} m assert(m[0] === 1) - */ - constructor (m) { - this.m = m; - this.blen = m.byteLength; - this.bs = new Uint8Array(this.blen); - this.cache = ensureCache(m); - /** - * This describes the position of the most significant byte (starts with 0 and increases with - * shift) - */ - this.bpos = 0; - } - - /** - * @param {number} byte - */ - write (byte) { - // assert(this.bs[0] === 0) - // Shift one byte to the left, add b - this.bs[this.bpos] = byte; - this.bpos = (this.bpos + 1) % this.blen; - const msb = this.bs[this.bpos]; - for (let i = 0; i < this.blen; i++) { - this.bs[(this.bpos + i) % this.blen] ^= this.cache[msb * this.blen + i]; - } - // assert(this.bs[this.bpos] === 0) - } - - getFingerprint () { - const result = new Uint8Array(this.blen - 1); - for (let i = 0; i < result.byteLength; i++) { - result[i] = this.bs[(this.bpos + i + 1) % this.blen]; - } - return result - } -} - -/** - * @param {Uint8Array} irreducible - * @param {Uint8Array} data - */ -const fingerprint = (irreducible, data) => { - const encoder = new RabinEncoder(irreducible); - for (let i = 0; i < data.length; i++) { - encoder.write(data[i]); - } - return encoder.getFingerprint() -}; - -exports.RabinEncoder = RabinEncoder; -exports.StandardIrreducible128 = StandardIrreducible128; -exports.StandardIrreducible16 = StandardIrreducible16; -exports.StandardIrreducible32 = StandardIrreducible32; -exports.StandardIrreducible64 = StandardIrreducible64; -exports.StandardIrreducible8 = StandardIrreducible8; -exports.fingerprint = fingerprint; -//# sourceMappingURL=rabin.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/rabin.cjs.map b/yjs-poll/node_modules/lib0/dist/rabin.cjs.map deleted file mode 100644 index 89b5fdc..0000000 --- a/yjs-poll/node_modules/lib0/dist/rabin.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rabin.cjs","sources":["../hash/rabin.js"],"sourcesContent":["/**\n * @module rabin\n *\n * Very efficient & versatile fingerprint/hashing algorithm. However, it is not cryptographically\n * secure. Well suited for fingerprinting.\n */\n\nimport * as buffer from '../buffer.js'\nimport * as map from '../map.js'\n\nexport const StandardIrreducible8 = new Uint8Array([1, 221])\nexport const StandardIrreducible16 = new Uint8Array([1, 244, 157])\nexport const StandardIrreducible32 = new Uint8Array([1, 149, 183, 205, 191])\nexport const StandardIrreducible64 = new Uint8Array([1, 133, 250, 114, 193, 250, 28, 193, 231])\nexport const StandardIrreducible128 = new Uint8Array([1, 94, 109, 166, 228, 6, 222, 102, 239, 27, 128, 184, 13, 50, 112, 169, 199])\n\n/**\n * Maps from a modulo to the precomputed values.\n *\n * @type {Map}\n */\nconst _precomputedFingerprintCache = new Map()\n\n/**\n * @param {Uint8Array} m\n */\nconst ensureCache = m => map.setIfUndefined(_precomputedFingerprintCache, buffer.toBase64(m), () => {\n const byteLen = m.byteLength\n const cache = new Uint8Array(256 * byteLen)\n // Use dynamic computing to compute the cached results.\n // Starting values: cache(0) = 0; cache(1) = m\n cache.set(m, byteLen)\n for (let bit = 1; bit < 8; bit++) {\n const mBitShifted = buffer.shiftNBitsLeft(m, bit)\n const bitShifted = 1 << bit\n for (let j = 0; j < bitShifted; j++) {\n // apply the shifted result (reducing the degree of the polynomial)\n const msb = bitShifted | j\n const rest = msb ^ mBitShifted[0]\n for (let i = 0; i < byteLen; i++) {\n // rest is already precomputed in the cache\n cache[msb * byteLen + i] = cache[rest * byteLen + i] ^ mBitShifted[i]\n }\n // if (cache[(bitShifted | j) * byteLen] !== (bitShifted | j)) { error.unexpectedCase() }\n }\n }\n return cache\n})\n\nexport class RabinEncoder {\n /**\n * @param {Uint8Array} m assert(m[0] === 1)\n */\n constructor (m) {\n this.m = m\n this.blen = m.byteLength\n this.bs = new Uint8Array(this.blen)\n this.cache = ensureCache(m)\n /**\n * This describes the position of the most significant byte (starts with 0 and increases with\n * shift)\n */\n this.bpos = 0\n }\n\n /**\n * @param {number} byte\n */\n write (byte) {\n // assert(this.bs[0] === 0)\n // Shift one byte to the left, add b\n this.bs[this.bpos] = byte\n this.bpos = (this.bpos + 1) % this.blen\n const msb = this.bs[this.bpos]\n for (let i = 0; i < this.blen; i++) {\n this.bs[(this.bpos + i) % this.blen] ^= this.cache[msb * this.blen + i]\n }\n // assert(this.bs[this.bpos] === 0)\n }\n\n getFingerprint () {\n const result = new Uint8Array(this.blen - 1)\n for (let i = 0; i < result.byteLength; i++) {\n result[i] = this.bs[(this.bpos + i + 1) % this.blen]\n }\n return result\n }\n}\n\n/**\n * @param {Uint8Array} irreducible\n * @param {Uint8Array} data\n */\nexport const fingerprint = (irreducible, data) => {\n const encoder = new RabinEncoder(irreducible)\n for (let i = 0; i < data.length; i++) {\n encoder.write(data[i])\n }\n return encoder.getFingerprint()\n}\n"],"names":["map.setIfUndefined","buffer.toBase64","buffer.shiftNBitsLeft"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAIA;AACY,MAAC,oBAAoB,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAC;AAChD,MAAC,qBAAqB,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,EAAC;AACtD,MAAC,qBAAqB,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAC;AAChE,MAAC,qBAAqB,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,EAAC;AACnF,MAAC,sBAAsB,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAA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,EAAE;AAChD,MAAM,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,EAAC;AAC1D,KAAK;AACL,IAAI,OAAO,MAAM;AACjB,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACA;AACY,MAAC,WAAW,GAAG,CAAC,WAAW,EAAE,IAAI,KAAK;AAClD,EAAE,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,WAAW,EAAC;AAC/C,EAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACxC,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC;AAC1B,GAAG;AACH,EAAE,OAAO,OAAO,CAAC,cAAc,EAAE;AACjC;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/random.cjs b/yjs-poll/node_modules/lib0/dist/random.cjs deleted file mode 100644 index b9a6b8e..0000000 --- a/yjs-poll/node_modules/lib0/dist/random.cjs +++ /dev/null @@ -1,48 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var math = require('./math-96d5e8c4.cjs'); -var binary = require('./binary-ac8e39e2.cjs'); -var webcrypto = require('lib0/webcrypto'); - -/** - * Isomorphic module for true random numbers / buffers / uuids. - * - * Attention: falls back to Math.random if the browser does not support crypto. - * - * @module random - */ - -const rand = Math.random; - -const uint32 = () => webcrypto.getRandomValues(new Uint32Array(1))[0]; - -const uint53 = () => { - const arr = webcrypto.getRandomValues(new Uint32Array(8)); - return (arr[0] & binary.BITS21) * (binary.BITS32 + 1) + (arr[1] >>> 0) -}; - -/** - * @template T - * @param {Array} arr - * @return {T} - */ -const oneOf = arr => arr[math.floor(rand() * arr.length)]; - -// @ts-ignore -const uuidv4Template = [1e7] + -1e3 + -4e3 + -8e3 + -1e11; - -/** - * @return {string} - */ -const uuidv4 = () => uuidv4Template.replace(/[018]/g, /** @param {number} c */ c => - (c ^ uint32() & 15 >> c / 4).toString(16) -); - -exports.oneOf = oneOf; -exports.rand = rand; -exports.uint32 = uint32; -exports.uint53 = uint53; -exports.uuidv4 = uuidv4; -//# sourceMappingURL=random.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/random.cjs.map b/yjs-poll/node_modules/lib0/dist/random.cjs.map deleted file mode 100644 index b3ca922..0000000 --- a/yjs-poll/node_modules/lib0/dist/random.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"random.cjs","sources":["../random.js"],"sourcesContent":["/**\n * Isomorphic module for true random numbers / buffers / uuids.\n *\n * Attention: falls back to Math.random if the browser does not support crypto.\n *\n * @module random\n */\n\nimport * as math from './math.js'\nimport * as binary from './binary.js'\nimport { getRandomValues } from 'lib0/webcrypto'\n\nexport const rand = Math.random\n\nexport const uint32 = () => getRandomValues(new Uint32Array(1))[0]\n\nexport const uint53 = () => {\n const arr = getRandomValues(new Uint32Array(8))\n return (arr[0] & binary.BITS21) * (binary.BITS32 + 1) + (arr[1] >>> 0)\n}\n\n/**\n * @template T\n * @param {Array} arr\n * @return {T}\n */\nexport const oneOf = arr => arr[math.floor(rand() * arr.length)]\n\n// @ts-ignore\nconst uuidv4Template = [1e7] + -1e3 + -4e3 + -8e3 + -1e11\n\n/**\n * @return {string}\n */\nexport const uuidv4 = () => uuidv4Template.replace(/[018]/g, /** @param {number} c */ c =>\n (c ^ uint32() & 15 >> c / 4).toString(16)\n)\n"],"names":["getRandomValues","binary.BITS21","binary.BITS32","math.floor"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACY,MAAC,IAAI,GAAG,IAAI,CAAC,OAAM;AAC/B;AACY,MAAC,MAAM,GAAG,MAAMA,yBAAe,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAC;AAClE;AACY,MAAC,MAAM,GAAG,MAAM;AAC5B,EAAE,MAAM,GAAG,GAAGA,yBAAe,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,EAAC;AACjD,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAGC,aAAa,KAAKC,aAAa,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AACxE,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,KAAK,GAAG,GAAG,IAAI,GAAG,CAACC,UAAU,CAAC,IAAI,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,EAAC;AAChE;AACA;AACA,MAAM,cAAc,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,KAAI;AACzD;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,QAAQ,2BAA2B,CAAC;AACvF,EAAE,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC;AAC3C;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/random.d.ts b/yjs-poll/node_modules/lib0/dist/random.d.ts deleted file mode 100644 index f52f7b8..0000000 --- a/yjs-poll/node_modules/lib0/dist/random.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const rand: () => number; -export function uint32(): number; -export function uint53(): number; -export function oneOf(arr: Array): T; -export function uuidv4(): string; -//# sourceMappingURL=random.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/random.d.ts.map b/yjs-poll/node_modules/lib0/dist/random.d.ts.map deleted file mode 100644 index 6d879a9..0000000 --- a/yjs-poll/node_modules/lib0/dist/random.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../random.js"],"names":[],"mappings":"AAYA,gCAA+B;AAExB,iCAA2D;AAE3D,iCAGN;AAOM,sBAJM,CAAC,OACH,KAAK,CAAC,CAAC,CAAC,GACP,CAAC,CAEmD;AAQzD,0BAFK,MAAM,CAIjB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/random.test.d.ts b/yjs-poll/node_modules/lib0/dist/random.test.d.ts deleted file mode 100644 index d3b2523..0000000 --- a/yjs-poll/node_modules/lib0/dist/random.test.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function testRandom(tc: t.TestCase): void; -export function testUint32(tc: t.TestCase): void; -export function testUint53(tc: t.TestCase): void; -export function testUuidv4(tc: t.TestCase): void; -export function testUuidv4Overlaps(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=random.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/random.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/random.test.d.ts.map deleted file mode 100644 index d117524..0000000 --- a/yjs-poll/node_modules/lib0/dist/random.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"random.test.d.ts","sourceRoot":"","sources":["../random.test.js"],"names":[],"mappings":"AASO,+BAFI,CAAC,CAAC,QAAQ,QAKpB;AAKM,+BAFI,CAAC,CAAC,QAAQ,QA0BpB;AAKM,+BAFI,CAAC,CAAC,QAAQ,QAyBpB;AAKM,+BAFI,CAAC,CAAC,QAAQ,QAIpB;AAKM,uCAFI,CAAC,CAAC,QAAQ,QAiBpB;mBA/FkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/rollup.config.d.ts b/yjs-poll/node_modules/lib0/dist/rollup.config.d.ts deleted file mode 100644 index 7192ab2..0000000 --- a/yjs-poll/node_modules/lib0/dist/rollup.config.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -declare const _default: { - input: string[]; - output: { - dir: string; - format: string; - sourcemap: boolean; - entryFileNames: string; - chunkFileNames: string; - }; - external: string[]; -}[]; -export default _default; -//# sourceMappingURL=rollup.config.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/rollup.config.d.ts.map b/yjs-poll/node_modules/lib0/dist/rollup.config.d.ts.map deleted file mode 100644 index 8ea43ed..0000000 --- a/yjs-poll/node_modules/lib0/dist/rollup.config.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rollup.config.d.ts","sourceRoot":"","sources":["../rollup.config.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/rsa-oaep.cjs b/yjs-poll/node_modules/lib0/dist/rsa-oaep.cjs deleted file mode 100644 index 39f8270..0000000 --- a/yjs-poll/node_modules/lib0/dist/rsa-oaep.cjs +++ /dev/null @@ -1,112 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var webcrypto = require('lib0/webcrypto'); -var common = require('./common.cjs'); - -function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n["default"] = e; - return Object.freeze(n); -} - -var webcrypto__namespace = /*#__PURE__*/_interopNamespace(webcrypto); - -/** - * RSA-OAEP is an asymmetric keypair used for encryption - */ - -/** - * @typedef {Array<'encrypt'|'decrypt'>} Usages - */ - -/** - * @type {Usages} - */ -const defaultUsages = ['encrypt', 'decrypt']; - -/** - * Note that the max data size is limited by the size of the RSA key. - * - * @param {CryptoKey} key - * @param {Uint8Array} data - * @return {PromiseLike>} - */ -const encrypt = (key, data) => - webcrypto__namespace.subtle.encrypt( - { - name: 'RSA-OAEP' - }, - key, - data - ).then(buf => new Uint8Array(buf)); - -/** - * @experimental The API is not final! - * - * Decrypt some data using AES-GCM method. - * - * @param {CryptoKey} key - * @param {Uint8Array} data - * @return {PromiseLike} decrypted buffer - */ -const decrypt = (key, data) => - webcrypto__namespace.subtle.decrypt( - { - name: 'RSA-OAEP' - }, - key, - data - ).then(data => new Uint8Array(data)); - -/** - * @param {Object} opts - * @param {boolean} [opts.extractable] - * @param {Usages} [opts.usages] - * @return {Promise} - */ -const generateKeyPair = ({ extractable = false, usages = defaultUsages } = {}) => - webcrypto__namespace.subtle.generateKey( - { - name: 'RSA-OAEP', - modulusLength: 4096, - publicExponent: new Uint8Array([1, 0, 1]), - hash: 'SHA-256' - }, - extractable, - usages - ); - -/** - * @param {any} jwk - * @param {Object} opts - * @param {boolean} [opts.extractable] - * @param {Usages} [opts.usages] - */ -const importKeyJwk = (jwk, { extractable = false, usages } = {}) => { - if (usages == null) { - /* c8 ignore next */ - usages = jwk.key_ops || defaultUsages; - } - return webcrypto__namespace.subtle.importKey('jwk', jwk, { name: 'RSA-OAEP', hash: 'SHA-256' }, extractable, /** @type {Usages} */ (usages)) -}; - -exports.exportKeyJwk = common.exportKeyJwk; -exports.decrypt = decrypt; -exports.encrypt = encrypt; -exports.generateKeyPair = generateKeyPair; -exports.importKeyJwk = importKeyJwk; -//# sourceMappingURL=rsa-oaep.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/rsa-oaep.cjs.map b/yjs-poll/node_modules/lib0/dist/rsa-oaep.cjs.map deleted file mode 100644 index 8e38d85..0000000 --- a/yjs-poll/node_modules/lib0/dist/rsa-oaep.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rsa-oaep.cjs","sources":["../crypto/rsa-oaep.js"],"sourcesContent":["/**\n * RSA-OAEP is an asymmetric keypair used for encryption\n */\n\nimport * as webcrypto from 'lib0/webcrypto'\nexport { exportKeyJwk } from './common.js'\n\n/**\n * @typedef {Array<'encrypt'|'decrypt'>} Usages\n */\n\n/**\n * @type {Usages}\n */\nconst defaultUsages = ['encrypt', 'decrypt']\n\n/**\n * Note that the max data size is limited by the size of the RSA key.\n *\n * @param {CryptoKey} key\n * @param {Uint8Array} data\n * @return {PromiseLike>}\n */\nexport const encrypt = (key, data) =>\n webcrypto.subtle.encrypt(\n {\n name: 'RSA-OAEP'\n },\n key,\n data\n ).then(buf => new Uint8Array(buf))\n\n/**\n * @experimental The API is not final!\n *\n * Decrypt some data using AES-GCM method.\n *\n * @param {CryptoKey} key\n * @param {Uint8Array} data\n * @return {PromiseLike} decrypted buffer\n */\nexport const decrypt = (key, data) =>\n webcrypto.subtle.decrypt(\n {\n name: 'RSA-OAEP'\n },\n key,\n data\n ).then(data => new Uint8Array(data))\n\n/**\n * @param {Object} opts\n * @param {boolean} [opts.extractable]\n * @param {Usages} [opts.usages]\n * @return {Promise}\n */\nexport const generateKeyPair = ({ extractable = false, usages = defaultUsages } = {}) =>\n webcrypto.subtle.generateKey(\n {\n name: 'RSA-OAEP',\n modulusLength: 4096,\n publicExponent: new Uint8Array([1, 0, 1]),\n hash: 'SHA-256'\n },\n extractable,\n usages\n )\n\n/**\n * @param {any} jwk\n * @param {Object} opts\n * @param {boolean} [opts.extractable]\n * @param {Usages} [opts.usages]\n */\nexport const importKeyJwk = (jwk, { extractable = false, usages } = {}) => {\n if (usages == null) {\n /* c8 ignore next */\n usages = jwk.key_ops || defaultUsages\n }\n return webcrypto.subtle.importKey('jwk', jwk, { name: 'RSA-OAEP', hash: 'SHA-256' }, extractable, /** @type {Usages} */ (usages))\n}\n"],"names":["webcrypto"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,aAAa,GAAG,CAAC,SAAS,EAAE,SAAS,EAAC;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,OAAO,GAAG,CAAC,GAAG,EAAE,IAAI;AACjC,EAAEA,oBAAS,CAAC,MAAM,CAAC,OAAO;AAC1B,IAAI;AACJ,MAAM,IAAI,EAAE,UAAU;AACtB,KAAK;AACL,IAAI,GAAG;AACP,IAAI,IAAI;AAC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;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/schema.cjs b/yjs-poll/node_modules/lib0/dist/schema.cjs deleted file mode 100644 index c430c70..0000000 --- a/yjs-poll/node_modules/lib0/dist/schema.cjs +++ /dev/null @@ -1,1223 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var object = require('./object-c0c9435b.cjs'); -var array = require('./array-78849c95.cjs'); -var error = require('./error-0c1f634f.cjs'); -var environment = require('./environment-1c97264d.cjs'); -var equality = require('./equality.cjs'); -var _function = require('./function-314580f7.cjs'); -var string = require('./string-fddc5f8b.cjs'); -var prng = require('./prng-37d48618.cjs'); -var number = require('./number-1fb57bba.cjs'); -require('./set-5b47859e.cjs'); -require('./map-24d263c0.cjs'); -require('./conditions-f5c0c102.cjs'); -require('./storage.cjs'); -require('./binary-ac8e39e2.cjs'); -require('./math-96d5e8c4.cjs'); -require('./buffer-3e750729.cjs'); -require('./encoding-1a745c43.cjs'); -require('./decoding-76e75827.cjs'); - -/** - * @experimental WIP - * - * Simple & efficient schemas for your data. - */ - -/** - * @typedef {string|number|bigint|boolean|null|undefined|symbol} Primitive - */ - -/** - * @typedef {{ [k:string|number|symbol]: any }} AnyObject - */ - -/** - * @template T - * @typedef {T extends Schema ? X : T} Unwrap - */ - -/** - * @template T - * @typedef {T extends Schema ? X : T} TypeOf - */ - -/** - * @template {readonly unknown[]} T - * @typedef {T extends readonly [Schema, ...infer Rest] ? [First, ...UnwrapArray] : [] } UnwrapArray - */ - -/** - * @template T - * @typedef {T extends Schema ? Schema : never} CastToSchema - */ - -/** - * @template {unknown[]} Arr - * @typedef {Arr extends [...unknown[], infer L] ? L : never} TupleLast - */ - -/** - * @template {unknown[]} Arr - * @typedef {Arr extends [...infer Fs, unknown] ? Fs : never} TuplePop - */ - -/** - * @template {readonly unknown[]} T - * @typedef {T extends [] - * ? {} - * : T extends [infer First] - * ? First - * : T extends [infer First, ...infer Rest] - * ? First & Intersect - * : never - * } Intersect - */ - -const schemaSymbol = Symbol('0schema'); - -class ValidationError { - constructor () { - /** - * Reverse errors - * @type {Array<{ path: string?, expected: string, has: string, message: string? }>} - */ - this._rerrs = []; - } - - /** - * @param {string?} path - * @param {string} expected - * @param {string} has - * @param {string?} message - */ - extend (path, expected, has, message = null) { - this._rerrs.push({ path, expected, has, message }); - } - - toString () { - const s = []; - for (let i = this._rerrs.length - 1; i > 0; i--) { - const r = this._rerrs[i]; - /* c8 ignore next */ - s.push(string.repeat(' ', (this._rerrs.length - i) * 2) + `${r.path != null ? `[${r.path}] ` : ''}${r.has} doesn't match ${r.expected}. ${r.message}`); - } - return s.join('\n') - } -} - -/** - * @param {any} a - * @param {any} b - * @return {boolean} - */ -const shapeExtends = (a, b) => { - if (a === b) return true - if (a == null || b == null || a.constructor !== b.constructor) return false - if (a[equality.EqualityTraitSymbol]) return equality.equals(a, b) // last resort: check equality (do this before array and obj check which don't implement the equality trait) - if (array.isArray(a)) { - return array.every(a, aitem => - array.some(b, bitem => shapeExtends(aitem, bitem)) - ) - } else if (object.isObject(a)) { - return object.every(a, (aitem, akey) => - shapeExtends(aitem, b[akey]) - ) - } - /* c8 ignore next */ - return false -}; - -/** - * @template T - * @implements {equalityTraits.EqualityTrait} - */ -class Schema { - // this.shape must not be defined on Schema. Otherwise typecheck on metatypes (e.g. $$object) won't work as expected anymore - /** - * If true, the more things are added to the shape the more objects this schema will accept (e.g. - * union). By default, the more objects are added, the the fewer objects this schema will accept. - * @protected - */ - static _dilutes = false - - /** - * @param {Schema} other - */ - extends (other) { - let [a, b] = [/** @type {any} */(this).shape, /** @type {any} */ (other).shape]; - if (/** @type {typeof Schema} */ (this.constructor)._dilutes) [b, a] = [a, b]; - return shapeExtends(a, b) - } - - /** - * Overwrite this when necessary. By default, we only check the `shape` property which every shape - * should have. - * @param {Schema} other - */ - equals (other) { - // @ts-ignore - return this.constructor === other.constructor && _function.equalityDeep(this.shape, other.shape) - } - - [schemaSymbol] () { return true } - - /** - * @param {object} other - */ - [equality.EqualityTraitSymbol] (other) { - return this.equals(/** @type {any} */ (other)) - } - - /** - * Use `schema.validate(obj)` with a typed parameter that is already of typed to be an instance of - * Schema. Validate will check the structure of the parameter and return true iff the instance - * really is an instance of Schema. - * - * @param {T} o - * @return {boolean} - */ - validate (o) { - return this.check(o) - } - - /* c8 ignore start */ - /** - * Similar to validate, but this method accepts untyped parameters. - * - * @param {any} _o - * @param {ValidationError} [_err] - * @return {_o is T} - */ - check (_o, _err) { - error.methodUnimplemented(); - } - /* c8 ignore stop */ - - /** - * @type {Schema} - */ - get nullable () { - // @ts-ignore - return $union(this, $null) - } - - /** - * @type {$Optional>} - */ - get optional () { - return new $Optional(/** @type {Schema} */ (this)) - } - - /** - * Cast a variable to a specific type. Returns the casted value, or throws an exception otherwise. - * Use this if you know that the type is of a specific type and you just want to convince the type - * system. - * - * **Do not rely on these error messages!** - * Performs an assertion check only if not in a production environment. - * - * @template OO - * @param {OO} o - * @return {Extract extends never ? T : (OO extends Array ? T : Extract)} - */ - cast (o) { - assert(o, this); - return /** @type {any} */ (o) - } - - /** - * EXPECTO PATRONUM!! 🪄 - * This function protects against type errors. Though it may not work in the real world. - * - * "After all this time?" - * "Always." - Snape, talking about type safety - * - * Ensures that a variable is a a specific type. Returns the value, or throws an exception if the assertion check failed. - * Use this if you know that the type is of a specific type and you just want to convince the type - * system. - * - * Can be useful when defining lambdas: `s.lambda(s.$number, s.$void).expect((n) => n + 1)` - * - * **Do not rely on these error messages!** - * Performs an assertion check if not in a production environment. - * - * @param {T} o - * @return {o extends T ? T : never} - */ - expect (o) { - assert(o, this); - return o - } -} - -/** - * @template {(new (...args:any[]) => any) | ((...args:any[]) => any)} Constr - * @typedef {Constr extends ((...args:any[]) => infer T) ? T : (Constr extends (new (...args:any[]) => any) ? InstanceType : never)} Instance - */ - -/** - * @template {(new (...args:any[]) => any) | ((...args:any[]) => any)} C - * @extends {Schema>} - */ -class $ConstructedBy extends Schema { - /** - * @param {C} c - * @param {((o:Instance)=>boolean)|null} check - */ - constructor (c, check) { - super(); - this.shape = c; - this._c = check; - } - - /** - * @param {any} o - * @param {ValidationError} [err] - * @return {o is C extends ((...args:any[]) => infer T) ? T : (C extends (new (...args:any[]) => any) ? InstanceType : never)} o - */ - check (o, err = undefined) { - const c = o?.constructor === this.shape && (this._c == null || this._c(o)); - /* c8 ignore next */ - !c && err?.extend(null, this.shape.name, o?.constructor.name, o?.constructor !== this.shape ? 'Constructor match failed' : 'Check failed'); - return c - } -} - -/** - * @template {(new (...args:any[]) => any) | ((...args:any[]) => any)} C - * @param {C} c - * @param {((o:Instance) => boolean)|null} check - * @return {CastToSchema<$ConstructedBy>} - */ -const $constructedBy = (c, check = null) => new $ConstructedBy(c, check); -const $$constructedBy = $constructedBy($ConstructedBy); - -/** - * Check custom properties on any object. You may want to overwrite the generated Schema. - * - * @extends {Schema} - */ -class $Custom extends Schema { - /** - * @param {(o:any) => boolean} check - */ - constructor (check) { - super(); - /** - * @type {(o:any) => boolean} - */ - this.shape = check; - } - - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is any} - */ - check (o, err) { - const c = this.shape(o); - /* c8 ignore next */ - !c && err?.extend(null, 'custom prop', o?.constructor.name, 'failed to check custom prop'); - return c - } -} - -/** - * @param {(o:any) => boolean} check - * @return {Schema} - */ -const $custom = (check) => new $Custom(check); -const $$custom = $constructedBy($Custom); - -/** - * @template {Primitive} T - * @extends {Schema} - */ -class $Literal extends Schema { - /** - * @param {Array} literals - */ - constructor (literals) { - super(); - this.shape = literals; - } - - /** - * - * @param {any} o - * @param {ValidationError} [err] - * @return {o is T} - */ - check (o, err) { - const c = this.shape.some(a => a === o); - /* c8 ignore next */ - !c && err?.extend(null, this.shape.join(' | '), o.toString()); - return c - } -} - -/** - * @template {Primitive[]} T - * @param {T} literals - * @return {CastToSchema<$Literal>} - */ -const $literal = (...literals) => new $Literal(literals); -const $$literal = $constructedBy($Literal); - -/** - * @template {Array>} Ts - * @typedef {Ts extends [] ? `` : (Ts extends [infer T] ? (Unwrap extends (string|number) ? Unwrap : never) : (Ts extends [infer T1, ...infer Rest] ? `${Unwrap extends (string|number) ? Unwrap : never}${Rest extends Array> ? CastStringTemplateArgsToTemplate : never}` : never))} CastStringTemplateArgsToTemplate - */ - -/** - * @param {string} str - * @return {string} - */ -const _regexEscape = /** @type {any} */ (RegExp).escape || /** @type {(str:string) => string} */ (str => - str.replace(/[().|&,$^[\]]/g, s => '\\' + s) -); - -/** - * @param {string|Schema} s - * @return {string[]} - */ -const _schemaStringTemplateToRegex = s => { - if ($string.check(s)) { - return [_regexEscape(s)] - } - if ($$literal.check(s)) { - return /** @type {Array} */ (s.shape).map(v => v + '') - } - if ($$number.check(s)) { - return ['[+-]?\\d+.?\\d*'] - } - if ($$string.check(s)) { - return ['.*'] - } - if ($$union.check(s)) { - return s.shape.map(_schemaStringTemplateToRegex).flat(1) - } - /* c8 ignore next 2 */ - // unexpected schema structure (only supports unions and string in literal types) - error.unexpectedCase(); -}; - -/** - * @template {Array>} T - * @extends {Schema>} - */ -class $StringTemplate extends Schema { - /** - * @param {T} shape - */ - constructor (shape) { - super(); - this.shape = shape; - this._r = new RegExp('^' + shape.map(_schemaStringTemplateToRegex).map(opts => `(${opts.join('|')})`).join('') + '$'); - } - - /** - * @param {any} o - * @param {ValidationError} [err] - * @return {o is CastStringTemplateArgsToTemplate} - */ - check (o, err) { - const c = this._r.exec(o) != null; - /* c8 ignore next */ - !c && err?.extend(null, this._r.toString(), o.toString(), 'String doesn\'t match string template.'); - return c - } -} - -/** - * @template {Array>} T - * @param {T} literals - * @return {CastToSchema<$StringTemplate>} - */ -const $stringTemplate = (...literals) => new $StringTemplate(literals); -const $$stringTemplate = $constructedBy($StringTemplate); - -const isOptionalSymbol = Symbol('optional'); -/** - * @template {Schema} S - * @extends Schema|undefined> - */ -class $Optional extends Schema { - /** - * @param {S} shape - */ - constructor (shape) { - super(); - this.shape = shape; - } - - /** - * @param {any} o - * @param {ValidationError} [err] - * @return {o is (Unwrap|undefined)} - */ - check (o, err) { - const c = o === undefined || this.shape.check(o); - /* c8 ignore next */ - !c && err?.extend(null, 'undefined (optional)', '()'); - return c - } - - get [isOptionalSymbol] () { return true } -} -const $$optional = $constructedBy($Optional); - -/** - * @extends Schema - */ -class $Never extends Schema { - /** - * @param {any} _o - * @param {ValidationError} [err] - * @return {_o is never} - */ - check (_o, err) { - /* c8 ignore next */ - err?.extend(null, 'never', typeof _o); - return false - } -} - -/** - * @type {Schema} - */ -const $never = new $Never(); -const $$never = $constructedBy($Never); - -/** - * @template {{ [key: string|symbol|number]: Schema }} S - * @typedef {{ [Key in keyof S as S[Key] extends $Optional> ? Key : never]?: S[Key] extends $Optional> ? Type : never } & { [Key in keyof S as S[Key] extends $Optional> ? never : Key]: S[Key] extends Schema ? Type : never }} $ObjectToType - */ - -/** - * @template {{[key:string|symbol|number]: Schema}} S - * @extends {Schema<$ObjectToType>} - */ -class $Object extends Schema { - /** - * @param {S} shape - * @param {boolean} partial - */ - constructor (shape, partial = false) { - super(); - /** - * @type {S} - */ - this.shape = shape; - this._isPartial = partial; - } - - static _dilutes = true - - /** - * @type {Schema>>} - */ - get partial () { - return new $Object(this.shape, true) - } - - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is $ObjectToType} - */ - check (o, err) { - if (o == null) { - /* c8 ignore next */ - err?.extend(null, 'object', 'null'); - return false - } - return object.every(this.shape, (vv, vk) => { - const c = (this._isPartial && !object.hasProperty(o, vk)) || vv.check(o[vk], err); - !c && err?.extend(vk.toString(), vv.toString(), typeof o[vk], 'Object property does not match'); - return c - }) - } -} - -/** - * @template S - * @typedef {Schema<{ [Key in keyof S as S[Key] extends $Optional> ? Key : never]?: S[Key] extends $Optional> ? Type : never } & { [Key in keyof S as S[Key] extends $Optional> ? never : Key]: S[Key] extends Schema ? Type : never }>} _ObjectDefToSchema - */ - -// I used an explicit type annotation instead of $ObjectToType, so that the user doesn't see the -// weird type definitions when inspecting type definions. -/** - * @template {{ [key:string|symbol|number]: Schema }} S - * @param {S} def - * @return {_ObjectDefToSchema extends Schema ? Schema<{ [K in keyof S]: S[K] }> : never} - */ -const $object = def => /** @type {any} */ (new $Object(def)); -const $$object = $constructedBy($Object); -/** - * @type {Schema<{[key:string]: any}>} - */ -const $objectAny = $custom(o => o != null && (o.constructor === Object || o.constructor == null)); - -/** - * @template {Schema} Keys - * @template {Schema} Values - * @extends {Schema<{ [key in Unwrap]: Unwrap }>} - */ -class $Record extends Schema { - /** - * @param {Keys} keys - * @param {Values} values - */ - constructor (keys, values) { - super(); - this.shape = { - keys, values - }; - } - - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is { [key in Unwrap]: Unwrap }} - */ - check (o, err) { - return o != null && object.every(o, (vv, vk) => { - const ck = this.shape.keys.check(vk, err); - /* c8 ignore next */ - !ck && err?.extend(vk + '', 'Record', typeof o, ck ? 'Key doesn\'t match schema' : 'Value doesn\'t match value'); - return ck && this.shape.values.check(vv, err) - }) - } -} - -/** - * @template {Schema} Keys - * @template {Schema} Values - * @param {Keys} keys - * @param {Values} values - * @return {CastToSchema<$Record>} - */ -const $record = (keys, values) => new $Record(keys, values); -const $$record = $constructedBy($Record); - -/** - * @template {Schema[]} S - * @extends {Schema<{ [Key in keyof S]: S[Key] extends Schema ? Type : never }>} - */ -class $Tuple extends Schema { - /** - * @param {S} shape - */ - constructor (shape) { - super(); - this.shape = shape; - } - - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is { [K in keyof S]: S[K] extends Schema ? Type : never }} - */ - check (o, err) { - return o != null && object.every(this.shape, (vv, vk) => { - const c = /** @type {Schema} */ (vv).check(o[vk], err); - /* c8 ignore next */ - !c && err?.extend(vk.toString(), 'Tuple', typeof vv); - return c - }) - } -} - -/** - * @template {Array>} T - * @param {T} def - * @return {CastToSchema<$Tuple>} - */ -const $tuple = (...def) => new $Tuple(def); -const $$tuple = $constructedBy($Tuple); - -/** - * @template {Schema} S - * @extends {Schema ? T : never>>} - */ -class $Array extends Schema { - /** - * @param {Array} v - */ - constructor (v) { - super(); - /** - * @type {Schema ? T : never>} - */ - this.shape = v.length === 1 ? v[0] : new $Union(v); - } - - /** - * @param {any} o - * @param {ValidationError} [err] - * @return {o is Array ? T : never>} o - */ - check (o, err) { - const c = array.isArray(o) && array.every(o, oi => this.shape.check(oi)); - /* c8 ignore next */ - !c && err?.extend(null, 'Array', ''); - return c - } -} - -/** - * @template {Array>} T - * @param {T} def - * @return {Schema> ? S : never>>} - */ -const $array = (...def) => new $Array(def); -const $$array = $constructedBy($Array); -/** - * @type {Schema>} - */ -const $arrayAny = $custom(o => array.isArray(o)); - -/** - * @template T - * @extends {Schema} - */ -class $InstanceOf extends Schema { - /** - * @param {new (...args:any) => T} constructor - * @param {((o:T) => boolean)|null} check - */ - constructor (constructor, check) { - super(); - this.shape = constructor; - this._c = check; - } - - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is T} - */ - check (o, err) { - const c = o instanceof this.shape && (this._c == null || this._c(o)); - /* c8 ignore next */ - !c && err?.extend(null, this.shape.name, o?.constructor.name); - return c - } -} - -/** - * @template T - * @param {new (...args:any) => T} c - * @param {((o:T) => boolean)|null} check - * @return {Schema} - */ -const $instanceOf = (c, check = null) => new $InstanceOf(c, check); -const $$instanceOf = $constructedBy($InstanceOf); - -const $$schema = $instanceOf(Schema); - -/** - * @template {Schema[]} Args - * @typedef {(...args:UnwrapArray>)=>Unwrap>} _LArgsToLambdaDef - */ - -/** - * @template {Array>} Args - * @extends {Schema<_LArgsToLambdaDef>} - */ -class $Lambda extends Schema { - /** - * @param {Args} args - */ - constructor (args) { - super(); - this.len = args.length - 1; - this.args = $tuple(...args.slice(-1)); - this.res = args[this.len]; - } - - /** - * @param {any} f - * @param {ValidationError} err - * @return {f is _LArgsToLambdaDef} - */ - check (f, err) { - const c = f.constructor === Function && f.length <= this.len; - /* c8 ignore next */ - !c && err?.extend(null, 'function', typeof f); - return c - } -} - -/** - * @template {Schema[]} Args - * @param {Args} args - * @return {Schema<(...args:UnwrapArray>)=>Unwrap>>} - */ -const $lambda = (...args) => new $Lambda(args.length > 0 ? args : [$void]); -const $$lambda = $constructedBy($Lambda); - -/** - * @type {Schema} - */ -const $function = $custom(o => typeof o === 'function'); - -/** - * @template {Array>} T - * @extends {Schema>>} - */ -class $Intersection extends Schema { - /** - * @param {T} v - */ - constructor (v) { - super(); - /** - * @type {T} - */ - this.shape = v; - } - - /** - * @param {any} o - * @param {ValidationError} [err] - * @return {o is Intersect>} - */ - check (o, err) { - // @ts-ignore - const c = array.every(this.shape, check => check.check(o, err)); - /* c8 ignore next */ - !c && err?.extend(null, 'Intersectinon', typeof o); - return c - } -} - -/** - * @template {Schema[]} T - * @param {T} def - * @return {CastToSchema<$Intersection>} - */ -const $intersect = (...def) => new $Intersection(def); -const $$intersect = $constructedBy($Intersection, o => o.shape.length > 0); // Intersection with length=0 is considered "any" - -/** - * @template S - * @extends {Schema} - */ -class $Union extends Schema { - static _dilutes = true - - /** - * @param {Array>} v - */ - constructor (v) { - super(); - this.shape = v; - } - - /** - * @param {any} o - * @param {ValidationError} [err] - * @return {o is S} - */ - check (o, err) { - const c = array.some(this.shape, (vv) => vv.check(o, err)); - err?.extend(null, 'Union', typeof o); - return c - } -} - -/** - * @template {Array} T - * @param {T} schemas - * @return {CastToSchema<$Union>>>} - */ -const $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)); -const $$union = /** @type {Schema<$Union>} */ ($constructedBy($Union)); - -const _t = () => true; -/** - * @type {Schema} - */ -const $any = $custom(_t); -const $$any = /** @type {Schema>} */ ($constructedBy($Custom, o => o.shape === _t)); - -/** - * @type {Schema} - */ -const $bigint = $custom(o => typeof o === 'bigint'); -const $$bigint = /** @type {Schema>} */ ($custom(o => o === $bigint)); - -/** - * @type {Schema} - */ -const $symbol = $custom(o => typeof o === 'symbol'); -const $$symbol = /** @type {Schema>} */ ($custom(o => o === $symbol)); - -/** - * @type {Schema} - */ -const $number = $custom(o => typeof o === 'number'); -const $$number = /** @type {Schema>} */ ($custom(o => o === $number)); - -/** - * @type {Schema} - */ -const $string = $custom(o => typeof o === 'string'); -const $$string = /** @type {Schema>} */ ($custom(o => o === $string)); - -/** - * @type {Schema} - */ -const $boolean = $custom(o => typeof o === 'boolean'); -const $$boolean = /** @type {Schema>} */ ($custom(o => o === $boolean)); - -/** - * @type {Schema} - */ -const $undefined = $literal(undefined); -const $$undefined = /** @type {Schema>} */ ($constructedBy($Literal, o => o.shape.length === 1 && o.shape[0] === undefined)); - -/** - * @type {Schema} - */ -const $void = $literal(undefined); -const $$void = /** @type {Schema>} */ ($$undefined); - -const $null = $literal(null); -const $$null = /** @type {Schema>} */ ($constructedBy($Literal, o => o.shape.length === 1 && o.shape[0] === null)); - -const $uint8Array = $constructedBy(Uint8Array); -const $$uint8Array = /** @type {Schema>} */ ($constructedBy($ConstructedBy, o => o.shape === Uint8Array)); - -/** - * @type {Schema} - */ -const $primitive = $union($number, $string, $null, $undefined, $bigint, $boolean, $symbol); - -/** - * @typedef {JSON[]} JSONArray - */ -/** - * @typedef {Primitive|JSONArray|{ [key:string]:JSON }} JSON - */ -/** - * @type {Schema} - */ -const $json = (() => { - const $jsonArr = /** @type {$Array<$any>} */ ($array($any)); - const $jsonRecord = /** @type {$Record<$string,$any>} */ ($record($string, $any)); - const $json = $union($number, $string, $null, $boolean, $jsonArr, $jsonRecord); - $jsonArr.shape = $json; - $jsonRecord.shape.values = $json; - return $json -})(); - -/** - * @template {any} IN - * @typedef {IN extends Schema ? IN - * : (IN extends string|number|boolean|null ? Schema - * : (IN extends new (...args:any[])=>any ? Schema> - * : (IN extends any[] ? Schema<{ [K in keyof IN]: Unwrap> }[number]> - * : (IN extends object ? (_ObjectDefToSchema<{[K in keyof IN]:ReadSchema}> extends Schema ? Schema<{ [K in keyof S]: S[K] }> : never) - * : never) - * ) - * ) - * ) - * } ReadSchemaOld - */ - -/** - * @template {any} IN - * @typedef {[Extract>,Extract,Extractany>,Extract,Extract|string|number|boolean|null|(new (...args:any[])=>any)|any[]>,object>] extends [infer Schemas, infer Primitives, infer Constructors, infer Arrs, infer Obj] - * ? Schema< - * (Schemas extends Schema ? S : never) - * | Primitives - * | (Constructors extends new (...args:any[])=>any ? InstanceType : never) - * | (Arrs extends any[] ? { [K in keyof Arrs]: Unwrap> }[number] : never) - * | (Obj extends object ? Unwrap<(_ObjectDefToSchema<{[K in keyof Obj]:ReadSchema}> extends Schema ? Schema<{ [K in keyof S]: S[K] }> : never)> : never)> - * : never - * } ReadSchema - */ - -/** - * @typedef {ReadSchema<{x:42}|{y:99}|Schema|[1,2,{}]>} Q - */ - -/** - * @template IN - * @param {IN} o - * @return {ReadSchema} - */ -const $ = o => { - if ($$schema.check(o)) { - return /** @type {any} */ (o) - } else if ($objectAny.check(o)) { - /** - * @type {any} - */ - const o2 = {}; - for (const k in o) { - o2[k] = $(o[k]); - } - return /** @type {any} */ ($object(o2)) - } else if ($arrayAny.check(o)) { - return /** @type {any} */ ($union(...o.map($))) - } else if ($primitive.check(o)) { - return /** @type {any} */ ($literal(o)) - } else if ($function.check(o)) { - return /** @type {any} */ ($constructedBy(/** @type {any} */ (o))) - } - /* c8 ignore next */ - error.unexpectedCase(); -}; - -/* c8 ignore start */ -/** - * Assert that a variable is of this specific type. - * The assertion check is only performed in non-production environments. - * - * @type {(o:any,schema:Schema) => asserts o is T} - */ -const assert = environment.production - ? () => {} - : (o, schema) => { - const err = new ValidationError(); - if (!schema.check(o, err)) { - throw error.create(`Expected value to be of type ${schema.constructor.name}.\n${err.toString()}`) - } - }; -/* c8 ignore end */ - -/** - * @template In - * @template Out - * @typedef {{ if: Schema, h: (o:In,state?:any)=>Out }} Pattern - */ - -/** - * @template {Pattern} P - * @template In - * @typedef {ReturnType>['h']>} PatternMatchResult - */ - -/** - * @todo move this to separate library - * @template {any} [State=undefined] - * @template {Pattern} [Patterns=never] - */ -class PatternMatcher { - /** - * @param {Schema} [$state] - */ - constructor ($state) { - /** - * @type {Array} - */ - this.patterns = []; - this.$state = $state; - } - - /** - * @template P - * @template R - * @param {P} pattern - * @param {(o:NoInfer>>,s:State)=>R} handler - * @return {PatternMatcher>,R>>} - */ - if (pattern, handler) { - // @ts-ignore - this.patterns.push({ if: $(pattern), h: handler }); - // @ts-ignore - return this - } - - /** - * @template R - * @param {(o:any,s:State)=>R} h - */ - else (h) { - return this.if($any, h) - } - - /** - * @return {State extends undefined - * ? >(o:In,state?:undefined)=>PatternMatchResult - * : >(o:In,state:State)=>PatternMatchResult} - */ - done () { - // @ts-ignore - return /** @type {any} */ (o, s) => { - for (let i = 0; i < this.patterns.length; i++) { - const p = this.patterns[i]; - if (p.if.check(o)) { - // @ts-ignore - return p.h(o, s) - } - } - throw error.create('Unhandled pattern') - } - } -} - -/** - * @template [State=undefined] - * @param {State} [state] - * @return {PatternMatcher>>} - */ -const match = state => new PatternMatcher(/** @type {any} */ (state)); - -/** - * Helper function to generate a (non-exhaustive) sample set from a gives schema. - * - * @type {(o:T,gen:prng.PRNG)=>T} - */ -const _random = /** @type {any} */ (match(/** @type {Schema} */ ($any)) - .if($$number, (_o, gen) => prng.int53(gen, number.MIN_SAFE_INTEGER, number.MAX_SAFE_INTEGER)) - .if($$string, (_o, gen) => prng.word(gen)) - .if($$boolean, (_o, gen) => prng.bool(gen)) - .if($$bigint, (_o, gen) => BigInt(prng.int53(gen, number.MIN_SAFE_INTEGER, number.MAX_SAFE_INTEGER))) - .if($$union, (o, gen) => random(gen, prng.oneOf(gen, o.shape))) - .if($$object, (o, gen) => { - /** - * @type {any} - */ - const res = {}; - for (const k in o.shape) { - let prop = o.shape[k]; - if ($$optional.check(prop)) { - if (prng.bool(gen)) { continue } - prop = prop.shape; - } - res[k] = _random(prop, gen); - } - return res - }) - .if($$array, (o, gen) => { - const arr = []; - const n = prng.int32(gen, 0, 42); - for (let i = 0; i < n; i++) { - arr.push(random(gen, o.shape)); - } - return arr - }) - .if($$literal, (o, gen) => { - return prng.oneOf(gen, o.shape) - }) - .if($$null, (o, gen) => { - return null - }) - .if($$lambda, (o, gen) => { - const res = random(gen, o.res); - return () => res - }) - .if($$any, (o, gen) => random(gen, prng.oneOf(gen, [ - $number, $string, $null, $undefined, $bigint, $boolean, - $array($number), - $record($union('a', 'b', 'c'), $number) - ]))) - .if($$record, (o, gen) => { - /** - * @type {any} - */ - const res = {}; - const keysN = prng.int53(gen, 0, 3); - for (let i = 0; i < keysN; i++) { - const key = random(gen, o.shape.keys); - const val = random(gen, o.shape.values); - res[key] = val; - } - return res - }) - .done()); - -/** - * @template S - * @param {prng.PRNG} gen - * @param {S} schema - * @return {Unwrap>} - */ -const random = (gen, schema) => /** @type {any} */ (_random($(schema), gen)); - -exports.$ = $; -exports.$$any = $$any; -exports.$$array = $$array; -exports.$$bigint = $$bigint; -exports.$$boolean = $$boolean; -exports.$$constructedBy = $$constructedBy; -exports.$$custom = $$custom; -exports.$$instanceOf = $$instanceOf; -exports.$$intersect = $$intersect; -exports.$$lambda = $$lambda; -exports.$$literal = $$literal; -exports.$$never = $$never; -exports.$$null = $$null; -exports.$$number = $$number; -exports.$$object = $$object; -exports.$$optional = $$optional; -exports.$$record = $$record; -exports.$$schema = $$schema; -exports.$$string = $$string; -exports.$$stringTemplate = $$stringTemplate; -exports.$$symbol = $$symbol; -exports.$$tuple = $$tuple; -exports.$$uint8Array = $$uint8Array; -exports.$$undefined = $$undefined; -exports.$$union = $$union; -exports.$$void = $$void; -exports.$Array = $Array; -exports.$ConstructedBy = $ConstructedBy; -exports.$Custom = $Custom; -exports.$InstanceOf = $InstanceOf; -exports.$Intersection = $Intersection; -exports.$Lambda = $Lambda; -exports.$Literal = $Literal; -exports.$Object = $Object; -exports.$Record = $Record; -exports.$StringTemplate = $StringTemplate; -exports.$Tuple = $Tuple; -exports.$Union = $Union; -exports.$any = $any; -exports.$array = $array; -exports.$arrayAny = $arrayAny; -exports.$bigint = $bigint; -exports.$boolean = $boolean; -exports.$constructedBy = $constructedBy; -exports.$custom = $custom; -exports.$function = $function; -exports.$instanceOf = $instanceOf; -exports.$intersect = $intersect; -exports.$json = $json; -exports.$lambda = $lambda; -exports.$literal = $literal; -exports.$never = $never; -exports.$null = $null; -exports.$number = $number; -exports.$object = $object; -exports.$objectAny = $objectAny; -exports.$primitive = $primitive; -exports.$record = $record; -exports.$string = $string; -exports.$stringTemplate = $stringTemplate; -exports.$symbol = $symbol; -exports.$tuple = $tuple; -exports.$uint8Array = $uint8Array; -exports.$undefined = $undefined; -exports.$union = $union; -exports.$void = $void; -exports.PatternMatcher = PatternMatcher; -exports.Schema = Schema; -exports.ValidationError = ValidationError; -exports.assert = assert; -exports.match = match; -exports.random = random; -//# sourceMappingURL=schema.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/schema.cjs.map b/yjs-poll/node_modules/lib0/dist/schema.cjs.map deleted file mode 100644 index 7699c65..0000000 --- a/yjs-poll/node_modules/lib0/dist/schema.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"schema.cjs","sources":["../schema.js"],"sourcesContent":["/**\n * @experimental WIP\n *\n * Simple & efficient schemas for your data.\n */\n\nimport * as obj from './object.js'\nimport * as arr from './array.js'\nimport * as error from './error.js'\nimport * as env from './environment.js'\nimport * as equalityTraits from './trait/equality.js'\nimport * as fun from './function.js'\nimport * as string from './string.js'\nimport * as prng from './prng.js'\nimport * as number from './number.js'\n\n/**\n * @typedef {string|number|bigint|boolean|null|undefined|symbol} Primitive\n */\n\n/**\n * @typedef {{ [k:string|number|symbol]: any }} AnyObject\n */\n\n/**\n * @template T\n * @typedef {T extends Schema ? X : T} Unwrap\n */\n\n/**\n * @template T\n * @typedef {T extends Schema ? X : T} TypeOf\n */\n\n/**\n * @template {readonly unknown[]} T\n * @typedef {T extends readonly [Schema, ...infer Rest] ? [First, ...UnwrapArray] : [] } UnwrapArray\n */\n\n/**\n * @template T\n * @typedef {T extends Schema ? Schema : never} CastToSchema\n */\n\n/**\n * @template {unknown[]} Arr\n * @typedef {Arr extends [...unknown[], infer L] ? L : never} TupleLast\n */\n\n/**\n * @template {unknown[]} Arr\n * @typedef {Arr extends [...infer Fs, unknown] ? Fs : never} TuplePop\n */\n\n/**\n * @template {readonly unknown[]} T\n * @typedef {T extends []\n * ? {}\n * : T extends [infer First]\n * ? First\n * : T extends [infer First, ...infer Rest]\n * ? First & Intersect\n * : never\n * } Intersect\n */\n\nconst schemaSymbol = Symbol('0schema')\n\nexport class ValidationError {\n constructor () {\n /**\n * Reverse errors\n * @type {Array<{ path: string?, expected: string, has: string, message: string? }>}\n */\n this._rerrs = []\n }\n\n /**\n * @param {string?} path\n * @param {string} expected\n * @param {string} has\n * @param {string?} message\n */\n extend (path, expected, has, message = null) {\n this._rerrs.push({ path, expected, has, message })\n }\n\n toString () {\n const s = []\n for (let i = this._rerrs.length - 1; i > 0; i--) {\n const r = this._rerrs[i]\n /* c8 ignore next */\n s.push(string.repeat(' ', (this._rerrs.length - i) * 2) + `${r.path != null ? `[${r.path}] ` : ''}${r.has} doesn't match ${r.expected}. ${r.message}`)\n }\n return s.join('\\n')\n }\n}\n\n/**\n * @param {any} a\n * @param {any} b\n * @return {boolean}\n */\nconst shapeExtends = (a, b) => {\n if (a === b) return true\n if (a == null || b == null || a.constructor !== b.constructor) return false\n if (a[equalityTraits.EqualityTraitSymbol]) return equalityTraits.equals(a, b) // last resort: check equality (do this before array and obj check which don't implement the equality trait)\n if (arr.isArray(a)) {\n return arr.every(a, aitem =>\n arr.some(b, bitem => shapeExtends(aitem, bitem))\n )\n } else if (obj.isObject(a)) {\n return obj.every(a, (aitem, akey) =>\n shapeExtends(aitem, b[akey])\n )\n }\n /* c8 ignore next */\n return false\n}\n\n/**\n * @template T\n * @implements {equalityTraits.EqualityTrait}\n */\nexport class Schema {\n // this.shape must not be defined on Schema. Otherwise typecheck on metatypes (e.g. $$object) won't work as expected anymore\n /**\n * If true, the more things are added to the shape the more objects this schema will accept (e.g.\n * union). By default, the more objects are added, the the fewer objects this schema will accept.\n * @protected\n */\n static _dilutes = false\n\n /**\n * @param {Schema} other\n */\n extends (other) {\n let [a, b] = [/** @type {any} */(this).shape, /** @type {any} */ (other).shape]\n if (/** @type {typeof Schema} */ (this.constructor)._dilutes) [b, a] = [a, b]\n return shapeExtends(a, b)\n }\n\n /**\n * Overwrite this when necessary. By default, we only check the `shape` property which every shape\n * should have.\n * @param {Schema} other\n */\n equals (other) {\n // @ts-ignore\n return this.constructor === other.constructor && fun.equalityDeep(this.shape, other.shape)\n }\n\n [schemaSymbol] () { return true }\n\n /**\n * @param {object} other\n */\n [equalityTraits.EqualityTraitSymbol] (other) {\n return this.equals(/** @type {any} */ (other))\n }\n\n /**\n * Use `schema.validate(obj)` with a typed parameter that is already of typed to be an instance of\n * Schema. Validate will check the structure of the parameter and return true iff the instance\n * really is an instance of Schema.\n *\n * @param {T} o\n * @return {boolean}\n */\n validate (o) {\n return this.check(o)\n }\n\n /* c8 ignore start */\n /**\n * Similar to validate, but this method accepts untyped parameters.\n *\n * @param {any} _o\n * @param {ValidationError} [_err]\n * @return {_o is T}\n */\n check (_o, _err) {\n error.methodUnimplemented()\n }\n /* c8 ignore stop */\n\n /**\n * @type {Schema}\n */\n get nullable () {\n // @ts-ignore\n return $union(this, $null)\n }\n\n /**\n * @type {$Optional>}\n */\n get optional () {\n return new $Optional(/** @type {Schema} */ (this))\n }\n\n /**\n * Cast a variable to a specific type. Returns the casted value, or throws an exception otherwise.\n * Use this if you know that the type is of a specific type and you just want to convince the type\n * system.\n *\n * **Do not rely on these error messages!**\n * Performs an assertion check only if not in a production environment.\n *\n * @template OO\n * @param {OO} o\n * @return {Extract extends never ? T : (OO extends Array ? T : Extract)}\n */\n cast (o) {\n assert(o, this)\n return /** @type {any} */ (o)\n }\n\n /**\n * EXPECTO PATRONUM!! 🪄\n * This function protects against type errors. Though it may not work in the real world.\n *\n * \"After all this time?\"\n * \"Always.\" - Snape, talking about type safety\n *\n * Ensures that a variable is a a specific type. Returns the value, or throws an exception if the assertion check failed.\n * Use this if you know that the type is of a specific type and you just want to convince the type\n * system.\n *\n * Can be useful when defining lambdas: `s.lambda(s.$number, s.$void).expect((n) => n + 1)`\n *\n * **Do not rely on these error messages!**\n * Performs an assertion check if not in a production environment.\n *\n * @param {T} o\n * @return {o extends T ? T : never}\n */\n expect (o) {\n assert(o, this)\n return o\n }\n}\n\n/**\n * @template {(new (...args:any[]) => any) | ((...args:any[]) => any)} Constr\n * @typedef {Constr extends ((...args:any[]) => infer T) ? T : (Constr extends (new (...args:any[]) => any) ? InstanceType : never)} Instance\n */\n\n/**\n * @template {(new (...args:any[]) => any) | ((...args:any[]) => any)} C\n * @extends {Schema>}\n */\nexport class $ConstructedBy extends Schema {\n /**\n * @param {C} c\n * @param {((o:Instance)=>boolean)|null} check\n */\n constructor (c, check) {\n super()\n this.shape = c\n this._c = check\n }\n\n /**\n * @param {any} o\n * @param {ValidationError} [err]\n * @return {o is C extends ((...args:any[]) => infer T) ? T : (C extends (new (...args:any[]) => any) ? InstanceType : never)} o\n */\n check (o, err = undefined) {\n const c = o?.constructor === this.shape && (this._c == null || this._c(o))\n /* c8 ignore next */\n !c && err?.extend(null, this.shape.name, o?.constructor.name, o?.constructor !== this.shape ? 'Constructor match failed' : 'Check failed')\n return c\n }\n}\n\n/**\n * @template {(new (...args:any[]) => any) | ((...args:any[]) => any)} C\n * @param {C} c\n * @param {((o:Instance) => boolean)|null} check\n * @return {CastToSchema<$ConstructedBy>}\n */\nexport const $constructedBy = (c, check = null) => new $ConstructedBy(c, check)\nexport const $$constructedBy = $constructedBy($ConstructedBy)\n\n/**\n * Check custom properties on any object. You may want to overwrite the generated Schema.\n *\n * @extends {Schema}\n */\nexport class $Custom extends Schema {\n /**\n * @param {(o:any) => boolean} check\n */\n constructor (check) {\n super()\n /**\n * @type {(o:any) => boolean}\n */\n this.shape = check\n }\n\n /**\n * @param {any} o\n * @param {ValidationError} err\n * @return {o is any}\n */\n check (o, err) {\n const c = this.shape(o)\n /* c8 ignore next */\n !c && err?.extend(null, 'custom prop', o?.constructor.name, 'failed to check custom prop')\n return c\n }\n}\n\n/**\n * @param {(o:any) => boolean} check\n * @return {Schema}\n */\nexport const $custom = (check) => new $Custom(check)\nexport const $$custom = $constructedBy($Custom)\n\n/**\n * @template {Primitive} T\n * @extends {Schema}\n */\nexport class $Literal extends Schema {\n /**\n * @param {Array} literals\n */\n constructor (literals) {\n super()\n this.shape = literals\n }\n\n /**\n *\n * @param {any} o\n * @param {ValidationError} [err]\n * @return {o is T}\n */\n check (o, err) {\n const c = this.shape.some(a => a === o)\n /* c8 ignore next */\n !c && err?.extend(null, this.shape.join(' | '), o.toString())\n return c\n }\n}\n\n/**\n * @template {Primitive[]} T\n * @param {T} literals\n * @return {CastToSchema<$Literal>}\n */\nexport const $literal = (...literals) => new $Literal(literals)\nexport const $$literal = $constructedBy($Literal)\n\n/**\n * @template {Array>} Ts\n * @typedef {Ts extends [] ? `` : (Ts extends [infer T] ? (Unwrap extends (string|number) ? Unwrap : never) : (Ts extends [infer T1, ...infer Rest] ? `${Unwrap extends (string|number) ? Unwrap : never}${Rest extends Array> ? CastStringTemplateArgsToTemplate : never}` : never))} CastStringTemplateArgsToTemplate\n */\n\n/**\n * @param {string} str\n * @return {string}\n */\nconst _regexEscape = /** @type {any} */ (RegExp).escape || /** @type {(str:string) => string} */ (str =>\n str.replace(/[().|&,$^[\\]]/g, s => '\\\\' + s)\n)\n\n/**\n * @param {string|Schema} s\n * @return {string[]}\n */\nconst _schemaStringTemplateToRegex = s => {\n if ($string.check(s)) {\n return [_regexEscape(s)]\n }\n if ($$literal.check(s)) {\n return /** @type {Array} */ (s.shape).map(v => v + '')\n }\n if ($$number.check(s)) {\n return ['[+-]?\\\\d+.?\\\\d*']\n }\n if ($$string.check(s)) {\n return ['.*']\n }\n if ($$union.check(s)) {\n return s.shape.map(_schemaStringTemplateToRegex).flat(1)\n }\n /* c8 ignore next 2 */\n // unexpected schema structure (only supports unions and string in literal types)\n error.unexpectedCase()\n}\n\n/**\n * @template {Array>} T\n * @extends {Schema>}\n */\nexport class $StringTemplate extends Schema {\n /**\n * @param {T} shape\n */\n constructor (shape) {\n super()\n this.shape = shape\n this._r = new RegExp('^' + shape.map(_schemaStringTemplateToRegex).map(opts => `(${opts.join('|')})`).join('') + '$')\n }\n\n /**\n * @param {any} o\n * @param {ValidationError} [err]\n * @return {o is CastStringTemplateArgsToTemplate}\n */\n check (o, err) {\n const c = this._r.exec(o) != null\n /* c8 ignore next */\n !c && err?.extend(null, this._r.toString(), o.toString(), 'String doesn\\'t match string template.')\n return c\n }\n}\n\n/**\n * @template {Array>} T\n * @param {T} literals\n * @return {CastToSchema<$StringTemplate>}\n */\nexport const $stringTemplate = (...literals) => new $StringTemplate(literals)\nexport const $$stringTemplate = $constructedBy($StringTemplate)\n\nconst isOptionalSymbol = Symbol('optional')\n/**\n * @template {Schema} S\n * @extends Schema|undefined>\n */\nclass $Optional extends Schema {\n /**\n * @param {S} shape\n */\n constructor (shape) {\n super()\n this.shape = shape\n }\n\n /**\n * @param {any} o\n * @param {ValidationError} [err]\n * @return {o is (Unwrap|undefined)}\n */\n check (o, err) {\n const c = o === undefined || this.shape.check(o)\n /* c8 ignore next */\n !c && err?.extend(null, 'undefined (optional)', '()')\n return c\n }\n\n get [isOptionalSymbol] () { return true }\n}\nexport const $$optional = $constructedBy($Optional)\n\n/**\n * @extends Schema\n */\nclass $Never extends Schema {\n /**\n * @param {any} _o\n * @param {ValidationError} [err]\n * @return {_o is never}\n */\n check (_o, err) {\n /* c8 ignore next */\n err?.extend(null, 'never', typeof _o)\n return false\n }\n}\n\n/**\n * @type {Schema}\n */\nexport const $never = new $Never()\nexport const $$never = $constructedBy($Never)\n\n/**\n * @template {{ [key: string|symbol|number]: Schema }} S\n * @typedef {{ [Key in keyof S as S[Key] extends $Optional> ? Key : never]?: S[Key] extends $Optional> ? Type : never } & { [Key in keyof S as S[Key] extends $Optional> ? never : Key]: S[Key] extends Schema ? Type : never }} $ObjectToType\n */\n\n/**\n * @template {{[key:string|symbol|number]: Schema}} S\n * @extends {Schema<$ObjectToType>}\n */\nexport class $Object extends Schema {\n /**\n * @param {S} shape\n * @param {boolean} partial\n */\n constructor (shape, partial = false) {\n super()\n /**\n * @type {S}\n */\n this.shape = shape\n this._isPartial = partial\n }\n\n static _dilutes = true\n\n /**\n * @type {Schema>>}\n */\n get partial () {\n return new $Object(this.shape, true)\n }\n\n /**\n * @param {any} o\n * @param {ValidationError} err\n * @return {o is $ObjectToType}\n */\n check (o, err) {\n if (o == null) {\n /* c8 ignore next */\n err?.extend(null, 'object', 'null')\n return false\n }\n return obj.every(this.shape, (vv, vk) => {\n const c = (this._isPartial && !obj.hasProperty(o, vk)) || vv.check(o[vk], err)\n !c && err?.extend(vk.toString(), vv.toString(), typeof o[vk], 'Object property does not match')\n return c\n })\n }\n}\n\n/**\n * @template S\n * @typedef {Schema<{ [Key in keyof S as S[Key] extends $Optional> ? Key : never]?: S[Key] extends $Optional> ? Type : never } & { [Key in keyof S as S[Key] extends $Optional> ? never : Key]: S[Key] extends Schema ? Type : never }>} _ObjectDefToSchema\n */\n\n// I used an explicit type annotation instead of $ObjectToType, so that the user doesn't see the\n// weird type definitions when inspecting type definions.\n/**\n * @template {{ [key:string|symbol|number]: Schema }} S\n * @param {S} def\n * @return {_ObjectDefToSchema extends Schema ? Schema<{ [K in keyof S]: S[K] }> : never}\n */\nexport const $object = def => /** @type {any} */ (new $Object(def))\nexport const $$object = $constructedBy($Object)\n/**\n * @type {Schema<{[key:string]: any}>}\n */\nexport const $objectAny = $custom(o => o != null && (o.constructor === Object || o.constructor == null))\n\n/**\n * @template {Schema} Keys\n * @template {Schema} Values\n * @extends {Schema<{ [key in Unwrap]: Unwrap }>}\n */\nexport class $Record extends Schema {\n /**\n * @param {Keys} keys\n * @param {Values} values\n */\n constructor (keys, values) {\n super()\n this.shape = {\n keys, values\n }\n }\n\n /**\n * @param {any} o\n * @param {ValidationError} err\n * @return {o is { [key in Unwrap]: Unwrap }}\n */\n check (o, err) {\n return o != null && obj.every(o, (vv, vk) => {\n const ck = this.shape.keys.check(vk, err)\n /* c8 ignore next */\n !ck && err?.extend(vk + '', 'Record', typeof o, ck ? 'Key doesn\\'t match schema' : 'Value doesn\\'t match value')\n return ck && this.shape.values.check(vv, err)\n })\n }\n}\n\n/**\n * @template {Schema} Keys\n * @template {Schema} Values\n * @param {Keys} keys\n * @param {Values} values\n * @return {CastToSchema<$Record>}\n */\nexport const $record = (keys, values) => new $Record(keys, values)\nexport const $$record = $constructedBy($Record)\n\n/**\n * @template {Schema[]} S\n * @extends {Schema<{ [Key in keyof S]: S[Key] extends Schema ? Type : never }>}\n */\nexport class $Tuple extends Schema {\n /**\n * @param {S} shape\n */\n constructor (shape) {\n super()\n this.shape = shape\n }\n\n /**\n * @param {any} o\n * @param {ValidationError} err\n * @return {o is { [K in keyof S]: S[K] extends Schema ? Type : never }}\n */\n check (o, err) {\n return o != null && obj.every(this.shape, (vv, vk) => {\n const c = /** @type {Schema} */ (vv).check(o[vk], err)\n /* c8 ignore next */\n !c && err?.extend(vk.toString(), 'Tuple', typeof vv)\n return c\n })\n }\n}\n\n/**\n * @template {Array>} T\n * @param {T} def\n * @return {CastToSchema<$Tuple>}\n */\nexport const $tuple = (...def) => new $Tuple(def)\nexport const $$tuple = $constructedBy($Tuple)\n\n/**\n * @template {Schema} S\n * @extends {Schema ? T : never>>}\n */\nexport class $Array extends Schema {\n /**\n * @param {Array} v\n */\n constructor (v) {\n super()\n /**\n * @type {Schema ? T : never>}\n */\n this.shape = v.length === 1 ? v[0] : new $Union(v)\n }\n\n /**\n * @param {any} o\n * @param {ValidationError} [err]\n * @return {o is Array ? T : never>} o\n */\n check (o, err) {\n const c = arr.isArray(o) && arr.every(o, oi => this.shape.check(oi))\n /* c8 ignore next */\n !c && err?.extend(null, 'Array', '')\n return c\n }\n}\n\n/**\n * @template {Array>} T\n * @param {T} def\n * @return {Schema> ? S : never>>}\n */\nexport const $array = (...def) => new $Array(def)\nexport const $$array = $constructedBy($Array)\n/**\n * @type {Schema>}\n */\nexport const $arrayAny = $custom(o => arr.isArray(o))\n\n/**\n * @template T\n * @extends {Schema}\n */\nexport class $InstanceOf extends Schema {\n /**\n * @param {new (...args:any) => T} constructor\n * @param {((o:T) => boolean)|null} check\n */\n constructor (constructor, check) {\n super()\n this.shape = constructor\n this._c = check\n }\n\n /**\n * @param {any} o\n * @param {ValidationError} err\n * @return {o is T}\n */\n check (o, err) {\n const c = o instanceof this.shape && (this._c == null || this._c(o))\n /* c8 ignore next */\n !c && err?.extend(null, this.shape.name, o?.constructor.name)\n return c\n }\n}\n\n/**\n * @template T\n * @param {new (...args:any) => T} c\n * @param {((o:T) => boolean)|null} check\n * @return {Schema}\n */\nexport const $instanceOf = (c, check = null) => new $InstanceOf(c, check)\nexport const $$instanceOf = $constructedBy($InstanceOf)\n\nexport const $$schema = $instanceOf(Schema)\n\n/**\n * @template {Schema[]} Args\n * @typedef {(...args:UnwrapArray>)=>Unwrap>} _LArgsToLambdaDef\n */\n\n/**\n * @template {Array>} Args\n * @extends {Schema<_LArgsToLambdaDef>}\n */\nexport class $Lambda extends Schema {\n /**\n * @param {Args} args\n */\n constructor (args) {\n super()\n this.len = args.length - 1\n this.args = $tuple(...args.slice(-1))\n this.res = args[this.len]\n }\n\n /**\n * @param {any} f\n * @param {ValidationError} err\n * @return {f is _LArgsToLambdaDef}\n */\n check (f, err) {\n const c = f.constructor === Function && f.length <= this.len\n /* c8 ignore next */\n !c && err?.extend(null, 'function', typeof f)\n return c\n }\n}\n\n/**\n * @template {Schema[]} Args\n * @param {Args} args\n * @return {Schema<(...args:UnwrapArray>)=>Unwrap>>}\n */\nexport const $lambda = (...args) => new $Lambda(args.length > 0 ? args : [$void])\nexport const $$lambda = $constructedBy($Lambda)\n\n/**\n * @type {Schema}\n */\nexport const $function = $custom(o => typeof o === 'function')\n\n/**\n * @template {Array>} T\n * @extends {Schema>>}\n */\nexport class $Intersection extends Schema {\n /**\n * @param {T} v\n */\n constructor (v) {\n super()\n /**\n * @type {T}\n */\n this.shape = v\n }\n\n /**\n * @param {any} o\n * @param {ValidationError} [err]\n * @return {o is Intersect>}\n */\n check (o, err) {\n // @ts-ignore\n const c = arr.every(this.shape, check => check.check(o, err))\n /* c8 ignore next */\n !c && err?.extend(null, 'Intersectinon', typeof o)\n return c\n }\n}\n\n/**\n * @template {Schema[]} T\n * @param {T} def\n * @return {CastToSchema<$Intersection>}\n */\nexport const $intersect = (...def) => new $Intersection(def)\nexport const $$intersect = $constructedBy($Intersection, o => o.shape.length > 0) // Intersection with length=0 is considered \"any\"\n\n/**\n * @template S\n * @extends {Schema}\n */\nexport class $Union extends Schema {\n static _dilutes = true\n\n /**\n * @param {Array>} v\n */\n constructor (v) {\n super()\n this.shape = v\n }\n\n /**\n * @param {any} o\n * @param {ValidationError} [err]\n * @return {o is S}\n */\n check (o, err) {\n const c = arr.some(this.shape, (vv) => vv.check(o, err))\n err?.extend(null, 'Union', typeof o)\n return c\n }\n}\n\n/**\n * @template {Array} T\n * @param {T} schemas\n * @return {CastToSchema<$Union>>>}\n */\nexport const $union = (...schemas) => schemas.findIndex($s => $$union.check($s)) >= 0\n ? $union(...schemas.map($s => $($s)).map($s => $$union.check($s) ? $s.shape : [$s]).flat(1))\n : (schemas.length === 1\n ? schemas[0]\n : new $Union(schemas))\nexport const $$union = /** @type {Schema<$Union>} */ ($constructedBy($Union))\n\nconst _t = () => true\n/**\n * @type {Schema}\n */\nexport const $any = $custom(_t)\nexport const $$any = /** @type {Schema>} */ ($constructedBy($Custom, o => o.shape === _t))\n\n/**\n * @type {Schema}\n */\nexport const $bigint = $custom(o => typeof o === 'bigint')\nexport const $$bigint = /** @type {Schema>} */ ($custom(o => o === $bigint))\n\n/**\n * @type {Schema}\n */\nexport const $symbol = $custom(o => typeof o === 'symbol')\nexport const $$symbol = /** @type {Schema>} */ ($custom(o => o === $symbol))\n\n/**\n * @type {Schema}\n */\nexport const $number = $custom(o => typeof o === 'number')\nexport const $$number = /** @type {Schema>} */ ($custom(o => o === $number))\n\n/**\n * @type {Schema}\n */\nexport const $string = $custom(o => typeof o === 'string')\nexport const $$string = /** @type {Schema>} */ ($custom(o => o === $string))\n\n/**\n * @type {Schema}\n */\nexport const $boolean = $custom(o => typeof o === 'boolean')\nexport const $$boolean = /** @type {Schema>} */ ($custom(o => o === $boolean))\n\n/**\n * @type {Schema}\n */\nexport const $undefined = $literal(undefined)\nexport const $$undefined = /** @type {Schema>} */ ($constructedBy($Literal, o => o.shape.length === 1 && o.shape[0] === undefined))\n\n/**\n * @type {Schema}\n */\nexport const $void = $literal(undefined)\nexport const $$void = /** @type {Schema>} */ ($$undefined)\n\nexport const $null = $literal(null)\nexport const $$null = /** @type {Schema>} */ ($constructedBy($Literal, o => o.shape.length === 1 && o.shape[0] === null))\n\nexport const $uint8Array = $constructedBy(Uint8Array)\nexport const $$uint8Array = /** @type {Schema>} */ ($constructedBy($ConstructedBy, o => o.shape === Uint8Array))\n\n/**\n * @type {Schema}\n */\nexport const $primitive = $union($number, $string, $null, $undefined, $bigint, $boolean, $symbol)\n\n/**\n * @typedef {JSON[]} JSONArray\n */\n/**\n * @typedef {Primitive|JSONArray|{ [key:string]:JSON }} JSON\n */\n/**\n * @type {Schema}\n */\nexport const $json = (() => {\n const $jsonArr = /** @type {$Array<$any>} */ ($array($any))\n const $jsonRecord = /** @type {$Record<$string,$any>} */ ($record($string, $any))\n const $json = $union($number, $string, $null, $boolean, $jsonArr, $jsonRecord)\n $jsonArr.shape = $json\n $jsonRecord.shape.values = $json\n return $json\n})()\n\n/**\n * @template {any} IN\n * @typedef {IN extends Schema ? IN\n * : (IN extends string|number|boolean|null ? Schema\n * : (IN extends new (...args:any[])=>any ? Schema>\n * : (IN extends any[] ? Schema<{ [K in keyof IN]: Unwrap> }[number]>\n * : (IN extends object ? (_ObjectDefToSchema<{[K in keyof IN]:ReadSchema}> extends Schema ? Schema<{ [K in keyof S]: S[K] }> : never)\n * : never)\n * )\n * )\n * )\n * } ReadSchemaOld\n */\n\n/**\n * @template {any} IN\n * @typedef {[Extract>,Extract,Extractany>,Extract,Extract|string|number|boolean|null|(new (...args:any[])=>any)|any[]>,object>] extends [infer Schemas, infer Primitives, infer Constructors, infer Arrs, infer Obj]\n * ? Schema<\n * (Schemas extends Schema ? S : never)\n * | Primitives\n * | (Constructors extends new (...args:any[])=>any ? InstanceType : never)\n * | (Arrs extends any[] ? { [K in keyof Arrs]: Unwrap> }[number] : never)\n * | (Obj extends object ? Unwrap<(_ObjectDefToSchema<{[K in keyof Obj]:ReadSchema}> extends Schema ? Schema<{ [K in keyof S]: S[K] }> : never)> : never)>\n * : never\n * } ReadSchema\n */\n\n/**\n * @typedef {ReadSchema<{x:42}|{y:99}|Schema|[1,2,{}]>} Q\n */\n\n/**\n * @template IN\n * @param {IN} o\n * @return {ReadSchema}\n */\nexport const $ = o => {\n if ($$schema.check(o)) {\n return /** @type {any} */ (o)\n } else if ($objectAny.check(o)) {\n /**\n * @type {any}\n */\n const o2 = {}\n for (const k in o) {\n o2[k] = $(o[k])\n }\n return /** @type {any} */ ($object(o2))\n } else if ($arrayAny.check(o)) {\n return /** @type {any} */ ($union(...o.map($)))\n } else if ($primitive.check(o)) {\n return /** @type {any} */ ($literal(o))\n } else if ($function.check(o)) {\n return /** @type {any} */ ($constructedBy(/** @type {any} */ (o)))\n }\n /* c8 ignore next */\n error.unexpectedCase()\n}\n\n/* c8 ignore start */\n/**\n * Assert that a variable is of this specific type.\n * The assertion check is only performed in non-production environments.\n *\n * @type {(o:any,schema:Schema) => asserts o is T}\n */\nexport const assert = env.production\n ? () => {}\n : (o, schema) => {\n const err = new ValidationError()\n if (!schema.check(o, err)) {\n throw error.create(`Expected value to be of type ${schema.constructor.name}.\\n${err.toString()}`)\n }\n }\n/* c8 ignore end */\n\n/**\n * @template In\n * @template Out\n * @typedef {{ if: Schema, h: (o:In,state?:any)=>Out }} Pattern\n */\n\n/**\n * @template {Pattern} P\n * @template In\n * @typedef {ReturnType>['h']>} PatternMatchResult\n */\n\n/**\n * @todo move this to separate library\n * @template {any} [State=undefined]\n * @template {Pattern} [Patterns=never]\n */\nexport class PatternMatcher {\n /**\n * @param {Schema} [$state]\n */\n constructor ($state) {\n /**\n * @type {Array}\n */\n this.patterns = []\n this.$state = $state\n }\n\n /**\n * @template P\n * @template R\n * @param {P} pattern\n * @param {(o:NoInfer>>,s:State)=>R} handler\n * @return {PatternMatcher>,R>>}\n */\n if (pattern, handler) {\n // @ts-ignore\n this.patterns.push({ if: $(pattern), h: handler })\n // @ts-ignore\n return this\n }\n\n /**\n * @template R\n * @param {(o:any,s:State)=>R} h\n */\n else (h) {\n return this.if($any, h)\n }\n\n /**\n * @return {State extends undefined\n * ? >(o:In,state?:undefined)=>PatternMatchResult\n * : >(o:In,state:State)=>PatternMatchResult}\n */\n done () {\n // @ts-ignore\n return /** @type {any} */ (o, s) => {\n for (let i = 0; i < this.patterns.length; i++) {\n const p = this.patterns[i]\n if (p.if.check(o)) {\n // @ts-ignore\n return p.h(o, s)\n }\n }\n throw error.create('Unhandled pattern')\n }\n }\n}\n\n/**\n * @template [State=undefined]\n * @param {State} [state]\n * @return {PatternMatcher>>}\n */\nexport const match = state => new PatternMatcher(/** @type {any} */ (state))\n\n/**\n * Helper function to generate a (non-exhaustive) sample set from a gives schema.\n *\n * @type {(o:T,gen:prng.PRNG)=>T}\n */\nconst _random = /** @type {any} */ (match(/** @type {Schema} */ ($any))\n .if($$number, (_o, gen) => prng.int53(gen, number.MIN_SAFE_INTEGER, number.MAX_SAFE_INTEGER))\n .if($$string, (_o, gen) => prng.word(gen))\n .if($$boolean, (_o, gen) => prng.bool(gen))\n .if($$bigint, (_o, gen) => BigInt(prng.int53(gen, number.MIN_SAFE_INTEGER, number.MAX_SAFE_INTEGER)))\n .if($$union, (o, gen) => random(gen, prng.oneOf(gen, o.shape)))\n .if($$object, (o, gen) => {\n /**\n * @type {any}\n */\n const res = {}\n for (const k in o.shape) {\n let prop = o.shape[k]\n if ($$optional.check(prop)) {\n if (prng.bool(gen)) { continue }\n prop = prop.shape\n }\n res[k] = _random(prop, gen)\n }\n return res\n })\n .if($$array, (o, gen) => {\n const arr = []\n const n = prng.int32(gen, 0, 42)\n for (let i = 0; i < n; i++) {\n arr.push(random(gen, o.shape))\n }\n return arr\n })\n .if($$literal, (o, gen) => {\n return prng.oneOf(gen, o.shape)\n })\n .if($$null, (o, gen) => {\n return null\n })\n .if($$lambda, (o, gen) => {\n const res = random(gen, o.res)\n return () => res\n })\n .if($$any, (o, gen) => random(gen, prng.oneOf(gen, [\n $number, $string, $null, $undefined, $bigint, $boolean,\n $array($number),\n $record($union('a', 'b', 'c'), $number)\n ])))\n .if($$record, (o, gen) => {\n /**\n * @type {any}\n */\n const res = {}\n const keysN = prng.int53(gen, 0, 3)\n for (let i = 0; i < keysN; i++) {\n const key = random(gen, o.shape.keys)\n const val = random(gen, o.shape.values)\n res[key] = val\n }\n return res\n })\n .done())\n\n/**\n * @template S\n * @param {prng.PRNG} gen\n * @param {S} schema\n * @return {Unwrap>}\n */\nexport const random = (gen, schema) => /** @type {any} */ (_random($(schema), gen))\n"],"names":["string.repeat","equalityTraits.EqualityTraitSymbol","equalityTraits.equals","arr.isArray","arr.every","arr.some","obj.isObject","obj.every","fun.equalityDeep","error.methodUnimplemented","error.unexpectedCase","obj.hasProperty","env.production","error.create","prng.int53","number.MIN_SAFE_INTEGER","number.MAX_SAFE_INTEGER","prng.word","prng.bool","prng.oneOf","prng.int32"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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AC3C,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,EAAC;AAC7C,MAAM,GAAG,CAAC,GAAG,CAAC,GAAG,IAAG;AACpB,KAAK;AACL,IAAI,OAAO,GAAG;AACd,GAAG,CAAC;AACJ,GAAG,IAAI,EAAE,EAAC;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,CAAC,GAAG,EAAE,MAAM,yBAAyB,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/schema.d.ts b/yjs-poll/node_modules/lib0/dist/schema.d.ts deleted file mode 100644 index 27c6fbf..0000000 --- a/yjs-poll/node_modules/lib0/dist/schema.d.ts +++ /dev/null @@ -1,595 +0,0 @@ -export class ValidationError { - /** - * Reverse errors - * @type {Array<{ path: string?, expected: string, has: string, message: string? }>} - */ - _rerrs: Array<{ - path: string | null; - expected: string; - has: string; - message: string | null; - }>; - /** - * @param {string?} path - * @param {string} expected - * @param {string} has - * @param {string?} message - */ - extend(path: string | null, expected: string, has: string, message?: string | null): void; - toString(): string; -} -/** - * @template T - * @implements {equalityTraits.EqualityTrait} - */ -export class Schema implements equalityTraits.EqualityTrait { - /** - * If true, the more things are added to the shape the more objects this schema will accept (e.g. - * union). By default, the more objects are added, the the fewer objects this schema will accept. - * @protected - */ - protected static _dilutes: boolean; - /** - * @param {Schema} other - */ - extends(other: Schema): boolean; - /** - * Overwrite this when necessary. By default, we only check the `shape` property which every shape - * should have. - * @param {Schema} other - */ - equals(other: Schema): boolean; - /** - * Use `schema.validate(obj)` with a typed parameter that is already of typed to be an instance of - * Schema. Validate will check the structure of the parameter and return true iff the instance - * really is an instance of Schema. - * - * @param {T} o - * @return {boolean} - */ - validate(o: T): boolean; - /** - * Similar to validate, but this method accepts untyped parameters. - * - * @param {any} _o - * @param {ValidationError} [_err] - * @return {_o is T} - */ - check(_o: any, _err?: ValidationError): _o is T; - /** - * @type {Schema} - */ - get nullable(): Schema; - /** - * @type {$Optional>} - */ - get optional(): $Optional>; - /** - * Cast a variable to a specific type. Returns the casted value, or throws an exception otherwise. - * Use this if you know that the type is of a specific type and you just want to convince the type - * system. - * - * **Do not rely on these error messages!** - * Performs an assertion check only if not in a production environment. - * - * @template OO - * @param {OO} o - * @return {Extract extends never ? T : (OO extends Array ? T : Extract)} - */ - cast(o: OO): Extract extends never ? T : (OO extends Array ? T : Extract); - /** - * EXPECTO PATRONUM!! 🪄 - * This function protects against type errors. Though it may not work in the real world. - * - * "After all this time?" - * "Always." - Snape, talking about type safety - * - * Ensures that a variable is a a specific type. Returns the value, or throws an exception if the assertion check failed. - * Use this if you know that the type is of a specific type and you just want to convince the type - * system. - * - * Can be useful when defining lambdas: `s.lambda(s.$number, s.$void).expect((n) => n + 1)` - * - * **Do not rely on these error messages!** - * Performs an assertion check if not in a production environment. - * - * @param {T} o - * @return {o extends T ? T : never} - */ - expect(o: T): T extends T ? T : never; - [schemaSymbol](): boolean; - /** - * @param {object} other - */ - [equalityTraits.EqualityTraitSymbol](other: object): boolean; -} -/** - * @template {(new (...args:any[]) => any) | ((...args:any[]) => any)} Constr - * @typedef {Constr extends ((...args:any[]) => infer T) ? T : (Constr extends (new (...args:any[]) => any) ? InstanceType : never)} Instance - */ -/** - * @template {(new (...args:any[]) => any) | ((...args:any[]) => any)} C - * @extends {Schema>} - */ -export class $ConstructedBy any) | ((...args: any[]) => any)> extends Schema> { - /** - * @param {C} c - * @param {((o:Instance)=>boolean)|null} check - */ - constructor(c: C, check: ((o: Instance) => boolean) | null); - shape: C; - _c: ((o: Instance) => boolean) | null; - /** - * @param {any} o - * @param {ValidationError} [err] - * @return {o is C extends ((...args:any[]) => infer T) ? T : (C extends (new (...args:any[]) => any) ? InstanceType : never)} o - */ - check(o: any, err?: ValidationError): o is C extends ((...args: any[]) => infer T) ? T : (C extends (new (...args: any[]) => any) ? InstanceType : never); -} -export function $constructedBy any) | ((...args: any[]) => any)>(c: C, check?: ((o: Instance) => boolean) | null): CastToSchema<$ConstructedBy>; -export const $$constructedBy: Schema<$ConstructedBy<(new (...args: any[]) => any) | ((...args: any[]) => any)>>; -/** - * Check custom properties on any object. You may want to overwrite the generated Schema. - * - * @extends {Schema} - */ -export class $Custom extends Schema { - /** - * @param {(o:any) => boolean} check - */ - constructor(check: (o: any) => boolean); - /** - * @type {(o:any) => boolean} - */ - shape: (o: any) => boolean; - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is any} - */ - check(o: any, err: ValidationError): o is any; -} -export function $custom(check: (o: any) => boolean): Schema; -export const $$custom: Schema<$Custom>; -/** - * @template {Primitive} T - * @extends {Schema} - */ -export class $Literal extends Schema { - /** - * @param {Array} literals - */ - constructor(literals: Array); - shape: T[]; -} -export function $literal(...literals: T): CastToSchema<$Literal>; -export const $$literal: Schema<$Literal>; -/** - * @template {Array>} T - * @extends {Schema>} - */ -export class $StringTemplate>> extends Schema> { - /** - * @param {T} shape - */ - constructor(shape: T); - shape: T; - _r: RegExp; -} -export function $stringTemplate>>(...literals: T): CastToSchema<$StringTemplate>; -export const $$stringTemplate: Schema<$StringTemplate<(string | Schema)[]>>; -export const $$optional: Schema<$Optional>>; -/** - * @type {Schema} - */ -export const $never: Schema; -export const $$never: Schema<$Never>; -/** - * @template {{ [key: string|symbol|number]: Schema }} S - * @typedef {{ [Key in keyof S as S[Key] extends $Optional> ? Key : never]?: S[Key] extends $Optional> ? Type : never } & { [Key in keyof S as S[Key] extends $Optional> ? never : Key]: S[Key] extends Schema ? Type : never }} $ObjectToType - */ -/** - * @template {{[key:string|symbol|number]: Schema}} S - * @extends {Schema<$ObjectToType>} - */ -export class $Object; -}> extends Schema<$ObjectToType> { - /** - * @param {S} shape - * @param {boolean} partial - */ - constructor(shape: S, partial?: boolean); - /** - * @type {S} - */ - shape: S; - _isPartial: boolean; - /** - * @type {Schema>>} - */ - get partial(): Schema>>; - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is $ObjectToType} - */ - check(o: any, err: ValidationError): o is $ObjectToType; -} -export function $object; -}>(def: S): _ObjectDefToSchema extends Schema ? Schema<{ [K in keyof S_1]: S_1[K]; }> : never; -export const $$object: Schema<$Object<{ - [key: string]: Schema; - [key: number]: Schema; - [key: symbol]: Schema; -}>>; -/** - * @type {Schema<{[key:string]: any}>} - */ -export const $objectAny: Schema<{ - [key: string]: any; -}>; -/** - * @template {Schema} Keys - * @template {Schema} Values - * @extends {Schema<{ [key in Unwrap]: Unwrap }>} - */ -export class $Record, Values extends Schema> extends Schema<{ [key in Unwrap]: Unwrap; }> { - /** - * @param {Keys} keys - * @param {Values} values - */ - constructor(keys: Keys, values: Values); - shape: { - keys: Keys; - values: Values; - }; - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is { [key in Unwrap]: Unwrap }} - */ - check(o: any, err: ValidationError): o is { [key_1 in Unwrap]: Unwrap; }; -} -export function $record, Values extends Schema>(keys: Keys, values: Values): CastToSchema<$Record>; -export const $$record: Schema<$Record, Schema>>; -/** - * @template {Schema[]} S - * @extends {Schema<{ [Key in keyof S]: S[Key] extends Schema ? Type : never }>} - */ -export class $Tuple[]> extends Schema<{ [Key in keyof S]: S[Key] extends Schema ? Type : never; }> { - /** - * @param {S} shape - */ - constructor(shape: S); - shape: S; - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is { [K in keyof S]: S[K] extends Schema ? Type : never }} - */ - check(o: any, err: ValidationError): o is { [K in keyof S]: S[K] extends Schema ? Type : never; }; -} -export function $tuple>>(...def: T): CastToSchema<$Tuple>; -export const $$tuple: Schema<$Tuple[]>>; -/** - * @template {Schema} S - * @extends {Schema ? T : never>>} - */ -export class $Array> extends Schema<(S extends Schema ? T : never)[]> { - /** - * @param {Array} v - */ - constructor(v: Array); - /** - * @type {Schema ? T : never>} - */ - shape: Schema ? T_1 : never>; - /** - * @param {any} o - * @param {ValidationError} [err] - * @return {o is Array ? T : never>} o - */ - check(o: any, err?: ValidationError): o is Array ? T_1 : never>; -} -export function $array>>(...def: T): Schema> ? S : never>>; -export const $$array: Schema<$Array>>; -/** - * @type {Schema>} - */ -export const $arrayAny: Schema>; -/** - * @template T - * @extends {Schema} - */ -export class $InstanceOf extends Schema { - /** - * @param {new (...args:any) => T} constructor - * @param {((o:T) => boolean)|null} check - */ - constructor(constructor: new (...args: any) => T, check: ((o: T) => boolean) | null); - shape: new (...args: any) => T; - _c: ((o: T) => boolean) | null; - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is T} - */ - check(o: any, err: ValidationError): o is T; -} -export function $instanceOf(c: new (...args: any) => T, check?: ((o: T) => boolean) | null): Schema; -export const $$instanceOf: Schema<$InstanceOf>; -export const $$schema: Schema>; -/** - * @template {Schema[]} Args - * @typedef {(...args:UnwrapArray>)=>Unwrap>} _LArgsToLambdaDef - */ -/** - * @template {Array>} Args - * @extends {Schema<_LArgsToLambdaDef>} - */ -export class $Lambda>> extends Schema<_LArgsToLambdaDef> { - /** - * @param {Args} args - */ - constructor(args: Args); - len: number; - args: Schema; - res: Schema; - /** - * @param {any} f - * @param {ValidationError} err - * @return {f is _LArgsToLambdaDef} - */ - check(f: any, err: ValidationError): f is _LArgsToLambdaDef; -} -export function $lambda[]>(...args: Args): Schema<(...args: UnwrapArray>) => Unwrap>>; -export const $$lambda: Schema<$Lambda[]>>; -/** - * @type {Schema} - */ -export const $function: Schema; -/** - * @template {Array>} T - * @extends {Schema>>} - */ -export class $Intersection>> extends Schema>> { - /** - * @param {T} v - */ - constructor(v: T); - /** - * @type {T} - */ - shape: T; -} -export function $intersect[]>(...def: T): CastToSchema<$Intersection>; -export const $$intersect: Schema<$Intersection[]>>; -/** - * @template S - * @extends {Schema} - */ -export class $Union extends Schema { - /** - * @param {Array>} v - */ - constructor(v: Array>); - shape: Schema[]; -} -export function $union>(...schemas: T): CastToSchema<$Union>>>; -export const $$union: Schema<$Union>; -/** - * @type {Schema} - */ -export const $any: Schema; -export const $$any: Schema>; -/** - * @type {Schema} - */ -export const $bigint: Schema; -export const $$bigint: Schema>; -/** - * @type {Schema} - */ -export const $symbol: Schema; -export const $$symbol: Schema>; -/** - * @type {Schema} - */ -export const $number: Schema; -export const $$number: Schema>; -/** - * @type {Schema} - */ -export const $string: Schema; -export const $$string: Schema>; -/** - * @type {Schema} - */ -export const $boolean: Schema; -export const $$boolean: Schema>; -/** - * @type {Schema} - */ -export const $undefined: Schema; -export const $$undefined: Schema>; -/** - * @type {Schema} - */ -export const $void: Schema; -export const $$void: Schema>; -export const $null: Schema; -export const $$null: Schema>; -export const $uint8Array: Schema>; -export const $$uint8Array: Schema>; -/** - * @type {Schema} - */ -export const $primitive: Schema; -/** - * @typedef {JSON[]} JSONArray - */ -/** - * @typedef {Primitive|JSONArray|{ [key:string]:JSON }} JSON - */ -/** - * @type {Schema} - */ -export const $json: Schema; -export function $(o: IN): ReadSchema; -/** - * Assert that a variable is of this specific type. - * The assertion check is only performed in non-production environments. - * - * @type {(o:any,schema:Schema) => asserts o is T} - */ -export const assert: (o: any, schema: Schema) => asserts o is T; -/** - * @template In - * @template Out - * @typedef {{ if: Schema, h: (o:In,state?:any)=>Out }} Pattern - */ -/** - * @template {Pattern} P - * @template In - * @typedef {ReturnType>['h']>} PatternMatchResult - */ -/** - * @todo move this to separate library - * @template {any} [State=undefined] - * @template {Pattern} [Patterns=never] - */ -export class PatternMatcher = never> { - /** - * @param {Schema} [$state] - */ - constructor($state?: Schema); - /** - * @type {Array} - */ - patterns: Array; - $state: Schema | undefined; - /** - * @template P - * @template R - * @param {P} pattern - * @param {(o:NoInfer>>,s:State)=>R} handler - * @return {PatternMatcher>,R>>} - */ - if(pattern: P, handler: (o: NoInfer>>, s: State) => R): PatternMatcher>, R>>; - /** - * @template R - * @param {(o:any,s:State)=>R} h - */ - else(h: (o: any, s: State) => R): PatternMatcher>; - /** - * @return {State extends undefined - * ? >(o:In,state?:undefined)=>PatternMatchResult - * : >(o:In,state:State)=>PatternMatchResult} - */ - done(): State extends undefined ? >(o: In, state?: undefined) => PatternMatchResult : >(o: In, state: State) => PatternMatchResult; -} -export function match(state?: State): PatternMatcher>>; -export function random(gen: prng.PRNG, schema: S): Unwrap>; -export type Primitive = string | number | bigint | boolean | null | undefined | symbol; -export type AnyObject = { - [k: string | number | symbol]: any; -}; -export type Unwrap = T extends Schema ? X : T; -export type TypeOf = T extends Schema ? X : T; -export type UnwrapArray = T extends readonly [Schema, ...infer Rest] ? [First, ...UnwrapArray] : []; -export type CastToSchema = T extends Schema ? Schema : never; -export type TupleLast = Arr extends [...unknown[], infer L] ? L : never; -export type TuplePop = Arr extends [...infer Fs, unknown] ? Fs : never; -export type Intersect = T extends [] ? {} : T extends [infer First] ? First : T extends [infer First, ...infer Rest] ? First & Intersect : never; -export type Instance any) | ((...args: any[]) => any)> = Constr extends ((...args: any[]) => infer T) ? T : (Constr extends (new (...args: any[]) => any) ? InstanceType : never); -export type CastStringTemplateArgsToTemplate>> = Ts extends [] ? `` : (Ts extends [infer T] ? (Unwrap extends (string | number) ? Unwrap : never) : (Ts extends [infer T1, ...infer Rest] ? `${Unwrap extends (string | number) ? Unwrap : never}${Rest extends Array> ? CastStringTemplateArgsToTemplate : never}` : never)); -export type $ObjectToType; -}> = { [Key in keyof S as S[Key] extends $Optional> ? Key : never]?: S[Key] extends $Optional> ? Type : never; } & { [Key in keyof S as S[Key] extends $Optional> ? never : Key]: S[Key] extends Schema ? Type : never; }; -export type _ObjectDefToSchema = Schema<{ [Key in keyof S as S[Key] extends $Optional> ? Key : never]?: S[Key] extends $Optional> ? Type : never; } & { [Key in keyof S as S[Key] extends $Optional> ? never : Key]: S[Key] extends Schema ? Type : never; }>; -export type _LArgsToLambdaDef[]> = (...args: UnwrapArray>) => Unwrap>; -export type JSONArray = JSON[]; -export type JSON = Primitive | JSONArray | { - [key: string]: JSON; -}; -export type ReadSchemaOld = IN extends Schema ? IN : (IN extends string | number | boolean | null ? Schema : (IN extends new (...args: any[]) => any ? Schema> : (IN extends any[] ? Schema<{ [K in keyof IN]: Unwrap>; }[number]> : (IN extends object ? (_ObjectDefToSchema<{ [K in keyof IN]: ReadSchema; }> extends Schema ? Schema<{ [K in keyof S]: S[K]; }> : never) : never)))); -export type ReadSchema = [Extract>, Extract, Extract any>, Extract, Extract | string | number | boolean | null | (new (...args: any[]) => any) | any[]>, object>] extends [infer Schemas, infer Primitives, infer Constructors, infer Arrs, infer Obj] ? Schema<(Schemas extends Schema ? S : never) | Primitives | (Constructors extends new (...args: any[]) => any ? InstanceType : never) | (Arrs extends any[] ? { [K in keyof Arrs]: Unwrap>; }[number] : never) | (Obj extends object ? Unwrap<(_ObjectDefToSchema<{ [K in keyof Obj]: ReadSchema; }> extends Schema ? Schema<{ [K in keyof S]: S[K]; }> : never)> : never)> : never; -export type Q = ReadSchema<{ - x: 42; -} | { - y: 99; -} | Schema | [1, 2, {}]>; -export type Pattern = { - if: Schema; - h: (o: In, state?: any) => Out; -}; -export type PatternMatchResult

, In> = ReturnType>["h"]>; -import * as equalityTraits from './trait/equality.js'; -/** - * @template {Schema} S - * @extends Schema|undefined> - */ -declare class $Optional> extends Schema | undefined> { - /** - * @param {S} shape - */ - constructor(shape: S); - shape: S; - get [isOptionalSymbol](): boolean; -} -/** - * @typedef {string|number|bigint|boolean|null|undefined|symbol} Primitive - */ -/** - * @typedef {{ [k:string|number|symbol]: any }} AnyObject - */ -/** - * @template T - * @typedef {T extends Schema ? X : T} Unwrap - */ -/** - * @template T - * @typedef {T extends Schema ? X : T} TypeOf - */ -/** - * @template {readonly unknown[]} T - * @typedef {T extends readonly [Schema, ...infer Rest] ? [First, ...UnwrapArray] : [] } UnwrapArray - */ -/** - * @template T - * @typedef {T extends Schema ? Schema : never} CastToSchema - */ -/** - * @template {unknown[]} Arr - * @typedef {Arr extends [...unknown[], infer L] ? L : never} TupleLast - */ -/** - * @template {unknown[]} Arr - * @typedef {Arr extends [...infer Fs, unknown] ? Fs : never} TuplePop - */ -/** - * @template {readonly unknown[]} T - * @typedef {T extends [] - * ? {} - * : T extends [infer First] - * ? First - * : T extends [infer First, ...infer Rest] - * ? First & Intersect - * : never - * } Intersect - */ -declare const schemaSymbol: unique symbol; -/** - * @extends Schema - */ -declare class $Never extends Schema { - constructor(); -} -import * as prng from './prng.js'; -declare const isOptionalSymbol: unique symbol; -export {}; -//# sourceMappingURL=schema.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/schema.d.ts.map b/yjs-poll/node_modules/lib0/dist/schema.d.ts.map deleted file mode 100644 index 29d6759..0000000 --- a/yjs-poll/node_modules/lib0/dist/schema.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../schema.js"],"names":[],"mappings":"AAoEA;IAEI;;;OAGG;IACH,QAFU,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,OAAC,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,OAAC,CAAA;KAAE,CAAC,CAEnE;IAGlB;;;;;OAKG;IACH,aALW,MAAM,OAAC,YACP,MAAM,OACN,MAAM,YACN,MAAM,OAAC,QAIjB;IAED,mBAQC;CACF;AAwBD;;;GAGG;AACH,oBAHa,CAAC,aACE,cAAc,CAAC,aAAa;IAI1C;;;;OAIG;IACH,mCAAuB;IAEvB;;OAEG;IACH,eAFW,MAAM,CAAC,GAAG,CAAC,WAMrB;IAED;;;;OAIG;IACH,cAFW,MAAM,CAAC,GAAG,CAAC,WAKrB;IAWD;;;;;;;OAOG;IACH,YAHW,CAAC,GACA,OAAO,CAIlB;IAGD;;;;;;OAMG;IACH,UAJW,GAAG,SACH,eAAe,GACd,EAAE,IAAI,CAAC,CAIlB;IAGD;;OAEG;IACH,gBAFU,MAAM,CAAC,CAAC,OAAC,CAA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IACF,UAAU,CAAC,OAAO,CAAC,CAAC,EAAC,OAAO,CAAC,EAAE,SAAS,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE,SAAS,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC,EAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gCA19BpF,qBAAqB;AAqarD;;;GAGG;AACH,wBAH2B,CAAC,SAAd,MAAM,CAAC,GAAG,CAAE;IAIxB;;OAEG;IACH,mBAFW,CAAC,EAKX;IADC,SAAkB;IAepB,kCAAyC;CAC1C;AAzbD;;GAEG;AAEH;;GAEG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;;;;;;;GAUG;AAEH,0CAAsC;AA0YtC;;GAEG;AACH;;CAWC;sBA7cqB,WAAW;AAiajC,8CAA2C"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/schema.test.d.ts b/yjs-poll/node_modules/lib0/dist/schema.test.d.ts deleted file mode 100644 index a6d6d4d..0000000 --- a/yjs-poll/node_modules/lib0/dist/schema.test.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -export function testSchemas(_tc: t.TestCase): void; -export function testSchemaExpect(): void; -export function testObjectSchemaOptionals(_tc: t.TestCase): void; -export function testMetaSchemas(_tc: t.TestCase): void; -export function testStringTemplate(_tc: t.TestCase): void; -export function testSchemaExtends(_tc: t.TestCase): void; -export function testSchemaErrors(_tc: t.TestCase): void; -export function testUnionMerging(_tc: t.TestCase): void; -export function testConvenienceHelper(): void; -export function testPatternMatcherBase(): void; -export function testPatternMatcherWithState(): void; -export function testPatternMatcherBenchmark(): void; -export function testRepeatRandomFromSchema(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=schema.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/schema.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/schema.test.d.ts.map deleted file mode 100644 index 04ac756..0000000 --- a/yjs-poll/node_modules/lib0/dist/schema.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"schema.test.d.ts","sourceRoot":"","sources":["../schema.test.js"],"names":[],"mappings":"AAQO,iCAFI,CAAC,CAAC,QAAQ,QAqPpB;AAEM,yCAMN;AAKM,+CAFI,CAAC,CAAC,QAAQ,QAiBpB;AAKM,qCAFI,CAAC,CAAC,QAAQ,QA0BpB;AAKM,wCAFI,CAAC,CAAC,QAAQ,QAmBpB;AAKM,uCAFI,CAAC,CAAC,QAAQ,QAUpB;AAKM,sCAFI,CAAC,CAAC,QAAQ,QASpB;AAMM,sCAFI,CAAC,CAAC,QAAQ,QAcpB;AAEM,8CAqBN;AAEM,+CAmBN;AAEM,oDAuBN;AAEM,oDA8IN;AAKM,+CAFI,CAAC,CAAC,QAAQ,QA4BpB;mBAzmBkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/set-5b47859e.cjs b/yjs-poll/node_modules/lib0/dist/set-5b47859e.cjs deleted file mode 100644 index 5126d94..0000000 --- a/yjs-poll/node_modules/lib0/dist/set-5b47859e.cjs +++ /dev/null @@ -1,45 +0,0 @@ -'use strict'; - -/** - * Utility module to work with sets. - * - * @module set - */ - -const create = () => new Set(); - -/** - * @template T - * @param {Set} set - * @return {Array} - */ -const toArray = set => Array.from(set); - -/** - * @template T - * @param {Set} set - * @return {T|undefined} - */ -const first = set => set.values().next().value; - -/** - * @template T - * @param {Iterable} entries - * @return {Set} - */ -const from = entries => new Set(entries); - -var set = /*#__PURE__*/Object.freeze({ - __proto__: null, - create: create, - toArray: toArray, - first: first, - from: from -}); - -exports.create = create; -exports.first = first; -exports.from = from; -exports.set = set; -exports.toArray = toArray; -//# sourceMappingURL=set-5b47859e.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/set-5b47859e.cjs.map b/yjs-poll/node_modules/lib0/dist/set-5b47859e.cjs.map deleted file mode 100644 index e56cd9d..0000000 --- a/yjs-poll/node_modules/lib0/dist/set-5b47859e.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"set-5b47859e.cjs","sources":["../set.js"],"sourcesContent":["/**\n * Utility module to work with sets.\n *\n * @module set\n */\n\nexport const create = () => new Set()\n\n/**\n * @template T\n * @param {Set} set\n * @return {Array}\n */\nexport const toArray = set => Array.from(set)\n\n/**\n * @template T\n * @param {Set} set\n * @return {T|undefined}\n */\nexport const first = set => set.values().next().value\n\n/**\n * @template T\n * @param {Iterable} entries\n * @return {Set}\n */\nexport const from = entries => new Set(entries)\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,MAAM,IAAI,GAAG,GAAE;AACrC;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,OAAO,GAAG,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,EAAC;AAC7C;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,KAAK,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,MAAK;AACrD;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,IAAI,GAAG,OAAO,IAAI,IAAI,GAAG,CAAC,OAAO;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/set.cjs b/yjs-poll/node_modules/lib0/dist/set.cjs deleted file mode 100644 index 1cbea6d..0000000 --- a/yjs-poll/node_modules/lib0/dist/set.cjs +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var set = require('./set-5b47859e.cjs'); - - - -exports.create = set.create; -exports.first = set.first; -exports.from = set.from; -exports.toArray = set.toArray; -//# sourceMappingURL=set.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/set.cjs.map b/yjs-poll/node_modules/lib0/dist/set.cjs.map deleted file mode 100644 index ce54f1a..0000000 --- a/yjs-poll/node_modules/lib0/dist/set.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"set.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/set.d.ts b/yjs-poll/node_modules/lib0/dist/set.d.ts deleted file mode 100644 index 28aff5d..0000000 --- a/yjs-poll/node_modules/lib0/dist/set.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function create(): Set; -export function toArray(set: Set): Array; -export function first(set: Set): T | undefined; -export function from(entries: Iterable): Set; -//# sourceMappingURL=set.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/set.d.ts.map b/yjs-poll/node_modules/lib0/dist/set.d.ts.map deleted file mode 100644 index 74bf751..0000000 --- a/yjs-poll/node_modules/lib0/dist/set.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../set.js"],"names":[],"mappings":"AAMO,mCAA8B;AAO9B,wBAJM,CAAC,OACH,GAAG,CAAC,CAAC,CAAC,GACL,KAAK,CAAC,CAAC,CAAC,CAEyB;AAOtC,sBAJM,CAAC,OACH,GAAG,CAAC,CAAC,CAAC,GACL,CAAC,GAAC,SAAS,CAE8B;AAO9C,qBAJM,CAAC,WACH,QAAQ,CAAC,CAAC,CAAC,GACV,GAAG,CAAC,CAAC,CAAC,CAE6B"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/set.test.d.ts b/yjs-poll/node_modules/lib0/dist/set.test.d.ts deleted file mode 100644 index 075f0d1..0000000 --- a/yjs-poll/node_modules/lib0/dist/set.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testFirst(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=set.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/set.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/set.test.d.ts.map deleted file mode 100644 index ca0a434..0000000 --- a/yjs-poll/node_modules/lib0/dist/set.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"set.test.d.ts","sourceRoot":"","sources":["../set.test.js"],"names":[],"mappings":"AAMO,+BAFI,CAAC,CAAC,QAAQ,QAUpB;mBAdkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/sha256.cjs b/yjs-poll/node_modules/lib0/dist/sha256.cjs deleted file mode 100644 index da9f76d..0000000 --- a/yjs-poll/node_modules/lib0/dist/sha256.cjs +++ /dev/null @@ -1,183 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var binary = require('./binary-ac8e39e2.cjs'); - -/** - * @module sha256 - * Spec: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf - * Resources: - * - https://web.archive.org/web/20150315061807/http://csrc.nist.gov/groups/STM/cavp/documents/shs/sha256-384-512.pdf - */ - -/** - * @param {number} w - a 32bit uint - * @param {number} shift - */ -const rotr = (w, shift) => (w >>> shift) | (w << (32 - shift)); - -/** - * Helper for SHA-224 & SHA-256. See 4.1.2. - * @param {number} x - */ -const sum0to256 = x => rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22); - -/** - * Helper for SHA-224 & SHA-256. See 4.1.2. - * @param {number} x - */ -const sum1to256 = x => rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25); - -/** - * Helper for SHA-224 & SHA-256. See 4.1.2. - * @param {number} x - */ -const sigma0to256 = x => rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3; - -/** - * Helper for SHA-224 & SHA-256. See 4.1.2. - * @param {number} x - */ -const sigma1to256 = x => rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10; - -// @todo don't init these variables globally - -/** - * See 4.2.2: Constant for sha256 & sha224 - * These words represent the first thirty-two bits of the fractional parts of - * the cube roots of the first sixty-four prime numbers. In hex, these constant words are (from left to - * right) - */ -const K = new Uint32Array([ - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 -]); - -/** - * See 5.3.3. Initial hash value. - * - * These words were obtained by taking the first thirty-two bits of the fractional parts of the - * square roots of the first eight prime numbers. - * - * @todo shouldn't be a global variable - */ -const HINIT = new Uint32Array([ - 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 -]); - -// time to beat: (large value < 4.35s) - -class Hasher { - constructor () { - const buf = new ArrayBuffer(64 + 64 * 4); - // Init working variables using a single arraybuffer - this._H = new Uint32Array(buf, 0, 8); - this._H.set(HINIT); - // "Message schedule" - a working variable - this._W = new Uint32Array(buf, 64, 64); - } - - _updateHash () { - const H = this._H; - const W = this._W; - for (let t = 16; t < 64; t++) { - W[t] = sigma1to256(W[t - 2]) + W[t - 7] + sigma0to256(W[t - 15]) + W[t - 16]; - } - let a = H[0]; - let b = H[1]; - let c = H[2]; - let d = H[3]; - let e = H[4]; - let f = H[5]; - let g = H[6]; - let h = H[7]; - for (let tt = 0, T1, T2; tt < 64; tt++) { - T1 = (h + sum1to256(e) + ((e & f) ^ (~e & g)) + K[tt] + W[tt]) >>> 0; - T2 = (sum0to256(a) + ((a & b) ^ (a & c) ^ (b & c))) >>> 0; - h = g; - g = f; - f = e; - e = (d + T1) >>> 0; - d = c; - c = b; - b = a; - a = (T1 + T2) >>> 0; - } - H[0] += a; - H[1] += b; - H[2] += c; - H[3] += d; - H[4] += e; - H[5] += f; - H[6] += g; - H[7] += h; - } - - /** - * Returns a 32-byte hash. - * - * @param {Uint8Array} data - */ - digest (data) { - let i = 0; - for (; i + 56 <= data.length;) { - // write data in big endianess - let j = 0; - for (; j < 16 && i + 3 < data.length; j++) { - this._W[j] = data[i++] << 24 | data[i++] << 16 | data[i++] << 8 | data[i++]; - } - if (i % 64 !== 0) { // there is still room to write partial content and the ending bit. - this._W.fill(0, j, 16); - while (i < data.length) { - this._W[j] |= data[i] << ((3 - (i % 4)) * 8); - i++; - } - this._W[j] |= binary.BIT8 << ((3 - (i % 4)) * 8); - } - this._updateHash(); - } - // same check as earlier - the ending bit has been written - const isPaddedWith1 = i % 64 !== 0; - this._W.fill(0, 0, 16); - let j = 0; - for (; i < data.length; j++) { - for (let ci = 3; ci >= 0 && i < data.length; ci--) { - this._W[j] |= data[i++] << (ci * 8); - } - } - // Write padding of the message. See 5.1.2. - if (!isPaddedWith1) { - this._W[j - (i % 4 === 0 ? 0 : 1)] |= binary.BIT8 << ((3 - (i % 4)) * 8); - } - // write length of message (size in bits) as 64 bit uint - // @todo test that this works correctly - this._W[14] = data.byteLength / binary.BIT30; // same as data.byteLength >>> 30 - but works on floats - this._W[15] = data.byteLength * 8; - this._updateHash(); - // correct H endianness to use big endiannes and return a Uint8Array - const dv = new Uint8Array(32); - for (let i = 0; i < this._H.length; i++) { - for (let ci = 0; ci < 4; ci++) { - dv[i * 4 + ci] = this._H[i] >>> (3 - ci) * 8; - } - } - return dv - } -} - -/** - * Returns a 32-byte hash. - * - * @param {Uint8Array} data - */ -const digest = data => new Hasher().digest(data); - -exports.digest = digest; -//# sourceMappingURL=sha256.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/sha256.cjs.map b/yjs-poll/node_modules/lib0/dist/sha256.cjs.map deleted file mode 100644 index 46b7281..0000000 --- a/yjs-poll/node_modules/lib0/dist/sha256.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha256.cjs","sources":["../hash/sha256.js"],"sourcesContent":["/**\n * @module sha256\n * Spec: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf\n * Resources:\n * - https://web.archive.org/web/20150315061807/http://csrc.nist.gov/groups/STM/cavp/documents/shs/sha256-384-512.pdf\n */\n\nimport * as binary from '../binary.js'\n\n/**\n * @param {number} w - a 32bit uint\n * @param {number} shift\n */\nconst rotr = (w, shift) => (w >>> shift) | (w << (32 - shift))\n\n/**\n * Helper for SHA-224 & SHA-256. See 4.1.2.\n * @param {number} x\n */\nconst sum0to256 = x => rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22)\n\n/**\n * Helper for SHA-224 & SHA-256. See 4.1.2.\n * @param {number} x\n */\nconst sum1to256 = x => rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25)\n\n/**\n * Helper for SHA-224 & SHA-256. See 4.1.2.\n * @param {number} x\n */\nconst sigma0to256 = x => rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3\n\n/**\n * Helper for SHA-224 & SHA-256. See 4.1.2.\n * @param {number} x\n */\nconst sigma1to256 = x => rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10\n\n// @todo don't init these variables globally\n\n/**\n * See 4.2.2: Constant for sha256 & sha224\n * These words represent the first thirty-two bits of the fractional parts of\n * the cube roots of the first sixty-four prime numbers. In hex, these constant words are (from left to\n * right)\n */\nconst K = new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n])\n\n/**\n * See 5.3.3. Initial hash value.\n *\n * These words were obtained by taking the first thirty-two bits of the fractional parts of the\n * square roots of the first eight prime numbers.\n *\n * @todo shouldn't be a global variable\n */\nconst HINIT = new Uint32Array([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19\n])\n\n// time to beat: (large value < 4.35s)\n\nclass Hasher {\n constructor () {\n const buf = new ArrayBuffer(64 + 64 * 4)\n // Init working variables using a single arraybuffer\n this._H = new Uint32Array(buf, 0, 8)\n this._H.set(HINIT)\n // \"Message schedule\" - a working variable\n this._W = new Uint32Array(buf, 64, 64)\n }\n\n _updateHash () {\n const H = this._H\n const W = this._W\n for (let t = 16; t < 64; t++) {\n W[t] = sigma1to256(W[t - 2]) + W[t - 7] + sigma0to256(W[t - 15]) + W[t - 16]\n }\n let a = H[0]\n let b = H[1]\n let c = H[2]\n let d = H[3]\n let e = H[4]\n let f = H[5]\n let g = H[6]\n let h = H[7]\n for (let tt = 0, T1, T2; tt < 64; tt++) {\n T1 = (h + sum1to256(e) + ((e & f) ^ (~e & g)) + K[tt] + W[tt]) >>> 0\n T2 = (sum0to256(a) + ((a & b) ^ (a & c) ^ (b & c))) >>> 0\n h = g\n g = f\n f = e\n e = (d + T1) >>> 0\n d = c\n c = b\n b = a\n a = (T1 + T2) >>> 0\n }\n H[0] += a\n H[1] += b\n H[2] += c\n H[3] += d\n H[4] += e\n H[5] += f\n H[6] += g\n H[7] += h\n }\n\n /**\n * Returns a 32-byte hash.\n *\n * @param {Uint8Array} data\n */\n digest (data) {\n let i = 0\n for (; i + 56 <= data.length;) {\n // write data in big endianess\n let j = 0\n for (; j < 16 && i + 3 < data.length; j++) {\n this._W[j] = data[i++] << 24 | data[i++] << 16 | data[i++] << 8 | data[i++]\n }\n if (i % 64 !== 0) { // there is still room to write partial content and the ending bit.\n this._W.fill(0, j, 16)\n while (i < data.length) {\n this._W[j] |= data[i] << ((3 - (i % 4)) * 8)\n i++\n }\n this._W[j] |= binary.BIT8 << ((3 - (i % 4)) * 8)\n }\n this._updateHash()\n }\n // same check as earlier - the ending bit has been written\n const isPaddedWith1 = i % 64 !== 0\n this._W.fill(0, 0, 16)\n let j = 0\n for (; i < data.length; j++) {\n for (let ci = 3; ci >= 0 && i < data.length; ci--) {\n this._W[j] |= data[i++] << (ci * 8)\n }\n }\n // Write padding of the message. See 5.1.2.\n if (!isPaddedWith1) {\n this._W[j - (i % 4 === 0 ? 0 : 1)] |= binary.BIT8 << ((3 - (i % 4)) * 8)\n }\n // write length of message (size in bits) as 64 bit uint\n // @todo test that this works correctly\n this._W[14] = data.byteLength / binary.BIT30 // same as data.byteLength >>> 30 - but works on floats\n this._W[15] = data.byteLength * 8\n this._updateHash()\n // correct H endianness to use big endiannes and return a Uint8Array\n const dv = new Uint8Array(32)\n for (let i = 0; i < this._H.length; i++) {\n for (let ci = 0; ci < 4; ci++) {\n dv[i * 4 + ci] = this._H[i] >>> (3 - ci) * 8\n }\n }\n return dv\n }\n}\n\n/**\n * Returns a 32-byte hash.\n *\n * @param {Uint8Array} data\n */\nexport const digest = data => new Hasher().digest(data)\n"],"names":["binary.BIT8","binary.BIT30"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA,MAAM,IAAI,GAAG,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,EAAC;AAC9D;AACA;AACA;AACA;AACA;AACA,MAAM,SAAS,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,EAAE,EAAC;AAC7D;AACA;AACA;AACA;AACA;AACA,MAAM,SAAS,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,EAAE,EAAC;AAC7D;AACA;AACA;AACA;AACA;AACA,MAAM,WAAW,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,EAAC;AAC3D;AACA;AACA;AACA;AACA;AACA,MAAM,WAAW,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,GAAE;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC,GAAG,IAAI,WAAW,CAAC;AAC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ACY,MAAC,MAAM,GAAG,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/sha256.node.cjs b/yjs-poll/node_modules/lib0/dist/sha256.node.cjs deleted file mode 100644 index be0b3e6..0000000 --- a/yjs-poll/node_modules/lib0/dist/sha256.node.cjs +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var node_crypto = require('node:crypto'); - -/** - * @param {Uint8Array} data - */ -const digest = data => { - const hasher = node_crypto.createHash('sha256'); - hasher.update(data); - return hasher.digest() -}; - -exports.digest = digest; -//# sourceMappingURL=sha256.node.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/sha256.node.cjs.map b/yjs-poll/node_modules/lib0/dist/sha256.node.cjs.map deleted file mode 100644 index 222e563..0000000 --- a/yjs-poll/node_modules/lib0/dist/sha256.node.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha256.node.cjs","sources":["../hash/sha256.node.js"],"sourcesContent":["import { createHash } from 'node:crypto'\n\n/**\n * @param {Uint8Array} data\n */\nexport const digest = data => {\n const hasher = createHash('sha256')\n hasher.update(data)\n return hasher.digest()\n}\n"],"names":["createHash"],"mappings":";;;;;;AAEA;AACA;AACA;AACY,MAAC,MAAM,GAAG,IAAI,IAAI;AAC9B,EAAE,MAAM,MAAM,GAAGA,sBAAU,CAAC,QAAQ,EAAC;AACrC,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAC;AACrB,EAAE,OAAO,MAAM,CAAC,MAAM,EAAE;AACxB;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/sort-812cc211.cjs b/yjs-poll/node_modules/lib0/dist/sort-812cc211.cjs deleted file mode 100644 index c842102..0000000 --- a/yjs-poll/node_modules/lib0/dist/sort-812cc211.cjs +++ /dev/null @@ -1,103 +0,0 @@ -'use strict'; - -var math = require('./math-96d5e8c4.cjs'); - -/** - * Efficient sort implementations. - * - * Note: These sort implementations were created to compare different sorting algorithms in JavaScript. - * Don't use them if you don't know what you are doing. Native Array.sort is almost always a better choice. - * - * @module sort - */ - -/** - * @template T - * @param {Array} arr - * @param {number} lo - * @param {number} hi - * @param {function(T,T):number} compare - */ -const _insertionSort = (arr, lo, hi, compare) => { - for (let i = lo + 1; i <= hi; i++) { - for (let j = i; j > 0 && compare(arr[j - 1], arr[j]) > 0; j--) { - const tmp = arr[j]; - arr[j] = arr[j - 1]; - arr[j - 1] = tmp; - } - } -}; - -/** - * @template T - * @param {Array} arr - * @param {function(T,T):number} compare - * @return {void} - */ -const insertionSort = (arr, compare) => { - _insertionSort(arr, 0, arr.length - 1, compare); -}; - -/** - * @template T - * @param {Array} arr - * @param {number} lo - * @param {number} hi - * @param {function(T,T):number} compare - */ -const _quickSort = (arr, lo, hi, compare) => { - if (hi - lo < 42) { - _insertionSort(arr, lo, hi, compare); - } else { - const pivot = arr[math.floor((lo + hi) / 2)]; - let i = lo; - let j = hi; - while (true) { - while (compare(pivot, arr[i]) > 0) { - i++; - } - while (compare(arr[j], pivot) > 0) { - j--; - } - if (i >= j) { - break - } - // swap arr[i] with arr[j] - // and increment i and j - const arri = arr[i]; - arr[i++] = arr[j]; - arr[j--] = arri; - } - _quickSort(arr, lo, j, compare); - _quickSort(arr, j + 1, hi, compare); - } -}; - -/** - * This algorithm beats Array.prototype.sort in Chrome only with arrays with 10 million entries. - * In most cases [].sort will do just fine. Make sure to performance test your use-case before you - * integrate this algorithm. - * - * Note that Chrome's sort is now a stable algorithm (Timsort). Quicksort is not stable. - * - * @template T - * @param {Array} arr - * @param {function(T,T):number} compare - * @return {void} - */ -const quicksort = (arr, compare) => { - _quickSort(arr, 0, arr.length - 1, compare); -}; - -var sort = /*#__PURE__*/Object.freeze({ - __proto__: null, - _insertionSort: _insertionSort, - insertionSort: insertionSort, - quicksort: quicksort -}); - -exports._insertionSort = _insertionSort; -exports.insertionSort = insertionSort; -exports.quicksort = quicksort; -exports.sort = sort; -//# sourceMappingURL=sort-812cc211.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/sort-812cc211.cjs.map b/yjs-poll/node_modules/lib0/dist/sort-812cc211.cjs.map deleted file mode 100644 index a747142..0000000 --- a/yjs-poll/node_modules/lib0/dist/sort-812cc211.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sort-812cc211.cjs","sources":["../sort.js"],"sourcesContent":["/**\n * Efficient sort implementations.\n *\n * Note: These sort implementations were created to compare different sorting algorithms in JavaScript.\n * Don't use them if you don't know what you are doing. Native Array.sort is almost always a better choice.\n *\n * @module sort\n */\n\nimport * as math from './math.js'\n\n/**\n * @template T\n * @param {Array} arr\n * @param {number} lo\n * @param {number} hi\n * @param {function(T,T):number} compare\n */\nexport const _insertionSort = (arr, lo, hi, compare) => {\n for (let i = lo + 1; i <= hi; i++) {\n for (let j = i; j > 0 && compare(arr[j - 1], arr[j]) > 0; j--) {\n const tmp = arr[j]\n arr[j] = arr[j - 1]\n arr[j - 1] = tmp\n }\n }\n}\n\n/**\n * @template T\n * @param {Array} arr\n * @param {function(T,T):number} compare\n * @return {void}\n */\nexport const insertionSort = (arr, compare) => {\n _insertionSort(arr, 0, arr.length - 1, compare)\n}\n\n/**\n * @template T\n * @param {Array} arr\n * @param {number} lo\n * @param {number} hi\n * @param {function(T,T):number} compare\n */\nconst _quickSort = (arr, lo, hi, compare) => {\n if (hi - lo < 42) {\n _insertionSort(arr, lo, hi, compare)\n } else {\n const pivot = arr[math.floor((lo + hi) / 2)]\n let i = lo\n let j = hi\n while (true) {\n while (compare(pivot, arr[i]) > 0) {\n i++\n }\n while (compare(arr[j], pivot) > 0) {\n j--\n }\n if (i >= j) {\n break\n }\n // swap arr[i] with arr[j]\n // and increment i and j\n const arri = arr[i]\n arr[i++] = arr[j]\n arr[j--] = arri\n }\n _quickSort(arr, lo, j, compare)\n _quickSort(arr, j + 1, hi, compare)\n }\n}\n\n/**\n * This algorithm beats Array.prototype.sort in Chrome only with arrays with 10 million entries.\n * In most cases [].sort will do just fine. Make sure to performance test your use-case before you\n * integrate this algorithm.\n *\n * Note that Chrome's sort is now a stable algorithm (Timsort). Quicksort is not stable.\n *\n * @template T\n * @param {Array} arr\n * @param {function(T,T):number} compare\n * @return {void}\n */\nexport const quicksort = (arr, compare) => {\n _quickSort(arr, 0, arr.length - 1, compare)\n}\n"],"names":["math.floor"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAG,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,KAAK;AACxD,EAAE,KAAK,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE;AACrC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AACnE,MAAM,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,EAAC;AACxB,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,EAAC;AACzB,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAG;AACtB,KAAK;AACL,GAAG;AACH,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,aAAa,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK;AAC/C,EAAE,cAAc,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,OAAO,EAAC;AACjD,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,UAAU,GAAG,CAAC,GAAG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GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,OAAO,EAAC;AAC7C;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/sort.cjs b/yjs-poll/node_modules/lib0/dist/sort.cjs deleted file mode 100644 index e7203ac..0000000 --- a/yjs-poll/node_modules/lib0/dist/sort.cjs +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./math-96d5e8c4.cjs'); -var sort = require('./sort-812cc211.cjs'); - - - -exports._insertionSort = sort._insertionSort; -exports.insertionSort = sort.insertionSort; -exports.quicksort = sort.quicksort; -//# sourceMappingURL=sort.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/sort.cjs.map b/yjs-poll/node_modules/lib0/dist/sort.cjs.map deleted file mode 100644 index d8561ec..0000000 --- a/yjs-poll/node_modules/lib0/dist/sort.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sort.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/sort.d.ts b/yjs-poll/node_modules/lib0/dist/sort.d.ts deleted file mode 100644 index d364b4a..0000000 --- a/yjs-poll/node_modules/lib0/dist/sort.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function _insertionSort(arr: Array, lo: number, hi: number, compare: (arg0: T, arg1: T) => number): void; -export function insertionSort(arr: Array, compare: (arg0: T, arg1: T) => number): void; -export function quicksort(arr: Array, compare: (arg0: T, arg1: T) => number): void; -//# sourceMappingURL=sort.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/sort.d.ts.map b/yjs-poll/node_modules/lib0/dist/sort.d.ts.map deleted file mode 100644 index 6a9b413..0000000 --- a/yjs-poll/node_modules/lib0/dist/sort.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../sort.js"],"names":[],"mappings":"AAkBO,+BANM,CAAC,OACH,KAAK,CAAC,CAAC,CAAC,MACR,MAAM,MACN,MAAM,WACN,CAAS,IAAC,EAAD,CAAC,EAAC,IAAC,EAAD,CAAC,KAAE,MAAM,QAU9B;AAQM,8BALM,CAAC,OACH,KAAK,CAAC,CAAC,CAAC,WACR,CAAS,IAAC,EAAD,CAAC,EAAC,IAAC,EAAD,CAAC,KAAE,MAAM,GACnB,IAAI,CAIf;AAiDM,0BALM,CAAC,OACH,KAAK,CAAC,CAAC,CAAC,WACR,CAAS,IAAC,EAAD,CAAC,EAAC,IAAC,EAAD,CAAC,KAAE,MAAM,GACnB,IAAI,CAIf"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/sort.test.d.ts b/yjs-poll/node_modules/lib0/dist/sort.test.d.ts deleted file mode 100644 index 11344b1..0000000 --- a/yjs-poll/node_modules/lib0/dist/sort.test.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function testSortUint8(tc: t.TestCase): void; -export function testSortUint32(tc: t.TestCase): void; -export function testSortUint16(tc: t.TestCase): void; -export function testSortObjectUint32(tc: t.TestCase): void; -export function testListVsArrayPerformance(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=sort.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/sort.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/sort.test.d.ts.map deleted file mode 100644 index 009caa7..0000000 --- a/yjs-poll/node_modules/lib0/dist/sort.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sort.test.d.ts","sourceRoot":"","sources":["../sort.test.js"],"names":[],"mappings":"AAoEO,kCAFI,CAAC,CAAC,QAAQ,QAoBpB;AAKM,mCAFI,CAAC,CAAC,QAAQ,QAoBpB;AAKM,mCAFI,CAAC,CAAC,QAAQ,QAoBpB;AAKM,yCAFI,CAAC,CAAC,QAAQ,QAoBpB;AAKM,+CAFI,CAAC,CAAC,QAAQ,QA4BpB;mBAzLkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/statistics-65f6114b.cjs b/yjs-poll/node_modules/lib0/dist/statistics-65f6114b.cjs deleted file mode 100644 index 079af92..0000000 --- a/yjs-poll/node_modules/lib0/dist/statistics-65f6114b.cjs +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -var math = require('./math-96d5e8c4.cjs'); - -/** - * Utility helpers for generating statistics. - * - * @module statistics - */ - -/** - * @param {Array} arr Array of values - * @return {number} Returns null if the array is empty - */ -const median = arr => arr.length === 0 ? NaN : (arr.length % 2 === 1 ? arr[(arr.length - 1) / 2] : (arr[math.floor((arr.length - 1) / 2)] + arr[math.ceil((arr.length - 1) / 2)]) / 2); - -/** - * @param {Array} arr - * @return {number} - */ -const average = arr => arr.reduce(math.add, 0) / arr.length; - -var statistics = /*#__PURE__*/Object.freeze({ - __proto__: null, - median: median, - average: average -}); - -exports.average = average; -exports.median = median; -exports.statistics = statistics; -//# sourceMappingURL=statistics-65f6114b.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/statistics-65f6114b.cjs.map b/yjs-poll/node_modules/lib0/dist/statistics-65f6114b.cjs.map deleted file mode 100644 index 34e30e5..0000000 --- a/yjs-poll/node_modules/lib0/dist/statistics-65f6114b.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"statistics-65f6114b.cjs","sources":["../statistics.js"],"sourcesContent":["/**\n * Utility helpers for generating statistics.\n *\n * @module statistics\n */\n\nimport * as math from './math.js'\n\n/**\n * @param {Array} arr Array of values\n * @return {number} Returns null if the array is empty\n */\nexport const median = arr => arr.length === 0 ? NaN : (arr.length % 2 === 1 ? arr[(arr.length - 1) / 2] : (arr[math.floor((arr.length - 1) / 2)] + arr[math.ceil((arr.length - 1) / 2)]) / 2)\n\n/**\n * @param {Array} arr\n * @return {number}\n */\nexport const average = arr => arr.reduce(math.add, 0) / arr.length\n"],"names":["math.floor","math.ceil","math.add"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAACA,UAAU,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAACC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAC;AAC7L;AACA;AACA;AACA;AACA;AACY,MAAC,OAAO,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAACC,QAAQ,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/statistics.cjs b/yjs-poll/node_modules/lib0/dist/statistics.cjs deleted file mode 100644 index 148b4c7..0000000 --- a/yjs-poll/node_modules/lib0/dist/statistics.cjs +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./math-96d5e8c4.cjs'); -var statistics = require('./statistics-65f6114b.cjs'); - - - -exports.average = statistics.average; -exports.median = statistics.median; -//# sourceMappingURL=statistics.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/statistics.cjs.map b/yjs-poll/node_modules/lib0/dist/statistics.cjs.map deleted file mode 100644 index 01cbd80..0000000 --- a/yjs-poll/node_modules/lib0/dist/statistics.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"statistics.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/statistics.d.ts b/yjs-poll/node_modules/lib0/dist/statistics.d.ts deleted file mode 100644 index 3033ab6..0000000 --- a/yjs-poll/node_modules/lib0/dist/statistics.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function median(arr: Array): number; -export function average(arr: Array): number; -//# sourceMappingURL=statistics.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/statistics.d.ts.map b/yjs-poll/node_modules/lib0/dist/statistics.d.ts.map deleted file mode 100644 index e1128ae..0000000 --- a/yjs-poll/node_modules/lib0/dist/statistics.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"statistics.d.ts","sourceRoot":"","sources":["../statistics.js"],"names":[],"mappings":"AAYO,4BAHI,KAAK,CAAC,MAAM,CAAC,GACZ,MAAM,CAE2K;AAMtL,6BAHI,KAAK,CAAC,MAAM,CAAC,GACZ,MAAM,CAEgD"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/statistics.test.d.ts b/yjs-poll/node_modules/lib0/dist/statistics.test.d.ts deleted file mode 100644 index 22230d6..0000000 --- a/yjs-poll/node_modules/lib0/dist/statistics.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testMedian(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=statistics.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/statistics.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/statistics.test.d.ts.map deleted file mode 100644 index 423a993..0000000 --- a/yjs-poll/node_modules/lib0/dist/statistics.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"statistics.test.d.ts","sourceRoot":"","sources":["../statistics.test.js"],"names":[],"mappings":"AAOO,+BAFI,CAAC,CAAC,QAAQ,QASpB;mBAbkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/storage.cjs b/yjs-poll/node_modules/lib0/dist/storage.cjs deleted file mode 100644 index bed6780..0000000 --- a/yjs-poll/node_modules/lib0/dist/storage.cjs +++ /dev/null @@ -1,81 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -/* eslint-env browser */ - -/** - * Isomorphic variable storage. - * - * Uses LocalStorage in the browser and falls back to in-memory storage. - * - * @module storage - */ - -/* c8 ignore start */ -class VarStoragePolyfill { - constructor () { - this.map = new Map(); - } - - /** - * @param {string} key - * @param {any} newValue - */ - setItem (key, newValue) { - this.map.set(key, newValue); - } - - /** - * @param {string} key - */ - getItem (key) { - return this.map.get(key) - } -} -/* c8 ignore stop */ - -/** - * @type {any} - */ -let _localStorage = new VarStoragePolyfill(); -let usePolyfill = true; - -/* c8 ignore start */ -try { - // if the same-origin rule is violated, accessing localStorage might thrown an error - if (typeof localStorage !== 'undefined' && localStorage) { - _localStorage = localStorage; - usePolyfill = false; - } -} catch (e) { } -/* c8 ignore stop */ - -/** - * This is basically localStorage in browser, or a polyfill in nodejs - */ -/* c8 ignore next */ -const varStorage = _localStorage; - -/** - * A polyfill for `addEventListener('storage', event => {..})` that does nothing if the polyfill is being used. - * - * @param {function({ key: string, newValue: string, oldValue: string }): void} eventHandler - * @function - */ -/* c8 ignore next */ -const onChange = eventHandler => usePolyfill || addEventListener('storage', /** @type {any} */ (eventHandler)); - -/** - * A polyfill for `removeEventListener('storage', event => {..})` that does nothing if the polyfill is being used. - * - * @param {function({ key: string, newValue: string, oldValue: string }): void} eventHandler - * @function - */ -/* c8 ignore next */ -const offChange = eventHandler => usePolyfill || removeEventListener('storage', /** @type {any} */ (eventHandler)); - -exports.offChange = offChange; -exports.onChange = onChange; -exports.varStorage = varStorage; -//# sourceMappingURL=storage.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/storage.cjs.map b/yjs-poll/node_modules/lib0/dist/storage.cjs.map deleted file mode 100644 index c2adf94..0000000 --- a/yjs-poll/node_modules/lib0/dist/storage.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"storage.cjs","sources":["../storage.js"],"sourcesContent":["/* eslint-env browser */\n\n/**\n * Isomorphic variable storage.\n *\n * Uses LocalStorage in the browser and falls back to in-memory storage.\n *\n * @module storage\n */\n\n/* c8 ignore start */\nclass VarStoragePolyfill {\n constructor () {\n this.map = new Map()\n }\n\n /**\n * @param {string} key\n * @param {any} newValue\n */\n setItem (key, newValue) {\n this.map.set(key, newValue)\n }\n\n /**\n * @param {string} key\n */\n getItem (key) {\n return this.map.get(key)\n }\n}\n/* c8 ignore stop */\n\n/**\n * @type {any}\n */\nlet _localStorage = new VarStoragePolyfill()\nlet usePolyfill = true\n\n/* c8 ignore start */\ntry {\n // if the same-origin rule is violated, accessing localStorage might thrown an error\n if (typeof localStorage !== 'undefined' && localStorage) {\n _localStorage = localStorage\n usePolyfill = false\n }\n} catch (e) { }\n/* c8 ignore stop */\n\n/**\n * This is basically localStorage in browser, or a polyfill in nodejs\n */\n/* c8 ignore next */\nexport const varStorage = _localStorage\n\n/**\n * A polyfill for `addEventListener('storage', event => {..})` that does nothing if the polyfill is being used.\n *\n * @param {function({ key: string, newValue: string, oldValue: string }): void} eventHandler\n * @function\n */\n/* c8 ignore next */\nexport const onChange = eventHandler => usePolyfill || addEventListener('storage', /** @type {any} */ (eventHandler))\n\n/**\n * A polyfill for `removeEventListener('storage', event => {..})` that does nothing if the polyfill is being used.\n *\n * @param {function({ key: string, newValue: string, oldValue: string }): void} eventHandler\n * @function\n */\n/* c8 ignore next */\nexport const offChange = eventHandler => usePolyfill || removeEventListener('storage', /** @type {any} */ (eventHandler))\n"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,kBAAkB,CAAC;AACzB,EAAE,WAAW,CAAC,GAAG;AACjB,IAAI,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,GAAE;AACxB,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,EAAE,OAAO,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE;AAC1B,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAC;AAC/B,GAAG;AACH;AACA;AACA;AACA;AACA,EAAE,OAAO,CAAC,CAAC,GAAG,EAAE;AAChB,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC;AAC5B,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,GAAG,IAAI,kBAAkB,GAAE;AAC5C,IAAI,WAAW,GAAG,KAAI;AACtB;AACA;AACA,IAAI;AACJ;AACA,EAAE,IAAI,OAAO,YAAY,KAAK,WAAW,IAAI,YAAY,EAAE;AAC3D,IAAI,aAAa,GAAG,aAAY;AAChC,IAAI,WAAW,GAAG,MAAK;AACvB,GAAG;AACH,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG;AACf;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,UAAU,GAAG,cAAa;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,QAAQ,GAAG,YAAY,IAAI,WAAW,IAAI,gBAAgB,CAAC,SAAS,sBAAsB,YAAY,GAAE;AACrH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,SAAS,GAAG,YAAY,IAAI,WAAW,IAAI,mBAAmB,CAAC,SAAS,sBAAsB,YAAY;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/storage.d.ts b/yjs-poll/node_modules/lib0/dist/storage.d.ts deleted file mode 100644 index 6c69f2e..0000000 --- a/yjs-poll/node_modules/lib0/dist/storage.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * This is basically localStorage in browser, or a polyfill in nodejs - */ -export const varStorage: any; -export function onChange(eventHandler: (arg0: { - key: string; - newValue: string; - oldValue: string; -}) => void): true | void; -export function offChange(eventHandler: (arg0: { - key: string; - newValue: string; - oldValue: string; -}) => void): true | void; -//# sourceMappingURL=storage.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/storage.d.ts.map b/yjs-poll/node_modules/lib0/dist/storage.d.ts.map deleted file mode 100644 index bc215c1..0000000 --- a/yjs-poll/node_modules/lib0/dist/storage.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../storage.js"],"names":[],"mappings":"AAiDA;;GAEG;AAEH,6BAAuC;AAShC,uCAJI,CAAS,IAAmD,EAAnD;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,KAAG,IAAI,eAIuC;AAS9G,wCAJI,CAAS,IAAmD,EAAnD;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,KAAG,IAAI,eAI2C"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/storage.test.d.ts b/yjs-poll/node_modules/lib0/dist/storage.test.d.ts deleted file mode 100644 index d87bfa9..0000000 --- a/yjs-poll/node_modules/lib0/dist/storage.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testStorageModule(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=storage.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/storage.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/storage.test.d.ts.map deleted file mode 100644 index 65c5328..0000000 --- a/yjs-poll/node_modules/lib0/dist/storage.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"storage.test.d.ts","sourceRoot":"","sources":["../storage.test.js"],"names":[],"mappings":"AAMO,sCAFI,CAAC,CAAC,QAAQ,QAapB;mBAhBkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/string-fddc5f8b.cjs b/yjs-poll/node_modules/lib0/dist/string-fddc5f8b.cjs deleted file mode 100644 index 121dc20..0000000 --- a/yjs-poll/node_modules/lib0/dist/string-fddc5f8b.cjs +++ /dev/null @@ -1,209 +0,0 @@ -'use strict'; - -var array = require('./array-78849c95.cjs'); - -/** - * Utility module to work with strings. - * - * @module string - */ - -const fromCharCode = String.fromCharCode; -const fromCodePoint = String.fromCodePoint; - -/** - * The largest utf16 character. - * Corresponds to Uint8Array([255, 255]) or charcodeof(2x2^8) - */ -const MAX_UTF16_CHARACTER = fromCharCode(65535); - -/** - * @param {string} s - * @return {string} - */ -const toLowerCase = s => s.toLowerCase(); - -const trimLeftRegex = /^\s*/g; - -/** - * @param {string} s - * @return {string} - */ -const trimLeft = s => s.replace(trimLeftRegex, ''); - -const fromCamelCaseRegex = /([A-Z])/g; - -/** - * @param {string} s - * @param {string} separator - * @return {string} - */ -const fromCamelCase = (s, separator) => trimLeft(s.replace(fromCamelCaseRegex, match => `${separator}${toLowerCase(match)}`)); - -/** - * Compute the utf8ByteLength - * @param {string} str - * @return {number} - */ -const utf8ByteLength = str => unescape(encodeURIComponent(str)).length; - -/** - * @param {string} str - * @return {Uint8Array} - */ -const _encodeUtf8Polyfill = str => { - const encodedString = unescape(encodeURIComponent(str)); - const len = encodedString.length; - const buf = new Uint8Array(len); - for (let i = 0; i < len; i++) { - buf[i] = /** @type {number} */ (encodedString.codePointAt(i)); - } - return buf -}; - -/* c8 ignore next */ -const utf8TextEncoder = /** @type {TextEncoder} */ (typeof TextEncoder !== 'undefined' ? new TextEncoder() : null); - -/** - * @param {string} str - * @return {Uint8Array} - */ -const _encodeUtf8Native = str => utf8TextEncoder.encode(str); - -/** - * @param {string} str - * @return {Uint8Array} - */ -/* c8 ignore next */ -const encodeUtf8 = utf8TextEncoder ? _encodeUtf8Native : _encodeUtf8Polyfill; - -/** - * @param {Uint8Array} buf - * @return {string} - */ -const _decodeUtf8Polyfill = buf => { - let remainingLen = buf.length; - let encodedString = ''; - let bufPos = 0; - while (remainingLen > 0) { - const nextLen = remainingLen < 10000 ? remainingLen : 10000; - const bytes = buf.subarray(bufPos, bufPos + nextLen); - bufPos += nextLen; - // Starting with ES5.1 we can supply a generic array-like object as arguments - encodedString += String.fromCodePoint.apply(null, /** @type {any} */ (bytes)); - remainingLen -= nextLen; - } - return decodeURIComponent(escape(encodedString)) -}; - -/* c8 ignore next */ -exports.utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }); - -/* c8 ignore start */ -if (exports.utf8TextDecoder && exports.utf8TextDecoder.decode(new Uint8Array()).length === 1) { - // Safari doesn't handle BOM correctly. - // This fixes a bug in Safari 13.0.5 where it produces a BOM the first time it is called. - // utf8TextDecoder.decode(new Uint8Array()).length === 1 on the first call and - // utf8TextDecoder.decode(new Uint8Array()).length === 1 on the second call - // Another issue is that from then on no BOM chars are recognized anymore - /* c8 ignore next */ - exports.utf8TextDecoder = null; -} -/* c8 ignore stop */ - -/** - * @param {Uint8Array} buf - * @return {string} - */ -const _decodeUtf8Native = buf => /** @type {TextDecoder} */ (exports.utf8TextDecoder).decode(buf); - -/** - * @param {Uint8Array} buf - * @return {string} - */ -/* c8 ignore next */ -const decodeUtf8 = exports.utf8TextDecoder ? _decodeUtf8Native : _decodeUtf8Polyfill; - -/** - * @param {string} str The initial string - * @param {number} index Starting position - * @param {number} remove Number of characters to remove - * @param {string} insert New content to insert - */ -const splice = (str, index, remove, insert = '') => str.slice(0, index) + insert + str.slice(index + remove); - -/** - * @param {string} source - * @param {number} n - */ -const repeat = (source, n) => array.unfold(n, () => source).join(''); - -/** - * Escape HTML characters &,<,>,'," to their respective HTML entities &,<,>,'," - * - * @param {string} str - */ -const escapeHTML = str => - str.replace(/[&<>'"]/g, r => /** @type {string} */ ({ - '&': '&', - '<': '<', - '>': '>', - "'": ''', - '"': '"' - }[r])); - -/** - * Reverse of `escapeHTML` - * - * @param {string} str - */ -const unescapeHTML = str => - str.replace(/&|<|>|'|"/g, r => /** @type {string} */ ({ - '&': '&', - '<': '<', - '>': '>', - ''': "'", - '"': '"' - }[r])); - -var string = /*#__PURE__*/Object.freeze({ - __proto__: null, - fromCharCode: fromCharCode, - fromCodePoint: fromCodePoint, - MAX_UTF16_CHARACTER: MAX_UTF16_CHARACTER, - trimLeft: trimLeft, - fromCamelCase: fromCamelCase, - utf8ByteLength: utf8ByteLength, - _encodeUtf8Polyfill: _encodeUtf8Polyfill, - utf8TextEncoder: utf8TextEncoder, - _encodeUtf8Native: _encodeUtf8Native, - encodeUtf8: encodeUtf8, - _decodeUtf8Polyfill: _decodeUtf8Polyfill, - get utf8TextDecoder () { return exports.utf8TextDecoder; }, - _decodeUtf8Native: _decodeUtf8Native, - decodeUtf8: decodeUtf8, - splice: splice, - repeat: repeat, - escapeHTML: escapeHTML, - unescapeHTML: unescapeHTML -}); - -exports.MAX_UTF16_CHARACTER = MAX_UTF16_CHARACTER; -exports._decodeUtf8Native = _decodeUtf8Native; -exports._decodeUtf8Polyfill = _decodeUtf8Polyfill; -exports._encodeUtf8Native = _encodeUtf8Native; -exports._encodeUtf8Polyfill = _encodeUtf8Polyfill; -exports.decodeUtf8 = decodeUtf8; -exports.encodeUtf8 = encodeUtf8; -exports.escapeHTML = escapeHTML; -exports.fromCamelCase = fromCamelCase; -exports.fromCharCode = fromCharCode; -exports.fromCodePoint = fromCodePoint; -exports.repeat = repeat; -exports.splice = splice; -exports.string = string; -exports.trimLeft = trimLeft; -exports.unescapeHTML = unescapeHTML; -exports.utf8ByteLength = utf8ByteLength; -exports.utf8TextEncoder = utf8TextEncoder; -//# sourceMappingURL=string-fddc5f8b.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/string-fddc5f8b.cjs.map b/yjs-poll/node_modules/lib0/dist/string-fddc5f8b.cjs.map deleted file mode 100644 index e2df8f5..0000000 --- a/yjs-poll/node_modules/lib0/dist/string-fddc5f8b.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"string-fddc5f8b.cjs","sources":["../string.js"],"sourcesContent":["import * as array from './array.js'\n\n/**\n * Utility module to work with strings.\n *\n * @module string\n */\n\nexport const fromCharCode = String.fromCharCode\nexport const fromCodePoint = String.fromCodePoint\n\n/**\n * The largest utf16 character.\n * Corresponds to Uint8Array([255, 255]) or charcodeof(2x2^8)\n */\nexport const MAX_UTF16_CHARACTER = fromCharCode(65535)\n\n/**\n * @param {string} s\n * @return {string}\n */\nconst toLowerCase = s => s.toLowerCase()\n\nconst trimLeftRegex = /^\\s*/g\n\n/**\n * @param {string} s\n * @return {string}\n */\nexport const trimLeft = s => s.replace(trimLeftRegex, '')\n\nconst fromCamelCaseRegex = /([A-Z])/g\n\n/**\n * @param {string} s\n * @param {string} separator\n * @return {string}\n */\nexport const fromCamelCase = (s, separator) => trimLeft(s.replace(fromCamelCaseRegex, match => `${separator}${toLowerCase(match)}`))\n\n/**\n * Compute the utf8ByteLength\n * @param {string} str\n * @return {number}\n */\nexport const utf8ByteLength = str => unescape(encodeURIComponent(str)).length\n\n/**\n * @param {string} str\n * @return {Uint8Array}\n */\nexport const _encodeUtf8Polyfill = str => {\n const encodedString = unescape(encodeURIComponent(str))\n const len = encodedString.length\n const buf = new Uint8Array(len)\n for (let i = 0; i < len; i++) {\n buf[i] = /** @type {number} */ (encodedString.codePointAt(i))\n }\n return buf\n}\n\n/* c8 ignore next */\nexport const utf8TextEncoder = /** @type {TextEncoder} */ (typeof TextEncoder !== 'undefined' ? new TextEncoder() : null)\n\n/**\n * @param {string} str\n * @return {Uint8Array}\n */\nexport const _encodeUtf8Native = str => utf8TextEncoder.encode(str)\n\n/**\n * @param {string} str\n * @return {Uint8Array}\n */\n/* c8 ignore next */\nexport const encodeUtf8 = utf8TextEncoder ? _encodeUtf8Native : _encodeUtf8Polyfill\n\n/**\n * @param {Uint8Array} buf\n * @return {string}\n */\nexport const _decodeUtf8Polyfill = buf => {\n let remainingLen = buf.length\n let encodedString = ''\n let bufPos = 0\n while (remainingLen > 0) {\n const nextLen = remainingLen < 10000 ? remainingLen : 10000\n const bytes = buf.subarray(bufPos, bufPos + nextLen)\n bufPos += nextLen\n // Starting with ES5.1 we can supply a generic array-like object as arguments\n encodedString += String.fromCodePoint.apply(null, /** @type {any} */ (bytes))\n remainingLen -= nextLen\n }\n return decodeURIComponent(escape(encodedString))\n}\n\n/* c8 ignore next */\nexport let utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf-8', { fatal: true, ignoreBOM: true })\n\n/* c8 ignore start */\nif (utf8TextDecoder && utf8TextDecoder.decode(new Uint8Array()).length === 1) {\n // Safari doesn't handle BOM correctly.\n // This fixes a bug in Safari 13.0.5 where it produces a BOM the first time it is called.\n // utf8TextDecoder.decode(new Uint8Array()).length === 1 on the first call and\n // utf8TextDecoder.decode(new Uint8Array()).length === 1 on the second call\n // Another issue is that from then on no BOM chars are recognized anymore\n /* c8 ignore next */\n utf8TextDecoder = null\n}\n/* c8 ignore stop */\n\n/**\n * @param {Uint8Array} buf\n * @return {string}\n */\nexport const _decodeUtf8Native = buf => /** @type {TextDecoder} */ (utf8TextDecoder).decode(buf)\n\n/**\n * @param {Uint8Array} buf\n * @return {string}\n */\n/* c8 ignore next */\nexport const decodeUtf8 = utf8TextDecoder ? _decodeUtf8Native : _decodeUtf8Polyfill\n\n/**\n * @param {string} str The initial string\n * @param {number} index Starting position\n * @param {number} remove Number of characters to remove\n * @param {string} insert New content to insert\n */\nexport const splice = (str, index, remove, insert = '') => str.slice(0, index) + insert + str.slice(index + remove)\n\n/**\n * @param {string} source\n * @param {number} n\n */\nexport const repeat = (source, n) => array.unfold(n, () => source).join('')\n\n/**\n * Escape HTML characters &,<,>,',\" to their respective HTML entities &,<,>,',"\n *\n * @param {string} str\n */\nexport const escapeHTML = str =>\n str.replace(/[&<>'\"]/g, r => /** @type {string} */ ({\n '&': '&',\n '<': '<',\n '>': '>',\n \"'\": ''',\n '\"': '"'\n }[r]))\n\n/**\n * Reverse of `escapeHTML`\n *\n * @param {string} str\n */\nexport const unescapeHTML = str =>\n str.replace(/&|<|>|'|"/g, r => /** @type {string} */ ({\n '&': '&',\n '<': '<',\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IAAI,MAAM,EAAE,GAAG;AACf,IAAI,MAAM,EAAE,GAAG;AACf,IAAI,OAAO,EAAE,GAAG;AAChB,IAAI,QAAQ,EAAE,GAAG;AACjB,GAAG,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/string.cjs b/yjs-poll/node_modules/lib0/dist/string.cjs deleted file mode 100644 index 9f0ad1a..0000000 --- a/yjs-poll/node_modules/lib0/dist/string.cjs +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./array-78849c95.cjs'); -var string = require('./string-fddc5f8b.cjs'); -require('./set-5b47859e.cjs'); - - - -exports.MAX_UTF16_CHARACTER = string.MAX_UTF16_CHARACTER; -exports._decodeUtf8Native = string._decodeUtf8Native; -exports._decodeUtf8Polyfill = string._decodeUtf8Polyfill; -exports._encodeUtf8Native = string._encodeUtf8Native; -exports._encodeUtf8Polyfill = string._encodeUtf8Polyfill; -exports.decodeUtf8 = string.decodeUtf8; -exports.encodeUtf8 = string.encodeUtf8; -exports.escapeHTML = string.escapeHTML; -exports.fromCamelCase = string.fromCamelCase; -exports.fromCharCode = string.fromCharCode; -exports.fromCodePoint = string.fromCodePoint; -exports.repeat = string.repeat; -exports.splice = string.splice; -exports.trimLeft = string.trimLeft; -exports.unescapeHTML = string.unescapeHTML; -exports.utf8ByteLength = string.utf8ByteLength; -Object.defineProperty(exports, 'utf8TextDecoder', { - enumerable: true, - get: function () { return string.utf8TextDecoder; } -}); -exports.utf8TextEncoder = string.utf8TextEncoder; -//# sourceMappingURL=string.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/string.cjs.map b/yjs-poll/node_modules/lib0/dist/string.cjs.map deleted file mode 100644 index 150a5bf..0000000 --- a/yjs-poll/node_modules/lib0/dist/string.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"string.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/string.d.ts b/yjs-poll/node_modules/lib0/dist/string.d.ts deleted file mode 100644 index caa0bba..0000000 --- a/yjs-poll/node_modules/lib0/dist/string.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Utility module to work with strings. - * - * @module string - */ -export const fromCharCode: (...codes: number[]) => string; -export const fromCodePoint: (...codePoints: number[]) => string; -/** - * The largest utf16 character. - * Corresponds to Uint8Array([255, 255]) or charcodeof(2x2^8) - */ -export const MAX_UTF16_CHARACTER: string; -export function trimLeft(s: string): string; -export function fromCamelCase(s: string, separator: string): string; -export function utf8ByteLength(str: string): number; -export function _encodeUtf8Polyfill(str: string): Uint8Array; -export const utf8TextEncoder: TextEncoder; -export function _encodeUtf8Native(str: string): Uint8Array; -export function encodeUtf8(str: string): Uint8Array; -export function _decodeUtf8Polyfill(buf: Uint8Array): string; -export let utf8TextDecoder: TextDecoder | null; -export function _decodeUtf8Native(buf: Uint8Array): string; -export function decodeUtf8(buf: Uint8Array): string; -export function splice(str: string, index: number, remove: number, insert?: string): string; -export function repeat(source: string, n: number): string; -export function escapeHTML(str: string): string; -export function unescapeHTML(str: string): string; -//# sourceMappingURL=string.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/string.d.ts.map b/yjs-poll/node_modules/lib0/dist/string.d.ts.map deleted file mode 100644 index 497012b..0000000 --- a/yjs-poll/node_modules/lib0/dist/string.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../string.js"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,0DAA+C;AAC/C,gEAAiD;AAEjD;;;GAGG;AACH,yCAAsD;AAc/C,4BAHI,MAAM,GACL,MAAM,CAEuC;AASlD,iCAJI,MAAM,aACN,MAAM,GACL,MAAM,CAEkH;AAO7H,oCAHI,MAAM,GACL,MAAM,CAE2D;AAMtE,yCAHI,MAAM,GACL,UAAU,CAAC,WAAW,CAAC,CAUlC;AAGD,8BAA0C,WAAW,CAAoE;AAMlH,uCAHI,MAAM,GACL,UAAU,CAAC,WAAW,CAAC,CAEgC;AAjB5D,gCAHI,MAAM,GACL,UAAU,CAAC,WAAW,CAAC,CAUlC;AAsBM,yCAHI,UAAU,GACT,MAAM,CAejB;AAGD,+CAAmI;AAkB5H,uCAHI,UAAU,GACT,MAAM,CAE8E;AAlCzF,gCAHI,UAAU,GACT,MAAM,CAejB;AAoCM,4BALI,MAAM,SACN,MAAM,UACN,MAAM,WACN,MAAM,UAEkG;AAM5G,+BAHI,MAAM,KACN,MAAM,UAE0D;AAOpE,gCAFI,MAAM,UAST;AAOD,kCAFI,MAAM,UAST"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/string.test.d.ts b/yjs-poll/node_modules/lib0/dist/string.test.d.ts deleted file mode 100644 index 73972bd..0000000 --- a/yjs-poll/node_modules/lib0/dist/string.test.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export function testUtilities(_tc: t.TestCase): void; -export function testLowercaseTransformation(_tc: t.TestCase): void; -export function testRepeatStringUtf8Encoding(tc: t.TestCase): void; -export function testRepeatStringUtf8Decoding(tc: t.TestCase): void; -export function testBomEncodingDecoding(_tc: t.TestCase): void; -export function testSplice(_tc: t.TestCase): void; -export function testHtmlEscape(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=string.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/string.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/string.test.d.ts.map deleted file mode 100644 index da74f05..0000000 --- a/yjs-poll/node_modules/lib0/dist/string.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"string.test.d.ts","sourceRoot":"","sources":["../string.test.js"],"names":[],"mappings":"AAOO,mCAFI,CAAC,CAAC,QAAQ,QAMpB;AAKM,iDAFI,CAAC,CAAC,QAAQ,QAOpB;AAKM,iDAFI,CAAC,CAAC,QAAQ,QAapB;AAKM,iDAFI,CAAC,CAAC,QAAQ,QAapB;AAKM,6CAFI,CAAC,CAAC,QAAQ,QAYpB;AAKM,gCAFI,CAAC,CAAC,QAAQ,QAMpB;AAKM,oCAFI,CAAC,CAAC,QAAQ,QAYpB;mBA1FkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/symbol-9c439012.cjs b/yjs-poll/node_modules/lib0/dist/symbol-9c439012.cjs deleted file mode 100644 index 1f623d4..0000000 --- a/yjs-poll/node_modules/lib0/dist/symbol-9c439012.cjs +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -/** - * Utility module to work with EcmaScript Symbols. - * - * @module symbol - */ - -/** - * Return fresh symbol. - */ -const create = Symbol; - -/** - * @param {any} s - * @return {boolean} - */ -const isSymbol = s => typeof s === 'symbol'; - -var symbol = /*#__PURE__*/Object.freeze({ - __proto__: null, - create: create, - isSymbol: isSymbol -}); - -exports.create = create; -exports.isSymbol = isSymbol; -exports.symbol = symbol; -//# sourceMappingURL=symbol-9c439012.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/symbol-9c439012.cjs.map b/yjs-poll/node_modules/lib0/dist/symbol-9c439012.cjs.map deleted file mode 100644 index 60cbe2e..0000000 --- a/yjs-poll/node_modules/lib0/dist/symbol-9c439012.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"symbol-9c439012.cjs","sources":["../symbol.js"],"sourcesContent":["/**\n * Utility module to work with EcmaScript Symbols.\n *\n * @module symbol\n */\n\n/**\n * Return fresh symbol.\n */\nexport const create = Symbol\n\n/**\n * @param {any} s\n * @return {boolean}\n */\nexport const isSymbol = s => typeof s === 'symbol'\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,OAAM;AAC5B;AACA;AACA;AACA;AACA;AACY,MAAC,QAAQ,GAAG,CAAC,IAAI,OAAO,CAAC,KAAK;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/symbol.cjs b/yjs-poll/node_modules/lib0/dist/symbol.cjs deleted file mode 100644 index ac6f1b1..0000000 --- a/yjs-poll/node_modules/lib0/dist/symbol.cjs +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var symbol = require('./symbol-9c439012.cjs'); - - - -exports.create = symbol.create; -exports.isSymbol = symbol.isSymbol; -//# sourceMappingURL=symbol.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/symbol.cjs.map b/yjs-poll/node_modules/lib0/dist/symbol.cjs.map deleted file mode 100644 index 5e1c70e..0000000 --- a/yjs-poll/node_modules/lib0/dist/symbol.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"symbol.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/symbol.d.ts b/yjs-poll/node_modules/lib0/dist/symbol.d.ts deleted file mode 100644 index 3fce473..0000000 --- a/yjs-poll/node_modules/lib0/dist/symbol.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Utility module to work with EcmaScript Symbols. - * - * @module symbol - */ -/** - * Return fresh symbol. - */ -export const create: SymbolConstructor; -export function isSymbol(s: any): boolean; -//# sourceMappingURL=symbol.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/symbol.d.ts.map b/yjs-poll/node_modules/lib0/dist/symbol.d.ts.map deleted file mode 100644 index e63fffe..0000000 --- a/yjs-poll/node_modules/lib0/dist/symbol.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"symbol.d.ts","sourceRoot":"","sources":["../symbol.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,uCAA4B;AAMrB,4BAHI,GAAG,GACF,OAAO,CAE+B"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/symbol.test.d.ts b/yjs-poll/node_modules/lib0/dist/symbol.test.d.ts deleted file mode 100644 index 3a29f01..0000000 --- a/yjs-poll/node_modules/lib0/dist/symbol.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testBasicSymbolFeatures(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=symbol.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/symbol.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/symbol.test.d.ts.map deleted file mode 100644 index 28b5d73..0000000 --- a/yjs-poll/node_modules/lib0/dist/symbol.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"symbol.test.d.ts","sourceRoot":"","sources":["../symbol.test.js"],"names":[],"mappings":"AAMO,6CAFI,CAAC,CAAC,QAAQ,QAQpB;mBAZkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/testing.cjs b/yjs-poll/node_modules/lib0/dist/testing.cjs deleted file mode 100644 index fb22e65..0000000 --- a/yjs-poll/node_modules/lib0/dist/testing.cjs +++ /dev/null @@ -1,709 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var log = require('lib0/logging'); -var diff = require('./diff-9d236524.cjs'); -var object = require('./object-c0c9435b.cjs'); -var string = require('./string-fddc5f8b.cjs'); -var math = require('./math-96d5e8c4.cjs'); -var random = require('./random.cjs'); -var prng = require('./prng-37d48618.cjs'); -var statistics = require('./statistics-65f6114b.cjs'); -var array = require('./array-78849c95.cjs'); -var environment = require('./environment-1c97264d.cjs'); -var json = require('./json-092190a1.cjs'); -var time = require('./time-d8438852.cjs'); -var promise = require('./promise-cda7b9bb.cjs'); -var performance = require('lib0/performance'); -var equality = require('./equality.cjs'); -require('./function-314580f7.cjs'); -require('./binary-ac8e39e2.cjs'); -require('lib0/webcrypto'); -require('./buffer-3e750729.cjs'); -require('./encoding-1a745c43.cjs'); -require('./number-1fb57bba.cjs'); -require('./decoding-76e75827.cjs'); -require('./error-0c1f634f.cjs'); -require('./set-5b47859e.cjs'); -require('./map-24d263c0.cjs'); -require('./conditions-f5c0c102.cjs'); -require('./storage.cjs'); -require('./metric.cjs'); - -function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n["default"] = e; - return Object.freeze(n); -} - -var log__namespace = /*#__PURE__*/_interopNamespace(log); -var performance__namespace = /*#__PURE__*/_interopNamespace(performance); - -/** - * Testing framework with support for generating tests. - * - * ```js - * // test.js template for creating a test executable - * import { runTests } from 'lib0/testing' - * import * as log from 'lib0/logging' - * import * as mod1 from './mod1.test.js' - * import * as mod2 from './mod2.test.js' - - * import { isBrowser, isNode } from 'lib0/environment.js' - * - * if (isBrowser) { - * // optional: if this is ran in the browser, attach a virtual console to the dom - * log.createVConsole(document.body) - * } - * - * runTests({ - * mod1, - * mod2, - * }).then(success => { - * if (isNode) { - * process.exit(success ? 0 : 1) - * } - * }) - * ``` - * - * ```js - * // mod1.test.js - * /** - * * runTests automatically tests all exported functions that start with "test". - * * The name of the function should be in camelCase and is used for the logging output. - * * - * * @ param {t.TestCase} tc - * *\/ - * export const testMyFirstTest = tc => { - * t.compare({ a: 4 }, { a: 4 }, 'objects are equal') - * } - * ``` - * - * Now you can simply run `node test.js` to run your test or run test.js in the browser. - * - * @module testing - */ -const extensive = environment.hasConf('extensive'); - -/* c8 ignore next */ -const envSeed = environment.hasParam('--seed') ? Number.parseInt(environment.getParam('--seed', '0')) : null; - -class TestCase { - /** - * @param {string} moduleName - * @param {string} testName - */ - constructor (moduleName, testName) { - /** - * @type {string} - */ - this.moduleName = moduleName; - /** - * @type {string} - */ - this.testName = testName; - /** - * This type can store custom information related to the TestCase - * - * @type {Map} - */ - this.meta = new Map(); - this._seed = null; - this._prng = null; - } - - resetSeed () { - this._seed = null; - this._prng = null; - } - - /** - * @type {number} - */ - /* c8 ignore next */ - get seed () { - /* c8 ignore else */ - if (this._seed === null) { - /* c8 ignore next */ - this._seed = envSeed === null ? random.uint32() : envSeed; - } - return this._seed - } - - /** - * A PRNG for this test case. Use only this PRNG for randomness to make the test case reproducible. - * - * @type {prng.PRNG} - */ - get prng () { - /* c8 ignore else */ - if (this._prng === null) { - this._prng = prng.create(this.seed); - } - return this._prng - } -} - -const repetitionTime = Number(environment.getParam('--repetition-time', '50')); -/* c8 ignore next */ -const testFilter = environment.hasParam('--filter') ? environment.getParam('--filter', '') : null; - -/* c8 ignore next */ -const testFilterRegExp = testFilter !== null ? new RegExp(testFilter) : /.*/; - -const repeatTestRegex = /^(repeat|repeating)\s/; - -/** - * @param {string} moduleName - * @param {string} name - * @param {function(TestCase):void|Promise} f - * @param {number} i - * @param {number} numberOfTests - */ -const run = async (moduleName, name, f, i, numberOfTests) => { - const uncamelized = string.fromCamelCase(name.slice(4), ' '); - const filtered = !testFilterRegExp.test(`[${i + 1}/${numberOfTests}] ${moduleName}: ${uncamelized}`); - /* c8 ignore next 3 */ - if (filtered) { - return true - } - const tc = new TestCase(moduleName, name); - const repeat = repeatTestRegex.test(uncamelized); - const groupArgs = [log__namespace.GREY, `[${i + 1}/${numberOfTests}] `, log__namespace.PURPLE, `${moduleName}: `, log__namespace.BLUE, uncamelized]; - /* c8 ignore next 5 */ - if (testFilter === null) { - log__namespace.groupCollapsed(...groupArgs); - } else { - log__namespace.group(...groupArgs); - } - const times = []; - const start = performance__namespace.now(); - let lastTime = start; - /** - * @type {any} - */ - let err = null; - performance__namespace.mark(`${name}-start`); - do { - try { - const p = f(tc); - if (promise.isPromise(p)) { - await p; - } - } catch (_err) { - err = _err; - } - const currTime = performance__namespace.now(); - times.push(currTime - lastTime); - lastTime = currTime; - if (repeat && err === null && (lastTime - start) < repetitionTime) { - tc.resetSeed(); - } else { - break - } - } while (err === null && (lastTime - start) < repetitionTime) - performance__namespace.mark(`${name}-end`); - /* c8 ignore next 3 */ - if (err !== null && err.constructor !== SkipError) { - log__namespace.printError(err); - } - performance__namespace.measure(name, `${name}-start`, `${name}-end`); - log__namespace.groupEnd(); - const duration = lastTime - start; - let success = true; - times.sort((a, b) => a - b); - /* c8 ignore next 3 */ - const againMessage = environment.isBrowser - ? ` - ${window.location.host + window.location.pathname}?filter=\\[${i + 1}/${tc._seed === null ? '' : `&seed=${tc._seed}`}` - : `\nrepeat: npm run test -- --filter "\\[${i + 1}/" ${tc._seed === null ? '' : `--seed ${tc._seed}`}`; - const timeInfo = (repeat && err === null) - ? ` - ${times.length} repetitions in ${time.humanizeDuration(duration)} (best: ${time.humanizeDuration(times[0])}, worst: ${time.humanizeDuration(array.last(times))}, median: ${time.humanizeDuration(statistics.median(times))}, average: ${time.humanizeDuration(statistics.average(times))})` - : ` in ${time.humanizeDuration(duration)}`; - if (err !== null) { - /* c8 ignore start */ - if (err.constructor === SkipError) { - log__namespace.print(log__namespace.GREY, log__namespace.BOLD, 'Skipped: ', log__namespace.UNBOLD, uncamelized); - } else { - success = false; - log__namespace.print(log__namespace.RED, log__namespace.BOLD, 'Failure: ', log__namespace.UNBOLD, log__namespace.UNCOLOR, uncamelized, log__namespace.GREY, timeInfo, againMessage); - } - /* c8 ignore stop */ - } else { - log__namespace.print(log__namespace.GREEN, log__namespace.BOLD, 'Success: ', log__namespace.UNBOLD, log__namespace.UNCOLOR, uncamelized, log__namespace.GREY, timeInfo, againMessage); - } - return success -}; - -/** - * Describe what you are currently testing. The message will be logged. - * - * ```js - * export const testMyFirstTest = tc => { - * t.describe('crunching numbers', 'already crunched 4 numbers!') // the optional second argument can describe the state. - * } - * ``` - * - * @param {string} description - * @param {string} info - */ -const describe = (description, info = '') => log__namespace.print(log__namespace.BLUE, description, ' ', log__namespace.GREY, info); - -/** - * Describe the state of the current computation. - * ```js - * export const testMyFirstTest = tc => { - * t.info(already crunched 4 numbers!') // the optional second argument can describe the state. - * } - * ``` - * - * @param {string} info - */ -const info = info => describe('', info); - -const printDom = log__namespace.printDom; - -const printCanvas = log__namespace.printCanvas; - -/** - * Group outputs in a collapsible category. - * - * ```js - * export const testMyFirstTest = tc => { - * t.group('subtest 1', () => { - * t.describe('this message is part of a collapsible section') - * }) - * await t.groupAsync('subtest async 2', async () => { - * await someaction() - * t.describe('this message is part of a collapsible section') - * }) - * } - * ``` - * - * @param {string} description - * @param {function(...any):void} f - */ -const group = (description, f) => { - log__namespace.group(log__namespace.BLUE, description); - try { - f(); - } finally { - log__namespace.groupEnd(); - } -}; - -/** - * Group outputs in a collapsible category. - * - * ```js - * export const testMyFirstTest = async tc => { - * t.group('subtest 1', () => { - * t.describe('this message is part of a collapsible section') - * }) - * await t.groupAsync('subtest async 2', async () => { - * await someaction() - * t.describe('this message is part of a collapsible section') - * }) - * } - * ``` - * - * @param {string} description - * @param {function(...any):Promise} f - */ -const groupAsync = async (description, f) => { - log__namespace.group(log__namespace.BLUE, description); - try { - await f(); - } finally { - log__namespace.groupEnd(); - } -}; - -/** - * Measure the time that it takes to calculate something. - * - * ```js - * export const testMyFirstTest = async tc => { - * t.measureTime('measurement', () => { - * heavyCalculation() - * }) - * await t.groupAsync('async measurement', async () => { - * await heavyAsyncCalculation() - * }) - * } - * ``` - * - * @param {string} message - * @param {function(...any):void} f - * @return {number} Returns a promise that resolves the measured duration to apply f - */ -const measureTime = (message, f) => { - let duration; - const start = performance__namespace.now(); - try { - f(); - } finally { - duration = performance__namespace.now() - start; - log__namespace.print(log__namespace.PURPLE, message, log__namespace.GREY, ` ${time.humanizeDuration(duration)}`); - } - return duration -}; - -/** - * Measure the time that it takes to calculate something. - * - * ```js - * export const testMyFirstTest = async tc => { - * t.measureTimeAsync('measurement', async () => { - * await heavyCalculation() - * }) - * await t.groupAsync('async measurement', async () => { - * await heavyAsyncCalculation() - * }) - * } - * ``` - * - * @param {string} message - * @param {function(...any):Promise} f - * @return {Promise} Returns a promise that resolves the measured duration to apply f - */ -const measureTimeAsync = async (message, f) => { - let duration; - const start = performance__namespace.now(); - try { - await f(); - } finally { - duration = performance__namespace.now() - start; - log__namespace.print(log__namespace.PURPLE, message, log__namespace.GREY, ` ${time.humanizeDuration(duration)}`); - } - return duration -}; - -/** - * @template T - * @param {Array} as - * @param {Array} bs - * @param {string} [m] - * @return {boolean} - */ -const compareArrays = (as, bs, m = 'Arrays match') => { - if (as.length !== bs.length) { - fail(m); - } - for (let i = 0; i < as.length; i++) { - if (as[i] !== bs[i]) { - fail(m); - } - } - return true -}; - -/** - * @param {string} a - * @param {string} b - * @param {string} [m] - * @throws {TestError} Throws if tests fails - */ -const compareStrings = (a, b, m = 'Strings match') => { - if (a !== b) { - const diff$1 = diff.simpleDiffString(a, b); - log__namespace.print(log__namespace.GREY, a.slice(0, diff$1.index), log__namespace.RED, a.slice(diff$1.index, diff$1.remove), log__namespace.GREEN, diff$1.insert, log__namespace.GREY, a.slice(diff$1.index + diff$1.remove)); - fail(m); - } -}; - -/** - * @template K,V - * @param {Object} a - * @param {Object} b - * @param {string} [m] - * @throws {TestError} Throws if test fails - */ -const compareObjects = (a, b, m = 'Objects match') => { object.equalFlat(a, b) || fail(m); }; - -/** - * @param {any} _constructor - * @param {any} a - * @param {any} b - * @param {string} path - * @throws {TestError} - */ -const compareValues = (_constructor, a, b, path) => { - if (a !== b) { - fail(`Values ${json.stringify(a)} and ${json.stringify(b)} don't match (${path})`); - } - return true -}; - -/** - * @param {string?} message - * @param {string} reason - * @param {string} path - * @throws {TestError} - */ -const _failMessage = (message, reason, path) => fail( - message === null - ? `${reason} ${path}` - : `${message} (${reason}) ${path}` -); - -/** - * @param {any} a - * @param {any} b - * @param {string} path - * @param {string?} message - * @param {function(any,any,any,string,any):boolean} customCompare - */ -const _compare = (a, b, path, message, customCompare) => { - // we don't use assert here because we want to test all branches (istanbul errors if one branch is not tested) - if (a == null || b == null) { - return compareValues(null, a, b, path) - } - if (a[equality.EqualityTraitSymbol] != null) { - if (a[equality.EqualityTraitSymbol](b)) { - return true - } else { - _failMessage(message, 'Not equal by equality trait', path); - } - } - if (a.constructor !== b.constructor) { - _failMessage(message, 'Constructors don\'t match', path); - } - let success = true; - switch (a.constructor) { - case ArrayBuffer: - a = new Uint8Array(a); - b = new Uint8Array(b); - // eslint-disable-next-line no-fallthrough - case Uint8Array: { - if (a.byteLength !== b.byteLength) { - _failMessage(message, 'ArrayBuffer lengths match', path); - } - for (let i = 0; success && i < a.length; i++) { - success = success && a[i] === b[i]; - } - break - } - case Set: { - if (a.size !== b.size) { - _failMessage(message, 'Sets have different number of attributes', path); - } - // @ts-ignore - a.forEach(value => { - if (!b.has(value)) { - _failMessage(message, `b.${path} does have ${value}`, path); - } - }); - break - } - case Map: { - if (a.size !== b.size) { - _failMessage(message, 'Maps have different number of attributes', path); - } - // @ts-ignore - a.forEach((value, key) => { - if (!b.has(key)) { - _failMessage(message, `Property ${path}["${key}"] does not exist on second argument`, path); - } - _compare(value, b.get(key), `${path}["${key}"]`, message, customCompare); - }); - break - } - case undefined: // undefined is often set as a constructor for objects - case Object: - if (object.length(a) !== object.length(b)) { - _failMessage(message, 'Objects have a different number of attributes', path); - } - object.forEach(a, (value, key) => { - if (!object.hasProperty(b, key)) { - _failMessage(message, `Property ${path} does not exist on second argument`, path); - } - _compare(value, b[key], `${path}["${key}"]`, message, customCompare); - }); - break - case Array: - if (a.length !== b.length) { - _failMessage(message, 'Arrays have a different number of attributes', path); - } - // @ts-ignore - a.forEach((value, i) => _compare(value, b[i], `${path}[${i}]`, message, customCompare)); - break - /* c8 ignore next 4 */ - default: - if (!customCompare(a.constructor, a, b, path, compareValues)) { - _failMessage(message, `Values ${json.stringify(a)} and ${json.stringify(b)} don't match`, path); - } - } - assert(success, message); - return true -}; - -/** - * @template T - * @param {T} a - * @param {T} b - * @param {string?} [message] - * @param {function(any,T,T,string,any):boolean} [customCompare] - */ -const compare = (a, b, message = null, customCompare = compareValues) => _compare(a, b, 'obj', message, customCompare); - -/** - * @template T - * @param {T} property - * @param {string?} [message] - * @return {asserts property is NonNullable} - * @throws {TestError} - */ -/* c8 ignore next */ -const assert = (property, message = null) => { property || fail(`Assertion failed${message !== null ? `: ${message}` : ''}`); }; - -/** - * @param {function(...any):Promise} f - */ -const promiseRejected = async f => { - try { - await f(); - } catch (err) { - return - } - fail('Expected promise to fail'); -}; - -/** - * @param {function(...any):void} f - * @throws {TestError} - */ -const fails = f => { - try { - f(); - } catch (_err) { - log__namespace.print(log__namespace.GREEN, '⇖ This Error was expected'); - return - } - fail('Expected this to fail'); -}; - -/** - * @param {function(...any):Promise} f - * @throws {TestError} - */ -const failsAsync = async f => { - try { - await f(); - } catch (_err) { - log__namespace.print(log__namespace.GREEN, '⇖ This Error was expected'); - return - } - fail('Expected this to fail'); -}; - -/** - * @param {Object>>} tests - */ -const runTests = async tests => { - /** - * @param {string} testname - */ - const filterTest = testname => testname.startsWith('test') || testname.startsWith('benchmark'); - const numberOfTests = object.map(tests, mod => object.map(mod, (f, fname) => /* c8 ignore next */ f && filterTest(fname) ? 1 : 0).reduce(math.add, 0)).reduce(math.add, 0); - let successfulTests = 0; - let testnumber = 0; - const start = performance__namespace.now(); - for (const modName in tests) { - const mod = tests[modName]; - for (const fname in mod) { - const f = mod[fname]; - /* c8 ignore else */ - if (f && filterTest(fname)) { - const repeatEachTest = 1; - let success = true; - for (let i = 0; success && i < repeatEachTest; i++) { - success = await run(modName, fname, f, testnumber, numberOfTests); - } - testnumber++; - /* c8 ignore else */ - if (success) { - successfulTests++; - } - } - } - } - const end = performance__namespace.now(); - log__namespace.print(''); - const success = successfulTests === numberOfTests; - /* c8 ignore start */ - if (success) { - log__namespace.print(log__namespace.GREEN, log__namespace.BOLD, 'All tests successful!', log__namespace.GREY, log__namespace.UNBOLD, ` in ${time.humanizeDuration(end - start)}`); - log__namespace.printImgBase64(nyanCatImage, 50); - } else { - const failedTests = numberOfTests - successfulTests; - log__namespace.print(log__namespace.RED, log__namespace.BOLD, `> ${failedTests} test${failedTests > 1 ? 's' : ''} failed`); - } - /* c8 ignore stop */ - return success -}; - -class TestError extends Error {} - -/** - * @param {string} reason - * @throws {TestError} - */ -const fail = reason => { - log__namespace.print(log__namespace.RED, log__namespace.BOLD, 'X ', log__namespace.UNBOLD, reason); - throw new TestError('Test Failed') -}; - -class SkipError extends Error {} - -/** - * @param {boolean} cond If true, this tests will be skipped - * @throws {SkipError} - */ -const skip = (cond = true) => { - if (cond) { - throw new SkipError('skipping..') - } -}; - -// eslint-disable-next-line -const nyanCatImage = 'R0lGODlhjABMAPcAAMiSE0xMTEzMzUKJzjQ0NFsoKPc7//FM/9mH/z9x0HIiIoKCgmBHN+frGSkZLdDQ0LCwsDk71g0KCUzDdrQQEOFz/8yYdelmBdTiHFxcXDU2erR/mLrTHCgoKK5szBQUFNgSCTk6ymfpCB9VZS2Bl+cGBt2N8kWm0uDcGXhZRUvGq94NCFPhDiwsLGVlZTgqIPMDA1g3aEzS5D6xAURERDtG9JmBjJsZGWs2AD1W6Hp6eswyDeJ4CFNTU1LcEoJRmTMzSd14CTg5ser2GmDzBd17/xkZGUzMvoSMDiEhIfKruCwNAJaWlvRzA8kNDXDrCfi0pe1U/+GS6SZrAB4eHpZwVhoabsx9oiYmJt/TGHFxcYyMjOid0+Zl/0rF6j09PeRr/0zU9DxO6j+z0lXtBtp8qJhMAEssLGhoaPL/GVn/AAsWJ/9/AE3Z/zs9/3cAAOlf/+aa2RIyADo85uhh/0i84WtrazQ0UyMlmDMzPwUFBe16BTMmHau0E03X+g8pMEAoS1MBAf++kkzO8pBaqSZoe9uB/zE0BUQ3Sv///4WFheuiyzo880gzNDIyNissBNqF/8RiAOF2qG5ubj0vL1z6Avl5ASsgGkgUSy8vL/8n/z4zJy8lOv96uEssV1csAN5ZCDQ0Wz1a3tbEGHLeDdYKCg4PATE7PiMVFSoqU83eHEi43gUPAOZ8reGogeKU5dBBC8faHEez2lHYF4bQF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7nLsl0ZkagKc1qWvOa2JxLNLPJzW6+ZZvevAhdwrkStJCTI2gZ5zknos51shOc7oynPOdJz3ra857hDAgAOw=='; - -exports.production = environment.production; -exports.TestCase = TestCase; -exports.assert = assert; -exports.compare = compare; -exports.compareArrays = compareArrays; -exports.compareObjects = compareObjects; -exports.compareStrings = compareStrings; -exports.describe = describe; -exports.envSeed = envSeed; -exports.extensive = extensive; -exports.fail = fail; -exports.fails = fails; -exports.failsAsync = failsAsync; -exports.group = group; -exports.groupAsync = groupAsync; -exports.info = info; -exports.measureTime = measureTime; -exports.measureTimeAsync = measureTimeAsync; -exports.printCanvas = printCanvas; -exports.printDom = printDom; -exports.promiseRejected = promiseRejected; -exports.repetitionTime = repetitionTime; -exports.run = run; -exports.runTests = runTests; -exports.skip = skip; -//# sourceMappingURL=testing.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/testing.cjs.map b/yjs-poll/node_modules/lib0/dist/testing.cjs.map deleted file mode 100644 index 056dd32..0000000 --- a/yjs-poll/node_modules/lib0/dist/testing.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"testing.cjs","sources":["../testing.js"],"sourcesContent":["/**\n * Testing framework with support for generating tests.\n *\n * ```js\n * // test.js template for creating a test executable\n * import { runTests } from 'lib0/testing'\n * import * as log from 'lib0/logging'\n * import * as mod1 from './mod1.test.js'\n * import * as mod2 from './mod2.test.js'\n\n * import { isBrowser, isNode } from 'lib0/environment.js'\n *\n * if (isBrowser) {\n * // optional: if this is ran in the browser, attach a virtual console to the dom\n * log.createVConsole(document.body)\n * }\n *\n * runTests({\n * mod1,\n * mod2,\n * }).then(success => {\n * if (isNode) {\n * process.exit(success ? 0 : 1)\n * }\n * })\n * ```\n *\n * ```js\n * // mod1.test.js\n * /**\n * * runTests automatically tests all exported functions that start with \"test\".\n * * The name of the function should be in camelCase and is used for the logging output.\n * *\n * * @ param {t.TestCase} tc\n * *\\/\n * export const testMyFirstTest = tc => {\n * t.compare({ a: 4 }, { a: 4 }, 'objects are equal')\n * }\n * ```\n *\n * Now you can simply run `node test.js` to run your test or run test.js in the browser.\n *\n * @module testing\n */\n\nimport * as log from 'lib0/logging'\nimport { simpleDiffString } from './diff.js'\nimport * as object from './object.js'\nimport * as string from './string.js'\nimport * as math from './math.js'\nimport * as random from './random.js'\nimport * as prng from './prng.js'\nimport * as statistics from './statistics.js'\nimport * as array from './array.js'\nimport * as env from './environment.js'\nimport * as json from './json.js'\nimport * as time from './time.js'\nimport * as promise from './promise.js'\nimport * as performance from 'lib0/performance'\nimport * as equalityTrait from './trait/equality.js'\n\nexport { production } from './environment.js'\nexport const extensive = env.hasConf('extensive')\n\n/* c8 ignore next */\nexport const envSeed = env.hasParam('--seed') ? Number.parseInt(env.getParam('--seed', '0')) : null\n\nexport class TestCase {\n /**\n * @param {string} moduleName\n * @param {string} testName\n */\n constructor (moduleName, testName) {\n /**\n * @type {string}\n */\n this.moduleName = moduleName\n /**\n * @type {string}\n */\n this.testName = testName\n /**\n * This type can store custom information related to the TestCase\n *\n * @type {Map}\n */\n this.meta = new Map()\n this._seed = null\n this._prng = null\n }\n\n resetSeed () {\n this._seed = null\n this._prng = null\n }\n\n /**\n * @type {number}\n */\n /* c8 ignore next */\n get seed () {\n /* c8 ignore else */\n if (this._seed === null) {\n /* c8 ignore next */\n this._seed = envSeed === null ? random.uint32() : envSeed\n }\n return this._seed\n }\n\n /**\n * A PRNG for this test case. Use only this PRNG for randomness to make the test case reproducible.\n *\n * @type {prng.PRNG}\n */\n get prng () {\n /* c8 ignore else */\n if (this._prng === null) {\n this._prng = prng.create(this.seed)\n }\n return this._prng\n }\n}\n\nexport const repetitionTime = Number(env.getParam('--repetition-time', '50'))\n/* c8 ignore next */\nconst testFilter = env.hasParam('--filter') ? env.getParam('--filter', '') : null\n\n/* c8 ignore next */\nconst testFilterRegExp = testFilter !== null ? new RegExp(testFilter) : /.*/\n\nconst repeatTestRegex = /^(repeat|repeating)\\s/\n\n/**\n * @param {string} moduleName\n * @param {string} name\n * @param {function(TestCase):void|Promise} f\n * @param {number} i\n * @param {number} numberOfTests\n */\nexport const run = async (moduleName, name, f, i, numberOfTests) => {\n const uncamelized = string.fromCamelCase(name.slice(4), ' ')\n const filtered = !testFilterRegExp.test(`[${i + 1}/${numberOfTests}] ${moduleName}: ${uncamelized}`)\n /* c8 ignore next 3 */\n if (filtered) {\n return true\n }\n const tc = new TestCase(moduleName, name)\n const repeat = repeatTestRegex.test(uncamelized)\n const groupArgs = [log.GREY, `[${i + 1}/${numberOfTests}] `, log.PURPLE, `${moduleName}: `, log.BLUE, uncamelized]\n /* c8 ignore next 5 */\n if (testFilter === null) {\n log.groupCollapsed(...groupArgs)\n } else {\n log.group(...groupArgs)\n }\n const times = []\n const start = performance.now()\n let lastTime = start\n /**\n * @type {any}\n */\n let err = null\n performance.mark(`${name}-start`)\n do {\n try {\n const p = f(tc)\n if (promise.isPromise(p)) {\n await p\n }\n } catch (_err) {\n err = _err\n }\n const currTime = performance.now()\n times.push(currTime - lastTime)\n lastTime = currTime\n if (repeat && err === null && (lastTime - start) < repetitionTime) {\n tc.resetSeed()\n } else {\n break\n }\n } while (err === null && (lastTime - start) < repetitionTime)\n performance.mark(`${name}-end`)\n /* c8 ignore next 3 */\n if (err !== null && err.constructor !== SkipError) {\n log.printError(err)\n }\n performance.measure(name, `${name}-start`, `${name}-end`)\n log.groupEnd()\n const duration = lastTime - start\n let success = true\n times.sort((a, b) => a - b)\n /* c8 ignore next 3 */\n const againMessage = env.isBrowser\n ? ` - ${window.location.host + window.location.pathname}?filter=\\\\[${i + 1}/${tc._seed === null ? '' : `&seed=${tc._seed}`}`\n : `\\nrepeat: npm run test -- --filter \"\\\\[${i + 1}/\" ${tc._seed === null ? '' : `--seed ${tc._seed}`}`\n const timeInfo = (repeat && err === null)\n ? ` - ${times.length} repetitions in ${time.humanizeDuration(duration)} (best: ${time.humanizeDuration(times[0])}, worst: ${time.humanizeDuration(array.last(times))}, median: ${time.humanizeDuration(statistics.median(times))}, average: ${time.humanizeDuration(statistics.average(times))})`\n : ` in ${time.humanizeDuration(duration)}`\n if (err !== null) {\n /* c8 ignore start */\n if (err.constructor === SkipError) {\n log.print(log.GREY, log.BOLD, 'Skipped: ', log.UNBOLD, uncamelized)\n } else {\n success = false\n log.print(log.RED, log.BOLD, 'Failure: ', log.UNBOLD, log.UNCOLOR, uncamelized, log.GREY, timeInfo, againMessage)\n }\n /* c8 ignore stop */\n } else {\n log.print(log.GREEN, log.BOLD, 'Success: ', log.UNBOLD, log.UNCOLOR, uncamelized, log.GREY, timeInfo, againMessage)\n }\n return success\n}\n\n/**\n * Describe what you are currently testing. The message will be logged.\n *\n * ```js\n * export const testMyFirstTest = tc => {\n * t.describe('crunching numbers', 'already crunched 4 numbers!') // the optional second argument can describe the state.\n * }\n * ```\n *\n * @param {string} description\n * @param {string} info\n */\nexport const describe = (description, info = '') => log.print(log.BLUE, description, ' ', log.GREY, info)\n\n/**\n * Describe the state of the current computation.\n * ```js\n * export const testMyFirstTest = tc => {\n * t.info(already crunched 4 numbers!') // the optional second argument can describe the state.\n * }\n * ```\n *\n * @param {string} info\n */\nexport const info = info => describe('', info)\n\nexport const printDom = log.printDom\n\nexport const printCanvas = log.printCanvas\n\n/**\n * Group outputs in a collapsible category.\n *\n * ```js\n * export const testMyFirstTest = tc => {\n * t.group('subtest 1', () => {\n * t.describe('this message is part of a collapsible section')\n * })\n * await t.groupAsync('subtest async 2', async () => {\n * await someaction()\n * t.describe('this message is part of a collapsible section')\n * })\n * }\n * ```\n *\n * @param {string} description\n * @param {function(...any):void} f\n */\nexport const group = (description, f) => {\n log.group(log.BLUE, description)\n try {\n f()\n } finally {\n log.groupEnd()\n }\n}\n\n/**\n * Group outputs in a collapsible category.\n *\n * ```js\n * export const testMyFirstTest = async tc => {\n * t.group('subtest 1', () => {\n * t.describe('this message is part of a collapsible section')\n * })\n * await t.groupAsync('subtest async 2', async () => {\n * await someaction()\n * t.describe('this message is part of a collapsible section')\n * })\n * }\n * ```\n *\n * @param {string} description\n * @param {function(...any):Promise} f\n */\nexport const groupAsync = async (description, f) => {\n log.group(log.BLUE, description)\n try {\n await f()\n } finally {\n log.groupEnd()\n }\n}\n\n/**\n * Measure the time that it takes to calculate something.\n *\n * ```js\n * export const testMyFirstTest = async tc => {\n * t.measureTime('measurement', () => {\n * heavyCalculation()\n * })\n * await t.groupAsync('async measurement', async () => {\n * await heavyAsyncCalculation()\n * })\n * }\n * ```\n *\n * @param {string} message\n * @param {function(...any):void} f\n * @return {number} Returns a promise that resolves the measured duration to apply f\n */\nexport const measureTime = (message, f) => {\n let duration\n const start = performance.now()\n try {\n f()\n } finally {\n duration = performance.now() - start\n log.print(log.PURPLE, message, log.GREY, ` ${time.humanizeDuration(duration)}`)\n }\n return duration\n}\n\n/**\n * Measure the time that it takes to calculate something.\n *\n * ```js\n * export const testMyFirstTest = async tc => {\n * t.measureTimeAsync('measurement', async () => {\n * await heavyCalculation()\n * })\n * await t.groupAsync('async measurement', async () => {\n * await heavyAsyncCalculation()\n * })\n * }\n * ```\n *\n * @param {string} message\n * @param {function(...any):Promise} f\n * @return {Promise} Returns a promise that resolves the measured duration to apply f\n */\nexport const measureTimeAsync = async (message, f) => {\n let duration\n const start = performance.now()\n try {\n await f()\n } finally {\n duration = performance.now() - start\n log.print(log.PURPLE, message, log.GREY, ` ${time.humanizeDuration(duration)}`)\n }\n return duration\n}\n\n/**\n * @template T\n * @param {Array} as\n * @param {Array} bs\n * @param {string} [m]\n * @return {boolean}\n */\nexport const compareArrays = (as, bs, m = 'Arrays match') => {\n if (as.length !== bs.length) {\n fail(m)\n }\n for (let i = 0; i < as.length; i++) {\n if (as[i] !== bs[i]) {\n fail(m)\n }\n }\n return true\n}\n\n/**\n * @param {string} a\n * @param {string} b\n * @param {string} [m]\n * @throws {TestError} Throws if tests fails\n */\nexport const compareStrings = (a, b, m = 'Strings match') => {\n if (a !== b) {\n const diff = simpleDiffString(a, b)\n log.print(log.GREY, a.slice(0, diff.index), log.RED, a.slice(diff.index, diff.remove), log.GREEN, diff.insert, log.GREY, a.slice(diff.index + diff.remove))\n fail(m)\n }\n}\n\n/**\n * @template K,V\n * @param {Object} a\n * @param {Object} b\n * @param {string} [m]\n * @throws {TestError} Throws if test fails\n */\nexport const compareObjects = (a, b, m = 'Objects match') => { object.equalFlat(a, b) || fail(m) }\n\n/**\n * @param {any} _constructor\n * @param {any} a\n * @param {any} b\n * @param {string} path\n * @throws {TestError}\n */\nconst compareValues = (_constructor, a, b, path) => {\n if (a !== b) {\n fail(`Values ${json.stringify(a)} and ${json.stringify(b)} don't match (${path})`)\n }\n return true\n}\n\n/**\n * @param {string?} message\n * @param {string} reason\n * @param {string} path\n * @throws {TestError}\n */\nconst _failMessage = (message, reason, path) => fail(\n message === null\n ? `${reason} ${path}`\n : `${message} (${reason}) ${path}`\n)\n\n/**\n * @param {any} a\n * @param {any} b\n * @param {string} path\n * @param {string?} message\n * @param {function(any,any,any,string,any):boolean} customCompare\n */\nconst _compare = (a, b, path, message, customCompare) => {\n // we don't use assert here because we want to test all branches (istanbul errors if one branch is not tested)\n if (a == null || b == null) {\n return compareValues(null, a, b, path)\n }\n if (a[equalityTrait.EqualityTraitSymbol] != null) {\n if (a[equalityTrait.EqualityTraitSymbol](b)) {\n return true\n } else {\n _failMessage(message, 'Not equal by equality trait', path)\n }\n }\n if (a.constructor !== b.constructor) {\n _failMessage(message, 'Constructors don\\'t match', path)\n }\n let success = true\n switch (a.constructor) {\n case ArrayBuffer:\n a = new Uint8Array(a)\n b = new Uint8Array(b)\n // eslint-disable-next-line no-fallthrough\n case Uint8Array: {\n if (a.byteLength !== b.byteLength) {\n _failMessage(message, 'ArrayBuffer lengths match', path)\n }\n for (let i = 0; success && i < a.length; i++) {\n success = success && a[i] === b[i]\n }\n break\n }\n case Set: {\n if (a.size !== b.size) {\n _failMessage(message, 'Sets have different number of attributes', path)\n }\n // @ts-ignore\n a.forEach(value => {\n if (!b.has(value)) {\n _failMessage(message, `b.${path} does have ${value}`, path)\n }\n })\n break\n }\n case Map: {\n if (a.size !== b.size) {\n _failMessage(message, 'Maps have different number of attributes', path)\n }\n // @ts-ignore\n a.forEach((value, key) => {\n if (!b.has(key)) {\n _failMessage(message, `Property ${path}[\"${key}\"] does not exist on second argument`, path)\n }\n _compare(value, b.get(key), `${path}[\"${key}\"]`, message, customCompare)\n })\n break\n }\n case undefined: // undefined is often set as a constructor for objects\n case Object:\n if (object.length(a) !== object.length(b)) {\n _failMessage(message, 'Objects have a different number of attributes', path)\n }\n object.forEach(a, (value, key) => {\n if (!object.hasProperty(b, key)) {\n _failMessage(message, `Property ${path} does not exist on second argument`, path)\n }\n _compare(value, b[key], `${path}[\"${key}\"]`, message, customCompare)\n })\n break\n case Array:\n if (a.length !== b.length) {\n _failMessage(message, 'Arrays have a different number of attributes', path)\n }\n // @ts-ignore\n a.forEach((value, i) => _compare(value, b[i], `${path}[${i}]`, message, customCompare))\n break\n /* c8 ignore next 4 */\n default:\n if (!customCompare(a.constructor, a, b, path, compareValues)) {\n _failMessage(message, `Values ${json.stringify(a)} and ${json.stringify(b)} don't match`, path)\n }\n }\n assert(success, message)\n return true\n}\n\n/**\n * @template T\n * @param {T} a\n * @param {T} b\n * @param {string?} [message]\n * @param {function(any,T,T,string,any):boolean} [customCompare]\n */\nexport const compare = (a, b, message = null, customCompare = compareValues) => _compare(a, b, 'obj', message, customCompare)\n\n/**\n * @template T\n * @param {T} property\n * @param {string?} [message]\n * @return {asserts property is NonNullable}\n * @throws {TestError}\n */\n/* c8 ignore next */\nexport const assert = (property, message = null) => { property || fail(`Assertion failed${message !== null ? `: ${message}` : ''}`) }\n\n/**\n * @param {function(...any):Promise} f\n */\nexport const promiseRejected = async f => {\n try {\n await f()\n } catch (err) {\n return\n }\n fail('Expected promise to fail')\n}\n\n/**\n * @param {function(...any):void} f\n * @throws {TestError}\n */\nexport const fails = f => {\n try {\n f()\n } catch (_err) {\n log.print(log.GREEN, '⇖ This Error was expected')\n return\n }\n fail('Expected this to fail')\n}\n\n/**\n * @param {function(...any):Promise} f\n * @throws {TestError}\n */\nexport const failsAsync = async f => {\n try {\n await f()\n } catch (_err) {\n log.print(log.GREEN, '⇖ This Error was expected')\n return\n }\n fail('Expected this to fail')\n}\n\n/**\n * @param {Object>>} tests\n */\nexport const runTests = async tests => {\n /**\n * @param {string} testname\n */\n const filterTest = testname => testname.startsWith('test') || testname.startsWith('benchmark')\n const numberOfTests = object.map(tests, mod => object.map(mod, (f, fname) => /* c8 ignore next */ f && filterTest(fname) ? 1 : 0).reduce(math.add, 0)).reduce(math.add, 0)\n let successfulTests = 0\n let testnumber = 0\n const start = performance.now()\n for (const modName in tests) {\n const mod = tests[modName]\n for (const fname in mod) {\n const f = mod[fname]\n /* c8 ignore else */\n if (f && filterTest(fname)) {\n const repeatEachTest = 1\n let success = true\n for (let i = 0; success && i < repeatEachTest; i++) {\n success = await run(modName, fname, f, testnumber, numberOfTests)\n }\n testnumber++\n /* c8 ignore else */\n if (success) {\n successfulTests++\n }\n }\n }\n }\n const end = performance.now()\n log.print('')\n const success = successfulTests === numberOfTests\n /* c8 ignore start */\n if (success) {\n log.print(log.GREEN, log.BOLD, 'All tests successful!', log.GREY, log.UNBOLD, ` in ${time.humanizeDuration(end - start)}`)\n log.printImgBase64(nyanCatImage, 50)\n } else {\n const failedTests = numberOfTests - successfulTests\n log.print(log.RED, log.BOLD, `> ${failedTests} test${failedTests > 1 ? 's' : ''} failed`)\n }\n /* c8 ignore stop */\n return success\n}\n\nclass TestError extends Error {}\n\n/**\n * @param {string} reason\n * @throws {TestError}\n */\nexport const fail = reason => {\n log.print(log.RED, log.BOLD, 'X ', log.UNBOLD, reason)\n throw new TestError('Test Failed')\n}\n\nclass SkipError extends Error {}\n\n/**\n * @param {boolean} cond If true, this tests will be skipped\n * @throws {SkipError}\n */\nexport const skip = (cond = true) => {\n if (cond) {\n throw new SkipError('skipping..')\n }\n}\n\n// eslint-disable-next-line\nconst nyanCatImage = 'R0lGODlhjABMAPcAAMiS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bVsPxyFiyjnPLKJruccswlV/MyCjW/jHPJOo/Mcxo+pwy0yTarbHIfnL2ioGvvaGExxrzaJ+wCdvT3ccgE9TzE2GOzTDbZZp/NcjVnD5G22ia3vbbccZ99dBp0iw13yWdD/10aF5BERx899CzwhQTxxHMP4hL0R08GlxQEDjiVqGG5GtRMPnnll1eiOTjUXK7G5+CInrnmoXf+eeqWf8655adPzroanqN+eeyUm7665TNMsQlnUCgh/PDCu1JFD/6ZqPzyvhJgEOxHRH8EGaITIf0R7oh+/RGiV3I99ZdbL332l2/f/fVEVH/962qYf7k76ItOxhEzuABkBhbkr//++aeQyf0ADKDzDBKGArbhgG3wQwEL6AcEtmGBBnQgBMPgQAUusIEInKADHwjBCkIQgwfUoAQ7iEALMtAPa5iEfbTQIT0YgTxGKJAMvfSFDhDoHgT4AgE6hBA/+GEQ2AgiNvy84EMfekGI2BhEEf1QAyQuEYhCJGIRjyhEJRaxiUJ8IhKlaEQkWtGHWAyiFqO4RC/UIIUl2s4H9PAlw+lrBPHQQ4UCtDU7vJEgbsijHvfIxz768Y+ADKQgB0lIQGJjDdvZjkBstJ3EHCSRRLLRHQnCiEoSJAKVrOQcCCKGTDIiApTMpBgIMgdPbnIgncxkQTw5yoGUMpOnFEgqLRnKSrZSIK/U5Ag+kLjEDaSXCQGmQHzJpWIasyV3OaYyl8nMZi7nLsl0ZkagKc1qWvOa2JxLNLPJzW6+ZZvevAhdwrkStJCTI2gZ5zknos51shOc7oynPOdJz3ra857hDAgAOw=='\n"],"names":["env.hasConf","env.hasParam","env.getParam","random.uint32","prng.create","string.fromCamelCase","log","performance","promise.isPromise","env.isBrowser","time.humanizeDuration","array.last","statistics.median","statistics.average","diff","simpleDiffString","object.equalFlat","json.stringify","equalityTrait.EqualityTraitSymbol","object.length","object.forEach","object.hasProperty","object.map","math.add"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;A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AAI,EAAEA,cAAG,CAAC,MAAM,EAAE,CAAC,IAAI,EAAEI,qBAAqB,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,EAAC;AAC9H,IAAIJ,cAAG,CAAC,cAAc,CAAC,YAAY,EAAE,EAAE,EAAC;AACxC,GAAG,MAAM;AACT,IAAI,MAAM,WAAW,GAAG,aAAa,GAAG,gBAAe;AACvD,IAAIA,cAAG,CAAC,KAAK,CAACA,cAAG,CAAC,GAAG,EAAEA,cAAG,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,EAAC;AAC7F,GAAG;AACH;AACA,EAAE,OAAO,OAAO;AAChB,EAAC;AACD;AACA,MAAM,SAAS,SAAS,KAAK,CAAC,EAAE;AAChC;AACA;AACA;AACA;AACA;AACY,MAAC,IAAI,GAAG,MAAM,IAAI;AAC9B,EAAEA,cAAG,CAAC,KAAK,CAACA,cAAG,CAAC,GAAG,EAAEA,cAAG,CAAC,IAAI,EAAE,IAAI,EAAEA,cAAG,CAAC,MAAM,EAAE,MAAM,EAAC;AACxD,EAAE,MAAM,IAAI,SAAS,CAAC,aAAa,CAAC;AACpC,EAAC;AACD;AACA,MAAM,SAAS,SAAS,KAAK,CAAC,EAAE;AAChC;AACA;AACA;AACA;AACA;AACY,MAAC,IAAI,GAAG,CAAC,IAAI,GAAG,IAAI,KAAK;AACrC,EAAE,IAAI,IAAI,EAAE;AACZ,IAAI,MAAM,IAAI,SAAS,CAAC,YAAY,CAAC;AACrC,GAAG;AACH,EAAC;AACD;AACA;AACA,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/testing.d.ts b/yjs-poll/node_modules/lib0/dist/testing.d.ts deleted file mode 100644 index 2ab045a..0000000 --- a/yjs-poll/node_modules/lib0/dist/testing.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -export { production } from "./environment.js"; -export const extensive: boolean; -export const envSeed: number | null; -export class TestCase { - /** - * @param {string} moduleName - * @param {string} testName - */ - constructor(moduleName: string, testName: string); - /** - * @type {string} - */ - moduleName: string; - /** - * @type {string} - */ - testName: string; - /** - * This type can store custom information related to the TestCase - * - * @type {Map} - */ - meta: Map; - _seed: number | null; - _prng: prng.PRNG | null; - resetSeed(): void; - /** - * @type {number} - */ - get seed(): number; - /** - * A PRNG for this test case. Use only this PRNG for randomness to make the test case reproducible. - * - * @type {prng.PRNG} - */ - get prng(): prng.PRNG; -} -export const repetitionTime: number; -export function run(moduleName: string, name: string, f: (arg0: TestCase) => void | Promise, i: number, numberOfTests: number): Promise; -export function describe(description: string, info?: string): void; -export function info(info: string): void; -export const printDom: (_createNode: () => Node) => void; -export const printCanvas: (canvas: HTMLCanvasElement, height: number) => void; -export function group(description: string, f: (...args: any[]) => void): void; -export function groupAsync(description: string, f: (...args: any[]) => Promise): Promise; -export function measureTime(message: string, f: (...args: any[]) => void): number; -export function measureTimeAsync(message: string, f: (...args: any[]) => Promise): Promise; -export function compareArrays(as: Array, bs: Array, m?: string): boolean; -export function compareStrings(a: string, b: string, m?: string): void; -export function compareObjects(a: any, b: any, m?: string): void; -export function compare(a: T, b: T, message?: string | null, customCompare?: (arg0: any, arg1: T, arg2: T, arg3: string, arg4: any) => boolean): boolean; -export function assert(property: T, message?: string | null): asserts property is NonNullable; -export function promiseRejected(f: (...args: any[]) => Promise): Promise; -export function fails(f: (...args: any[]) => void): void; -export function failsAsync(f: (...args: any[]) => Promise): Promise; -export function runTests(tests: { - [x: string]: { - [x: string]: (arg0: TestCase) => void | Promise; - }; -}): Promise; -export function fail(reason: string): never; -export function skip(cond?: boolean): void; -import * as prng from './prng.js'; -//# sourceMappingURL=testing.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/testing.d.ts.map b/yjs-poll/node_modules/lib0/dist/testing.d.ts.map deleted file mode 100644 index 556755c..0000000 --- a/yjs-poll/node_modules/lib0/dist/testing.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../testing.js"],"names":[],"mappings":";AA8DA,gCAAiD;AAGjD,oCAAmG;AAEnG;IACE;;;OAGG;IACH,wBAHW,MAAM,YACN,MAAM,EAmBhB;IAhBC;;OAEG;IACH,YAFU,MAAM,CAEY;IAC5B;;OAEG;IACH,UAFU,MAAM,CAEQ;IACxB;;;;OAIG;IACH,MAFU,GAAG,CAAC,MAAM,EAAC,GAAG,CAAC,CAEJ;IACrB,qBAAiB;IACjB,wBAAiB;IAGnB,kBAGC;IAED;;OAEG;IAEH,YAHU,MAAM,CAUf;IAED;;;;OAIG;IACH,YAFU,IAAI,CAAC,IAAI,CAQlB;CACF;AAED,oCAA6E;AAgBtE,gCANI,MAAM,QACN,MAAM,KACN,CAAS,IAAQ,EAAR,QAAQ,KAAE,IAAI,GAAC,OAAO,CAAC,GAAG,CAAC,KACpC,MAAM,iBACN,MAAM,oBA0EhB;AAcM,sCAHI,MAAM,SACN,MAAM,QAEwF;AAYlG,2BAFI,MAAM,QAE6B;AAE9C,yDAAoC;AAEpC,8EAA0C;AAoBnC,mCAHI,MAAM,KACN,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,IAAI,QAS/B;AAoBM,wCAHI,MAAM,KACN,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,OAAO,CAAC,GAAG,CAAC,iBASvC;AAoBM,qCAJI,MAAM,KACN,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,IAAI,GACpB,MAAM,CAYjB;AAoBM,0CAJI,MAAM,KACN,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,OAAO,CAAC,GAAG,CAAC,GAC5B,OAAO,CAAC,MAAM,CAAC,CAY1B;AASM,8BANM,CAAC,MACH,KAAK,CAAC,CAAC,CAAC,MACR,KAAK,CAAC,CAAC,CAAC,MACR,MAAM,GACL,OAAO,CAYlB;AAQM,kCALI,MAAM,KACN,MAAM,MACN,MAAM,QAShB;AASM,+BANM,CAAC,EAAC,CAAC,sBAGL,MAAM,QAGiF;AA8H3F,wBANM,CAAC,KACH,CAAC,KACD,CAAC,YACD,MAAM,OAAC,kBACP,CAAS,IAAG,EAAH,GAAG,EAAC,IAAC,EAAD,CAAC,EAAC,IAAC,EAAD,CAAC,EAAC,IAAM,EAAN,MAAM,EAAC,IAAG,EAAH,GAAG,KAAE,OAAO,WAE8E;AAUtH,uBAPM,CAAC,YACH,CAAC,YACD,MAAM,OAAC,GACN,QAAQ,QAAQ,IAAI,WAAW,CAAC,CAAC,CAAC,CAIuF;AAK9H,mCAFI,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,OAAO,CAAC,GAAG,CAAC,iBASvC;AAMM,yBAHI,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,IAAI,QAW/B;AAMM,8BAHI,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,OAAO,CAAC,GAAG,CAAC,iBAWvC;AAKM;;4BAF2C,QAAQ,KAAE,IAAI,GAAC,OAAO,CAAC,GAAG,CAAC;;qBA2C5E;AAQM,6BAHI,MAAM,SAMhB;AAQM,4BAHI,OAAO,QAOjB;sBA/kBqB,WAAW"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/testing.test.d.ts b/yjs-poll/node_modules/lib0/dist/testing.test.d.ts deleted file mode 100644 index 9007956..0000000 --- a/yjs-poll/node_modules/lib0/dist/testing.test.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export function nottestingNotTested(): void; -export function testAssertTyping(): void; -export function testComparing(_tc: t.TestCase): void; -export function testFailing(): Promise; -export function testSkipping(): void; -export function testAsync(): Promise; -export function testRepeatRepetition(): void; -import * as t from './testing.js'; -//# sourceMappingURL=testing.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/testing.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/testing.test.d.ts.map deleted file mode 100644 index 0d151e2..0000000 --- a/yjs-poll/node_modules/lib0/dist/testing.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"testing.test.d.ts","sourceRoot":"","sources":["../testing.test.js"],"names":[],"mappings":"AAQO,4CAEN;AAEM,yCAMN;AAKM,mCAFI,CAAC,CAAC,QAAQ,QAqGpB;AAEM,6CAcN;AAEM,qCAMN;AAEM,2CAIN;AAEM,6CAON;mBAjKkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/time-d8438852.cjs b/yjs-poll/node_modules/lib0/dist/time-d8438852.cjs deleted file mode 100644 index 7ad173a..0000000 --- a/yjs-poll/node_modules/lib0/dist/time-d8438852.cjs +++ /dev/null @@ -1,63 +0,0 @@ -'use strict'; - -var metric = require('./metric.cjs'); -var math = require('./math-96d5e8c4.cjs'); - -/** - * Utility module to work with time. - * - * @module time - */ - -/** - * Return current time. - * - * @return {Date} - */ -const getDate = () => new Date(); - -/** - * Return current unix time. - * - * @return {number} - */ -const getUnixTime = Date.now; - -/** - * Transform time (in ms) to a human readable format. E.g. 1100 => 1.1s. 60s => 1min. .001 => 10μs. - * - * @param {number} d duration in milliseconds - * @return {string} humanized approximation of time - */ -const humanizeDuration = d => { - if (d < 60000) { - const p = metric.prefix(d, -1); - return math.round(p.n * 100) / 100 + p.prefix + 's' - } - d = math.floor(d / 1000); - const seconds = d % 60; - const minutes = math.floor(d / 60) % 60; - const hours = math.floor(d / 3600) % 24; - const days = math.floor(d / 86400); - if (days > 0) { - return days + 'd' + ((hours > 0 || minutes > 30) ? ' ' + (minutes > 30 ? hours + 1 : hours) + 'h' : '') - } - if (hours > 0) { - /* c8 ignore next */ - return hours + 'h' + ((minutes > 0 || seconds > 30) ? ' ' + (seconds > 30 ? minutes + 1 : minutes) + 'min' : '') - } - return minutes + 'min' + (seconds > 0 ? ' ' + seconds + 's' : '') -}; - -var time = /*#__PURE__*/Object.freeze({ - __proto__: null, - getDate: getDate, - getUnixTime: getUnixTime, - humanizeDuration: humanizeDuration -}); - -exports.getDate = getDate; -exports.getUnixTime = getUnixTime; -exports.humanizeDuration = humanizeDuration; -exports.time = time; -//# sourceMappingURL=time-d8438852.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/time-d8438852.cjs.map b/yjs-poll/node_modules/lib0/dist/time-d8438852.cjs.map deleted file mode 100644 index 3709d50..0000000 --- a/yjs-poll/node_modules/lib0/dist/time-d8438852.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"time-d8438852.cjs","sources":["../time.js"],"sourcesContent":["/**\n * Utility module to work with time.\n *\n * @module time\n */\n\nimport * as metric from './metric.js'\nimport * as math from './math.js'\n\n/**\n * Return current time.\n *\n * @return {Date}\n */\nexport const getDate = () => new Date()\n\n/**\n * Return current unix time.\n *\n * @return {number}\n */\nexport const getUnixTime = Date.now\n\n/**\n * Transform time (in ms) to a human readable format. E.g. 1100 => 1.1s. 60s => 1min. .001 => 10μs.\n *\n * @param {number} d duration in milliseconds\n * @return {string} humanized approximation of time\n */\nexport const humanizeDuration = d => {\n if (d < 60000) {\n const p = metric.prefix(d, -1)\n return math.round(p.n * 100) / 100 + p.prefix + 's'\n }\n d = math.floor(d / 1000)\n const seconds = d % 60\n const minutes = math.floor(d / 60) % 60\n const hours = math.floor(d / 3600) % 24\n const days = math.floor(d / 86400)\n if (days > 0) {\n return days + 'd' + ((hours > 0 || minutes > 30) ? ' ' + (minutes > 30 ? hours + 1 : hours) + 'h' : '')\n }\n if (hours > 0) {\n /* c8 ignore next */\n return hours + 'h' + ((minutes > 0 || seconds > 30) ? ' ' + (seconds > 30 ? minutes + 1 : minutes) + 'min' : '')\n }\n return minutes + 'min' + (seconds > 0 ? ' ' + seconds + 's' : '')\n}\n"],"names":["metric.prefix","math.round","math.floor"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,OAAO,GAAG,MAAM,IAAI,IAAI,GAAE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;AACH,EAAE,OAAO,OAAO,GAAG,KAAK,IAAI,OAAO,GAAG,CAAC,GAAG,GAAG,GAAG,OAAO,GAAG,GAAG,GAAG,EAAE,CAAC;AACnE;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/time.cjs b/yjs-poll/node_modules/lib0/dist/time.cjs deleted file mode 100644 index b1edb0c..0000000 --- a/yjs-poll/node_modules/lib0/dist/time.cjs +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./metric.cjs'); -require('./math-96d5e8c4.cjs'); -var time = require('./time-d8438852.cjs'); - - - -exports.getDate = time.getDate; -exports.getUnixTime = time.getUnixTime; -exports.humanizeDuration = time.humanizeDuration; -//# sourceMappingURL=time.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/time.cjs.map b/yjs-poll/node_modules/lib0/dist/time.cjs.map deleted file mode 100644 index d5d354a..0000000 --- a/yjs-poll/node_modules/lib0/dist/time.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"time.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/time.d.ts b/yjs-poll/node_modules/lib0/dist/time.d.ts deleted file mode 100644 index 5ee1371..0000000 --- a/yjs-poll/node_modules/lib0/dist/time.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export function getDate(): Date; -/** - * Return current unix time. - * - * @return {number} - */ -export const getUnixTime: () => number; -export function humanizeDuration(d: number): string; -//# sourceMappingURL=time.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/time.d.ts.map b/yjs-poll/node_modules/lib0/dist/time.d.ts.map deleted file mode 100644 index 6d25924..0000000 --- a/yjs-poll/node_modules/lib0/dist/time.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../time.js"],"names":[],"mappings":"AAcO,2BAFK,IAAI,CAEuB;AAEvC;;;;GAIG;AACH,uCAAmC;AAQ5B,oCAHI,MAAM,GACL,MAAM,CAoBjB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/time.test.d.ts b/yjs-poll/node_modules/lib0/dist/time.test.d.ts deleted file mode 100644 index 614187b..0000000 --- a/yjs-poll/node_modules/lib0/dist/time.test.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function testTime(tc: t.TestCase): void; -export function testHumanDuration(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=time.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/time.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/time.test.d.ts.map deleted file mode 100644 index 78dfcce..0000000 --- a/yjs-poll/node_modules/lib0/dist/time.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"time.test.d.ts","sourceRoot":"","sources":["../time.test.js"],"names":[],"mappings":"AAOO,6BAFI,CAAC,CAAC,QAAQ,QAMpB;AAKM,sCAFI,CAAC,CAAC,QAAQ,QAmBpB;mBAhCkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/trait/equality.d.ts b/yjs-poll/node_modules/lib0/dist/trait/equality.d.ts deleted file mode 100644 index 1848ba1..0000000 --- a/yjs-poll/node_modules/lib0/dist/trait/equality.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const EqualityTraitSymbol: unique symbol; -export function equals(a: NoInfer, b: T): boolean; -export type EqualityTrait = { - [EqualityTraitSymbol]: (other: EqualityTrait) => boolean; -}; -//# sourceMappingURL=equality.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/trait/equality.d.ts.map b/yjs-poll/node_modules/lib0/dist/trait/equality.d.ts.map deleted file mode 100644 index 4977998..0000000 --- a/yjs-poll/node_modules/lib0/dist/trait/equality.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"equality.d.ts","sourceRoot":"","sources":["../../trait/equality.js"],"names":[],"mappings":"AAAA,gDAAqD;AAyB9C,uBALsB,CAAC,SAAhB,aAAc,KACjB,OAAO,CAAC,CAAC,CAAC,KACV,CAAC,GACA,OAAO,CAEgE;4BAtBtE;IAAE,CAAC,mBAAmB,CAAC,EAAC,CAAC,KAAK,EAAC,aAAa,KAAG,OAAO,CAAA;CAAE"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/trait/fingerprint.d.ts b/yjs-poll/node_modules/lib0/dist/trait/fingerprint.d.ts deleted file mode 100644 index 1a31d75..0000000 --- a/yjs-poll/node_modules/lib0/dist/trait/fingerprint.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export const FingerprintTraitSymbol: unique symbol; -export function fingerprint(a: Fingerprintable): string; -/** - * When implementing this trait, it is recommended to write some sort of "magic number" first to - * ensure that different types of objects don't have the same fingerprint. - * - * The recommended pracice is to generate a random u32 number as your magic number. e.g. using - * `console.log(random.uint32().toString(16))` - */ -export type Fingerprintable = { - [FingerprintTraitSymbol]: () => string; -} | import("../encoding.js").AnyEncodable; -//# sourceMappingURL=fingerprint.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/trait/fingerprint.d.ts.map b/yjs-poll/node_modules/lib0/dist/trait/fingerprint.d.ts.map deleted file mode 100644 index 2f03e47..0000000 --- a/yjs-poll/node_modules/lib0/dist/trait/fingerprint.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fingerprint.d.ts","sourceRoot":"","sources":["../../trait/fingerprint.js"],"names":[],"mappings":"AAIA,mDAA2D;AAgBpD,+BAHI,eAAe,GACd,MAAM,CAE6P;;;;;;;;8BAPlQ;IAAE,CAAC,sBAAsB,CAAC,EAAC,MAAI,MAAM,CAAA;CAAE,GAAG,OAAO,gBAAgB,EAAE,YAAY"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/trait/traits.d.ts b/yjs-poll/node_modules/lib0/dist/trait/traits.d.ts deleted file mode 100644 index e0084f2..0000000 --- a/yjs-poll/node_modules/lib0/dist/trait/traits.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./equality.js"; -export * from "./fingerprint.js"; -//# sourceMappingURL=traits.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/trait/traits.d.ts.map b/yjs-poll/node_modules/lib0/dist/trait/traits.d.ts.map deleted file mode 100644 index 5a8b838..0000000 --- a/yjs-poll/node_modules/lib0/dist/trait/traits.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"traits.d.ts","sourceRoot":"","sources":["../../trait/traits.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/trait/traits.test.d.ts b/yjs-poll/node_modules/lib0/dist/trait/traits.test.d.ts deleted file mode 100644 index ac3f802..0000000 --- a/yjs-poll/node_modules/lib0/dist/trait/traits.test.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function testEqualityTrait1(_tc: t.TestCase): void; -export function testEqualityTrait2(_tc: t.TestCase): void; -export function testFingerprintTrait(): void; -import * as t from '../testing.js'; -//# sourceMappingURL=traits.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/trait/traits.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/trait/traits.test.d.ts.map deleted file mode 100644 index 86451b3..0000000 --- a/yjs-poll/node_modules/lib0/dist/trait/traits.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"traits.test.d.ts","sourceRoot":"","sources":["../../trait/traits.test.js"],"names":[],"mappings":"AAQO,wCAFI,CAAC,CAAC,QAAQ,QAwCpB;AAKM,wCAFI,CAAC,CAAC,QAAQ,QA2BpB;AAEM,6CAMN;mBApFkB,eAAe"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/traits.cjs b/yjs-poll/node_modules/lib0/dist/traits.cjs deleted file mode 100644 index 8aa7b3d..0000000 --- a/yjs-poll/node_modules/lib0/dist/traits.cjs +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var equality = require('./equality.cjs'); -var fingerprint = require('./fingerprint.cjs'); -require('./encoding-1a745c43.cjs'); -require('./math-96d5e8c4.cjs'); -require('./number-1fb57bba.cjs'); -require('./binary-ac8e39e2.cjs'); -require('./string-fddc5f8b.cjs'); -require('./array-78849c95.cjs'); -require('./set-5b47859e.cjs'); -require('./rabin.cjs'); -require('./buffer-3e750729.cjs'); -require('./environment-1c97264d.cjs'); -require('./map-24d263c0.cjs'); -require('./conditions-f5c0c102.cjs'); -require('./storage.cjs'); -require('./function-314580f7.cjs'); -require('./object-c0c9435b.cjs'); -require('./decoding-76e75827.cjs'); -require('./error-0c1f634f.cjs'); - - - -exports.EqualityTraitSymbol = equality.EqualityTraitSymbol; -exports.equals = equality.equals; -exports.FingerprintTraitSymbol = fingerprint.FingerprintTraitSymbol; -exports.fingerprint = fingerprint.fingerprint; -//# sourceMappingURL=traits.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/traits.cjs.map b/yjs-poll/node_modules/lib0/dist/traits.cjs.map deleted file mode 100644 index 654b779..0000000 --- a/yjs-poll/node_modules/lib0/dist/traits.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"traits.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/tree-9f3c8837.cjs b/yjs-poll/node_modules/lib0/dist/tree-9f3c8837.cjs deleted file mode 100644 index 5a2cfcc..0000000 --- a/yjs-poll/node_modules/lib0/dist/tree-9f3c8837.cjs +++ /dev/null @@ -1,557 +0,0 @@ -'use strict'; - -/** - * Red-black-tree implementation. - * - * @module tree - */ -// @ts-nocheck TODO: remove or refactor this file - -const rotate = (tree, parent, newParent, n) => { - if (parent === null) { - tree.root = newParent; - newParent._parent = null; - } else if (parent.left === n) { - parent.left = newParent; - } else if (parent.right === n) { - parent.right = newParent; - } else { - throw new Error('The elements are wrongly connected!') - } -}; - -/** - * @template V - */ -class N { - /** - * A created node is always red! - * - * @param {V} val - */ - constructor (val) { - this.val = val; - this.color = true; - this._left = null; - this._right = null; - this._parent = null; - } - - isRed () { return this.color } - isBlack () { return !this.color } - redden () { this.color = true; return this } - blacken () { this.color = false; return this } - get grandparent () { - return this.parent.parent - } - - get parent () { - return this._parent - } - - get sibling () { - return (this === this.parent.left) - ? this.parent.right - : this.parent.left - } - - get left () { - return this._left - } - - get right () { - return this._right - } - - set left (n) { - if (n !== null) { - n._parent = this; - } - this._left = n; - } - - set right (n) { - if (n !== null) { - n._parent = this; - } - this._right = n; - } - - rotateLeft (tree) { - const parent = this.parent; - const newParent = this.right; - const newRight = this.right.left; - newParent.left = this; - this.right = newRight; - rotate(tree, parent, newParent, this); - } - - next () { - if (this.right !== null) { - // search the most left node in the right tree - let o = this.right; - while (o.left !== null) { - o = o.left; - } - return o - } else { - let p = this; - while (p.parent !== null && p !== p.parent.left) { - p = p.parent; - } - return p.parent - } - } - - prev () { - if (this.left !== null) { - // search the most right node in the left tree - let o = this.left; - while (o.right !== null) { - o = o.right; - } - return o - } else { - let p = this; - while (p.parent !== null && p !== p.parent.right) { - p = p.parent; - } - return p.parent - } - } - - rotateRight (tree) { - const parent = this.parent; - const newParent = this.left; - const newLeft = this.left.right; - newParent.right = this; - this.left = newLeft; - rotate(tree, parent, newParent, this); - } - - getUncle () { - // we can assume that grandparent exists when this is called! - if (this.parent === this.parent.parent.left) { - return this.parent.parent.right - } else { - return this.parent.parent.left - } - } -} - -const isBlack = node => - node !== null ? node.isBlack() : true; - -const isRed = (node) => - node !== null ? node.isRed() : false; - -/** - * This is a Red Black Tree implementation - * - * @template K,V - */ -class Tree { - constructor () { - this.root = null; - this.length = 0; - } - - /** - * @param {K} id - */ - findNext (id) { - const nextID = id.clone(); - nextID.clock += 1; - return this.findWithLowerBound(nextID) - } - - /** - * @param {K} id - */ - findPrev (id) { - const prevID = id.clone(); - prevID.clock -= 1; - return this.findWithUpperBound(prevID) - } - - /** - * @param {K} from - */ - findNodeWithLowerBound (from) { - let o = this.root; - if (o === null) { - return null - } else { - while (true) { - if (from === null || (from.lessThan(o.val._id) && o.left !== null)) { - // o is included in the bound - // try to find an element that is closer to the bound - o = o.left; - } else if (from !== null && o.val._id.lessThan(from)) { - // o is not within the bound, maybe one of the right elements is.. - if (o.right !== null) { - o = o.right; - } else { - // there is no right element. Search for the next bigger element, - // this should be within the bounds - return o.next() - } - } else { - return o - } - } - } - } - - /** - * @param {K} to - */ - findNodeWithUpperBound (to) { - if (to === undefined) { - throw new Error('You must define from!') - } - let o = this.root; - if (o === null) { - return null - } else { - while (true) { - if ((to === null || o.val._id.lessThan(to)) && o.right !== null) { - // o is included in the bound - // try to find an element that is closer to the bound - o = o.right; - } else if (to !== null && to.lessThan(o.val._id)) { - // o is not within the bound, maybe one of the left elements is.. - if (o.left !== null) { - o = o.left; - } else { - // there is no left element. Search for the prev smaller element, - // this should be within the bounds - return o.prev() - } - } else { - return o - } - } - } - } - - /** - * @return {V} - */ - findSmallestNode () { - let o = this.root; - while (o != null && o.left != null) { - o = o.left; - } - return o - } - - /** - * @param {K} from - * @return {V} - */ - findWithLowerBound (from) { - const n = this.findNodeWithLowerBound(from); - return n == null ? null : n.val - } - - /** - * @param {K} to - * @return {V} - */ - findWithUpperBound (to) { - const n = this.findNodeWithUpperBound(to); - return n == null ? null : n.val - } - - /** - * @param {K} from - * @param {V} from - * @param {function(V):void} f - */ - iterate (from, to, f) { - let o; - if (from === null) { - o = this.findSmallestNode(); - } else { - o = this.findNodeWithLowerBound(from); - } - while ( - o !== null && - ( - to === null || // eslint-disable-line no-unmodified-loop-condition - o.val._id.lessThan(to) || - o.val._id.equals(to) - ) - ) { - f(o.val); - o = o.next(); - } - } - - /** - * @param {K} id - * @return {V|null} - */ - find (id) { - const n = this.findNode(id); - if (n !== null) { - return n.val - } else { - return null - } - } - - /** - * @param {K} id - * @return {N|null} - */ - findNode (id) { - let o = this.root; - if (o === null) { - return null - } else { - while (true) { - if (o === null) { - return null - } - if (id.lessThan(o.val._id)) { - o = o.left; - } else if (o.val._id.lessThan(id)) { - o = o.right; - } else { - return o - } - } - } - } - - /** - * @param {K} id - */ - delete (id) { - let d = this.findNode(id); - if (d == null) { - // throw new Error('Element does not exist!') - return - } - this.length--; - if (d.left !== null && d.right !== null) { - // switch d with the greates element in the left subtree. - // o should have at most one child. - let o = d.left; - // find - while (o.right !== null) { - o = o.right; - } - // switch - d.val = o.val; - d = o; - } - // d has at most one child - // let n be the node that replaces d - let isFakeChild; - let child = d.left || d.right; - if (child === null) { - isFakeChild = true; - child = new N(null); - child.blacken(); - d.right = child; - } else { - isFakeChild = false; - } - - if (d.parent === null) { - if (!isFakeChild) { - this.root = child; - child.blacken(); - child._parent = null; - } else { - this.root = null; - } - return - } else if (d.parent.left === d) { - d.parent.left = child; - } else if (d.parent.right === d) { - d.parent.right = child; - } else { - throw new Error('Impossible!') - } - if (d.isBlack()) { - if (child.isRed()) { - child.blacken(); - } else { - this._fixDelete(child); - } - } - this.root.blacken(); - if (isFakeChild) { - if (child.parent.left === child) { - child.parent.left = null; - } else if (child.parent.right === child) { - child.parent.right = null; - } else { - throw new Error('Impossible #3') - } - } - } - - _fixDelete (n) { - if (n.parent === null) { - // this can only be called after the first iteration of fixDelete. - return - } - // d was already replaced by the child - // d is not the root - // d and child are black - let sibling = n.sibling; - if (isRed(sibling)) { - // make sibling the grandfather - n.parent.redden(); - sibling.blacken(); - if (n === n.parent.left) { - n.parent.rotateLeft(this); - } else if (n === n.parent.right) { - n.parent.rotateRight(this); - } else { - throw new Error('Impossible #2') - } - sibling = n.sibling; - } - // parent, sibling, and children of n are black - if (n.parent.isBlack() && - sibling.isBlack() && - isBlack(sibling.left) && - isBlack(sibling.right) - ) { - sibling.redden(); - this._fixDelete(n.parent); - } else if (n.parent.isRed() && - sibling.isBlack() && - isBlack(sibling.left) && - isBlack(sibling.right) - ) { - sibling.redden(); - n.parent.blacken(); - } else { - if (n === n.parent.left && - sibling.isBlack() && - isRed(sibling.left) && - isBlack(sibling.right) - ) { - sibling.redden(); - sibling.left.blacken(); - sibling.rotateRight(this); - sibling = n.sibling; - } else if (n === n.parent.right && - sibling.isBlack() && - isRed(sibling.right) && - isBlack(sibling.left) - ) { - sibling.redden(); - sibling.right.blacken(); - sibling.rotateLeft(this); - sibling = n.sibling; - } - sibling.color = n.parent.color; - n.parent.blacken(); - if (n === n.parent.left) { - sibling.right.blacken(); - n.parent.rotateLeft(this); - } else { - sibling.left.blacken(); - n.parent.rotateRight(this); - } - } - } - - put (v) { - const node = new N(v); - if (this.root !== null) { - let p = this.root; // p abbrev. parent - while (true) { - if (node.val._id.lessThan(p.val._id)) { - if (p.left === null) { - p.left = node; - break - } else { - p = p.left; - } - } else if (p.val._id.lessThan(node.val._id)) { - if (p.right === null) { - p.right = node; - break - } else { - p = p.right; - } - } else { - p.val = node.val; - return p - } - } - this._fixInsert(node); - } else { - this.root = node; - } - this.length++; - this.root.blacken(); - return node - } - - _fixInsert (n) { - if (n.parent === null) { - n.blacken(); - return - } else if (n.parent.isBlack()) { - return - } - const uncle = n.getUncle(); - if (uncle !== null && uncle.isRed()) { - // Note: parent: red, uncle: red - n.parent.blacken(); - uncle.blacken(); - n.grandparent.redden(); - this._fixInsert(n.grandparent); - } else { - // Note: parent: red, uncle: black or null - // Now we transform the tree in such a way that - // either of these holds: - // 1) grandparent.left.isRed - // and grandparent.left.left.isRed - // 2) grandparent.right.isRed - // and grandparent.right.right.isRed - if (n === n.parent.right && n.parent === n.grandparent.left) { - n.parent.rotateLeft(this); - // Since we rotated and want to use the previous - // cases, we need to set n in such a way that - // n.parent.isRed again - n = n.left; - } else if (n === n.parent.left && n.parent === n.grandparent.right) { - n.parent.rotateRight(this); - // see above - n = n.right; - } - // Case 1) or 2) hold from here on. - // Now traverse grandparent, make parent a black node - // on the highest level which holds two red nodes. - n.parent.blacken(); - n.grandparent.redden(); - if (n === n.parent.left) { - // Case 1 - n.grandparent.rotateRight(this); - } else { - // Case 2 - n.grandparent.rotateLeft(this); - } - } - } -} - -var tree = /*#__PURE__*/Object.freeze({ - __proto__: null, - Tree: Tree -}); - -exports.Tree = Tree; -exports.tree = tree; -//# sourceMappingURL=tree-9f3c8837.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/tree-9f3c8837.cjs.map b/yjs-poll/node_modules/lib0/dist/tree-9f3c8837.cjs.map deleted file mode 100644 index 04a1538..0000000 --- a/yjs-poll/node_modules/lib0/dist/tree-9f3c8837.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tree-9f3c8837.cjs","sources":["../tree.js"],"sourcesContent":["/**\n * Red-black-tree implementation.\n *\n * @module tree\n */\n// @ts-nocheck TODO: remove or refactor this file\n\nconst rotate = (tree, parent, newParent, n) => {\n if (parent === null) {\n tree.root = newParent\n newParent._parent = null\n } else if (parent.left === n) {\n parent.left = newParent\n } else if (parent.right === n) {\n parent.right = newParent\n } else {\n throw new Error('The elements are wrongly connected!')\n }\n}\n\n/**\n * @template V\n */\nclass N {\n /**\n * A created node is always red!\n *\n * @param {V} val\n */\n constructor (val) {\n this.val = val\n this.color = true\n this._left = null\n this._right = null\n this._parent = null\n }\n\n isRed () { return this.color }\n isBlack () { return !this.color }\n redden () { this.color = true; return this }\n blacken () { this.color = false; return this }\n get grandparent () {\n return this.parent.parent\n }\n\n get parent () {\n return this._parent\n }\n\n get sibling () {\n return (this === this.parent.left)\n ? this.parent.right\n : this.parent.left\n }\n\n get left () {\n return this._left\n }\n\n get right () {\n return this._right\n }\n\n set left (n) {\n if (n !== null) {\n n._parent = this\n }\n this._left = n\n }\n\n set right (n) {\n if (n !== null) {\n n._parent = this\n }\n this._right = n\n }\n\n rotateLeft (tree) {\n const parent = this.parent\n const newParent = this.right\n const newRight = this.right.left\n newParent.left = this\n this.right = newRight\n rotate(tree, parent, newParent, this)\n }\n\n next () {\n if (this.right !== null) {\n // search the most left node in the right tree\n let o = this.right\n while (o.left !== null) {\n o = o.left\n }\n return o\n } else {\n let p = this\n while (p.parent !== null && p !== p.parent.left) {\n p = p.parent\n }\n return p.parent\n }\n }\n\n prev () {\n if (this.left !== null) {\n // search the most right node in the left tree\n let o = this.left\n while (o.right !== null) {\n o = o.right\n }\n return o\n } else {\n let p = this\n while (p.parent !== null && p !== p.parent.right) {\n p = p.parent\n }\n return p.parent\n }\n }\n\n rotateRight (tree) {\n const parent = this.parent\n const newParent = this.left\n const newLeft = this.left.right\n newParent.right = this\n this.left = newLeft\n rotate(tree, parent, newParent, this)\n }\n\n getUncle () {\n // we can assume that grandparent exists when this is called!\n if (this.parent === this.parent.parent.left) {\n return this.parent.parent.right\n } else {\n return this.parent.parent.left\n }\n }\n}\n\nconst isBlack = node =>\n node !== null ? node.isBlack() : true\n\nconst isRed = (node) =>\n node !== null ? node.isRed() : false\n\n/**\n * This is a Red Black Tree implementation\n *\n * @template K,V\n */\nexport class Tree {\n constructor () {\n this.root = null\n this.length = 0\n }\n\n /**\n * @param {K} id\n */\n findNext (id) {\n const nextID = id.clone()\n nextID.clock += 1\n return this.findWithLowerBound(nextID)\n }\n\n /**\n * @param {K} id\n */\n findPrev (id) {\n const prevID = id.clone()\n prevID.clock -= 1\n return this.findWithUpperBound(prevID)\n }\n\n /**\n * @param {K} from\n */\n findNodeWithLowerBound (from) {\n let o = this.root\n if (o === null) {\n return null\n } else {\n while (true) {\n if (from === null || (from.lessThan(o.val._id) && o.left !== null)) {\n // o is included in the bound\n // try to find an element that is closer to the bound\n o = o.left\n } else if (from !== null && o.val._id.lessThan(from)) {\n // o is not within the bound, maybe one of the right elements is..\n if (o.right !== null) {\n o = o.right\n } else {\n // there is no right element. Search for the next bigger element,\n // this should be within the bounds\n return o.next()\n }\n } else {\n return o\n }\n }\n }\n }\n\n /**\n * @param {K} to\n */\n findNodeWithUpperBound (to) {\n if (to === undefined) {\n throw new Error('You must define from!')\n }\n let o = this.root\n if (o === null) {\n return null\n } else {\n while (true) {\n if ((to === null || o.val._id.lessThan(to)) && o.right !== null) {\n // o is included in the bound\n // try to find an element that is closer to the bound\n o = o.right\n } else if (to !== null && to.lessThan(o.val._id)) {\n // o is not within the bound, maybe one of the left elements is..\n if (o.left !== null) {\n o = o.left\n } else {\n // there is no left element. Search for the prev smaller element,\n // this should be within the bounds\n return o.prev()\n }\n } else {\n return o\n }\n }\n }\n }\n\n /**\n * @return {V}\n */\n findSmallestNode () {\n let o = this.root\n while (o != null && o.left != null) {\n o = o.left\n }\n return o\n }\n\n /**\n * @param {K} from\n * @return {V}\n */\n findWithLowerBound (from) {\n const n = this.findNodeWithLowerBound(from)\n return n == null ? null : n.val\n }\n\n /**\n * @param {K} to\n * @return {V}\n */\n findWithUpperBound (to) {\n const n = this.findNodeWithUpperBound(to)\n return n == null ? null : n.val\n }\n\n /**\n * @param {K} from\n * @param {V} from\n * @param {function(V):void} f\n */\n iterate (from, to, f) {\n let o\n if (from === null) {\n o = this.findSmallestNode()\n } else {\n o = this.findNodeWithLowerBound(from)\n }\n while (\n o !== null &&\n (\n to === null || // eslint-disable-line no-unmodified-loop-condition\n o.val._id.lessThan(to) ||\n o.val._id.equals(to)\n )\n ) {\n f(o.val)\n o = o.next()\n }\n }\n\n /**\n * @param {K} id\n * @return {V|null}\n */\n find (id) {\n const n = this.findNode(id)\n if (n !== null) {\n return n.val\n } else {\n return null\n }\n }\n\n /**\n * @param {K} id\n * @return {N|null}\n */\n findNode (id) {\n let o = this.root\n if (o === null) {\n return null\n } else {\n while (true) {\n if (o === null) {\n return null\n }\n if (id.lessThan(o.val._id)) {\n o = o.left\n } else if (o.val._id.lessThan(id)) {\n o = o.right\n } else {\n return o\n }\n }\n }\n }\n\n /**\n * @param {K} id\n */\n delete (id) {\n let d = this.findNode(id)\n if (d == null) {\n // throw new Error('Element does not exist!')\n return\n }\n this.length--\n if (d.left !== null && d.right !== null) {\n // switch d with the greates element in the left subtree.\n // o should have at most one child.\n let o = d.left\n // find\n while (o.right !== null) {\n o = o.right\n }\n // switch\n d.val = o.val\n d = o\n }\n // d has at most one child\n // let n be the node that replaces d\n let isFakeChild\n let child = d.left || d.right\n if (child === null) {\n isFakeChild = true\n child = new N(null)\n child.blacken()\n d.right = child\n } else {\n isFakeChild = false\n }\n\n if (d.parent === null) {\n if (!isFakeChild) {\n this.root = child\n child.blacken()\n child._parent = null\n } else {\n this.root = null\n }\n return\n } else if (d.parent.left === d) {\n d.parent.left = child\n } else if (d.parent.right === d) {\n d.parent.right = child\n } else {\n throw new Error('Impossible!')\n }\n if (d.isBlack()) {\n if (child.isRed()) {\n child.blacken()\n } else {\n this._fixDelete(child)\n }\n }\n this.root.blacken()\n if (isFakeChild) {\n if (child.parent.left === child) {\n child.parent.left = null\n } else if (child.parent.right === child) {\n child.parent.right = null\n } else {\n throw new Error('Impossible #3')\n }\n }\n }\n\n _fixDelete (n) {\n if (n.parent === null) {\n // this can only be called after the first iteration of fixDelete.\n return\n }\n // d was already replaced by the child\n // d is not the root\n // d and child are black\n let sibling = n.sibling\n if (isRed(sibling)) {\n // make sibling the grandfather\n n.parent.redden()\n sibling.blacken()\n if (n === n.parent.left) {\n n.parent.rotateLeft(this)\n } else if (n === n.parent.right) {\n n.parent.rotateRight(this)\n } else {\n throw new Error('Impossible #2')\n }\n sibling = n.sibling\n }\n // parent, sibling, and children of n are black\n if (n.parent.isBlack() &&\n sibling.isBlack() &&\n isBlack(sibling.left) &&\n isBlack(sibling.right)\n ) {\n sibling.redden()\n this._fixDelete(n.parent)\n } else if (n.parent.isRed() &&\n sibling.isBlack() &&\n isBlack(sibling.left) &&\n isBlack(sibling.right)\n ) {\n sibling.redden()\n n.parent.blacken()\n } else {\n if (n === n.parent.left &&\n sibling.isBlack() &&\n isRed(sibling.left) &&\n isBlack(sibling.right)\n ) {\n sibling.redden()\n sibling.left.blacken()\n sibling.rotateRight(this)\n sibling = n.sibling\n } else if (n === n.parent.right &&\n sibling.isBlack() &&\n isRed(sibling.right) &&\n isBlack(sibling.left)\n ) {\n sibling.redden()\n sibling.right.blacken()\n sibling.rotateLeft(this)\n sibling = n.sibling\n }\n sibling.color = n.parent.color\n n.parent.blacken()\n if (n === n.parent.left) {\n sibling.right.blacken()\n n.parent.rotateLeft(this)\n } else {\n sibling.left.blacken()\n n.parent.rotateRight(this)\n }\n }\n }\n\n put (v) {\n const node = new N(v)\n if (this.root !== null) {\n let p = this.root // p abbrev. parent\n while (true) {\n if (node.val._id.lessThan(p.val._id)) {\n if (p.left === null) {\n p.left = node\n break\n } else {\n p = p.left\n }\n } else if (p.val._id.lessThan(node.val._id)) {\n if (p.right === null) {\n p.right = node\n break\n } else {\n p = p.right\n }\n } else {\n p.val = node.val\n return p\n }\n }\n this._fixInsert(node)\n } else {\n this.root = node\n }\n this.length++\n this.root.blacken()\n return node\n }\n\n _fixInsert (n) {\n if (n.parent === null) {\n n.blacken()\n return\n } else if (n.parent.isBlack()) {\n return\n }\n const uncle = n.getUncle()\n if (uncle !== null && uncle.isRed()) {\n // Note: parent: red, uncle: red\n n.parent.blacken()\n uncle.blacken()\n n.grandparent.redden()\n this._fixInsert(n.grandparent)\n } else {\n // Note: parent: red, uncle: black or null\n // Now we transform the tree in such a way that\n // either of these holds:\n // 1) grandparent.left.isRed\n // and grandparent.left.left.isRed\n // 2) grandparent.right.isRed\n // and grandparent.right.right.isRed\n if (n === n.parent.right && n.parent === n.grandparent.left) {\n n.parent.rotateLeft(this)\n // Since we rotated and want to use the previous\n // cases, we need to set n in such a way that\n // n.parent.isRed again\n n = n.left\n } else if (n === n.parent.left && n.parent === n.grandparent.right) {\n n.parent.rotateRight(this)\n // see above\n n = n.right\n }\n // Case 1) or 2) hold from here on.\n // Now traverse grandparent, make parent a black node\n // on the highest level which holds two red nodes.\n n.parent.blacken()\n n.grandparent.redden()\n if (n === n.parent.left) {\n // Case 1\n n.grandparent.rotateRight(this)\n } else {\n // Case 2\n n.grandparent.rotateLeft(this)\n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WAAW,CAAC,IAAI,EAAE;AACnE,QAAQ,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,EAAC;AACjC;AACA;AACA;AACA,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAI;AAClB,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,WAAW,CAAC,KAAK,EAAE;AAC1E,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAC;AAClC;AACA,QAAQ,CAAC,GAAG,CAAC,CAAC,MAAK;AACnB,OAAO;AACP;AACA;AACA;AACA,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,GAAE;AACxB,MAAM,CAAC,CAAC,WAAW,CAAC,MAAM,GAAE;AAC5B,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE;AAC/B;AACA,QAAQ,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,EAAC;AACvC,OAAO,MAAM;AACb;AACA,QAAQ,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,EAAC;AACtC,OAAO;AACP,KAAK;AACL,GAAG;AACH;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/tree.cjs b/yjs-poll/node_modules/lib0/dist/tree.cjs deleted file mode 100644 index 5483f42..0000000 --- a/yjs-poll/node_modules/lib0/dist/tree.cjs +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var tree = require('./tree-9f3c8837.cjs'); - - - -exports.Tree = tree.Tree; -//# sourceMappingURL=tree.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/tree.cjs.map b/yjs-poll/node_modules/lib0/dist/tree.cjs.map deleted file mode 100644 index d423c90..0000000 --- a/yjs-poll/node_modules/lib0/dist/tree.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tree.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/tree.d.ts b/yjs-poll/node_modules/lib0/dist/tree.d.ts deleted file mode 100644 index 915e4ec..0000000 --- a/yjs-poll/node_modules/lib0/dist/tree.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -/** - * This is a Red Black Tree implementation - * - * @template K,V - */ -export class Tree { - root: any; - length: number; - /** - * @param {K} id - */ - findNext(id: K): V; - /** - * @param {K} id - */ - findPrev(id: K): V; - /** - * @param {K} from - */ - findNodeWithLowerBound(from: K): any; - /** - * @param {K} to - */ - findNodeWithUpperBound(to: K): any; - /** - * @return {V} - */ - findSmallestNode(): V; - /** - * @param {K} from - * @return {V} - */ - findWithLowerBound(from: K): V; - /** - * @param {K} to - * @return {V} - */ - findWithUpperBound(to: K): V; - /** - * @param {K} from - * @param {V} from - * @param {function(V):void} f - */ - iterate(from: K, to: any, f: (arg0: V) => void): void; - /** - * @param {K} id - * @return {V|null} - */ - find(id: K): V | null; - /** - * @param {K} id - * @return {N|null} - */ - findNode(id: K): N | null; - /** - * @param {K} id - */ - delete(id: K): void; - _fixDelete(n: any): void; - put(v: any): any; - _fixInsert(n: any): void; -} -/** - * @template V - */ -declare class N { - /** - * A created node is always red! - * - * @param {V} val - */ - constructor(val: V); - val: V; - color: boolean; - _left: any; - _right: any; - _parent: any; - isRed(): boolean; - isBlack(): boolean; - redden(): this; - blacken(): this; - get grandparent(): any; - get parent(): any; - get sibling(): any; - set left(n: any); - get left(): any; - set right(n: any); - get right(): any; - rotateLeft(tree: any): void; - next(): any; - prev(): any; - rotateRight(tree: any): void; - getUncle(): any; -} -export {}; -//# sourceMappingURL=tree.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/tree.d.ts.map b/yjs-poll/node_modules/lib0/dist/tree.d.ts.map deleted file mode 100644 index 4cbe114..0000000 --- a/yjs-poll/node_modules/lib0/dist/tree.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../tree.js"],"names":[],"mappings":"AAiJA;;;;GAIG;AACH,kBAFa,CAAC,EAAC,CAAC;IAIZ,UAAgB;IAChB,eAAe;IAGjB;;OAEG;IACH,aAFW,CAAC,KAMX;IAED;;OAEG;IACH,aAFW,CAAC,KAMX;IAED;;OAEG;IACH,6BAFW,CAAC,OA0BX;IAED;;OAEG;IACH,2BAFW,CAAC,OA6BX;IAED;;OAEG;IACH,oBAFY,CAAC,CAQZ;IAED;;;OAGG;IACH,yBAHW,CAAC,GACA,CAAC,CAKZ;IAED;;;OAGG;IACH,uBAHW,CAAC,GACA,CAAC,CAKZ;IAED;;;;OAIG;IACH,cAJW,CAAC,cAED,CAAS,IAAC,EAAD,CAAC,KAAE,IAAI,QAoB1B;IAED;;;OAGG;IACH,SAHW,CAAC,GACA,CAAC,GAAC,IAAI,CASjB;IAED;;;OAGG;IACH,aAHW,CAAC,GACA,CAAC,CAAC,CAAC,CAAC,GAAC,IAAI,CAoBpB;IAED;;OAEG;IACH,WAFW,CAAC,QAmEX;IAED,yBAmEC;IAED,iBA+BC;IAED,yBA8CC;CACF;AA7gBD;;GAEG;AACH,gBAFa,CAAC;IAGZ;;;;OAIG;IACH,iBAFW,CAAC,EAQX;IALC,OAAc;IACd,eAAiB;IACjB,WAAiB;IACjB,YAAkB;IAClB,aAAmB;IAGrB,iBAA8B;IAC9B,mBAAiC;IACjC,eAA4C;IAC5C,gBAA8C;IAC9C,uBAEC;IAED,kBAEC;IAED,mBAIC;IAUD,iBAKC;IAbD,gBAEC;IAaD,kBAKC;IAhBD,iBAEC;IAgBD,4BAOC;IAED,YAeC;IAED,YAeC;IAED,6BAOC;IAED,gBAOC;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/tree.test.d.ts b/yjs-poll/node_modules/lib0/dist/tree.test.d.ts deleted file mode 100644 index 54a03d2..0000000 --- a/yjs-poll/node_modules/lib0/dist/tree.test.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=tree.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/tree.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/tree.test.d.ts.map deleted file mode 100644 index 193aa86..0000000 --- a/yjs-poll/node_modules/lib0/dist/tree.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tree.test.d.ts","sourceRoot":"","sources":["../tree.test.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/url.cjs b/yjs-poll/node_modules/lib0/dist/url.cjs deleted file mode 100644 index 1c3eb97..0000000 --- a/yjs-poll/node_modules/lib0/dist/url.cjs +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var object = require('./object-c0c9435b.cjs'); -require('./equality.cjs'); - -/** - * Utility module to work with urls. - * - * @module url - */ - -/** - * Parse query parameters from an url. - * - * @param {string} url - * @return {Object} - */ -const decodeQueryParams = url => { - /** - * @type {Object} - */ - const query = {}; - const urlQuerySplit = url.split('?'); - const pairs = urlQuerySplit[urlQuerySplit.length - 1].split('&'); - for (let i = 0; i < pairs.length; i++) { - const item = pairs[i]; - if (item.length > 0) { - const pair = item.split('='); - query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || ''); - } - } - return query -}; - -/** - * @param {Object} params - * @return {string} - */ -const encodeQueryParams = params => - object.map(params, (val, key) => `${encodeURIComponent(key)}=${encodeURIComponent(val)}`).join('&'); - -exports.decodeQueryParams = decodeQueryParams; -exports.encodeQueryParams = encodeQueryParams; -//# sourceMappingURL=url.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/url.cjs.map b/yjs-poll/node_modules/lib0/dist/url.cjs.map deleted file mode 100644 index 49fa2ca..0000000 --- a/yjs-poll/node_modules/lib0/dist/url.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"url.cjs","sources":["../url.js"],"sourcesContent":["/**\n * Utility module to work with urls.\n *\n * @module url\n */\n\nimport * as object from './object.js'\n\n/**\n * Parse query parameters from an url.\n *\n * @param {string} url\n * @return {Object}\n */\nexport const decodeQueryParams = url => {\n /**\n * @type {Object}\n */\n const query = {}\n const urlQuerySplit = url.split('?')\n const pairs = urlQuerySplit[urlQuerySplit.length - 1].split('&')\n for (let i = 0; i < pairs.length; i++) {\n const item = pairs[i]\n if (item.length > 0) {\n const pair = item.split('=')\n query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || '')\n }\n }\n return query\n}\n\n/**\n * @param {Object} params\n * @return {string}\n */\nexport const encodeQueryParams = params =>\n object.map(params, (val, key) => `${encodeURIComponent(key)}=${encodeURIComponent(val)}`).join('&')\n"],"names":["object.map"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,iBAAiB,GAAG,GAAG,IAAI;AACxC;AACA;AACA;AACA,EAAE,MAAM,KAAK,GAAG,GAAE;AAClB,EAAE,MAAM,aAAa,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,EAAC;AACtC,EAAE,MAAM,KAAK,GAAG,aAAa,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAC;AAClE,EAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACzC,IAAI,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,EAAC;AACzB,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;AACzB,MAAM,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAC;AAClC,MAAM,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,EAAC;AAC5E,KAAK;AACL,GAAG;AACH,EAAE,OAAO,KAAK;AACd,EAAC;AACD;AACA;AACA;AACA;AACA;AACY,MAAC,iBAAiB,GAAG,MAAM;AACvC,EAAEA,UAAU,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/url.d.ts b/yjs-poll/node_modules/lib0/dist/url.d.ts deleted file mode 100644 index ed2895c..0000000 --- a/yjs-poll/node_modules/lib0/dist/url.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function decodeQueryParams(url: string): { - [x: string]: string; -}; -export function encodeQueryParams(params: { - [x: string]: string; -}): string; -//# sourceMappingURL=url.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/url.d.ts.map b/yjs-poll/node_modules/lib0/dist/url.d.ts.map deleted file mode 100644 index 99fc3f6..0000000 --- a/yjs-poll/node_modules/lib0/dist/url.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../url.js"],"names":[],"mappings":"AAcO,uCAHI,MAAM;;EAkBhB;AAMM;;IAFK,MAAM,CAGmF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/url.test.d.ts b/yjs-poll/node_modules/lib0/dist/url.test.d.ts deleted file mode 100644 index 027c9ee..0000000 --- a/yjs-poll/node_modules/lib0/dist/url.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testUrlParamQuery(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=url.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/url.test.d.ts.map b/yjs-poll/node_modules/lib0/dist/url.test.d.ts.map deleted file mode 100644 index 6e4b709..0000000 --- a/yjs-poll/node_modules/lib0/dist/url.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"url.test.d.ts","sourceRoot":"","sources":["../url.test.js"],"names":[],"mappings":"AAcO,sCAFI,CAAC,CAAC,QAAQ,QAapB;mBAzBkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/webcrypto.cjs b/yjs-poll/node_modules/lib0/dist/webcrypto.cjs deleted file mode 100644 index ddbfc29..0000000 --- a/yjs-poll/node_modules/lib0/dist/webcrypto.cjs +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -/* eslint-env browser */ - -const subtle = crypto.subtle; -const getRandomValues = crypto.getRandomValues.bind(crypto); - -exports.getRandomValues = getRandomValues; -exports.subtle = subtle; -//# sourceMappingURL=webcrypto.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/webcrypto.cjs.map b/yjs-poll/node_modules/lib0/dist/webcrypto.cjs.map deleted file mode 100644 index 44e2018..0000000 --- a/yjs-poll/node_modules/lib0/dist/webcrypto.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"webcrypto.cjs","sources":["../webcrypto.js"],"sourcesContent":["/* eslint-env browser */\n\nexport const subtle = crypto.subtle\nexport const getRandomValues = crypto.getRandomValues.bind(crypto)\n"],"names":[],"mappings":";;;;AAAA;AACA;AACY,MAAC,MAAM,GAAG,MAAM,CAAC,OAAM;AACvB,MAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/webcrypto.d.ts b/yjs-poll/node_modules/lib0/dist/webcrypto.d.ts deleted file mode 100644 index d9e514e..0000000 --- a/yjs-poll/node_modules/lib0/dist/webcrypto.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const subtle: SubtleCrypto; -export const getRandomValues: (array: T) => T; -//# sourceMappingURL=webcrypto.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/webcrypto.d.ts.map b/yjs-poll/node_modules/lib0/dist/webcrypto.d.ts.map deleted file mode 100644 index 4c49c57..0000000 --- a/yjs-poll/node_modules/lib0/dist/webcrypto.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"webcrypto.d.ts","sourceRoot":"","sources":["../webcrypto.js"],"names":[],"mappings":"AAEA,kCAAmC;AACnC,yEAAkE"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/webcrypto.deno.cjs b/yjs-poll/node_modules/lib0/dist/webcrypto.deno.cjs deleted file mode 100644 index 5934e4c..0000000 --- a/yjs-poll/node_modules/lib0/dist/webcrypto.deno.cjs +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -// eslint-disable-next-line -const subtle = /** @type {any} */ (crypto).subtle; -// eslint-disable-next-line -const getRandomValues = /** @type {any} */ (crypto).getRandomValues.bind(crypto); - -exports.getRandomValues = getRandomValues; -exports.subtle = subtle; -//# sourceMappingURL=webcrypto.deno.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/webcrypto.deno.cjs.map b/yjs-poll/node_modules/lib0/dist/webcrypto.deno.cjs.map deleted file mode 100644 index 443ac80..0000000 --- a/yjs-poll/node_modules/lib0/dist/webcrypto.deno.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"webcrypto.deno.cjs","sources":["../webcrypto.deno.js"],"sourcesContent":["// eslint-disable-next-line\nexport const subtle = /** @type {any} */ (crypto).subtle\n// eslint-disable-next-line\nexport const getRandomValues = /** @type {any} */ (crypto).getRandomValues.bind(crypto)\n"],"names":[],"mappings":";;;;AAAA;AACY,MAAC,MAAM,sBAAsB,CAAC,MAAM,EAAE,OAAM;AACxD;AACY,MAAC,eAAe,sBAAsB,CAAC,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,MAAM;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/webcrypto.deno.d.ts b/yjs-poll/node_modules/lib0/dist/webcrypto.deno.d.ts deleted file mode 100644 index ec6b5e5..0000000 --- a/yjs-poll/node_modules/lib0/dist/webcrypto.deno.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const subtle: any; -export const getRandomValues: any; -//# sourceMappingURL=webcrypto.deno.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/webcrypto.deno.d.ts.map b/yjs-poll/node_modules/lib0/dist/webcrypto.deno.d.ts.map deleted file mode 100644 index 264be7f..0000000 --- a/yjs-poll/node_modules/lib0/dist/webcrypto.deno.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"webcrypto.deno.d.ts","sourceRoot":"","sources":["../webcrypto.deno.js"],"names":[],"mappings":"AACA,yBAAwD;AAExD,kCAAuF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/webcrypto.node.cjs b/yjs-poll/node_modules/lib0/dist/webcrypto.node.cjs deleted file mode 100644 index 378e7f5..0000000 --- a/yjs-poll/node_modules/lib0/dist/webcrypto.node.cjs +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var node_crypto = require('node:crypto'); - -const subtle = /** @type {any} */ (node_crypto.webcrypto).subtle; -const getRandomValues = /** @type {any} */ (node_crypto.webcrypto).getRandomValues.bind(node_crypto.webcrypto); - -exports.getRandomValues = getRandomValues; -exports.subtle = subtle; -//# sourceMappingURL=webcrypto.node.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/webcrypto.node.cjs.map b/yjs-poll/node_modules/lib0/dist/webcrypto.node.cjs.map deleted file mode 100644 index 558afb3..0000000 --- a/yjs-poll/node_modules/lib0/dist/webcrypto.node.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"webcrypto.node.cjs","sources":["../webcrypto.node.js"],"sourcesContent":["import { webcrypto } from 'node:crypto'\n\nexport const subtle = /** @type {any} */ (webcrypto).subtle\nexport const getRandomValues = /** @type {any} */ (webcrypto).getRandomValues.bind(webcrypto)\n"],"names":["webcrypto"],"mappings":";;;;;;AAEY,MAAC,MAAM,sBAAsB,CAACA,qBAAS,EAAE,OAAM;AAC/C,MAAC,eAAe,sBAAsB,CAACA,qBAAS,EAAE,eAAe,CAAC,IAAI,CAACA,qBAAS;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/webcrypto.node.d.ts b/yjs-poll/node_modules/lib0/dist/webcrypto.node.d.ts deleted file mode 100644 index 0026211..0000000 --- a/yjs-poll/node_modules/lib0/dist/webcrypto.node.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const subtle: any; -export const getRandomValues: any; -//# sourceMappingURL=webcrypto.node.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/webcrypto.node.d.ts.map b/yjs-poll/node_modules/lib0/dist/webcrypto.node.d.ts.map deleted file mode 100644 index 847c2b9..0000000 --- a/yjs-poll/node_modules/lib0/dist/webcrypto.node.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"webcrypto.node.d.ts","sourceRoot":"","sources":["../webcrypto.node.js"],"names":[],"mappings":"AAEA,yBAA2D;AAC3D,kCAA6F"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/webcrypto.react-native.cjs b/yjs-poll/node_modules/lib0/dist/webcrypto.react-native.cjs deleted file mode 100644 index 4e6d3c4..0000000 --- a/yjs-poll/node_modules/lib0/dist/webcrypto.react-native.cjs +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var webcrypto = require('isomorphic-webcrypto/src/react-native'); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var webcrypto__default = /*#__PURE__*/_interopDefaultLegacy(webcrypto); - -// @ts-ignore - -webcrypto__default["default"].ensureSecure(); - -const subtle = webcrypto__default["default"].subtle; -const getRandomValues = webcrypto__default["default"].getRandomValues.bind(webcrypto__default["default"]); - -exports.getRandomValues = getRandomValues; -exports.subtle = subtle; -//# sourceMappingURL=webcrypto.react-native.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/webcrypto.react-native.cjs.map b/yjs-poll/node_modules/lib0/dist/webcrypto.react-native.cjs.map deleted file mode 100644 index 47d68bd..0000000 --- a/yjs-poll/node_modules/lib0/dist/webcrypto.react-native.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"webcrypto.react-native.cjs","sources":["../webcrypto.react-native.js"],"sourcesContent":["// @ts-ignore\nimport webcrypto from 'isomorphic-webcrypto/src/react-native'\n\nwebcrypto.ensureSecure()\n\nexport const subtle = webcrypto.subtle\nexport const getRandomValues = webcrypto.getRandomValues.bind(webcrypto)\n"],"names":["webcrypto"],"mappings":";;;;;;;;;;AAAA;AAEA;AACAA,6BAAS,CAAC,YAAY,GAAE;AACxB;AACY,MAAC,MAAM,GAAGA,6BAAS,CAAC,OAAM;AAC1B,MAAC,eAAe,GAAGA,6BAAS,CAAC,eAAe,CAAC,IAAI,CAACA,6BAAS;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/webcrypto.react-native.d.ts b/yjs-poll/node_modules/lib0/dist/webcrypto.react-native.d.ts deleted file mode 100644 index 59dad39..0000000 --- a/yjs-poll/node_modules/lib0/dist/webcrypto.react-native.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const subtle: any; -export const getRandomValues: any; -//# sourceMappingURL=webcrypto.react-native.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/webcrypto.react-native.d.ts.map b/yjs-poll/node_modules/lib0/dist/webcrypto.react-native.d.ts.map deleted file mode 100644 index e09a19e..0000000 --- a/yjs-poll/node_modules/lib0/dist/webcrypto.react-native.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"webcrypto.react-native.d.ts","sourceRoot":"","sources":["../webcrypto.react-native.js"],"names":[],"mappings":"AAKA,yBAAsC;AACtC,kCAAwE"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/websocket-b073d0fc.cjs b/yjs-poll/node_modules/lib0/dist/websocket-b073d0fc.cjs deleted file mode 100644 index 04686db..0000000 --- a/yjs-poll/node_modules/lib0/dist/websocket-b073d0fc.cjs +++ /dev/null @@ -1,157 +0,0 @@ -'use strict'; - -var observable = require('./observable.cjs'); -var time = require('./time-d8438852.cjs'); -var math = require('./math-96d5e8c4.cjs'); - -/* eslint-env browser */ - -const reconnectTimeoutBase = 1200; -const maxReconnectTimeout = 2500; -// @todo - this should depend on awareness.outdatedTime -const messageReconnectTimeout = 30000; - -/** - * @param {WebsocketClient} wsclient - */ -const setupWS = (wsclient) => { - if (wsclient.shouldConnect && wsclient.ws === null) { - const websocket = new WebSocket(wsclient.url); - const binaryType = wsclient.binaryType; - /** - * @type {any} - */ - let pingTimeout = null; - if (binaryType) { - websocket.binaryType = binaryType; - } - wsclient.ws = websocket; - wsclient.connecting = true; - wsclient.connected = false; - websocket.onmessage = event => { - wsclient.lastMessageReceived = time.getUnixTime(); - const data = event.data; - const message = typeof data === 'string' ? JSON.parse(data) : data; - if (message && message.type === 'pong') { - clearTimeout(pingTimeout); - pingTimeout = setTimeout(sendPing, messageReconnectTimeout / 2); - } - wsclient.emit('message', [message, wsclient]); - }; - /** - * @param {any} error - */ - const onclose = error => { - if (wsclient.ws !== null) { - wsclient.ws = null; - wsclient.connecting = false; - if (wsclient.connected) { - wsclient.connected = false; - wsclient.emit('disconnect', [{ type: 'disconnect', error }, wsclient]); - } else { - wsclient.unsuccessfulReconnects++; - } - // Start with no reconnect timeout and increase timeout by - // log10(wsUnsuccessfulReconnects). - // The idea is to increase reconnect timeout slowly and have no reconnect - // timeout at the beginning (log(1) = 0) - setTimeout(setupWS, math.min(math.log10(wsclient.unsuccessfulReconnects + 1) * reconnectTimeoutBase, maxReconnectTimeout), wsclient); - } - clearTimeout(pingTimeout); - }; - const sendPing = () => { - if (wsclient.ws === websocket) { - wsclient.send({ - type: 'ping' - }); - } - }; - websocket.onclose = () => onclose(null); - websocket.onerror = error => onclose(error); - websocket.onopen = () => { - wsclient.lastMessageReceived = time.getUnixTime(); - wsclient.connecting = false; - wsclient.connected = true; - wsclient.unsuccessfulReconnects = 0; - wsclient.emit('connect', [{ type: 'connect' }, wsclient]); - // set ping - pingTimeout = setTimeout(sendPing, messageReconnectTimeout / 2); - }; - } -}; - -/** - * @deprecated - * @extends Observable - */ -class WebsocketClient extends observable.Observable { - /** - * @param {string} url - * @param {object} opts - * @param {'arraybuffer' | 'blob' | null} [opts.binaryType] Set `ws.binaryType` - */ - constructor (url, { binaryType } = {}) { - super(); - this.url = url; - /** - * @type {WebSocket?} - */ - this.ws = null; - this.binaryType = binaryType || null; - this.connected = false; - this.connecting = false; - this.unsuccessfulReconnects = 0; - this.lastMessageReceived = 0; - /** - * Whether to connect to other peers or not - * @type {boolean} - */ - this.shouldConnect = true; - this._checkInterval = setInterval(() => { - if (this.connected && messageReconnectTimeout < time.getUnixTime() - this.lastMessageReceived) { - // no message received in a long time - not even your own awareness - // updates (which are updated every 15 seconds) - /** @type {WebSocket} */ (this.ws).close(); - } - }, messageReconnectTimeout / 2); - setupWS(this); - } - - /** - * @param {any} message - */ - send (message) { - if (this.ws) { - this.ws.send(JSON.stringify(message)); - } - } - - destroy () { - clearInterval(this._checkInterval); - this.disconnect(); - super.destroy(); - } - - disconnect () { - this.shouldConnect = false; - if (this.ws !== null) { - this.ws.close(); - } - } - - connect () { - this.shouldConnect = true; - if (!this.connected && this.ws === null) { - setupWS(this); - } - } -} - -var websocket = /*#__PURE__*/Object.freeze({ - __proto__: null, - WebsocketClient: WebsocketClient -}); - -exports.WebsocketClient = WebsocketClient; -exports.websocket = websocket; -//# sourceMappingURL=websocket-b073d0fc.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/websocket-b073d0fc.cjs.map b/yjs-poll/node_modules/lib0/dist/websocket-b073d0fc.cjs.map deleted file mode 100644 index baec2bc..0000000 --- a/yjs-poll/node_modules/lib0/dist/websocket-b073d0fc.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"websocket-b073d0fc.cjs","sources":["../websocket.js"],"sourcesContent":["/* eslint-env browser */\n\n/**\n * Tiny websocket connection handler.\n *\n * Implements exponential backoff reconnects, ping/pong, and a nice event system using [lib0/observable].\n *\n * @module websocket\n */\n\nimport { Observable } from './observable.js'\nimport * as time from './time.js'\nimport * as math from './math.js'\n\nconst reconnectTimeoutBase = 1200\nconst maxReconnectTimeout = 2500\n// @todo - this should depend on awareness.outdatedTime\nconst messageReconnectTimeout = 30000\n\n/**\n * @param {WebsocketClient} wsclient\n */\nconst setupWS = (wsclient) => {\n if (wsclient.shouldConnect && wsclient.ws === null) {\n const websocket = new WebSocket(wsclient.url)\n const binaryType = wsclient.binaryType\n /**\n * @type {any}\n */\n let pingTimeout = null\n if (binaryType) {\n websocket.binaryType = binaryType\n }\n wsclient.ws = websocket\n wsclient.connecting = true\n wsclient.connected = false\n websocket.onmessage = event => {\n wsclient.lastMessageReceived = time.getUnixTime()\n const data = event.data\n const message = typeof data === 'string' ? JSON.parse(data) : data\n if (message && message.type === 'pong') {\n clearTimeout(pingTimeout)\n pingTimeout = setTimeout(sendPing, messageReconnectTimeout / 2)\n }\n wsclient.emit('message', [message, wsclient])\n }\n /**\n * @param {any} error\n */\n const onclose = error => {\n if (wsclient.ws !== null) {\n wsclient.ws = null\n wsclient.connecting = false\n if (wsclient.connected) {\n wsclient.connected = false\n wsclient.emit('disconnect', [{ type: 'disconnect', error }, wsclient])\n } else {\n wsclient.unsuccessfulReconnects++\n }\n // Start with no reconnect timeout and increase timeout by\n // log10(wsUnsuccessfulReconnects).\n // The idea is to increase reconnect timeout slowly and have no reconnect\n // timeout at the beginning (log(1) = 0)\n setTimeout(setupWS, math.min(math.log10(wsclient.unsuccessfulReconnects + 1) * reconnectTimeoutBase, maxReconnectTimeout), wsclient)\n }\n clearTimeout(pingTimeout)\n }\n const sendPing = () => {\n if (wsclient.ws === websocket) {\n wsclient.send({\n type: 'ping'\n })\n }\n }\n websocket.onclose = () => onclose(null)\n websocket.onerror = error => onclose(error)\n websocket.onopen = () => {\n wsclient.lastMessageReceived = time.getUnixTime()\n wsclient.connecting = false\n wsclient.connected = true\n wsclient.unsuccessfulReconnects = 0\n wsclient.emit('connect', [{ type: 'connect' }, wsclient])\n // set ping\n pingTimeout = setTimeout(sendPing, messageReconnectTimeout / 2)\n }\n }\n}\n\n/**\n * @deprecated\n * @extends Observable\n */\nexport class WebsocketClient extends Observable {\n /**\n * @param {string} url\n * @param {object} opts\n * @param {'arraybuffer' | 'blob' | null} [opts.binaryType] Set `ws.binaryType`\n */\n constructor (url, { binaryType } = {}) {\n super()\n this.url = url\n /**\n * @type {WebSocket?}\n */\n this.ws = null\n this.binaryType = binaryType || null\n this.connected = false\n this.connecting = false\n this.unsuccessfulReconnects = 0\n this.lastMessageReceived = 0\n /**\n * Whether to connect to other peers or not\n * @type {boolean}\n */\n this.shouldConnect = true\n this._checkInterval = setInterval(() => {\n if (this.connected && messageReconnectTimeout < time.getUnixTime() - this.lastMessageReceived) {\n // no message received in a long time - not even your own awareness\n // updates (which are updated every 15 seconds)\n /** @type {WebSocket} */ (this.ws).close()\n }\n }, messageReconnectTimeout / 2)\n setupWS(this)\n }\n\n /**\n * @param {any} message\n */\n send (message) {\n if (this.ws) {\n this.ws.send(JSON.stringify(message))\n }\n }\n\n destroy () {\n clearInterval(this._checkInterval)\n this.disconnect()\n super.destroy()\n }\n\n disconnect () {\n this.shouldConnect = false\n if (this.ws !== null) {\n this.ws.close()\n }\n }\n\n connect () {\n this.shouldConnect = true\n if (!this.connected && this.ws === null) {\n setupWS(this)\n }\n }\n}\n"],"names":["time.getUnixTime","math.min","math.log10","Observable"],"mappings":";;;;;;AAAA;AAaA;AACA,MAAM,oBAAoB,GAAG,KAAI;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M,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAC;AAC3C,KAAK;AACL,GAAG;AACH;AACA,EAAE,OAAO,CAAC,GAAG;AACb,IAAI,aAAa,CAAC,IAAI,CAAC,cAAc,EAAC;AACtC,IAAI,IAAI,CAAC,UAAU,GAAE;AACrB,IAAI,KAAK,CAAC,OAAO,GAAE;AACnB,GAAG;AACH;AACA,EAAE,UAAU,CAAC,GAAG;AAChB,IAAI,IAAI,CAAC,aAAa,GAAG,MAAK;AAC9B,IAAI,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,EAAE;AAC1B,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,GAAE;AACrB,KAAK;AACL,GAAG;AACH;AACA,EAAE,OAAO,CAAC,GAAG;AACb,IAAI,IAAI,CAAC,aAAa,GAAG,KAAI;AAC7B,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,EAAE;AAC7C,MAAM,OAAO,CAAC,IAAI,EAAC;AACnB,KAAK;AACL,GAAG;AACH;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/websocket.cjs b/yjs-poll/node_modules/lib0/dist/websocket.cjs deleted file mode 100644 index ad8c2ac..0000000 --- a/yjs-poll/node_modules/lib0/dist/websocket.cjs +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -require('./observable.cjs'); -require('./time-d8438852.cjs'); -require('./math-96d5e8c4.cjs'); -var websocket = require('./websocket-b073d0fc.cjs'); -require('./map-24d263c0.cjs'); -require('./set-5b47859e.cjs'); -require('./array-78849c95.cjs'); -require('./metric.cjs'); - - - -exports.WebsocketClient = websocket.WebsocketClient; -//# sourceMappingURL=websocket.cjs.map diff --git a/yjs-poll/node_modules/lib0/dist/websocket.cjs.map b/yjs-poll/node_modules/lib0/dist/websocket.cjs.map deleted file mode 100644 index e970065..0000000 --- a/yjs-poll/node_modules/lib0/dist/websocket.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"websocket.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/websocket.d.ts b/yjs-poll/node_modules/lib0/dist/websocket.d.ts deleted file mode 100644 index 7adeac1..0000000 --- a/yjs-poll/node_modules/lib0/dist/websocket.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @deprecated - * @extends Observable - */ -export class WebsocketClient extends Observable { - /** - * @param {string} url - * @param {object} opts - * @param {'arraybuffer' | 'blob' | null} [opts.binaryType] Set `ws.binaryType` - */ - constructor(url: string, { binaryType }?: { - binaryType?: "arraybuffer" | "blob" | null | undefined; - }); - url: string; - /** - * @type {WebSocket?} - */ - ws: WebSocket | null; - binaryType: "arraybuffer" | "blob" | null; - connected: boolean; - connecting: boolean; - unsuccessfulReconnects: number; - lastMessageReceived: number; - /** - * Whether to connect to other peers or not - * @type {boolean} - */ - shouldConnect: boolean; - _checkInterval: NodeJS.Timeout; - /** - * @param {any} message - */ - send(message: any): void; - disconnect(): void; - connect(): void; -} -import { Observable } from './observable.js'; -//# sourceMappingURL=websocket.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dist/websocket.d.ts.map b/yjs-poll/node_modules/lib0/dist/websocket.d.ts.map deleted file mode 100644 index ec5d8de..0000000 --- a/yjs-poll/node_modules/lib0/dist/websocket.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["../websocket.js"],"names":[],"mappings":"AAwFA;;;GAGG;AACH;IACE;;;;OAIG;IACH,iBAJW,MAAM,mBAEd;QAA6C,UAAU;KACzD,EA0BA;IAvBC,YAAc;IACd;;OAEG;IACH,IAFU,SAAS,OAAC,CAEN;IACd,0CAAoC;IACpC,mBAAsB;IACtB,oBAAuB;IACvB,+BAA+B;IAC/B,4BAA4B;IAC5B;;;OAGG;IACH,eAFU,OAAO,CAEQ;IACzB,+BAM+B;IAIjC;;OAEG;IACH,cAFW,GAAG,QAMb;IAQD,mBAKC;IAED,gBAKC;CACF;2BA/I0B,iBAAiB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dom.d.ts b/yjs-poll/node_modules/lib0/dom.d.ts deleted file mode 100644 index e71a664..0000000 --- a/yjs-poll/node_modules/lib0/dom.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @type {Document} - */ -export const doc: Document; -export function createElement(name: string): HTMLElement; -export function createDocumentFragment(): DocumentFragment; -/** - * @type {$.Schema} - */ -export const $fragment: $.Schema; -export function createTextNode(text: string): Text; -export const domParser: DOMParser; -export function emitCustomEvent(el: HTMLElement, name: string, opts: Object): boolean; -export function setAttributes(el: Element, attrs: Array>): Element; -export function setAttributesMap(el: Element, attrs: Map): Element; -export function fragment(children: Array | HTMLCollection): DocumentFragment; -export function append(parent: Element, nodes: Array): Element; -export function remove(el: HTMLElement): void; -export function addEventListener(el: EventTarget, name: string, f: EventListener): void; -export function removeEventListener(el: EventTarget, name: string, f: EventListener): void; -export function addEventListeners(node: Node, listeners: Array>): Node; -export function removeEventListeners(node: Node, listeners: Array>): Node; -export function element(name: string, attrs?: Array | pair.Pair>, children?: Array): Element; -/** - * @type {$.Schema} - */ -export const $element: $.Schema; -export function canvas(width: number, height: number): HTMLCanvasElement; -export function text(text: string): Text; -/** - * @type {$.Schema} - */ -export const $text: $.Schema; -export function pairToStyleString(pair: pair.Pair): string; -export function pairsToStyleString(pairs: Array>): string; -export function mapToStyleString(m: Map): string; -export function querySelector(el: HTMLElement | ShadowRoot, query: string): HTMLElement | null; -export function querySelectorAll(el: HTMLElement | ShadowRoot, query: string): NodeListOf; -export function getElementById(id: string): HTMLElement; -export function parseFragment(html: string): DocumentFragment; -export function parseElement(html: string): HTMLElement; -export function replaceWith(oldEl: HTMLElement, newEl: HTMLElement | DocumentFragment): void; -export function insertBefore(parent: HTMLElement, el: HTMLElement, ref: Node | null): HTMLElement; -export function appendChild(parent: Node, child: Node): Node; -export const ELEMENT_NODE: 1; -export const TEXT_NODE: 3; -export const CDATA_SECTION_NODE: 4; -export const COMMENT_NODE: 8; -export const DOCUMENT_NODE: 9; -export const DOCUMENT_TYPE_NODE: 10; -export const DOCUMENT_FRAGMENT_NODE: 11; -/** - * @type {$.Schema} - */ -export const $node: $.Schema; -export function checkNodeType(node: any, type: number): boolean; -export function isParentOf(parent: Node, child: HTMLElement): boolean; -import * as $ from './schema.js'; -import * as pair from './pair.js'; -//# sourceMappingURL=dom.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dom.d.ts.map b/yjs-poll/node_modules/lib0/dom.d.ts.map deleted file mode 100644 index de9d056..0000000 --- a/yjs-poll/node_modules/lib0/dom.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["dom.js"],"names":[],"mappings":"AAaA;;GAEG;AACH,kBAFU,QAAQ,CAE0E;AAMrF,oCAHI,MAAM,GACL,WAAW,CAEqC;AAKrD,0CAFK,gBAAgB,CAE4C;AAExE;;GAEG;AACH,wBAFU,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAE4C;AAMzE,qCAHI,MAAM,GACL,IAAI,CAE8C;AAE9D,wBAAoC,SAAS,CAAgE;AAOtG,oCAJI,WAAW,QACX,MAAM,QACN,MAAM,WAE+E;AAOzF,kCAJI,OAAO,SACP,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAC,MAAM,GAAC,OAAO,CAAC,CAAC,GACtC,OAAO,CAclB;AAOM,qCAJI,OAAO,SACP,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAClB,OAAO,CAKlB;AAMM,mCAHI,KAAK,CAAC,IAAI,CAAC,GAAC,cAAc,GACzB,gBAAgB,CAQ3B;AAOM,+BAJI,OAAO,SACP,KAAK,CAAC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I,MAAM,GACL,gBAAgB,CAE+D;AAMpF,mCAHI,MAAM,GACL,WAAW,CAEsE;AAMtF,mCAHI,WAAW,SACX,WAAW,GAAC,gBAAgB,QAE8B;AAQ9D,qCALI,WAAW,MACX,WAAW,OACX,IAAI,GAAC,IAAI,GACR,WAAW,CAEsD;AAOtE,oCAJI,IAAI,SACJ,IAAI,GACH,IAAI,CAEuD;AAEvE,6BAA4C;AAC5C,0BAAsC;AACtC,mCAAwD;AACxD,6BAA4C;AAC5C,8BAA8C;AAC9C,oCAAwD;AACxD,wCAAgE;AAEhE;;GAEG;AACH,oBAFU,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAE2C;AAM5D,oCAHI,GAAG,QACH,MAAM,WAEkD;AAM5D,mCAHI,IAAI,SACJ,WAAW,WAQrB;mBAhRkB,aAAa;sBAFV,WAAW"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/dom.js b/yjs-poll/node_modules/lib0/dom.js deleted file mode 100644 index bac14b6..0000000 --- a/yjs-poll/node_modules/lib0/dom.js +++ /dev/null @@ -1,284 +0,0 @@ -/* eslint-env browser */ - -/** - * Utility module to work with the DOM. - * - * @module dom - */ - -import * as pair from './pair.js' -import * as map from './map.js' -import * as $ from './schema.js' - -/* c8 ignore start */ -/** - * @type {Document} - */ -export const doc = /** @type {Document} */ (typeof document !== 'undefined' ? document : {}) - -/** - * @param {string} name - * @return {HTMLElement} - */ -export const createElement = name => doc.createElement(name) - -/** - * @return {DocumentFragment} - */ -export const createDocumentFragment = () => doc.createDocumentFragment() - -/** - * @type {$.Schema} - */ -export const $fragment = $.$custom(el => el.nodeType === DOCUMENT_FRAGMENT_NODE) - -/** - * @param {string} text - * @return {Text} - */ -export const createTextNode = text => doc.createTextNode(text) - -export const domParser = /** @type {DOMParser} */ (typeof DOMParser !== 'undefined' ? new DOMParser() : null) - -/** - * @param {HTMLElement} el - * @param {string} name - * @param {Object} opts - */ -export const emitCustomEvent = (el, name, opts) => el.dispatchEvent(new CustomEvent(name, opts)) - -/** - * @param {Element} el - * @param {Array>} attrs Array of key-value pairs - * @return {Element} - */ -export const setAttributes = (el, attrs) => { - pair.forEach(attrs, (key, value) => { - if (value === false) { - el.removeAttribute(key) - } else if (value === true) { - el.setAttribute(key, '') - } else { - // @ts-ignore - el.setAttribute(key, value) - } - }) - return el -} - -/** - * @param {Element} el - * @param {Map} attrs Array of key-value pairs - * @return {Element} - */ -export const setAttributesMap = (el, attrs) => { - attrs.forEach((value, key) => { el.setAttribute(key, value) }) - return el -} - -/** - * @param {Array|HTMLCollection} children - * @return {DocumentFragment} - */ -export const fragment = children => { - const fragment = createDocumentFragment() - for (let i = 0; i < children.length; i++) { - appendChild(fragment, children[i]) - } - return fragment -} - -/** - * @param {Element} parent - * @param {Array} nodes - * @return {Element} - */ -export const append = (parent, nodes) => { - appendChild(parent, fragment(nodes)) - return parent -} - -/** - * @param {HTMLElement} el - */ -export const remove = el => el.remove() - -/** - * @param {EventTarget} el - * @param {string} name - * @param {EventListener} f - */ -export const addEventListener = (el, name, f) => el.addEventListener(name, f) - -/** - * @param {EventTarget} el - * @param {string} name - * @param {EventListener} f - */ -export const removeEventListener = (el, name, f) => el.removeEventListener(name, f) - -/** - * @param {Node} node - * @param {Array>} listeners - * @return {Node} - */ -export const addEventListeners = (node, listeners) => { - pair.forEach(listeners, (name, f) => addEventListener(node, name, f)) - return node -} - -/** - * @param {Node} node - * @param {Array>} listeners - * @return {Node} - */ -export const removeEventListeners = (node, listeners) => { - pair.forEach(listeners, (name, f) => removeEventListener(node, name, f)) - return node -} - -/** - * @param {string} name - * @param {Array|pair.Pair>} attrs Array of key-value pairs - * @param {Array} children - * @return {Element} - */ -export const element = (name, attrs = [], children = []) => - append(setAttributes(createElement(name), attrs), children) - -/** - * @type {$.Schema} - */ -export const $element = $.$custom(el => el.nodeType === ELEMENT_NODE) - -/** - * @param {number} width - * @param {number} height - */ -export const canvas = (width, height) => { - const c = /** @type {HTMLCanvasElement} */ (createElement('canvas')) - c.height = height - c.width = width - return c -} - -/** - * @param {string} t - * @return {Text} - */ -export const text = createTextNode - -/** - * @type {$.Schema} - */ -export const $text = $.$custom(el => el.nodeType === TEXT_NODE) - -/** - * @param {pair.Pair} pair - */ -export const pairToStyleString = pair => `${pair.left}:${pair.right};` - -/** - * @param {Array>} pairs - * @return {string} - */ -export const pairsToStyleString = pairs => pairs.map(pairToStyleString).join('') - -/** - * @param {Map} m - * @return {string} - */ -export const mapToStyleString = m => map.map(m, (value, key) => `${key}:${value};`).join('') - -/** - * @todo should always query on a dom element - * - * @param {HTMLElement|ShadowRoot} el - * @param {string} query - * @return {HTMLElement | null} - */ -export const querySelector = (el, query) => el.querySelector(query) - -/** - * @param {HTMLElement|ShadowRoot} el - * @param {string} query - * @return {NodeListOf} - */ -export const querySelectorAll = (el, query) => el.querySelectorAll(query) - -/** - * @param {string} id - * @return {HTMLElement} - */ -export const getElementById = id => /** @type {HTMLElement} */ (doc.getElementById(id)) - -/** - * @param {string} html - * @return {HTMLElement} - */ -const _parse = html => domParser.parseFromString(`${html}`, 'text/html').body - -/** - * @param {string} html - * @return {DocumentFragment} - */ -export const parseFragment = html => fragment(/** @type {any} */ (_parse(html).childNodes)) - -/** - * @param {string} html - * @return {HTMLElement} - */ -export const parseElement = html => /** @type HTMLElement */ (_parse(html).firstElementChild) - -/** - * @param {HTMLElement} oldEl - * @param {HTMLElement|DocumentFragment} newEl - */ -export const replaceWith = (oldEl, newEl) => oldEl.replaceWith(newEl) - -/** - * @param {HTMLElement} parent - * @param {HTMLElement} el - * @param {Node|null} ref - * @return {HTMLElement} - */ -export const insertBefore = (parent, el, ref) => parent.insertBefore(el, ref) - -/** - * @param {Node} parent - * @param {Node} child - * @return {Node} - */ -export const appendChild = (parent, child) => parent.appendChild(child) - -export const ELEMENT_NODE = doc.ELEMENT_NODE -export const TEXT_NODE = doc.TEXT_NODE -export const CDATA_SECTION_NODE = doc.CDATA_SECTION_NODE -export const COMMENT_NODE = doc.COMMENT_NODE -export const DOCUMENT_NODE = doc.DOCUMENT_NODE -export const DOCUMENT_TYPE_NODE = doc.DOCUMENT_TYPE_NODE -export const DOCUMENT_FRAGMENT_NODE = doc.DOCUMENT_FRAGMENT_NODE - -/** - * @type {$.Schema} - */ -export const $node = $.$custom(el => el.nodeType === DOCUMENT_NODE) - -/** - * @param {any} node - * @param {number} type - */ -export const checkNodeType = (node, type) => node.nodeType === type - -/** - * @param {Node} parent - * @param {HTMLElement} child - */ -export const isParentOf = (parent, child) => { - let p = child.parentNode - while (p && p !== parent) { - p = p.parentNode - } - return p === parent -} -/* c8 ignore stop */ diff --git a/yjs-poll/node_modules/lib0/encoding.d.ts b/yjs-poll/node_modules/lib0/encoding.d.ts deleted file mode 100644 index 574ca97..0000000 --- a/yjs-poll/node_modules/lib0/encoding.d.ts +++ /dev/null @@ -1,235 +0,0 @@ -/** - * A BinaryEncoder handles the encoding to an Uint8Array. - */ -export class Encoder { - cpos: number; - cbuf: Uint8Array; - /** - * @type {Array} - */ - bufs: Array; -} -export function createEncoder(): Encoder; -export function encode(f: (arg0: Encoder) => void): Uint8Array; -export function length(encoder: Encoder): number; -export function hasContent(encoder: Encoder): boolean; -export function toUint8Array(encoder: Encoder): Uint8Array; -export function verifyLen(encoder: Encoder, len: number): void; -export function write(encoder: Encoder, num: number): void; -export function set(encoder: Encoder, pos: number, num: number): void; -export function writeUint8(encoder: Encoder, num: number): void; -export function setUint8(encoder: Encoder, pos: number, num: number): void; -export function writeUint16(encoder: Encoder, num: number): void; -export function setUint16(encoder: Encoder, pos: number, num: number): void; -export function writeUint32(encoder: Encoder, num: number): void; -export function writeUint32BigEndian(encoder: Encoder, num: number): void; -export function setUint32(encoder: Encoder, pos: number, num: number): void; -export function writeVarUint(encoder: Encoder, num: number): void; -export function writeVarInt(encoder: Encoder, num: number): void; -export function _writeVarStringNative(encoder: Encoder, str: string): void; -export function _writeVarStringPolyfill(encoder: Encoder, str: string): void; -export function writeVarString(encoder: Encoder, str: string): void; -export function writeTerminatedString(encoder: Encoder, str: string): void; -export function writeTerminatedUint8Array(encoder: Encoder, buf: Uint8Array): void; -export function writeBinaryEncoder(encoder: Encoder, append: Encoder): void; -export function writeUint8Array(encoder: Encoder, uint8Array: Uint8Array): void; -export function writeVarUint8Array(encoder: Encoder, uint8Array: Uint8Array): void; -export function writeOnDataView(encoder: Encoder, len: number): DataView; -export function writeFloat32(encoder: Encoder, num: number): void; -export function writeFloat64(encoder: Encoder, num: number): void; -export function writeBigInt64(encoder: Encoder, num: bigint): any; -export function writeBigUint64(encoder: Encoder, num: bigint): any; -export function writeAny(encoder: Encoder, data: AnyEncodable): void; -/** - * Now come a few stateful encoder that have their own classes. - */ -/** - * Basic Run Length Encoder - a basic compression implementation. - * - * Encodes [1,1,1,7] to [1,3,7,1] (3 times 1, 1 time 7). This encoder might do more harm than good if there are a lot of values that are not repeated. - * - * It was originally used for image compression. Cool .. article http://csbruce.com/cbm/transactor/pdfs/trans_v7_i06.pdf - * - * @note T must not be null! - * - * @template T - */ -export class RleEncoder extends Encoder { - /** - * @param {function(Encoder, T):void} writer - */ - constructor(writer: (arg0: Encoder, arg1: T) => void); - /** - * The writer - */ - w: (arg0: Encoder, arg1: T) => void; - /** - * Current state - * @type {T|null} - */ - s: T | null; - count: number; - /** - * @param {T} v - */ - write(v: T): void; -} -/** - * Basic diff decoder using variable length encoding. - * - * Encodes the values [3, 1100, 1101, 1050, 0] to [3, 1097, 1, -51, -1050] using writeVarInt. - */ -export class IntDiffEncoder extends Encoder { - /** - * @param {number} start - */ - constructor(start: number); - /** - * Current state - * @type {number} - */ - s: number; - /** - * @param {number} v - */ - write(v: number): void; -} -/** - * A combination of IntDiffEncoder and RleEncoder. - * - * Basically first writes the IntDiffEncoder and then counts duplicate diffs using RleEncoding. - * - * Encodes the values [1,1,1,2,3,4,5,6] as [1,1,0,2,1,5] (RLE([1,0,0,1,1,1,1,1]) ⇒ RleIntDiff[1,1,0,2,1,5]) - */ -export class RleIntDiffEncoder extends Encoder { - /** - * @param {number} start - */ - constructor(start: number); - /** - * Current state - * @type {number} - */ - s: number; - count: number; - /** - * @param {number} v - */ - write(v: number): void; -} -/** - * Optimized Rle encoder that does not suffer from the mentioned problem of the basic Rle encoder. - * - * Internally uses VarInt encoder to write unsigned integers. If the input occurs multiple times, we write - * write it as a negative number. The UintOptRleDecoder then understands that it needs to read a count. - * - * Encodes [1,2,3,3,3] as [1,2,-3,3] (once 1, once 2, three times 3) - */ -export class UintOptRleEncoder { - encoder: Encoder; - /** - * @type {number} - */ - s: number; - count: number; - /** - * @param {number} v - */ - write(v: number): void; - /** - * Flush the encoded state and transform this to a Uint8Array. - * - * Note that this should only be called once. - */ - toUint8Array(): Uint8Array; -} -/** - * Increasing Uint Optimized RLE Encoder - * - * The RLE encoder counts the number of same occurences of the same value. - * The IncUintOptRle encoder counts if the value increases. - * I.e. 7, 8, 9, 10 will be encoded as [-7, 4]. 1, 3, 5 will be encoded - * as [1, 3, 5]. - */ -export class IncUintOptRleEncoder { - encoder: Encoder; - /** - * @type {number} - */ - s: number; - count: number; - /** - * @param {number} v - */ - write(v: number): void; - /** - * Flush the encoded state and transform this to a Uint8Array. - * - * Note that this should only be called once. - */ - toUint8Array(): Uint8Array; -} -/** - * A combination of the IntDiffEncoder and the UintOptRleEncoder. - * - * The count approach is similar to the UintDiffOptRleEncoder, but instead of using the negative bitflag, it encodes - * in the LSB whether a count is to be read. Therefore this Encoder only supports 31 bit integers! - * - * Encodes [1, 2, 3, 2] as [3, 1, 6, -1] (more specifically [(1 << 1) | 1, (3 << 0) | 0, -1]) - * - * Internally uses variable length encoding. Contrary to normal UintVar encoding, the first byte contains: - * * 1 bit that denotes whether the next value is a count (LSB) - * * 1 bit that denotes whether this value is negative (MSB - 1) - * * 1 bit that denotes whether to continue reading the variable length integer (MSB) - * - * Therefore, only five bits remain to encode diff ranges. - * - * Use this Encoder only when appropriate. In most cases, this is probably a bad idea. - */ -export class IntDiffOptRleEncoder { - encoder: Encoder; - /** - * @type {number} - */ - s: number; - count: number; - diff: number; - /** - * @param {number} v - */ - write(v: number): void; - /** - * Flush the encoded state and transform this to a Uint8Array. - * - * Note that this should only be called once. - */ - toUint8Array(): Uint8Array; -} -/** - * Optimized String Encoder. - * - * Encoding many small strings in a simple Encoder is not very efficient. The function call to decode a string takes some time and creates references that must be eventually deleted. - * In practice, when decoding several million small strings, the GC will kick in more and more often to collect orphaned string objects (or maybe there is another reason?). - * - * This string encoder solves the above problem. All strings are concatenated and written as a single string using a single encoding call. - * - * The lengths are encoded using a UintOptRleEncoder. - */ -export class StringEncoder { - /** - * @type {Array} - */ - sarr: Array; - s: string; - lensE: UintOptRleEncoder; - /** - * @param {string} string - */ - write(string: string): void; - toUint8Array(): Uint8Array; -} -export type AnyEncodableArray = Array; -export type AnyEncodable = undefined | null | number | bigint | boolean | string | { - [k: string]: AnyEncodable; -} | AnyEncodableArray | Uint8Array; -//# sourceMappingURL=encoding.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/encoding.d.ts.map b/yjs-poll/node_modules/lib0/encoding.d.ts.map deleted file mode 100644 index 184d5c4..0000000 --- a/yjs-poll/node_modules/lib0/encoding.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["encoding.js"],"names":[],"mappings":"AAkCA;;GAEG;AACH;IAEI,aAAa;IACb,8BAA+B;IAC/B;;OAEG;IACH,MAFU,KAAK,CAAC,UAAU,CAAC,CAEb;CAEjB;AAMM,iCAFK,OAAO,CAE6B;AAKzC,0BAFI,CAAS,IAAO,EAAP,OAAO,KAAE,IAAI,2BAMhC;AASM,gCAHI,OAAO,GACN,MAAM,CAQjB;AASM,oCAHI,OAAO,GACN,OAAO,CAE6D;AASzE,sCAHI,OAAO,GACN,UAAU,CAAC,WAAW,CAAC,CAYlC;AASM,mCAHI,OAAO,OACP,MAAM,QAShB;AASM,+BAHI,OAAO,OACP,MAAM,QAUhB;AAWM,6BAJI,OAAO,OACP,MAAM,O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EG;IACH,mBAFW,MAAM,EAShB;IALC;;;OAGG;IACH,GAFU,MAAM,CAEF;IAGhB;;OAEG;IACH,SAFW,MAAM,QAKhB;CACF;AAED;;;;;;GAMG;AACH;IACE;;OAEG;IACH,mBAFW,MAAM,EAUhB;IANC;;;OAGG;IACH,GAFU,MAAM,CAEF;IACd,cAAc;IAGhB;;OAEG;IACH,SAFW,MAAM,QAehB;CACF;AAiBD;;;;;;;GAOG;AACH;IAEI,iBAA4B;IAC5B;;OAEG;IACH,GAFU,MAAM,CAEN;IACV,cAAc;IAGhB;;OAEG;IACH,SAFW,MAAM,QAUhB;IAED;;;;OAIG;IACH,wCAGC;CACF;AAED;;;;;;;GAOG;AACH;IAEI,iBAA4B;IAC5B;;OAEG;IACH,GAFU,MAAM,CAEN;IACV,cAAc;IAGhB;;OAEG;IACH,SAFW,MAAM,QAUhB;IAED;;;;OAIG;IACH,wCAGC;CACF;AAoBD;;;;;;;;;;;;;;;;GAgBG;AACH;IAEI,iBAA4B;IAC5B;;OAEG;IACH,GAFU,MAAM,CAEN;IACV,cAAc;IACd,aAAa;IAGf;;OAEG;IACH,SAFW,MAAM,QAYhB;IAED;;;;OAIG;IACH,wCAGC;CACF;AAED;;;;;;;;;GASG;AACH;IAEI;;OAEG;IACH,MAFU,KAAK,CAAC,MAAM,CAAC,CAET;IACd,UAAW;IACX,yBAAoC;IAGtC;;OAEG;IACH,cAFW,MAAM,QAShB;IAED,wCAOC;CACF;gCAtbY,KAAK,CAAC,YAAY,CAAC;2BAInB,SAAS,GAAC,IAAI,GAAC,MAAM,GAAC,MAAM,GAAC,OAAO,GAAC,MAAM,GAAC;IAAC,CAAC,CAAC,EAAC,MAAM,GAAE,YAAY,CAAA;CAAC,GAAC,iBAAiB,GAAC,UAAU"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/encoding.js b/yjs-poll/node_modules/lib0/encoding.js deleted file mode 100644 index 9668489..0000000 --- a/yjs-poll/node_modules/lib0/encoding.js +++ /dev/null @@ -1,938 +0,0 @@ -/** - * Efficient schema-less binary encoding with support for variable length encoding. - * - * Use [lib0/encoding] with [lib0/decoding]. Every encoding function has a corresponding decoding function. - * - * Encodes numbers in little-endian order (least to most significant byte order) - * and is compatible with Golang's binary encoding (https://golang.org/pkg/encoding/binary/) - * which is also used in Protocol Buffers. - * - * ```js - * // encoding step - * const encoder = encoding.createEncoder() - * encoding.writeVarUint(encoder, 256) - * encoding.writeVarString(encoder, 'Hello world!') - * const buf = encoding.toUint8Array(encoder) - * ``` - * - * ```js - * // decoding step - * const decoder = decoding.createDecoder(buf) - * decoding.readVarUint(decoder) // => 256 - * decoding.readVarString(decoder) // => 'Hello world!' - * decoding.hasContent(decoder) // => false - all data is read - * ``` - * - * @module encoding - */ - -import * as math from './math.js' -import * as number from './number.js' -import * as binary from './binary.js' -import * as string from './string.js' -import * as array from './array.js' - -/** - * A BinaryEncoder handles the encoding to an Uint8Array. - */ -export class Encoder { - constructor () { - this.cpos = 0 - this.cbuf = new Uint8Array(100) - /** - * @type {Array} - */ - this.bufs = [] - } -} - -/** - * @function - * @return {Encoder} - */ -export const createEncoder = () => new Encoder() - -/** - * @param {function(Encoder):void} f - */ -export const encode = (f) => { - const encoder = createEncoder() - f(encoder) - return toUint8Array(encoder) -} - -/** - * The current length of the encoded data. - * - * @function - * @param {Encoder} encoder - * @return {number} - */ -export const length = encoder => { - let len = encoder.cpos - for (let i = 0; i < encoder.bufs.length; i++) { - len += encoder.bufs[i].length - } - return len -} - -/** - * Check whether encoder is empty. - * - * @function - * @param {Encoder} encoder - * @return {boolean} - */ -export const hasContent = encoder => encoder.cpos > 0 || encoder.bufs.length > 0 - -/** - * Transform to Uint8Array. - * - * @function - * @param {Encoder} encoder - * @return {Uint8Array} The created ArrayBuffer. - */ -export const toUint8Array = encoder => { - const uint8arr = new Uint8Array(length(encoder)) - let curPos = 0 - for (let i = 0; i < encoder.bufs.length; i++) { - const d = encoder.bufs[i] - uint8arr.set(d, curPos) - curPos += d.length - } - uint8arr.set(new Uint8Array(encoder.cbuf.buffer, 0, encoder.cpos), curPos) - return uint8arr -} - -/** - * Verify that it is possible to write `len` bytes wtihout checking. If - * necessary, a new Buffer with the required length is attached. - * - * @param {Encoder} encoder - * @param {number} len - */ -export const verifyLen = (encoder, len) => { - const bufferLen = encoder.cbuf.length - if (bufferLen - encoder.cpos < len) { - encoder.bufs.push(new Uint8Array(encoder.cbuf.buffer, 0, encoder.cpos)) - encoder.cbuf = new Uint8Array(math.max(bufferLen, len) * 2) - encoder.cpos = 0 - } -} - -/** - * Write one byte to the encoder. - * - * @function - * @param {Encoder} encoder - * @param {number} num The byte that is to be encoded. - */ -export const write = (encoder, num) => { - const bufferLen = encoder.cbuf.length - if (encoder.cpos === bufferLen) { - encoder.bufs.push(encoder.cbuf) - encoder.cbuf = new Uint8Array(bufferLen * 2) - encoder.cpos = 0 - } - encoder.cbuf[encoder.cpos++] = num -} - -/** - * Write one byte at a specific position. - * Position must already be written (i.e. encoder.length > pos) - * - * @function - * @param {Encoder} encoder - * @param {number} pos Position to which to write data - * @param {number} num Unsigned 8-bit integer - */ -export const set = (encoder, pos, num) => { - let buffer = null - // iterate all buffers and adjust position - for (let i = 0; i < encoder.bufs.length && buffer === null; i++) { - const b = encoder.bufs[i] - if (pos < b.length) { - buffer = b // found buffer - } else { - pos -= b.length - } - } - if (buffer === null) { - // use current buffer - buffer = encoder.cbuf - } - buffer[pos] = num -} - -/** - * Write one byte as an unsigned integer. - * - * @function - * @param {Encoder} encoder - * @param {number} num The number that is to be encoded. - */ -export const writeUint8 = write - -/** - * Write one byte as an unsigned Integer at a specific location. - * - * @function - * @param {Encoder} encoder - * @param {number} pos The location where the data will be written. - * @param {number} num The number that is to be encoded. - */ -export const setUint8 = set - -/** - * Write two bytes as an unsigned integer. - * - * @function - * @param {Encoder} encoder - * @param {number} num The number that is to be encoded. - */ -export const writeUint16 = (encoder, num) => { - write(encoder, num & binary.BITS8) - write(encoder, (num >>> 8) & binary.BITS8) -} -/** - * Write two bytes as an unsigned integer at a specific location. - * - * @function - * @param {Encoder} encoder - * @param {number} pos The location where the data will be written. - * @param {number} num The number that is to be encoded. - */ -export const setUint16 = (encoder, pos, num) => { - set(encoder, pos, num & binary.BITS8) - set(encoder, pos + 1, (num >>> 8) & binary.BITS8) -} - -/** - * Write two bytes as an unsigned integer - * - * @function - * @param {Encoder} encoder - * @param {number} num The number that is to be encoded. - */ -export const writeUint32 = (encoder, num) => { - for (let i = 0; i < 4; i++) { - write(encoder, num & binary.BITS8) - num >>>= 8 - } -} - -/** - * Write two bytes as an unsigned integer in big endian order. - * (most significant byte first) - * - * @function - * @param {Encoder} encoder - * @param {number} num The number that is to be encoded. - */ -export const writeUint32BigEndian = (encoder, num) => { - for (let i = 3; i >= 0; i--) { - write(encoder, (num >>> (8 * i)) & binary.BITS8) - } -} - -/** - * Write two bytes as an unsigned integer at a specific location. - * - * @function - * @param {Encoder} encoder - * @param {number} pos The location where the data will be written. - * @param {number} num The number that is to be encoded. - */ -export const setUint32 = (encoder, pos, num) => { - for (let i = 0; i < 4; i++) { - set(encoder, pos + i, num & binary.BITS8) - num >>>= 8 - } -} - -/** - * Write a variable length unsigned integer. Max encodable integer is 2^53. - * - * @function - * @param {Encoder} encoder - * @param {number} num The number that is to be encoded. - */ -export const writeVarUint = (encoder, num) => { - while (num > binary.BITS7) { - write(encoder, binary.BIT8 | (binary.BITS7 & num)) - num = math.floor(num / 128) // shift >>> 7 - } - write(encoder, binary.BITS7 & num) -} - -/** - * Write a variable length integer. - * - * We use the 7th bit instead for signaling that this is a negative number. - * - * @function - * @param {Encoder} encoder - * @param {number} num The number that is to be encoded. - */ -export const writeVarInt = (encoder, num) => { - const isNegative = math.isNegativeZero(num) - if (isNegative) { - num = -num - } - // |- whether to continue reading |- whether is negative |- number - write(encoder, (num > binary.BITS6 ? binary.BIT8 : 0) | (isNegative ? binary.BIT7 : 0) | (binary.BITS6 & num)) - num = math.floor(num / 64) // shift >>> 6 - // We don't need to consider the case of num === 0 so we can use a different - // pattern here than above. - while (num > 0) { - write(encoder, (num > binary.BITS7 ? binary.BIT8 : 0) | (binary.BITS7 & num)) - num = math.floor(num / 128) // shift >>> 7 - } -} - -/** - * A cache to store strings temporarily - */ -const _strBuffer = new Uint8Array(30000) -const _maxStrBSize = _strBuffer.length / 3 - -/** - * Write a variable length string. - * - * @function - * @param {Encoder} encoder - * @param {String} str The string that is to be encoded. - */ -export const _writeVarStringNative = (encoder, str) => { - if (str.length < _maxStrBSize) { - // We can encode the string into the existing buffer - /* c8 ignore next */ - const written = string.utf8TextEncoder.encodeInto(str, _strBuffer).written || 0 - writeVarUint(encoder, written) - for (let i = 0; i < written; i++) { - write(encoder, _strBuffer[i]) - } - } else { - writeVarUint8Array(encoder, string.encodeUtf8(str)) - } -} - -/** - * Write a variable length string. - * - * @function - * @param {Encoder} encoder - * @param {String} str The string that is to be encoded. - */ -export const _writeVarStringPolyfill = (encoder, str) => { - const encodedString = unescape(encodeURIComponent(str)) - const len = encodedString.length - writeVarUint(encoder, len) - for (let i = 0; i < len; i++) { - write(encoder, /** @type {number} */ (encodedString.codePointAt(i))) - } -} - -/** - * Write a variable length string. - * - * @function - * @param {Encoder} encoder - * @param {String} str The string that is to be encoded. - */ -/* c8 ignore next */ -export const writeVarString = (string.utf8TextEncoder && /** @type {any} */ (string.utf8TextEncoder).encodeInto) ? _writeVarStringNative : _writeVarStringPolyfill - -/** - * Write a string terminated by a special byte sequence. This is not very performant and is - * generally discouraged. However, the resulting byte arrays are lexiographically ordered which - * makes this a nice feature for databases. - * - * The string will be encoded using utf8 and then terminated and escaped using writeTerminatingUint8Array. - * - * @function - * @param {Encoder} encoder - * @param {String} str The string that is to be encoded. - */ -export const writeTerminatedString = (encoder, str) => - writeTerminatedUint8Array(encoder, string.encodeUtf8(str)) - -/** - * Write a terminating Uint8Array. Note that this is not performant and is generally - * discouraged. There are few situations when this is needed. - * - * We use 0x0 as a terminating character. 0x1 serves as an escape character for 0x0 and 0x1. - * - * Example: [0,1,2] is encoded to [1,0,1,1,2,0]. 0x0, and 0x1 needed to be escaped using 0x1. Then - * the result is terminated using the 0x0 character. - * - * This is basically how many systems implement null terminated strings. However, we use an escape - * character 0x1 to avoid issues and potenial attacks on our database (if this is used as a key - * encoder for NoSql databases). - * - * @function - * @param {Encoder} encoder - * @param {Uint8Array} buf The string that is to be encoded. - */ -export const writeTerminatedUint8Array = (encoder, buf) => { - for (let i = 0; i < buf.length; i++) { - const b = buf[i] - if (b === 0 || b === 1) { - write(encoder, 1) - } - write(encoder, buf[i]) - } - write(encoder, 0) -} - -/** - * Write the content of another Encoder. - * - * @TODO: can be improved! - * - Note: Should consider that when appending a lot of small Encoders, we should rather clone than referencing the old structure. - * Encoders start with a rather big initial buffer. - * - * @function - * @param {Encoder} encoder The enUint8Arr - * @param {Encoder} append The BinaryEncoder to be written. - */ -export const writeBinaryEncoder = (encoder, append) => writeUint8Array(encoder, toUint8Array(append)) - -/** - * Append fixed-length Uint8Array to the encoder. - * - * @function - * @param {Encoder} encoder - * @param {Uint8Array} uint8Array - */ -export const writeUint8Array = (encoder, uint8Array) => { - const bufferLen = encoder.cbuf.length - const cpos = encoder.cpos - const leftCopyLen = math.min(bufferLen - cpos, uint8Array.length) - const rightCopyLen = uint8Array.length - leftCopyLen - encoder.cbuf.set(uint8Array.subarray(0, leftCopyLen), cpos) - encoder.cpos += leftCopyLen - if (rightCopyLen > 0) { - // Still something to write, write right half.. - // Append new buffer - encoder.bufs.push(encoder.cbuf) - // must have at least size of remaining buffer - encoder.cbuf = new Uint8Array(math.max(bufferLen * 2, rightCopyLen)) - // copy array - encoder.cbuf.set(uint8Array.subarray(leftCopyLen)) - encoder.cpos = rightCopyLen - } -} - -/** - * Append an Uint8Array to Encoder. - * - * @function - * @param {Encoder} encoder - * @param {Uint8Array} uint8Array - */ -export const writeVarUint8Array = (encoder, uint8Array) => { - writeVarUint(encoder, uint8Array.byteLength) - writeUint8Array(encoder, uint8Array) -} - -/** - * Create an DataView of the next `len` bytes. Use it to write data after - * calling this function. - * - * ```js - * // write float32 using DataView - * const dv = writeOnDataView(encoder, 4) - * dv.setFloat32(0, 1.1) - * // read float32 using DataView - * const dv = readFromDataView(encoder, 4) - * dv.getFloat32(0) // => 1.100000023841858 (leaving it to the reader to find out why this is the correct result) - * ``` - * - * @param {Encoder} encoder - * @param {number} len - * @return {DataView} - */ -export const writeOnDataView = (encoder, len) => { - verifyLen(encoder, len) - const dview = new DataView(encoder.cbuf.buffer, encoder.cpos, len) - encoder.cpos += len - return dview -} - -/** - * @param {Encoder} encoder - * @param {number} num - */ -export const writeFloat32 = (encoder, num) => writeOnDataView(encoder, 4).setFloat32(0, num, false) - -/** - * @param {Encoder} encoder - * @param {number} num - */ -export const writeFloat64 = (encoder, num) => writeOnDataView(encoder, 8).setFloat64(0, num, false) - -/** - * @param {Encoder} encoder - * @param {bigint} num - */ -export const writeBigInt64 = (encoder, num) => /** @type {any} */ (writeOnDataView(encoder, 8)).setBigInt64(0, num, false) - -/** - * @param {Encoder} encoder - * @param {bigint} num - */ -export const writeBigUint64 = (encoder, num) => /** @type {any} */ (writeOnDataView(encoder, 8)).setBigUint64(0, num, false) - -const floatTestBed = new DataView(new ArrayBuffer(4)) -/** - * Check if a number can be encoded as a 32 bit float. - * - * @param {number} num - * @return {boolean} - */ -const isFloat32 = num => { - floatTestBed.setFloat32(0, num) - return floatTestBed.getFloat32(0) === num -} - -/** - * @typedef {Array} AnyEncodableArray - */ - -/** - * @typedef {undefined|null|number|bigint|boolean|string|{[k:string]:AnyEncodable}|AnyEncodableArray|Uint8Array} AnyEncodable - */ - -/** - * Encode data with efficient binary format. - * - * Differences to JSON: - * • Transforms data to a binary format (not to a string) - * • Encodes undefined, NaN, and ArrayBuffer (these can't be represented in JSON) - * • Numbers are efficiently encoded either as a variable length integer, as a - * 32 bit float, as a 64 bit float, or as a 64 bit bigint. - * - * Encoding table: - * - * | Data Type | Prefix | Encoding Method | Comment | - * | ------------------- | -------- | ------------------ | ------- | - * | undefined | 127 | | Functions, symbol, and everything that cannot be identified is encoded as undefined | - * | null | 126 | | | - * | integer | 125 | writeVarInt | Only encodes 32 bit signed integers | - * | float32 | 124 | writeFloat32 | | - * | float64 | 123 | writeFloat64 | | - * | bigint | 122 | writeBigInt64 | | - * | boolean (false) | 121 | | True and false are different data types so we save the following byte | - * | boolean (true) | 120 | | - 0b01111000 so the last bit determines whether true or false | - * | string | 119 | writeVarString | | - * | object | 118 | custom | Writes {length} then {length} key-value pairs | - * | array | 117 | custom | Writes {length} then {length} json values | - * | Uint8Array | 116 | writeVarUint8Array | We use Uint8Array for any kind of binary data | - * - * Reasons for the decreasing prefix: - * We need the first bit for extendability (later we may want to encode the - * prefix with writeVarUint). The remaining 7 bits are divided as follows: - * [0-30] the beginning of the data range is used for custom purposes - * (defined by the function that uses this library) - * [31-127] the end of the data range is used for data encoding by - * lib0/encoding.js - * - * @param {Encoder} encoder - * @param {AnyEncodable} data - */ -export const writeAny = (encoder, data) => { - switch (typeof data) { - case 'string': - // TYPE 119: STRING - write(encoder, 119) - writeVarString(encoder, data) - break - case 'number': - if (number.isInteger(data) && math.abs(data) <= binary.BITS31) { - // TYPE 125: INTEGER - write(encoder, 125) - writeVarInt(encoder, data) - } else if (isFloat32(data)) { - // TYPE 124: FLOAT32 - write(encoder, 124) - writeFloat32(encoder, data) - } else { - // TYPE 123: FLOAT64 - write(encoder, 123) - writeFloat64(encoder, data) - } - break - case 'bigint': - // TYPE 122: BigInt - write(encoder, 122) - writeBigInt64(encoder, data) - break - case 'object': - if (data === null) { - // TYPE 126: null - write(encoder, 126) - } else if (array.isArray(data)) { - // TYPE 117: Array - write(encoder, 117) - writeVarUint(encoder, data.length) - for (let i = 0; i < data.length; i++) { - writeAny(encoder, data[i]) - } - } else if (data instanceof Uint8Array) { - // TYPE 116: ArrayBuffer - write(encoder, 116) - writeVarUint8Array(encoder, data) - } else { - // TYPE 118: Object - write(encoder, 118) - const keys = Object.keys(data) - writeVarUint(encoder, keys.length) - for (let i = 0; i < keys.length; i++) { - const key = keys[i] - writeVarString(encoder, key) - writeAny(encoder, data[key]) - } - } - break - case 'boolean': - // TYPE 120/121: boolean (true/false) - write(encoder, data ? 120 : 121) - break - default: - // TYPE 127: undefined - write(encoder, 127) - } -} - -/** - * Now come a few stateful encoder that have their own classes. - */ - -/** - * Basic Run Length Encoder - a basic compression implementation. - * - * Encodes [1,1,1,7] to [1,3,7,1] (3 times 1, 1 time 7). This encoder might do more harm than good if there are a lot of values that are not repeated. - * - * It was originally used for image compression. Cool .. article http://csbruce.com/cbm/transactor/pdfs/trans_v7_i06.pdf - * - * @note T must not be null! - * - * @template T - */ -export class RleEncoder extends Encoder { - /** - * @param {function(Encoder, T):void} writer - */ - constructor (writer) { - super() - /** - * The writer - */ - this.w = writer - /** - * Current state - * @type {T|null} - */ - this.s = null - this.count = 0 - } - - /** - * @param {T} v - */ - write (v) { - if (this.s === v) { - this.count++ - } else { - if (this.count > 0) { - // flush counter, unless this is the first value (count = 0) - writeVarUint(this, this.count - 1) // since count is always > 0, we can decrement by one. non-standard encoding ftw - } - this.count = 1 - // write first value - this.w(this, v) - this.s = v - } - } -} - -/** - * Basic diff decoder using variable length encoding. - * - * Encodes the values [3, 1100, 1101, 1050, 0] to [3, 1097, 1, -51, -1050] using writeVarInt. - */ -export class IntDiffEncoder extends Encoder { - /** - * @param {number} start - */ - constructor (start) { - super() - /** - * Current state - * @type {number} - */ - this.s = start - } - - /** - * @param {number} v - */ - write (v) { - writeVarInt(this, v - this.s) - this.s = v - } -} - -/** - * A combination of IntDiffEncoder and RleEncoder. - * - * Basically first writes the IntDiffEncoder and then counts duplicate diffs using RleEncoding. - * - * Encodes the values [1,1,1,2,3,4,5,6] as [1,1,0,2,1,5] (RLE([1,0,0,1,1,1,1,1]) ⇒ RleIntDiff[1,1,0,2,1,5]) - */ -export class RleIntDiffEncoder extends Encoder { - /** - * @param {number} start - */ - constructor (start) { - super() - /** - * Current state - * @type {number} - */ - this.s = start - this.count = 0 - } - - /** - * @param {number} v - */ - write (v) { - if (this.s === v && this.count > 0) { - this.count++ - } else { - if (this.count > 0) { - // flush counter, unless this is the first value (count = 0) - writeVarUint(this, this.count - 1) // since count is always > 0, we can decrement by one. non-standard encoding ftw - } - this.count = 1 - // write first value - writeVarInt(this, v - this.s) - this.s = v - } - } -} - -/** - * @param {UintOptRleEncoder} encoder - */ -const flushUintOptRleEncoder = encoder => { - if (encoder.count > 0) { - // flush counter, unless this is the first value (count = 0) - // case 1: just a single value. set sign to positive - // case 2: write several values. set sign to negative to indicate that there is a length coming - writeVarInt(encoder.encoder, encoder.count === 1 ? encoder.s : -encoder.s) - if (encoder.count > 1) { - writeVarUint(encoder.encoder, encoder.count - 2) // since count is always > 1, we can decrement by one. non-standard encoding ftw - } - } -} - -/** - * Optimized Rle encoder that does not suffer from the mentioned problem of the basic Rle encoder. - * - * Internally uses VarInt encoder to write unsigned integers. If the input occurs multiple times, we write - * write it as a negative number. The UintOptRleDecoder then understands that it needs to read a count. - * - * Encodes [1,2,3,3,3] as [1,2,-3,3] (once 1, once 2, three times 3) - */ -export class UintOptRleEncoder { - constructor () { - this.encoder = new Encoder() - /** - * @type {number} - */ - this.s = 0 - this.count = 0 - } - - /** - * @param {number} v - */ - write (v) { - if (this.s === v) { - this.count++ - } else { - flushUintOptRleEncoder(this) - this.count = 1 - this.s = v - } - } - - /** - * Flush the encoded state and transform this to a Uint8Array. - * - * Note that this should only be called once. - */ - toUint8Array () { - flushUintOptRleEncoder(this) - return toUint8Array(this.encoder) - } -} - -/** - * Increasing Uint Optimized RLE Encoder - * - * The RLE encoder counts the number of same occurences of the same value. - * The IncUintOptRle encoder counts if the value increases. - * I.e. 7, 8, 9, 10 will be encoded as [-7, 4]. 1, 3, 5 will be encoded - * as [1, 3, 5]. - */ -export class IncUintOptRleEncoder { - constructor () { - this.encoder = new Encoder() - /** - * @type {number} - */ - this.s = 0 - this.count = 0 - } - - /** - * @param {number} v - */ - write (v) { - if (this.s + this.count === v) { - this.count++ - } else { - flushUintOptRleEncoder(this) - this.count = 1 - this.s = v - } - } - - /** - * Flush the encoded state and transform this to a Uint8Array. - * - * Note that this should only be called once. - */ - toUint8Array () { - flushUintOptRleEncoder(this) - return toUint8Array(this.encoder) - } -} - -/** - * @param {IntDiffOptRleEncoder} encoder - */ -const flushIntDiffOptRleEncoder = encoder => { - if (encoder.count > 0) { - // 31 bit making up the diff | wether to write the counter - // const encodedDiff = encoder.diff << 1 | (encoder.count === 1 ? 0 : 1) - const encodedDiff = encoder.diff * 2 + (encoder.count === 1 ? 0 : 1) - // flush counter, unless this is the first value (count = 0) - // case 1: just a single value. set first bit to positive - // case 2: write several values. set first bit to negative to indicate that there is a length coming - writeVarInt(encoder.encoder, encodedDiff) - if (encoder.count > 1) { - writeVarUint(encoder.encoder, encoder.count - 2) // since count is always > 1, we can decrement by one. non-standard encoding ftw - } - } -} - -/** - * A combination of the IntDiffEncoder and the UintOptRleEncoder. - * - * The count approach is similar to the UintDiffOptRleEncoder, but instead of using the negative bitflag, it encodes - * in the LSB whether a count is to be read. Therefore this Encoder only supports 31 bit integers! - * - * Encodes [1, 2, 3, 2] as [3, 1, 6, -1] (more specifically [(1 << 1) | 1, (3 << 0) | 0, -1]) - * - * Internally uses variable length encoding. Contrary to normal UintVar encoding, the first byte contains: - * * 1 bit that denotes whether the next value is a count (LSB) - * * 1 bit that denotes whether this value is negative (MSB - 1) - * * 1 bit that denotes whether to continue reading the variable length integer (MSB) - * - * Therefore, only five bits remain to encode diff ranges. - * - * Use this Encoder only when appropriate. In most cases, this is probably a bad idea. - */ -export class IntDiffOptRleEncoder { - constructor () { - this.encoder = new Encoder() - /** - * @type {number} - */ - this.s = 0 - this.count = 0 - this.diff = 0 - } - - /** - * @param {number} v - */ - write (v) { - if (this.diff === v - this.s) { - this.s = v - this.count++ - } else { - flushIntDiffOptRleEncoder(this) - this.count = 1 - this.diff = v - this.s - this.s = v - } - } - - /** - * Flush the encoded state and transform this to a Uint8Array. - * - * Note that this should only be called once. - */ - toUint8Array () { - flushIntDiffOptRleEncoder(this) - return toUint8Array(this.encoder) - } -} - -/** - * Optimized String Encoder. - * - * Encoding many small strings in a simple Encoder is not very efficient. The function call to decode a string takes some time and creates references that must be eventually deleted. - * In practice, when decoding several million small strings, the GC will kick in more and more often to collect orphaned string objects (or maybe there is another reason?). - * - * This string encoder solves the above problem. All strings are concatenated and written as a single string using a single encoding call. - * - * The lengths are encoded using a UintOptRleEncoder. - */ -export class StringEncoder { - constructor () { - /** - * @type {Array} - */ - this.sarr = [] - this.s = '' - this.lensE = new UintOptRleEncoder() - } - - /** - * @param {string} string - */ - write (string) { - this.s += string - if (this.s.length > 19) { - this.sarr.push(this.s) - this.s = '' - } - this.lensE.write(string.length) - } - - toUint8Array () { - const encoder = new Encoder() - this.sarr.push(this.s) - this.s = '' - writeVarString(encoder, this.sarr.join('')) - writeUint8Array(encoder, this.lensE.toUint8Array()) - return toUint8Array(encoder) - } -} diff --git a/yjs-poll/node_modules/lib0/encoding.test.d.ts b/yjs-poll/node_modules/lib0/encoding.test.d.ts deleted file mode 100644 index 83f548f..0000000 --- a/yjs-poll/node_modules/lib0/encoding.test.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -export function testGolangBinaryEncodingCompatibility(): void; -export function testVerifyLen(): void; -export function testStringEncodingPerformanceNativeVsPolyfill(): void; -export function testDecodingPerformanceNativeVsPolyfill(): void; -export function testStringDecodingPerformance(): void; -export function testAnyEncodeUnknowns(_tc: t.TestCase): void; -export function testAnyEncodeDate(_tc: t.TestCase): void; -export function testEncodeMax32bitUint(_tc: t.TestCase): void; -export function testVarUintEncoding(_tc: t.TestCase): void; -export function testVarIntEncoding(_tc: t.TestCase): void; -export function testRepeatVarUintEncoding(tc: t.TestCase): void; -export function testRepeatVarUintEncoding53bit(tc: t.TestCase): void; -export function testRepeatVarIntEncoding(tc: t.TestCase): void; -export function testRepeatVarIntEncoding53bit(tc: t.TestCase): void; -export function testRepeanntAnyEncoding(tc: t.TestCase): void; -export function testRepeatPeekVarUintEncoding(tc: t.TestCase): void; -export function testRepeatPeekVarIntEncoding(tc: t.TestCase): void; -export function testAnyVsJsonEncoding(tc: t.TestCase): void; -export function testStringEncoding(_tc: t.TestCase): void; -export function testRepeatStringEncoding(tc: t.TestCase): void; -export function testSetMethods(_tc: t.TestCase): void; -export function testRepeatRandomWrites(tc: t.TestCase): void; -export function testWriteUint8ArrayOverflow(_tc: t.TestCase): void; -export function testSetOnOverflow(_tc: t.TestCase): void; -export function testCloneDecoder(_tc: t.TestCase): void; -export function testWriteBinaryEncoder(_tc: t.TestCase): void; -export function testOverflowStringDecoding(tc: t.TestCase): void; -export function testRleEncoder(_tc: t.TestCase): void; -export function testRleIntDiffEncoder(_tc: t.TestCase): void; -export function testUintOptRleEncoder(_tc: t.TestCase): void; -export function testIncUintOptRleEncoder(_tc: t.TestCase): void; -export function testIntDiffRleEncoder(_tc: t.TestCase): void; -export function testIntEncoders(tc: t.TestCase): void; -export function testIntDiffEncoder(_tc: t.TestCase): void; -export function testStringDecoder(tc: t.TestCase): void; -export function testLargeNumberEncoding(tc: t.TestCase): void; -export function testInvalidVarIntEncoding(_tc: t.TestCase): void; -export function testTerminatedEncodering(_tc: t.TestCase): void; -export type EncodingPair = { - read: (arg0: decoding.Decoder) => any; - write: (arg0: encoding.Encoder, arg1: any) => void; - gen: (arg0: prng.PRNG) => any; - compare: (arg0: any, arg1: any) => boolean; - name: string; -}; -import * as t from './testing.js'; -import * as decoding from './decoding.js'; -import * as encoding from './encoding.js'; -import * as prng from './prng.js'; -//# sourceMappingURL=encoding.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/encoding.test.d.ts.map b/yjs-poll/node_modules/lib0/encoding.test.d.ts.map deleted file mode 100644 index e687ec4..0000000 --- a/yjs-poll/node_modules/lib0/encoding.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"encoding.test.d.ts","sourceRoot":"","sources":["encoding.test.js"],"names":[],"mappings":"A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pB;AAKM,sCAFI,CAAC,CAAC,QAAQ,QAyBpB;AAKM,4CAFI,CAAC,CAAC,QAAQ,QAyBpB;AAKM,+CAFI,CAAC,CAAC,QAAQ,QAapB;AAKM,8CAFI,CAAC,CAAC,QAAQ,QAqBpB;;UAvZa,CAAS,IAAgB,EAAhB,QAAQ,CAAC,OAAO,KAAE,GAAG;WAC9B,CAAS,IAAgB,EAAhB,QAAQ,CAAC,OAAO,EAAC,IAAG,EAAH,GAAG,KAAE,IAAI;SACnC,CAAS,IAAS,EAAT,IAAI,CAAC,IAAI,KAAE,GAAG;aACvB,CAAS,IAAG,EAAH,GAAG,EAAC,IAAG,EAAH,GAAG,KAAE,OAAO;UACzB,MAAM;;mBAhdD,cAAc;0BAFP,eAAe;0BADf,eAAe;sBAEnB,WAAW"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/environment.d.ts b/yjs-poll/node_modules/lib0/environment.d.ts deleted file mode 100644 index 9366538..0000000 --- a/yjs-poll/node_modules/lib0/environment.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -export const isNode: boolean; -export const isBrowser: boolean; -export const isMac: boolean; -export function hasParam(name: string): boolean; -export function getParam(name: string, defaultVal: string): string; -export function getVariable(name: string): string | null; -export function getConf(name: string): string | null; -export function ensureConf(name: string): string; -export function hasConf(name: string): boolean; -export const production: boolean; -/** - * Color is enabled by default if the terminal supports it. - * - * Explicitly enable color using `--color` parameter - * Disable color using `--no-color` parameter or using `NO_COLOR=1` environment variable. - * `FORCE_COLOR=1` enables color and takes precedence over all. - */ -export const supportsColor: boolean; -//# sourceMappingURL=environment.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/environment.d.ts.map b/yjs-poll/node_modules/lib0/environment.d.ts.map deleted file mode 100644 index cbc6b40..0000000 --- a/yjs-poll/node_modules/lib0/environment.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["environment.js"],"names":[],"mappings":"AAcA,6BAA0N;AAG1N,gCAAoG;AAEpG,4BAES;AAyDF,+BAJI,MAAM,GACL,OAAO,CAGwC;AAQpD,+BALI,MAAM,cACN,MAAM,GACL,MAAM,CAIuB;AAOlC,kCAJI,MAAM,GACL,MAAM,GAAC,IAAI,CAM2C;AAO3D,8BAJI,MAAM,GACL,MAAM,GAAC,IAAI,CAIgC;AAOhD,iCAJI,MAAM,GACL,MAAM,CAOjB;AAOM,8BAJI,MAAM,GACL,OAAO,CAIkC;AAGrD,iCAA+C;AAO/C;;;;;;GAMG;AACH,oCASC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/environment.js b/yjs-poll/node_modules/lib0/environment.js deleted file mode 100644 index 5bec300..0000000 --- a/yjs-poll/node_modules/lib0/environment.js +++ /dev/null @@ -1,152 +0,0 @@ -/** - * Isomorphic module to work access the environment (query params, env variables). - * - * @module environment - */ - -import * as map from './map.js' -import * as string from './string.js' -import * as conditions from './conditions.js' -import * as storage from './storage.js' -import * as f from './function.js' - -/* c8 ignore next 2 */ -// @ts-ignore -export const isNode = typeof process !== 'undefined' && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]' - -/* c8 ignore next */ -export const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && !isNode -/* c8 ignore next 3 */ -export const isMac = typeof navigator !== 'undefined' - ? /Mac/.test(navigator.platform) - : false - -/** - * @type {Map} - */ -let params -const args = [] - -/* c8 ignore start */ -const computeParams = () => { - if (params === undefined) { - if (isNode) { - params = map.create() - const pargs = process.argv - let currParamName = null - for (let i = 0; i < pargs.length; i++) { - const parg = pargs[i] - if (parg[0] === '-') { - if (currParamName !== null) { - params.set(currParamName, '') - } - currParamName = parg - } else { - if (currParamName !== null) { - params.set(currParamName, parg) - currParamName = null - } else { - args.push(parg) - } - } - } - if (currParamName !== null) { - params.set(currParamName, '') - } - // in ReactNative for example this would not be true (unless connected to the Remote Debugger) - } else if (typeof location === 'object') { - params = map.create(); // eslint-disable-next-line no-undef - (location.search || '?').slice(1).split('&').forEach((kv) => { - if (kv.length !== 0) { - const [key, value] = kv.split('=') - params.set(`--${string.fromCamelCase(key, '-')}`, value) - params.set(`-${string.fromCamelCase(key, '-')}`, value) - } - }) - } else { - params = map.create() - } - } - return params -} -/* c8 ignore stop */ - -/** - * @param {string} name - * @return {boolean} - */ -/* c8 ignore next */ -export const hasParam = (name) => computeParams().has(name) - -/** - * @param {string} name - * @param {string} defaultVal - * @return {string} - */ -/* c8 ignore next 2 */ -export const getParam = (name, defaultVal) => - computeParams().get(name) || defaultVal - -/** - * @param {string} name - * @return {string|null} - */ -/* c8 ignore next 4 */ -export const getVariable = (name) => - isNode - ? conditions.undefinedToNull(process.env[name.toUpperCase().replaceAll('-', '_')]) - : conditions.undefinedToNull(storage.varStorage.getItem(name)) - -/** - * @param {string} name - * @return {string|null} - */ -/* c8 ignore next 2 */ -export const getConf = (name) => - computeParams().get('--' + name) || getVariable(name) - -/** - * @param {string} name - * @return {string} - */ -/* c8 ignore next 5 */ -export const ensureConf = (name) => { - const c = getConf(name) - if (c == null) throw new Error(`Expected configuration "${name.toUpperCase().replaceAll('-', '_')}"`) - return c -} - -/** - * @param {string} name - * @return {boolean} - */ -/* c8 ignore next 2 */ -export const hasConf = (name) => - hasParam('--' + name) || getVariable(name) !== null - -/* c8 ignore next */ -export const production = hasConf('production') - -/* c8 ignore next 2 */ -const forceColor = isNode && - f.isOneOf(process.env.FORCE_COLOR, ['true', '1', '2']) - -/* c8 ignore start */ -/** - * Color is enabled by default if the terminal supports it. - * - * Explicitly enable color using `--color` parameter - * Disable color using `--no-color` parameter or using `NO_COLOR=1` environment variable. - * `FORCE_COLOR=1` enables color and takes precedence over all. - */ -export const supportsColor = forceColor || ( - !hasParam('--no-colors') && // @todo deprecate --no-colors - !hasConf('no-color') && - (!isNode || process.stdout.isTTY) && ( - !isNode || - hasParam('--color') || - getVariable('COLORTERM') !== null || - (getVariable('TERM') || '').includes('color') - ) -) -/* c8 ignore stop */ diff --git a/yjs-poll/node_modules/lib0/error.d.ts b/yjs-poll/node_modules/lib0/error.d.ts deleted file mode 100644 index e60d1b1..0000000 --- a/yjs-poll/node_modules/lib0/error.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function create(s: string): Error; -export function methodUnimplemented(): never; -export function unexpectedCase(): never; -export function assert(property: boolean): asserts property is true; -//# sourceMappingURL=error.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/error.d.ts.map b/yjs-poll/node_modules/lib0/error.d.ts.map deleted file mode 100644 index 6627e0a..0000000 --- a/yjs-poll/node_modules/lib0/error.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["error.js"],"names":[],"mappings":"AAWO,0BAJI,MAAM,GACL,KAAK,CAGsB;AAOhC,uCAHK,KAAK,CAKhB;AAOM,kCAHK,KAAK,CAKhB;AAMM,iCAHI,OAAO,GACN,QAAQ,QAAQ,IAAI,IAAI,CAE8C"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/error.js b/yjs-poll/node_modules/lib0/error.js deleted file mode 100644 index 2be40e9..0000000 --- a/yjs-poll/node_modules/lib0/error.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Error helpers. - * - * @module error - */ - -/** - * @param {string} s - * @return {Error} - */ -/* c8 ignore next */ -export const create = s => new Error(s) - -/** - * @throws {Error} - * @return {never} - */ -/* c8 ignore next 3 */ -export const methodUnimplemented = () => { - throw create('Method unimplemented') -} - -/** - * @throws {Error} - * @return {never} - */ -/* c8 ignore next 3 */ -export const unexpectedCase = () => { - throw create('Unexpected case') -} - -/** - * @param {boolean} property - * @return {asserts property is true} - */ -export const assert = property => { if (!property) throw create('Assert failed') } diff --git a/yjs-poll/node_modules/lib0/eventloop.d.ts b/yjs-poll/node_modules/lib0/eventloop.d.ts deleted file mode 100644 index 73d266a..0000000 --- a/yjs-poll/node_modules/lib0/eventloop.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -export function enqueue(f: () => void): void; -export function timeout(timeout: number, callback: Function): TimeoutObject; -export function interval(timeout: number, callback: Function): TimeoutObject; -export const Animation: { - new (timeoutId: number): { - _: number; - destroy(): void; - }; -}; -export function animationFrame(cb: (arg0: number) => void): TimeoutObject; -export function idleCallback(cb: Function): TimeoutObject; -export function createDebouncer(timeout: number, triggerAfter?: number): (cb: ((...args: any) => void) | null) => void; -export type TimeoutObject = { - destroy: Function; -}; -//# sourceMappingURL=eventloop.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/eventloop.d.ts.map b/yjs-poll/node_modules/lib0/eventloop.d.ts.map deleted file mode 100644 index a68f4da..0000000 --- a/yjs-poll/node_modules/lib0/eventloop.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"eventloop.d.ts","sourceRoot":"","sources":["eventloop.js"],"names":[],"mappings":"AAyBO,2BAFI,MAAW,IAAI,QAOzB;AA8BM,iCAJI,MAAM,uBAEL,aAAa,CAE+D;AASjF,kCAJI,MAAM,uBAEL,aAAa,CAEkE;AAG3F;oBA9Ba,MAAM;;;;EA8B0G;AAOtH,mCAJI,CAAS,IAAM,EAAN,MAAM,KAAE,IAAI,GACpB,aAAa,CAGmH;AAcrI,4CAJK,aAAa,CAI2G;AAO7H,yCAJI,MAAM,iBACN,MAAM,IAaR,IAHI,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,KAAG,IAAI,CAAC,OAGxB,UAiBV"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/eventloop.js b/yjs-poll/node_modules/lib0/eventloop.js deleted file mode 100644 index f2d598f..0000000 --- a/yjs-poll/node_modules/lib0/eventloop.js +++ /dev/null @@ -1,128 +0,0 @@ -/* global requestIdleCallback, requestAnimationFrame, cancelIdleCallback, cancelAnimationFrame */ - -import * as time from './time.js' - -/** - * Utility module to work with EcmaScript's event loop. - * - * @module eventloop - */ - -/** - * @type {Array} - */ -let queue = [] - -const _runQueue = () => { - for (let i = 0; i < queue.length; i++) { - queue[i]() - } - queue = [] -} - -/** - * @param {function():void} f - */ -export const enqueue = f => { - queue.push(f) - if (queue.length === 1) { - setTimeout(_runQueue, 0) - } -} - -/** - * @typedef {Object} TimeoutObject - * @property {function} TimeoutObject.destroy - */ - -/** - * @param {function(number):void} clearFunction - */ -const createTimeoutClass = clearFunction => class TT { - /** - * @param {number} timeoutId - */ - constructor (timeoutId) { - this._ = timeoutId - } - - destroy () { - clearFunction(this._) - } -} - -const Timeout = createTimeoutClass(clearTimeout) - -/** - * @param {number} timeout - * @param {function} callback - * @return {TimeoutObject} - */ -export const timeout = (timeout, callback) => new Timeout(setTimeout(callback, timeout)) - -const Interval = createTimeoutClass(clearInterval) - -/** - * @param {number} timeout - * @param {function} callback - * @return {TimeoutObject} - */ -export const interval = (timeout, callback) => new Interval(setInterval(callback, timeout)) - -/* c8 ignore next */ -export const Animation = createTimeoutClass(arg => typeof requestAnimationFrame !== 'undefined' && cancelAnimationFrame(arg)) - -/** - * @param {function(number):void} cb - * @return {TimeoutObject} - */ -/* c8 ignore next */ -export const animationFrame = cb => typeof requestAnimationFrame === 'undefined' ? timeout(0, cb) : new Animation(requestAnimationFrame(cb)) - -/* c8 ignore next */ -// @ts-ignore -const Idle = createTimeoutClass(arg => typeof cancelIdleCallback !== 'undefined' && cancelIdleCallback(arg)) - -/** - * Note: this is experimental and is probably only useful in browsers. - * - * @param {function} cb - * @return {TimeoutObject} - */ -/* c8 ignore next 2 */ -// @ts-ignore -export const idleCallback = cb => typeof requestIdleCallback !== 'undefined' ? new Idle(requestIdleCallback(cb)) : timeout(1000, cb) - -/** - * @param {number} timeout Timeout of the debounce action - * @param {number} triggerAfter Optional. Trigger callback after a certain amount of time - * without waiting for debounce. - */ -export const createDebouncer = (timeout, triggerAfter = -1) => { - let timer = -1 - /** - * @type {number?} - */ - let lastCall = null - /** - * @param {((...args: any)=>void)?} cb function to trigger after debounce. If null, it will reset the - * debounce. - */ - return cb => { - clearTimeout(timer) - if (cb) { - if (triggerAfter >= 0) { - const now = time.getUnixTime() - if (lastCall === null) lastCall = now - if (now - lastCall > triggerAfter) { - lastCall = null - timer = /** @type {any} */ (setTimeout(cb, 0)) - return - } - } - timer = /** @type {any} */ (setTimeout(() => { lastCall = null; cb() }, timeout)) - } else { - lastCall = null - } - } -} diff --git a/yjs-poll/node_modules/lib0/eventloop.test.d.ts b/yjs-poll/node_modules/lib0/eventloop.test.d.ts deleted file mode 100644 index a5ff2f2..0000000 --- a/yjs-poll/node_modules/lib0/eventloop.test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export function testEventloopOrder(_tc: t.TestCase): Promise<[void, void]>; -export function testTimeout(_tc: t.TestCase): Promise; -export function testInterval(_tc: t.TestCase): Promise; -export function testAnimationFrame(_tc: t.TestCase): Promise; -export function testIdleCallback(_tc: t.TestCase): Promise; -export function testDebouncer(_tc: t.TestCase): Promise; -export function testDebouncerTriggerAfter(_tc: t.TestCase): Promise; -export function testDebouncerClear(_tc: t.TestCase): Promise; -import * as t from './testing.js'; -//# sourceMappingURL=eventloop.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/eventloop.test.d.ts.map b/yjs-poll/node_modules/lib0/eventloop.test.d.ts.map deleted file mode 100644 index 2c13d32..0000000 --- a/yjs-poll/node_modules/lib0/eventloop.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"eventloop.test.d.ts","sourceRoot":"","sources":["eventloop.test.js"],"names":[],"mappings":"AAOO,wCAFI,CAAC,CAAC,QAAQ,yBAkBpB;AAKM,iCAFI,CAAC,CAAC,QAAQ,iBAYpB;AAKM,kCAFI,CAAC,CAAC,QAAQ,iBAepB;AAKM,wCAFI,CAAC,CAAC,QAAQ,iBAOpB;AAKM,sCAFI,CAAC,CAAC,QAAQ,iBAMpB;AAKM,mCAFI,CAAC,CAAC,QAAQ,iBAcpB;AAKM,+CAFI,CAAC,CAAC,QAAQ,iBAyBpB;AAKM,wCAFI,CAAC,CAAC,QAAQ,iBAyBpB;mBAnJkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/function.d.ts b/yjs-poll/node_modules/lib0/function.d.ts deleted file mode 100644 index 1bd353e..0000000 --- a/yjs-poll/node_modules/lib0/function.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -export function callAll(fs: Array, args: Array, i?: number): void; -export function nop(): void; -export function apply(f: () => T): T; -export function id(a: A): A; -export function equalityStrict(a: T, b: T): boolean; -export function equalityFlat(a: Array | object, b: Array | object): boolean; -export function equalityDeep(a: any, b: any): boolean; -export function isOneOf(value: V, options: Array): boolean; -export const isArray: (arg: any) => arg is any[]; -export function isString(s: any): s is string; -export function isNumber(n: any): n is number; -export function is any>(n: any, T: TYPE): n is InstanceType; -export function isTemplate any>(T: TYPE): ( -/** - * @param {any} n - * @return {n is InstanceType} - **/ -n: any) => n is InstanceType; -//# sourceMappingURL=function.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/function.d.ts.map b/yjs-poll/node_modules/lib0/function.d.ts.map deleted file mode 100644 index 419b734..0000000 --- a/yjs-poll/node_modules/lib0/function.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["function.js"],"names":[],"mappings":"AAgBO,4BAHI,KAAK,UAAU,QACf,KAAK,CAAC,GAAG,CAAC,oBAYpB;AAEM,4BAAoB;AAOpB,sBAJM,CAAC,KACH,MAAW,CAAC,GACX,CAAC,CAEgB;AAQtB,mBALM,CAAC,KAEH,CAAC,GACA,CAAC,CAEW;AASjB,+BANM,CAAC,KAEH,CAAC,KACD,CAAC,GACA,OAAO,CAE4B;AASxC,6BANM,CAAC,KAEH,KAAK,CAAC,CAAC,CAAC,GAAC,MAAM,KACf,KAAK,CAAC,CAAC,CAAC,GAAC,MAAM,GACd,OAAO,CAEyN;AASrO,gCAJI,GAAG,KACH,GAAG,GACF,OAAO,CA2ElB;AAUM,wBAPM,CAAC,EACG,IAAI,SAAP,CAAE,SAEL,CAAC,WACD,KAAK,CAAC,IAAI,CAAC,WAG4C;AAGlE,iDAAoC;AAM7B,4BAHI,GAAG,GACF,CAAC,UAAU,CAEqC;AAMrD,4BAHI,GAAG,GACF,CAAC,UAAU,CAE2C;AAQ3D,mBAL2C,IAAI,SAAxC,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,KAAK,GAAI,KACtC,GAAG,KACH,IAAI,GACH,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,CAEiB;AAM7C,2BAH2C,IAAI,SAAxC,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,KAAK,GAAI,KACtC,IAAI;AAGb;;;IAGI;AACJ,GAHW,GAGV,KAFW,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,CAEN"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/function.js b/yjs-poll/node_modules/lib0/function.js deleted file mode 100644 index 77d4370..0000000 --- a/yjs-poll/node_modules/lib0/function.js +++ /dev/null @@ -1,188 +0,0 @@ -/** - * Common functions and function call helpers. - * - * @module function - */ - -import * as array from './array.js' -import * as object from './object.js' -import * as equalityTrait from './trait/equality.js' - -/** - * Calls all functions in `fs` with args. Only throws after all functions were called. - * - * @param {Array} fs - * @param {Array} args - */ -export const callAll = (fs, args, i = 0) => { - try { - for (; i < fs.length; i++) { - fs[i](...args) - } - } finally { - if (i < fs.length) { - callAll(fs, args, i + 1) - } - } -} - -export const nop = () => {} - -/** - * @template T - * @param {function():T} f - * @return {T} - */ -export const apply = f => f() - -/** - * @template A - * - * @param {A} a - * @return {A} - */ -export const id = a => a - -/** - * @template T - * - * @param {T} a - * @param {T} b - * @return {boolean} - */ -export const equalityStrict = (a, b) => a === b - -/** - * @template T - * - * @param {Array|object} a - * @param {Array|object} b - * @return {boolean} - */ -export const equalityFlat = (a, b) => a === b || (a != null && b != null && a.constructor === b.constructor && ((array.isArray(a) && array.equalFlat(a, /** @type {Array} */ (b))) || (typeof a === 'object' && object.equalFlat(a, b)))) - -/* c8 ignore start */ - -/** - * @param {any} a - * @param {any} b - * @return {boolean} - */ -export const equalityDeep = (a, b) => { - if (a === b) { - return true - } - if (a == null || b == null || (a.constructor !== b.constructor && (a.constructor || Object) !== (b.constructor || Object))) { - return false - } - if (a[equalityTrait.EqualityTraitSymbol] != null) { - return a[equalityTrait.EqualityTraitSymbol](b) - } - switch (a.constructor) { - case ArrayBuffer: - a = new Uint8Array(a) - b = new Uint8Array(b) - // eslint-disable-next-line no-fallthrough - case Uint8Array: { - if (a.byteLength !== b.byteLength) { - return false - } - for (let i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false - } - } - break - } - case Set: { - if (a.size !== b.size) { - return false - } - for (const value of a) { - if (!b.has(value)) { - return false - } - } - break - } - case Map: { - if (a.size !== b.size) { - return false - } - for (const key of a.keys()) { - if (!b.has(key) || !equalityDeep(a.get(key), b.get(key))) { - return false - } - } - break - } - case undefined: - case Object: - if (object.size(a) !== object.size(b)) { - return false - } - for (const key in a) { - if (!object.hasProperty(a, key) || !equalityDeep(a[key], b[key])) { - return false - } - } - break - case Array: - if (a.length !== b.length) { - return false - } - for (let i = 0; i < a.length; i++) { - if (!equalityDeep(a[i], b[i])) { - return false - } - } - break - default: - return false - } - return true -} - -/** - * @template V - * @template {V} OPTS - * - * @param {V} value - * @param {Array} options - */ -// @ts-ignore -export const isOneOf = (value, options) => options.includes(value) -/* c8 ignore stop */ - -export const isArray = array.isArray - -/** - * @param {any} s - * @return {s is String} - */ -export const isString = (s) => s && s.constructor === String - -/** - * @param {any} n - * @return {n is Number} - */ -export const isNumber = n => n != null && n.constructor === Number - -/** - * @template {abstract new (...args: any) => any} TYPE - * @param {any} n - * @param {TYPE} T - * @return {n is InstanceType} - */ -export const is = (n, T) => n && n.constructor === T - -/** - * @template {abstract new (...args: any) => any} TYPE - * @param {TYPE} T - */ -export const isTemplate = (T) => - /** - * @param {any} n - * @return {n is InstanceType} - **/ - n => n && n.constructor === T diff --git a/yjs-poll/node_modules/lib0/function.test.d.ts b/yjs-poll/node_modules/lib0/function.test.d.ts deleted file mode 100644 index 8d7b277..0000000 --- a/yjs-poll/node_modules/lib0/function.test.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function testBasics(_tc: t.TestCase): void; -export function testCallAll(_tc: t.TestCase): void; -export function testDeepEquality(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=function.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/function.test.d.ts.map b/yjs-poll/node_modules/lib0/function.test.d.ts.map deleted file mode 100644 index 2a1bd5e..0000000 --- a/yjs-poll/node_modules/lib0/function.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"function.test.d.ts","sourceRoot":"","sources":["function.test.js"],"names":[],"mappings":"AAMO,gCAFI,CAAC,CAAC,QAAQ,QA+CpB;AAKM,iCAFI,CAAC,CAAC,QAAQ,QAuBpB;AAKM,sCAFI,CAAC,CAAC,QAAQ,QAkEpB;mBAjJkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/hash/rabin-gf2-polynomial.d.ts b/yjs-poll/node_modules/lib0/hash/rabin-gf2-polynomial.d.ts deleted file mode 100644 index d6d03d6..0000000 --- a/yjs-poll/node_modules/lib0/hash/rabin-gf2-polynomial.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * This is a GF2 Polynomial abstraction that is not meant for production! - * - * It is easy to understand and it's correctness is as obvious as possible. It can be used to verify - * efficient implementations of algorithms on GF2. - */ -export class GF2Polynomial { - /** - * @type {Set} - */ - degrees: Set; -} -export function createFromBytes(bytes: Uint8Array): GF2Polynomial; -export function toUint8Array(p: GF2Polynomial, byteLength?: number): Uint8Array; -export function createFromUint(uint: number): GF2Polynomial; -export function createRandom(degree: number): GF2Polynomial; -export function getHighestDegree(p: GF2Polynomial): number; -export function addInto(p1: GF2Polynomial, p2: GF2Polynomial): void; -export function orInto(p1: GF2Polynomial, p2: GF2Polynomial): void; -export function add(p1: GF2Polynomial, p2: GF2Polynomial): GF2Polynomial; -export function clone(p: GF2Polynomial): GF2Polynomial; -export function addDegreeInto(p: GF2Polynomial, degree: number): void; -export function multiply(p1: GF2Polynomial, p2: GF2Polynomial): GF2Polynomial; -export function shiftLeft(p: GF2Polynomial, shift: number): GF2Polynomial; -export function mod(p1: GF2Polynomial, p2: GF2Polynomial): GF2Polynomial; -export function modPow(p: GF2Polynomial, e: number, m: GF2Polynomial): GF2Polynomial; -export function gcd(p1: GF2Polynomial, p2: GF2Polynomial): GF2Polynomial; -export function equals(p1: GF2Polynomial, p2: GF2Polynomial): boolean; -export function isIrreducibleBenOr(p: GF2Polynomial): boolean; -export function createIrreducible(degree: number): GF2Polynomial; -export function fingerprint(buf: Uint8Array, m: GF2Polynomial): Uint8Array; -export class RabinPolynomialEncoder { - /** - * @param {GF2Polynomial} m The irreducible polynomial - */ - constructor(m: GF2Polynomial); - fingerprint: GF2Polynomial; - m: GF2Polynomial; - /** - * @param {number} b - */ - write(b: number): void; - getFingerprint(): Uint8Array; -} -//# sourceMappingURL=rabin-gf2-polynomial.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/hash/rabin-gf2-polynomial.d.ts.map b/yjs-poll/node_modules/lib0/hash/rabin-gf2-polynomial.d.ts.map deleted file mode 100644 index c2aad23..0000000 --- a/yjs-poll/node_modules/lib0/hash/rabin-gf2-polynomial.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rabin-gf2-polynomial.d.ts","sourceRoot":"","sources":["rabin-gf2-polynomial.js"],"names":[],"mappings":"AAqBA;;;;;GAKG;AACH;IAEI;;QAEI;IACJ,SAFW,GAAG,CAAC,MAAM,CAAC,CAEE;CAE3B;AAOM,uCAFI,UAAU,iBAcpB;AAQM,gCAHI,aAAa,eACb,MAAM,2BAahB;AAOM,qCAFI,MAAM,iBAQhB;AAOM,qCAFI,MAAM,iBAYhB;AAMM,oCAHI,aAAa,UAG2D;AAU5E,4BAHI,aAAa,MACb,aAAa,QAUvB;AAUM,2BAHI,aAAa,MACb,aAAa,QAMvB;AAUM,wBAHI,aAAa,MACb,aAAa,iBAevB;AASM,yBAFI,aAAa,iBAMvB;AAUM,iCAHI,aAAa,UACb,MAAM,QAQhB;AAQM,6BAHI,aAAa,MACb,aAAa,iBAUvB;AAQM,6BAHI,aAAa,SACb,MAAM,iBAShB;AAQM,wBAHI,aAAa,MACb,aAAa,iBAavB;AAWM,0BAJI,aAAa,KACb,MAAM,KACN,aAAa,iBAcvB;AAQM,wBAHI,aAAa,MACb,aAAa,iBASvB;AAQM,2BAHI,aAAa,MACb,aAAa,WAQvB;AAgCM,sCAFI,aAAa,WAYvB;AAKM,0CAFI,MAAM,iBAOhB;AAQM,iCAHI,UAAU,KACV,aAAa,2BAE0G;AAElI;IACE;;OAEG;IACH,eAFW,aAAa,EAKvB;IAFC,2BAAsC;IACtC,iBAAU;IAGZ;;OAEG;IACH,SAFW,MAAM,QAOhB;IAED,0CAEC;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/hash/rabin-gf2-polynomial.js b/yjs-poll/node_modules/lib0/hash/rabin-gf2-polynomial.js deleted file mode 100644 index 6ae87b2..0000000 --- a/yjs-poll/node_modules/lib0/hash/rabin-gf2-polynomial.js +++ /dev/null @@ -1,379 +0,0 @@ -/** - * The idea of the Rabin fingerprint algorithm is to represent the binary as a polynomial in a - * finite field (Galois Field G(2)). The polynomial will then be taken "modulo" by an irreducible - * polynomial of the desired size. - * - * This implementation is inefficient and is solely used to verify the actually performant - * implementation in `./rabin.js`. - * - * @module rabin-gf2-polynomial - */ - -import * as math from '../math.js' -import * as webcrypto from 'lib0/webcrypto' -import * as array from '../array.js' -import * as buffer from '../buffer.js' - -/** - * @param {number} degree - */ -const _degreeToMinByteLength = degree => math.floor(degree / 8) + 1 - -/** - * This is a GF2 Polynomial abstraction that is not meant for production! - * - * It is easy to understand and it's correctness is as obvious as possible. It can be used to verify - * efficient implementations of algorithms on GF2. - */ -export class GF2Polynomial { - constructor () { - /** - * @type {Set} - */ - this.degrees = new Set() - } -} - -/** - * From Uint8Array (MSB). - * - * @param {Uint8Array} bytes - */ -export const createFromBytes = bytes => { - const p = new GF2Polynomial() - for (let bsi = bytes.length - 1, currDegree = 0; bsi >= 0; bsi--) { - const currByte = bytes[bsi] - for (let i = 0; i < 8; i++) { - if (((currByte >>> i) & 1) === 1) { - p.degrees.add(currDegree) - } - currDegree++ - } - } - return p -} - -/** - * Transform to Uint8Array (MSB). - * - * @param {GF2Polynomial} p - * @param {number} byteLength - */ -export const toUint8Array = (p, byteLength = _degreeToMinByteLength(getHighestDegree(p))) => { - const buf = buffer.createUint8ArrayFromLen(byteLength) - /** - * @param {number} i - */ - const setBit = i => { - const bi = math.floor(i / 8) - buf[buf.length - 1 - bi] |= (1 << (i % 8)) - } - p.degrees.forEach(setBit) - return buf -} - -/** - * Create from unsigned integer (max 32bit uint) - read most-significant-byte first. - * - * @param {number} uint - */ -export const createFromUint = uint => { - const buf = new Uint8Array(4) - for (let i = 0; i < 4; i++) { - buf[i] = uint >>> 8 * (3 - i) - } - return createFromBytes(buf) -} - -/** - * Create a random polynomial of a specified degree. - * - * @param {number} degree - */ -export const createRandom = degree => { - const bs = new Uint8Array(_degreeToMinByteLength(degree)) - webcrypto.getRandomValues(bs) - // Get first byte and explicitly set the bit of "degree" to 1 (the result must have the specified - // degree). - const firstByte = bs[0] | 1 << (degree % 8) - // Find out how many bits of the first byte need to be filled with zeros because they are >degree. - const zeros = 7 - (degree % 8) - bs[0] = ((firstByte << zeros) & 0xff) >>> zeros - return createFromBytes(bs) -} - -/** - * @param {GF2Polynomial} p - * @return number - */ -export const getHighestDegree = p => array.fold(array.from(p.degrees), 0, math.max) - -/** - * Add (+) p2 int the p1 polynomial. - * - * Addition is defined as xor in F2. Substraction is equivalent to addition in F2. - * - * @param {GF2Polynomial} p1 - * @param {GF2Polynomial} p2 - */ -export const addInto = (p1, p2) => { - p2.degrees.forEach(degree => { - if (p1.degrees.has(degree)) { - p1.degrees.delete(degree) - } else { - p1.degrees.add(degree) - } - }) -} - -/** - * Or (|) p2 into the p1 polynomial. - * - * Addition is defined as xor in F2. Substraction is equivalent to addition in F2. - * - * @param {GF2Polynomial} p1 - * @param {GF2Polynomial} p2 - */ -export const orInto = (p1, p2) => { - p2.degrees.forEach(degree => { - p1.degrees.add(degree) - }) -} - -/** - * Add (+) p2 to the p1 polynomial. - * - * Addition is defined as xor in F2. Substraction is equivalent to addition in F2. - * - * @param {GF2Polynomial} p1 - * @param {GF2Polynomial} p2 - */ -export const add = (p1, p2) => { - const result = new GF2Polynomial() - p2.degrees.forEach(degree => { - if (!p1.degrees.has(degree)) { - result.degrees.add(degree) - } - }) - p1.degrees.forEach(degree => { - if (!p2.degrees.has(degree)) { - result.degrees.add(degree) - } - }) - return result -} - -/** - * Add (+) p2 to the p1 polynomial. - * - * Addition is defined as xor in F2. Substraction is equivalent to addition in F2. - * - * @param {GF2Polynomial} p - */ -export const clone = (p) => { - const result = new GF2Polynomial() - p.degrees.forEach(d => result.degrees.add(d)) - return result -} - -/** - * Add (+) p2 to the p1 polynomial. - * - * Addition is defined as xor in F2. Substraction is equivalent to addition in F2. - * - * @param {GF2Polynomial} p - * @param {number} degree - */ -export const addDegreeInto = (p, degree) => { - if (p.degrees.has(degree)) { - p.degrees.delete(degree) - } else { - p.degrees.add(degree) - } -} - -/** - * Multiply (•) p1 with p2 and store the result in p1. - * - * @param {GF2Polynomial} p1 - * @param {GF2Polynomial} p2 - */ -export const multiply = (p1, p2) => { - const result = new GF2Polynomial() - p1.degrees.forEach(degree1 => { - p2.degrees.forEach(degree2 => { - addDegreeInto(result, degree1 + degree2) - }) - }) - return result -} - -/** - * Multiply (•) p1 with p2 and store the result in p1. - * - * @param {GF2Polynomial} p - * @param {number} shift - */ -export const shiftLeft = (p, shift) => { - const result = new GF2Polynomial() - p.degrees.forEach(degree => { - const r = degree + shift - r >= 0 && result.degrees.add(r) - }) - return result -} - -/** - * Computes p1 % p2. I.e. the remainder of p1/p2. - * - * @param {GF2Polynomial} p1 - * @param {GF2Polynomial} p2 - */ -export const mod = (p1, p2) => { - const maxDeg1 = getHighestDegree(p1) - const maxDeg2 = getHighestDegree(p2) - const result = clone(p1) - for (let i = maxDeg1 - maxDeg2; i >= 0; i--) { - if (result.degrees.has(maxDeg2 + i)) { - const shifted = shiftLeft(p2, i) - addInto(result, shifted) - } - } - return result -} - -/** - * Computes (p^e mod m). - * - * http://en.wikipedia.org/wiki/Modular_exponentiation - * - * @param {GF2Polynomial} p - * @param {number} e - * @param {GF2Polynomial} m - */ -export const modPow = (p, e, m) => { - let result = ONE - while (true) { - if ((e & 1) === 1) { - result = mod(multiply(result, p), m) - } - e >>>= 1 - if (e === 0) { - return result - } - p = mod(multiply(p, p), m) - } -} - -/** - * Find the greatest common divisor using Euclid's Algorithm. - * - * @param {GF2Polynomial} p1 - * @param {GF2Polynomial} p2 - */ -export const gcd = (p1, p2) => { - while (p2.degrees.size > 0) { - const modded = mod(p1, p2) - p1 = p2 - p2 = modded - } - return p1 -} - -/** - * true iff p1 equals p2 - * - * @param {GF2Polynomial} p1 - * @param {GF2Polynomial} p2 - */ -export const equals = (p1, p2) => { - if (p1.degrees.size !== p2.degrees.size) return false - for (const d of p1.degrees) { - if (!p2.degrees.has(d)) return false - } - return true -} - -const X = createFromBytes(new Uint8Array([2])) -const ONE = createFromBytes(new Uint8Array([1])) - -/** - * Computes ( x^(2^p) - x ) mod f - * - * (shamelessly copied from - * https://github.com/opendedup/rabinfingerprint/blob/master/src/org/rabinfingerprint/polynomial/Polynomial.java) - * - * @param {GF2Polynomial} f - * @param {number} p - */ -const reduceExponent = (f, p) => { - // compute (x^q^p mod f) - const q2p = math.pow(2, p) - const x2q2p = modPow(X, q2p, f) - // subtract (x mod f) - return mod(add(x2q2p, X), f) -} - -/** - * BenOr Reducibility Test - * - * Tests and Constructions of Irreducible Polynomials over Finite Fields - * (1997) Shuhong Gao, Daniel Panario - * - * http://citeseer.ist.psu.edu/cache/papers/cs/27167/http:zSzzSzwww.math.clemson.eduzSzfacultyzSzGaozSzpaperszSzGP97a.pdf/gao97tests.pdf - * - * @param {GF2Polynomial} p - */ -export const isIrreducibleBenOr = p => { - const degree = getHighestDegree(p) - for (let i = 1; i < degree / 2; i++) { - const b = reduceExponent(p, i) - const g = gcd(p, b) - if (!equals(g, ONE)) { - return false - } - } - return true -} - -/** - * @param {number} degree - */ -export const createIrreducible = degree => { - while (true) { - const p = createRandom(degree) - if (isIrreducibleBenOr(p)) return p - } -} - -/** - * Create a fingerprint of buf using the irreducible polynomial m. - * - * @param {Uint8Array} buf - * @param {GF2Polynomial} m - */ -export const fingerprint = (buf, m) => toUint8Array(mod(createFromBytes(buf), m), _degreeToMinByteLength(getHighestDegree(m) - 1)) - -export class RabinPolynomialEncoder { - /** - * @param {GF2Polynomial} m The irreducible polynomial - */ - constructor (m) { - this.fingerprint = new GF2Polynomial() - this.m = m - } - - /** - * @param {number} b - */ - write (b) { - const bp = createFromBytes(new Uint8Array([b])) - const fingerprint = shiftLeft(this.fingerprint, 8) - orInto(fingerprint, bp) - this.fingerprint = mod(fingerprint, this.m) - } - - getFingerprint () { - return toUint8Array(this.fingerprint, _degreeToMinByteLength(getHighestDegree(this.m) - 1)) - } -} diff --git a/yjs-poll/node_modules/lib0/hash/rabin-uncached.d.ts b/yjs-poll/node_modules/lib0/hash/rabin-uncached.d.ts deleted file mode 100644 index 5adc6e2..0000000 --- a/yjs-poll/node_modules/lib0/hash/rabin-uncached.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -export class RabinUncachedEncoder { - /** - * @param {Uint8Array} m assert(m[0] === 1) - */ - constructor(m: Uint8Array); - m: Uint8Array; - blen: number; - bs: Uint8Array; - /** - * This describes the position of the most significant byte (starts with 0 and increases with - * shift) - */ - bpos: number; - /** - * Add/Xor/Substract bytes. - * - * Discards bytes that are out of range. - * @todo put this in function or inline - * - * @param {Uint8Array} cs - */ - add(cs: Uint8Array): void; - /** - * @param {number} byte - */ - write(byte: number): void; - getFingerprint(): Uint8Array; -} -//# sourceMappingURL=rabin-uncached.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/hash/rabin-uncached.d.ts.map b/yjs-poll/node_modules/lib0/hash/rabin-uncached.d.ts.map deleted file mode 100644 index 06473af..0000000 --- a/yjs-poll/node_modules/lib0/hash/rabin-uncached.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rabin-uncached.d.ts","sourceRoot":"","sources":["rabin-uncached.js"],"names":[],"mappings":"AAUA;IACE;;OAEG;IACH,eAFW,UAAU,EAWpB;IARC,+BAAU;IACV,aAAwB;IACxB,4BAAmC;IACnC;;;OAGG;IACH,aAAa;IAGf;;;;;;;OAOG;IACH,QAFW,UAAU,QAQpB;IAED;;OAEG;IACH,YAFW,MAAM,QAgBhB;IAED,0CAMC;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/hash/rabin-uncached.js b/yjs-poll/node_modules/lib0/hash/rabin-uncached.js deleted file mode 100644 index f40da97..0000000 --- a/yjs-poll/node_modules/lib0/hash/rabin-uncached.js +++ /dev/null @@ -1,68 +0,0 @@ -/** - * It is not recommended to use this package. This is the uncached implementation of the rabin - * fingerprint algorithm. However, it can be used to verify the `rabin.js` implementation. - * - * @module rabin-uncached - */ - -import * as math from '../math.js' -import * as buffer from '../buffer.js' - -export class RabinUncachedEncoder { - /** - * @param {Uint8Array} m assert(m[0] === 1) - */ - constructor (m) { - this.m = m - this.blen = m.byteLength - this.bs = new Uint8Array(this.blen) - /** - * This describes the position of the most significant byte (starts with 0 and increases with - * shift) - */ - this.bpos = 0 - } - - /** - * Add/Xor/Substract bytes. - * - * Discards bytes that are out of range. - * @todo put this in function or inline - * - * @param {Uint8Array} cs - */ - add (cs) { - const copyLen = math.min(this.blen, cs.byteLength) - // copy from right to left until max is reached - for (let i = 0; i < copyLen; i++) { - this.bs[(this.bpos + this.blen - i - 1) % this.blen] ^= cs[cs.byteLength - i - 1] - } - } - - /** - * @param {number} byte - */ - write (byte) { - // [0,m1,m2,b] - // x <- bpos - // Shift one byte to the left, add b - this.bs[this.bpos] = byte - this.bpos = (this.bpos + 1) % this.blen - // mod - for (let i = 7; i >= 0; i--) { - if (((this.bs[this.bpos] >>> i) & 1) === 1) { - this.add(buffer.shiftNBitsLeft(this.m, i)) - } - } - // if (this.bs[this.bpos] !== 0) { error.unexpectedCase() } - // assert(this.bs[this.bpos] === 0) - } - - getFingerprint () { - const result = new Uint8Array(this.blen - 1) - for (let i = 0; i < result.byteLength; i++) { - result[i] = this.bs[(this.bpos + i + 1) % this.blen] - } - return result - } -} diff --git a/yjs-poll/node_modules/lib0/hash/rabin.d.ts b/yjs-poll/node_modules/lib0/hash/rabin.d.ts deleted file mode 100644 index cd3061a..0000000 --- a/yjs-poll/node_modules/lib0/hash/rabin.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -export const StandardIrreducible8: Uint8Array; -export const StandardIrreducible16: Uint8Array; -export const StandardIrreducible32: Uint8Array; -export const StandardIrreducible64: Uint8Array; -export const StandardIrreducible128: Uint8Array; -export class RabinEncoder { - /** - * @param {Uint8Array} m assert(m[0] === 1) - */ - constructor(m: Uint8Array); - m: Uint8Array; - blen: number; - bs: Uint8Array; - cache: Uint8Array; - /** - * This describes the position of the most significant byte (starts with 0 and increases with - * shift) - */ - bpos: number; - /** - * @param {number} byte - */ - write(byte: number): void; - getFingerprint(): Uint8Array; -} -export function fingerprint(irreducible: Uint8Array, data: Uint8Array): Uint8Array; -//# sourceMappingURL=rabin.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/hash/rabin.d.ts.map b/yjs-poll/node_modules/lib0/hash/rabin.d.ts.map deleted file mode 100644 index 108c536..0000000 --- a/yjs-poll/node_modules/lib0/hash/rabin.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rabin.d.ts","sourceRoot":"","sources":["rabin.js"],"names":[],"mappings":"AAUA,2DAA4D;AAC5D,4DAAkE;AAClE,4DAA4E;AAC5E,4DAA+F;AAC/F,6DAAmI;AAmCnI;IACE;;OAEG;IACH,eAFW,UAAU,EAYpB;IATC,+BAAU;IACV,aAAwB;IACxB,4BAAmC;IACnC,+BAA2B;IAC3B;;;OAGG;IACH,aAAa;IAGf;;OAEG;IACH,YAFW,MAAM,QAYhB;IAED,0CAMC;CACF;AAMM,yCAHI,UAAU,QACV,UAAU,2BAQpB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/hash/rabin.js b/yjs-poll/node_modules/lib0/hash/rabin.js deleted file mode 100644 index d5690f1..0000000 --- a/yjs-poll/node_modules/lib0/hash/rabin.js +++ /dev/null @@ -1,100 +0,0 @@ -/** - * @module rabin - * - * Very efficient & versatile fingerprint/hashing algorithm. However, it is not cryptographically - * secure. Well suited for fingerprinting. - */ - -import * as buffer from '../buffer.js' -import * as map from '../map.js' - -export const StandardIrreducible8 = new Uint8Array([1, 221]) -export const StandardIrreducible16 = new Uint8Array([1, 244, 157]) -export const StandardIrreducible32 = new Uint8Array([1, 149, 183, 205, 191]) -export const StandardIrreducible64 = new Uint8Array([1, 133, 250, 114, 193, 250, 28, 193, 231]) -export const StandardIrreducible128 = new Uint8Array([1, 94, 109, 166, 228, 6, 222, 102, 239, 27, 128, 184, 13, 50, 112, 169, 199]) - -/** - * Maps from a modulo to the precomputed values. - * - * @type {Map} - */ -const _precomputedFingerprintCache = new Map() - -/** - * @param {Uint8Array} m - */ -const ensureCache = m => map.setIfUndefined(_precomputedFingerprintCache, buffer.toBase64(m), () => { - const byteLen = m.byteLength - const cache = new Uint8Array(256 * byteLen) - // Use dynamic computing to compute the cached results. - // Starting values: cache(0) = 0; cache(1) = m - cache.set(m, byteLen) - for (let bit = 1; bit < 8; bit++) { - const mBitShifted = buffer.shiftNBitsLeft(m, bit) - const bitShifted = 1 << bit - for (let j = 0; j < bitShifted; j++) { - // apply the shifted result (reducing the degree of the polynomial) - const msb = bitShifted | j - const rest = msb ^ mBitShifted[0] - for (let i = 0; i < byteLen; i++) { - // rest is already precomputed in the cache - cache[msb * byteLen + i] = cache[rest * byteLen + i] ^ mBitShifted[i] - } - // if (cache[(bitShifted | j) * byteLen] !== (bitShifted | j)) { error.unexpectedCase() } - } - } - return cache -}) - -export class RabinEncoder { - /** - * @param {Uint8Array} m assert(m[0] === 1) - */ - constructor (m) { - this.m = m - this.blen = m.byteLength - this.bs = new Uint8Array(this.blen) - this.cache = ensureCache(m) - /** - * This describes the position of the most significant byte (starts with 0 and increases with - * shift) - */ - this.bpos = 0 - } - - /** - * @param {number} byte - */ - write (byte) { - // assert(this.bs[0] === 0) - // Shift one byte to the left, add b - this.bs[this.bpos] = byte - this.bpos = (this.bpos + 1) % this.blen - const msb = this.bs[this.bpos] - for (let i = 0; i < this.blen; i++) { - this.bs[(this.bpos + i) % this.blen] ^= this.cache[msb * this.blen + i] - } - // assert(this.bs[this.bpos] === 0) - } - - getFingerprint () { - const result = new Uint8Array(this.blen - 1) - for (let i = 0; i < result.byteLength; i++) { - result[i] = this.bs[(this.bpos + i + 1) % this.blen] - } - return result - } -} - -/** - * @param {Uint8Array} irreducible - * @param {Uint8Array} data - */ -export const fingerprint = (irreducible, data) => { - const encoder = new RabinEncoder(irreducible) - for (let i = 0; i < data.length; i++) { - encoder.write(data[i]) - } - return encoder.getFingerprint() -} diff --git a/yjs-poll/node_modules/lib0/hash/rabin.test.d.ts b/yjs-poll/node_modules/lib0/hash/rabin.test.d.ts deleted file mode 100644 index 6ed6dd5..0000000 --- a/yjs-poll/node_modules/lib0/hash/rabin.test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export function testPolynomialBasics(_tc: t.TestCase): void; -export function testIrreducibleInput(_tc: t.TestCase): void; -export function testIrreducibleSpread(_tc: t.TestCase): void; -export function testGenerateIrreducibles(_tc: t.TestCase): void; -export function testFingerprintCompatiblity(tc: t.TestCase): void; -export function testConflicts(tc: t.TestCase): void; -import * as t from '../testing.js'; -//# sourceMappingURL=rabin.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/hash/rabin.test.d.ts.map b/yjs-poll/node_modules/lib0/hash/rabin.test.d.ts.map deleted file mode 100644 index ae118d2..0000000 --- a/yjs-poll/node_modules/lib0/hash/rabin.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rabin.test.d.ts","sourceRoot":"","sources":["rabin.test.js"],"names":[],"mappings":"AAaO,0CAFI,CAAC,CAAC,QAAQ,QASpB;AAKM,0CAFI,CAAC,CAAC,QAAQ,QAapB;AAKM,2CAFI,CAAC,CAAC,QAAQ,QASpB;AAwBM,8CAFI,CAAC,CAAC,QAAQ,QAyBpB;AAmGM,gDAFI,CAAC,CAAC,QAAQ,QAQpB;AAKM,kCAFI,CAAC,CAAC,QAAQ,QA4BpB;mBAvOkB,eAAe"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/hash/sha256.d.ts b/yjs-poll/node_modules/lib0/hash/sha256.d.ts deleted file mode 100644 index b3014a7..0000000 --- a/yjs-poll/node_modules/lib0/hash/sha256.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export function digest(data: Uint8Array): Uint8Array; -//# sourceMappingURL=sha256.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/hash/sha256.d.ts.map b/yjs-poll/node_modules/lib0/hash/sha256.d.ts.map deleted file mode 100644 index 666f53e..0000000 --- a/yjs-poll/node_modules/lib0/hash/sha256.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha256.d.ts","sourceRoot":"","sources":["sha256.js"],"names":[],"mappings":"AA+KO,6BAFI,UAAU,2BAEkC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/hash/sha256.js b/yjs-poll/node_modules/lib0/hash/sha256.js deleted file mode 100644 index 170c2bb..0000000 --- a/yjs-poll/node_modules/lib0/hash/sha256.js +++ /dev/null @@ -1,176 +0,0 @@ -/** - * @module sha256 - * Spec: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf - * Resources: - * - https://web.archive.org/web/20150315061807/http://csrc.nist.gov/groups/STM/cavp/documents/shs/sha256-384-512.pdf - */ - -import * as binary from '../binary.js' - -/** - * @param {number} w - a 32bit uint - * @param {number} shift - */ -const rotr = (w, shift) => (w >>> shift) | (w << (32 - shift)) - -/** - * Helper for SHA-224 & SHA-256. See 4.1.2. - * @param {number} x - */ -const sum0to256 = x => rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22) - -/** - * Helper for SHA-224 & SHA-256. See 4.1.2. - * @param {number} x - */ -const sum1to256 = x => rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25) - -/** - * Helper for SHA-224 & SHA-256. See 4.1.2. - * @param {number} x - */ -const sigma0to256 = x => rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3 - -/** - * Helper for SHA-224 & SHA-256. See 4.1.2. - * @param {number} x - */ -const sigma1to256 = x => rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10 - -// @todo don't init these variables globally - -/** - * See 4.2.2: Constant for sha256 & sha224 - * These words represent the first thirty-two bits of the fractional parts of - * the cube roots of the first sixty-four prime numbers. In hex, these constant words are (from left to - * right) - */ -const K = new Uint32Array([ - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 -]) - -/** - * See 5.3.3. Initial hash value. - * - * These words were obtained by taking the first thirty-two bits of the fractional parts of the - * square roots of the first eight prime numbers. - * - * @todo shouldn't be a global variable - */ -const HINIT = new Uint32Array([ - 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 -]) - -// time to beat: (large value < 4.35s) - -class Hasher { - constructor () { - const buf = new ArrayBuffer(64 + 64 * 4) - // Init working variables using a single arraybuffer - this._H = new Uint32Array(buf, 0, 8) - this._H.set(HINIT) - // "Message schedule" - a working variable - this._W = new Uint32Array(buf, 64, 64) - } - - _updateHash () { - const H = this._H - const W = this._W - for (let t = 16; t < 64; t++) { - W[t] = sigma1to256(W[t - 2]) + W[t - 7] + sigma0to256(W[t - 15]) + W[t - 16] - } - let a = H[0] - let b = H[1] - let c = H[2] - let d = H[3] - let e = H[4] - let f = H[5] - let g = H[6] - let h = H[7] - for (let tt = 0, T1, T2; tt < 64; tt++) { - T1 = (h + sum1to256(e) + ((e & f) ^ (~e & g)) + K[tt] + W[tt]) >>> 0 - T2 = (sum0to256(a) + ((a & b) ^ (a & c) ^ (b & c))) >>> 0 - h = g - g = f - f = e - e = (d + T1) >>> 0 - d = c - c = b - b = a - a = (T1 + T2) >>> 0 - } - H[0] += a - H[1] += b - H[2] += c - H[3] += d - H[4] += e - H[5] += f - H[6] += g - H[7] += h - } - - /** - * Returns a 32-byte hash. - * - * @param {Uint8Array} data - */ - digest (data) { - let i = 0 - for (; i + 56 <= data.length;) { - // write data in big endianess - let j = 0 - for (; j < 16 && i + 3 < data.length; j++) { - this._W[j] = data[i++] << 24 | data[i++] << 16 | data[i++] << 8 | data[i++] - } - if (i % 64 !== 0) { // there is still room to write partial content and the ending bit. - this._W.fill(0, j, 16) - while (i < data.length) { - this._W[j] |= data[i] << ((3 - (i % 4)) * 8) - i++ - } - this._W[j] |= binary.BIT8 << ((3 - (i % 4)) * 8) - } - this._updateHash() - } - // same check as earlier - the ending bit has been written - const isPaddedWith1 = i % 64 !== 0 - this._W.fill(0, 0, 16) - let j = 0 - for (; i < data.length; j++) { - for (let ci = 3; ci >= 0 && i < data.length; ci--) { - this._W[j] |= data[i++] << (ci * 8) - } - } - // Write padding of the message. See 5.1.2. - if (!isPaddedWith1) { - this._W[j - (i % 4 === 0 ? 0 : 1)] |= binary.BIT8 << ((3 - (i % 4)) * 8) - } - // write length of message (size in bits) as 64 bit uint - // @todo test that this works correctly - this._W[14] = data.byteLength / binary.BIT30 // same as data.byteLength >>> 30 - but works on floats - this._W[15] = data.byteLength * 8 - this._updateHash() - // correct H endianness to use big endiannes and return a Uint8Array - const dv = new Uint8Array(32) - for (let i = 0; i < this._H.length; i++) { - for (let ci = 0; ci < 4; ci++) { - dv[i * 4 + ci] = this._H[i] >>> (3 - ci) * 8 - } - } - return dv - } -} - -/** - * Returns a 32-byte hash. - * - * @param {Uint8Array} data - */ -export const digest = data => new Hasher().digest(data) diff --git a/yjs-poll/node_modules/lib0/hash/sha256.node.d.ts b/yjs-poll/node_modules/lib0/hash/sha256.node.d.ts deleted file mode 100644 index e5e6591..0000000 --- a/yjs-poll/node_modules/lib0/hash/sha256.node.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export function digest(data: Uint8Array): Buffer; -//# sourceMappingURL=sha256.node.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/hash/sha256.node.d.ts.map b/yjs-poll/node_modules/lib0/hash/sha256.node.d.ts.map deleted file mode 100644 index 50eeb78..0000000 --- a/yjs-poll/node_modules/lib0/hash/sha256.node.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha256.node.d.ts","sourceRoot":"","sources":["sha256.node.js"],"names":[],"mappings":"AAKO,6BAFI,UAAU,2BAMpB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/hash/sha256.node.js b/yjs-poll/node_modules/lib0/hash/sha256.node.js deleted file mode 100644 index 55c3c77..0000000 --- a/yjs-poll/node_modules/lib0/hash/sha256.node.js +++ /dev/null @@ -1,10 +0,0 @@ -import { createHash } from 'node:crypto' - -/** - * @param {Uint8Array} data - */ -export const digest = data => { - const hasher = createHash('sha256') - hasher.update(data) - return hasher.digest() -} diff --git a/yjs-poll/node_modules/lib0/hash/sha256.test.d.ts b/yjs-poll/node_modules/lib0/hash/sha256.test.d.ts deleted file mode 100644 index 39fc538..0000000 --- a/yjs-poll/node_modules/lib0/hash/sha256.test.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function testSelfReferencingHash(_tc: t.TestCase): void; -export function testSha256Basics(_tc: t.TestCase): Promise; -export function testLargeValue(_tc: t.TestCase): Promise; -export function testRepeatSha256Hashing(tc: t.TestCase): Promise; -export function testBenchmarkSha256(_tc: t.TestCase): Promise; -import * as t from '../testing.js'; -//# sourceMappingURL=sha256.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/hash/sha256.test.d.ts.map b/yjs-poll/node_modules/lib0/hash/sha256.test.d.ts.map deleted file mode 100644 index 09f6c9e..0000000 --- a/yjs-poll/node_modules/lib0/hash/sha256.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha256.test.d.ts","sourceRoot":"","sources":["sha256.test.js"],"names":[],"mappings":"AAcO,6CAFI,CAAC,CAAC,QAAQ,QAKpB;AAKM,sCAFI,CAAC,CAAC,QAAQ,iBA2BpB;AAOM,oCAFI,CAAC,CAAC,QAAQ,iBA4BpB;AAKM,4CAFI,CAAC,CAAC,QAAQ,iBAQpB;AAKM,yCAFI,CAAC,CAAC,QAAQ,iBAmDpB;mBAjJkB,eAAe"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/index.d.ts b/yjs-poll/node_modules/lib0/index.d.ts deleted file mode 100644 index 8aa3ac2..0000000 --- a/yjs-poll/node_modules/lib0/index.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import * as array from './array.js'; -import * as binary from './binary.js'; -import * as broadcastchannel from './broadcastchannel.js'; -import * as buffer from './buffer.js'; -import * as conditions from './conditions.js'; -import * as decoding from './decoding.js'; -import * as diff from './diff.js'; -import * as dom from './dom.js'; -import * as encoding from './encoding.js'; -import * as environment from './environment.js'; -import * as error from './error.js'; -import * as eventloop from './eventloop.js'; -import * as func from './function.js'; -import * as indexeddb from './indexeddb.js'; -import * as iterator from './iterator.js'; -import * as json from './json.js'; -import * as logging from 'lib0/logging'; -import * as map from './map.js'; -import * as math from './math.js'; -import * as mutex from './mutex.js'; -import * as number from './number.js'; -import * as object from './object.js'; -import * as pair from './pair.js'; -import * as prng from './prng.js'; -import * as promise from './promise.js'; -import * as set from './set.js'; -import * as sort from './sort.js'; -import * as statistics from './statistics.js'; -import * as string from './string.js'; -import * as symbol from './symbol.js'; -import * as time from './time.js'; -import * as tree from './tree.js'; -import * as websocket from './websocket.js'; -export { array, binary, broadcastchannel, buffer, conditions, decoding, diff, dom, encoding, environment, error, eventloop, func, indexeddb, iterator, json, logging, map, math, mutex, number, object, pair, prng, promise, set, sort, statistics, string, symbol, time, tree, websocket }; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/index.d.ts.map b/yjs-poll/node_modules/lib0/index.d.ts.map deleted file mode 100644 index 1e8cb8e..0000000 --- a/yjs-poll/node_modules/lib0/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"uBAQuB,YAAY;wBACX,aAAa;kCACH,uBAAuB;wBACjC,aAAa;4BACT,iBAAiB;0BACnB,eAAe;sBACnB,WAAW;qBACZ,UAAU;0BACL,eAAe;6BACZ,kBAAkB;uBACxB,YAAY;2BACR,gBAAgB;sBAErB,eAAe;2BACV,gBAAgB;0BACjB,eAAe;sBACnB,WAAW;yBACR,cAAc;qBAClB,UAAU;sBACT,WAAW;uBACV,YAAY;wBACX,aAAa;wBACb,aAAa;sBACf,WAAW;sBACX,WAAW;yBACR,cAAc;qBAElB,UAAU;sBACT,WAAW;4BACL,iBAAiB;wBACrB,aAAa;wBACb,aAAa;sBAEf,WAAW;sBACX,WAAW;2BACN,gBAAgB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/index.js b/yjs-poll/node_modules/lib0/index.js deleted file mode 100644 index 1ea2fdd..0000000 --- a/yjs-poll/node_modules/lib0/index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Experimental method to import lib0. - * - * Not recommended if the module bundler doesn't support dead code elimination. - * - * @module lib0 - */ - -import * as array from './array.js' -import * as binary from './binary.js' -import * as broadcastchannel from './broadcastchannel.js' -import * as buffer from './buffer.js' -import * as conditions from './conditions.js' -import * as decoding from './decoding.js' -import * as diff from './diff.js' -import * as dom from './dom.js' -import * as encoding from './encoding.js' -import * as environment from './environment.js' -import * as error from './error.js' -import * as eventloop from './eventloop.js' -// @todo rename file to func -import * as func from './function.js' -import * as indexeddb from './indexeddb.js' -import * as iterator from './iterator.js' -import * as json from './json.js' -import * as logging from 'lib0/logging' -import * as map from './map.js' -import * as math from './math.js' -import * as mutex from './mutex.js' -import * as number from './number.js' -import * as object from './object.js' -import * as pair from './pair.js' -import * as prng from './prng.js' -import * as promise from './promise.js' -// import * as random from './random.js' -import * as set from './set.js' -import * as sort from './sort.js' -import * as statistics from './statistics.js' -import * as string from './string.js' -import * as symbol from './symbol.js' -// import * as testing from './testing.js' -import * as time from './time.js' -import * as tree from './tree.js' -import * as websocket from './websocket.js' - -export { - array, - binary, - broadcastchannel, - buffer, - conditions, - decoding, - diff, - dom, - encoding, - environment, - error, - eventloop, - func, - indexeddb, - iterator, - json, - logging, - map, - math, - mutex, - number, - object, - pair, - prng, - promise, - // random, - set, - sort, - statistics, - string, - symbol, - // testing, - time, - tree, - websocket -} diff --git a/yjs-poll/node_modules/lib0/indexeddb.d.ts b/yjs-poll/node_modules/lib0/indexeddb.d.ts deleted file mode 100644 index fe7148e..0000000 --- a/yjs-poll/node_modules/lib0/indexeddb.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -export function rtop(request: IDBRequest): Promise; -export function openDB(name: string, initDB: (arg0: IDBDatabase) => any): Promise; -export function deleteDB(name: string): Promise; -export function createStores(db: IDBDatabase, definitions: Array | Array>): void; -export function transact(db: IDBDatabase, stores: Array, access?: "readwrite" | "readonly"): Array; -export function count(store: IDBObjectStore, range?: IDBKeyRange): Promise; -export function get(store: IDBObjectStore, key: string | number | ArrayBuffer | Date | Array): Promise>; -export function del(store: IDBObjectStore, key: string | number | ArrayBuffer | Date | IDBKeyRange | Array): Promise; -export function put(store: IDBObjectStore, item: string | number | ArrayBuffer | Date | boolean, key?: string | number | ArrayBuffer | Date | Array): Promise; -export function add(store: IDBObjectStore, item: string | number | ArrayBuffer | Date | boolean, key: string | number | ArrayBuffer | Date | Array): Promise; -export function addAutoKey(store: IDBObjectStore, item: string | number | ArrayBuffer | Date): Promise; -export function getAll(store: IDBObjectStore, range?: IDBKeyRange, limit?: number): Promise>; -export function getAllKeys(store: IDBObjectStore, range?: IDBKeyRange, limit?: number): Promise>; -export function queryFirst(store: IDBObjectStore, query: IDBKeyRange | null, direction: "next" | "prev" | "nextunique" | "prevunique"): Promise; -export function getLastKey(store: IDBObjectStore, range?: IDBKeyRange | null): Promise; -export function getFirstKey(store: IDBObjectStore, range?: IDBKeyRange | null): Promise; -export function getAllKeysValues(store: IDBObjectStore, range?: IDBKeyRange, limit?: number): Promise>; -export function iterate(store: IDBObjectStore, keyrange: IDBKeyRange | null, f: (arg0: any, arg1: any) => void | boolean | Promise, direction?: "next" | "prev" | "nextunique" | "prevunique"): Promise; -export function iterateKeys(store: IDBObjectStore, keyrange: IDBKeyRange | null, f: (arg0: any) => void | boolean | Promise, direction?: "next" | "prev" | "nextunique" | "prevunique"): Promise; -export function getStore(t: IDBTransaction, store: string): IDBObjectStore; -export function createIDBKeyRangeBound(lower: any, upper: any, lowerOpen: boolean, upperOpen: boolean): IDBKeyRange; -export function createIDBKeyRangeUpperBound(upper: any, upperOpen: boolean): IDBKeyRange; -export function createIDBKeyRangeLowerBound(lower: any, lowerOpen: boolean): IDBKeyRange; -export type KeyValuePair = { - /** - * key - */ - k: any; - /** - * Value - */ - v: any; -}; -//# sourceMappingURL=indexeddb.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/indexeddb.d.ts.map b/yjs-poll/node_modules/lib0/indexeddb.d.ts.map deleted file mode 100644 index 85e381e..0000000 --- a/yjs-poll/node_modules/lib0/indexeddb.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"indexeddb.d.ts","sourceRoot":"","sources":["indexeddb.js"],"names":[],"mappings":"AAmBO,8BAHI,UAAU,GACT,OAAO,CAAC,GAAG,CAAC,CAOtB;AAOK,6BAJI,MAAM,UACN,CAAS,IAAW,EAAX,WAAW,KAAE,GAAG,GACxB,OAAO,CAAC,WAAW,CAAC,CAuB9B;AAKK,+BAFI,MAAM,gBAEmD;AAM7D,iCAHI,WAAW,eACX,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,GAAC,KAAK,CAAC,MAAM,GAAC,wBAAwB,GAAC,SAAS,CAAC,CAAC,QAK/E;AAQM,6BALI,WAAW,UACX,KAAK,CAAC,MAAM,CAAC,WACb,WAAW,GAAC,UAAU,GACrB,KAAK,CAAC,cAAc,CAAC,CAKhC;AAOM,6BAJI,cAAc,UACd,WAAW,GACV,OAAO,CAAC,MAAM,CAAC,CAGD;AAOnB,2BAJI,cAAc,OACd,SAAS,MAAM,GAAG,WAAW,GAAG,IAAI,G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A4B9H,+BALI,cAAc,YACd,WAAW,GAAC,IAAI,KAChB,CAAS,IAAG,EAAH,GAAG,EAAC,IAAG,EAAH,GAAG,KAAE,IAAI,GAAC,OAAO,GAAC,OAAO,CAAC,IAAI,GAAC,OAAO,CAAC,cACpD,MAAM,GAAC,MAAM,GAAC,YAAY,GAAC,YAAY,iBAG8C;AAUzF,mCALI,cAAc,YACd,WAAW,GAAC,IAAI,KAChB,CAAS,IAAG,EAAH,GAAG,KAAE,IAAI,GAAC,OAAO,GAAC,OAAO,CAAC,IAAI,GAAC,OAAO,CAAC,cAChD,MAAM,GAAC,MAAM,GAAC,YAAY,GAAC,YAAY,iBAGmC;AAQ9E,4BAJI,cAAc,kBAEZ,cAAc,CAE+B;AAQnD,8CALI,GAAG,SACH,GAAG,aACH,OAAO,aACP,OAAO,eAEiH;AAM5H,mDAHI,GAAG,aACH,OAAO,eAEuF;AAMlG,mDAHI,GAAG,aACH,OAAO,eAEuF;;;;;OAhF3F,GAAG;;;;OACH,GAAG"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/indexeddb.js b/yjs-poll/node_modules/lib0/indexeddb.js deleted file mode 100644 index a228868..0000000 --- a/yjs-poll/node_modules/lib0/indexeddb.js +++ /dev/null @@ -1,262 +0,0 @@ -/* eslint-env browser */ - -/** - * Helpers to work with IndexedDB. - * - * @module indexeddb - */ - -import * as promise from './promise.js' -import * as error from './error.js' - -/* c8 ignore start */ - -/** - * IDB Request to Promise transformer - * - * @param {IDBRequest} request - * @return {Promise} - */ -export const rtop = request => promise.create((resolve, reject) => { - // @ts-ignore - request.onerror = event => reject(new Error(event.target.error)) - // @ts-ignore - request.onsuccess = event => resolve(event.target.result) -}) - -/** - * @param {string} name - * @param {function(IDBDatabase):any} initDB Called when the database is first created - * @return {Promise} - */ -export const openDB = (name, initDB) => promise.create((resolve, reject) => { - const request = indexedDB.open(name) - /** - * @param {any} event - */ - request.onupgradeneeded = event => initDB(event.target.result) - /** - * @param {any} event - */ - request.onerror = event => reject(error.create(event.target.error)) - /** - * @param {any} event - */ - request.onsuccess = event => { - /** - * @type {IDBDatabase} - */ - const db = event.target.result - db.onversionchange = () => { db.close() } - resolve(db) - } -}) - -/** - * @param {string} name - */ -export const deleteDB = name => rtop(indexedDB.deleteDatabase(name)) - -/** - * @param {IDBDatabase} db - * @param {Array|Array>} definitions - */ -export const createStores = (db, definitions) => definitions.forEach(d => - // @ts-ignore - db.createObjectStore.apply(db, d) -) - -/** - * @param {IDBDatabase} db - * @param {Array} stores - * @param {"readwrite"|"readonly"} [access] - * @return {Array} - */ -export const transact = (db, stores, access = 'readwrite') => { - const transaction = db.transaction(stores, access) - return stores.map(store => getStore(transaction, store)) -} - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange} [range] - * @return {Promise} - */ -export const count = (store, range) => - rtop(store.count(range)) - -/** - * @param {IDBObjectStore} store - * @param {String | number | ArrayBuffer | Date | Array } key - * @return {Promise>} - */ -export const get = (store, key) => - rtop(store.get(key)) - -/** - * @param {IDBObjectStore} store - * @param {String | number | ArrayBuffer | Date | IDBKeyRange | Array } key - */ -export const del = (store, key) => - rtop(store.delete(key)) - -/** - * @param {IDBObjectStore} store - * @param {String | number | ArrayBuffer | Date | boolean} item - * @param {String | number | ArrayBuffer | Date | Array} [key] - */ -export const put = (store, item, key) => - rtop(store.put(item, key)) - -/** - * @param {IDBObjectStore} store - * @param {String | number | ArrayBuffer | Date | boolean} item - * @param {String | number | ArrayBuffer | Date | Array} key - * @return {Promise} - */ -export const add = (store, item, key) => - rtop(store.add(item, key)) - -/** - * @param {IDBObjectStore} store - * @param {String | number | ArrayBuffer | Date} item - * @return {Promise} Returns the generated key - */ -export const addAutoKey = (store, item) => - rtop(store.add(item)) - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange} [range] - * @param {number} [limit] - * @return {Promise>} - */ -export const getAll = (store, range, limit) => - rtop(store.getAll(range, limit)) - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange} [range] - * @param {number} [limit] - * @return {Promise>} - */ -export const getAllKeys = (store, range, limit) => - rtop(store.getAllKeys(range, limit)) - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange|null} query - * @param {'next'|'prev'|'nextunique'|'prevunique'} direction - * @return {Promise} - */ -export const queryFirst = (store, query, direction) => { - /** - * @type {any} - */ - let first = null - return iterateKeys(store, query, key => { - first = key - return false - }, direction).then(() => first) -} - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange?} [range] - * @return {Promise} - */ -export const getLastKey = (store, range = null) => queryFirst(store, range, 'prev') - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange?} [range] - * @return {Promise} - */ -export const getFirstKey = (store, range = null) => queryFirst(store, range, 'next') - -/** - * @typedef KeyValuePair - * @type {Object} - * @property {any} k key - * @property {any} v Value - */ - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange} [range] - * @param {number} [limit] - * @return {Promise>} - */ -export const getAllKeysValues = (store, range, limit) => - // @ts-ignore - promise.all([getAllKeys(store, range, limit), getAll(store, range, limit)]).then(([ks, vs]) => ks.map((k, i) => ({ k, v: vs[i] }))) - -/** - * @param {any} request - * @param {function(IDBCursorWithValue):void|boolean|Promise} f - * @return {Promise} - */ -const iterateOnRequest = (request, f) => promise.create((resolve, reject) => { - request.onerror = reject - /** - * @param {any} event - */ - request.onsuccess = async event => { - const cursor = event.target.result - if (cursor === null || (await f(cursor)) === false) { - return resolve() - } - cursor.continue() - } -}) - -/** - * Iterate on keys and values - * @param {IDBObjectStore} store - * @param {IDBKeyRange|null} keyrange - * @param {function(any,any):void|boolean|Promise} f Callback that receives (value, key) - * @param {'next'|'prev'|'nextunique'|'prevunique'} direction - */ -export const iterate = (store, keyrange, f, direction = 'next') => - iterateOnRequest(store.openCursor(keyrange, direction), cursor => f(cursor.value, cursor.key)) - -/** - * Iterate on the keys (no values) - * - * @param {IDBObjectStore} store - * @param {IDBKeyRange|null} keyrange - * @param {function(any):void|boolean|Promise} f callback that receives the key - * @param {'next'|'prev'|'nextunique'|'prevunique'} direction - */ -export const iterateKeys = (store, keyrange, f, direction = 'next') => - iterateOnRequest(store.openKeyCursor(keyrange, direction), cursor => f(cursor.key)) - -/** - * Open store from transaction - * @param {IDBTransaction} t - * @param {String} store - * @returns {IDBObjectStore} - */ -export const getStore = (t, store) => t.objectStore(store) - -/** - * @param {any} lower - * @param {any} upper - * @param {boolean} lowerOpen - * @param {boolean} upperOpen - */ -export const createIDBKeyRangeBound = (lower, upper, lowerOpen, upperOpen) => IDBKeyRange.bound(lower, upper, lowerOpen, upperOpen) - -/** - * @param {any} upper - * @param {boolean} upperOpen - */ -export const createIDBKeyRangeUpperBound = (upper, upperOpen) => IDBKeyRange.upperBound(upper, upperOpen) - -/** - * @param {any} lower - * @param {boolean} lowerOpen - */ -export const createIDBKeyRangeLowerBound = (lower, lowerOpen) => IDBKeyRange.lowerBound(lower, lowerOpen) - -/* c8 ignore stop */ diff --git a/yjs-poll/node_modules/lib0/indexeddb.test.d.ts b/yjs-poll/node_modules/lib0/indexeddb.test.d.ts deleted file mode 100644 index e45d0c9..0000000 --- a/yjs-poll/node_modules/lib0/indexeddb.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testRetrieveElements(): Promise; -export function testBlocked(): Promise; -//# sourceMappingURL=indexeddb.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/indexeddb.test.d.ts.map b/yjs-poll/node_modules/lib0/indexeddb.test.d.ts.map deleted file mode 100644 index 2b53eb3..0000000 --- a/yjs-poll/node_modules/lib0/indexeddb.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"indexeddb.test.d.ts","sourceRoot":"","sources":["indexeddb.test.js"],"names":[],"mappings":"AAyBO,sDAoEN;AAGM,6CAWN"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/indexeddbV2.d.ts b/yjs-poll/node_modules/lib0/indexeddbV2.d.ts deleted file mode 100644 index 0b104d9..0000000 --- a/yjs-poll/node_modules/lib0/indexeddbV2.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -export function bindPledge(p: pledge.PledgeInstance, request: IDBRequest): void; -export function openDB(name: string, initDB: (arg0: IDBDatabase) => any): pledge.PledgeInstance; -export function deleteDB(name: pledge.Pledge): pledge.PledgeInstance; -export function createStores(db: IDBDatabase, definitions: Array | Array>): void; -export function transact(db: pledge.Pledge, stores: pledge.Pledge>, access?: "readwrite" | "readonly"): pledge.Pledge>; -export function count(store: IDBObjectStore, range?: pledge.Pledge): pledge.PledgeInstance; -export function get(store: pledge.Pledge, key: pledge.Pledge>): pledge.PledgeInstance>; -export function del(store: pledge.Pledge, key: string | number | ArrayBuffer | Date | IDBKeyRange | Array): pledge.PledgeInstance; -export function put(store: pledge.Pledge, item: string | number | ArrayBuffer | Date | boolean, key?: string | number | ArrayBuffer | Date | Array): pledge.PledgeInstance; -export function add(store: pledge.Pledge, item: string | number | ArrayBuffer | Date | boolean, key: string | number | ArrayBuffer | Date | Array): pledge.PledgeInstance; -export function addAutoKey(store: pledge.Pledge, item: string | number | ArrayBuffer | Date): pledge.PledgeInstance; -export function getAll(store: pledge.Pledge, range?: IDBKeyRange, limit?: number): pledge.PledgeInstance>; -export function getAllKeys(store: pledge.Pledge, range?: IDBKeyRange, limit?: number): pledge.PledgeInstance>; -export function queryFirst(store: IDBObjectStore, query: IDBKeyRange | null, direction: "next" | "prev" | "nextunique" | "prevunique"): pledge.PledgeInstance; -export function getLastKey(store: IDBObjectStore, range?: IDBKeyRange | null): pledge.PledgeInstance; -export function getFirstKey(store: IDBObjectStore, range?: IDBKeyRange | null): pledge.PledgeInstance; -export function getAllKeysValues(store: pledge.Pledge, range?: pledge.Pledge, limit?: pledge.Pledge): pledge.PledgeInstance>; -export function iterate(store: pledge.Pledge, keyrange: pledge.Pledge, f: (arg0: any, arg1: any) => void | boolean | Promise, direction?: "next" | "prev" | "nextunique" | "prevunique"): pledge.PledgeInstance; -export function iterateKeys(store: pledge.Pledge, keyrange: pledge.Pledge, f: (arg0: any) => void | boolean | Promise, direction?: "next" | "prev" | "nextunique" | "prevunique"): pledge.PledgeInstance; -export function getStore(t: IDBTransaction, store: string): IDBObjectStore; -export function createIDBKeyRangeBound(lower: any, upper: any, lowerOpen: boolean, upperOpen: boolean): IDBKeyRange; -export function createIDBKeyRangeUpperBound(upper: any, upperOpen: boolean): IDBKeyRange; -export function createIDBKeyRangeLowerBound(lower: any, lowerOpen: boolean): IDBKeyRange; -export type KeyValuePair = { - /** - * key - */ - k: any; - /** - * Value - */ - v: any; -}; -import * as pledge from './pledge.js'; -//# sourceMappingURL=indexeddbV2.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/indexeddbV2.d.ts.map b/yjs-poll/node_modules/lib0/indexeddbV2.d.ts.map deleted file mode 100644 index ecb142e..0000000 --- a/yjs-poll/node_modules/lib0/indexeddbV2.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"indexeddbV2.d.ts","sourceRoot":"","sources":["indexeddbV2.js"],"names":[],"mappings":"AAqBO,8BAHI,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,WAC1B,UAAU,QAOpB;AAOM,6BAJI,MAAM,UACN,CAAS,IAAW,EAAX,WAAW,KAAE,GAAG,GACxB,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CA4B7C;AAMM,+BAHI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GACpB,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAEwF;AAMxH,iCAHI,WAAW,eACX,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,GAAC,KAAK,CAAC,MAAM,GAAC,wBAAwB,GAAC,SAAS,CAAC,CAAC,QAK/E;AAQM,6BALI,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,UAC1B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,WAC5B,WAAW,GAAC,UAAU,GACrB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC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Y,qCAI/B;AAQZ,4BAJI,cAAc,kBAEZ,cAAc,CAE+B;AAQnD,8CALI,GAAG,SACH,GAAG,aACH,OAAO,aACP,OAAO,eAEiH;AAM5H,mDAHI,GAAG,aACH,OAAO,eAEuF;AAMlG,mDAHI,GAAG,aACH,OAAO,eAEuF;;;;;OAnF3F,GAAG;;;;OACH,GAAG;;wBAzKO,aAAa"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/indexeddbV2.js b/yjs-poll/node_modules/lib0/indexeddbV2.js deleted file mode 100644 index eb0d75f..0000000 --- a/yjs-poll/node_modules/lib0/indexeddbV2.js +++ /dev/null @@ -1,265 +0,0 @@ -/* eslint-env browser */ - -/** - * Helpers to work with IndexedDB. - * This is an experimental implementation using Pledge instead of Promise. - * - * @experimental - * - * @module indexeddbv2 - */ - -import * as pledge from './pledge.js' - -/* c8 ignore start */ - -/** - * IDB Request to Pledge transformer - * - * @param {pledge.PledgeInstance} p - * @param {IDBRequest} request - */ -export const bindPledge = (p, request) => { - // @ts-ignore - request.onerror = event => p.cancel(event.target.error) - // @ts-ignore - request.onsuccess = event => p.resolve(event.target.result) -} - -/** - * @param {string} name - * @param {function(IDBDatabase):any} initDB Called when the database is first created - * @return {pledge.PledgeInstance} - */ -export const openDB = (name, initDB) => { - /** - * @type {pledge.PledgeInstance} - */ - const p = pledge.create() - const request = indexedDB.open(name) - /** - * @param {any} event - */ - request.onupgradeneeded = event => initDB(event.target.result) - /** - * @param {any} event - */ - request.onerror = event => p.cancel(event.target.error) - /** - * @param {any} event - */ - request.onsuccess = event => { - /** - * @type {IDBDatabase} - */ - const db = event.target.result - db.onversionchange = () => { db.close() } - p.resolve(db) - } - return p -} - -/** - * @param {pledge.Pledge} name - * @return {pledge.PledgeInstance} - */ -export const deleteDB = name => pledge.createWithDependencies((p, name) => bindPledge(p, indexedDB.deleteDatabase(name)), name) - -/** - * @param {IDBDatabase} db - * @param {Array|Array>} definitions - */ -export const createStores = (db, definitions) => definitions.forEach(d => - // @ts-ignore - db.createObjectStore.apply(db, d) -) - -/** - * @param {pledge.Pledge} db - * @param {pledge.Pledge>} stores - * @param {"readwrite"|"readonly"} [access] - * @return {pledge.Pledge>} - */ -export const transact = (db, stores, access = 'readwrite') => pledge.createWithDependencies((p, db, stores) => { - const transaction = db.transaction(stores, access) - p.resolve(stores.map(store => getStore(transaction, store))) -}, db, stores) - -/** - * @param {IDBObjectStore} store - * @param {pledge.Pledge} [range] - * @return {pledge.PledgeInstance} - */ -export const count = (store, range) => pledge.createWithDependencies((p, store, range) => bindPledge(p, store.count(range)), store, range) - -/** - * @param {pledge.Pledge} store - * @param {pledge.Pledge>} key - * @return {pledge.PledgeInstance>} - */ -export const get = (store, key) => pledge.createWithDependencies((p, store, key) => bindPledge(p, store.get(key)), store, key) - -/** - * @param {pledge.Pledge} store - * @param {String | number | ArrayBuffer | Date | IDBKeyRange | Array } key - */ -export const del = (store, key) => pledge.createWithDependencies((p, store, key) => bindPledge(p, store.delete(key)), store, key) - -/** - * @param {pledge.Pledge} store - * @param {String | number | ArrayBuffer | Date | boolean} item - * @param {String | number | ArrayBuffer | Date | Array} [key] - */ -export const put = (store, item, key) => pledge.createWithDependencies((p, store, item, key) => bindPledge(p, store.put(item, key)), store, item, key) - -/** - * @param {pledge.Pledge} store - * @param {String | number | ArrayBuffer | Date | boolean} item - * @param {String | number | ArrayBuffer | Date | Array} key - * @return {pledge.PledgeInstance} - */ -export const add = (store, item, key) => pledge.createWithDependencies((p, store, item, key) => bindPledge(p, store.add(item, key)), store, item, key) - -/** - * @param {pledge.Pledge} store - * @param {String | number | ArrayBuffer | Date} item - * @return {pledge.PledgeInstance} Returns the generated key - */ -export const addAutoKey = (store, item) => pledge.createWithDependencies((p, store, item) => bindPledge(p, store.add(item)), store, item) - -/** - * @param {pledge.Pledge} store - * @param {IDBKeyRange} [range] - * @param {number} [limit] - * @return {pledge.PledgeInstance>} - */ -export const getAll = (store, range, limit) => pledge.createWithDependencies((p, store, range, limit) => bindPledge(p, store.getAll(range, limit)), store, range, limit) - -/** - * @param {pledge.Pledge} store - * @param {IDBKeyRange} [range] - * @param {number} [limit] - * @return {pledge.PledgeInstance>} - */ -export const getAllKeys = (store, range, limit) => pledge.createWithDependencies((p, store, range, limit) => bindPledge(p, store.getAllKeys(range, limit)), store, range, limit) - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange|null} query - * @param {'next'|'prev'|'nextunique'|'prevunique'} direction - * @return {pledge.PledgeInstance} - */ -export const queryFirst = (store, query, direction) => { - /** - * @type {any} - */ - let first = null - return iterateKeys(store, query, key => { - first = key - return false - }, direction).map(() => first) -} - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange?} [range] - * @return {pledge.PledgeInstance} - */ -export const getLastKey = (store, range = null) => queryFirst(store, range, 'prev') - -/** - * @param {IDBObjectStore} store - * @param {IDBKeyRange?} [range] - * @return {pledge.PledgeInstance} - */ -export const getFirstKey = (store, range = null) => queryFirst(store, range, 'next') - -/** - * @typedef KeyValuePair - * @type {Object} - * @property {any} k key - * @property {any} v Value - */ - -/** - * @param {pledge.Pledge} store - * @param {pledge.Pledge} [range] - * @param {pledge.Pledge} [limit] - * @return {pledge.PledgeInstance>} - */ -export const getAllKeysValues = (store, range, limit) => pledge.createWithDependencies((p, store, range, limit) => { - pledge.all([getAllKeys(store, range, limit), getAll(store, range, limit)]).map(([ks, vs]) => ks.map((k, i) => ({ k, v: vs[i] }))).whenResolved(p.resolve.bind(p)) -}, store, range, limit) - -/** - * @param {pledge.PledgeInstance} p - * @param {any} request - * @param {function(IDBCursorWithValue):void|boolean|Promise} f - */ -const iterateOnRequest = (p, request, f) => { - request.onerror = p.cancel.bind(p) - /** - * @param {any} event - */ - request.onsuccess = async event => { - const cursor = event.target.result - if (cursor === null || (await f(cursor)) === false) { - p.resolve(undefined) - return - } - cursor.continue() - } -} - -/** - * Iterate on keys and values - * @param {pledge.Pledge} store - * @param {pledge.Pledge} keyrange - * @param {function(any,any):void|boolean|Promise} f Callback that receives (value, key) - * @param {'next'|'prev'|'nextunique'|'prevunique'} direction - */ -export const iterate = (store, keyrange, f, direction = 'next') => pledge.createWithDependencies((p, store, keyrange) => { - iterateOnRequest(p, store.openCursor(keyrange, direction), cursor => f(cursor.value, cursor.key)) -}, store, keyrange) - -/** - * Iterate on the keys (no values) - * - * @param {pledge.Pledge} store - * @param {pledge.Pledge} keyrange - * @param {function(any):void|boolean|Promise} f callback that receives the key - * @param {'next'|'prev'|'nextunique'|'prevunique'} direction - */ -export const iterateKeys = (store, keyrange, f, direction = 'next') => pledge.createWithDependencies((p, store, keyrange) => { - iterateOnRequest(p, store.openKeyCursor(keyrange, direction), cursor => f(cursor.key)) -}, store, keyrange) - -/** - * Open store from transaction - * @param {IDBTransaction} t - * @param {String} store - * @returns {IDBObjectStore} - */ -export const getStore = (t, store) => t.objectStore(store) - -/** - * @param {any} lower - * @param {any} upper - * @param {boolean} lowerOpen - * @param {boolean} upperOpen - */ -export const createIDBKeyRangeBound = (lower, upper, lowerOpen, upperOpen) => IDBKeyRange.bound(lower, upper, lowerOpen, upperOpen) - -/** - * @param {any} upper - * @param {boolean} upperOpen - */ -export const createIDBKeyRangeUpperBound = (upper, upperOpen) => IDBKeyRange.upperBound(upper, upperOpen) - -/** - * @param {any} lower - * @param {boolean} lowerOpen - */ -export const createIDBKeyRangeLowerBound = (lower, lowerOpen) => IDBKeyRange.lowerBound(lower, lowerOpen) - -/* c8 ignore stop */ diff --git a/yjs-poll/node_modules/lib0/indexeddbV2.test.d.ts b/yjs-poll/node_modules/lib0/indexeddbV2.test.d.ts deleted file mode 100644 index c61e1a6..0000000 --- a/yjs-poll/node_modules/lib0/indexeddbV2.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testRetrieveElements(): Promise; -export function testBlocked(): Promise; -//# sourceMappingURL=indexeddbV2.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/indexeddbV2.test.d.ts.map b/yjs-poll/node_modules/lib0/indexeddbV2.test.d.ts.map deleted file mode 100644 index 49e4b03..0000000 --- a/yjs-poll/node_modules/lib0/indexeddbV2.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"indexeddbV2.test.d.ts","sourceRoot":"","sources":["indexeddbV2.test.js"],"names":[],"mappings":"AA0BO,sDAoEN;AAGM,6CAgBN"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/isomorphic.js b/yjs-poll/node_modules/lib0/isomorphic.js deleted file mode 100644 index 7d1c5fa..0000000 --- a/yjs-poll/node_modules/lib0/isomorphic.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Isomorphic library exports from isomorphic.js. - * - * @todo remove this module - * @deprecated - * - * @module isomorphic - */ - -export { performance, cryptoRandomBuffer } from 'isomorphic.js' diff --git a/yjs-poll/node_modules/lib0/iterator.d.ts b/yjs-poll/node_modules/lib0/iterator.d.ts deleted file mode 100644 index 91a2024..0000000 --- a/yjs-poll/node_modules/lib0/iterator.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function mapIterator(iterator: Iterator, f: (arg0: T) => R): IterableIterator; -export function createIterator(next: () => IteratorResult): IterableIterator; -export function iteratorFilter(iterator: Iterator, filter: (arg0: T) => boolean): IterableIterator; -export function iteratorMap(iterator: Iterator, fmap: (arg0: T) => M): IterableIterator; -//# sourceMappingURL=iterator.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/iterator.d.ts.map b/yjs-poll/node_modules/lib0/iterator.d.ts.map deleted file mode 100644 index 0c3c7ba..0000000 --- a/yjs-poll/node_modules/lib0/iterator.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"iterator.d.ts","sourceRoot":"","sources":["iterator.js"],"names":[],"mappings":"AAYO,4BALM,CAAC,EAAC,CAAC,YACL,QAAQ,CAAC,CAAC,CAAC,KACX,CAAS,IAAC,EAAD,CAAC,KAAE,CAAC,GACZ,gBAAgB,CAAC,CAAC,CAAC,CAW7B;AAOK,+BAJM,CAAC,QACH,MAAW,cAAc,CAAC,CAAC,CAAC,GAC3B,gBAAgB,CAAC,CAAC,CAAC,CAW7B;AAOK,+BAJM,CAAC,YACH,QAAQ,CAAC,CAAC,CAAC,UACX,CAAS,IAAC,EAAD,CAAC,KAAE,OAAO,uBAQ5B;AAOK,4BAJM,CAAC,EAAC,CAAC,YACL,QAAQ,CAAC,CAAC,CAAC,QACX,CAAS,IAAC,EAAD,CAAC,KAAE,CAAC,mCAKtB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/iterator.js b/yjs-poll/node_modules/lib0/iterator.js deleted file mode 100644 index 6ab0e7a..0000000 --- a/yjs-poll/node_modules/lib0/iterator.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Utility module to create and manipulate Iterators. - * - * @module iterator - */ - -/** - * @template T,R - * @param {Iterator} iterator - * @param {function(T):R} f - * @return {IterableIterator} - */ -export const mapIterator = (iterator, f) => ({ - [Symbol.iterator] () { - return this - }, - // @ts-ignore - next () { - const r = iterator.next() - return { value: r.done ? undefined : f(r.value), done: r.done } - } -}) - -/** - * @template T - * @param {function():IteratorResult} next - * @return {IterableIterator} - */ -export const createIterator = next => ({ - /** - * @return {IterableIterator} - */ - [Symbol.iterator] () { - return this - }, - // @ts-ignore - next -}) - -/** - * @template T - * @param {Iterator} iterator - * @param {function(T):boolean} filter - */ -export const iteratorFilter = (iterator, filter) => createIterator(() => { - let res - do { - res = iterator.next() - } while (!res.done && !filter(res.value)) - return res -}) - -/** - * @template T,M - * @param {Iterator} iterator - * @param {function(T):M} fmap - */ -export const iteratorMap = (iterator, fmap) => createIterator(() => { - const { done, value } = iterator.next() - return { done, value: done ? undefined : fmap(value) } -}) diff --git a/yjs-poll/node_modules/lib0/json.d.ts b/yjs-poll/node_modules/lib0/json.d.ts deleted file mode 100644 index 146362c..0000000 --- a/yjs-poll/node_modules/lib0/json.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * JSON utility functions. - * - * @module json - */ -/** - * Transform JavaScript object to JSON. - * - * @param {any} object - * @return {string} - */ -export const stringify: { - (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string; - (value: any, replacer?: (number | string)[] | null, space?: string | number): string; -}; -/** - * Parse JSON object. - * - * @param {string} json - * @return {any} - */ -export const parse: (text: string, reviver?: (this: any, key: string, value: any) => any) => any; -//# sourceMappingURL=json.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/json.d.ts.map b/yjs-poll/node_modules/lib0/json.d.ts.map deleted file mode 100644 index 453eca6..0000000 --- a/yjs-poll/node_modules/lib0/json.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["json.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH;;;EAAuC;AAEvC;;;;;GAKG;AACH,iGAA+B"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/json.js b/yjs-poll/node_modules/lib0/json.js deleted file mode 100644 index 7354089..0000000 --- a/yjs-poll/node_modules/lib0/json.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * JSON utility functions. - * - * @module json - */ - -/** - * Transform JavaScript object to JSON. - * - * @param {any} object - * @return {string} - */ -export const stringify = JSON.stringify - -/** - * Parse JSON object. - * - * @param {string} json - * @return {any} - */ -export const parse = JSON.parse diff --git a/yjs-poll/node_modules/lib0/list.d.ts b/yjs-poll/node_modules/lib0/list.d.ts deleted file mode 100644 index bd60710..0000000 --- a/yjs-poll/node_modules/lib0/list.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -export class ListNode { - /** - * @type {this|null} - */ - next: this | null; - /** - * @type {this|null} - */ - prev: this | null; -} -/** - * @template {ListNode} N - */ -export class List { - /** - * @type {N | null} - */ - start: N | null; - /** - * @type {N | null} - */ - end: N | null; - len: number; - toArray(): N[]; - /** - * @param {function(N):any} f - */ - forEach(f: (arg0: N) => any): void; - /** - * @template M - * @param {function(N):M} f - * @return {Array} - */ - map(f: (arg0: N) => M): Array; - [Symbol.iterator](): Generator; - /** - * @param {List} other - */ - [equalityTrait.EqualityTraitSymbol](other: List): boolean; -} -export function create(): List; -export function isEmpty(queue: List): boolean; -export function remove(list: List, node: N): N; -export function removeNode(list: List, node: N): N; -export function insertBetween(queue: List, left: N | null, right: N | null, node: N): void; -export function replace(queue: List, node: N, newNode: N): void; -export function pushEnd(queue: List, n: N): void; -export function pushFront(queue: List, n: N): void; -export function popFront(list: List): N | null; -export function popEnd(list: List): N | null; -export function map(list: List, f: (arg0: N) => M): Array; -export function toArray(list: List): N[]; -export function forEach(list: List, f: (arg0: N) => any): void; -import * as equalityTrait from './trait/equality.js'; -//# sourceMappingURL=list.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/list.d.ts.map b/yjs-poll/node_modules/lib0/list.d.ts.map deleted file mode 100644 index c8d120c..0000000 --- a/yjs-poll/node_modules/lib0/list.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.js"],"names":[],"mappings":"AAKA;IAEI;;OAEG;IACH,MAFU,IAAI,GAAC,IAAI,CAEH;IAChB;;OAEG;IACH,MAFU,IAAI,GAAC,IAAI,CAEH;CAEnB;AAED;;GAEG;AACH,kBAFwB,CAAC,SAAX,QAAS;IAInB;;OAEG;IACH,OAFU,CAAC,GAAG,IAAI,CAED;IACjB;;OAEG;IACH,KAFU,CAAC,GAAG,IAAI,CAEH;IACf,YAAY;IAWd,eAEC;IAED;;OAEG;IACH,WAFW,CAAS,IAAC,EAAD,CAAC,KAAE,GAAG,QAIzB;IAED;;;;OAIG;IACH,IAJa,CAAC,KACH,CAAS,IAAC,EAAD,CAAC,KAAE,CAAC,GACZ,KAAK,CAAC,CAAC,CAAC,CAInB;IA1BD,iDAMC;IAsBD;;OAEG;IACH,2CAFW,IAAI,CAAC,GAAG,CAAC,WAWnB;CACF;AAUM,uBAJiB,CAAC,SAAX,QAAS,KAEX,IAAI,CAAC,CAAC,CAAC,CA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file mode 100644 index 3175d44..0000000 --- a/yjs-poll/node_modules/lib0/list.js +++ /dev/null @@ -1,243 +0,0 @@ -import { id } from './function.js' -import * as error from './error.js' -import * as equalityTrait from './trait/equality.js' -import * as f from './function.js' - -export class ListNode { - constructor () { - /** - * @type {this|null} - */ - this.next = null - /** - * @type {this|null} - */ - this.prev = null - } -} - -/** - * @template {ListNode} N - */ -export class List { - constructor () { - /** - * @type {N | null} - */ - this.start = null - /** - * @type {N | null} - */ - this.end = null - this.len = 0 - } - - * [Symbol.iterator] () { - let n = this.start - while (n) { - yield n - n = n.next - } - } - - toArray () { - return map(this, f.id) - } - - /** - * @param {function(N):any} f - */ - forEach (f) { - forEach(this, f) - } - - /** - * @template M - * @param {function(N):M} f - * @return {Array} - */ - map (f) { - return map(this, f) - } - - /** - * @param {List} other - */ - [equalityTrait.EqualityTraitSymbol] (other) { - let n = this.start - let m = other.start - while (n && m) { - if (!equalityTrait.equals(n, m)) return false - n = n.next - m = m.next - } - return n === m // only true iff n == null && m == null - } -} - -/** - * @note The queue implementation is experimental and unfinished. - * Don't use this in production yet. - * - * @template {ListNode} N - * - * @return {List} - */ -export const create = () => new List() - -/** - * @template {ListNode} N - * - * @param {List} queue - */ -export const isEmpty = queue => queue.start === null - -/** - * Remove a single node from the queue. Only works with Queues that operate on Doubly-linked lists of nodes. - * - * @template {ListNode} N - * - * @param {List} list - * @param {N} node - */ -export const remove = (list, node) => { - const prev = node.prev - const next = node.next - if (prev) { - prev.next = next - } else { - list.start = next - } - if (next) { - next.prev = prev - } else { - list.end = prev - } - list.len-- - return node -} - -/** - * @deprecated @todo remove in next major release - */ -export const removeNode = remove - -/** - * @template {ListNode} N - * - * @param {List} queue - * @param {N| null} left - * @param {N| null} right - * @param {N} node - */ -export const insertBetween = (queue, left, right, node) => { - /* c8 ignore start */ - if (left != null && left.next !== right) { - throw error.unexpectedCase() - } - /* c8 ignore stop */ - if (left) { - left.next = node - } else { - queue.start = node - } - if (right) { - right.prev = node - } else { - queue.end = node - } - node.prev = left - node.next = right - queue.len++ -} - -/** - * Remove a single node from the queue. Only works with Queues that operate on Doubly-linked lists of nodes. - * - * @template {ListNode} N - * - * @param {List} queue - * @param {N} node - * @param {N} newNode - */ -export const replace = (queue, node, newNode) => { - insertBetween(queue, node, node.next, newNode) - remove(queue, node) -} - -/** - * @template {ListNode} N - * - * @param {List} queue - * @param {N} n - */ -export const pushEnd = (queue, n) => - insertBetween(queue, queue.end, null, n) - -/** - * @template {ListNode} N - * - * @param {List} queue - * @param {N} n - */ -export const pushFront = (queue, n) => - insertBetween(queue, null, queue.start, n) - -/** - * @template {ListNode} N - * - * @param {List} list - * @return {N| null} - */ -export const popFront = list => - list.start ? removeNode(list, list.start) : null - -/** - * @template {ListNode} N - * - * @param {List} list - * @return {N| null} - */ -export const popEnd = list => - list.end ? removeNode(list, list.end) : null - -/** - * @template {ListNode} N - * @template M - * - * @param {List} list - * @param {function(N):M} f - * @return {Array} - */ -export const map = (list, f) => { - /** - * @type {Array} - */ - const arr = [] - let n = list.start - while (n) { - arr.push(f(n)) - n = n.next - } - return arr -} - -/** - * @template {ListNode} N - * - * @param {List} list - */ -export const toArray = list => map(list, id) - -/** - * @template {ListNode} N - * @param {List} list - * @param {function(N):any} f - */ -export const forEach = (list, f) => { - let n = list.start - while (n) { - f(n) - n = n.next - } -} diff --git a/yjs-poll/node_modules/lib0/list.test.d.ts b/yjs-poll/node_modules/lib0/list.test.d.ts deleted file mode 100644 index 7227113..0000000 --- a/yjs-poll/node_modules/lib0/list.test.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export function testAssignability(_tc: t.TestCase): void; -export function testEnqueueDequeue(_tc: t.TestCase): void; -export function testSelectivePop(_tc: t.TestCase): void; -export function testEquality(): void; -import * as t from './testing.js'; -//# sourceMappingURL=list.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/list.test.d.ts.map b/yjs-poll/node_modules/lib0/list.test.d.ts.map deleted file mode 100644 index 27cbf56..0000000 --- a/yjs-poll/node_modules/lib0/list.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"list.test.d.ts","sourceRoot":"","sources":["list.test.js"],"names":[],"mappings":"AA2BO,uCAFI,CAAC,CAAC,QAAQ,QAcpB;AAKM,wCAFI,CAAC,CAAC,QAAQ,QA8BpB;AAKM,sCAFI,CAAC,CAAC,QAAQ,QAiCpB;AAEM,qCAgBN;mBA9HkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/logging.common.d.ts b/yjs-poll/node_modules/lib0/logging.common.d.ts deleted file mode 100644 index f0489be..0000000 --- a/yjs-poll/node_modules/lib0/logging.common.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -export const BOLD: symbol; -export const UNBOLD: symbol; -export const BLUE: symbol; -export const GREY: symbol; -export const GREEN: symbol; -export const RED: symbol; -export const PURPLE: symbol; -export const ORANGE: symbol; -export const UNCOLOR: symbol; -export function computeNoColorLoggingArgs(args: Array any)>): Array; -export function createModuleLogger(_print: (...args: any[]) => void, moduleName: string): (...args: any[]) => void; -//# sourceMappingURL=logging.common.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/logging.common.d.ts.map b/yjs-poll/node_modules/lib0/logging.common.d.ts.map deleted file mode 100644 index 07917e0..0000000 --- a/yjs-poll/node_modules/lib0/logging.common.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logging.common.d.ts","sourceRoot":"","sources":["logging.common.js"],"names":[],"mappings":"AAMA,0BAAmC;AACnC,4BAAqC;AACrC,0BAAmC;AACnC,0BAAmC;AACnC,2BAAoC;AACpC,yBAAkC;AAClC,4BAAqC;AACrC,4BAAqC;AACrC,6BAAsC;AAO/B,gDAHI,KAAK,CAAC,SAAS,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,IAAC,MAAW,GAAG,CAAA,CAAC,GAC1D,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,SAAS,CAAC,CAgChD;AAaM,2CAJI,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,IAAI,cACrB,MAAM,GACL,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,IAAI,CAyChC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/logging.common.js b/yjs-poll/node_modules/lib0/logging.common.js deleted file mode 100644 index 8c654ec..0000000 --- a/yjs-poll/node_modules/lib0/logging.common.js +++ /dev/null @@ -1,105 +0,0 @@ -import * as symbol from './symbol.js' -import * as time from './time.js' -import * as env from './environment.js' -import * as func from './function.js' -import * as json from './json.js' - -export const BOLD = symbol.create() -export const UNBOLD = symbol.create() -export const BLUE = symbol.create() -export const GREY = symbol.create() -export const GREEN = symbol.create() -export const RED = symbol.create() -export const PURPLE = symbol.create() -export const ORANGE = symbol.create() -export const UNCOLOR = symbol.create() - -/* c8 ignore start */ -/** - * @param {Array} args - * @return {Array} - */ -export const computeNoColorLoggingArgs = args => { - if (args.length === 1 && args[0]?.constructor === Function) { - args = /** @type {Array} */ (/** @type {[function]} */ (args)[0]()) - } - const strBuilder = [] - const logArgs = [] - // try with formatting until we find something unsupported - let i = 0 - for (; i < args.length; i++) { - const arg = args[i] - if (arg === undefined) { - break - } else if (arg.constructor === String || arg.constructor === Number) { - strBuilder.push(arg) - } else if (arg.constructor === Object) { - break - } - } - if (i > 0) { - // create logArgs with what we have so far - logArgs.push(strBuilder.join('')) - } - // append the rest - for (; i < args.length; i++) { - const arg = args[i] - if (!(arg instanceof Symbol)) { - logArgs.push(arg) - } - } - return logArgs -} -/* c8 ignore stop */ - -const loggingColors = [GREEN, PURPLE, ORANGE, BLUE] -let nextColor = 0 -let lastLoggingTime = time.getUnixTime() - -/* c8 ignore start */ -/** - * @param {function(...any):void} _print - * @param {string} moduleName - * @return {function(...any):void} - */ -export const createModuleLogger = (_print, moduleName) => { - const color = loggingColors[nextColor] - const debugRegexVar = env.getVariable('log') - const doLogging = debugRegexVar !== null && - (debugRegexVar === '*' || debugRegexVar === 'true' || - new RegExp(debugRegexVar, 'gi').test(moduleName)) - nextColor = (nextColor + 1) % loggingColors.length - moduleName += ': ' - return !doLogging - ? func.nop - : (...args) => { - if (args.length === 1 && args[0]?.constructor === Function) { - args = args[0]() - } - const timeNow = time.getUnixTime() - const timeDiff = timeNow - lastLoggingTime - lastLoggingTime = timeNow - _print( - color, - moduleName, - UNCOLOR, - ...args.map((arg) => { - if (arg != null && arg.constructor === Uint8Array) { - arg = Array.from(arg) - } - const t = typeof arg - switch (t) { - case 'string': - case 'symbol': - return arg - default: { - return json.stringify(arg) - } - } - }), - color, - ' +' + timeDiff + 'ms' - ) - } -} -/* c8 ignore stop */ diff --git a/yjs-poll/node_modules/lib0/logging.d.ts b/yjs-poll/node_modules/lib0/logging.d.ts deleted file mode 100644 index a768a17..0000000 --- a/yjs-poll/node_modules/lib0/logging.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -export function print(...args: Array): void; -export function warn(...args: Array): void; -export function printError(err: Error): void; -export function printImg(url: string, height: number): void; -export function printImgBase64(base64: string, height: number): void; -export function group(...args: Array): void; -export function groupCollapsed(...args: Array): void; -export function groupEnd(): void; -export function printDom(createNode: () => Node): void; -export function printCanvas(canvas: HTMLCanvasElement, height: number): void; -export const vconsoles: Set; -export class VConsole { - /** - * @param {Element} dom - */ - constructor(dom: Element); - dom: Element; - /** - * @type {Element} - */ - ccontainer: Element; - depth: number; - /** - * @param {Array} args - * @param {boolean} collapsed - */ - group(args: Array, collapsed?: boolean): void; - /** - * @param {Array} args - */ - groupCollapsed(args: Array): void; - groupEnd(): void; - /** - * @param {Array} args - */ - print(args: Array): void; - /** - * @param {Error} err - */ - printError(err: Error): void; - /** - * @param {string} url - * @param {number} height - */ - printImg(url: string, height: number): void; - /** - * @param {Node} node - */ - printDom(node: Node): void; - destroy(): void; -} -export function createVConsole(dom: Element): VConsole; -export function createModuleLogger(moduleName: string): (...args: any[]) => void; -export { BOLD, UNBOLD, BLUE, GREY, GREEN, RED, PURPLE, ORANGE, UNCOLOR } from "./logging.common.js"; -//# sourceMappingURL=logging.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/logging.d.ts.map b/yjs-poll/node_modules/lib0/logging.d.ts.map deleted file mode 100644 index 1f91f0c..0000000 --- a/yjs-poll/node_modules/lib0/logging.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["logging.js"],"names":[],"mappings":"AAmGO,+BAFI,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAM5C;AAMM,8BAFI,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAM5C;AAOM,gCAHI,KAAK,QAMf;AAQM,8BAJI,MAAM,UACN,MAAM,QAYhB;AAQM,uCAJI,MAAM,UACN,MAAM,QAIoC;AAK9C,+BAFI,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAM5C;AAKM,wCAFI,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAM5C;AAEM,iCAIN;AAMM,qCAHI,MAAW,IAAI,QAI4B;AAO/C,oCAJI,iBAAiB,UACjB,MAAM,QAIqB;AAEtC,iCAAqC;AAwDrC;IACE;;OAEG;IACH,iBAFW,OAAO,EAUjB;IAPC,aAAc;IACd;;OAEG;IACH,YAFU,OAAO,CAES;IAC1B,cAAc;IAIhB;;;OAGG;IACH,YAHW,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,cAClC,OAAO,QAoCjB;IAED;;OAEG;IACH,qBAFW,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAI5C;IAED,iBAQC;IAED;;OAEG;IACH,YAFW,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAa5C;IAED;;OAEG;IACH,gBAFW,KAAK,QAIf;IAED;;;OAGG;IACH,cAHW,MAAM,UACN,MAAM,QAWhB;IAED;;OAEG;IACH,eAFW,IAAI,QAMd;IAED,gBAIC;CACF;AAOM,oCAHI,OAAO,YAGsC;AAMjD,+CAHI,MAAM,GACL,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,IAAI,CAE6D"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/logging.js b/yjs-poll/node_modules/lib0/logging.js deleted file mode 100644 index d6c77c6..0000000 --- a/yjs-poll/node_modules/lib0/logging.js +++ /dev/null @@ -1,383 +0,0 @@ -/** - * Isomorphic logging module with support for colors! - * - * @module logging - */ - -import * as env from './environment.js' -import * as set from './set.js' -import * as pair from './pair.js' -import * as dom from './dom.js' -import * as json from './json.js' -import * as map from './map.js' -import * as eventloop from './eventloop.js' -import * as math from './math.js' -import * as common from './logging.common.js' - -export { BOLD, UNBOLD, BLUE, GREY, GREEN, RED, PURPLE, ORANGE, UNCOLOR } from './logging.common.js' - -/** - * @type {Object>} - */ -const _browserStyleMap = { - [common.BOLD]: pair.create('font-weight', 'bold'), - [common.UNBOLD]: pair.create('font-weight', 'normal'), - [common.BLUE]: pair.create('color', 'blue'), - [common.GREEN]: pair.create('color', 'green'), - [common.GREY]: pair.create('color', 'grey'), - [common.RED]: pair.create('color', 'red'), - [common.PURPLE]: pair.create('color', 'purple'), - [common.ORANGE]: pair.create('color', 'orange'), // not well supported in chrome when debugging node with inspector - TODO: deprecate - [common.UNCOLOR]: pair.create('color', 'black') -} - -/** - * @param {Array} args - * @return {Array} - */ -/* c8 ignore start */ -const computeBrowserLoggingArgs = (args) => { - if (args.length === 1 && args[0]?.constructor === Function) { - args = /** @type {Array} */ (/** @type {[function]} */ (args)[0]()) - } - const strBuilder = [] - const styles = [] - const currentStyle = map.create() - /** - * @type {Array} - */ - let logArgs = [] - // try with formatting until we find something unsupported - let i = 0 - for (; i < args.length; i++) { - const arg = args[i] - // @ts-ignore - const style = _browserStyleMap[arg] - if (style !== undefined) { - currentStyle.set(style.left, style.right) - } else { - if (arg === undefined) { - break - } - if (arg.constructor === String || arg.constructor === Number) { - const style = dom.mapToStyleString(currentStyle) - if (i > 0 || style.length > 0) { - strBuilder.push('%c' + arg) - styles.push(style) - } else { - strBuilder.push(arg) - } - } else { - break - } - } - } - if (i > 0) { - // create logArgs with what we have so far - logArgs = styles - logArgs.unshift(strBuilder.join('')) - } - // append the rest - for (; i < args.length; i++) { - const arg = args[i] - if (!(arg instanceof Symbol)) { - logArgs.push(arg) - } - } - return logArgs -} -/* c8 ignore stop */ - -/* c8 ignore start */ -const computeLoggingArgs = env.supportsColor - ? computeBrowserLoggingArgs - : common.computeNoColorLoggingArgs -/* c8 ignore stop */ - -/** - * @param {Array} args - */ -export const print = (...args) => { - console.log(...computeLoggingArgs(args)) - /* c8 ignore next */ - vconsoles.forEach((vc) => vc.print(args)) -} - -/* c8 ignore start */ -/** - * @param {Array} args - */ -export const warn = (...args) => { - console.warn(...computeLoggingArgs(args)) - args.unshift(common.ORANGE) - vconsoles.forEach((vc) => vc.print(args)) -} -/* c8 ignore stop */ - -/** - * @param {Error} err - */ -/* c8 ignore start */ -export const printError = (err) => { - console.error(err) - vconsoles.forEach((vc) => vc.printError(err)) -} -/* c8 ignore stop */ - -/** - * @param {string} url image location - * @param {number} height height of the image in pixel - */ -/* c8 ignore start */ -export const printImg = (url, height) => { - if (env.isBrowser) { - console.log( - '%c ', - `font-size: ${height}px; background-size: contain; background-repeat: no-repeat; background-image: url(${url})` - ) - // console.log('%c ', `font-size: ${height}x; background: url(${url}) no-repeat;`) - } - vconsoles.forEach((vc) => vc.printImg(url, height)) -} -/* c8 ignore stop */ - -/** - * @param {string} base64 - * @param {number} height - */ -/* c8 ignore next 2 */ -export const printImgBase64 = (base64, height) => - printImg(`data:image/gif;base64,${base64}`, height) - -/** - * @param {Array} args - */ -export const group = (...args) => { - console.group(...computeLoggingArgs(args)) - /* c8 ignore next */ - vconsoles.forEach((vc) => vc.group(args)) -} - -/** - * @param {Array} args - */ -export const groupCollapsed = (...args) => { - console.groupCollapsed(...computeLoggingArgs(args)) - /* c8 ignore next */ - vconsoles.forEach((vc) => vc.groupCollapsed(args)) -} - -export const groupEnd = () => { - console.groupEnd() - /* c8 ignore next */ - vconsoles.forEach((vc) => vc.groupEnd()) -} - -/** - * @param {function():Node} createNode - */ -/* c8 ignore next 2 */ -export const printDom = (createNode) => - vconsoles.forEach((vc) => vc.printDom(createNode())) - -/** - * @param {HTMLCanvasElement} canvas - * @param {number} height - */ -/* c8 ignore next 2 */ -export const printCanvas = (canvas, height) => - printImg(canvas.toDataURL(), height) - -export const vconsoles = set.create() - -/** - * @param {Array} args - * @return {Array} - */ -/* c8 ignore start */ -const _computeLineSpans = (args) => { - const spans = [] - const currentStyle = new Map() - // try with formatting until we find something unsupported - let i = 0 - for (; i < args.length; i++) { - let arg = args[i] - // @ts-ignore - const style = _browserStyleMap[arg] - if (style !== undefined) { - currentStyle.set(style.left, style.right) - } else { - if (arg === undefined) { - arg = 'undefined ' - } - if (arg.constructor === String || arg.constructor === Number) { - // @ts-ignore - const span = dom.element('span', [ - pair.create('style', dom.mapToStyleString(currentStyle)) - ], [dom.text(arg.toString())]) - if (span.innerHTML === '') { - span.innerHTML = ' ' - } - spans.push(span) - } else { - break - } - } - } - // append the rest - for (; i < args.length; i++) { - let content = args[i] - if (!(content instanceof Symbol)) { - if (content.constructor !== String && content.constructor !== Number) { - content = ' ' + json.stringify(content) + ' ' - } - spans.push( - dom.element('span', [], [dom.text(/** @type {string} */ (content))]) - ) - } - } - return spans -} -/* c8 ignore stop */ - -const lineStyle = - 'font-family:monospace;border-bottom:1px solid #e2e2e2;padding:2px;' - -/* c8 ignore start */ -export class VConsole { - /** - * @param {Element} dom - */ - constructor (dom) { - this.dom = dom - /** - * @type {Element} - */ - this.ccontainer = this.dom - this.depth = 0 - vconsoles.add(this) - } - - /** - * @param {Array} args - * @param {boolean} collapsed - */ - group (args, collapsed = false) { - eventloop.enqueue(() => { - const triangleDown = dom.element('span', [ - pair.create('hidden', collapsed), - pair.create('style', 'color:grey;font-size:120%;') - ], [dom.text('▼')]) - const triangleRight = dom.element('span', [ - pair.create('hidden', !collapsed), - pair.create('style', 'color:grey;font-size:125%;') - ], [dom.text('▶')]) - const content = dom.element( - 'div', - [pair.create( - 'style', - `${lineStyle};padding-left:${this.depth * 10}px` - )], - [triangleDown, triangleRight, dom.text(' ')].concat( - _computeLineSpans(args) - ) - ) - const nextContainer = dom.element('div', [ - pair.create('hidden', collapsed) - ]) - const nextLine = dom.element('div', [], [content, nextContainer]) - dom.append(this.ccontainer, [nextLine]) - this.ccontainer = nextContainer - this.depth++ - // when header is clicked, collapse/uncollapse container - dom.addEventListener(content, 'click', (_event) => { - nextContainer.toggleAttribute('hidden') - triangleDown.toggleAttribute('hidden') - triangleRight.toggleAttribute('hidden') - }) - }) - } - - /** - * @param {Array} args - */ - groupCollapsed (args) { - this.group(args, true) - } - - groupEnd () { - eventloop.enqueue(() => { - if (this.depth > 0) { - this.depth-- - // @ts-ignore - this.ccontainer = this.ccontainer.parentElement.parentElement - } - }) - } - - /** - * @param {Array} args - */ - print (args) { - eventloop.enqueue(() => { - dom.append(this.ccontainer, [ - dom.element('div', [ - pair.create( - 'style', - `${lineStyle};padding-left:${this.depth * 10}px` - ) - ], _computeLineSpans(args)) - ]) - }) - } - - /** - * @param {Error} err - */ - printError (err) { - this.print([common.RED, common.BOLD, err.toString()]) - } - - /** - * @param {string} url - * @param {number} height - */ - printImg (url, height) { - eventloop.enqueue(() => { - dom.append(this.ccontainer, [ - dom.element('img', [ - pair.create('src', url), - pair.create('height', `${math.round(height * 1.5)}px`) - ]) - ]) - }) - } - - /** - * @param {Node} node - */ - printDom (node) { - eventloop.enqueue(() => { - dom.append(this.ccontainer, [node]) - }) - } - - destroy () { - eventloop.enqueue(() => { - vconsoles.delete(this) - }) - } -} -/* c8 ignore stop */ - -/** - * @param {Element} dom - */ -/* c8 ignore next */ -export const createVConsole = (dom) => new VConsole(dom) - -/** - * @param {string} moduleName - * @return {function(...any):void} - */ -export const createModuleLogger = (moduleName) => common.createModuleLogger(print, moduleName) diff --git a/yjs-poll/node_modules/lib0/logging.node.d.ts b/yjs-poll/node_modules/lib0/logging.node.d.ts deleted file mode 100644 index 69edeeb..0000000 --- a/yjs-poll/node_modules/lib0/logging.node.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -export function print(...args: Array): void; -export function warn(...args: Array): void; -export function printError(err: Error): void; -export function printImg(_url: string, _height: number): void; -export function printImgBase64(base64: string, height: number): void; -export function group(...args: Array): void; -export function groupCollapsed(...args: Array): void; -export function groupEnd(): void; -export function printDom(_createNode: () => Node): void; -export function printCanvas(canvas: HTMLCanvasElement, height: number): void; -export function createVConsole(_dom: Element): void; -export function createModuleLogger(moduleName: string): (...args: any[]) => void; -export { BOLD, UNBOLD, BLUE, GREY, GREEN, RED, PURPLE, ORANGE, UNCOLOR } from "./logging.common.js"; -//# sourceMappingURL=logging.node.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/logging.node.d.ts.map b/yjs-poll/node_modules/lib0/logging.node.d.ts.map deleted file mode 100644 index a821eba..0000000 --- a/yjs-poll/node_modules/lib0/logging.node.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logging.node.d.ts","sourceRoot":"","sources":["logging.node.js"],"names":[],"mappings":"AA6EO,+BAFI,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,SAAS,CAAC,QAItD;AAMM,8BAFI,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAI5C;AAOM,gCAHI,KAAK,QAKf;AAQM,+BAJI,MAAM,WACN,MAAM,QAKhB;AAQM,uCAJI,MAAM,UACN,MAAM,QAIoC;AAM9C,+BAHI,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAK5C;AAMM,wCAHI,KAAK,CAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAK5C;AAGM,iCAEN;AAMM,sCAHI,MAAW,IAAI,QAGiB;AAOpC,oCAJI,iBAAiB,UACjB,MAAM,QAIqB;AAM/B,qCAHI,OAAO,QAGwB;AAOnC,+CAJI,MAAM,GACL,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,IAAI,CAG6D"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/logging.node.js b/yjs-poll/node_modules/lib0/logging.node.js deleted file mode 100644 index 63d41ec..0000000 --- a/yjs-poll/node_modules/lib0/logging.node.js +++ /dev/null @@ -1,164 +0,0 @@ -/** - * Isomorphic logging module with support for colors! - * - * @module logging - */ - -import * as env from './environment.js' -import * as common from './logging.common.js' - -export { BOLD, UNBOLD, BLUE, GREY, GREEN, RED, PURPLE, ORANGE, UNCOLOR } from './logging.common.js' - -const _nodeStyleMap = { - [common.BOLD]: '\u001b[1m', - [common.UNBOLD]: '\u001b[2m', - [common.BLUE]: '\x1b[34m', - [common.GREEN]: '\x1b[32m', - [common.GREY]: '\u001b[37m', - [common.RED]: '\x1b[31m', - [common.PURPLE]: '\x1b[35m', - [common.ORANGE]: '\x1b[38;5;208m', - [common.UNCOLOR]: '\x1b[0m' -} - -/* c8 ignore start */ -/** - * @param {Array>} args - * @return {Array} - */ -const computeNodeLoggingArgs = (args) => { - if (args.length === 1 && args[0]?.constructor === Function) { - args = /** @type {Array} */ (/** @type {[function]} */ (args)[0]()) - } - const strBuilder = [] - const logArgs = [] - // try with formatting until we find something unsupported - let i = 0 - for (; i < args.length; i++) { - const arg = args[i] - // @ts-ignore - const style = _nodeStyleMap[arg] - if (style !== undefined) { - strBuilder.push(style) - } else { - if (arg === undefined) { - break - } else if (arg.constructor === String || arg.constructor === Number) { - strBuilder.push(arg) - } else { - break - } - } - } - if (i > 0) { - // create logArgs with what we have so far - strBuilder.push('\x1b[0m') - logArgs.push(strBuilder.join('')) - } - // append the rest - for (; i < args.length; i++) { - const arg = args[i] - if (!(arg instanceof Symbol)) { - logArgs.push(arg) - } - } - return logArgs -} -/* c8 ignore stop */ - -/* c8 ignore start */ -const computeLoggingArgs = env.supportsColor - ? computeNodeLoggingArgs - : common.computeNoColorLoggingArgs -/* c8 ignore stop */ - -/** - * @param {Array} args - */ -export const print = (...args) => { - console.log(...computeLoggingArgs(args)) -} - -/* c8 ignore start */ -/** - * @param {Array} args - */ -export const warn = (...args) => { - console.warn(...computeLoggingArgs(args)) -} -/* c8 ignore stop */ - -/** - * @param {Error} err - */ -/* c8 ignore start */ -export const printError = (err) => { - console.error(err) -} -/* c8 ignore stop */ - -/** - * @param {string} _url image location - * @param {number} _height height of the image in pixel - */ -/* c8 ignore start */ -export const printImg = (_url, _height) => { - // console.log('%c ', `font-size: ${height}x; background: url(${url}) no-repeat;`) -} -/* c8 ignore stop */ - -/** - * @param {string} base64 - * @param {number} height - */ -/* c8 ignore next 2 */ -export const printImgBase64 = (base64, height) => - printImg(`data:image/gif;base64,${base64}`, height) - -/** - * @param {Array} args - */ -/* c8 ignore next 3 */ -export const group = (...args) => { - console.group(...computeLoggingArgs(args)) -} - -/** - * @param {Array} args - */ -/* c8 ignore next 3 */ -export const groupCollapsed = (...args) => { - console.groupCollapsed(...computeLoggingArgs(args)) -} - -/* c8 ignore next 3 */ -export const groupEnd = () => { - console.groupEnd() -} - -/** - * @param {function():Node} _createNode - */ -/* c8 ignore next 2 */ -export const printDom = (_createNode) => {} - -/** - * @param {HTMLCanvasElement} canvas - * @param {number} height - */ -/* c8 ignore next 2 */ -export const printCanvas = (canvas, height) => - printImg(canvas.toDataURL(), height) - -/** - * @param {Element} _dom - */ -/* c8 ignore next */ -export const createVConsole = (_dom) => {} - -/** - * @param {string} moduleName - * @return {function(...any):void} - */ -/* c8 ignore next */ -export const createModuleLogger = (moduleName) => common.createModuleLogger(print, moduleName) diff --git a/yjs-poll/node_modules/lib0/logging.test.d.ts b/yjs-poll/node_modules/lib0/logging.test.d.ts deleted file mode 100644 index 0bdf329..0000000 --- a/yjs-poll/node_modules/lib0/logging.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testLogging(): void; -export function testModuleLogger(): void; -//# sourceMappingURL=logging.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/logging.test.d.ts.map b/yjs-poll/node_modules/lib0/logging.test.d.ts.map deleted file mode 100644 index 38b69bf..0000000 --- a/yjs-poll/node_modules/lib0/logging.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logging.test.d.ts","sourceRoot":"","sources":["logging.test.js"],"names":[],"mappings":"AAEO,oCAgBN;AAEM,yCAON"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/map.d.ts b/yjs-poll/node_modules/lib0/map.d.ts deleted file mode 100644 index f1f216e..0000000 --- a/yjs-poll/node_modules/lib0/map.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export function create(): Map; -export function copy(m: Map): Map; -export function setIfUndefined, CF extends MAP extends Map ? () => V : unknown>(map: MAP, key: MAP extends Map ? K : unknown, createT: CF): ReturnType; -export function map(m: Map, f: (arg0: V, arg1: K) => R): Array; -export function any(m: Map, f: (arg0: V, arg1: K) => boolean): boolean; -export function all(m: Map, f: (arg0: V, arg1: K) => boolean): boolean; -export type GlobalMap = Map; -//# sourceMappingURL=map.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/map.d.ts.map b/yjs-poll/node_modules/lib0/map.d.ts.map deleted file mode 100644 index 6ff23cd..0000000 --- a/yjs-poll/node_modules/lib0/map.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["map.js"],"names":[],"mappings":"AAoBO,0BAJK,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAIY;AAU9B,qBAJM,CAAC,EAAC,CAAC,KACL,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,GACP,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,CAMnB;AAkBM,+BAPsB,GAAG,SAAlB,GAAG,CAAC,GAAG,EAAE,GAAG,CAAE,EACyC,EAAE,SAAzD,GAAG,SAAS,GAAG,CAAC,GAAG,EAAC,MAAM,CAAC,CAAC,GAAG,MAAW,CAAC,GAAG,OAAQ,OACzD,GAAG,OACH,GAAG,SAAS,GAAG,CAAC,MAAM,CAAC,EAAC,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO,WAC1C,EAAE,GACD,UAAU,CAAC,EAAE,CAAC,CAQzB;AAaM,oBAPM,CAAC,EACD,CAAC,EACD,CAAC,KACH,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,KACR,CAAS,IAAC,EAAD,CAAC,EAAC,IAAC,EAAD,CAAC,KAAE,CAAC,GACd,KAAK,CAAC,CAAC,CAAC,CAQnB;AAcM,oBANM,CAAC,EACD,CAAC,KACH,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,KACR,CAAS,IAAC,EAAD,CAAC,EAAC,IAAC,EAAD,CAAC,KAAE,OAAO,GACpB,OAAO,CASlB;AAYM,oBANM,CAAC,EACD,CAAC,KACH,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,KACR,CAAS,IAAC,EAAD,CAAC,EAAC,IAAC,EAAD,CAAC,KAAE,OAAO,GACpB,OAAO,CASlB;sBA9GY,CAAC,EACD,CAAC,IACD,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/map.js b/yjs-poll/node_modules/lib0/map.js deleted file mode 100644 index 3a88f51..0000000 --- a/yjs-poll/node_modules/lib0/map.js +++ /dev/null @@ -1,118 +0,0 @@ -/** - * Utility module to work with key-value stores. - * - * @module map - */ - -/** - * @template K - * @template V - * @typedef {Map} GlobalMap - */ - -/** - * Creates a new Map instance. - * - * @function - * @return {Map} - * - * @function - */ -export const create = () => new Map() - -/** - * Copy a Map object into a fresh Map object. - * - * @function - * @template K,V - * @param {Map} m - * @return {Map} - */ -export const copy = m => { - const r = create() - m.forEach((v, k) => { r.set(k, v) }) - return r -} - -/** - * Get map property. Create T if property is undefined and set T on map. - * - * ```js - * const listeners = map.setIfUndefined(events, 'eventName', set.create) - * listeners.add(listener) - * ``` - * - * @function - * @template {Map} MAP - * @template {MAP extends Map ? function():V : unknown} CF - * @param {MAP} map - * @param {MAP extends Map ? K : unknown} key - * @param {CF} createT - * @return {ReturnType} - */ -export const setIfUndefined = (map, key, createT) => { - let set = map.get(key) - if (set === undefined) { - map.set(key, set = createT()) - } - return set -} - -/** - * Creates an Array and populates it with the content of all key-value pairs using the `f(value, key)` function. - * - * @function - * @template K - * @template V - * @template R - * @param {Map} m - * @param {function(V,K):R} f - * @return {Array} - */ -export const map = (m, f) => { - const res = [] - for (const [key, value] of m) { - res.push(f(value, key)) - } - return res -} - -/** - * Tests whether any key-value pairs pass the test implemented by `f(value, key)`. - * - * @todo should rename to some - similarly to Array.some - * - * @function - * @template K - * @template V - * @param {Map} m - * @param {function(V,K):boolean} f - * @return {boolean} - */ -export const any = (m, f) => { - for (const [key, value] of m) { - if (f(value, key)) { - return true - } - } - return false -} - -/** - * Tests whether all key-value pairs pass the test implemented by `f(value, key)`. - * - * @function - * @template K - * @template V - * @param {Map} m - * @param {function(V,K):boolean} f - * @return {boolean} - */ -export const all = (m, f) => { - for (const [key, value] of m) { - if (!f(value, key)) { - return false - } - } - return true -} diff --git a/yjs-poll/node_modules/lib0/map.test.d.ts b/yjs-poll/node_modules/lib0/map.test.d.ts deleted file mode 100644 index ca8dbcc..0000000 --- a/yjs-poll/node_modules/lib0/map.test.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function testMap(_tc: t.TestCase): void; -export function testTypeDefinitions(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=map.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/map.test.d.ts.map b/yjs-poll/node_modules/lib0/map.test.d.ts.map deleted file mode 100644 index 41f7c5f..0000000 --- a/yjs-poll/node_modules/lib0/map.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"map.test.d.ts","sourceRoot":"","sources":["map.test.js"],"names":[],"mappings":"AAOO,6BAFI,CAAC,CAAC,QAAQ,QAsBpB;AAKM,yCAFI,CAAC,CAAC,QAAQ,QAwBpB;mBApDkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/math.d.ts b/yjs-poll/node_modules/lib0/math.d.ts deleted file mode 100644 index 7490f90..0000000 --- a/yjs-poll/node_modules/lib0/math.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Common Math expressions. - * - * @module math - */ -export const floor: (x: number) => number; -export const ceil: (x: number) => number; -export const abs: (x: number) => number; -export const imul: (x: number, y: number) => number; -export const round: (x: number) => number; -export const log10: (x: number) => number; -export const log2: (x: number) => number; -export const log: (x: number) => number; -export const sqrt: (x: number) => number; -export function add(a: number, b: number): number; -export function min(a: number, b: number): number; -export function max(a: number, b: number): number; -export const isNaN: (number: unknown) => boolean; -export const pow: (x: number, y: number) => number; -export function exp10(exp: number): number; -export const sign: (x: number) => number; -export function isNegativeZero(n: number): boolean; -//# sourceMappingURL=math.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/math.d.ts.map b/yjs-poll/node_modules/lib0/math.d.ts.map deleted file mode 100644 index 265d466..0000000 --- a/yjs-poll/node_modules/lib0/math.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["math.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,0CAA+B;AAC/B,yCAA6B;AAC7B,wCAA2B;AAC3B,oDAA6B;AAC7B,0CAA+B;AAC/B,0CAA+B;AAC/B,yCAA6B;AAC7B,wCAA2B;AAC3B,yCAA6B;AAQtB,uBAJI,MAAM,KACN,MAAM,GACL,MAAM,CAEgB;AAQ3B,uBAJI,MAAM,KACN,MAAM,GACL,MAAM,CAEwB;AAQnC,uBAJI,MAAM,KACN,MAAM,GACL,MAAM,CAEwB;AAE1C,iDAAiC;AAEjC,mDAA2B;AAOpB,2BAHI,MAAM,GACL,MAAM,CAE2B;AAE7C,yCAA6B;AAQtB,kCAHI,MAAM,GACL,OAAO,CAE2C"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/math.js b/yjs-poll/node_modules/lib0/math.js deleted file mode 100644 index 50c0d8d..0000000 --- a/yjs-poll/node_modules/lib0/math.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Common Math expressions. - * - * @module math - */ - -export const floor = Math.floor -export const ceil = Math.ceil -export const abs = Math.abs -export const imul = Math.imul -export const round = Math.round -export const log10 = Math.log10 -export const log2 = Math.log2 -export const log = Math.log -export const sqrt = Math.sqrt - -/** - * @function - * @param {number} a - * @param {number} b - * @return {number} The sum of a and b - */ -export const add = (a, b) => a + b - -/** - * @function - * @param {number} a - * @param {number} b - * @return {number} The smaller element of a and b - */ -export const min = (a, b) => a < b ? a : b - -/** - * @function - * @param {number} a - * @param {number} b - * @return {number} The bigger element of a and b - */ -export const max = (a, b) => a > b ? a : b - -export const isNaN = Number.isNaN - -export const pow = Math.pow -/** - * Base 10 exponential function. Returns the value of 10 raised to the power of pow. - * - * @param {number} exp - * @return {number} - */ -export const exp10 = exp => Math.pow(10, exp) - -export const sign = Math.sign - -/** - * Check whether n is negative, while considering the -0 edge case. While `-0 < 0` is false, this - * function returns true for -0,-1,,.. and returns false for 0,1,2,... - * @param {number} n - * @return {boolean} Wether n is negative. This function also distinguishes between -0 and +0 - */ -export const isNegativeZero = n => n !== 0 ? n < 0 : 1 / n < 0 diff --git a/yjs-poll/node_modules/lib0/math.test.d.ts b/yjs-poll/node_modules/lib0/math.test.d.ts deleted file mode 100644 index ff01d80..0000000 --- a/yjs-poll/node_modules/lib0/math.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testMath(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=math.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/math.test.d.ts.map b/yjs-poll/node_modules/lib0/math.test.d.ts.map deleted file mode 100644 index af9e13f..0000000 --- a/yjs-poll/node_modules/lib0/math.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"math.test.d.ts","sourceRoot":"","sources":["math.test.js"],"names":[],"mappings":"AAOO,6BAFI,CAAC,CAAC,QAAQ,QA0BpB;mBA/BkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/metric.d.ts b/yjs-poll/node_modules/lib0/metric.d.ts deleted file mode 100644 index 144f43c..0000000 --- a/yjs-poll/node_modules/lib0/metric.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -export const yotta: 1e+24; -export const zetta: 1e+21; -export const exa: 1000000000000000000; -export const peta: 1000000000000000; -export const tera: 1000000000000; -export const giga: 1000000000; -export const mega: 1000000; -export const kilo: 1000; -export const hecto: 100; -export const deca: 10; -export const deci: 0.1; -export const centi: 0.01; -export const milli: 0.001; -export const micro: 0.000001; -export const nano: 1e-9; -export const pico: 1e-12; -export const femto: 1e-15; -export const atto: 1e-18; -export const zepto: 1e-21; -export const yocto: 1e-24; -export function prefix(n: number, baseMultiplier?: number): { - n: number; - prefix: string; -}; -//# sourceMappingURL=metric.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/metric.d.ts.map b/yjs-poll/node_modules/lib0/metric.d.ts.map deleted file mode 100644 index f8137af..0000000 --- a/yjs-poll/node_modules/lib0/metric.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"metric.d.ts","sourceRoot":"","sources":["metric.js"],"names":[],"mappings":"AAQA,oBAAqB,KAAI,CAAA;AACzB,oBAAqB,KAAI,CAAA;AACzB,kBAAmB,mBAAI,CAAA;AACvB,mBAAoB,gBAAI,CAAA;AACxB,mBAAoB,aAAI,CAAA;AACxB,mBAAoB,UAAG,CAAA;AACvB,mBAAoB,OAAG,CAAA;AACvB,mBAAoB,IAAG,CAAA;AACvB,oBAAqB,GAAG,CAAA;AACxB,mBAAoB,EAAE,CAAA;AACtB,mBAAoB,GAAG,CAAA;AACvB,oBAAqB,IAAI,CAAA;AACzB,oBAAqB,KAAI,CAAA;AACzB,oBAAqB,QAAI,CAAA;AACzB,mBAAoB,IAAI,CAAA;AACxB,mBAAoB,KAAK,CAAA;AACzB,oBAAqB,KAAK,CAAA;AAC1B,mBAAoB,KAAK,CAAA;AACzB,oBAAqB,KAAK,CAAA;AAC1B,oBAAqB,KAAK,CAAA;AAYnB,0BAJI,MAAM,mBACN,MAAM,GACL;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,MAAM,EAAC,MAAM,CAAA;CAAC,CAkBnC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/metric.js b/yjs-poll/node_modules/lib0/metric.js deleted file mode 100644 index 6365453..0000000 --- a/yjs-poll/node_modules/lib0/metric.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Utility module to convert metric values. - * - * @module metric - */ - -import * as math from './math.js' - -export const yotta = 1e24 -export const zetta = 1e21 -export const exa = 1e18 -export const peta = 1e15 -export const tera = 1e12 -export const giga = 1e9 -export const mega = 1e6 -export const kilo = 1e3 -export const hecto = 1e2 -export const deca = 10 -export const deci = 0.1 -export const centi = 0.01 -export const milli = 1e-3 -export const micro = 1e-6 -export const nano = 1e-9 -export const pico = 1e-12 -export const femto = 1e-15 -export const atto = 1e-18 -export const zepto = 1e-21 -export const yocto = 1e-24 - -const prefixUp = ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'] -const prefixDown = ['', 'm', 'μ', 'n', 'p', 'f', 'a', 'z', 'y'] - -/** - * Calculate the metric prefix for a number. Assumes E.g. `prefix(1000) = { n: 1, prefix: 'k' }` - * - * @param {number} n - * @param {number} [baseMultiplier] Multiplier of the base (10^(3*baseMultiplier)). E.g. `convert(time, -3)` if time is already in milli seconds - * @return {{n:number,prefix:string}} - */ -export const prefix = (n, baseMultiplier = 0) => { - const nPow = n === 0 ? 0 : math.log10(n) - let mult = 0 - while (nPow < mult * 3 && baseMultiplier > -8) { - baseMultiplier-- - mult-- - } - while (nPow >= 3 + mult * 3 && baseMultiplier < 8) { - baseMultiplier++ - mult++ - } - const prefix = baseMultiplier < 0 ? prefixDown[-baseMultiplier] : prefixUp[baseMultiplier] - return { - n: math.round((mult > 0 ? n / math.exp10(mult * 3) : n * math.exp10(mult * -3)) * 1e12) / 1e12, - prefix - } -} diff --git a/yjs-poll/node_modules/lib0/metric.test.d.ts b/yjs-poll/node_modules/lib0/metric.test.d.ts deleted file mode 100644 index 3672726..0000000 --- a/yjs-poll/node_modules/lib0/metric.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testMetricPrefix(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=metric.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/metric.test.d.ts.map b/yjs-poll/node_modules/lib0/metric.test.d.ts.map deleted file mode 100644 index e129d7b..0000000 --- a/yjs-poll/node_modules/lib0/metric.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"metric.test.d.ts","sourceRoot":"","sources":["metric.test.js"],"names":[],"mappings":"AAMO,qCAFI,CAAC,CAAC,QAAQ,QA8BpB;mBAlCkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/mutex.d.ts b/yjs-poll/node_modules/lib0/mutex.d.ts deleted file mode 100644 index 92fd40f..0000000 --- a/yjs-poll/node_modules/lib0/mutex.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function createMutex(): mutex; -export type mutex = (cb: () => void, elseCb?: (() => void) | undefined) => any; -//# sourceMappingURL=mutex.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/mutex.d.ts.map b/yjs-poll/node_modules/lib0/mutex.d.ts.map deleted file mode 100644 index c38ab37..0000000 --- a/yjs-poll/node_modules/lib0/mutex.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mutex.d.ts","sourceRoot":"","sources":["mutex.js"],"names":[],"mappings":"AA4BO,+BAHK,KAAK,CAiBhB;yBAlCU,MAAW,IAAI,kBACJ,IAAI"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/mutex.js b/yjs-poll/node_modules/lib0/mutex.js deleted file mode 100644 index 41513ef..0000000 --- a/yjs-poll/node_modules/lib0/mutex.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Mutual exclude for JavaScript. - * - * @module mutex - */ - -/** - * @callback mutex - * @param {function():void} cb Only executed when this mutex is not in the current stack - * @param {function():void} [elseCb] Executed when this mutex is in the current stack - */ - -/** - * Creates a mutual exclude function with the following property: - * - * ```js - * const mutex = createMutex() - * mutex(() => { - * // This function is immediately executed - * mutex(() => { - * // This function is not executed, as the mutex is already active. - * }) - * }) - * ``` - * - * @return {mutex} A mutual exclude function - * @public - */ -export const createMutex = () => { - let token = true - return (f, g) => { - if (token) { - token = false - try { - f() - } finally { - token = true - } - } else if (g !== undefined) { - g() - } - } -} diff --git a/yjs-poll/node_modules/lib0/mutex.test.d.ts b/yjs-poll/node_modules/lib0/mutex.test.d.ts deleted file mode 100644 index d58484b..0000000 --- a/yjs-poll/node_modules/lib0/mutex.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testMutex(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=mutex.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/mutex.test.d.ts.map b/yjs-poll/node_modules/lib0/mutex.test.d.ts.map deleted file mode 100644 index 3d0251b..0000000 --- a/yjs-poll/node_modules/lib0/mutex.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mutex.test.d.ts","sourceRoot":"","sources":["mutex.test.js"],"names":[],"mappings":"AAMO,+BAFI,CAAC,CAAC,QAAQ,QAmBpB;mBAvBkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/number.d.ts b/yjs-poll/node_modules/lib0/number.d.ts deleted file mode 100644 index 851ba98..0000000 --- a/yjs-poll/node_modules/lib0/number.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export const MAX_SAFE_INTEGER: number; -export const MIN_SAFE_INTEGER: number; -export const LOWEST_INT32: number; -export const HIGHEST_INT32: number; -export const HIGHEST_UINT32: number; -export const isInteger: (number: unknown) => boolean; -export const isNaN: (number: unknown) => boolean; -export const parseInt: (string: string, radix?: number) => number; -export function countBits(n: number): number; -//# sourceMappingURL=number.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/number.d.ts.map b/yjs-poll/node_modules/lib0/number.d.ts.map deleted file mode 100644 index 4492025..0000000 --- a/yjs-poll/node_modules/lib0/number.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["number.js"],"names":[],"mappings":"AASA,sCAAuD;AACvD,sCAAuD;AAEvD,kCAAmC;AACnC,mCAA0C;AAC1C,oCAA2C;AAG3C,qDAAyH;AACzH,iDAAiC;AACjC,kEAAuC;AAShC,6BAFI,MAAM,UAUhB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/number.js b/yjs-poll/node_modules/lib0/number.js deleted file mode 100644 index bbc297a..0000000 --- a/yjs-poll/node_modules/lib0/number.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Utility helpers for working with numbers. - * - * @module number - */ - -import * as math from './math.js' -import * as binary from './binary.js' - -export const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER -export const MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER - -export const LOWEST_INT32 = 1 << 31 -export const HIGHEST_INT32 = binary.BITS31 -export const HIGHEST_UINT32 = binary.BITS32 - -/* c8 ignore next */ -export const isInteger = Number.isInteger || (num => typeof num === 'number' && isFinite(num) && math.floor(num) === num) -export const isNaN = Number.isNaN -export const parseInt = Number.parseInt - -/** - * Count the number of "1" bits in an unsigned 32bit number. - * - * Super fun bitcount algorithm by Brian Kernighan. - * - * @param {number} n - */ -export const countBits = n => { - n &= binary.BITS32 - let count = 0 - while (n) { - n &= (n - 1) - count++ - } - return count -} diff --git a/yjs-poll/node_modules/lib0/number.test.d.ts b/yjs-poll/node_modules/lib0/number.test.d.ts deleted file mode 100644 index 71df185..0000000 --- a/yjs-poll/node_modules/lib0/number.test.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function testNumber(_tc: t.TestCase): void; -export function testShiftVsDivision(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=number.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/number.test.d.ts.map b/yjs-poll/node_modules/lib0/number.test.d.ts.map deleted file mode 100644 index 480fc6c..0000000 --- a/yjs-poll/node_modules/lib0/number.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"number.test.d.ts","sourceRoot":"","sources":["number.test.js"],"names":[],"mappings":"AAQO,gCAFI,CAAC,CAAC,QAAQ,QAiBpB;AAOM,wCAFI,CAAC,CAAC,QAAQ,QA6DpB;mBAzFkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/object.d.ts b/yjs-poll/node_modules/lib0/object.d.ts deleted file mode 100644 index 59f4dfe..0000000 --- a/yjs-poll/node_modules/lib0/object.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -export function create(): { - [x: string]: any; -}; -export function isObject(o: any): o is { - [k: string]: any; -}; -/** - * Object.assign - */ -export const assign: { - (target: T, source: U): T & U; - (target: T, source1: U, source2: V_1): T & U & V_1; - (target: T, source1: U, source2: V_1, source3: W): T & U & V_1 & W; - (target: object, ...sources: any[]): any; -}; -/** - * @param {Object} obj - */ -export const keys: { - (o: object): string[]; - (o: {}): string[]; -}; -/** - * @template V - * @param {{[key:string]: V}} obj - * @return {Array} - */ -export const values: { - (o: { - [s: string]: T; - } | ArrayLike): T[]; - (o: {}): any[]; -}; -export function forEach(obj: { - [k: string]: V_1; -}, f: (arg0: V_1, arg1: string) => any): void; -export function map(obj: { - [x: string]: any; -}, f: (arg0: any, arg1: string) => R): Array; -export function length(obj: { - [x: string]: any; -}): number; -export function size(obj: { - [x: string]: any; -}): number; -export function some(obj: T, f: (v: T[keyof T], k: keyof T) => boolean): boolean; -export function isEmpty(obj: Object | null | undefined): boolean; -export function every(obj: T, f: (v: T[keyof T], k: keyof T) => boolean): boolean; -export function hasProperty(obj: any, key: string | number | symbol): boolean; -export function equalFlat(a: { - [x: string]: any; -}, b: { - [x: string]: any; -}): boolean; -/** - * Make an object immutable. This hurts performance and is usually not needed if you perform good - * coding practices. - */ -export const freeze: { - (f: T): T; - (o: T): Readonly; - (o: T): Readonly; -}; -export function deepFreeze(o: T): Readonly; -export function setIfUndefined(o: KV, key: K, createT: () => KV[K]): KV[K]; -//# sourceMappingURL=object.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/object.d.ts.map b/yjs-poll/node_modules/lib0/object.d.ts.map deleted file mode 100644 index 13fb8cb..0000000 --- a/yjs-poll/node_modules/lib0/object.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["object.js"],"names":[],"mappings":"AAWO;;EAAwC;AAMxC,4BAHI,GAAG,GACF,CAAC,IAAI;IAAE,CAAC,CAAC,EAAC,MAAM,GAAE,GAAG,CAAA;CAAE,CAEe;AAElD;;GAEG;AACH;;;;;EAAmC;AAEnC;;GAEG;AACH;;;EAA+B;AAE/B;;;;GAIG;AACH;;;;;EAAmC;AAO5B,kCAHI;IAAC,CAAC,CAAC,EAAC,MAAM,GAAE,GAAC,CAAA;CAAC,KACd,CAAS,IAAC,EAAD,GAAC,EAAC,IAAM,EAAN,MAAM,KAAE,GAAG,QAMhC;AAUM,oBALM,CAAC;;MAEH,CAAS,IAAG,EAAH,GAAG,EAAC,IAAM,EAAN,MAAM,KAAE,CAAC,GACrB,KAAK,CAAC,CAAC,CAAC,CAQnB;AAOM;;IAFK,MAAM,CAE2B;AAMtC;;IAFK,MAAM,CAEyB;AAQpC,qBAL4C,CAAC,SAAvC;IAAG,CAAC,GAAG,EAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAG,GAAG,CAAA;CAAG,OACvC,CAAC,KACD,CAAC,CAAC,EAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAC,CAAC,EAAC,MAAM,CAAC,KAAG,OAAO,GAChC,OAAO,CASlB;AAKM,6BAFI,MAAM,GAAC,IAAI,GAAC,SAAS,WAQ/B;AAQM,sBAL4C,CAAC,SAAvC;IAAG,CAAC,GAAG,EAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAG,GAAG,CAAA;CAAG,OACvC,CAAC,KACD,CAAC,CAAC,EAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAC,CAAC,EAAC,MAAM,CAAC,KAAG,OAAO,GAChC,OAAO,CASlB;AASM,iCAJI,GAAG,OACH,MAAM,GAAC,MAAM,GAAC,MAAM,GACnB,OAAO,CAEoE;AAOhF;;;;IAFK,OAAO,CAE2J;AAE9K;;;GAGG;AACH;;;;;;EAAmC;AAU5B,2BAJY,CAAC,qBACT,CAAC,GACA,QAAQ,CAAC,CAAC,CAAC,CAUtB;AAaM,+BAPe,EAAE,SAAX,MAAQ,EACI,CAAC,SAAb,MAAO,EAAG,gBACZ,EAAE,OACF,CAAC,WACD,MAAM,EAAE,CAAC,CAAC,CAAC,GACV,EAAE,CAAC,CAAC,CAAC,CAEqF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/object.js b/yjs-poll/node_modules/lib0/object.js deleted file mode 100644 index f0e52ca..0000000 --- a/yjs-poll/node_modules/lib0/object.js +++ /dev/null @@ -1,169 +0,0 @@ -import * as equalityTrait from './trait/equality.js' - -/** - * Utility functions for working with EcmaScript objects. - * - * @module object - */ - -/** - * @return {Object} obj - */ -export const create = () => Object.create(null) - -/** - * @param {any} o - * @return {o is { [k:string]:any }} - */ -export const isObject = o => typeof o === 'object' - -/** - * Object.assign - */ -export const assign = Object.assign - -/** - * @param {Object} obj - */ -export const keys = Object.keys - -/** - * @template V - * @param {{[key:string]: V}} obj - * @return {Array} - */ -export const values = Object.values - -/** - * @template V - * @param {{[k:string]:V}} obj - * @param {function(V,string):any} f - */ -export const forEach = (obj, f) => { - for (const key in obj) { - f(obj[key], key) - } -} - -/** - * @todo implement mapToArray & map - * - * @template R - * @param {Object} obj - * @param {function(any,string):R} f - * @return {Array} - */ -export const map = (obj, f) => { - const results = [] - for (const key in obj) { - results.push(f(obj[key], key)) - } - return results -} - -/** - * @deprecated use object.size instead - * @param {Object} obj - * @return {number} - */ -export const length = obj => keys(obj).length - -/** - * @param {Object} obj - * @return {number} - */ -export const size = obj => keys(obj).length - -/** - * @template {{ [key:string|number|symbol]: any }} T - * @param {T} obj - * @param {(v:T[keyof T],k:keyof T)=>boolean} f - * @return {boolean} - */ -export const some = (obj, f) => { - for (const key in obj) { - if (f(obj[key], key)) { - return true - } - } - return false -} - -/** - * @param {Object|null|undefined} obj - */ -export const isEmpty = obj => { - // eslint-disable-next-line no-unreachable-loop - for (const _k in obj) { - return false - } - return true -} - -/** - * @template {{ [key:string|number|symbol]: any }} T - * @param {T} obj - * @param {(v:T[keyof T],k:keyof T)=>boolean} f - * @return {boolean} - */ -export const every = (obj, f) => { - for (const key in obj) { - if (!f(obj[key], key)) { - return false - } - } - return true -} - -/** - * Calls `Object.prototype.hasOwnProperty`. - * - * @param {any} obj - * @param {string|number|symbol} key - * @return {boolean} - */ -export const hasProperty = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key) - -/** - * @param {Object} a - * @param {Object} b - * @return {boolean} - */ -export const equalFlat = (a, b) => a === b || (size(a) === size(b) && every(a, (val, key) => (val !== undefined || hasProperty(b, key)) && equalityTrait.equals(b[key], val))) - -/** - * Make an object immutable. This hurts performance and is usually not needed if you perform good - * coding practices. - */ -export const freeze = Object.freeze - -/** - * Make an object and all its children immutable. - * This *really* hurts performance and is usually not needed if you perform good coding practices. - * - * @template {any} T - * @param {T} o - * @return {Readonly} - */ -export const deepFreeze = (o) => { - for (const key in o) { - const c = o[key] - if (typeof c === 'object' || typeof c === 'function') { - deepFreeze(o[key]) - } - } - return freeze(o) -} - -/** - * Get object property. Create T if property is undefined and set T on object. - * - * @function - * @template {object} KV - * @template {keyof KV} [K=keyof KV] - * @param {KV} o - * @param {K} key - * @param {() => KV[K]} createT - * @return {KV[K]} - */ -export const setIfUndefined = (o, key, createT) => hasProperty(o, key) ? o[key] : (o[key] = createT()) diff --git a/yjs-poll/node_modules/lib0/object.test.d.ts b/yjs-poll/node_modules/lib0/object.test.d.ts deleted file mode 100644 index 9b50e5f..0000000 --- a/yjs-poll/node_modules/lib0/object.test.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export function testEqualFlat(): void; -export function testObject(_tc: t.TestCase): void; -export function testFreeze(_tc: t.TestCase): void; -export function testSetifundefined(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=object.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/object.test.d.ts.map b/yjs-poll/node_modules/lib0/object.test.d.ts.map deleted file mode 100644 index b51e06f..0000000 --- a/yjs-poll/node_modules/lib0/object.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"object.test.d.ts","sourceRoot":"","sources":["object.test.js"],"names":[],"mappings":"AAIO,sCAEN;AAKM,gCAFI,CAAC,CAAC,QAAQ,QA4CpB;AAKM,gCAFI,CAAC,CAAC,QAAQ,QAuBpB;AAKM,wCAFI,CAAC,CAAC,QAAQ,QAgBpB;mBAlGkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/observable.d.ts b/yjs-poll/node_modules/lib0/observable.d.ts deleted file mode 100644 index 8d83170..0000000 --- a/yjs-poll/node_modules/lib0/observable.d.ts +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Handles named events. - * @experimental - * - * This is basically a (better typed) duplicate of Observable, which will replace Observable in the - * next release. - * - * @template {{[key in keyof EVENTS]: function(...any):void}} EVENTS - */ -export class ObservableV2 void; }> { - /** - * Some desc. - * @type {Map>} - */ - _observers: Map>; - /** - * @template {keyof EVENTS & string} NAME - * @param {NAME} name - * @param {EVENTS[NAME]} f - */ - on(name: NAME, f: EVENTS[NAME]): EVENTS[NAME]; - /** - * @template {keyof EVENTS & string} NAME - * @param {NAME} name - * @param {EVENTS[NAME]} f - */ - once(name: NAME, f: EVENTS[NAME]): void; - /** - * @template {keyof EVENTS & string} NAME - * @param {NAME} name - * @param {EVENTS[NAME]} f - */ - off(name: NAME, f: EVENTS[NAME]): void; - /** - * Emit a named event. All registered event listeners that listen to the - * specified name will receive the event. - * - * @todo This should catch exceptions - * - * @template {keyof EVENTS & string} NAME - * @param {NAME} name The event name. - * @param {Parameters} args The arguments that are applied to the event listener. - */ - emit(name: NAME, args: Parameters): void; - destroy(): void; -} -/** - * Handles named events. - * - * @deprecated - * @template N - */ -export class Observable { - /** - * Some desc. - * @type {Map} - */ - _observers: Map; - /** - * @param {N} name - * @param {function} f - */ - on(name: N, f: Function): void; - /** - * @param {N} name - * @param {function} f - */ - once(name: N, f: Function): void; - /** - * @param {N} name - * @param {function} f - */ - off(name: N, f: Function): void; - /** - * Emit a named event. All registered event listeners that listen to the - * specified name will receive the event. - * - * @todo This should catch exceptions - * - * @param {N} name The event name. - * @param {Array} args The arguments that are applied to the event listener. - */ - emit(name: N, args: Array): void; - destroy(): void; -} -//# sourceMappingURL=observable.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/observable.d.ts.map b/yjs-poll/node_modules/lib0/observable.d.ts.map deleted file mode 100644 index 00ceb94..0000000 --- a/yjs-poll/node_modules/lib0/observable.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"observable.d.ts","sourceRoot":"","sources":["observable.js"],"names":[],"mappings":"AAUA;;;;;;;;GAQG;AACH,0BAF8D,MAAM,SAAvD,GAAG,GAAG,IAAI,MAAM,MAAM,GAAG,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,IAAI,GAAE;IAIzD;;;OAGG;IACH,YAFU,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAED;IAGhC;;;;OAIG;IACH,GAJqC,IAAI,SAA3B,MAAM,MAAM,GAAG,MAAO,QACzB,IAAI,KACJ,MAAM,CAAC,IAAI,CAAC,gBAKtB;IAED;;;;OAIG;IACH,KAJqC,IAAI,SAA3B,MAAM,MAAM,GAAG,MAAO,QACzB,IAAI,KACJ,MAAM,CAAC,IAAI,CAAC,QAWtB;IAED;;;;OAIG;IACH,IAJqC,IAAI,SAA3B,MAAM,MAAM,GAAG,MAAO,QACzB,IAAI,KACJ,MAAM,CAAC,IAAI,CAAC,QAUtB;IAED;;;;;;;;;OASG;IACH,KAJqC,IAAI,SAA3B,MAAM,MAAM,GAAG,MAAO,QACzB,IAAI,QACJ,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAKlC;IAED,gBAEC;CACF;AAGD;;;;;GAKG;AACH,wBAFa,CAAC;IAIV;;;OAGG;IACH,YAFU,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAES;IAGhC;;;OAGG;IACH,SAHW,CAAC,qBAKX;IAED;;;OAGG;IACH,WAHW,CAAC,qBAYX;IAED;;;OAGG;IACH,UAHW,CAAC,qBAWX;IAED;;;;;;;;OAQG;IACH,WAHW,CAAC,QACD,KAAK,CAAC,GAAG,CAAC,QAKpB;IAED,gBAEC;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/observable.js b/yjs-poll/node_modules/lib0/observable.js deleted file mode 100644 index c1c0ed2..0000000 --- a/yjs-poll/node_modules/lib0/observable.js +++ /dev/null @@ -1,161 +0,0 @@ -/** - * Observable class prototype. - * - * @module observable - */ - -import * as map from './map.js' -import * as set from './set.js' -import * as array from './array.js' - -/** - * Handles named events. - * @experimental - * - * This is basically a (better typed) duplicate of Observable, which will replace Observable in the - * next release. - * - * @template {{[key in keyof EVENTS]: function(...any):void}} EVENTS - */ -export class ObservableV2 { - constructor () { - /** - * Some desc. - * @type {Map>} - */ - this._observers = map.create() - } - - /** - * @template {keyof EVENTS & string} NAME - * @param {NAME} name - * @param {EVENTS[NAME]} f - */ - on (name, f) { - map.setIfUndefined(this._observers, /** @type {string} */ (name), set.create).add(f) - return f - } - - /** - * @template {keyof EVENTS & string} NAME - * @param {NAME} name - * @param {EVENTS[NAME]} f - */ - once (name, f) { - /** - * @param {...any} args - */ - const _f = (...args) => { - this.off(name, /** @type {any} */ (_f)) - f(...args) - } - this.on(name, /** @type {any} */ (_f)) - } - - /** - * @template {keyof EVENTS & string} NAME - * @param {NAME} name - * @param {EVENTS[NAME]} f - */ - off (name, f) { - const observers = this._observers.get(name) - if (observers !== undefined) { - observers.delete(f) - if (observers.size === 0) { - this._observers.delete(name) - } - } - } - - /** - * Emit a named event. All registered event listeners that listen to the - * specified name will receive the event. - * - * @todo This should catch exceptions - * - * @template {keyof EVENTS & string} NAME - * @param {NAME} name The event name. - * @param {Parameters} args The arguments that are applied to the event listener. - */ - emit (name, args) { - // copy all listeners to an array first to make sure that no event is emitted to listeners that are subscribed while the event handler is called. - return array.from((this._observers.get(name) || map.create()).values()).forEach(f => f(...args)) - } - - destroy () { - this._observers = map.create() - } -} - -/* c8 ignore start */ -/** - * Handles named events. - * - * @deprecated - * @template N - */ -export class Observable { - constructor () { - /** - * Some desc. - * @type {Map} - */ - this._observers = map.create() - } - - /** - * @param {N} name - * @param {function} f - */ - on (name, f) { - map.setIfUndefined(this._observers, name, set.create).add(f) - } - - /** - * @param {N} name - * @param {function} f - */ - once (name, f) { - /** - * @param {...any} args - */ - const _f = (...args) => { - this.off(name, _f) - f(...args) - } - this.on(name, _f) - } - - /** - * @param {N} name - * @param {function} f - */ - off (name, f) { - const observers = this._observers.get(name) - if (observers !== undefined) { - observers.delete(f) - if (observers.size === 0) { - this._observers.delete(name) - } - } - } - - /** - * Emit a named event. All registered event listeners that listen to the - * specified name will receive the event. - * - * @todo This should catch exceptions - * - * @param {N} name The event name. - * @param {Array} args The arguments that are applied to the event listener. - */ - emit (name, args) { - // copy all listeners to an array first to make sure that no event is emitted to listeners that are subscribed while the event handler is called. - return array.from((this._observers.get(name) || map.create()).values()).forEach(f => f(...args)) - } - - destroy () { - this._observers = map.create() - } -} -/* c8 ignore end */ diff --git a/yjs-poll/node_modules/lib0/observable.test.d.ts b/yjs-poll/node_modules/lib0/observable.test.d.ts deleted file mode 100644 index 895ebfe..0000000 --- a/yjs-poll/node_modules/lib0/observable.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testTypedObservable(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=observable.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/observable.test.d.ts.map b/yjs-poll/node_modules/lib0/observable.test.d.ts.map deleted file mode 100644 index 0335d64..0000000 --- a/yjs-poll/node_modules/lib0/observable.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"observable.test.d.ts","sourceRoot":"","sources":["observable.test.js"],"names":[],"mappings":"AAMO,yCAFI,CAAC,CAAC,QAAQ,QA6CpB;mBAjDkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/package.json b/yjs-poll/node_modules/lib0/package.json deleted file mode 100644 index aab330f..0000000 --- a/yjs-poll/node_modules/lib0/package.json +++ /dev/null @@ -1,556 +0,0 @@ -{ - "name": "lib0", - "version": "0.2.117", - "description": "", - "sideEffects": false, - "type": "module", - "main": "./dist/index.cjs", - "module": "./index.js", - "types": "./index.d.ts", - "funding": { - "type": "GitHub Sponsors ❤", - "url": "https://github.com/sponsors/dmonad" - }, - "bin": { - "0gentesthtml": "./bin/gentesthtml.js", - "0serve": "./bin/0serve.js", - "0ecdsa-generate-keypair": "./bin/0ecdsa-generate-keypair.js" - }, - "exports": { - "./package.json": "./package.json", - ".": { - "types": "./index.d.ts", - "module": "./index.js", - "import": "./index.js", - "require": "./dist/index.cjs" - }, - "./array.js": "./array.js", - "./dist/array.cjs": "./dist/array.cjs", - "./array": { - "types": "./array.d.ts", - "module": "./array.js", - "import": "./array.js", - "require": "./dist/array.cjs" - }, - "./binary.js": "./binary.js", - "./dist/binary.cjs": "./dist/binary.cjs", - "./binary": { - "types": "./binary.d.ts", - "module": "./binary.js", - "import": "./binary.js", - "require": "./dist/binary.cjs" - }, - "./broadcastchannel.js": "./broadcastchannel.js", - "./dist/broadcastchannel.cjs": "./dist/broadcastchannel.cjs", - "./broadcastchannel": { - "types": "./broadcastchannel.d.ts", - "module": "./broadcastchannel.js", - "import": "./broadcastchannel.js", - "require": "./dist/broadcastchannel.cjs" - }, - "./buffer.js": "./buffer.js", - "./dist/buffer.cjs": "./dist/buffer.cjs", - "./buffer": { - "types": "./buffer.d.ts", - "module": "./buffer.js", - "import": "./buffer.js", - "require": "./dist/buffer.cjs" - }, - "./cache.js": "./cache.js", - "./dist/cache.cjs": "./dist/cache.cjs", - "./cache": { - "types": "./cache.d.ts", - "module": "./cache.js", - "import": "./cache.js", - "require": "./dist/cache.cjs" - }, - "./component.js": "./component.js", - "./dist/component.cjs": "./dist/component.cjs", - "./component": { - "types": "./component.d.ts", - "module": "./component.js", - "import": "./component.js", - "require": "./dist/component.cjs" - }, - "./conditions.js": "./conditions.js", - "./dist/conditions.cjs": "./dist/conditions.cjs", - "./conditions": { - "types": "./conditions.d.ts", - "module": "./conditions.js", - "import": "./conditions.js", - "require": "./dist/conditions.cjs" - }, - "./crypto/jwt": { - "types": "./crypto/jwt.d.ts", - "module": "./crypto/jwt.js", - "import": "./crypto/jwt.js", - "require": "./dist/jwt.cjs" - }, - "./crypto/aes-gcm": { - "types": "./crypto/aes-gcm.d.ts", - "module": "./crypto/aes-gcm.js", - "import": "./crypto/aes-gcm.js", - "require": "./dist/aes-gcm.cjs" - }, - "./delta": { - "types": "./delta/delta.d.ts", - "module": "./delta/delta.js", - "import": "./delta/delta.js", - "require": "./dist/delta.cjs" - }, - "./crypto/ecdsa": { - "types": "./crypto/ecdsa.d.ts", - "module": "./crypto/ecdsa.js", - "import": "./crypto/ecdsa.js", - "require": "./dist/ecdsa.cjs" - }, - "./crypto/rsa-oaep": { - "types": "./crypto/rsa-oaep.d.ts", - "module": "./crypto/rsa-oaep.js", - "import": "./crypto/rsa-oaep.js", - "require": "./dist/rsa-oaep.cjs" - }, - "./hash/rabin": { - "types": "./hash/rabin.d.ts", - "module": "./hash/rabin.js", - "import": "./hash/rabin.js", - "require": "./dist/rabin.cjs" - }, - "./hash/sha256": { - "types": "./hash/sha256.d.ts", - "browser": { - "module": "./hash/sha256.js", - "require": "./dist/sha256.cjs", - "default": "./hash/sha256.js" - }, - "node": { - "require": "./dist/sha256.node.cjs", - "default": "./hash/sha256.node.js" - }, - "default": { - "module": "./hash/sha256.js", - "require": "./dist/sha256.cjs", - "default": "./hash/sha256.js" - } - }, - "./decoding.js": "./decoding.js", - "./dist/decoding.cjs": "./dist/decoding.cjs", - "./decoding": { - "types": "./decoding.d.ts", - "module": "./decoding.js", - "import": "./decoding.js", - "require": "./dist/decoding.cjs" - }, - "./diff/patience": { - "types": "./diff/patience.d.ts", - "module": "./diff/patience.js", - "import": "./diff/patience.js", - "require": "./dist/patience.cjs" - }, - "./diff.js": "./diff.js", - "./dist/diff.cjs": "./dist/diff.cjs", - "./diff": { - "types": "./diff.d.ts", - "module": "./diff.js", - "import": "./diff.js", - "require": "./dist/diff.cjs" - }, - "./dom.js": "./dom.js", - "./dist/dom.cjs": "./dist/dom.cjs", - "./dom": { - "types": "./dom.d.ts", - "module": "./dom.js", - "import": "./dom.js", - "require": "./dist/dom.cjs" - }, - "./encoding.js": "./encoding.js", - "./dist/encoding.cjs": "./dist/encoding.cjs", - "./encoding": { - "types": "./encoding.d.ts", - "module": "./encoding.js", - "import": "./encoding.js", - "require": "./dist/encoding.cjs" - }, - "./environment.js": "./environment.js", - "./dist/environment.cjs": "./dist/environment.cjs", - "./environment": { - "types": "./environment.d.ts", - "module": "./environment.js", - "import": "./environment.js", - "require": "./dist/environment.cjs" - }, - "./error.js": "./error.js", - "./dist/error.cjs": "./dist/error.cjs", - "./error": { - "types": "./error.d.ts", - "module": "./error.js", - "import": "./error.js", - "require": "./dist/error.cjs" - }, - "./eventloop.js": "./eventloop.js", - "./dist/eventloop.cjs": "./dist/eventloop.cjs", - "./eventloop": { - "types": "./eventloop.d.ts", - "module": "./eventloop.js", - "import": "./eventloop.js", - "require": "./dist/eventloop.cjs" - }, - "./function.js": "./function.js", - "./dist/function.cjs": "./dist/function.cjs", - "./function": { - "types": "./function.d.ts", - "module": "./function.js", - "import": "./function.js", - "require": "./dist/function.cjs" - }, - "./indexeddb.js": "./indexeddb.js", - "./dist/indexeddb.cjs": "./dist/indexeddb.cjs", - "./indexeddb": { - "types": "./indexeddb.d.ts", - "module": "./indexeddb.js", - "import": "./indexeddb.js", - "require": "./dist/indexeddb.cjs" - }, - "./isomorphic.js": "./isomorphic.js", - "./dist/isomorphic.cjs": "./dist/isomorphic.cjs", - "./isomorphic": { - "types": "./isomorphic.d.ts", - "module": "./isomorphic.js", - "import": "./isomorphic.js", - "require": "./dist/isomorphic.cjs" - }, - "./iterator.js": "./iterator.js", - "./dist/iterator.cjs": "./dist/iterator.cjs", - "./iterator": { - "types": "./iterator.d.ts", - "module": "./iterator.js", - "import": "./iterator.js", - "require": "./dist/iterator.cjs" - }, - "./json.js": "./json.js", - "./dist/json.cjs": "./dist/json.cjs", - "./json": { - "types": "./json.d.ts", - "module": "./json.js", - "import": "./json.js", - "require": "./dist/json.cjs" - }, - "./list.js": "./list.js", - "./dist/list.cjs": "./dist/list.cjs", - "./list": { - "types": "./list.d.ts", - "module": "./list.js", - "import": "./list.js", - "require": "./dist/list.cjs" - }, - "./logging.js": "./logging.js", - "./dist/logging.cjs": "./dist/logging.node.cjs", - "./logging": { - "types": "./logging.node.d.ts", - "deno": "./logging.node.js", - "bun": "./logging.js", - "browser": { - "module": "./logging.js", - "require": "./dist/logging.cjs", - "default": "./logging.js" - }, - "node": { - "module": "./logging.node.js", - "require": "./dist/logging.node.cjs", - "default": "./logging.node.js" - }, - "default": { - "module": "./logging.js", - "require": "./dist/logging.cjs", - "default": "./logging.js" - } - }, - "./map.js": "./map.js", - "./dist/map.cjs": "./dist/map.cjs", - "./map": { - "types": "./map.d.ts", - "module": "./map.js", - "import": "./map.js", - "require": "./dist/map.cjs" - }, - "./math.js": "./math.js", - "./dist/math.cjs": "./dist/math.cjs", - "./math": { - "types": "./math.d.ts", - "module": "./math.js", - "import": "./math.js", - "require": "./dist/math.cjs" - }, - "./metric.js": "./metric.js", - "./dist/metric.cjs": "./dist/metric.cjs", - "./metric": { - "types": "./metric.d.ts", - "module": "./metric.js", - "import": "./metric.js", - "require": "./dist/metric.cjs" - }, - "./mutex.js": "./mutex.js", - "./dist/mutex.cjs": "./dist/mutex.cjs", - "./mutex": { - "types": "./mutex.d.ts", - "module": "./mutex.js", - "import": "./mutex.js", - "require": "./dist/mutex.cjs" - }, - "./number.js": "./number.js", - "./dist/number.cjs": "./dist/number.cjs", - "./number": { - "types": "./number.d.ts", - "module": "./number.js", - "import": "./number.js", - "require": "./dist/number.cjs" - }, - "./object.js": "./object.js", - "./dist/object.cjs": "./dist/object.cjs", - "./object": { - "types": "./object.d.ts", - "module": "./object.js", - "import": "./object.js", - "require": "./dist/object.cjs" - }, - "./observable.js": "./observable.js", - "./dist/observable.cjs": "./dist/observable.cjs", - "./observable": { - "types": "./observable.d.ts", - "module": "./observable.js", - "import": "./observable.js", - "require": "./dist/observable.cjs" - }, - "./pair.js": "./pair.js", - "./dist/pair.cjs": "./dist/pair.cjs", - "./pair": { - "types": "./pair.d.ts", - "module": "./pair.js", - "import": "./pair.js", - "require": "./dist/pair.cjs" - }, - "./prng.js": "./prng.js", - "./dist/prng.cjs": "./dist/prng.cjs", - "./prng": { - "types": "./prng.d.ts", - "module": "./prng.js", - "import": "./prng.js", - "require": "./dist/prng.cjs" - }, - "./promise.js": "./promise.js", - "./dist/promise.cjs": "./dist/promise.cjs", - "./promise": { - "types": "./promise.d.ts", - "module": "./promise.js", - "import": "./promise.js", - "require": "./dist/promise.cjs" - }, - "./queue.js": "./queue.js", - "./dist/queue.cjs": "./dist/queue.cjs", - "./queue": { - "types": "./queue.d.ts", - "module": "./queue.js", - "import": "./queue.js", - "require": "./dist/queue.cjs" - }, - "./random.js": "./random.js", - "./dist/random.cjs": "./dist/random.cjs", - "./random": { - "types": "./random.d.ts", - "module": "./random.js", - "import": "./random.js", - "require": "./dist/random.cjs" - }, - "./set.js": "./set.js", - "./dist/set.cjs": "./dist/set.cjs", - "./set": { - "types": "./set.d.ts", - "module": "./set.js", - "import": "./set.js", - "require": "./dist/set.cjs" - }, - "./sort.js": "./sort.js", - "./dist/sort.cjs": "./dist/sort.cjs", - "./sort": { - "types": "./sort.d.ts", - "module": "./sort.js", - "import": "./sort.js", - "require": "./dist/sort.cjs" - }, - "./statistics.js": "./statistics.js", - "./dist/statistics.cjs": "./dist/statistics.cjs", - "./statistics": { - "types": "./statistics.d.ts", - "module": "./statistics.js", - "import": "./statistics.js", - "require": "./dist/statistics.cjs" - }, - "./storage.js": "./storage.js", - "./dist/storage.cjs": "./dist/storage.cjs", - "./storage": { - "types": "./storage.d.ts", - "module": "./storage.js", - "import": "./storage.js", - "require": "./dist/storage.cjs" - }, - "./string.js": "./string.js", - "./dist/string.cjs": "./dist/string.cjs", - "./string": { - "types": "./string.d.ts", - "module": "./string.js", - "import": "./string.js", - "require": "./dist/string.cjs" - }, - "./symbol.js": "./symbol.js", - "./dist/symbol.cjs": "./dist/symbol.cjs", - "./symbol": { - "types": "./symbol.d.ts", - "module": "./symbol.js", - "import": "./symbol.js", - "require": "./dist/symbol.cjs" - }, - "./traits": { - "types": "./trait/traits.d.ts", - "module": "./trait/traits.js", - "import": "./trait/traits.js", - "require": "./dist/traits.cjs" - }, - "./testing.js": "./testing.js", - "./dist/testing.cjs": "./dist/testing.cjs", - "./testing": { - "types": "./testing.d.ts", - "module": "./testing.js", - "import": "./testing.js", - "require": "./dist/testing.cjs" - }, - "./time.js": "./time.js", - "./dist/time.cjs": "./dist/time.cjs", - "./time": { - "types": "./time.d.ts", - "module": "./time.js", - "import": "./time.js", - "require": "./dist/time.cjs" - }, - "./tree.js": "./tree.js", - "./dist/tree.cjs": "./dist/tree.cjs", - "./tree": { - "types": "./tree.d.ts", - "module": "./tree.js", - "import": "./tree.js", - "require": "./dist/tree.cjs" - }, - "./url.js": "./url.js", - "./dist/url.cjs": "./dist/url.cjs", - "./url": { - "types": "./url.d.ts", - "module": "./url.js", - "import": "./url.js", - "require": "./dist/url.cjs" - }, - "./websocket.js": "./websocket.js", - "./dist/websocket.cjs": "./dist/websocket.cjs", - "./websocket": { - "types": "./websocket.d.ts", - "module": "./websocket.js", - "import": "./websocket.js", - "require": "./dist/websocket.cjs" - }, - "./webcrypto": { - "types": "./webcrypto.d.ts", - "deno": "./webcrypto.deno.js", - "bun": "./webcrypto.js", - "react-native": "./dist/webcrypto.react-native.cjs", - "browser": { - "module": "./webcrypto.js", - "require": "./dist/webcrypto.cjs", - "default": "./webcrypto.js" - }, - "node": { - "module": "./webcrypto.node.js", - "require": "./dist/webcrypto.node.cjs", - "default": "./webcrypto.node.js" - }, - "default": { - "module": "./webcrypto.js", - "require": "./dist/webcrypto.cjs", - "default": "./webcrypto.js" - } - }, - "./performance.js": "./performance.js", - "./dist/performance.cjs": "./dist/performance.node.cjs", - "./performance": { - "types": "./performance.d.ts", - "deno": "./performance.node.js", - "bun": "./performance.node.js", - "browser": { - "module": "./performance.js", - "require": "./dist/performance.cjs", - "default": "./performance.js" - }, - "node": { - "module": "./performance.node.js", - "require": "./dist/performance.node.cjs", - "default": "./performance.node.js" - }, - "default": { - "module": "./performance.js", - "require": "./dist/performance.cjs", - "default": "./performance.js" - } - }, - "./schema": { - "types": "./schema.d.ts", - "module": "./schema.js", - "import": "./schema.js", - "require": "./dist/schema.cjs" - } - }, - "dependencies": { - "isomorphic.js": "^0.2.4" - }, - "devDependencies": { - "@types/node": "^24.0.14", - "c8": "^10.1.3", - "jsdoc-api": "^8.0.0", - "jsdoc-plugin-typescript": "^2.2.1", - "rollup": "^2.42.1", - "standard": "^17.1.0", - "typescript": "^5.9.3" - }, - "scripts": { - "clean": "rm -rf dist *.d.ts */*.d.ts *.d.ts.map */*.d.ts.map", - "types": "tsc --outDir .", - "dist": "rollup -c", - "debug": "npm run gentesthtml && node ./bin/0serve.js -o test.html", - "test": "c8 --check-coverage --lines 100 --branches 100 --functions 100 --statements 100 node --unhandled-rejections=strict ./test.js --repetition-time 50", - "test-inspect": "node --inspect-brk --unhandled-rejections=strict ./test.js --repetition-time 50", - "test-extensive": "c8 --check-coverage --lines 100 --branches 100 --functions 100 --statements 100 node test.js --repetition-time 30000 --extensive", - "trace-deopt": "clear && rollup -c && node --trace-deopt dist/test.cjs", - "trace-opt": "clear && rollup -c && node --trace-opt dist/test.cjs", - "lint": "standard && tsc", - "gendocs": "node ./bin/gendocs.js", - "preversion": "npm run clean && npm run lint && npm run types && npm run dist && git add README.md", - "postpublish": "npm run clean", - "gentesthtml": "node ./bin/gentesthtml.js --script test.js > test.html" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/dmonad/lib0.git" - }, - "author": "Kevin Jahns ", - "license": "MIT", - "bugs": { - "url": "https://github.com/dmonad/lib0/issues" - }, - "homepage": "https://github.com/dmonad/lib0#readme", - "standard": { - "ignore": [ - "/dist", - "/node_modules", - "/docs" - ] - }, - "engines": { - "node": ">=16" - } -} diff --git a/yjs-poll/node_modules/lib0/pair.d.ts b/yjs-poll/node_modules/lib0/pair.d.ts deleted file mode 100644 index 08c917d..0000000 --- a/yjs-poll/node_modules/lib0/pair.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Working with value pairs. - * - * @module pair - */ -/** - * @template L,R - */ -export class Pair { - /** - * @param {L} left - * @param {R} right - */ - constructor(left: L, right: R); - left: L; - right: R; -} -export function create(left: L, right: R): Pair; -export function createReversed(right: R, left: L): Pair; -export function forEach(arr: Array>, f: (arg0: L, arg1: R) => any): void; -export function map(arr: Array>, f: (arg0: L, arg1: R) => X): Array; -//# sourceMappingURL=pair.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/pair.d.ts.map b/yjs-poll/node_modules/lib0/pair.d.ts.map deleted file mode 100644 index 54c51cc..0000000 --- a/yjs-poll/node_modules/lib0/pair.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pair.d.ts","sourceRoot":"","sources":["pair.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,kBAFa,CAAC,EAAC,CAAC;IAGd;;;OAGG;IACH,kBAHW,CAAC,SACD,CAAC,EAKX;IAFC,QAAgB;IAChB,SAAkB;CAErB;AAQM,uBALM,CAAC,EAAC,CAAC,QACL,CAAC,SACD,CAAC,GACA,IAAI,CAAC,CAAC,EAAC,CAAC,CAAC,CAEuC;AAQrD,+BALM,CAAC,EAAC,CAAC,SACL,CAAC,QACD,CAAC,GACA,IAAI,CAAC,CAAC,EAAC,CAAC,CAAC,CAE+C;AAO7D,wBAJM,CAAC,EAAC,CAAC,OACL,KAAK,CAAC,IAAI,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,KAChB,CAAS,IAAC,EAAD,CAAC,EAAE,IAAC,EAAD,CAAC,KAAE,GAAG,QAE0C;AAQhE,oBALM,CAAC,EAAC,CAAC,EAAC,CAAC,OACP,KAAK,CAAC,IAAI,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,KAChB,CAAS,IAAC,EAAD,CAAC,EAAE,IAAC,EAAD,CAAC,KAAE,CAAC,GACf,KAAK,CAAC,CAAC,CAAC,CAE2C"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/pair.js b/yjs-poll/node_modules/lib0/pair.js deleted file mode 100644 index 8b88e7e..0000000 --- a/yjs-poll/node_modules/lib0/pair.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Working with value pairs. - * - * @module pair - */ - -/** - * @template L,R - */ -export class Pair { - /** - * @param {L} left - * @param {R} right - */ - constructor (left, right) { - this.left = left - this.right = right - } -} - -/** - * @template L,R - * @param {L} left - * @param {R} right - * @return {Pair} - */ -export const create = (left, right) => new Pair(left, right) - -/** - * @template L,R - * @param {R} right - * @param {L} left - * @return {Pair} - */ -export const createReversed = (right, left) => new Pair(left, right) - -/** - * @template L,R - * @param {Array>} arr - * @param {function(L, R):any} f - */ -export const forEach = (arr, f) => arr.forEach(p => f(p.left, p.right)) - -/** - * @template L,R,X - * @param {Array>} arr - * @param {function(L, R):X} f - * @return {Array} - */ -export const map = (arr, f) => arr.map(p => f(p.left, p.right)) diff --git a/yjs-poll/node_modules/lib0/pair.test.d.ts b/yjs-poll/node_modules/lib0/pair.test.d.ts deleted file mode 100644 index ab51b8b..0000000 --- a/yjs-poll/node_modules/lib0/pair.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testPair(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=pair.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/pair.test.d.ts.map b/yjs-poll/node_modules/lib0/pair.test.d.ts.map deleted file mode 100644 index 616364c..0000000 --- a/yjs-poll/node_modules/lib0/pair.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pair.test.d.ts","sourceRoot":"","sources":["pair.test.js"],"names":[],"mappings":"AAOO,6BAFI,CAAC,CAAC,QAAQ,QAepB;mBApBkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/performance.d.ts b/yjs-poll/node_modules/lib0/performance.d.ts deleted file mode 100644 index 0226088..0000000 --- a/yjs-poll/node_modules/lib0/performance.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const measure: (measureName: string, startOrMeasureOptions?: string | PerformanceMeasureOptions, endMark?: string) => PerformanceMeasure; -export const now: () => DOMHighResTimeStamp; -export const mark: (markName: string, markOptions?: PerformanceMarkOptions) => PerformanceMark; -//# sourceMappingURL=performance.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/performance.d.ts.map b/yjs-poll/node_modules/lib0/performance.d.ts.map deleted file mode 100644 index 93c5c52..0000000 --- a/yjs-poll/node_modules/lib0/performance.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"performance.d.ts","sourceRoot":"","sources":["performance.js"],"names":[],"mappings":"AAEA,gJAA4D;AAC5D,4CAAoD;AACpD,+FAAsD"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/performance.js b/yjs-poll/node_modules/lib0/performance.js deleted file mode 100644 index ed151c6..0000000 --- a/yjs-poll/node_modules/lib0/performance.js +++ /dev/null @@ -1,5 +0,0 @@ -/* eslint-env browser */ - -export const measure = performance.measure.bind(performance) -export const now = performance.now.bind(performance) -export const mark = performance.mark.bind(performance) diff --git a/yjs-poll/node_modules/lib0/performance.node.d.ts b/yjs-poll/node_modules/lib0/performance.node.d.ts deleted file mode 100644 index 4458270..0000000 --- a/yjs-poll/node_modules/lib0/performance.node.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @type {typeof performance.measure} - */ -export const measure: typeof performance.measure; -/** - * @type {typeof performance.now} - */ -export const now: typeof performance.now; -/** - * @type {typeof performance.mark} - */ -export const mark: typeof performance.mark; -import { performance } from 'node:perf_hooks'; -//# sourceMappingURL=performance.node.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/performance.node.d.ts.map b/yjs-poll/node_modules/lib0/performance.node.d.ts.map deleted file mode 100644 index 4e8cb24..0000000 --- a/yjs-poll/node_modules/lib0/performance.node.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"performance.node.d.ts","sourceRoot":"","sources":["performance.node.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH,sBAHU,OAAO,WAAW,CAAC,OAAO,CAGyE;AAE7G;;GAEG;AAEH,kBAHU,OAAO,WAAW,CAAC,GAAG,CAGyD;AAEzF;;GAEG;AAEH,mBAHU,OAAO,WAAW,CAAC,IAAI,CAGmE;4BApBxE,iBAAiB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/performance.node.js b/yjs-poll/node_modules/lib0/performance.node.js deleted file mode 100644 index 72d08e8..0000000 --- a/yjs-poll/node_modules/lib0/performance.node.js +++ /dev/null @@ -1,21 +0,0 @@ -import { performance } from 'node:perf_hooks' -import { nop } from './function.js' -import * as time from './time.js' - -/** - * @type {typeof performance.measure} - */ -/* c8 ignore next */ -export const measure = performance.measure ? performance.measure.bind(performance) : /** @type {any} */ (nop) - -/** - * @type {typeof performance.now} - */ -/* c8 ignore next */ -export const now = performance.now ? performance.now.bind(performance) : time.getUnixTime - -/** - * @type {typeof performance.mark} - */ -/* c8 ignore next */ -export const mark = performance.mark ? performance.mark.bind(performance) : /** @type {any} */ (nop) diff --git a/yjs-poll/node_modules/lib0/pledge.d.ts b/yjs-poll/node_modules/lib0/pledge.d.ts deleted file mode 100644 index c8dcfb7..0000000 --- a/yjs-poll/node_modules/lib0/pledge.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * @template V - * @typedef {V | PledgeInstance} Pledge - */ -/** - * @template {any} Val - * @template {any} [CancelReason=Error] - */ -export class PledgeInstance { - /** - * @type {Val | CancelReason | null} - */ - _v: Val | CancelReason | null; - isResolved: boolean; - /** - * @type {Array | null} - */ - _whenResolved: Array<(arg0: Val) => void> | null; - /** - * @type {Array | null} - */ - _whenCanceled: Array<(arg0: CancelReason) => void> | null; - get isDone(): boolean; - get isCanceled(): boolean; - /** - * @param {Val} v - */ - resolve(v: Val): void; - /** - * @param {CancelReason} reason - */ - cancel(reason: CancelReason): void; - /** - * @template R - * @param {function(Val):Pledge} f - * @return {PledgeInstance} - */ - map(f: (arg0: Val) => Pledge): PledgeInstance; - /** - * @param {function(Val):void} f - */ - whenResolved(f: (arg0: Val) => void): void; - /** - * @param {(reason: CancelReason) => void} f - */ - whenCanceled(f: (reason: CancelReason) => void): void; - /** - * @return {Promise} - */ - promise(): Promise; -} -export function create(): PledgeInstance; -export function createWithDependencies>>(init: (p: PledgeInstance, ...deps: Resolved) => void, ...deps: DEPS): PledgeInstance; -export function whenResolved(p: Pledge, f: (arg0: R) => void): void; -export function whenCanceled

>(p: P, f: P extends PledgeInstance ? (arg0: CancelReason) => void : (arg0: any) => void): void; -export function map(p: Pledge

, f: (r: P) => Q): Pledge; -export function all(ps: PS): PledgeInstance>; -export function coroutine(f: () => Generator | PledgeInstance, Result, any>): PledgeInstance; -export function wait(timeout: number): PledgeInstance; -export type Pledge = V | PledgeInstance; -export type PledgeMap = Array> | { - [x: string]: Pledge; -}; -/** - *

- */ -export type Resolved

| PledgeMap> = P extends PledgeMap ? { [K in keyof P]: P[K] extends Pledge ? V : P[K]; } : (P extends Pledge ? V : never); -//# sourceMappingURL=pledge.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/pledge.d.ts.map b/yjs-poll/node_modules/lib0/pledge.d.ts.map deleted file mode 100644 index a41d427..0000000 --- a/yjs-poll/node_modules/lib0/pledge.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pledge.d.ts","sourceRoot":"","sources":["pledge.js"],"names":[],"mappings":"AA8BA;;;GAGG;AAEH;;;GAGG;AACH,4BAHmB,GAAG,kBACF,YAAY;IAI5B;;OAEG;IACH,IAFU,GAAG,GAAG,YAAY,GAAG,IAAI,CAErB;IACd,oBAAuB;IACvB;;OAEG;IACH,eAFU,KAAK,CAAC,CAAS,IAAG,EAAH,GAAG,KAAE,IAAI,CAAC,GAAG,IAAI,CAEnB;IACvB;;OAEG;IACH,eAFU,KAAK,CAAC,CAAS,IAAY,EAAZ,YAAY,KAAE,IAAI,CAAC,GAAG,IAAI,CAE5B;IAGzB,sBAEC;IAED,0BAEC;IAED;;OAEG;IACH,WAFW,GAAG,QAYb;IAED;;OAEG;IACH,eAFW,YAAY,QAWtB;IAED;;;;OAIG;IACH,IAJa,CAAC,KACH,C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AC,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,GACpF,cAAc,CAAC,MAAM,CAAC,CAwBjC;AAMM,8BAHI,MAAM,GACL,cAAc,CAAC,SAAS,CAAC,CAMpC;mBAlQY,CAAC,IACD,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC;wBA8HrB,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG;QAAO,MAAM,GAAC,MAAM,CAAC,OAAO,CAAC;CAAC;;;;qBAIzB,CAAC,SAA9B,MAAM,CAAC,OAAO,CAAC,GAAG,SAAU,IAC7B,CAAC,SAAS,SAAS,GAAG,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAC,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/pledge.js b/yjs-poll/node_modules/lib0/pledge.js deleted file mode 100644 index 07403d9..0000000 --- a/yjs-poll/node_modules/lib0/pledge.js +++ /dev/null @@ -1,292 +0,0 @@ -/** - * @experimental Use of this module is not encouraged! - * This is just an experiment. - * @todo remove `c8 ignore` line once this is moved to "non-experimental" - */ - -import * as queue from './queue.js' -import * as object from './object.js' - -/* c8 ignore start */ - -/** - * @type {queue.Queuevoid>>} - */ -const ctxFs = queue.create() - -/** - * @param {() => void} f - */ -const runInGlobalContext = f => { - const isEmpty = queue.isEmpty(ctxFs) - queue.enqueue(ctxFs, new queue.QueueValue(f)) - if (isEmpty) { - while (!queue.isEmpty(ctxFs)) { - /** @type {queue.QueueValue<()=>{}>} */ (ctxFs.start).v() - queue.dequeue(ctxFs) - } - } -} - -/** - * @template V - * @typedef {V | PledgeInstance} Pledge - */ - -/** - * @template {any} Val - * @template {any} [CancelReason=Error] - */ -export class PledgeInstance { - constructor () { - /** - * @type {Val | CancelReason | null} - */ - this._v = null - this.isResolved = false - /** - * @type {Array | null} - */ - this._whenResolved = [] - /** - * @type {Array | null} - */ - this._whenCanceled = [] - } - - get isDone () { - return this._whenResolved === null - } - - get isCanceled () { - return !this.isResolved && this._whenResolved === null - } - - /** - * @param {Val} v - */ - resolve (v) { - const whenResolved = this._whenResolved - if (whenResolved === null) return - this._v = v - this.isResolved = true - this._whenResolved = null - this._whenCanceled = null - for (let i = 0; i < whenResolved.length; i++) { - whenResolved[i](v) - } - } - - /** - * @param {CancelReason} reason - */ - cancel (reason) { - const whenCanceled = this._whenCanceled - if (whenCanceled === null) return - this._v = reason - this._whenResolved = null - this._whenCanceled = null - for (let i = 0; i < whenCanceled.length; i++) { - whenCanceled[i](reason) - } - } - - /** - * @template R - * @param {function(Val):Pledge} f - * @return {PledgeInstance} - */ - map (f) { - /** - * @type {PledgeInstance} - */ - const p = new PledgeInstance() - this.whenResolved(v => { - const result = f(v) - if (result instanceof PledgeInstance) { - if (result._whenResolved === null) { - result.resolve(/** @type {R} */ (result._v)) - } else { - result._whenResolved.push(p.resolve.bind(p)) - } - } else { - p.resolve(result) - } - }) - return p - } - - /** - * @param {function(Val):void} f - */ - whenResolved (f) { - if (this.isResolved) { - f(/** @type {Val} */ (this._v)) - } else { - this._whenResolved?.push(f) - } - } - - /** - * @param {(reason: CancelReason) => void} f - */ - whenCanceled (f) { - if (this.isCanceled) { - f(/** @type {CancelReason} */ (this._v)) - } else { - this._whenCanceled?.push(f) - } - } - - /** - * @return {Promise} - */ - promise () { - return new Promise((resolve, reject) => { - this.whenResolved(resolve) - this.whenCanceled(reject) - }) - } -} - -/** - * @template T - * @return {PledgeInstance} - */ -export const create = () => new PledgeInstance() - -/** - * @typedef {Array> | Object>} PledgeMap - */ - -/** - * @template {Pledge | PledgeMap} P - * @typedef {P extends PledgeMap ? { [K in keyof P]: P[K] extends Pledge ? V : P[K]} : (P extends Pledge ? V : never)} Resolved

- */ - -/** - * @todo Create a "resolveHelper" that will simplify creating indxeddbv2 functions. Double arguments - * are not necessary. - * - * @template V - * @template {Array>} DEPS - * @param {(p: PledgeInstance, ...deps: Resolved) => void} init - * @param {DEPS} deps - * @return {PledgeInstance} - */ -export const createWithDependencies = (init, ...deps) => { - /** - * @type {PledgeInstance} - */ - const p = new PledgeInstance() - // @ts-ignore @todo remove this - all(deps).whenResolved(ds => init(p, ...ds)) - return p -} - -/** - * @template R - * @param {Pledge} p - * @param {function(R):void} f - */ -export const whenResolved = (p, f) => { - if (p instanceof PledgeInstance) { - return p.whenResolved(f) - } - return f(p) -} - -/** - * @template {Pledge} P - * @param {P} p - * @param {P extends PledgeInstance ? function(CancelReason):void : function(any):void} f - */ -export const whenCanceled = (p, f) => { - if (p instanceof PledgeInstance) { - p.whenCanceled(f) - } -} - -/** - * @template P - * @template Q - * @param {Pledge

} p - * @param {(r: P) => Q} f - * @return {Pledge} - */ -export const map = (p, f) => { - if (p instanceof PledgeInstance) { - return p.map(f) - } - return f(p) -} - -/** - * @template {PledgeMap} PS - * @param {PS} ps - * @return {PledgeInstance>} - */ -export const all = ps => { - /** - * @type {any} - */ - const pall = create() - /** - * @type {any} - */ - const result = ps instanceof Array ? new Array(ps.length) : {} - let waitingPs = ps instanceof Array ? ps.length : object.size(ps) - for (const key in ps) { - const p = ps[key] - whenResolved(p, r => { - result[key] = r - if (--waitingPs === 0) { - // @ts-ignore - pall.resolve(result) - } - }) - } - return pall -} - -/** - * @template Result - * @template {any} YieldResults - * @param {() => Generator | PledgeInstance, Result, any>} f - * @return {PledgeInstance} - */ -export const coroutine = f => { - const p = create() - const gen = f() - /** - * @param {any} [yv] - */ - const handleGen = (yv) => { - const res = gen.next(yv) - if (res.done) { - p.resolve(res.value) - return - } - // @ts-ignore - whenCanceled(res.value, (reason) => { - gen.throw(reason) - }) - runInGlobalContext(() => - whenResolved(res.value, handleGen) - ) - } - handleGen() - return p -} - -/** - * @param {number} timeout - * @return {PledgeInstance} - */ -export const wait = timeout => { - const p = create() - setTimeout(p.resolve.bind(p), timeout) - return p -} - -/* c8 ignore end */ diff --git a/yjs-poll/node_modules/lib0/pledge.test.d.ts b/yjs-poll/node_modules/lib0/pledge.test.d.ts deleted file mode 100644 index 0398e18..0000000 --- a/yjs-poll/node_modules/lib0/pledge.test.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export function testPledgeCoroutine(_tc: t.TestCase): Promise; -export function testPledgeVsPromisePerformanceTimeout(_tc: t.TestCase): Promise; -export function testPledgeVsPromisePerformanceResolved(_tc: t.TestCase): Promise; -export type MaybePromise = Promise | number; -import * as t from './testing.js'; -//# sourceMappingURL=pledge.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/pledge.test.d.ts.map b/yjs-poll/node_modules/lib0/pledge.test.d.ts.map deleted file mode 100644 index a0447e9..0000000 --- a/yjs-poll/node_modules/lib0/pledge.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pledge.test.d.ts","sourceRoot":"","sources":["pledge.test.js"],"names":[],"mappings":"AAOO,yCAFI,CAAC,CAAC,QAAQ,iBAepB;AAKM,2DAFI,CAAC,CAAC,QAAQ,iBAiBpB;AASM,4DAFI,CAAC,CAAC,QAAQ,iBAqCpB;2BAzCY,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM;mBA3ClB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/prng.d.ts b/yjs-poll/node_modules/lib0/prng.d.ts deleted file mode 100644 index 77c666d..0000000 --- a/yjs-poll/node_modules/lib0/prng.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Description of the function - * @callback generatorNext - * @return {number} A random float in the cange of [0,1) - */ -/** - * A random type generator. - * - * @typedef {Object} PRNG - * @property {generatorNext} next Generate new number - */ -export const DefaultPRNG: typeof Xoroshiro128plus; -export function create(seed: number): PRNG; -export function bool(gen: PRNG): boolean; -export function int53(gen: PRNG, min: number, max: number): number; -export function uint53(gen: PRNG, min: number, max: number): number; -export function int32(gen: PRNG, min: number, max: number): number; -export function uint32(gen: PRNG, min: number, max: number): number; -export function int31(gen: PRNG, min: number, max: number): number; -export function real53(gen: PRNG): number; -export function char(gen: PRNG): string; -export function letter(gen: PRNG): string; -export function word(gen: PRNG, minLen?: number, maxLen?: number): string; -export function utf16Rune(gen: PRNG): string; -export function utf16String(gen: PRNG, maxlen?: number): string; -export function oneOf(gen: PRNG, array: Array): T; -export function uint8Array(gen: PRNG, len: number): Uint8Array; -export function uint16Array(gen: PRNG, len: number): Uint16Array; -export function uint32Array(gen: PRNG, len: number): Uint32Array; -/** - * Description of the function - */ -export type generatorNext = () => number; -/** - * A random type generator. - */ -export type PRNG = { - /** - * Generate new number - */ - next: generatorNext; -}; -import { Xoroshiro128plus } from './prng/Xoroshiro128plus.js'; -//# sourceMappingURL=prng.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/prng.d.ts.map b/yjs-poll/node_modules/lib0/prng.d.ts.map deleted file mode 100644 index 4b06d33..0000000 --- a/yjs-poll/node_modules/lib0/prng.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"prng.d.ts","sourceRoot":"","sources":["prng.js"],"names":[],"mappings":"AAeA;;;;GAIG;AAEH;;;;;GAKG;AACH,kDAA2C;AAUpC,6BAHI,MAAM,GACL,IAAI,CAEmC;AAQ5C,0BAHI,IAAI,WAG+B;AAUvC,2BALI,IAAI,oCAKuE;AAU/E,4BALI,IAAI,oCAKwD;AAUhE,2BALI,IAAI,oCAKuE;AAU/E,4BALI,IAAI,oCAKoD;AAY5D,2BALI,IAAI,oCAK6C;AAQrD,4BAHI,IAAI,UAGwB;AAUhC,0BALI,IAAI,GACH,MAAM,CAI0C;AAMrD,4BAHI,IAAI,GACH,MAAM,CAE4C;AAQvD,0BALI,IAAI,WACJ,MAAM,WACN,MAAM,GACL,MAAM,CASjB;AAQM,+BAHI,IAAI,GACH,MAAM,CAKjB;AAMM,iCAHI,IAAI,WACJ,MAAM,UAShB;AAUM,sBAFM,CAAC,OAHH,IAAI,SACJ,KAAK,CAAC,CAAC,CAAC,GACP,CAAC,CAG8D;AAOpE,gCAJI,IAAI,OACJ,MAAM,GACL,UAAU,CAAC,WAAW,CAAC,CAQlC;AAQM,iCAJI,IAAI,OACJ,MAAM,GACL,WAAW,CAEkE;AAOlF,iCAJI,IAAI,OACJ,MAAM,GACL,WAAW,CAEkE;;;;kCApL5E,MAAM;;;;;;;;UAOL,aAAa;;iCAbM,4BAA4B"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/prng.js b/yjs-poll/node_modules/lib0/prng.js deleted file mode 100644 index 6e05ba8..0000000 --- a/yjs-poll/node_modules/lib0/prng.js +++ /dev/null @@ -1,200 +0,0 @@ -/** - * Fast Pseudo Random Number Generators. - * - * Given a seed a PRNG generates a sequence of numbers that cannot be reasonably predicted. - * Two PRNGs must generate the same random sequence of numbers if given the same seed. - * - * @module prng - */ - -import * as binary from './binary.js' -import { fromCharCode, fromCodePoint } from './string.js' -import * as math from './math.js' -import { Xoroshiro128plus } from './prng/Xoroshiro128plus.js' -import * as buffer from './buffer.js' - -/** - * Description of the function - * @callback generatorNext - * @return {number} A random float in the cange of [0,1) - */ - -/** - * A random type generator. - * - * @typedef {Object} PRNG - * @property {generatorNext} next Generate new number - */ -export const DefaultPRNG = Xoroshiro128plus - -/** - * Create a Xoroshiro128plus Pseudo-Random-Number-Generator. - * This is the fastest full-period generator passing BigCrush without systematic failures. - * But there are more PRNGs available in ./PRNG/. - * - * @param {number} seed A positive 32bit integer. Do not use negative numbers. - * @return {PRNG} - */ -export const create = seed => new DefaultPRNG(seed) - -/** - * Generates a single random bool. - * - * @param {PRNG} gen A random number generator. - * @return {Boolean} A random boolean - */ -export const bool = gen => (gen.next() >= 0.5) - -/** - * Generates a random integer with 53 bit resolution. - * - * @param {PRNG} gen A random number generator. - * @param {Number} min The lower bound of the allowed return values (inclusive). - * @param {Number} max The upper bound of the allowed return values (inclusive). - * @return {Number} A random integer on [min, max] - */ -export const int53 = (gen, min, max) => math.floor(gen.next() * (max + 1 - min) + min) - -/** - * Generates a random integer with 53 bit resolution. - * - * @param {PRNG} gen A random number generator. - * @param {Number} min The lower bound of the allowed return values (inclusive). - * @param {Number} max The upper bound of the allowed return values (inclusive). - * @return {Number} A random integer on [min, max] - */ -export const uint53 = (gen, min, max) => math.abs(int53(gen, min, max)) - -/** - * Generates a random integer with 32 bit resolution. - * - * @param {PRNG} gen A random number generator. - * @param {Number} min The lower bound of the allowed return values (inclusive). - * @param {Number} max The upper bound of the allowed return values (inclusive). - * @return {Number} A random integer on [min, max] - */ -export const int32 = (gen, min, max) => math.floor(gen.next() * (max + 1 - min) + min) - -/** - * Generates a random integer with 53 bit resolution. - * - * @param {PRNG} gen A random number generator. - * @param {Number} min The lower bound of the allowed return values (inclusive). - * @param {Number} max The upper bound of the allowed return values (inclusive). - * @return {Number} A random integer on [min, max] - */ -export const uint32 = (gen, min, max) => int32(gen, min, max) >>> 0 - -/** - * @deprecated - * Optimized version of prng.int32. It has the same precision as prng.int32, but should be preferred when - * openaring on smaller ranges. - * - * @param {PRNG} gen A random number generator. - * @param {Number} min The lower bound of the allowed return values (inclusive). - * @param {Number} max The upper bound of the allowed return values (inclusive). The max inclusive number is `binary.BITS31-1` - * @return {Number} A random integer on [min, max] - */ -export const int31 = (gen, min, max) => int32(gen, min, max) - -/** - * Generates a random real on [0, 1) with 53 bit resolution. - * - * @param {PRNG} gen A random number generator. - * @return {Number} A random real number on [0, 1). - */ -export const real53 = gen => gen.next() // (((gen.next() >>> 5) * binary.BIT26) + (gen.next() >>> 6)) / MAX_SAFE_INTEGER - -/** - * Generates a random character from char code 32 - 126. I.e. Characters, Numbers, special characters, and Space: - * - * @param {PRNG} gen A random number generator. - * @return {string} - * - * (Space)!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[/]^_`abcdefghijklmnopqrstuvwxyz{|}~ - */ -export const char = gen => fromCharCode(int31(gen, 32, 126)) - -/** - * @param {PRNG} gen - * @return {string} A single letter (a-z) - */ -export const letter = gen => fromCharCode(int31(gen, 97, 122)) - -/** - * @param {PRNG} gen - * @param {number} [minLen=0] - * @param {number} [maxLen=20] - * @return {string} A random word (0-20 characters) without spaces consisting of letters (a-z) - */ -export const word = (gen, minLen = 0, maxLen = 20) => { - const len = int31(gen, minLen, maxLen) - let str = '' - for (let i = 0; i < len; i++) { - str += letter(gen) - } - return str -} - -/** - * TODO: this function produces invalid runes. Does not cover all of utf16!! - * - * @param {PRNG} gen - * @return {string} - */ -export const utf16Rune = gen => { - const codepoint = int31(gen, 0, 256) - return fromCodePoint(codepoint) -} - -/** - * @param {PRNG} gen - * @param {number} [maxlen = 20] - */ -export const utf16String = (gen, maxlen = 20) => { - const len = int31(gen, 0, maxlen) - let str = '' - for (let i = 0; i < len; i++) { - str += utf16Rune(gen) - } - return str -} - -/** - * Returns one element of a given array. - * - * @param {PRNG} gen A random number generator. - * @param {Array} array Non empty Array of possible values. - * @return {T} One of the values of the supplied Array. - * @template T - */ -export const oneOf = (gen, array) => array[int31(gen, 0, array.length - 1)] - -/** - * @param {PRNG} gen - * @param {number} len - * @return {Uint8Array} - */ -export const uint8Array = (gen, len) => { - const buf = buffer.createUint8ArrayFromLen(len) - for (let i = 0; i < buf.length; i++) { - buf[i] = int32(gen, 0, binary.BITS8) - } - return buf -} - -/* c8 ignore start */ -/** - * @param {PRNG} gen - * @param {number} len - * @return {Uint16Array} - */ -export const uint16Array = (gen, len) => new Uint16Array(uint8Array(gen, len * 2).buffer) - -/** - * @param {PRNG} gen - * @param {number} len - * @return {Uint32Array} - */ -export const uint32Array = (gen, len) => new Uint32Array(uint8Array(gen, len * 4).buffer) -/* c8 ignore stop */ diff --git a/yjs-poll/node_modules/lib0/prng.test.d.ts b/yjs-poll/node_modules/lib0/prng.test.d.ts deleted file mode 100644 index dd69f9a..0000000 --- a/yjs-poll/node_modules/lib0/prng.test.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export function testGeneratorXoroshiro128plus(tc: t.TestCase): void; -export function testGeneratorXorshift32(tc: t.TestCase): void; -export function testGeneratorMt19937(tc: t.TestCase): void; -export function testNumberDistributions(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=prng.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/prng.test.d.ts.map b/yjs-poll/node_modules/lib0/prng.test.d.ts.map deleted file mode 100644 index 8fd97fd..0000000 --- a/yjs-poll/node_modules/lib0/prng.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"prng.test.d.ts","sourceRoot":"","sources":["prng.test.js"],"names":[],"mappings":"AA4LO,kDAFI,CAAC,CAAC,QAAQ,QAE2E;AAKzF,4CAFI,CAAC,CAAC,QAAQ,QAIpB;AAKM,yCAFI,CAAC,CAAC,QAAQ,QAIpB;AA2BM,4CAFI,CAAC,CAAC,QAAQ,QAOpB;mBAtOkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/prng/Mt19937.d.ts b/yjs-poll/node_modules/lib0/prng/Mt19937.d.ts deleted file mode 100644 index 8b499e0..0000000 --- a/yjs-poll/node_modules/lib0/prng/Mt19937.d.ts +++ /dev/null @@ -1,29 +0,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: number); - seed: number; - _state: Uint32Array; - _i: number; - /** - * Generate a random signed integer. - * - * @return {Number} A 32 bit signed integer. - */ - next(): number; -} -//# sourceMappingURL=Mt19937.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/prng/Mt19937.d.ts.map b/yjs-poll/node_modules/lib0/prng/Mt19937.d.ts.map deleted file mode 100644 index 598d30d..0000000 --- a/yjs-poll/node_modules/lib0/prng/Mt19937.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"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"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/prng/Mt19937.js b/yjs-poll/node_modules/lib0/prng/Mt19937.js deleted file mode 100644 index a0d5643..0000000 --- a/yjs-poll/node_modules/lib0/prng/Mt19937.js +++ /dev/null @@ -1,78 +0,0 @@ -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) - } -} diff --git a/yjs-poll/node_modules/lib0/prng/Xoroshiro128plus.d.ts b/yjs-poll/node_modules/lib0/prng/Xoroshiro128plus.d.ts deleted file mode 100644 index 5f2f9fd..0000000 --- a/yjs-poll/node_modules/lib0/prng/Xoroshiro128plus.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * 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; - _fresh: boolean; - /** - * @return {number} Float/Double in [0,1) - */ - next(): number; -} -//# sourceMappingURL=Xoroshiro128plus.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/prng/Xoroshiro128plus.d.ts.map b/yjs-poll/node_modules/lib0/prng/Xoroshiro128plus.d.ts.map deleted file mode 100644 index 9331744..0000000 --- a/yjs-poll/node_modules/lib0/prng/Xoroshiro128plus.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"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"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/prng/Xoroshiro128plus.js b/yjs-poll/node_modules/lib0/prng/Xoroshiro128plus.js deleted file mode 100644 index ba9b84a..0000000 --- a/yjs-poll/node_modules/lib0/prng/Xoroshiro128plus.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * @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 -#include - -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; -} -*/ diff --git a/yjs-poll/node_modules/lib0/prng/Xorshift32.d.ts b/yjs-poll/node_modules/lib0/prng/Xorshift32.d.ts deleted file mode 100644 index 436b8bc..0000000 --- a/yjs-poll/node_modules/lib0/prng/Xorshift32.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/prng/Xorshift32.d.ts.map b/yjs-poll/node_modules/lib0/prng/Xorshift32.d.ts.map deleted file mode 100644 index 281c028..0000000 --- a/yjs-poll/node_modules/lib0/prng/Xorshift32.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"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"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/prng/Xorshift32.js b/yjs-poll/node_modules/lib0/prng/Xorshift32.js deleted file mode 100644 index 9153504..0000000 --- a/yjs-poll/node_modules/lib0/prng/Xorshift32.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @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) - } -} diff --git a/yjs-poll/node_modules/lib0/promise.d.ts b/yjs-poll/node_modules/lib0/promise.d.ts deleted file mode 100644 index ccb4234..0000000 --- a/yjs-poll/node_modules/lib0/promise.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -export function create(f: (arg0: PromiseResolve, arg1: (arg0: Error) => void) => any): Promise; -export function createEmpty(f: (arg0: () => void, arg1: (arg0: Error) => void) => void): Promise; -/** - * `Promise.all` wait for all promises in the array to resolve and return the result - * @template {unknown[] | []} PS - * - * @param {PS} ps - * @return {Promise<{ -readonly [P in keyof PS]: Awaited }>} - */ -export const all: { - (values: Iterable>): Promise[]>; - (values: T): Promise<{ -readonly [P in keyof T]: Awaited; }>; -}; -export function reject(reason?: Error): Promise; -export function resolve(res: T | void): Promise; -export function resolveWith(res: T): Promise; -export function until(timeout: number, check: () => boolean, intervalResolution?: number): Promise; -export function untilAsync(check: () => Promise | boolean, timeout?: number, intervalResolution?: number): Promise; -export function wait(timeout: number): Promise; -export function isPromise(p: any): boolean; -export type PromiseResolve = (result?: T | PromiseLike | undefined) => any; -//# sourceMappingURL=promise.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/promise.d.ts.map b/yjs-poll/node_modules/lib0/promise.d.ts.map deleted file mode 100644 index 358b809..0000000 --- a/yjs-poll/node_modules/lib0/promise.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["promise.js"],"names":[],"mappings":"AAmBO,uBAJM,CAAC,KACH,CAAS,IAAiB,EAAjB,cAAc,CAAC,CAAC,CAAC,EAAC,IAAoB,EAApB,CAAS,IAAK,EAAL,KAAK,KAAE,IAAI,KAAE,GAAG,GACnD,OAAO,CAAC,CAAC,CAAC,CAE+C;AAM9D,+BAHI,CAAS,IAAe,EAAf,MAAW,IAAI,EAAC,IAAoB,EAApB,CAAS,IAAK,EAAL,KAAK,KAAE,IAAI,KAAE,IAAI,GAClD,OAAO,CAAC,IAAI,CAAC,CAEqB;AAE9C;;;;;;GAMG;AACH;;8DAwCM,CAAC;EAxCqC;AAMrC,gCAHI,KAAK,GACJ,OAAO,CAAC,KAAK,CAAC,CAE4B;AAO/C,wBAJM,CAAC,OACH,CAAC,GAAC,IAAI,GACL,OAAO,CAAC,CAAC,GAAC,IAAI,CAAC,CAEuB;AAO3C,4BAJM,CAAC,OACH,CAAC,GACA,OAAO,CAAC,CAAC,CAAC,CAEgC;AAW/C,+BALI,MAAM,SACN,MAAW,OAAO,uBAClB,MAAM,GACL,OAAO,CAAC,IAAI,CAAC,CAkBvB;AAQK,kCALI,MAAI,OAAO,CAAC,OAAO,CAAC,GAAC,OAAO,YAC5B,MAAM,uBACN,MAAM,GACL,OAAO,CAAC,IAAI,CAAC,CAWxB;AAMM,8BAHI,MAAM,GACL,OAAO,CAAC,SAAS,CAAC,CAE2D;AAWlF,6BAHI,GAAG,GACF,OAAO,CAEwE;2BA1G9E,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/promise.js b/yjs-poll/node_modules/lib0/promise.js deleted file mode 100644 index 61eefe8..0000000 --- a/yjs-poll/node_modules/lib0/promise.js +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Utility helpers to work with promises. - * - * @module promise - */ - -import * as time from './time.js' - -/** - * @template T - * @callback PromiseResolve - * @param {T|PromiseLike} [result] - */ - -/** - * @template T - * @param {function(PromiseResolve,function(Error):void):any} f - * @return {Promise} - */ -export const create = f => /** @type {Promise} */ (new Promise(f)) - -/** - * @param {function(function():void,function(Error):void):void} f - * @return {Promise} - */ -export const createEmpty = f => new Promise(f) - -/** - * `Promise.all` wait for all promises in the array to resolve and return the result - * @template {unknown[] | []} PS - * - * @param {PS} ps - * @return {Promise<{ -readonly [P in keyof PS]: Awaited }>} - */ -export const all = Promise.all.bind(Promise) - -/** - * @param {Error} [reason] - * @return {Promise} - */ -export const reject = reason => Promise.reject(reason) - -/** - * @template T - * @param {T|void} res - * @return {Promise} - */ -export const resolve = res => Promise.resolve(res) - -/** - * @template T - * @param {T} res - * @return {Promise} - */ -export const resolveWith = res => Promise.resolve(res) - -/** - * @todo Next version, reorder parameters: check, [timeout, [intervalResolution]] - * @deprecated use untilAsync instead - * - * @param {number} timeout - * @param {function():boolean} check - * @param {number} [intervalResolution] - * @return {Promise} - */ -export const until = (timeout, check, intervalResolution = 10) => create((resolve, reject) => { - const startTime = time.getUnixTime() - const hasTimeout = timeout > 0 - const untilInterval = () => { - if (check()) { - clearInterval(intervalHandle) - resolve() - } else if (hasTimeout) { - /* c8 ignore else */ - if (time.getUnixTime() - startTime > timeout) { - clearInterval(intervalHandle) - reject(new Error('Timeout')) - } - } - } - const intervalHandle = setInterval(untilInterval, intervalResolution) -}) - -/** - * @param {()=>Promise|boolean} check - * @param {number} timeout - * @param {number} intervalResolution - * @return {Promise} - */ -export const untilAsync = async (check, timeout = 0, intervalResolution = 10) => { - const startTime = time.getUnixTime() - const noTimeout = timeout <= 0 - // eslint-disable-next-line no-unmodified-loop-condition - while (noTimeout || time.getUnixTime() - startTime <= timeout) { - if (await check()) return - await wait(intervalResolution) - } - throw new Error('Timeout') -} - -/** - * @param {number} timeout - * @return {Promise} - */ -export const wait = timeout => create((resolve, _reject) => setTimeout(resolve, timeout)) - -/** - * Checks if an object is a promise using ducktyping. - * - * Promises are often polyfilled, so it makes sense to add some additional guarantees if the user of this - * library has some insane environment where global Promise objects are overwritten. - * - * @param {any} p - * @return {boolean} - */ -export const isPromise = p => p instanceof Promise || (p && p.then && p.catch && p.finally) diff --git a/yjs-poll/node_modules/lib0/promise.test.d.ts b/yjs-poll/node_modules/lib0/promise.test.d.ts deleted file mode 100644 index aa230e1..0000000 --- a/yjs-poll/node_modules/lib0/promise.test.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function testRepeatPromise(_tc: t.TestCase): Promise; -export function testispromise(_tc: t.TestCase): void; -export function testTypings(_tc: t.TestCase): Promise; -import * as t from './testing.js'; -//# sourceMappingURL=promise.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/promise.test.d.ts.map b/yjs-poll/node_modules/lib0/promise.test.d.ts.map deleted file mode 100644 index af058ae..0000000 --- a/yjs-poll/node_modules/lib0/promise.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"promise.test.d.ts","sourceRoot":"","sources":["promise.test.js"],"names":[],"mappings":"AA6BO,uCAFI,CAAC,CAAC,QAAQ,iBAmBpB;AAKM,mCAFI,CAAC,CAAC,QAAQ,QAapB;AAKM,iCAFI,CAAC,CAAC,QAAQ,iBAapB;mBA7EkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/queue.d.ts b/yjs-poll/node_modules/lib0/queue.d.ts deleted file mode 100644 index abba016..0000000 --- a/yjs-poll/node_modules/lib0/queue.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -export class QueueNode { - /** - * @type {QueueNode|null} - */ - next: QueueNode | null; -} -/** - * @template V - */ -export class QueueValue extends QueueNode { - /** - * @param {V} v - */ - constructor(v: V); - v: V; -} -/** - * @template {QueueNode} N - */ -export class Queue { - /** - * @type {N | null} - */ - start: N | null; - /** - * @type {N | null} - */ - end: N | null; -} -export function create(): Queue; -export function isEmpty(queue: Queue): boolean; -export function enqueue>(queue: Q, n: Q extends Queue ? N : never): void; -export function dequeue(queue: Queue): N | null; -//# sourceMappingURL=queue.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/queue.d.ts.map b/yjs-poll/node_modules/lib0/queue.d.ts.map deleted file mode 100644 index 25a9625..0000000 --- a/yjs-poll/node_modules/lib0/queue.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["queue.js"],"names":[],"mappings":"AAAA;IAEI;;OAEG;IACH,MAFU,SAAS,GAAC,IAAI,CAER;CAEnB;AAED;;GAEG;AACH,wBAFa,CAAC;IAGZ;;OAEG;IACH,eAFW,CAAC,EAKX;IADC,KAAU;CAEb;AAED;;GAEG;AACH,mBAFyB,CAAC,SAAZ,SAAU;IAIpB;;OAEG;IACH,OAFU,CAAC,GAAG,IAAI,CAED;IACjB;;OAEG;IACH,KAFU,CAAC,GAAG,IAAI,CAEH;CAElB;AASM,uBAHkB,CAAC,SAAZ,SAAU,KACZ,KAAK,CAAC,CAAC,CAAC,CAEmB;AAKhC,+BAFI,KAAK,CAAC,GAAG,CAAC,WAE+B;AAO7C,wBAJmB,CAAC,SAAb,KAAK,CAAC,GAAG,CAAE,SACd,CAAC,KACD,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,QAU9C;AAOM,wBAJkB,CAAC,SAAZ,SAAU,SACb,KAAK,CAAC,CAAC,CAAC,GACP,CAAC,GAAG,IAAI,CAanB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/queue.js b/yjs-poll/node_modules/lib0/queue.js deleted file mode 100644 index 5be7fd4..0000000 --- a/yjs-poll/node_modules/lib0/queue.js +++ /dev/null @@ -1,84 +0,0 @@ -export class QueueNode { - constructor () { - /** - * @type {QueueNode|null} - */ - this.next = null - } -} - -/** - * @template V - */ -export class QueueValue extends QueueNode { - /** - * @param {V} v - */ - constructor (v) { - super() - this.v = v - } -} - -/** - * @template {QueueNode} N - */ -export class Queue { - constructor () { - /** - * @type {N | null} - */ - this.start = null - /** - * @type {N | null} - */ - this.end = null - } -} - -/** - * @note The queue implementation is experimental and unfinished. - * Don't use this in production yet. - * - * @template {QueueNode} N - * @return {Queue} - */ -export const create = () => new Queue() - -/** - * @param {Queue} queue - */ -export const isEmpty = queue => queue.start === null - -/** - * @template {Queue} Q - * @param {Q} queue - * @param {Q extends Queue ? N : never} n - */ -export const enqueue = (queue, n) => { - if (queue.end !== null) { - queue.end.next = n - queue.end = n - } else { - queue.end = n - queue.start = n - } -} - -/** - * @template {QueueNode} N - * @param {Queue} queue - * @return {N | null} - */ -export const dequeue = queue => { - const n = queue.start - if (n !== null) { - // @ts-ignore - queue.start = n.next - if (queue.start === null) { - queue.end = null - } - return n - } - return null -} diff --git a/yjs-poll/node_modules/lib0/queue.test.d.ts b/yjs-poll/node_modules/lib0/queue.test.d.ts deleted file mode 100644 index 7caa54d..0000000 --- a/yjs-poll/node_modules/lib0/queue.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testEnqueueDequeue(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=queue.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/queue.test.d.ts.map b/yjs-poll/node_modules/lib0/queue.test.d.ts.map deleted file mode 100644 index be0508d..0000000 --- a/yjs-poll/node_modules/lib0/queue.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"queue.test.d.ts","sourceRoot":"","sources":["queue.test.js"],"names":[],"mappings":"AAMO,wCAFI,CAAC,CAAC,QAAQ,QA8BpB;mBAlCkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/random.d.ts b/yjs-poll/node_modules/lib0/random.d.ts deleted file mode 100644 index f52f7b8..0000000 --- a/yjs-poll/node_modules/lib0/random.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const rand: () => number; -export function uint32(): number; -export function uint53(): number; -export function oneOf(arr: Array): T; -export function uuidv4(): string; -//# sourceMappingURL=random.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/random.d.ts.map b/yjs-poll/node_modules/lib0/random.d.ts.map deleted file mode 100644 index e68e2aa..0000000 --- a/yjs-poll/node_modules/lib0/random.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["random.js"],"names":[],"mappings":"AAYA,gCAA+B;AAExB,iCAA2D;AAE3D,iCAGN;AAOM,sBAJM,CAAC,OACH,KAAK,CAAC,CAAC,CAAC,GACP,CAAC,CAEmD;AAQzD,0BAFK,MAAM,CAIjB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/random.js b/yjs-poll/node_modules/lib0/random.js deleted file mode 100644 index 741e5f1..0000000 --- a/yjs-poll/node_modules/lib0/random.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Isomorphic module for true random numbers / buffers / uuids. - * - * Attention: falls back to Math.random if the browser does not support crypto. - * - * @module random - */ - -import * as math from './math.js' -import * as binary from './binary.js' -import { getRandomValues } from 'lib0/webcrypto' - -export const rand = Math.random - -export const uint32 = () => getRandomValues(new Uint32Array(1))[0] - -export const uint53 = () => { - const arr = getRandomValues(new Uint32Array(8)) - return (arr[0] & binary.BITS21) * (binary.BITS32 + 1) + (arr[1] >>> 0) -} - -/** - * @template T - * @param {Array} arr - * @return {T} - */ -export const oneOf = arr => arr[math.floor(rand() * arr.length)] - -// @ts-ignore -const uuidv4Template = [1e7] + -1e3 + -4e3 + -8e3 + -1e11 - -/** - * @return {string} - */ -export const uuidv4 = () => uuidv4Template.replace(/[018]/g, /** @param {number} c */ c => - (c ^ uint32() & 15 >> c / 4).toString(16) -) diff --git a/yjs-poll/node_modules/lib0/random.test.d.ts b/yjs-poll/node_modules/lib0/random.test.d.ts deleted file mode 100644 index d3b2523..0000000 --- a/yjs-poll/node_modules/lib0/random.test.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function testRandom(tc: t.TestCase): void; -export function testUint32(tc: t.TestCase): void; -export function testUint53(tc: t.TestCase): void; -export function testUuidv4(tc: t.TestCase): void; -export function testUuidv4Overlaps(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=random.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/random.test.d.ts.map b/yjs-poll/node_modules/lib0/random.test.d.ts.map deleted file mode 100644 index 11ee966..0000000 --- a/yjs-poll/node_modules/lib0/random.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"random.test.d.ts","sourceRoot":"","sources":["random.test.js"],"names":[],"mappings":"AASO,+BAFI,CAAC,CAAC,QAAQ,QAKpB;AAKM,+BAFI,CAAC,CAAC,QAAQ,QA0BpB;AAKM,+BAFI,CAAC,CAAC,QAAQ,QAyBpB;AAKM,+BAFI,CAAC,CAAC,QAAQ,QAIpB;AAKM,uCAFI,CAAC,CAAC,QAAQ,QAiBpB;mBA/FkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/rollup.config.d.ts b/yjs-poll/node_modules/lib0/rollup.config.d.ts deleted file mode 100644 index 7192ab2..0000000 --- a/yjs-poll/node_modules/lib0/rollup.config.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -declare const _default: { - input: string[]; - output: { - dir: string; - format: string; - sourcemap: boolean; - entryFileNames: string; - chunkFileNames: string; - }; - external: string[]; -}[]; -export default _default; -//# sourceMappingURL=rollup.config.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/rollup.config.d.ts.map b/yjs-poll/node_modules/lib0/rollup.config.d.ts.map deleted file mode 100644 index 26da1df..0000000 --- a/yjs-poll/node_modules/lib0/rollup.config.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rollup.config.d.ts","sourceRoot":"","sources":["rollup.config.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/schema.d.ts b/yjs-poll/node_modules/lib0/schema.d.ts deleted file mode 100644 index 27c6fbf..0000000 --- a/yjs-poll/node_modules/lib0/schema.d.ts +++ /dev/null @@ -1,595 +0,0 @@ -export class ValidationError { - /** - * Reverse errors - * @type {Array<{ path: string?, expected: string, has: string, message: string? }>} - */ - _rerrs: Array<{ - path: string | null; - expected: string; - has: string; - message: string | null; - }>; - /** - * @param {string?} path - * @param {string} expected - * @param {string} has - * @param {string?} message - */ - extend(path: string | null, expected: string, has: string, message?: string | null): void; - toString(): string; -} -/** - * @template T - * @implements {equalityTraits.EqualityTrait} - */ -export class Schema implements equalityTraits.EqualityTrait { - /** - * If true, the more things are added to the shape the more objects this schema will accept (e.g. - * union). By default, the more objects are added, the the fewer objects this schema will accept. - * @protected - */ - protected static _dilutes: boolean; - /** - * @param {Schema} other - */ - extends(other: Schema): boolean; - /** - * Overwrite this when necessary. By default, we only check the `shape` property which every shape - * should have. - * @param {Schema} other - */ - equals(other: Schema): boolean; - /** - * Use `schema.validate(obj)` with a typed parameter that is already of typed to be an instance of - * Schema. Validate will check the structure of the parameter and return true iff the instance - * really is an instance of Schema. - * - * @param {T} o - * @return {boolean} - */ - validate(o: T): boolean; - /** - * Similar to validate, but this method accepts untyped parameters. - * - * @param {any} _o - * @param {ValidationError} [_err] - * @return {_o is T} - */ - check(_o: any, _err?: ValidationError): _o is T; - /** - * @type {Schema} - */ - get nullable(): Schema; - /** - * @type {$Optional>} - */ - get optional(): $Optional>; - /** - * Cast a variable to a specific type. Returns the casted value, or throws an exception otherwise. - * Use this if you know that the type is of a specific type and you just want to convince the type - * system. - * - * **Do not rely on these error messages!** - * Performs an assertion check only if not in a production environment. - * - * @template OO - * @param {OO} o - * @return {Extract extends never ? T : (OO extends Array ? T : Extract)} - */ - cast(o: OO): Extract extends never ? T : (OO extends Array ? T : Extract); - /** - * EXPECTO PATRONUM!! 🪄 - * This function protects against type errors. Though it may not work in the real world. - * - * "After all this time?" - * "Always." - Snape, talking about type safety - * - * Ensures that a variable is a a specific type. Returns the value, or throws an exception if the assertion check failed. - * Use this if you know that the type is of a specific type and you just want to convince the type - * system. - * - * Can be useful when defining lambdas: `s.lambda(s.$number, s.$void).expect((n) => n + 1)` - * - * **Do not rely on these error messages!** - * Performs an assertion check if not in a production environment. - * - * @param {T} o - * @return {o extends T ? T : never} - */ - expect(o: T): T extends T ? T : never; - [schemaSymbol](): boolean; - /** - * @param {object} other - */ - [equalityTraits.EqualityTraitSymbol](other: object): boolean; -} -/** - * @template {(new (...args:any[]) => any) | ((...args:any[]) => any)} Constr - * @typedef {Constr extends ((...args:any[]) => infer T) ? T : (Constr extends (new (...args:any[]) => any) ? InstanceType : never)} Instance - */ -/** - * @template {(new (...args:any[]) => any) | ((...args:any[]) => any)} C - * @extends {Schema>} - */ -export class $ConstructedBy any) | ((...args: any[]) => any)> extends Schema> { - /** - * @param {C} c - * @param {((o:Instance)=>boolean)|null} check - */ - constructor(c: C, check: ((o: Instance) => boolean) | null); - shape: C; - _c: ((o: Instance) => boolean) | null; - /** - * @param {any} o - * @param {ValidationError} [err] - * @return {o is C extends ((...args:any[]) => infer T) ? T : (C extends (new (...args:any[]) => any) ? InstanceType : never)} o - */ - check(o: any, err?: ValidationError): o is C extends ((...args: any[]) => infer T) ? T : (C extends (new (...args: any[]) => any) ? InstanceType : never); -} -export function $constructedBy any) | ((...args: any[]) => any)>(c: C, check?: ((o: Instance) => boolean) | null): CastToSchema<$ConstructedBy>; -export const $$constructedBy: Schema<$ConstructedBy<(new (...args: any[]) => any) | ((...args: any[]) => any)>>; -/** - * Check custom properties on any object. You may want to overwrite the generated Schema. - * - * @extends {Schema} - */ -export class $Custom extends Schema { - /** - * @param {(o:any) => boolean} check - */ - constructor(check: (o: any) => boolean); - /** - * @type {(o:any) => boolean} - */ - shape: (o: any) => boolean; - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is any} - */ - check(o: any, err: ValidationError): o is any; -} -export function $custom(check: (o: any) => boolean): Schema; -export const $$custom: Schema<$Custom>; -/** - * @template {Primitive} T - * @extends {Schema} - */ -export class $Literal extends Schema { - /** - * @param {Array} literals - */ - constructor(literals: Array); - shape: T[]; -} -export function $literal(...literals: T): CastToSchema<$Literal>; -export const $$literal: Schema<$Literal>; -/** - * @template {Array>} T - * @extends {Schema>} - */ -export class $StringTemplate>> extends Schema> { - /** - * @param {T} shape - */ - constructor(shape: T); - shape: T; - _r: RegExp; -} -export function $stringTemplate>>(...literals: T): CastToSchema<$StringTemplate>; -export const $$stringTemplate: Schema<$StringTemplate<(string | Schema)[]>>; -export const $$optional: Schema<$Optional>>; -/** - * @type {Schema} - */ -export const $never: Schema; -export const $$never: Schema<$Never>; -/** - * @template {{ [key: string|symbol|number]: Schema }} S - * @typedef {{ [Key in keyof S as S[Key] extends $Optional> ? Key : never]?: S[Key] extends $Optional> ? Type : never } & { [Key in keyof S as S[Key] extends $Optional> ? never : Key]: S[Key] extends Schema ? Type : never }} $ObjectToType - */ -/** - * @template {{[key:string|symbol|number]: Schema}} S - * @extends {Schema<$ObjectToType>} - */ -export class $Object; -}> extends Schema<$ObjectToType> { - /** - * @param {S} shape - * @param {boolean} partial - */ - constructor(shape: S, partial?: boolean); - /** - * @type {S} - */ - shape: S; - _isPartial: boolean; - /** - * @type {Schema>>} - */ - get partial(): Schema>>; - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is $ObjectToType} - */ - check(o: any, err: ValidationError): o is $ObjectToType; -} -export function $object; -}>(def: S): _ObjectDefToSchema extends Schema ? Schema<{ [K in keyof S_1]: S_1[K]; }> : never; -export const $$object: Schema<$Object<{ - [key: string]: Schema; - [key: number]: Schema; - [key: symbol]: Schema; -}>>; -/** - * @type {Schema<{[key:string]: any}>} - */ -export const $objectAny: Schema<{ - [key: string]: any; -}>; -/** - * @template {Schema} Keys - * @template {Schema} Values - * @extends {Schema<{ [key in Unwrap]: Unwrap }>} - */ -export class $Record, Values extends Schema> extends Schema<{ [key in Unwrap]: Unwrap; }> { - /** - * @param {Keys} keys - * @param {Values} values - */ - constructor(keys: Keys, values: Values); - shape: { - keys: Keys; - values: Values; - }; - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is { [key in Unwrap]: Unwrap }} - */ - check(o: any, err: ValidationError): o is { [key_1 in Unwrap]: Unwrap; }; -} -export function $record, Values extends Schema>(keys: Keys, values: Values): CastToSchema<$Record>; -export const $$record: Schema<$Record, Schema>>; -/** - * @template {Schema[]} S - * @extends {Schema<{ [Key in keyof S]: S[Key] extends Schema ? Type : never }>} - */ -export class $Tuple[]> extends Schema<{ [Key in keyof S]: S[Key] extends Schema ? Type : never; }> { - /** - * @param {S} shape - */ - constructor(shape: S); - shape: S; - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is { [K in keyof S]: S[K] extends Schema ? Type : never }} - */ - check(o: any, err: ValidationError): o is { [K in keyof S]: S[K] extends Schema ? Type : never; }; -} -export function $tuple>>(...def: T): CastToSchema<$Tuple>; -export const $$tuple: Schema<$Tuple[]>>; -/** - * @template {Schema} S - * @extends {Schema ? T : never>>} - */ -export class $Array> extends Schema<(S extends Schema ? T : never)[]> { - /** - * @param {Array} v - */ - constructor(v: Array); - /** - * @type {Schema ? T : never>} - */ - shape: Schema ? T_1 : never>; - /** - * @param {any} o - * @param {ValidationError} [err] - * @return {o is Array ? T : never>} o - */ - check(o: any, err?: ValidationError): o is Array ? T_1 : never>; -} -export function $array>>(...def: T): Schema> ? S : never>>; -export const $$array: Schema<$Array>>; -/** - * @type {Schema>} - */ -export const $arrayAny: Schema>; -/** - * @template T - * @extends {Schema} - */ -export class $InstanceOf extends Schema { - /** - * @param {new (...args:any) => T} constructor - * @param {((o:T) => boolean)|null} check - */ - constructor(constructor: new (...args: any) => T, check: ((o: T) => boolean) | null); - shape: new (...args: any) => T; - _c: ((o: T) => boolean) | null; - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is T} - */ - check(o: any, err: ValidationError): o is T; -} -export function $instanceOf(c: new (...args: any) => T, check?: ((o: T) => boolean) | null): Schema; -export const $$instanceOf: Schema<$InstanceOf>; -export const $$schema: Schema>; -/** - * @template {Schema[]} Args - * @typedef {(...args:UnwrapArray>)=>Unwrap>} _LArgsToLambdaDef - */ -/** - * @template {Array>} Args - * @extends {Schema<_LArgsToLambdaDef>} - */ -export class $Lambda>> extends Schema<_LArgsToLambdaDef> { - /** - * @param {Args} args - */ - constructor(args: Args); - len: number; - args: Schema; - res: Schema; - /** - * @param {any} f - * @param {ValidationError} err - * @return {f is _LArgsToLambdaDef} - */ - check(f: any, err: ValidationError): f is _LArgsToLambdaDef; -} -export function $lambda[]>(...args: Args): Schema<(...args: UnwrapArray>) => Unwrap>>; -export const $$lambda: Schema<$Lambda[]>>; -/** - * @type {Schema} - */ -export const $function: Schema; -/** - * @template {Array>} T - * @extends {Schema>>} - */ -export class $Intersection>> extends Schema>> { - /** - * @param {T} v - */ - constructor(v: T); - /** - * @type {T} - */ - shape: T; -} -export function $intersect[]>(...def: T): CastToSchema<$Intersection>; -export const $$intersect: Schema<$Intersection[]>>; -/** - * @template S - * @extends {Schema} - */ -export class $Union extends Schema { - /** - * @param {Array>} v - */ - constructor(v: Array>); - shape: Schema[]; -} -export function $union>(...schemas: T): CastToSchema<$Union>>>; -export const $$union: Schema<$Union>; -/** - * @type {Schema} - */ -export const $any: Schema; -export const $$any: Schema>; -/** - * @type {Schema} - */ -export const $bigint: Schema; -export const $$bigint: Schema>; -/** - * @type {Schema} - */ -export const $symbol: Schema; -export const $$symbol: Schema>; -/** - * @type {Schema} - */ -export const $number: Schema; -export const $$number: Schema>; -/** - * @type {Schema} - */ -export const $string: Schema; -export const $$string: Schema>; -/** - * @type {Schema} - */ -export const $boolean: Schema; -export const $$boolean: Schema>; -/** - * @type {Schema} - */ -export const $undefined: Schema; -export const $$undefined: Schema>; -/** - * @type {Schema} - */ -export const $void: Schema; -export const $$void: Schema>; -export const $null: Schema; -export const $$null: Schema>; -export const $uint8Array: Schema>; -export const $$uint8Array: Schema>; -/** - * @type {Schema} - */ -export const $primitive: Schema; -/** - * @typedef {JSON[]} JSONArray - */ -/** - * @typedef {Primitive|JSONArray|{ [key:string]:JSON }} JSON - */ -/** - * @type {Schema} - */ -export const $json: Schema; -export function $(o: IN): ReadSchema; -/** - * Assert that a variable is of this specific type. - * The assertion check is only performed in non-production environments. - * - * @type {(o:any,schema:Schema) => asserts o is T} - */ -export const assert: (o: any, schema: Schema) => asserts o is T; -/** - * @template In - * @template Out - * @typedef {{ if: Schema, h: (o:In,state?:any)=>Out }} Pattern - */ -/** - * @template {Pattern} P - * @template In - * @typedef {ReturnType>['h']>} PatternMatchResult - */ -/** - * @todo move this to separate library - * @template {any} [State=undefined] - * @template {Pattern} [Patterns=never] - */ -export class PatternMatcher = never> { - /** - * @param {Schema} [$state] - */ - constructor($state?: Schema); - /** - * @type {Array} - */ - patterns: Array; - $state: Schema | undefined; - /** - * @template P - * @template R - * @param {P} pattern - * @param {(o:NoInfer>>,s:State)=>R} handler - * @return {PatternMatcher>,R>>} - */ - if(pattern: P, handler: (o: NoInfer>>, s: State) => R): PatternMatcher>, R>>; - /** - * @template R - * @param {(o:any,s:State)=>R} h - */ - else(h: (o: any, s: State) => R): PatternMatcher>; - /** - * @return {State extends undefined - * ? >(o:In,state?:undefined)=>PatternMatchResult - * : >(o:In,state:State)=>PatternMatchResult} - */ - done(): State extends undefined ? >(o: In, state?: undefined) => PatternMatchResult : >(o: In, state: State) => PatternMatchResult; -} -export function match(state?: State): PatternMatcher>>; -export function random(gen: prng.PRNG, schema: S): Unwrap>; -export type Primitive = string | number | bigint | boolean | null | undefined | symbol; -export type AnyObject = { - [k: string | number | symbol]: any; -}; -export type Unwrap = T extends Schema ? X : T; -export type TypeOf = T extends Schema ? X : T; -export type UnwrapArray = T extends readonly [Schema, ...infer Rest] ? [First, ...UnwrapArray] : []; -export type CastToSchema = T extends Schema ? Schema : never; -export type TupleLast = Arr extends [...unknown[], infer L] ? L : never; -export type TuplePop = Arr extends [...infer Fs, unknown] ? Fs : never; -export type Intersect = T extends [] ? {} : T extends [infer First] ? First : T extends [infer First, ...infer Rest] ? First & Intersect : never; -export type Instance any) | ((...args: any[]) => any)> = Constr extends ((...args: any[]) => infer T) ? T : (Constr extends (new (...args: any[]) => any) ? InstanceType : never); -export type CastStringTemplateArgsToTemplate>> = Ts extends [] ? `` : (Ts extends [infer T] ? (Unwrap extends (string | number) ? Unwrap : never) : (Ts extends [infer T1, ...infer Rest] ? `${Unwrap extends (string | number) ? Unwrap : never}${Rest extends Array> ? CastStringTemplateArgsToTemplate : never}` : never)); -export type $ObjectToType; -}> = { [Key in keyof S as S[Key] extends $Optional> ? Key : never]?: S[Key] extends $Optional> ? Type : never; } & { [Key in keyof S as S[Key] extends $Optional> ? never : Key]: S[Key] extends Schema ? Type : never; }; -export type _ObjectDefToSchema = Schema<{ [Key in keyof S as S[Key] extends $Optional> ? Key : never]?: S[Key] extends $Optional> ? Type : never; } & { [Key in keyof S as S[Key] extends $Optional> ? never : Key]: S[Key] extends Schema ? Type : never; }>; -export type _LArgsToLambdaDef[]> = (...args: UnwrapArray>) => Unwrap>; -export type JSONArray = JSON[]; -export type JSON = Primitive | JSONArray | { - [key: string]: JSON; -}; -export type ReadSchemaOld = IN extends Schema ? IN : (IN extends string | number | boolean | null ? Schema : (IN extends new (...args: any[]) => any ? Schema> : (IN extends any[] ? Schema<{ [K in keyof IN]: Unwrap>; }[number]> : (IN extends object ? (_ObjectDefToSchema<{ [K in keyof IN]: ReadSchema; }> extends Schema ? Schema<{ [K in keyof S]: S[K]; }> : never) : never)))); -export type ReadSchema = [Extract>, Extract, Extract any>, Extract, Extract | string | number | boolean | null | (new (...args: any[]) => any) | any[]>, object>] extends [infer Schemas, infer Primitives, infer Constructors, infer Arrs, infer Obj] ? Schema<(Schemas extends Schema ? S : never) | Primitives | (Constructors extends new (...args: any[]) => any ? InstanceType : never) | (Arrs extends any[] ? { [K in keyof Arrs]: Unwrap>; }[number] : never) | (Obj extends object ? Unwrap<(_ObjectDefToSchema<{ [K in keyof Obj]: ReadSchema; }> extends Schema ? Schema<{ [K in keyof S]: S[K]; }> : never)> : never)> : never; -export type Q = ReadSchema<{ - x: 42; -} | { - y: 99; -} | Schema | [1, 2, {}]>; -export type Pattern = { - if: Schema; - h: (o: In, state?: any) => Out; -}; -export type PatternMatchResult

, In> = ReturnType>["h"]>; -import * as equalityTraits from './trait/equality.js'; -/** - * @template {Schema} S - * @extends Schema|undefined> - */ -declare class $Optional> extends Schema | undefined> { - /** - * @param {S} shape - */ - constructor(shape: S); - shape: S; - get [isOptionalSymbol](): boolean; -} -/** - * @typedef {string|number|bigint|boolean|null|undefined|symbol} Primitive - */ -/** - * @typedef {{ [k:string|number|symbol]: any }} AnyObject - */ -/** - * @template T - * @typedef {T extends Schema ? X : T} Unwrap - */ -/** - * @template T - * @typedef {T extends Schema ? X : T} TypeOf - */ -/** - * @template {readonly unknown[]} T - * @typedef {T extends readonly [Schema, ...infer Rest] ? [First, ...UnwrapArray] : [] } UnwrapArray - */ -/** - * @template T - * @typedef {T extends Schema ? Schema : never} CastToSchema - */ -/** - * @template {unknown[]} Arr - * @typedef {Arr extends [...unknown[], infer L] ? L : never} TupleLast - */ -/** - * @template {unknown[]} Arr - * @typedef {Arr extends [...infer Fs, unknown] ? Fs : never} TuplePop - */ -/** - * @template {readonly unknown[]} T - * @typedef {T extends [] - * ? {} - * : T extends [infer First] - * ? First - * : T extends [infer First, ...infer Rest] - * ? First & Intersect - * : never - * } Intersect - */ -declare const schemaSymbol: unique symbol; -/** - * @extends Schema - */ -declare class $Never extends Schema { - constructor(); -} -import * as prng from './prng.js'; -declare const isOptionalSymbol: unique symbol; -export {}; -//# sourceMappingURL=schema.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/schema.d.ts.map b/yjs-poll/node_modules/lib0/schema.d.ts.map deleted file mode 100644 index 9c01a9c..0000000 --- a/yjs-poll/node_modules/lib0/schema.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["schema.js"],"names":[],"mappings":"AAoEA;IAEI;;;OAGG;IACH,QAFU,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,OAAC,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,OAAC,CAAA;KAAE,CAAC,CAEnE;IAGlB;;;;;OAKG;IACH,aALW,MAAM,OAAC,YACP,MAAM,OACN,MAAM,YACN,MAAM,OAAC,QAIjB;IAED,mBAQC;CACF;AAwBD;;;GAGG;AACH,oBAHa,CAAC,aACE,cAAc,CAAC,aAAa;IAI1C;;;;OAIG;IACH,mCAAuB;IAEv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AC,CAAC,EAAC,CAAC,EAAC,EAAE,CAAC,CAAC;oBAiDjD,EAAE,EACF,GAAG,IACH;IAAE,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;IAAC,CAAC,EAAE,CAAC,CAAC,EAAC,EAAE,EAAC,KAAK,CAAC,EAAC,GAAG,KAAG,GAAG,CAAA;CAAE;+BAI1B,CAAC,SAAnB,OAAO,CAAC,GAAG,EAAC,GAAG,CAAE,EAClB,EAAE,IACF,UAAU,CAAC,OAAO,CAAC,CAAC,EAAC,OAAO,CAAC,EAAE,SAAS,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE,SAAS,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC,EAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gCA19BpF,qBAAqB;AAqarD;;;GAGG;AACH,wBAH2B,CAAC,SAAd,MAAM,CAAC,GAAG,CAAE;IAIxB;;OAEG;IACH,mBAFW,CAAC,EAKX;IADC,SAAkB;IAepB,kCAAyC;CAC1C;AAzbD;;GAEG;AAEH;;GAEG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;;;;;;;GAUG;AAEH,0CAAsC;AA0YtC;;GAEG;AACH;;CAWC;sBA7cqB,WAAW;AAiajC,8CAA2C"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/schema.js b/yjs-poll/node_modules/lib0/schema.js deleted file mode 100644 index 4f7afa1..0000000 --- a/yjs-poll/node_modules/lib0/schema.js +++ /dev/null @@ -1,1136 +0,0 @@ -/** - * @experimental WIP - * - * Simple & efficient schemas for your data. - */ - -import * as obj from './object.js' -import * as arr from './array.js' -import * as error from './error.js' -import * as env from './environment.js' -import * as equalityTraits from './trait/equality.js' -import * as fun from './function.js' -import * as string from './string.js' -import * as prng from './prng.js' -import * as number from './number.js' - -/** - * @typedef {string|number|bigint|boolean|null|undefined|symbol} Primitive - */ - -/** - * @typedef {{ [k:string|number|symbol]: any }} AnyObject - */ - -/** - * @template T - * @typedef {T extends Schema ? X : T} Unwrap - */ - -/** - * @template T - * @typedef {T extends Schema ? X : T} TypeOf - */ - -/** - * @template {readonly unknown[]} T - * @typedef {T extends readonly [Schema, ...infer Rest] ? [First, ...UnwrapArray] : [] } UnwrapArray - */ - -/** - * @template T - * @typedef {T extends Schema ? Schema : never} CastToSchema - */ - -/** - * @template {unknown[]} Arr - * @typedef {Arr extends [...unknown[], infer L] ? L : never} TupleLast - */ - -/** - * @template {unknown[]} Arr - * @typedef {Arr extends [...infer Fs, unknown] ? Fs : never} TuplePop - */ - -/** - * @template {readonly unknown[]} T - * @typedef {T extends [] - * ? {} - * : T extends [infer First] - * ? First - * : T extends [infer First, ...infer Rest] - * ? First & Intersect - * : never - * } Intersect - */ - -const schemaSymbol = Symbol('0schema') - -export class ValidationError { - constructor () { - /** - * Reverse errors - * @type {Array<{ path: string?, expected: string, has: string, message: string? }>} - */ - this._rerrs = [] - } - - /** - * @param {string?} path - * @param {string} expected - * @param {string} has - * @param {string?} message - */ - extend (path, expected, has, message = null) { - this._rerrs.push({ path, expected, has, message }) - } - - toString () { - const s = [] - for (let i = this._rerrs.length - 1; i > 0; i--) { - const r = this._rerrs[i] - /* c8 ignore next */ - s.push(string.repeat(' ', (this._rerrs.length - i) * 2) + `${r.path != null ? `[${r.path}] ` : ''}${r.has} doesn't match ${r.expected}. ${r.message}`) - } - return s.join('\n') - } -} - -/** - * @param {any} a - * @param {any} b - * @return {boolean} - */ -const shapeExtends = (a, b) => { - if (a === b) return true - if (a == null || b == null || a.constructor !== b.constructor) return false - if (a[equalityTraits.EqualityTraitSymbol]) return equalityTraits.equals(a, b) // last resort: check equality (do this before array and obj check which don't implement the equality trait) - if (arr.isArray(a)) { - return arr.every(a, aitem => - arr.some(b, bitem => shapeExtends(aitem, bitem)) - ) - } else if (obj.isObject(a)) { - return obj.every(a, (aitem, akey) => - shapeExtends(aitem, b[akey]) - ) - } - /* c8 ignore next */ - return false -} - -/** - * @template T - * @implements {equalityTraits.EqualityTrait} - */ -export class Schema { - // this.shape must not be defined on Schema. Otherwise typecheck on metatypes (e.g. $$object) won't work as expected anymore - /** - * If true, the more things are added to the shape the more objects this schema will accept (e.g. - * union). By default, the more objects are added, the the fewer objects this schema will accept. - * @protected - */ - static _dilutes = false - - /** - * @param {Schema} other - */ - extends (other) { - let [a, b] = [/** @type {any} */(this).shape, /** @type {any} */ (other).shape] - if (/** @type {typeof Schema} */ (this.constructor)._dilutes) [b, a] = [a, b] - return shapeExtends(a, b) - } - - /** - * Overwrite this when necessary. By default, we only check the `shape` property which every shape - * should have. - * @param {Schema} other - */ - equals (other) { - // @ts-ignore - return this.constructor === other.constructor && fun.equalityDeep(this.shape, other.shape) - } - - [schemaSymbol] () { return true } - - /** - * @param {object} other - */ - [equalityTraits.EqualityTraitSymbol] (other) { - return this.equals(/** @type {any} */ (other)) - } - - /** - * Use `schema.validate(obj)` with a typed parameter that is already of typed to be an instance of - * Schema. Validate will check the structure of the parameter and return true iff the instance - * really is an instance of Schema. - * - * @param {T} o - * @return {boolean} - */ - validate (o) { - return this.check(o) - } - - /* c8 ignore start */ - /** - * Similar to validate, but this method accepts untyped parameters. - * - * @param {any} _o - * @param {ValidationError} [_err] - * @return {_o is T} - */ - check (_o, _err) { - error.methodUnimplemented() - } - /* c8 ignore stop */ - - /** - * @type {Schema} - */ - get nullable () { - // @ts-ignore - return $union(this, $null) - } - - /** - * @type {$Optional>} - */ - get optional () { - return new $Optional(/** @type {Schema} */ (this)) - } - - /** - * Cast a variable to a specific type. Returns the casted value, or throws an exception otherwise. - * Use this if you know that the type is of a specific type and you just want to convince the type - * system. - * - * **Do not rely on these error messages!** - * Performs an assertion check only if not in a production environment. - * - * @template OO - * @param {OO} o - * @return {Extract extends never ? T : (OO extends Array ? T : Extract)} - */ - cast (o) { - assert(o, this) - return /** @type {any} */ (o) - } - - /** - * EXPECTO PATRONUM!! 🪄 - * This function protects against type errors. Though it may not work in the real world. - * - * "After all this time?" - * "Always." - Snape, talking about type safety - * - * Ensures that a variable is a a specific type. Returns the value, or throws an exception if the assertion check failed. - * Use this if you know that the type is of a specific type and you just want to convince the type - * system. - * - * Can be useful when defining lambdas: `s.lambda(s.$number, s.$void).expect((n) => n + 1)` - * - * **Do not rely on these error messages!** - * Performs an assertion check if not in a production environment. - * - * @param {T} o - * @return {o extends T ? T : never} - */ - expect (o) { - assert(o, this) - return o - } -} - -/** - * @template {(new (...args:any[]) => any) | ((...args:any[]) => any)} Constr - * @typedef {Constr extends ((...args:any[]) => infer T) ? T : (Constr extends (new (...args:any[]) => any) ? InstanceType : never)} Instance - */ - -/** - * @template {(new (...args:any[]) => any) | ((...args:any[]) => any)} C - * @extends {Schema>} - */ -export class $ConstructedBy extends Schema { - /** - * @param {C} c - * @param {((o:Instance)=>boolean)|null} check - */ - constructor (c, check) { - super() - this.shape = c - this._c = check - } - - /** - * @param {any} o - * @param {ValidationError} [err] - * @return {o is C extends ((...args:any[]) => infer T) ? T : (C extends (new (...args:any[]) => any) ? InstanceType : never)} o - */ - check (o, err = undefined) { - const c = o?.constructor === this.shape && (this._c == null || this._c(o)) - /* c8 ignore next */ - !c && err?.extend(null, this.shape.name, o?.constructor.name, o?.constructor !== this.shape ? 'Constructor match failed' : 'Check failed') - return c - } -} - -/** - * @template {(new (...args:any[]) => any) | ((...args:any[]) => any)} C - * @param {C} c - * @param {((o:Instance) => boolean)|null} check - * @return {CastToSchema<$ConstructedBy>} - */ -export const $constructedBy = (c, check = null) => new $ConstructedBy(c, check) -export const $$constructedBy = $constructedBy($ConstructedBy) - -/** - * Check custom properties on any object. You may want to overwrite the generated Schema. - * - * @extends {Schema} - */ -export class $Custom extends Schema { - /** - * @param {(o:any) => boolean} check - */ - constructor (check) { - super() - /** - * @type {(o:any) => boolean} - */ - this.shape = check - } - - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is any} - */ - check (o, err) { - const c = this.shape(o) - /* c8 ignore next */ - !c && err?.extend(null, 'custom prop', o?.constructor.name, 'failed to check custom prop') - return c - } -} - -/** - * @param {(o:any) => boolean} check - * @return {Schema} - */ -export const $custom = (check) => new $Custom(check) -export const $$custom = $constructedBy($Custom) - -/** - * @template {Primitive} T - * @extends {Schema} - */ -export class $Literal extends Schema { - /** - * @param {Array} literals - */ - constructor (literals) { - super() - this.shape = literals - } - - /** - * - * @param {any} o - * @param {ValidationError} [err] - * @return {o is T} - */ - check (o, err) { - const c = this.shape.some(a => a === o) - /* c8 ignore next */ - !c && err?.extend(null, this.shape.join(' | '), o.toString()) - return c - } -} - -/** - * @template {Primitive[]} T - * @param {T} literals - * @return {CastToSchema<$Literal>} - */ -export const $literal = (...literals) => new $Literal(literals) -export const $$literal = $constructedBy($Literal) - -/** - * @template {Array>} Ts - * @typedef {Ts extends [] ? `` : (Ts extends [infer T] ? (Unwrap extends (string|number) ? Unwrap : never) : (Ts extends [infer T1, ...infer Rest] ? `${Unwrap extends (string|number) ? Unwrap : never}${Rest extends Array> ? CastStringTemplateArgsToTemplate : never}` : never))} CastStringTemplateArgsToTemplate - */ - -/** - * @param {string} str - * @return {string} - */ -const _regexEscape = /** @type {any} */ (RegExp).escape || /** @type {(str:string) => string} */ (str => - str.replace(/[().|&,$^[\]]/g, s => '\\' + s) -) - -/** - * @param {string|Schema} s - * @return {string[]} - */ -const _schemaStringTemplateToRegex = s => { - if ($string.check(s)) { - return [_regexEscape(s)] - } - if ($$literal.check(s)) { - return /** @type {Array} */ (s.shape).map(v => v + '') - } - if ($$number.check(s)) { - return ['[+-]?\\d+.?\\d*'] - } - if ($$string.check(s)) { - return ['.*'] - } - if ($$union.check(s)) { - return s.shape.map(_schemaStringTemplateToRegex).flat(1) - } - /* c8 ignore next 2 */ - // unexpected schema structure (only supports unions and string in literal types) - error.unexpectedCase() -} - -/** - * @template {Array>} T - * @extends {Schema>} - */ -export class $StringTemplate extends Schema { - /** - * @param {T} shape - */ - constructor (shape) { - super() - this.shape = shape - this._r = new RegExp('^' + shape.map(_schemaStringTemplateToRegex).map(opts => `(${opts.join('|')})`).join('') + '$') - } - - /** - * @param {any} o - * @param {ValidationError} [err] - * @return {o is CastStringTemplateArgsToTemplate} - */ - check (o, err) { - const c = this._r.exec(o) != null - /* c8 ignore next */ - !c && err?.extend(null, this._r.toString(), o.toString(), 'String doesn\'t match string template.') - return c - } -} - -/** - * @template {Array>} T - * @param {T} literals - * @return {CastToSchema<$StringTemplate>} - */ -export const $stringTemplate = (...literals) => new $StringTemplate(literals) -export const $$stringTemplate = $constructedBy($StringTemplate) - -const isOptionalSymbol = Symbol('optional') -/** - * @template {Schema} S - * @extends Schema|undefined> - */ -class $Optional extends Schema { - /** - * @param {S} shape - */ - constructor (shape) { - super() - this.shape = shape - } - - /** - * @param {any} o - * @param {ValidationError} [err] - * @return {o is (Unwrap|undefined)} - */ - check (o, err) { - const c = o === undefined || this.shape.check(o) - /* c8 ignore next */ - !c && err?.extend(null, 'undefined (optional)', '()') - return c - } - - get [isOptionalSymbol] () { return true } -} -export const $$optional = $constructedBy($Optional) - -/** - * @extends Schema - */ -class $Never extends Schema { - /** - * @param {any} _o - * @param {ValidationError} [err] - * @return {_o is never} - */ - check (_o, err) { - /* c8 ignore next */ - err?.extend(null, 'never', typeof _o) - return false - } -} - -/** - * @type {Schema} - */ -export const $never = new $Never() -export const $$never = $constructedBy($Never) - -/** - * @template {{ [key: string|symbol|number]: Schema }} S - * @typedef {{ [Key in keyof S as S[Key] extends $Optional> ? Key : never]?: S[Key] extends $Optional> ? Type : never } & { [Key in keyof S as S[Key] extends $Optional> ? never : Key]: S[Key] extends Schema ? Type : never }} $ObjectToType - */ - -/** - * @template {{[key:string|symbol|number]: Schema}} S - * @extends {Schema<$ObjectToType>} - */ -export class $Object extends Schema { - /** - * @param {S} shape - * @param {boolean} partial - */ - constructor (shape, partial = false) { - super() - /** - * @type {S} - */ - this.shape = shape - this._isPartial = partial - } - - static _dilutes = true - - /** - * @type {Schema>>} - */ - get partial () { - return new $Object(this.shape, true) - } - - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is $ObjectToType} - */ - check (o, err) { - if (o == null) { - /* c8 ignore next */ - err?.extend(null, 'object', 'null') - return false - } - return obj.every(this.shape, (vv, vk) => { - const c = (this._isPartial && !obj.hasProperty(o, vk)) || vv.check(o[vk], err) - !c && err?.extend(vk.toString(), vv.toString(), typeof o[vk], 'Object property does not match') - return c - }) - } -} - -/** - * @template S - * @typedef {Schema<{ [Key in keyof S as S[Key] extends $Optional> ? Key : never]?: S[Key] extends $Optional> ? Type : never } & { [Key in keyof S as S[Key] extends $Optional> ? never : Key]: S[Key] extends Schema ? Type : never }>} _ObjectDefToSchema - */ - -// I used an explicit type annotation instead of $ObjectToType, so that the user doesn't see the -// weird type definitions when inspecting type definions. -/** - * @template {{ [key:string|symbol|number]: Schema }} S - * @param {S} def - * @return {_ObjectDefToSchema extends Schema ? Schema<{ [K in keyof S]: S[K] }> : never} - */ -export const $object = def => /** @type {any} */ (new $Object(def)) -export const $$object = $constructedBy($Object) -/** - * @type {Schema<{[key:string]: any}>} - */ -export const $objectAny = $custom(o => o != null && (o.constructor === Object || o.constructor == null)) - -/** - * @template {Schema} Keys - * @template {Schema} Values - * @extends {Schema<{ [key in Unwrap]: Unwrap }>} - */ -export class $Record extends Schema { - /** - * @param {Keys} keys - * @param {Values} values - */ - constructor (keys, values) { - super() - this.shape = { - keys, values - } - } - - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is { [key in Unwrap]: Unwrap }} - */ - check (o, err) { - return o != null && obj.every(o, (vv, vk) => { - const ck = this.shape.keys.check(vk, err) - /* c8 ignore next */ - !ck && err?.extend(vk + '', 'Record', typeof o, ck ? 'Key doesn\'t match schema' : 'Value doesn\'t match value') - return ck && this.shape.values.check(vv, err) - }) - } -} - -/** - * @template {Schema} Keys - * @template {Schema} Values - * @param {Keys} keys - * @param {Values} values - * @return {CastToSchema<$Record>} - */ -export const $record = (keys, values) => new $Record(keys, values) -export const $$record = $constructedBy($Record) - -/** - * @template {Schema[]} S - * @extends {Schema<{ [Key in keyof S]: S[Key] extends Schema ? Type : never }>} - */ -export class $Tuple extends Schema { - /** - * @param {S} shape - */ - constructor (shape) { - super() - this.shape = shape - } - - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is { [K in keyof S]: S[K] extends Schema ? Type : never }} - */ - check (o, err) { - return o != null && obj.every(this.shape, (vv, vk) => { - const c = /** @type {Schema} */ (vv).check(o[vk], err) - /* c8 ignore next */ - !c && err?.extend(vk.toString(), 'Tuple', typeof vv) - return c - }) - } -} - -/** - * @template {Array>} T - * @param {T} def - * @return {CastToSchema<$Tuple>} - */ -export const $tuple = (...def) => new $Tuple(def) -export const $$tuple = $constructedBy($Tuple) - -/** - * @template {Schema} S - * @extends {Schema ? T : never>>} - */ -export class $Array extends Schema { - /** - * @param {Array} v - */ - constructor (v) { - super() - /** - * @type {Schema ? T : never>} - */ - this.shape = v.length === 1 ? v[0] : new $Union(v) - } - - /** - * @param {any} o - * @param {ValidationError} [err] - * @return {o is Array ? T : never>} o - */ - check (o, err) { - const c = arr.isArray(o) && arr.every(o, oi => this.shape.check(oi)) - /* c8 ignore next */ - !c && err?.extend(null, 'Array', '') - return c - } -} - -/** - * @template {Array>} T - * @param {T} def - * @return {Schema> ? S : never>>} - */ -export const $array = (...def) => new $Array(def) -export const $$array = $constructedBy($Array) -/** - * @type {Schema>} - */ -export const $arrayAny = $custom(o => arr.isArray(o)) - -/** - * @template T - * @extends {Schema} - */ -export class $InstanceOf extends Schema { - /** - * @param {new (...args:any) => T} constructor - * @param {((o:T) => boolean)|null} check - */ - constructor (constructor, check) { - super() - this.shape = constructor - this._c = check - } - - /** - * @param {any} o - * @param {ValidationError} err - * @return {o is T} - */ - check (o, err) { - const c = o instanceof this.shape && (this._c == null || this._c(o)) - /* c8 ignore next */ - !c && err?.extend(null, this.shape.name, o?.constructor.name) - return c - } -} - -/** - * @template T - * @param {new (...args:any) => T} c - * @param {((o:T) => boolean)|null} check - * @return {Schema} - */ -export const $instanceOf = (c, check = null) => new $InstanceOf(c, check) -export const $$instanceOf = $constructedBy($InstanceOf) - -export const $$schema = $instanceOf(Schema) - -/** - * @template {Schema[]} Args - * @typedef {(...args:UnwrapArray>)=>Unwrap>} _LArgsToLambdaDef - */ - -/** - * @template {Array>} Args - * @extends {Schema<_LArgsToLambdaDef>} - */ -export class $Lambda extends Schema { - /** - * @param {Args} args - */ - constructor (args) { - super() - this.len = args.length - 1 - this.args = $tuple(...args.slice(-1)) - this.res = args[this.len] - } - - /** - * @param {any} f - * @param {ValidationError} err - * @return {f is _LArgsToLambdaDef} - */ - check (f, err) { - const c = f.constructor === Function && f.length <= this.len - /* c8 ignore next */ - !c && err?.extend(null, 'function', typeof f) - return c - } -} - -/** - * @template {Schema[]} Args - * @param {Args} args - * @return {Schema<(...args:UnwrapArray>)=>Unwrap>>} - */ -export const $lambda = (...args) => new $Lambda(args.length > 0 ? args : [$void]) -export const $$lambda = $constructedBy($Lambda) - -/** - * @type {Schema} - */ -export const $function = $custom(o => typeof o === 'function') - -/** - * @template {Array>} T - * @extends {Schema>>} - */ -export class $Intersection extends Schema { - /** - * @param {T} v - */ - constructor (v) { - super() - /** - * @type {T} - */ - this.shape = v - } - - /** - * @param {any} o - * @param {ValidationError} [err] - * @return {o is Intersect>} - */ - check (o, err) { - // @ts-ignore - const c = arr.every(this.shape, check => check.check(o, err)) - /* c8 ignore next */ - !c && err?.extend(null, 'Intersectinon', typeof o) - return c - } -} - -/** - * @template {Schema[]} T - * @param {T} def - * @return {CastToSchema<$Intersection>} - */ -export const $intersect = (...def) => new $Intersection(def) -export const $$intersect = $constructedBy($Intersection, o => o.shape.length > 0) // Intersection with length=0 is considered "any" - -/** - * @template S - * @extends {Schema} - */ -export class $Union extends Schema { - static _dilutes = true - - /** - * @param {Array>} v - */ - constructor (v) { - super() - this.shape = v - } - - /** - * @param {any} o - * @param {ValidationError} [err] - * @return {o is S} - */ - check (o, err) { - const c = arr.some(this.shape, (vv) => vv.check(o, err)) - err?.extend(null, 'Union', typeof o) - return c - } -} - -/** - * @template {Array} T - * @param {T} schemas - * @return {CastToSchema<$Union>>>} - */ -export const $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)) -export const $$union = /** @type {Schema<$Union>} */ ($constructedBy($Union)) - -const _t = () => true -/** - * @type {Schema} - */ -export const $any = $custom(_t) -export const $$any = /** @type {Schema>} */ ($constructedBy($Custom, o => o.shape === _t)) - -/** - * @type {Schema} - */ -export const $bigint = $custom(o => typeof o === 'bigint') -export const $$bigint = /** @type {Schema>} */ ($custom(o => o === $bigint)) - -/** - * @type {Schema} - */ -export const $symbol = $custom(o => typeof o === 'symbol') -export const $$symbol = /** @type {Schema>} */ ($custom(o => o === $symbol)) - -/** - * @type {Schema} - */ -export const $number = $custom(o => typeof o === 'number') -export const $$number = /** @type {Schema>} */ ($custom(o => o === $number)) - -/** - * @type {Schema} - */ -export const $string = $custom(o => typeof o === 'string') -export const $$string = /** @type {Schema>} */ ($custom(o => o === $string)) - -/** - * @type {Schema} - */ -export const $boolean = $custom(o => typeof o === 'boolean') -export const $$boolean = /** @type {Schema>} */ ($custom(o => o === $boolean)) - -/** - * @type {Schema} - */ -export const $undefined = $literal(undefined) -export const $$undefined = /** @type {Schema>} */ ($constructedBy($Literal, o => o.shape.length === 1 && o.shape[0] === undefined)) - -/** - * @type {Schema} - */ -export const $void = $literal(undefined) -export const $$void = /** @type {Schema>} */ ($$undefined) - -export const $null = $literal(null) -export const $$null = /** @type {Schema>} */ ($constructedBy($Literal, o => o.shape.length === 1 && o.shape[0] === null)) - -export const $uint8Array = $constructedBy(Uint8Array) -export const $$uint8Array = /** @type {Schema>} */ ($constructedBy($ConstructedBy, o => o.shape === Uint8Array)) - -/** - * @type {Schema} - */ -export const $primitive = $union($number, $string, $null, $undefined, $bigint, $boolean, $symbol) - -/** - * @typedef {JSON[]} JSONArray - */ -/** - * @typedef {Primitive|JSONArray|{ [key:string]:JSON }} JSON - */ -/** - * @type {Schema} - */ -export const $json = (() => { - const $jsonArr = /** @type {$Array<$any>} */ ($array($any)) - const $jsonRecord = /** @type {$Record<$string,$any>} */ ($record($string, $any)) - const $json = $union($number, $string, $null, $boolean, $jsonArr, $jsonRecord) - $jsonArr.shape = $json - $jsonRecord.shape.values = $json - return $json -})() - -/** - * @template {any} IN - * @typedef {IN extends Schema ? IN - * : (IN extends string|number|boolean|null ? Schema - * : (IN extends new (...args:any[])=>any ? Schema> - * : (IN extends any[] ? Schema<{ [K in keyof IN]: Unwrap> }[number]> - * : (IN extends object ? (_ObjectDefToSchema<{[K in keyof IN]:ReadSchema}> extends Schema ? Schema<{ [K in keyof S]: S[K] }> : never) - * : never) - * ) - * ) - * ) - * } ReadSchemaOld - */ - -/** - * @template {any} IN - * @typedef {[Extract>,Extract,Extractany>,Extract,Extract|string|number|boolean|null|(new (...args:any[])=>any)|any[]>,object>] extends [infer Schemas, infer Primitives, infer Constructors, infer Arrs, infer Obj] - * ? Schema< - * (Schemas extends Schema ? S : never) - * | Primitives - * | (Constructors extends new (...args:any[])=>any ? InstanceType : never) - * | (Arrs extends any[] ? { [K in keyof Arrs]: Unwrap> }[number] : never) - * | (Obj extends object ? Unwrap<(_ObjectDefToSchema<{[K in keyof Obj]:ReadSchema}> extends Schema ? Schema<{ [K in keyof S]: S[K] }> : never)> : never)> - * : never - * } ReadSchema - */ - -/** - * @typedef {ReadSchema<{x:42}|{y:99}|Schema|[1,2,{}]>} Q - */ - -/** - * @template IN - * @param {IN} o - * @return {ReadSchema} - */ -export const $ = o => { - if ($$schema.check(o)) { - return /** @type {any} */ (o) - } else if ($objectAny.check(o)) { - /** - * @type {any} - */ - const o2 = {} - for (const k in o) { - o2[k] = $(o[k]) - } - return /** @type {any} */ ($object(o2)) - } else if ($arrayAny.check(o)) { - return /** @type {any} */ ($union(...o.map($))) - } else if ($primitive.check(o)) { - return /** @type {any} */ ($literal(o)) - } else if ($function.check(o)) { - return /** @type {any} */ ($constructedBy(/** @type {any} */ (o))) - } - /* c8 ignore next */ - error.unexpectedCase() -} - -/* c8 ignore start */ -/** - * Assert that a variable is of this specific type. - * The assertion check is only performed in non-production environments. - * - * @type {(o:any,schema:Schema) => asserts o is T} - */ -export const assert = env.production - ? () => {} - : (o, schema) => { - const err = new ValidationError() - if (!schema.check(o, err)) { - throw error.create(`Expected value to be of type ${schema.constructor.name}.\n${err.toString()}`) - } - } -/* c8 ignore end */ - -/** - * @template In - * @template Out - * @typedef {{ if: Schema, h: (o:In,state?:any)=>Out }} Pattern - */ - -/** - * @template {Pattern} P - * @template In - * @typedef {ReturnType>['h']>} PatternMatchResult - */ - -/** - * @todo move this to separate library - * @template {any} [State=undefined] - * @template {Pattern} [Patterns=never] - */ -export class PatternMatcher { - /** - * @param {Schema} [$state] - */ - constructor ($state) { - /** - * @type {Array} - */ - this.patterns = [] - this.$state = $state - } - - /** - * @template P - * @template R - * @param {P} pattern - * @param {(o:NoInfer>>,s:State)=>R} handler - * @return {PatternMatcher>,R>>} - */ - if (pattern, handler) { - // @ts-ignore - this.patterns.push({ if: $(pattern), h: handler }) - // @ts-ignore - return this - } - - /** - * @template R - * @param {(o:any,s:State)=>R} h - */ - else (h) { - return this.if($any, h) - } - - /** - * @return {State extends undefined - * ? >(o:In,state?:undefined)=>PatternMatchResult - * : >(o:In,state:State)=>PatternMatchResult} - */ - done () { - // @ts-ignore - return /** @type {any} */ (o, s) => { - for (let i = 0; i < this.patterns.length; i++) { - const p = this.patterns[i] - if (p.if.check(o)) { - // @ts-ignore - return p.h(o, s) - } - } - throw error.create('Unhandled pattern') - } - } -} - -/** - * @template [State=undefined] - * @param {State} [state] - * @return {PatternMatcher>>} - */ -export const match = state => new PatternMatcher(/** @type {any} */ (state)) - -/** - * Helper function to generate a (non-exhaustive) sample set from a gives schema. - * - * @type {(o:T,gen:prng.PRNG)=>T} - */ -const _random = /** @type {any} */ (match(/** @type {Schema} */ ($any)) - .if($$number, (_o, gen) => prng.int53(gen, number.MIN_SAFE_INTEGER, number.MAX_SAFE_INTEGER)) - .if($$string, (_o, gen) => prng.word(gen)) - .if($$boolean, (_o, gen) => prng.bool(gen)) - .if($$bigint, (_o, gen) => BigInt(prng.int53(gen, number.MIN_SAFE_INTEGER, number.MAX_SAFE_INTEGER))) - .if($$union, (o, gen) => random(gen, prng.oneOf(gen, o.shape))) - .if($$object, (o, gen) => { - /** - * @type {any} - */ - const res = {} - for (const k in o.shape) { - let prop = o.shape[k] - if ($$optional.check(prop)) { - if (prng.bool(gen)) { continue } - prop = prop.shape - } - res[k] = _random(prop, gen) - } - return res - }) - .if($$array, (o, gen) => { - const arr = [] - const n = prng.int32(gen, 0, 42) - for (let i = 0; i < n; i++) { - arr.push(random(gen, o.shape)) - } - return arr - }) - .if($$literal, (o, gen) => { - return prng.oneOf(gen, o.shape) - }) - .if($$null, (o, gen) => { - return null - }) - .if($$lambda, (o, gen) => { - const res = random(gen, o.res) - return () => res - }) - .if($$any, (o, gen) => random(gen, prng.oneOf(gen, [ - $number, $string, $null, $undefined, $bigint, $boolean, - $array($number), - $record($union('a', 'b', 'c'), $number) - ]))) - .if($$record, (o, gen) => { - /** - * @type {any} - */ - const res = {} - const keysN = prng.int53(gen, 0, 3) - for (let i = 0; i < keysN; i++) { - const key = random(gen, o.shape.keys) - const val = random(gen, o.shape.values) - res[key] = val - } - return res - }) - .done()) - -/** - * @template S - * @param {prng.PRNG} gen - * @param {S} schema - * @return {Unwrap>} - */ -export const random = (gen, schema) => /** @type {any} */ (_random($(schema), gen)) diff --git a/yjs-poll/node_modules/lib0/schema.test.d.ts b/yjs-poll/node_modules/lib0/schema.test.d.ts deleted file mode 100644 index a6d6d4d..0000000 --- a/yjs-poll/node_modules/lib0/schema.test.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -export function testSchemas(_tc: t.TestCase): void; -export function testSchemaExpect(): void; -export function testObjectSchemaOptionals(_tc: t.TestCase): void; -export function testMetaSchemas(_tc: t.TestCase): void; -export function testStringTemplate(_tc: t.TestCase): void; -export function testSchemaExtends(_tc: t.TestCase): void; -export function testSchemaErrors(_tc: t.TestCase): void; -export function testUnionMerging(_tc: t.TestCase): void; -export function testConvenienceHelper(): void; -export function testPatternMatcherBase(): void; -export function testPatternMatcherWithState(): void; -export function testPatternMatcherBenchmark(): void; -export function testRepeatRandomFromSchema(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=schema.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/schema.test.d.ts.map b/yjs-poll/node_modules/lib0/schema.test.d.ts.map deleted file mode 100644 index bc8418d..0000000 --- a/yjs-poll/node_modules/lib0/schema.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"schema.test.d.ts","sourceRoot":"","sources":["schema.test.js"],"names":[],"mappings":"AAQO,iCAFI,CAAC,CAAC,QAAQ,QAqPpB;AAEM,yCAMN;AAKM,+CAFI,CAAC,CAAC,QAAQ,QAiBpB;AAKM,qCAFI,CAAC,CAAC,QAAQ,QA0BpB;AAKM,wCAFI,CAAC,CAAC,QAAQ,QAmBpB;AAKM,uCAFI,CAAC,CAAC,QAAQ,QAUpB;AAKM,sCAFI,CAAC,CAAC,QAAQ,QASpB;AAMM,sCAFI,CAAC,CAAC,QAAQ,QAcpB;AAEM,8CAqBN;AAEM,+CAmBN;AAEM,oDAuBN;AAEM,oDA8IN;AAKM,+CAFI,CAAC,CAAC,QAAQ,QA4BpB;mBAzmBkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/set.d.ts b/yjs-poll/node_modules/lib0/set.d.ts deleted file mode 100644 index 28aff5d..0000000 --- a/yjs-poll/node_modules/lib0/set.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function create(): Set; -export function toArray(set: Set): Array; -export function first(set: Set): T | undefined; -export function from(entries: Iterable): Set; -//# sourceMappingURL=set.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/set.d.ts.map b/yjs-poll/node_modules/lib0/set.d.ts.map deleted file mode 100644 index 2553730..0000000 --- a/yjs-poll/node_modules/lib0/set.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["set.js"],"names":[],"mappings":"AAMO,mCAA8B;AAO9B,wBAJM,CAAC,OACH,GAAG,CAAC,CAAC,CAAC,GACL,KAAK,CAAC,CAAC,CAAC,CAEyB;AAOtC,sBAJM,CAAC,OACH,GAAG,CAAC,CAAC,CAAC,GACL,CAAC,GAAC,SAAS,CAE8B;AAO9C,qBAJM,CAAC,WACH,QAAQ,CAAC,CAAC,CAAC,GACV,GAAG,CAAC,CAAC,CAAC,CAE6B"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/set.js b/yjs-poll/node_modules/lib0/set.js deleted file mode 100644 index 95feb73..0000000 --- a/yjs-poll/node_modules/lib0/set.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Utility module to work with sets. - * - * @module set - */ - -export const create = () => new Set() - -/** - * @template T - * @param {Set} set - * @return {Array} - */ -export const toArray = set => Array.from(set) - -/** - * @template T - * @param {Set} set - * @return {T|undefined} - */ -export const first = set => set.values().next().value - -/** - * @template T - * @param {Iterable} entries - * @return {Set} - */ -export const from = entries => new Set(entries) diff --git a/yjs-poll/node_modules/lib0/set.test.d.ts b/yjs-poll/node_modules/lib0/set.test.d.ts deleted file mode 100644 index 075f0d1..0000000 --- a/yjs-poll/node_modules/lib0/set.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testFirst(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=set.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/set.test.d.ts.map b/yjs-poll/node_modules/lib0/set.test.d.ts.map deleted file mode 100644 index fc3f3e8..0000000 --- a/yjs-poll/node_modules/lib0/set.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"set.test.d.ts","sourceRoot":"","sources":["set.test.js"],"names":[],"mappings":"AAMO,+BAFI,CAAC,CAAC,QAAQ,QAUpB;mBAdkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/sort.d.ts b/yjs-poll/node_modules/lib0/sort.d.ts deleted file mode 100644 index d364b4a..0000000 --- a/yjs-poll/node_modules/lib0/sort.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function _insertionSort(arr: Array, lo: number, hi: number, compare: (arg0: T, arg1: T) => number): void; -export function insertionSort(arr: Array, compare: (arg0: T, arg1: T) => number): void; -export function quicksort(arr: Array, compare: (arg0: T, arg1: T) => number): void; -//# sourceMappingURL=sort.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/sort.d.ts.map b/yjs-poll/node_modules/lib0/sort.d.ts.map deleted file mode 100644 index ccf5aff..0000000 --- a/yjs-poll/node_modules/lib0/sort.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["sort.js"],"names":[],"mappings":"AAkBO,+BANM,CAAC,OACH,KAAK,CAAC,CAAC,CAAC,MACR,MAAM,MACN,MAAM,WACN,CAAS,IAAC,EAAD,CAAC,EAAC,IAAC,EAAD,CAAC,KAAE,MAAM,QAU9B;AAQM,8BALM,CAAC,OACH,KAAK,CAAC,CAAC,CAAC,WACR,CAAS,IAAC,EAAD,CAAC,EAAC,IAAC,EAAD,CAAC,KAAE,MAAM,GACnB,IAAI,CAIf;AAiDM,0BALM,CAAC,OACH,KAAK,CAAC,CAAC,CAAC,WACR,CAAS,IAAC,EAAD,CAAC,EAAC,IAAC,EAAD,CAAC,KAAE,MAAM,GACnB,IAAI,CAIf"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/sort.js b/yjs-poll/node_modules/lib0/sort.js deleted file mode 100644 index 149e318..0000000 --- a/yjs-poll/node_modules/lib0/sort.js +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Efficient sort implementations. - * - * Note: These sort implementations were created to compare different sorting algorithms in JavaScript. - * Don't use them if you don't know what you are doing. Native Array.sort is almost always a better choice. - * - * @module sort - */ - -import * as math from './math.js' - -/** - * @template T - * @param {Array} arr - * @param {number} lo - * @param {number} hi - * @param {function(T,T):number} compare - */ -export const _insertionSort = (arr, lo, hi, compare) => { - for (let i = lo + 1; i <= hi; i++) { - for (let j = i; j > 0 && compare(arr[j - 1], arr[j]) > 0; j--) { - const tmp = arr[j] - arr[j] = arr[j - 1] - arr[j - 1] = tmp - } - } -} - -/** - * @template T - * @param {Array} arr - * @param {function(T,T):number} compare - * @return {void} - */ -export const insertionSort = (arr, compare) => { - _insertionSort(arr, 0, arr.length - 1, compare) -} - -/** - * @template T - * @param {Array} arr - * @param {number} lo - * @param {number} hi - * @param {function(T,T):number} compare - */ -const _quickSort = (arr, lo, hi, compare) => { - if (hi - lo < 42) { - _insertionSort(arr, lo, hi, compare) - } else { - const pivot = arr[math.floor((lo + hi) / 2)] - let i = lo - let j = hi - while (true) { - while (compare(pivot, arr[i]) > 0) { - i++ - } - while (compare(arr[j], pivot) > 0) { - j-- - } - if (i >= j) { - break - } - // swap arr[i] with arr[j] - // and increment i and j - const arri = arr[i] - arr[i++] = arr[j] - arr[j--] = arri - } - _quickSort(arr, lo, j, compare) - _quickSort(arr, j + 1, hi, compare) - } -} - -/** - * This algorithm beats Array.prototype.sort in Chrome only with arrays with 10 million entries. - * In most cases [].sort will do just fine. Make sure to performance test your use-case before you - * integrate this algorithm. - * - * Note that Chrome's sort is now a stable algorithm (Timsort). Quicksort is not stable. - * - * @template T - * @param {Array} arr - * @param {function(T,T):number} compare - * @return {void} - */ -export const quicksort = (arr, compare) => { - _quickSort(arr, 0, arr.length - 1, compare) -} diff --git a/yjs-poll/node_modules/lib0/sort.test.d.ts b/yjs-poll/node_modules/lib0/sort.test.d.ts deleted file mode 100644 index 11344b1..0000000 --- a/yjs-poll/node_modules/lib0/sort.test.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function testSortUint8(tc: t.TestCase): void; -export function testSortUint32(tc: t.TestCase): void; -export function testSortUint16(tc: t.TestCase): void; -export function testSortObjectUint32(tc: t.TestCase): void; -export function testListVsArrayPerformance(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=sort.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/sort.test.d.ts.map b/yjs-poll/node_modules/lib0/sort.test.d.ts.map deleted file mode 100644 index c1340e4..0000000 --- a/yjs-poll/node_modules/lib0/sort.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sort.test.d.ts","sourceRoot":"","sources":["sort.test.js"],"names":[],"mappings":"AAoEO,kCAFI,CAAC,CAAC,QAAQ,QAoBpB;AAKM,mCAFI,CAAC,CAAC,QAAQ,QAoBpB;AAKM,mCAFI,CAAC,CAAC,QAAQ,QAoBpB;AAKM,yCAFI,CAAC,CAAC,QAAQ,QAoBpB;AAKM,+CAFI,CAAC,CAAC,QAAQ,QA4BpB;mBAzLkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/statistics.d.ts b/yjs-poll/node_modules/lib0/statistics.d.ts deleted file mode 100644 index 3033ab6..0000000 --- a/yjs-poll/node_modules/lib0/statistics.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function median(arr: Array): number; -export function average(arr: Array): number; -//# sourceMappingURL=statistics.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/statistics.d.ts.map b/yjs-poll/node_modules/lib0/statistics.d.ts.map deleted file mode 100644 index b1f583d..0000000 --- a/yjs-poll/node_modules/lib0/statistics.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"statistics.d.ts","sourceRoot":"","sources":["statistics.js"],"names":[],"mappings":"AAYO,4BAHI,KAAK,CAAC,MAAM,CAAC,GACZ,MAAM,CAE2K;AAMtL,6BAHI,KAAK,CAAC,MAAM,CAAC,GACZ,MAAM,CAEgD"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/statistics.js b/yjs-poll/node_modules/lib0/statistics.js deleted file mode 100644 index 64814ac..0000000 --- a/yjs-poll/node_modules/lib0/statistics.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Utility helpers for generating statistics. - * - * @module statistics - */ - -import * as math from './math.js' - -/** - * @param {Array} arr Array of values - * @return {number} Returns null if the array is empty - */ -export const median = arr => arr.length === 0 ? NaN : (arr.length % 2 === 1 ? arr[(arr.length - 1) / 2] : (arr[math.floor((arr.length - 1) / 2)] + arr[math.ceil((arr.length - 1) / 2)]) / 2) - -/** - * @param {Array} arr - * @return {number} - */ -export const average = arr => arr.reduce(math.add, 0) / arr.length diff --git a/yjs-poll/node_modules/lib0/statistics.test.d.ts b/yjs-poll/node_modules/lib0/statistics.test.d.ts deleted file mode 100644 index 22230d6..0000000 --- a/yjs-poll/node_modules/lib0/statistics.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testMedian(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=statistics.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/statistics.test.d.ts.map b/yjs-poll/node_modules/lib0/statistics.test.d.ts.map deleted file mode 100644 index c45e6bc..0000000 --- a/yjs-poll/node_modules/lib0/statistics.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"statistics.test.d.ts","sourceRoot":"","sources":["statistics.test.js"],"names":[],"mappings":"AAOO,+BAFI,CAAC,CAAC,QAAQ,QASpB;mBAbkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/storage.d.ts b/yjs-poll/node_modules/lib0/storage.d.ts deleted file mode 100644 index 6c69f2e..0000000 --- a/yjs-poll/node_modules/lib0/storage.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * This is basically localStorage in browser, or a polyfill in nodejs - */ -export const varStorage: any; -export function onChange(eventHandler: (arg0: { - key: string; - newValue: string; - oldValue: string; -}) => void): true | void; -export function offChange(eventHandler: (arg0: { - key: string; - newValue: string; - oldValue: string; -}) => void): true | void; -//# sourceMappingURL=storage.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/storage.d.ts.map b/yjs-poll/node_modules/lib0/storage.d.ts.map deleted file mode 100644 index 5a3562e..0000000 --- a/yjs-poll/node_modules/lib0/storage.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["storage.js"],"names":[],"mappings":"AAiDA;;GAEG;AAEH,6BAAuC;AAShC,uCAJI,CAAS,IAAmD,EAAnD;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,KAAG,IAAI,eAIuC;AAS9G,wCAJI,CAAS,IAAmD,EAAnD;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,KAAG,IAAI,eAI2C"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/storage.js b/yjs-poll/node_modules/lib0/storage.js deleted file mode 100644 index 1920ee4..0000000 --- a/yjs-poll/node_modules/lib0/storage.js +++ /dev/null @@ -1,72 +0,0 @@ -/* eslint-env browser */ - -/** - * Isomorphic variable storage. - * - * Uses LocalStorage in the browser and falls back to in-memory storage. - * - * @module storage - */ - -/* c8 ignore start */ -class VarStoragePolyfill { - constructor () { - this.map = new Map() - } - - /** - * @param {string} key - * @param {any} newValue - */ - setItem (key, newValue) { - this.map.set(key, newValue) - } - - /** - * @param {string} key - */ - getItem (key) { - return this.map.get(key) - } -} -/* c8 ignore stop */ - -/** - * @type {any} - */ -let _localStorage = new VarStoragePolyfill() -let usePolyfill = true - -/* c8 ignore start */ -try { - // if the same-origin rule is violated, accessing localStorage might thrown an error - if (typeof localStorage !== 'undefined' && localStorage) { - _localStorage = localStorage - usePolyfill = false - } -} catch (e) { } -/* c8 ignore stop */ - -/** - * This is basically localStorage in browser, or a polyfill in nodejs - */ -/* c8 ignore next */ -export const varStorage = _localStorage - -/** - * A polyfill for `addEventListener('storage', event => {..})` that does nothing if the polyfill is being used. - * - * @param {function({ key: string, newValue: string, oldValue: string }): void} eventHandler - * @function - */ -/* c8 ignore next */ -export const onChange = eventHandler => usePolyfill || addEventListener('storage', /** @type {any} */ (eventHandler)) - -/** - * A polyfill for `removeEventListener('storage', event => {..})` that does nothing if the polyfill is being used. - * - * @param {function({ key: string, newValue: string, oldValue: string }): void} eventHandler - * @function - */ -/* c8 ignore next */ -export const offChange = eventHandler => usePolyfill || removeEventListener('storage', /** @type {any} */ (eventHandler)) diff --git a/yjs-poll/node_modules/lib0/storage.test.d.ts b/yjs-poll/node_modules/lib0/storage.test.d.ts deleted file mode 100644 index d87bfa9..0000000 --- a/yjs-poll/node_modules/lib0/storage.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testStorageModule(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=storage.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/storage.test.d.ts.map b/yjs-poll/node_modules/lib0/storage.test.d.ts.map deleted file mode 100644 index baffb8a..0000000 --- a/yjs-poll/node_modules/lib0/storage.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"storage.test.d.ts","sourceRoot":"","sources":["storage.test.js"],"names":[],"mappings":"AAMO,sCAFI,CAAC,CAAC,QAAQ,QAapB;mBAhBkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/string.d.ts b/yjs-poll/node_modules/lib0/string.d.ts deleted file mode 100644 index caa0bba..0000000 --- a/yjs-poll/node_modules/lib0/string.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Utility module to work with strings. - * - * @module string - */ -export const fromCharCode: (...codes: number[]) => string; -export const fromCodePoint: (...codePoints: number[]) => string; -/** - * The largest utf16 character. - * Corresponds to Uint8Array([255, 255]) or charcodeof(2x2^8) - */ -export const MAX_UTF16_CHARACTER: string; -export function trimLeft(s: string): string; -export function fromCamelCase(s: string, separator: string): string; -export function utf8ByteLength(str: string): number; -export function _encodeUtf8Polyfill(str: string): Uint8Array; -export const utf8TextEncoder: TextEncoder; -export function _encodeUtf8Native(str: string): Uint8Array; -export function encodeUtf8(str: string): Uint8Array; -export function _decodeUtf8Polyfill(buf: Uint8Array): string; -export let utf8TextDecoder: TextDecoder | null; -export function _decodeUtf8Native(buf: Uint8Array): string; -export function decodeUtf8(buf: Uint8Array): string; -export function splice(str: string, index: number, remove: number, insert?: string): string; -export function repeat(source: string, n: number): string; -export function escapeHTML(str: string): string; -export function unescapeHTML(str: string): string; -//# sourceMappingURL=string.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/string.d.ts.map b/yjs-poll/node_modules/lib0/string.d.ts.map deleted file mode 100644 index 106be33..0000000 --- a/yjs-poll/node_modules/lib0/string.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["string.js"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,0DAA+C;AAC/C,gEAAiD;AAEjD;;;GAGG;AACH,yCAAsD;AAc/C,4BAHI,MAAM,GACL,MAAM,CAEuC;AASlD,iCAJI,MAAM,aACN,MAAM,GACL,MAAM,CAEkH;AAO7H,oCAHI,MAAM,GACL,MAAM,CAE2D;AAMtE,yCAHI,MAAM,GACL,UAAU,CAAC,WAAW,CAAC,CAUlC;AAGD,8BAA0C,WAAW,CAAoE;AAMlH,uCAHI,MAAM,GACL,UAAU,CAAC,WAAW,CAAC,CAEgC;AAjB5D,gCAHI,MAAM,GACL,UAAU,CAAC,WAAW,CAAC,CAUlC;AAsBM,yCAHI,UAAU,GACT,MAAM,CAejB;AAGD,+CAAmI;AAkB5H,uCAHI,UAAU,GACT,MAAM,CAE8E;AAlCzF,gCAHI,UAAU,GACT,MAAM,CAejB;AAoCM,4BALI,MAAM,SACN,MAAM,UACN,MAAM,WACN,MAAM,UAEkG;AAM5G,+BAHI,MAAM,KACN,MAAM,UAE0D;AAOpE,gCAFI,MAAM,UAST;AAOD,kCAFI,MAAM,UAST"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/string.js b/yjs-poll/node_modules/lib0/string.js deleted file mode 100644 index 22100e5..0000000 --- a/yjs-poll/node_modules/lib0/string.js +++ /dev/null @@ -1,165 +0,0 @@ -import * as array from './array.js' - -/** - * Utility module to work with strings. - * - * @module string - */ - -export const fromCharCode = String.fromCharCode -export const fromCodePoint = String.fromCodePoint - -/** - * The largest utf16 character. - * Corresponds to Uint8Array([255, 255]) or charcodeof(2x2^8) - */ -export const MAX_UTF16_CHARACTER = fromCharCode(65535) - -/** - * @param {string} s - * @return {string} - */ -const toLowerCase = s => s.toLowerCase() - -const trimLeftRegex = /^\s*/g - -/** - * @param {string} s - * @return {string} - */ -export const trimLeft = s => s.replace(trimLeftRegex, '') - -const fromCamelCaseRegex = /([A-Z])/g - -/** - * @param {string} s - * @param {string} separator - * @return {string} - */ -export const fromCamelCase = (s, separator) => trimLeft(s.replace(fromCamelCaseRegex, match => `${separator}${toLowerCase(match)}`)) - -/** - * Compute the utf8ByteLength - * @param {string} str - * @return {number} - */ -export const utf8ByteLength = str => unescape(encodeURIComponent(str)).length - -/** - * @param {string} str - * @return {Uint8Array} - */ -export const _encodeUtf8Polyfill = str => { - const encodedString = unescape(encodeURIComponent(str)) - const len = encodedString.length - const buf = new Uint8Array(len) - for (let i = 0; i < len; i++) { - buf[i] = /** @type {number} */ (encodedString.codePointAt(i)) - } - return buf -} - -/* c8 ignore next */ -export const utf8TextEncoder = /** @type {TextEncoder} */ (typeof TextEncoder !== 'undefined' ? new TextEncoder() : null) - -/** - * @param {string} str - * @return {Uint8Array} - */ -export const _encodeUtf8Native = str => utf8TextEncoder.encode(str) - -/** - * @param {string} str - * @return {Uint8Array} - */ -/* c8 ignore next */ -export const encodeUtf8 = utf8TextEncoder ? _encodeUtf8Native : _encodeUtf8Polyfill - -/** - * @param {Uint8Array} buf - * @return {string} - */ -export const _decodeUtf8Polyfill = buf => { - let remainingLen = buf.length - let encodedString = '' - let bufPos = 0 - while (remainingLen > 0) { - const nextLen = remainingLen < 10000 ? remainingLen : 10000 - const bytes = buf.subarray(bufPos, bufPos + nextLen) - bufPos += nextLen - // Starting with ES5.1 we can supply a generic array-like object as arguments - encodedString += String.fromCodePoint.apply(null, /** @type {any} */ (bytes)) - remainingLen -= nextLen - } - return decodeURIComponent(escape(encodedString)) -} - -/* c8 ignore next */ -export let utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }) - -/* c8 ignore start */ -if (utf8TextDecoder && utf8TextDecoder.decode(new Uint8Array()).length === 1) { - // Safari doesn't handle BOM correctly. - // This fixes a bug in Safari 13.0.5 where it produces a BOM the first time it is called. - // utf8TextDecoder.decode(new Uint8Array()).length === 1 on the first call and - // utf8TextDecoder.decode(new Uint8Array()).length === 1 on the second call - // Another issue is that from then on no BOM chars are recognized anymore - /* c8 ignore next */ - utf8TextDecoder = null -} -/* c8 ignore stop */ - -/** - * @param {Uint8Array} buf - * @return {string} - */ -export const _decodeUtf8Native = buf => /** @type {TextDecoder} */ (utf8TextDecoder).decode(buf) - -/** - * @param {Uint8Array} buf - * @return {string} - */ -/* c8 ignore next */ -export const decodeUtf8 = utf8TextDecoder ? _decodeUtf8Native : _decodeUtf8Polyfill - -/** - * @param {string} str The initial string - * @param {number} index Starting position - * @param {number} remove Number of characters to remove - * @param {string} insert New content to insert - */ -export const splice = (str, index, remove, insert = '') => str.slice(0, index) + insert + str.slice(index + remove) - -/** - * @param {string} source - * @param {number} n - */ -export const repeat = (source, n) => array.unfold(n, () => source).join('') - -/** - * Escape HTML characters &,<,>,'," to their respective HTML entities &,<,>,'," - * - * @param {string} str - */ -export const escapeHTML = str => - str.replace(/[&<>'"]/g, r => /** @type {string} */ ({ - '&': '&', - '<': '<', - '>': '>', - "'": ''', - '"': '"' - }[r])) - -/** - * Reverse of `escapeHTML` - * - * @param {string} str - */ -export const unescapeHTML = str => - str.replace(/&|<|>|'|"/g, r => /** @type {string} */ ({ - '&': '&', - '<': '<', - '>': '>', - ''': "'", - '"': '"' - }[r])) diff --git a/yjs-poll/node_modules/lib0/string.test.d.ts b/yjs-poll/node_modules/lib0/string.test.d.ts deleted file mode 100644 index 73972bd..0000000 --- a/yjs-poll/node_modules/lib0/string.test.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export function testUtilities(_tc: t.TestCase): void; -export function testLowercaseTransformation(_tc: t.TestCase): void; -export function testRepeatStringUtf8Encoding(tc: t.TestCase): void; -export function testRepeatStringUtf8Decoding(tc: t.TestCase): void; -export function testBomEncodingDecoding(_tc: t.TestCase): void; -export function testSplice(_tc: t.TestCase): void; -export function testHtmlEscape(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=string.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/string.test.d.ts.map b/yjs-poll/node_modules/lib0/string.test.d.ts.map deleted file mode 100644 index ad1986e..0000000 --- a/yjs-poll/node_modules/lib0/string.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"string.test.d.ts","sourceRoot":"","sources":["string.test.js"],"names":[],"mappings":"AAOO,mCAFI,CAAC,CAAC,QAAQ,QAMpB;AAKM,iDAFI,CAAC,CAAC,QAAQ,QAOpB;AAKM,iDAFI,CAAC,CAAC,QAAQ,QAapB;AAKM,iDAFI,CAAC,CAAC,QAAQ,QAapB;AAKM,6CAFI,CAAC,CAAC,QAAQ,QAYpB;AAKM,gCAFI,CAAC,CAAC,QAAQ,QAMpB;AAKM,oCAFI,CAAC,CAAC,QAAQ,QAYpB;mBA1FkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/symbol.d.ts b/yjs-poll/node_modules/lib0/symbol.d.ts deleted file mode 100644 index 3fce473..0000000 --- a/yjs-poll/node_modules/lib0/symbol.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Utility module to work with EcmaScript Symbols. - * - * @module symbol - */ -/** - * Return fresh symbol. - */ -export const create: SymbolConstructor; -export function isSymbol(s: any): boolean; -//# sourceMappingURL=symbol.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/symbol.d.ts.map b/yjs-poll/node_modules/lib0/symbol.d.ts.map deleted file mode 100644 index 8b7d9c1..0000000 --- a/yjs-poll/node_modules/lib0/symbol.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"symbol.d.ts","sourceRoot":"","sources":["symbol.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,uCAA4B;AAMrB,4BAHI,GAAG,GACF,OAAO,CAE+B"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/symbol.js b/yjs-poll/node_modules/lib0/symbol.js deleted file mode 100644 index 31d2ebe..0000000 --- a/yjs-poll/node_modules/lib0/symbol.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Utility module to work with EcmaScript Symbols. - * - * @module symbol - */ - -/** - * Return fresh symbol. - */ -export const create = Symbol - -/** - * @param {any} s - * @return {boolean} - */ -export const isSymbol = s => typeof s === 'symbol' diff --git a/yjs-poll/node_modules/lib0/symbol.test.d.ts b/yjs-poll/node_modules/lib0/symbol.test.d.ts deleted file mode 100644 index 3a29f01..0000000 --- a/yjs-poll/node_modules/lib0/symbol.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testBasicSymbolFeatures(_tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=symbol.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/symbol.test.d.ts.map b/yjs-poll/node_modules/lib0/symbol.test.d.ts.map deleted file mode 100644 index d8ebae5..0000000 --- a/yjs-poll/node_modules/lib0/symbol.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"symbol.test.d.ts","sourceRoot":"","sources":["symbol.test.js"],"names":[],"mappings":"AAMO,6CAFI,CAAC,CAAC,QAAQ,QAQpB;mBAZkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/test.d.ts b/yjs-poll/node_modules/lib0/test.d.ts deleted file mode 100644 index 9bcc471..0000000 --- a/yjs-poll/node_modules/lib0/test.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/test.d.ts.map b/yjs-poll/node_modules/lib0/test.d.ts.map deleted file mode 100644 index 5019b82..0000000 --- a/yjs-poll/node_modules/lib0/test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["test.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/test.html b/yjs-poll/node_modules/lib0/test.html deleted file mode 100644 index cd65bfc..0000000 --- a/yjs-poll/node_modules/lib0/test.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - - Testing lib0 - - - - - - - diff --git a/yjs-poll/node_modules/lib0/test.js b/yjs-poll/node_modules/lib0/test.js deleted file mode 100644 index 6484735..0000000 --- a/yjs-poll/node_modules/lib0/test.js +++ /dev/null @@ -1,104 +0,0 @@ -import { runTests } from './testing.js' -import * as array from './array.test.js' -import * as broadcastchannel from './broadcastchannel.test.js' -import * as crypto from './crypto.test.js' -import * as rabin from './hash/rabin.test.js' -import * as sha256 from './hash/sha256.test.js' -import * as logging from './logging.test.js' -import * as string from './string.test.js' -import * as encoding from './encoding.test.js' -import * as diff from './diff.test.js' -import * as patienceDiff from './diff/patience.test.js' -import * as testing from './testing.test.js' -import * as indexeddb from './indexeddb.test.js' -import * as indexeddbV2 from './indexeddbV2.test.js' -import * as prng from './prng.test.js' -import * as log from 'lib0/logging' -import * as statistics from './statistics.test.js' -import * as binary from './binary.test.js' -import * as random from './random.test.js' -import * as promise from './promise.test.js' -import * as queue from './queue.test.js' -import * as map from './map.test.js' -import * as eventloop from './eventloop.test.js' -import * as time from './time.test.js' -import * as pair from './pair.test.js' -import * as object from './object.test.js' -import * as observable from './observable.test.js' -import * as pledge from './pledge.test.js' -import * as math from './math.test.js' -import * as number from './number.test.js' -import * as buffer from './buffer.test.js' -import * as set from './set.test.js' -import * as sort from './sort.test.js' -import * as url from './url.test.js' -import * as metric from './metric.test.js' -import * as func from './function.test.js' -import * as storage from './storage.test.js' -import * as list from './list.test.js' -import * as cache from './cache.test.js' -import * as symbol from './symbol.test.js' -import * as traits from './trait/traits.test.js' -import * as schema from './schema.test.js' -import * as delta from './delta/delta.test.js' -import * as deltaPitch from './delta/delta-pitch.test.js' -// import * as deltaBinding from './delta/binding.test.js' -import * as mutex from './mutex.test.js' -import { isBrowser, isNode } from './environment.js' - -/* c8 ignore next */ -if (isBrowser) { - log.createVConsole(document.body) -} - -runTests({ - array, - broadcastchannel, - crypto, - rabin, - sha256, - logging, - string, - encoding, - diff, - patienceDiff, - testing, - indexeddb, - indexeddbV2, - prng, - statistics, - binary, - random, - promise, - queue, - map, - eventloop, - time, - pair, - object, - observable, - pledge, - math, - number, - buffer, - set, - sort, - url, - metric, - func, - storage, - list, - cache, - symbol, - traits, - schema, - delta, - deltaPitch, - // deltaBinding, - mutex -}).then(success => { - /* c8 ignore next */ - if (isNode) { - process.exit(success ? 0 : 1) - } -}) diff --git a/yjs-poll/node_modules/lib0/testing.d.ts b/yjs-poll/node_modules/lib0/testing.d.ts deleted file mode 100644 index 2ab045a..0000000 --- a/yjs-poll/node_modules/lib0/testing.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -export { production } from "./environment.js"; -export const extensive: boolean; -export const envSeed: number | null; -export class TestCase { - /** - * @param {string} moduleName - * @param {string} testName - */ - constructor(moduleName: string, testName: string); - /** - * @type {string} - */ - moduleName: string; - /** - * @type {string} - */ - testName: string; - /** - * This type can store custom information related to the TestCase - * - * @type {Map} - */ - meta: Map; - _seed: number | null; - _prng: prng.PRNG | null; - resetSeed(): void; - /** - * @type {number} - */ - get seed(): number; - /** - * A PRNG for this test case. Use only this PRNG for randomness to make the test case reproducible. - * - * @type {prng.PRNG} - */ - get prng(): prng.PRNG; -} -export const repetitionTime: number; -export function run(moduleName: string, name: string, f: (arg0: TestCase) => void | Promise, i: number, numberOfTests: number): Promise; -export function describe(description: string, info?: string): void; -export function info(info: string): void; -export const printDom: (_createNode: () => Node) => void; -export const printCanvas: (canvas: HTMLCanvasElement, height: number) => void; -export function group(description: string, f: (...args: any[]) => void): void; -export function groupAsync(description: string, f: (...args: any[]) => Promise): Promise; -export function measureTime(message: string, f: (...args: any[]) => void): number; -export function measureTimeAsync(message: string, f: (...args: any[]) => Promise): Promise; -export function compareArrays(as: Array, bs: Array, m?: string): boolean; -export function compareStrings(a: string, b: string, m?: string): void; -export function compareObjects(a: any, b: any, m?: string): void; -export function compare(a: T, b: T, message?: string | null, customCompare?: (arg0: any, arg1: T, arg2: T, arg3: string, arg4: any) => boolean): boolean; -export function assert(property: T, message?: string | null): asserts property is NonNullable; -export function promiseRejected(f: (...args: any[]) => Promise): Promise; -export function fails(f: (...args: any[]) => void): void; -export function failsAsync(f: (...args: any[]) => Promise): Promise; -export function runTests(tests: { - [x: string]: { - [x: string]: (arg0: TestCase) => void | Promise; - }; -}): Promise; -export function fail(reason: string): never; -export function skip(cond?: boolean): void; -import * as prng from './prng.js'; -//# sourceMappingURL=testing.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/testing.d.ts.map b/yjs-poll/node_modules/lib0/testing.d.ts.map deleted file mode 100644 index a492e9d..0000000 --- a/yjs-poll/node_modules/lib0/testing.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["testing.js"],"names":[],"mappings":";AA8DA,gCAAiD;AAGjD,oCAAmG;AAEnG;IACE;;;OAGG;IACH,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,IAAC,EAAD,CAAC,EAAC,IAAC,EAAD,CAAC,EAAC,IAAM,EAAN,MAAM,EAAC,IAAG,EAAH,GAAG,KAAE,OAAO,WAE8E;AAUtH,uBAPM,CAAC,YACH,CAAC,YACD,MAAM,OAAC,GACN,QAAQ,QAAQ,IAAI,WAAW,CAAC,CAAC,CAAC,CAIuF;AAK9H,mCAFI,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,OAAO,CAAC,GAAG,CAAC,iBASvC;AAMM,yBAHI,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,IAAI,QAW/B;AAMM,8BAHI,IAAS,IAAM,EAAH,GAAG,EAAA,KAAE,OAAO,CAAC,GAAG,CAAC,iBAWvC;AAKM;;4BAF2C,QAAQ,KAAE,IAAI,GAAC,OAAO,CAAC,GAAG,CAAC;;qBA2C5E;AAQM,6BAHI,MAAM,SAMhB;AAQM,4BAHI,OAAO,QAOjB;sBA/kBqB,WAAW"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/testing.js b/yjs-poll/node_modules/lib0/testing.js deleted file mode 100644 index 893193c..0000000 --- a/yjs-poll/node_modules/lib0/testing.js +++ /dev/null @@ -1,646 +0,0 @@ -/** - * Testing framework with support for generating tests. - * - * ```js - * // test.js template for creating a test executable - * import { runTests } from 'lib0/testing' - * import * as log from 'lib0/logging' - * import * as mod1 from './mod1.test.js' - * import * as mod2 from './mod2.test.js' - - * import { isBrowser, isNode } from 'lib0/environment.js' - * - * if (isBrowser) { - * // optional: if this is ran in the browser, attach a virtual console to the dom - * log.createVConsole(document.body) - * } - * - * runTests({ - * mod1, - * mod2, - * }).then(success => { - * if (isNode) { - * process.exit(success ? 0 : 1) - * } - * }) - * ``` - * - * ```js - * // mod1.test.js - * /** - * * runTests automatically tests all exported functions that start with "test". - * * The name of the function should be in camelCase and is used for the logging output. - * * - * * @ param {t.TestCase} tc - * *\/ - * export const testMyFirstTest = tc => { - * t.compare({ a: 4 }, { a: 4 }, 'objects are equal') - * } - * ``` - * - * Now you can simply run `node test.js` to run your test or run test.js in the browser. - * - * @module testing - */ - -import * as log from 'lib0/logging' -import { simpleDiffString } from './diff.js' -import * as object from './object.js' -import * as string from './string.js' -import * as math from './math.js' -import * as random from './random.js' -import * as prng from './prng.js' -import * as statistics from './statistics.js' -import * as array from './array.js' -import * as env from './environment.js' -import * as json from './json.js' -import * as time from './time.js' -import * as promise from './promise.js' -import * as performance from 'lib0/performance' -import * as equalityTrait from './trait/equality.js' - -export { production } from './environment.js' -export const extensive = env.hasConf('extensive') - -/* c8 ignore next */ -export const envSeed = env.hasParam('--seed') ? Number.parseInt(env.getParam('--seed', '0')) : null - -export class TestCase { - /** - * @param {string} moduleName - * @param {string} testName - */ - constructor (moduleName, testName) { - /** - * @type {string} - */ - this.moduleName = moduleName - /** - * @type {string} - */ - this.testName = testName - /** - * This type can store custom information related to the TestCase - * - * @type {Map} - */ - this.meta = new Map() - this._seed = null - this._prng = null - } - - resetSeed () { - this._seed = null - this._prng = null - } - - /** - * @type {number} - */ - /* c8 ignore next */ - get seed () { - /* c8 ignore else */ - if (this._seed === null) { - /* c8 ignore next */ - this._seed = envSeed === null ? random.uint32() : envSeed - } - return this._seed - } - - /** - * A PRNG for this test case. Use only this PRNG for randomness to make the test case reproducible. - * - * @type {prng.PRNG} - */ - get prng () { - /* c8 ignore else */ - if (this._prng === null) { - this._prng = prng.create(this.seed) - } - return this._prng - } -} - -export const repetitionTime = Number(env.getParam('--repetition-time', '50')) -/* c8 ignore next */ -const testFilter = env.hasParam('--filter') ? env.getParam('--filter', '') : null - -/* c8 ignore next */ -const testFilterRegExp = testFilter !== null ? new RegExp(testFilter) : /.*/ - -const repeatTestRegex = /^(repeat|repeating)\s/ - -/** - * @param {string} moduleName - * @param {string} name - * @param {function(TestCase):void|Promise} f - * @param {number} i - * @param {number} numberOfTests - */ -export const run = async (moduleName, name, f, i, numberOfTests) => { - const uncamelized = string.fromCamelCase(name.slice(4), ' ') - const filtered = !testFilterRegExp.test(`[${i + 1}/${numberOfTests}] ${moduleName}: ${uncamelized}`) - /* c8 ignore next 3 */ - if (filtered) { - return true - } - const tc = new TestCase(moduleName, name) - const repeat = repeatTestRegex.test(uncamelized) - const groupArgs = [log.GREY, `[${i + 1}/${numberOfTests}] `, log.PURPLE, `${moduleName}: `, log.BLUE, uncamelized] - /* c8 ignore next 5 */ - if (testFilter === null) { - log.groupCollapsed(...groupArgs) - } else { - log.group(...groupArgs) - } - const times = [] - const start = performance.now() - let lastTime = start - /** - * @type {any} - */ - let err = null - performance.mark(`${name}-start`) - do { - try { - const p = f(tc) - if (promise.isPromise(p)) { - await p - } - } catch (_err) { - err = _err - } - const currTime = performance.now() - times.push(currTime - lastTime) - lastTime = currTime - if (repeat && err === null && (lastTime - start) < repetitionTime) { - tc.resetSeed() - } else { - break - } - } while (err === null && (lastTime - start) < repetitionTime) - performance.mark(`${name}-end`) - /* c8 ignore next 3 */ - if (err !== null && err.constructor !== SkipError) { - log.printError(err) - } - performance.measure(name, `${name}-start`, `${name}-end`) - log.groupEnd() - const duration = lastTime - start - let success = true - times.sort((a, b) => a - b) - /* c8 ignore next 3 */ - const againMessage = env.isBrowser - ? ` - ${window.location.host + window.location.pathname}?filter=\\[${i + 1}/${tc._seed === null ? '' : `&seed=${tc._seed}`}` - : `\nrepeat: npm run test -- --filter "\\[${i + 1}/" ${tc._seed === null ? '' : `--seed ${tc._seed}`}` - const timeInfo = (repeat && err === null) - ? ` - ${times.length} repetitions in ${time.humanizeDuration(duration)} (best: ${time.humanizeDuration(times[0])}, worst: ${time.humanizeDuration(array.last(times))}, median: ${time.humanizeDuration(statistics.median(times))}, average: ${time.humanizeDuration(statistics.average(times))})` - : ` in ${time.humanizeDuration(duration)}` - if (err !== null) { - /* c8 ignore start */ - if (err.constructor === SkipError) { - log.print(log.GREY, log.BOLD, 'Skipped: ', log.UNBOLD, uncamelized) - } else { - success = false - log.print(log.RED, log.BOLD, 'Failure: ', log.UNBOLD, log.UNCOLOR, uncamelized, log.GREY, timeInfo, againMessage) - } - /* c8 ignore stop */ - } else { - log.print(log.GREEN, log.BOLD, 'Success: ', log.UNBOLD, log.UNCOLOR, uncamelized, log.GREY, timeInfo, againMessage) - } - return success -} - -/** - * Describe what you are currently testing. The message will be logged. - * - * ```js - * export const testMyFirstTest = tc => { - * t.describe('crunching numbers', 'already crunched 4 numbers!') // the optional second argument can describe the state. - * } - * ``` - * - * @param {string} description - * @param {string} info - */ -export const describe = (description, info = '') => log.print(log.BLUE, description, ' ', log.GREY, info) - -/** - * Describe the state of the current computation. - * ```js - * export const testMyFirstTest = tc => { - * t.info(already crunched 4 numbers!') // the optional second argument can describe the state. - * } - * ``` - * - * @param {string} info - */ -export const info = info => describe('', info) - -export const printDom = log.printDom - -export const printCanvas = log.printCanvas - -/** - * Group outputs in a collapsible category. - * - * ```js - * export const testMyFirstTest = tc => { - * t.group('subtest 1', () => { - * t.describe('this message is part of a collapsible section') - * }) - * await t.groupAsync('subtest async 2', async () => { - * await someaction() - * t.describe('this message is part of a collapsible section') - * }) - * } - * ``` - * - * @param {string} description - * @param {function(...any):void} f - */ -export const group = (description, f) => { - log.group(log.BLUE, description) - try { - f() - } finally { - log.groupEnd() - } -} - -/** - * Group outputs in a collapsible category. - * - * ```js - * export const testMyFirstTest = async tc => { - * t.group('subtest 1', () => { - * t.describe('this message is part of a collapsible section') - * }) - * await t.groupAsync('subtest async 2', async () => { - * await someaction() - * t.describe('this message is part of a collapsible section') - * }) - * } - * ``` - * - * @param {string} description - * @param {function(...any):Promise} f - */ -export const groupAsync = async (description, f) => { - log.group(log.BLUE, description) - try { - await f() - } finally { - log.groupEnd() - } -} - -/** - * Measure the time that it takes to calculate something. - * - * ```js - * export const testMyFirstTest = async tc => { - * t.measureTime('measurement', () => { - * heavyCalculation() - * }) - * await t.groupAsync('async measurement', async () => { - * await heavyAsyncCalculation() - * }) - * } - * ``` - * - * @param {string} message - * @param {function(...any):void} f - * @return {number} Returns a promise that resolves the measured duration to apply f - */ -export const measureTime = (message, f) => { - let duration - const start = performance.now() - try { - f() - } finally { - duration = performance.now() - start - log.print(log.PURPLE, message, log.GREY, ` ${time.humanizeDuration(duration)}`) - } - return duration -} - -/** - * Measure the time that it takes to calculate something. - * - * ```js - * export const testMyFirstTest = async tc => { - * t.measureTimeAsync('measurement', async () => { - * await heavyCalculation() - * }) - * await t.groupAsync('async measurement', async () => { - * await heavyAsyncCalculation() - * }) - * } - * ``` - * - * @param {string} message - * @param {function(...any):Promise} f - * @return {Promise} Returns a promise that resolves the measured duration to apply f - */ -export const measureTimeAsync = async (message, f) => { - let duration - const start = performance.now() - try { - await f() - } finally { - duration = performance.now() - start - log.print(log.PURPLE, message, log.GREY, ` ${time.humanizeDuration(duration)}`) - } - return duration -} - -/** - * @template T - * @param {Array} as - * @param {Array} bs - * @param {string} [m] - * @return {boolean} - */ -export const compareArrays = (as, bs, m = 'Arrays match') => { - if (as.length !== bs.length) { - fail(m) - } - for (let i = 0; i < as.length; i++) { - if (as[i] !== bs[i]) { - fail(m) - } - } - return true -} - -/** - * @param {string} a - * @param {string} b - * @param {string} [m] - * @throws {TestError} Throws if tests fails - */ -export const compareStrings = (a, b, m = 'Strings match') => { - if (a !== b) { - const diff = simpleDiffString(a, b) - log.print(log.GREY, a.slice(0, diff.index), log.RED, a.slice(diff.index, diff.remove), log.GREEN, diff.insert, log.GREY, a.slice(diff.index + diff.remove)) - fail(m) - } -} - -/** - * @template K,V - * @param {Object} a - * @param {Object} b - * @param {string} [m] - * @throws {TestError} Throws if test fails - */ -export const compareObjects = (a, b, m = 'Objects match') => { object.equalFlat(a, b) || fail(m) } - -/** - * @param {any} _constructor - * @param {any} a - * @param {any} b - * @param {string} path - * @throws {TestError} - */ -const compareValues = (_constructor, a, b, path) => { - if (a !== b) { - fail(`Values ${json.stringify(a)} and ${json.stringify(b)} don't match (${path})`) - } - return true -} - -/** - * @param {string?} message - * @param {string} reason - * @param {string} path - * @throws {TestError} - */ -const _failMessage = (message, reason, path) => fail( - message === null - ? `${reason} ${path}` - : `${message} (${reason}) ${path}` -) - -/** - * @param {any} a - * @param {any} b - * @param {string} path - * @param {string?} message - * @param {function(any,any,any,string,any):boolean} customCompare - */ -const _compare = (a, b, path, message, customCompare) => { - // we don't use assert here because we want to test all branches (istanbul errors if one branch is not tested) - if (a == null || b == null) { - return compareValues(null, a, b, path) - } - if (a[equalityTrait.EqualityTraitSymbol] != null) { - if (a[equalityTrait.EqualityTraitSymbol](b)) { - return true - } else { - _failMessage(message, 'Not equal by equality trait', path) - } - } - if (a.constructor !== b.constructor) { - _failMessage(message, 'Constructors don\'t match', path) - } - let success = true - switch (a.constructor) { - case ArrayBuffer: - a = new Uint8Array(a) - b = new Uint8Array(b) - // eslint-disable-next-line no-fallthrough - case Uint8Array: { - if (a.byteLength !== b.byteLength) { - _failMessage(message, 'ArrayBuffer lengths match', path) - } - for (let i = 0; success && i < a.length; i++) { - success = success && a[i] === b[i] - } - break - } - case Set: { - if (a.size !== b.size) { - _failMessage(message, 'Sets have different number of attributes', path) - } - // @ts-ignore - a.forEach(value => { - if (!b.has(value)) { - _failMessage(message, `b.${path} does have ${value}`, path) - } - }) - break - } - case Map: { - if (a.size !== b.size) { - _failMessage(message, 'Maps have different number of attributes', path) - } - // @ts-ignore - a.forEach((value, key) => { - if (!b.has(key)) { - _failMessage(message, `Property ${path}["${key}"] does not exist on second argument`, path) - } - _compare(value, b.get(key), `${path}["${key}"]`, message, customCompare) - }) - break - } - case undefined: // undefined is often set as a constructor for objects - case Object: - if (object.length(a) !== object.length(b)) { - _failMessage(message, 'Objects have a different number of attributes', path) - } - object.forEach(a, (value, key) => { - if (!object.hasProperty(b, key)) { - _failMessage(message, `Property ${path} does not exist on second argument`, path) - } - _compare(value, b[key], `${path}["${key}"]`, message, customCompare) - }) - break - case Array: - if (a.length !== b.length) { - _failMessage(message, 'Arrays have a different number of attributes', path) - } - // @ts-ignore - a.forEach((value, i) => _compare(value, b[i], `${path}[${i}]`, message, customCompare)) - break - /* c8 ignore next 4 */ - default: - if (!customCompare(a.constructor, a, b, path, compareValues)) { - _failMessage(message, `Values ${json.stringify(a)} and ${json.stringify(b)} don't match`, path) - } - } - assert(success, message) - return true -} - -/** - * @template T - * @param {T} a - * @param {T} b - * @param {string?} [message] - * @param {function(any,T,T,string,any):boolean} [customCompare] - */ -export const compare = (a, b, message = null, customCompare = compareValues) => _compare(a, b, 'obj', message, customCompare) - -/** - * @template T - * @param {T} property - * @param {string?} [message] - * @return {asserts property is NonNullable} - * @throws {TestError} - */ -/* c8 ignore next */ -export const assert = (property, message = null) => { property || fail(`Assertion failed${message !== null ? `: ${message}` : ''}`) } - -/** - * @param {function(...any):Promise} f - */ -export const promiseRejected = async f => { - try { - await f() - } catch (err) { - return - } - fail('Expected promise to fail') -} - -/** - * @param {function(...any):void} f - * @throws {TestError} - */ -export const fails = f => { - try { - f() - } catch (_err) { - log.print(log.GREEN, '⇖ This Error was expected') - return - } - fail('Expected this to fail') -} - -/** - * @param {function(...any):Promise} f - * @throws {TestError} - */ -export const failsAsync = async f => { - try { - await f() - } catch (_err) { - log.print(log.GREEN, '⇖ This Error was expected') - return - } - fail('Expected this to fail') -} - -/** - * @param {Object>>} tests - */ -export const runTests = async tests => { - /** - * @param {string} testname - */ - const filterTest = testname => testname.startsWith('test') || testname.startsWith('benchmark') - const numberOfTests = object.map(tests, mod => object.map(mod, (f, fname) => /* c8 ignore next */ f && filterTest(fname) ? 1 : 0).reduce(math.add, 0)).reduce(math.add, 0) - let successfulTests = 0 - let testnumber = 0 - const start = performance.now() - for (const modName in tests) { - const mod = tests[modName] - for (const fname in mod) { - const f = mod[fname] - /* c8 ignore else */ - if (f && filterTest(fname)) { - const repeatEachTest = 1 - let success = true - for (let i = 0; success && i < repeatEachTest; i++) { - success = await run(modName, fname, f, testnumber, numberOfTests) - } - testnumber++ - /* c8 ignore else */ - if (success) { - successfulTests++ - } - } - } - } - const end = performance.now() - log.print('') - const success = successfulTests === numberOfTests - /* c8 ignore start */ - if (success) { - log.print(log.GREEN, log.BOLD, 'All tests successful!', log.GREY, log.UNBOLD, ` in ${time.humanizeDuration(end - start)}`) - log.printImgBase64(nyanCatImage, 50) - } else { - const failedTests = numberOfTests - successfulTests - log.print(log.RED, log.BOLD, `> ${failedTests} test${failedTests > 1 ? 's' : ''} failed`) - } - /* c8 ignore stop */ - return success -} - -class TestError extends Error {} - -/** - * @param {string} reason - * @throws {TestError} - */ -export const fail = reason => { - log.print(log.RED, log.BOLD, 'X ', log.UNBOLD, reason) - throw new TestError('Test Failed') -} - -class SkipError extends Error {} - -/** - * @param {boolean} cond If true, this tests will be skipped - * @throws {SkipError} - */ -export const skip = (cond = true) => { - if (cond) { - throw new SkipError('skipping..') - } -} - -// eslint-disable-next-line -const nyanCatImage = 'R0lGODlhjABMAPcAAMiSE0xMTEzMzUKJzjQ0NFsoKPc7//FM/9mH/z9x0HIiIoKCgmBHN+frGSkZLdDQ0LCwsDk71g0KCUzDdrQQEOFz/8yYdelmBdTiHFxcXDU2erR/mLrTHCgoKK5szBQUFNgSCTk6ymfpCB9VZS2Bl+cGBt2N8kWm0uDcGXhZRUvGq94NCFPhDiwsLGVlZTgqIPMDA1g3aEzS5D6xAURERDtG9JmBjJsZGWs2AD1W6Hp6eswyDeJ4CFNTU1LcEoJRmTMzSd14CTg5ser2GmDzBd17/xkZGUzMvoSMDiEhIfKruCwNAJaWlvRzA8kNDXDrCfi0pe1U/+GS6SZrAB4eHpZwVhoabsx9oiYmJt/TGHFxcYyMjOid0+Zl/0rF6j09PeRr/0zU9DxO6j+z0lXtBtp8qJhMAEssLGhoaPL/GVn/AAsWJ/9/AE3Z/zs9/3cAAOlf/+aa2RIyADo85uhh/0i84WtrazQ0UyMlmDMzPwUFBe16BTMmHau0E03X+g8pMEAoS1MBAf++kkzO8pBaqSZoe9uB/zE0BUQ3Sv///4WFheuiyzo880gzNDIyNissBNqF/8RiAOF2qG5ubj0vL1z6Avl5ASsgGkgUSy8vL/8n/z4zJy8lOv96uEssV1csAN5ZCDQ0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nIgncxkQTw5yoGUMpOnFEgqLRnKSrZSIK/U5Ag+kLjEDaSXCQGmQHzJpWIasyV3OaYyl8nMZi7nLsl0ZkagKc1qWvOa2JxLNLPJzW6+ZZvevAhdwrkStJCTI2gZ5zknos51shOc7oynPOdJz3ra857hDAgAOw==' diff --git a/yjs-poll/node_modules/lib0/testing.test.d.ts b/yjs-poll/node_modules/lib0/testing.test.d.ts deleted file mode 100644 index 9007956..0000000 --- a/yjs-poll/node_modules/lib0/testing.test.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export function nottestingNotTested(): void; -export function testAssertTyping(): void; -export function testComparing(_tc: t.TestCase): void; -export function testFailing(): Promise; -export function testSkipping(): void; -export function testAsync(): Promise; -export function testRepeatRepetition(): void; -import * as t from './testing.js'; -//# sourceMappingURL=testing.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/testing.test.d.ts.map b/yjs-poll/node_modules/lib0/testing.test.d.ts.map deleted file mode 100644 index 2840cd3..0000000 --- a/yjs-poll/node_modules/lib0/testing.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"testing.test.d.ts","sourceRoot":"","sources":["testing.test.js"],"names":[],"mappings":"AAQO,4CAEN;AAEM,yCAMN;AAKM,mCAFI,CAAC,CAAC,QAAQ,QAqGpB;AAEM,6CAcN;AAEM,qCAMN;AAEM,2CAIN;AAEM,6CAON;mBAjKkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/time.d.ts b/yjs-poll/node_modules/lib0/time.d.ts deleted file mode 100644 index 5ee1371..0000000 --- a/yjs-poll/node_modules/lib0/time.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export function getDate(): Date; -/** - * Return current unix time. - * - * @return {number} - */ -export const getUnixTime: () => number; -export function humanizeDuration(d: number): string; -//# sourceMappingURL=time.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/time.d.ts.map b/yjs-poll/node_modules/lib0/time.d.ts.map deleted file mode 100644 index 15c07c2..0000000 --- a/yjs-poll/node_modules/lib0/time.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["time.js"],"names":[],"mappings":"AAcO,2BAFK,IAAI,CAEuB;AAEvC;;;;GAIG;AACH,uCAAmC;AAQ5B,oCAHI,MAAM,GACL,MAAM,CAoBjB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/time.js b/yjs-poll/node_modules/lib0/time.js deleted file mode 100644 index 07965c6..0000000 --- a/yjs-poll/node_modules/lib0/time.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Utility module to work with time. - * - * @module time - */ - -import * as metric from './metric.js' -import * as math from './math.js' - -/** - * Return current time. - * - * @return {Date} - */ -export const getDate = () => new Date() - -/** - * Return current unix time. - * - * @return {number} - */ -export const getUnixTime = Date.now - -/** - * Transform time (in ms) to a human readable format. E.g. 1100 => 1.1s. 60s => 1min. .001 => 10μs. - * - * @param {number} d duration in milliseconds - * @return {string} humanized approximation of time - */ -export const humanizeDuration = d => { - if (d < 60000) { - const p = metric.prefix(d, -1) - return math.round(p.n * 100) / 100 + p.prefix + 's' - } - d = math.floor(d / 1000) - const seconds = d % 60 - const minutes = math.floor(d / 60) % 60 - const hours = math.floor(d / 3600) % 24 - const days = math.floor(d / 86400) - if (days > 0) { - return days + 'd' + ((hours > 0 || minutes > 30) ? ' ' + (minutes > 30 ? hours + 1 : hours) + 'h' : '') - } - if (hours > 0) { - /* c8 ignore next */ - return hours + 'h' + ((minutes > 0 || seconds > 30) ? ' ' + (seconds > 30 ? minutes + 1 : minutes) + 'min' : '') - } - return minutes + 'min' + (seconds > 0 ? ' ' + seconds + 's' : '') -} diff --git a/yjs-poll/node_modules/lib0/time.test.d.ts b/yjs-poll/node_modules/lib0/time.test.d.ts deleted file mode 100644 index 614187b..0000000 --- a/yjs-poll/node_modules/lib0/time.test.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function testTime(tc: t.TestCase): void; -export function testHumanDuration(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=time.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/time.test.d.ts.map b/yjs-poll/node_modules/lib0/time.test.d.ts.map deleted file mode 100644 index 273a868..0000000 --- a/yjs-poll/node_modules/lib0/time.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"time.test.d.ts","sourceRoot":"","sources":["time.test.js"],"names":[],"mappings":"AAOO,6BAFI,CAAC,CAAC,QAAQ,QAMpB;AAKM,sCAFI,CAAC,CAAC,QAAQ,QAmBpB;mBAhCkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/trait/equality.d.ts b/yjs-poll/node_modules/lib0/trait/equality.d.ts deleted file mode 100644 index 1848ba1..0000000 --- a/yjs-poll/node_modules/lib0/trait/equality.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const EqualityTraitSymbol: unique symbol; -export function equals(a: NoInfer, b: T): boolean; -export type EqualityTrait = { - [EqualityTraitSymbol]: (other: EqualityTrait) => boolean; -}; -//# sourceMappingURL=equality.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/trait/equality.d.ts.map b/yjs-poll/node_modules/lib0/trait/equality.d.ts.map deleted file mode 100644 index 81b3991..0000000 --- a/yjs-poll/node_modules/lib0/trait/equality.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"equality.d.ts","sourceRoot":"","sources":["equality.js"],"names":[],"mappings":"AAAA,gDAAqD;AAyB9C,uBALsB,CAAC,SAAhB,aAAc,KACjB,OAAO,CAAC,CAAC,CAAC,KACV,CAAC,GACA,OAAO,CAEgE;4BAtBtE;IAAE,CAAC,mBAAmB,CAAC,EAAC,CAAC,KAAK,EAAC,aAAa,KAAG,OAAO,CAAA;CAAE"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/trait/equality.js b/yjs-poll/node_modules/lib0/trait/equality.js deleted file mode 100644 index dfe7214..0000000 --- a/yjs-poll/node_modules/lib0/trait/equality.js +++ /dev/null @@ -1,26 +0,0 @@ -export const EqualityTraitSymbol = Symbol('Equality') - -/** - * @typedef {{ [EqualityTraitSymbol]:(other:EqualityTrait)=>boolean }} EqualityTrait - */ - -/** - * - * Utility function to compare any two objects. - * - * Note that it is expected that the first parameter is more specific than the latter one. - * - * @example js - * class X { [traits.EqualityTraitSymbol] (other) { return other === this } } - * class X2 { [traits.EqualityTraitSymbol] (other) { return other === this }, x2 () { return 2 } } - * // this is fine - * traits.equals(new X2(), new X()) - * // this is not, because the left type is less specific than the right one - * traits.equals(new X(), new X2()) - * - * @template {EqualityTrait} T - * @param {NoInfer} a - * @param {T} b - * @return {boolean} - */ -export const equals = (a, b) => a === b || !!a?.[EqualityTraitSymbol]?.(b) || false diff --git a/yjs-poll/node_modules/lib0/trait/fingerprint.d.ts b/yjs-poll/node_modules/lib0/trait/fingerprint.d.ts deleted file mode 100644 index 1a31d75..0000000 --- a/yjs-poll/node_modules/lib0/trait/fingerprint.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export const FingerprintTraitSymbol: unique symbol; -export function fingerprint(a: Fingerprintable): string; -/** - * When implementing this trait, it is recommended to write some sort of "magic number" first to - * ensure that different types of objects don't have the same fingerprint. - * - * The recommended pracice is to generate a random u32 number as your magic number. e.g. using - * `console.log(random.uint32().toString(16))` - */ -export type Fingerprintable = { - [FingerprintTraitSymbol]: () => string; -} | import("../encoding.js").AnyEncodable; -//# sourceMappingURL=fingerprint.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/trait/fingerprint.d.ts.map b/yjs-poll/node_modules/lib0/trait/fingerprint.d.ts.map deleted file mode 100644 index a1b6941..0000000 --- a/yjs-poll/node_modules/lib0/trait/fingerprint.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fingerprint.d.ts","sourceRoot":"","sources":["fingerprint.js"],"names":[],"mappings":"AAIA,mDAA2D;AAgBpD,+BAHI,eAAe,GACd,MAAM,CAE6P;;;;;;;;8BAPlQ;IAAE,CAAC,sBAAsB,CAAC,EAAC,MAAI,MAAM,CAAA;CAAE,GAAG,OAAO,gBAAgB,EAAE,YAAY"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/trait/fingerprint.js b/yjs-poll/node_modules/lib0/trait/fingerprint.js deleted file mode 100644 index a12b327..0000000 --- a/yjs-poll/node_modules/lib0/trait/fingerprint.js +++ /dev/null @@ -1,21 +0,0 @@ -import * as encoding from '../encoding.js' -import * as rabin from '../hash/rabin.js' -import * as buffer from '../buffer.js' - -export const FingerprintTraitSymbol = Symbol('Fingerprint') - -/** - * When implementing this trait, it is recommended to write some sort of "magic number" first to - * ensure that different types of objects don't have the same fingerprint. - * - * The recommended pracice is to generate a random u32 number as your magic number. e.g. using - * `console.log(random.uint32().toString(16))` - * - * @typedef {{ [FingerprintTraitSymbol]:()=>string } | import('../encoding.js').AnyEncodable} Fingerprintable - */ - -/** - * @param {Fingerprintable} a - * @return {string} - */ -export const fingerprint = a => (a != null && /** @type {any} */ (a)[FingerprintTraitSymbol]?.()) || buffer.toBase64(rabin.fingerprint(rabin.StandardIrreducible128, encoding.encode(encoder => { encoding.writeUint32(encoder, 0x8de1c475); encoding.writeAny(encoder, a) }))) diff --git a/yjs-poll/node_modules/lib0/trait/traits.d.ts b/yjs-poll/node_modules/lib0/trait/traits.d.ts deleted file mode 100644 index e0084f2..0000000 --- a/yjs-poll/node_modules/lib0/trait/traits.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./equality.js"; -export * from "./fingerprint.js"; -//# sourceMappingURL=traits.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/trait/traits.d.ts.map b/yjs-poll/node_modules/lib0/trait/traits.d.ts.map deleted file mode 100644 index b52843a..0000000 --- a/yjs-poll/node_modules/lib0/trait/traits.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"traits.d.ts","sourceRoot":"","sources":["traits.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/trait/traits.js b/yjs-poll/node_modules/lib0/trait/traits.js deleted file mode 100644 index 67ea73f..0000000 --- a/yjs-poll/node_modules/lib0/trait/traits.js +++ /dev/null @@ -1,2 +0,0 @@ -export * from './equality.js' -export * from './fingerprint.js' diff --git a/yjs-poll/node_modules/lib0/trait/traits.test.d.ts b/yjs-poll/node_modules/lib0/trait/traits.test.d.ts deleted file mode 100644 index ac3f802..0000000 --- a/yjs-poll/node_modules/lib0/trait/traits.test.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function testEqualityTrait1(_tc: t.TestCase): void; -export function testEqualityTrait2(_tc: t.TestCase): void; -export function testFingerprintTrait(): void; -import * as t from '../testing.js'; -//# sourceMappingURL=traits.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/trait/traits.test.d.ts.map b/yjs-poll/node_modules/lib0/trait/traits.test.d.ts.map deleted file mode 100644 index b342be7..0000000 --- a/yjs-poll/node_modules/lib0/trait/traits.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"traits.test.d.ts","sourceRoot":"","sources":["traits.test.js"],"names":[],"mappings":"AAQO,wCAFI,CAAC,CAAC,QAAQ,QAwCpB;AAKM,wCAFI,CAAC,CAAC,QAAQ,QA2BpB;AAEM,6CAMN;mBApFkB,eAAe"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/tree.d.ts b/yjs-poll/node_modules/lib0/tree.d.ts deleted file mode 100644 index 915e4ec..0000000 --- a/yjs-poll/node_modules/lib0/tree.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -/** - * This is a Red Black Tree implementation - * - * @template K,V - */ -export class Tree { - root: any; - length: number; - /** - * @param {K} id - */ - findNext(id: K): V; - /** - * @param {K} id - */ - findPrev(id: K): V; - /** - * @param {K} from - */ - findNodeWithLowerBound(from: K): any; - /** - * @param {K} to - */ - findNodeWithUpperBound(to: K): any; - /** - * @return {V} - */ - findSmallestNode(): V; - /** - * @param {K} from - * @return {V} - */ - findWithLowerBound(from: K): V; - /** - * @param {K} to - * @return {V} - */ - findWithUpperBound(to: K): V; - /** - * @param {K} from - * @param {V} from - * @param {function(V):void} f - */ - iterate(from: K, to: any, f: (arg0: V) => void): void; - /** - * @param {K} id - * @return {V|null} - */ - find(id: K): V | null; - /** - * @param {K} id - * @return {N|null} - */ - findNode(id: K): N | null; - /** - * @param {K} id - */ - delete(id: K): void; - _fixDelete(n: any): void; - put(v: any): any; - _fixInsert(n: any): void; -} -/** - * @template V - */ -declare class N { - /** - * A created node is always red! - * - * @param {V} val - */ - constructor(val: V); - val: V; - color: boolean; - _left: any; - _right: any; - _parent: any; - isRed(): boolean; - isBlack(): boolean; - redden(): this; - blacken(): this; - get grandparent(): any; - get parent(): any; - get sibling(): any; - set left(n: any); - get left(): any; - set right(n: any); - get right(): any; - rotateLeft(tree: any): void; - next(): any; - prev(): any; - rotateRight(tree: any): void; - getUncle(): any; -} -export {}; -//# sourceMappingURL=tree.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/tree.d.ts.map b/yjs-poll/node_modules/lib0/tree.d.ts.map deleted file mode 100644 index cedcef5..0000000 --- a/yjs-poll/node_modules/lib0/tree.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["tree.js"],"names":[],"mappings":"AAiJA;;;;GAIG;AACH,kBAFa,CAAC,EAAC,CAAC;IAIZ,UAAgB;IAChB,eAAe;IAGjB;;OAEG;IACH,aAFW,CAAC,KAMX;IAED;;OAEG;IACH,aAFW,CAAC,KAMX;IAED;;OAEG;IACH,6BAFW,CAAC,OA0BX;IAED;;OAEG;IACH,2BAFW,CAAC,OA6BX;IAED;;OAEG;IACH,oBAFY,CAAC,CAQZ;IAED;;;OAGG;IACH,yBAHW,CAAC,GACA,CAAC,CAKZ;IAED;;;OAGG;IACH,uBAHW,CAAC,GACA,CAAC,CAKZ;IAED;;;;OAIG;IACH,cAJW,CAAC,cAED,CAAS,IAAC,EAAD,CAAC,KAAE,IAAI,QAoB1B;IAED;;;OAGG;IACH,SAHW,CAAC,GACA,CAAC,GAAC,IAAI,CASjB;IAED;;;OAGG;IACH,aAHW,CAAC,GACA,CAAC,CAAC,CAAC,CAAC,GAAC,IAAI,CAoBpB;IAED;;OAEG;IACH,WAFW,CAAC,QAmEX;IAED,yBAmEC;IAED,iBA+BC;IAED,yBA8CC;CACF;AA7gBD;;GAEG;AACH,gBAFa,CAAC;IAGZ;;;;OAIG;IACH,iBAFW,CAAC,EAQX;IALC,OAAc;IACd,eAAiB;IACjB,WAAiB;IACjB,YAAkB;IAClB,aAAmB;IAGrB,iBAA8B;IAC9B,mBAAiC;IACjC,eAA4C;IAC5C,gBAA8C;IAC9C,uBAEC;IAED,kBAEC;IAED,mBAIC;IAUD,iBAKC;IAbD,gBAEC;IAaD,kBAKC;IAhBD,iBAEC;IAgBD,4BAOC;IAED,YAeC;IAED,YAeC;IAED,6BAOC;IAED,gBAOC;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/tree.js b/yjs-poll/node_modules/lib0/tree.js deleted file mode 100644 index 330aada..0000000 --- a/yjs-poll/node_modules/lib0/tree.js +++ /dev/null @@ -1,546 +0,0 @@ -/** - * Red-black-tree implementation. - * - * @module tree - */ -// @ts-nocheck TODO: remove or refactor this file - -const rotate = (tree, parent, newParent, n) => { - if (parent === null) { - tree.root = newParent - newParent._parent = null - } else if (parent.left === n) { - parent.left = newParent - } else if (parent.right === n) { - parent.right = newParent - } else { - throw new Error('The elements are wrongly connected!') - } -} - -/** - * @template V - */ -class N { - /** - * A created node is always red! - * - * @param {V} val - */ - constructor (val) { - this.val = val - this.color = true - this._left = null - this._right = null - this._parent = null - } - - isRed () { return this.color } - isBlack () { return !this.color } - redden () { this.color = true; return this } - blacken () { this.color = false; return this } - get grandparent () { - return this.parent.parent - } - - get parent () { - return this._parent - } - - get sibling () { - return (this === this.parent.left) - ? this.parent.right - : this.parent.left - } - - get left () { - return this._left - } - - get right () { - return this._right - } - - set left (n) { - if (n !== null) { - n._parent = this - } - this._left = n - } - - set right (n) { - if (n !== null) { - n._parent = this - } - this._right = n - } - - rotateLeft (tree) { - const parent = this.parent - const newParent = this.right - const newRight = this.right.left - newParent.left = this - this.right = newRight - rotate(tree, parent, newParent, this) - } - - next () { - if (this.right !== null) { - // search the most left node in the right tree - let o = this.right - while (o.left !== null) { - o = o.left - } - return o - } else { - let p = this - while (p.parent !== null && p !== p.parent.left) { - p = p.parent - } - return p.parent - } - } - - prev () { - if (this.left !== null) { - // search the most right node in the left tree - let o = this.left - while (o.right !== null) { - o = o.right - } - return o - } else { - let p = this - while (p.parent !== null && p !== p.parent.right) { - p = p.parent - } - return p.parent - } - } - - rotateRight (tree) { - const parent = this.parent - const newParent = this.left - const newLeft = this.left.right - newParent.right = this - this.left = newLeft - rotate(tree, parent, newParent, this) - } - - getUncle () { - // we can assume that grandparent exists when this is called! - if (this.parent === this.parent.parent.left) { - return this.parent.parent.right - } else { - return this.parent.parent.left - } - } -} - -const isBlack = node => - node !== null ? node.isBlack() : true - -const isRed = (node) => - node !== null ? node.isRed() : false - -/** - * This is a Red Black Tree implementation - * - * @template K,V - */ -export class Tree { - constructor () { - this.root = null - this.length = 0 - } - - /** - * @param {K} id - */ - findNext (id) { - const nextID = id.clone() - nextID.clock += 1 - return this.findWithLowerBound(nextID) - } - - /** - * @param {K} id - */ - findPrev (id) { - const prevID = id.clone() - prevID.clock -= 1 - return this.findWithUpperBound(prevID) - } - - /** - * @param {K} from - */ - findNodeWithLowerBound (from) { - let o = this.root - if (o === null) { - return null - } else { - while (true) { - if (from === null || (from.lessThan(o.val._id) && o.left !== null)) { - // o is included in the bound - // try to find an element that is closer to the bound - o = o.left - } else if (from !== null && o.val._id.lessThan(from)) { - // o is not within the bound, maybe one of the right elements is.. - if (o.right !== null) { - o = o.right - } else { - // there is no right element. Search for the next bigger element, - // this should be within the bounds - return o.next() - } - } else { - return o - } - } - } - } - - /** - * @param {K} to - */ - findNodeWithUpperBound (to) { - if (to === undefined) { - throw new Error('You must define from!') - } - let o = this.root - if (o === null) { - return null - } else { - while (true) { - if ((to === null || o.val._id.lessThan(to)) && o.right !== null) { - // o is included in the bound - // try to find an element that is closer to the bound - o = o.right - } else if (to !== null && to.lessThan(o.val._id)) { - // o is not within the bound, maybe one of the left elements is.. - if (o.left !== null) { - o = o.left - } else { - // there is no left element. Search for the prev smaller element, - // this should be within the bounds - return o.prev() - } - } else { - return o - } - } - } - } - - /** - * @return {V} - */ - findSmallestNode () { - let o = this.root - while (o != null && o.left != null) { - o = o.left - } - return o - } - - /** - * @param {K} from - * @return {V} - */ - findWithLowerBound (from) { - const n = this.findNodeWithLowerBound(from) - return n == null ? null : n.val - } - - /** - * @param {K} to - * @return {V} - */ - findWithUpperBound (to) { - const n = this.findNodeWithUpperBound(to) - return n == null ? null : n.val - } - - /** - * @param {K} from - * @param {V} from - * @param {function(V):void} f - */ - iterate (from, to, f) { - let o - if (from === null) { - o = this.findSmallestNode() - } else { - o = this.findNodeWithLowerBound(from) - } - while ( - o !== null && - ( - to === null || // eslint-disable-line no-unmodified-loop-condition - o.val._id.lessThan(to) || - o.val._id.equals(to) - ) - ) { - f(o.val) - o = o.next() - } - } - - /** - * @param {K} id - * @return {V|null} - */ - find (id) { - const n = this.findNode(id) - if (n !== null) { - return n.val - } else { - return null - } - } - - /** - * @param {K} id - * @return {N|null} - */ - findNode (id) { - let o = this.root - if (o === null) { - return null - } else { - while (true) { - if (o === null) { - return null - } - if (id.lessThan(o.val._id)) { - o = o.left - } else if (o.val._id.lessThan(id)) { - o = o.right - } else { - return o - } - } - } - } - - /** - * @param {K} id - */ - delete (id) { - let d = this.findNode(id) - if (d == null) { - // throw new Error('Element does not exist!') - return - } - this.length-- - if (d.left !== null && d.right !== null) { - // switch d with the greates element in the left subtree. - // o should have at most one child. - let o = d.left - // find - while (o.right !== null) { - o = o.right - } - // switch - d.val = o.val - d = o - } - // d has at most one child - // let n be the node that replaces d - let isFakeChild - let child = d.left || d.right - if (child === null) { - isFakeChild = true - child = new N(null) - child.blacken() - d.right = child - } else { - isFakeChild = false - } - - if (d.parent === null) { - if (!isFakeChild) { - this.root = child - child.blacken() - child._parent = null - } else { - this.root = null - } - return - } else if (d.parent.left === d) { - d.parent.left = child - } else if (d.parent.right === d) { - d.parent.right = child - } else { - throw new Error('Impossible!') - } - if (d.isBlack()) { - if (child.isRed()) { - child.blacken() - } else { - this._fixDelete(child) - } - } - this.root.blacken() - if (isFakeChild) { - if (child.parent.left === child) { - child.parent.left = null - } else if (child.parent.right === child) { - child.parent.right = null - } else { - throw new Error('Impossible #3') - } - } - } - - _fixDelete (n) { - if (n.parent === null) { - // this can only be called after the first iteration of fixDelete. - return - } - // d was already replaced by the child - // d is not the root - // d and child are black - let sibling = n.sibling - if (isRed(sibling)) { - // make sibling the grandfather - n.parent.redden() - sibling.blacken() - if (n === n.parent.left) { - n.parent.rotateLeft(this) - } else if (n === n.parent.right) { - n.parent.rotateRight(this) - } else { - throw new Error('Impossible #2') - } - sibling = n.sibling - } - // parent, sibling, and children of n are black - if (n.parent.isBlack() && - sibling.isBlack() && - isBlack(sibling.left) && - isBlack(sibling.right) - ) { - sibling.redden() - this._fixDelete(n.parent) - } else if (n.parent.isRed() && - sibling.isBlack() && - isBlack(sibling.left) && - isBlack(sibling.right) - ) { - sibling.redden() - n.parent.blacken() - } else { - if (n === n.parent.left && - sibling.isBlack() && - isRed(sibling.left) && - isBlack(sibling.right) - ) { - sibling.redden() - sibling.left.blacken() - sibling.rotateRight(this) - sibling = n.sibling - } else if (n === n.parent.right && - sibling.isBlack() && - isRed(sibling.right) && - isBlack(sibling.left) - ) { - sibling.redden() - sibling.right.blacken() - sibling.rotateLeft(this) - sibling = n.sibling - } - sibling.color = n.parent.color - n.parent.blacken() - if (n === n.parent.left) { - sibling.right.blacken() - n.parent.rotateLeft(this) - } else { - sibling.left.blacken() - n.parent.rotateRight(this) - } - } - } - - put (v) { - const node = new N(v) - if (this.root !== null) { - let p = this.root // p abbrev. parent - while (true) { - if (node.val._id.lessThan(p.val._id)) { - if (p.left === null) { - p.left = node - break - } else { - p = p.left - } - } else if (p.val._id.lessThan(node.val._id)) { - if (p.right === null) { - p.right = node - break - } else { - p = p.right - } - } else { - p.val = node.val - return p - } - } - this._fixInsert(node) - } else { - this.root = node - } - this.length++ - this.root.blacken() - return node - } - - _fixInsert (n) { - if (n.parent === null) { - n.blacken() - return - } else if (n.parent.isBlack()) { - return - } - const uncle = n.getUncle() - if (uncle !== null && uncle.isRed()) { - // Note: parent: red, uncle: red - n.parent.blacken() - uncle.blacken() - n.grandparent.redden() - this._fixInsert(n.grandparent) - } else { - // Note: parent: red, uncle: black or null - // Now we transform the tree in such a way that - // either of these holds: - // 1) grandparent.left.isRed - // and grandparent.left.left.isRed - // 2) grandparent.right.isRed - // and grandparent.right.right.isRed - if (n === n.parent.right && n.parent === n.grandparent.left) { - n.parent.rotateLeft(this) - // Since we rotated and want to use the previous - // cases, we need to set n in such a way that - // n.parent.isRed again - n = n.left - } else if (n === n.parent.left && n.parent === n.grandparent.right) { - n.parent.rotateRight(this) - // see above - n = n.right - } - // Case 1) or 2) hold from here on. - // Now traverse grandparent, make parent a black node - // on the highest level which holds two red nodes. - n.parent.blacken() - n.grandparent.redden() - if (n === n.parent.left) { - // Case 1 - n.grandparent.rotateRight(this) - } else { - // Case 2 - n.grandparent.rotateLeft(this) - } - } - } -} diff --git a/yjs-poll/node_modules/lib0/tree.test.d.ts b/yjs-poll/node_modules/lib0/tree.test.d.ts deleted file mode 100644 index 54a03d2..0000000 --- a/yjs-poll/node_modules/lib0/tree.test.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=tree.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/tree.test.d.ts.map b/yjs-poll/node_modules/lib0/tree.test.d.ts.map deleted file mode 100644 index 5fe9668..0000000 --- a/yjs-poll/node_modules/lib0/tree.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tree.test.d.ts","sourceRoot":"","sources":["tree.test.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/bin/0ecdsa-generate-keypair.d.ts b/yjs-poll/node_modules/lib0/types/bin/0ecdsa-generate-keypair.d.ts deleted file mode 100644 index 71a08e3..0000000 --- a/yjs-poll/node_modules/lib0/types/bin/0ecdsa-generate-keypair.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -export {}; -//# sourceMappingURL=0ecdsa-generate-keypair.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/bin/0ecdsa-generate-keypair.d.ts.map b/yjs-poll/node_modules/lib0/types/bin/0ecdsa-generate-keypair.d.ts.map deleted file mode 100644 index 08280aa..0000000 --- a/yjs-poll/node_modules/lib0/types/bin/0ecdsa-generate-keypair.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"0ecdsa-generate-keypair.d.ts","sourceRoot":"","sources":["../../src/bin/0ecdsa-generate-keypair.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/bin/0serve.d.ts b/yjs-poll/node_modules/lib0/types/bin/0serve.d.ts deleted file mode 100644 index 97bafa4..0000000 --- a/yjs-poll/node_modules/lib0/types/bin/0serve.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -export {}; -//# sourceMappingURL=0serve.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/bin/0serve.d.ts.map b/yjs-poll/node_modules/lib0/types/bin/0serve.d.ts.map deleted file mode 100644 index 8a23ef8..0000000 --- a/yjs-poll/node_modules/lib0/types/bin/0serve.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"0serve.d.ts","sourceRoot":"","sources":["../../src/bin/0serve.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/bin/gendocs.d.ts b/yjs-poll/node_modules/lib0/types/bin/gendocs.d.ts deleted file mode 100644 index 422e119..0000000 --- a/yjs-poll/node_modules/lib0/types/bin/gendocs.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -export {}; -//# sourceMappingURL=gendocs.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/bin/gendocs.d.ts.map b/yjs-poll/node_modules/lib0/types/bin/gendocs.d.ts.map deleted file mode 100644 index d4f124a..0000000 --- a/yjs-poll/node_modules/lib0/types/bin/gendocs.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gendocs.d.ts","sourceRoot":"","sources":["../../src/bin/gendocs.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/bin/gentesthtml.d.ts b/yjs-poll/node_modules/lib0/types/bin/gentesthtml.d.ts deleted file mode 100644 index 39f067b..0000000 --- a/yjs-poll/node_modules/lib0/types/bin/gentesthtml.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -export {}; -//# sourceMappingURL=gentesthtml.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/bin/gentesthtml.d.ts.map b/yjs-poll/node_modules/lib0/types/bin/gentesthtml.d.ts.map deleted file mode 100644 index 5f95055..0000000 --- a/yjs-poll/node_modules/lib0/types/bin/gentesthtml.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gentesthtml.d.ts","sourceRoot":"","sources":["../../src/bin/gentesthtml.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/crypto/aes-gcm.d.ts b/yjs-poll/node_modules/lib0/types/crypto/aes-gcm.d.ts deleted file mode 100644 index 2120545..0000000 --- a/yjs-poll/node_modules/lib0/types/crypto/aes-gcm.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export function encrypt(key: CryptoKey, data: Uint8Array): Promise>; -export function decrypt(key: CryptoKey, data: Uint8Array): PromiseLike; -export function importKeyJwk(jwk: any, { usages, extractable }?: { - usages?: Usages | undefined; - extractable?: boolean | undefined; -}): Promise; -export function importKeyRaw(raw: Uint8Array, { usages, extractable }?: { - usages?: Usages | undefined; - extractable?: boolean | undefined; -}): Promise; -export function deriveKey(secret: Uint8Array | string, salt: Uint8Array | string, { extractable, usages }?: { - extractable?: boolean | undefined; - usages?: Usages | undefined; -}): Promise; -export type Usages = Array<"encrypt" | "decrypt">; -export { exportKeyJwk, exportKeyRaw } from "./common.js"; -//# sourceMappingURL=aes-gcm.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/crypto/aes-gcm.d.ts.map b/yjs-poll/node_modules/lib0/types/crypto/aes-gcm.d.ts.map deleted file mode 100644 index ff8d7ef..0000000 --- a/yjs-poll/node_modules/lib0/types/crypto/aes-gcm.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"aes-gcm.d.ts","sourceRoot":"","sources":["../../src/crypto/aes-gcm.js"],"names":[],"mappings":"AAuBO,6BAHI,SAAS,QACT,UAAU,CAAC,WAAW,CAAC,oCAkBjC;AAWM,6BAJI,SAAS,QACT,UAAU,CAAC,WAAW,CAAC,GACtB,WAAW,CAAC,UAAU,CAAC,CAclC;AAaM,kCALI,GAAG,4BAEX;IAAsB,MAAM;IACL,WAAW;CAAC,sBAQrC;AAUM,kCALI,UAAU,CAAC,WAAW,CAAC,4BAE/B;IAAsB,MAAM;IACL,WAAW;CAAC,sBAG0D;AAmBzF,kCANI,UAAU,CAAC,WAAW,CAAC,GAAC,MAAM,QAC9B,UAAU,CAAC,WAAW,CAAC,GAAC,MAAM,4BAEtC;IAAuB,WAAW;IACZ,MAAM;CAAC,sBAsB7B;qBAxHU,KAAK,CAAC,SAAS,GAAC,SAAS,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/crypto/common.d.ts b/yjs-poll/node_modules/lib0/types/crypto/common.d.ts deleted file mode 100644 index 75106c9..0000000 --- a/yjs-poll/node_modules/lib0/types/crypto/common.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function exportKeyJwk(key: CryptoKey): Promise; -export function exportKeyRaw(key: CryptoKey): Promise>; -//# sourceMappingURL=common.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/crypto/common.d.ts.map b/yjs-poll/node_modules/lib0/types/crypto/common.d.ts.map deleted file mode 100644 index eed2e01..0000000 --- a/yjs-poll/node_modules/lib0/types/crypto/common.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/crypto/common.js"],"names":[],"mappings":"AAKO,kCAFI,SAAS,uBAMnB;AAQM,kCAHI,SAAS,GACR,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAG6B"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/crypto/ecdsa.d.ts b/yjs-poll/node_modules/lib0/types/crypto/ecdsa.d.ts deleted file mode 100644 index 5ebdfe1..0000000 --- a/yjs-poll/node_modules/lib0/types/crypto/ecdsa.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export function sign(key: CryptoKey, data: Uint8Array): PromiseLike>; -export function verify(key: CryptoKey, signature: Uint8Array, data: Uint8Array): PromiseLike; -export function generateKeyPair({ extractable, usages }?: { - extractable?: boolean | undefined; - usages?: Usages | undefined; -}): Promise; -export function importKeyJwk(jwk: any, { extractable, usages }?: { - extractable?: boolean | undefined; - usages?: Usages | undefined; -}): Promise; -export function importKeyRaw(raw: any, { extractable, usages }?: { - extractable?: boolean | undefined; - usages?: Usages | undefined; -}): Promise; -export type Usages = Array<"sign" | "verify">; -export { exportKeyJwk, exportKeyRaw } from "./common.js"; -//# sourceMappingURL=ecdsa.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/crypto/ecdsa.d.ts.map b/yjs-poll/node_modules/lib0/types/crypto/ecdsa.d.ts.map deleted file mode 100644 index bf6482f..0000000 --- a/yjs-poll/node_modules/lib0/types/crypto/ecdsa.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ecdsa.d.ts","sourceRoot":"","sources":["../../src/crypto/ecdsa.js"],"names":[],"mappings":"AA8BO,0BAJI,SAAS,QACT,UAAU,CAAC,WAAW,CAAC,GACtB,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAOA;AAYzC,4BALI,SAAS,aACT,UAAU,CAAC,WAAW,CAAC,QACvB,UAAU,CAAC,WAAW,CAAC,GACtB,WAAW,CAAC,OAAO,CAAC,CAQ7B;AAaI,0DAHJ;IAAuB,WAAW;IACZ,MAAM;CAAC,0BAO7B;AAQI,kCALI,GAAG,4BAEX;IAAuB,WAAW;IACZ,MAAM;CAAC,sBAQ/B;AAUM,kCALI,GAAG,4BAEX;IAAuB,WAAW;IACZ,MAAM;CAAC,sBAGkD;qBAxFrE,KAAK,CAAC,MAAM,GAAC,QAAQ,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/crypto/jwt.d.ts b/yjs-poll/node_modules/lib0/types/crypto/jwt.d.ts deleted file mode 100644 index 0447def..0000000 --- a/yjs-poll/node_modules/lib0/types/crypto/jwt.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export function encodeJwt(privateKey: CryptoKey, payload: Object): PromiseLike; -export function verifyJwt(publicKey: CryptoKey, jwt: string): Promise<{ - header: any; - payload: any; -}>; -export function unsafeDecode(jwt: string): { - header: any; - payload: any; -}; -//# sourceMappingURL=jwt.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/crypto/jwt.d.ts.map b/yjs-poll/node_modules/lib0/types/crypto/jwt.d.ts.map deleted file mode 100644 index a0db593..0000000 --- a/yjs-poll/node_modules/lib0/types/crypto/jwt.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../src/crypto/jwt.js"],"names":[],"mappings":"AAqBO,sCAHI,SAAS,WACT,MAAM,uBAgBhB;AAMM,qCAHI,SAAS,OACT,MAAM;;;GAiBhB;AAOM,kCAFI,MAAM;;;EAQhB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/crypto/rsa-oaep.d.ts b/yjs-poll/node_modules/lib0/types/crypto/rsa-oaep.d.ts deleted file mode 100644 index b8bf3e9..0000000 --- a/yjs-poll/node_modules/lib0/types/crypto/rsa-oaep.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export { exportKeyJwk } from "./common.js"; -export function encrypt(key: CryptoKey, data: Uint8Array): PromiseLike>; -export function decrypt(key: CryptoKey, data: Uint8Array): PromiseLike; -export function generateKeyPair({ extractable, usages }?: { - extractable?: boolean | undefined; - usages?: Usages | undefined; -}): Promise; -export function importKeyJwk(jwk: any, { extractable, usages }?: { - extractable?: boolean | undefined; - usages?: Usages | undefined; -}): Promise; -export type Usages = Array<"encrypt" | "decrypt">; -//# sourceMappingURL=rsa-oaep.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/crypto/rsa-oaep.d.ts.map b/yjs-poll/node_modules/lib0/types/crypto/rsa-oaep.d.ts.map deleted file mode 100644 index 1544fc1..0000000 --- a/yjs-poll/node_modules/lib0/types/crypto/rsa-oaep.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rsa-oaep.d.ts","sourceRoot":"","sources":["../../src/crypto/rsa-oaep.js"],"names":[],"mappings":";AAuBO,6BAJI,SAAS,QACT,UAAU,CAAC,WAAW,CAAC,GACtB,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CASZ;AAW7B,6BAJI,SAAS,QACT,UAAU,CAAC,WAAW,CAAC,GACtB,WAAW,CAAC,UAAU,CAAC,CASG;AAQ/B,0DAJJ;IAAuB,WAAW;IACZ,MAAM;CAC5B,GAAS,OAAO,CAAC,aAAa,CAAC,CAY/B;AAQI,kCALI,GAAG,4BAEX;IAAuB,WAAW;IACZ,MAAM;CAAC,sBAQ/B;qBAxEY,KAAK,CAAC,SAAS,GAAC,SAAS,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/delta/binding.d.ts b/yjs-poll/node_modules/lib0/types/delta/binding.d.ts deleted file mode 100644 index 5bf528f..0000000 --- a/yjs-poll/node_modules/lib0/types/delta/binding.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -/** - * @template T - * @typedef {import('../schema.js').Schema} Schema - */ -/** - * @template {delta.AbstractDelta} DeltaA - * @template {delta.AbstractDelta} DeltaB - */ -export class Binding { - /** - * @param {RDT} a - * @param {RDT} b - * @param {dt.Template} template - */ - constructor(a: RDT, b: RDT, template: dt.Template); - /** - * @type {dt.Transformer} - */ - t: dt.Transformer; - a: RDT; - b: RDT; - _mux: mux.mutex; - _achanged: (delta: DeltaA) => void; - _bchanged: (delta: DeltaB) => void; - destroy: () => void; -} -export function bind>(a: RDT, b: RDT ? DeltaB : never>, template: dt.Template): Binding ? DeltaB : never>; -export function deltaRDT($delta: Schema): DeltaRDT; -export const $domDelta: any; -export function domRDT(dom: Element): DomRDT>; -export type Schema = import("../schema.js").Schema; -/** - * Abstract Interface for a delta-based Replicated Data Type. - */ -export type RDT = ObservableV2<{ - "change": (delta: Delta) => void; - "destroy": (rdt: RDT) => void; -}> & { - update: (delta: Delta) => any; - destroy: () => void; -}; -export type DomDelta = delta.RecursiveNode; -import * as delta from './delta.js'; -import * as dt from './t3.test.js'; -import * as mux from '../mutex.js'; -/** - * @template {delta.AbstractDelta} Delta - * @implements RDT - * @extends {ObservableV2<{ change: (delta: Delta) => void, 'destroy': (rdt:DeltaRDT)=>void }>} - */ -declare class DeltaRDT extends ObservableV2<{ - change: (delta: Delta) => void; - destroy: (rdt: DeltaRDT) => void; -}> implements RDT { - /** - * @param {Schema} $delta - */ - constructor($delta: Schema); - $delta: s.Schema; - /** - * @type {Delta?} - */ - state: Delta | null; - _mux: mux.mutex; - /** - * @param {Delta} delta - */ - update: (delta: Delta) => any; -} -/** - * @typedef {delta.RecursiveNode} DomDelta - */ -/** - * @template {DomDelta} [D=DomDelta] - * @implements RDT - * @extends {ObservableV2<{ change: (delta: D)=>void, destroy: (rdt:DomRDT)=>void }>}>} - */ -declare class DomRDT> extends ObservableV2<{ - change: (delta: D) => void; - destroy: (rdt: DomRDT) => void; -}> implements RDT { - /** - * @param {Element} observedNode - */ - constructor(observedNode: Element); - observedNode: Element; - _mux: mux.mutex; - observer: MutationObserver; - /** - * @param {MutationRecord[]} mutations - */ - _mutationHandler: (mutations: MutationRecord[]) => any; - /** - * @param {D} delta - */ - update: (delta: D) => void; -} -import { ObservableV2 } from '../observable.js'; -import * as s from '../schema.js'; -export {}; -//# sourceMappingURL=binding.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/delta/binding.d.ts.map b/yjs-poll/node_modules/lib0/types/delta/binding.d.ts.map deleted file mode 100644 index 965b0c7..0000000 --- a/yjs-poll/node_modules/lib0/types/delta/binding.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"binding.d.ts","sourceRoot":"","sources":["../../src/delta/binding.js"],"names":[],"mappings":"AAeA;;;GAGG;AAEH;;;GAGG;AACH,qBAHmC,MAAM,SAA3B,KAAK,CAAC,aAAc,EACC,MAAM,SAA3B,KAAK,CAAC,aAAc;IAGhC;;;;OAIG;IACH,eAJW,GAAG,CAAC,MAAM,CAAC,KACX,GAAG,CAAC,MAAM,CAAC,YACX,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAC,MAAM,EAAC,MAAM,CAAC,EA4BxC;IAzBC;;OAEG;IACH,GAFU,EAAE,CAAC,WAAW,CAAC,GAAG,EAAC,MAAM,EAAC,MAAM,CAAC,CAEnB;IACxB,eAAU;IACV,eAAU;IACV,gBAA6B;IAC7B,8BAgCoD,IAAI,CAxBrD;IACH,8BAuBoD,IAAI,CAfrD;IAGL,oBAKC;CACF;AAgBM,qBAN4B,MAAM,SAA3B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OAEG;IACH,oBAFW,MAAM,CAAC,KAAK,CAAC,EAUvB;IANC,wBAAoB;IACpB;;OAEG;IACH,OAFU,KAAK,OAAC,CAEC;IACjB,gBAA6B;IAG/B;;OAEG;IACH,SAAS,OAFE,KAEG,SAOZ;CAMH;AAkMD;;GAEG;AAEH;;;;GAIG;AACH,qBAJyB,CAAC,SAAZ,QAAS;;;YAEa,CAAC,KAAK,EAAE,CAAC,KAAG,IAAI;aAAW,CAAC,GAAG,EAAC,MAAM,CAAC,CAAC,CAAC,KAAG,IAAI;cADrE,GAAG,CAAC,CAAC;IAIlB;;OAEG;IACH,0BAFW,OAAO,EAajB;IATC,sBAAgC;IAChC,gBAA6B;IAC7B,2BAA2D;IAS7D;;OAEG;IACH,mBAAmB,WAFR,cAAc,EAEG,SAGxB;IAEJ;;OAEG;IACH,SAAS,OAFE,CAEG,UAWb;CAOF;6BA1W4B,kBAAkB;mBAS5B,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/delta/delta.d.ts b/yjs-poll/node_modules/lib0/types/delta/delta.d.ts deleted file mode 100644 index a4697f6..0000000 --- a/yjs-poll/node_modules/lib0/types/delta/delta.d.ts +++ /dev/null @@ -1,1074 +0,0 @@ -/** - * @typedef {{ - * insert?: string[] - * insertAt?: number - * delete?: string[] - * deleteAt?: number - * format?: Record - * formatAt?: number - * }} Attribution - */ -/** - * @type {s.Schema} - */ -export const $attribution: s.Schema; -/** - * @typedef {{ [key: string]: any }} FormattingAttributes - */ -/** - * @typedef {{ - * type: 'delta', - * name?: string, - * attrs?: { [Key in string|number]: DeltaAttrOpJSON }, - * children?: Array - * }} DeltaJSON - */ -/** - * @typedef {{ type: 'insert', insert: string|Array, format?: { [key: string]: any }, attribution?: Attribution } | { delete: number } | { type: 'retain', retain: number, format?: { [key:string]: any }, attribution?: Attribution } | { type: 'modify', value: object }} DeltaListOpJSON - */ -/** - * @typedef {{ type: 'insert', value: any, prevValue?: any, attribution?: Attribution } | { type: 'delete', prevValue?: any, attribution?: Attribution } | { type: 'modify', value: DeltaJSON }} DeltaAttrOpJSON - */ -/** - * @typedef {TextOp|InsertOp|DeleteOp|RetainOp|ModifyOp} ChildrenOpAny - */ -/** - * @typedef {SetAttrOp|DeleteAttrOp|ModifyAttrOp} AttrOpAny - */ -/** - * @typedef {ChildrenOpAny|AttrOpAny} _OpAny - */ -/** - * @type {s.Schema} - */ -export const $deltaMapChangeJson: s.Schema; -export class TextOp extends list.ListNode { - /** - * @param {string} insert - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor(insert: string, format: FormattingAttributes | null, attribution: Attribution | null); - /** - * @readonly - * @type {string} - */ - readonly insert: string; - /** - * @readonly - * @type {FormattingAttributes|null} - */ - readonly format: FormattingAttributes | null; - attribution: Attribution | null; - /** - * @type {string?} - */ - _fingerprint: string | null; - get $type(): s.Schema; - /** - * @param {string} newVal - */ - _updateInsert(newVal: string): void; - /** - * @return {'insert'} - */ - get type(): "insert"; - get length(): number; - get fingerprint(): string; - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} offset - * @param {number} len - */ - _splice(offset: number, len: number): this; - /** - * @return {DeltaListOpJSON} - */ - toJSON(): DeltaListOpJSON; - /** - * @return {TextOp} - */ - clone(start?: number, end?: number): TextOp; - /** - * @param {TextOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: TextOp): boolean; -} -/** - * @template {any} ArrayContent - */ -export class InsertOp extends list.ListNode { - /** - * @param {Array} insert - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor(insert: Array, format: FormattingAttributes | null, attribution: Attribution | null); - /** - * @readonly - * @type {Array} - */ - readonly insert: Array; - /** - * @readonly - * @type {FormattingAttributes?} - */ - readonly format: FormattingAttributes | null; - /** - * @readonly - * @type {Attribution?} - */ - readonly attribution: Attribution | null; - /** - * @type {string?} - */ - _fingerprint: string | null; - get $type(): s.Schema>; - /** - * @param {ArrayContent} newVal - */ - _updateInsert(newVal: ArrayContent): void; - /** - * @return {'insert'} - */ - get type(): "insert"; - get length(): number; - /** - * @param {number} i - * @return {Extract} - */ - _modValue(i: number): Extract; - get fingerprint(): string; - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} offset - * @param {number} len - */ - _splice(offset: number, len: number): this; - /** - * @return {DeltaListOpJSON} - */ - toJSON(): DeltaListOpJSON; - /** - * @return {InsertOp} - */ - clone(start?: number, end?: number): InsertOp; - /** - * @param {InsertOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: InsertOp): boolean; -} -/** - * @template {DeltaConf} [DConf={}] - */ -export class DeleteOp extends list.ListNode { - /** - * @param {number} len - */ - constructor(len: number); - delete: number; - /** - * @type {Delta?} - */ - prevValue: Delta | null; - /** - * @type {string|null} - */ - _fingerprint: string | null; - get $type(): s.Schema>; - /** - * @return {'delete'} - */ - get type(): "delete"; - get length(): number; - get fingerprint(): string; - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} _offset - * @param {number} len - */ - _splice(_offset: number, len: number): this; - /** - * @return {DeltaListOpJSON} - */ - toJSON(): DeltaListOpJSON; - /** - * @param {number} start - * @param {number} end - * @return {DeleteOp} - */ - clone(start?: number, end?: number): DeleteOp; - /** - * @param {DeleteOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: DeleteOp): boolean; -} -export class RetainOp extends list.ListNode { - /** - * @param {number} retain - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor(retain: number, format: FormattingAttributes | null, attribution: Attribution | null); - /** - * @readonly - * @type {number} - */ - readonly retain: number; - /** - * @readonly - * @type {FormattingAttributes?} - */ - readonly format: FormattingAttributes | null; - /** - * @readonly - * @type {Attribution?} - */ - readonly attribution: Attribution | null; - /** - * @type {string|null} - */ - _fingerprint: string | null; - get $type(): s.Schema; - /** - * @return {'retain'} - */ - get type(): "retain"; - get length(): number; - get fingerprint(): string; - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} _offset - * @param {number} len - */ - _splice(_offset: number, len: number): this; - /** - * @return {DeltaListOpJSON} - */ - toJSON(): DeltaListOpJSON; - clone(start?: number, end?: number): RetainOp; - /** - * @param {RetainOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: RetainOp): boolean; -} -/** - * Delta that can be applied on a YType Embed - * - * @template {Delta} [DTypes=DeltaAny] - */ -export class ModifyOp extends list.ListNode { - /** - * @param {DTypes} delta - * @param {FormattingAttributes|null} format - * @param {Attribution?} attribution - */ - constructor(delta: DTypes, format: FormattingAttributes | null, attribution: Attribution | null); - /** - * @readonly - * @type {DTypes} - */ - readonly value: DTypes; - /** - * @readonly - * @type {FormattingAttributes?} - */ - readonly format: FormattingAttributes | null; - /** - * @readonly - * @type {Attribution?} - */ - readonly attribution: Attribution | null; - /** - * @type {string|null} - */ - _fingerprint: string | null; - get $type(): s.Schema>; - /** - * @return {'modify'} - */ - get type(): "modify"; - get length(): number; - /** - * @type {DeltaBuilderAny} - */ - get _modValue(): DeltaBuilderAny; - get fingerprint(): string; - /** - * Remove a part of the operation (similar to Array.splice) - * - * @param {number} _offset - * @param {number} _len - */ - _splice(_offset: number, _len: number): this; - /** - * @return {DeltaListOpJSON} - */ - toJSON(): DeltaListOpJSON; - /** - * @return {ModifyOp} - */ - clone(): ModifyOp; - /** - * @param {ModifyOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: ModifyOp): boolean; -} -/** - * @template {any} [V=any] - * @template {string|number} [K=any] - */ -export class SetAttrOp { - /** - * @param {K} key - * @param {V} value - * @param {V|undefined} prevValue - * @param {Attribution?} attribution - */ - constructor(key: K, value: V, prevValue: V | undefined, attribution: Attribution | null); - /** - * @readonly - * @type {K} - */ - readonly key: K; - /** - * @readonly - * @type {V} - */ - readonly value: V; - /** - * @readonly - * @type {V|undefined} - */ - readonly prevValue: V | undefined; - /** - * @readonly - * @type {Attribution?} - */ - readonly attribution: Attribution | null; - /** - * @type {string|null} - */ - _fingerprint: string | null; - get $type(): s.Schema>; - /** - * @return {'insert'} - */ - get type(): "insert"; - /** - * @type {DeltaBuilderAny} - */ - get _modValue(): DeltaBuilderAny; - get fingerprint(): string; - toJSON(): { - type: "insert"; - value: DeltaJSON | V; - } & (({ - attribution: Attribution; - } | { - attribution?: undefined; - }) & ({ - prevValue: V & ({} | null); - } | { - prevValue?: undefined; - })); - /** - * @return {SetAttrOp} - */ - clone(): SetAttrOp; - /** - * @param {SetAttrOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: SetAttrOp): boolean; -} -/** - * @template [V=any] - * @template {string|number} [K=string|number] - */ -export class DeleteAttrOp { - /** - * @param {K} key - * @param {V|undefined} prevValue - * @param {Attribution?} attribution - */ - constructor(key: K, prevValue: V | undefined, attribution: Attribution | null); - /** - * @type {K} - */ - key: K; - /** - * @type {V|undefined} - */ - prevValue: V | undefined; - attribution: Attribution | null; - /** - * @type {string|null} - */ - _fingerprint: string | null; - get $type(): s.Schema>; - /** - * @type {'delete'} - */ - get type(): "delete"; - get value(): undefined; - get fingerprint(): string; - /** - * @return {DeltaAttrOpJSON} - */ - toJSON(): DeltaAttrOpJSON; - clone(): DeleteAttrOp; - /** - * @param {DeleteAttrOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: DeleteAttrOp): boolean; -} -/** - * @template {DeltaAny} [Modifier=DeltaAny] - * @template {string|number} [K=string] - */ -export class ModifyAttrOp { - /** - * @param {K} key - * @param {Modifier} delta - */ - constructor(key: K, delta: Modifier); - /** - * @readonly - * @type {K} - */ - readonly key: K; - /** - * @readonly - * @type {Modifier} - */ - readonly value: Modifier; - /** - * @type {string|null} - */ - _fingerprint: string | null; - get $type(): s.Schema>; - /** - * @type {'modify'} - */ - get type(): "modify"; - get fingerprint(): string; - /** - * @return {DeltaBuilder} - */ - get _modValue(): DeltaBuilder; - /** - * @return {DeltaAttrOpJSON} - */ - toJSON(): DeltaAttrOpJSON; - /** - * @return {ModifyAttrOp} - */ - clone(): ModifyAttrOp; - /** - * @param {ModifyAttrOp} other - */ - [equalityTrait.EqualityTraitSymbol](other: ModifyAttrOp): boolean; -} -export const $insertOp: s.Schema>; -export const $modifyOp: s.Schema; -export const $textOp: s.Schema; -export const $deleteOp: s.Schema>; -export const $retainOp: s.Schema; -export const $anyOp: s.Schema | DeleteOp | ModifyOp>; -export const $setAttrOp: s.Schema>; -export const $modifyAttrOp: s.Schema>; -export const $deleteAttrOp: s.Schema>; -export const $anyAttrOp: s.Schema | DeleteAttrOp | ModifyAttrOp>; -export function $setAttrOpWith($content: s.Schema): s.Schema>; -export function $insertOpWith($content: s.Schema): s.Schema>; -export function $modifyOpWith($content: s.Schema): s.Schema>; -export function $modifyAttrOpWith($content: s.Schema): s.Schema>; -/** - * @template {DeltaConf} [DConf={}] - * @extends {DeltaData< - * DeltaConfGetName, - * DeltaConfGetAttrs, - * DeltaConfGetChildren, - * DConf extends {text:true} ? true : false - * >} - */ -export class Delta extends DeltaData, import("../ts.js").TypeIsAny, DeltaConfGetChildren, DConf extends { - text: true; -} ? true : false> { - /** - * @param {string?} name - * @param {s.Schema>?} $schema - */ - constructor(name: string | null, $schema: s.Schema> | null); - get $type(): s.Schema; - /** - * @type {string} - */ - get fingerprint(): string; - isEmpty(): boolean; - /** - * @return {DeltaJSON} - */ - toJSON(): DeltaJSON; - /** - * @param {Delta} other - * @return {boolean} - */ - equals(other: Delta): boolean; - /** - * Mark this delta as done and perform some cleanup (e.g. remove appended retains without - * formats&attributions). In the future, there might be additional merge operations that can be - * performed to result in smaller deltas. Set `markAsDone=false` to only perform the cleanup. - * - * @return {Delta} - */ - done(markAsDone?: boolean): Delta; - [fingerprintTrait.FingerprintTraitSymbol](): string; - /** - * @param {any} other - * @return {boolean} - */ - [equalityTrait.EqualityTraitSymbol](other: any): boolean; -} -export function slice(d: Delta, start?: number, end?: number, currNode?: ChildrenOpAny | null): DeltaBuilder; -export function clone(d: D): D extends Delta ? DeltaBuilder : never; -/** - * @template {DeltaConf} [DConf={}] - * @extends {Delta} - */ -export class DeltaBuilder extends Delta { - /** - * @param {string?} name - * @param {s.Schema>?} $schema - */ - constructor(name: string | null, $schema: s.Schema> | null); - /** - * @type {FormattingAttributes?} - */ - usedAttributes: FormattingAttributes | null; - /** - * @type {Attribution?} - */ - usedAttribution: Attribution | null; - /** - * @param {Attribution?} attribution - */ - useAttribution(attribution: Attribution | null): this; - /** - * @param {FormattingAttributes?} attributes - * @return {this} - */ - useAttributes(attributes: FormattingAttributes | null): this; - /** - * @param {string} name - * @param {any} value - */ - updateUsedAttributes(name: string, value: any): this; - /** - * @template {keyof Attribution} NAME - * @param {NAME} name - * @param {Attribution[NAME]?} value - */ - updateUsedAttribution(name: NAME, value: Attribution[NAME] | null): this; - /** - * @template {(DConf extends {fixed:true} ? never : (Array|string)) | (DeltaConfGetChildren extends infer Children ? (Children extends never ? never : Array) : never) | DeltaConfGetText} NewContent - * @param {NewContent} insert - * @param {FormattingAttributes?} [formatting] - * @param {Attribution?} [attribution] - * @return {DeltaBuilder extends never ? {} : { - * children: Exclude[number]|DeltaConfGetChildren - * }) & (Extract extends never ? {} : { text: true })>>} - */ - insert | string)) | (DeltaConfGetChildren extends infer Children_1 ? (Children_1 extends never ? never : Array) : never) | DeltaConfGetText>(insert: NewContent, formatting?: FormattingAttributes | null, attribution?: Attribution | null): DeltaBuilder extends never ? {} : { - children: Exclude[number] | DeltaConfGetChildren; - }) & (Extract extends never ? {} : { - text: true; - })>>; - /** - * @template {Extract,Delta>} NewContent - * @param {NewContent} modify - * @param {FormattingAttributes?} formatting - * @param {Attribution?} attribution - * @return {DeltaBuilder|NewContent}>>} - */ - modify, Delta>>(modify: NewContent, formatting?: FormattingAttributes | null, attribution?: Attribution | null): DeltaBuilder | NewContent; - }>>; - /** - * @param {number} len - * @param {FormattingAttributes?} [format] - * @param {Attribution?} [attribution] - */ - retain(len: number, format?: FormattingAttributes | null, attribution?: Attribution | null): this; - /** - * @param {number} len - */ - delete(len: number): this; - /** - * @template {keyof DeltaConfGetAllowedAttrs} Key - * @template {DeltaConfGetAllowedAttrs[Key]} Val - * @param {Key} key - * @param {Val} val - * @param {Attribution?} attribution - * @param {Val|undefined} [prevValue] - * @return {DeltaBuilder,Key,Val>}>>} - */ - setAttr, Val extends DeltaConfGetAllowedAttrs[Key]>(key: Key, val: Val, attribution?: Attribution | null, prevValue?: Val | undefined): DeltaBuilder, Key, Val>; - }>>; - /** - * @template {DeltaConfGetAllowedAttrs} NewAttrs - * @param {NewAttrs} attrs - * @param {Attribution?} attribution - * @return {DeltaBuilder,NewAttrs> } - * >> - * } - */ - setAttrs>(attrs: NewAttrs, attribution?: Attribution | null): DeltaBuilder, NewAttrs>; - }>>; - /** - * @template {keyof DeltaConfGetAllowedAttrs} Key - * @param {Key} key - * @param {Attribution?} attribution - * @param {any} [prevValue] - * @return {DeltaBuilder,Key,never> - * }>>} - */ - deleteAttr>(key: Key, attribution?: Attribution | null, prevValue?: any): DeltaBuilder, Key, never>; - }>>; - /** - * @template {DeltaConfGetAllowedAttrs extends infer As ? { [K in keyof As]: Extract extends never ? never : K }[keyof As] : never} Key - * @template {Extract[Key],DeltaAny>} D - * @param {Key} key - * @param {D} modify - * @return {DeltaBuilder,Key,D>}>>} - */ - modifyAttr extends infer As ? { [K in keyof As]: Extract extends never ? never : K; }[keyof As] : never, D extends Extract[Key], DeltaAny>>(key: Key, modify: D): DeltaBuilder, Key, D>; - }>>; - /** - * @param {Delta} other - */ - apply(other: Delta): this; - /** - * @param {DeltaAny} other - * @param {boolean} priority - */ - rebase(other: DeltaAny, priority: boolean): this; - /** - * Same as doing `delta.rebase(other.inverse())`, without creating a temporary delta. - * - * @param {DeltaAny} other - * @param {boolean} priority - */ - rebaseOnInverse(other: DeltaAny, priority: boolean): this; - /** - * Append child ops from one op to the other. - * - * delta.create().insert('a').append(delta.create().insert('b')) // => insert "ab" - * - * @todo on fixed deltas this should not extend - * - * @template {DeltaConf} OtherDeltaConf - * @param {Delta} other - * @return {DeltaBuilder extends never ? {} : { children: DeltaConfGetChildren | DeltaConfGetChildren }) - * & (DeltaConfGetText extends string ? { text: true } : never) - * >>} - */ - append(other: Delta): DeltaBuilder extends never ? {} : { - children: DeltaConfGetChildren | DeltaConfGetChildren; - }) & (DeltaConfGetText extends string ? { - text: true; - } : never)>>; -} -/** - * @template {DeltaConf} DConf - * @extends {s.Schema>} - */ -export class $Delta extends s.Schema> { - /** - * @param {s.Schema} $name - * @param {s.Schema} $attrs - * @param {s.Schema} $children - * @param {any} hasText - * @param {any} recursiveChildren - * @param {s.Schema<{[K:string]:any}>} $formats - */ - constructor($name: s.Schema, $attrs: s.Schema, $children: s.Schema, hasText: any, recursiveChildren: any, $formats: s.Schema<{ - [K: string]: any; - }>); - /** - * @type {{ - * $name: s.Schema>, - * $attrs: s.Schema>, - * $children: s.Schema>, - * hasText: DeltaConfGetText - * recursiveChildren: DeltaConfGetRecursiveChildren, - * $formats: s.Schema<{[K:string]:any}> - * }} - */ - shape: { - $name: s.Schema>; - $attrs: s.Schema>; - $children: s.Schema>; - hasText: DeltaConfGetText; - recursiveChildren: DeltaConfGetRecursiveChildren; - $formats: s.Schema<{ - [K: string]: any; - }>; - }; -} -export function $delta | string | Array = s.Schema, AttrsSchema extends s.Schema<{ - [key: string | number]: any; -}> | { - [key: string | number]: any; -} = s.Schema<{}>, ChildrenSchema extends unknown = s.Schema, HasText extends boolean = false, RecursiveChildren extends boolean = false, Formats extends { - [k: string]: any; -} = { - [k: string]: any; -}>({ name, attrs, children, text, formats, recursiveChildren: recursive }: { - name?: NodeNameSchema | null | undefined; - attrs?: AttrsSchema | null | undefined; - children?: ChildrenSchema | null | undefined; - text?: HasText | undefined; - formats?: Formats | undefined; - recursiveChildren?: RecursiveChildren | undefined; -}): [s.Unwrap>, s.Unwrap>, s.Unwrap>] extends [infer NodeName_1, infer Attrs_1, infer Children_1] ? s.Schema> : never; -export const $$delta: s.Schema<$Delta>; -export function _$delta | string | Array = s.Schema, AttrsSchema extends s.Schema<{ - [key: string | number]: any; -}> | { - [key: string | number]: any; -} = s.Schema<{}>, ChildrenSchema extends unknown = s.Schema, HasText extends boolean = false, Recursive extends boolean = false>({ name, attrs, children, text, recursive }: { - name?: NodeNameSchema | null | undefined; - attrs?: AttrsSchema | null | undefined; - children?: ChildrenSchema | null | undefined; - text?: HasText | undefined; - recursive?: Recursive | undefined; -}): [s.Unwrap>, s.Unwrap>, s.Unwrap>] extends [infer NodeName_1, infer Attrs_1, infer Children_1] ? s.Schema : never), HasText extends true ? string : never>> : never; -export const $deltaAny: s.Schema; -export const $deltaBuilderAny: s.Schema; -export function mergeAttrs(a: T | null, b: T | null): T | null; -export function mergeDeltas(a: D, b: D): D; -export function random(gen: prng.PRNG, $d: s.Schema>): DeltaBuilder; -/** - * @overload - * @return {DeltaBuilder<{}>} - */ -export function create(): DeltaBuilder<{}>; -/** - * @template {string} NodeName - * @overload - * @param {NodeName} nodeName - * @return {DeltaBuilder<{ name: NodeName }>} - */ -export function create(nodeName: NodeName): DeltaBuilder<{ - name: NodeName; -}>; -/** - * @template {string} NodeName - * @template {s.Schema} Schema - * @overload - * @param {NodeName} nodeName - * @param {Schema} schema - * @return {Schema extends s.Schema> ? DeltaBuilder> : never} - */ -export function create>(nodeName: NodeName, schema: Schema): Schema extends s.Schema> ? DeltaBuilder> : never; -/** - * @template {s.Schema} Schema - * @overload - * @param {Schema} schema - * @return {Schema extends s.Schema> ? DeltaBuilder> : never} - */ -export function create>(schema: Schema): Schema extends s.Schema> ? DeltaBuilder> : never; -/** - * @template {string|null} NodeName - * @template {{[k:string|number]:any}|null} Attrs - * @template {Array|string} [Children=never] - * @overload - * @param {NodeName} nodeName - * @param {Attrs} attrs - * @param {Children} [children] - * @return {DeltaBuilder<{ - * name: NodeName, - * attrs: Attrs extends null ? {} : Attrs, - * children: Extract> extends Array ? (unknown extends Ac ? never : Ac) : never, - * text: Extract extends never ? false : true - * }>} - */ -export function create | string = never>(nodeName: NodeName, attrs: Attrs, children?: Children | undefined): DeltaBuilder<{ - name: NodeName; - attrs: Attrs extends null ? {} : Attrs; - children: Extract> extends Array ? (unknown extends Ac ? never : Ac) : never; - text: Extract extends never ? false : true; -}>; -export function diff(d1: Delta, d2: NoInfer>): DeltaBuilder; -export type Attribution = { - insert?: string[]; - insertAt?: number; - delete?: string[]; - deleteAt?: number; - format?: Record; - formatAt?: number; -}; -export type FormattingAttributes = { - [key: string]: any; -}; -export type DeltaJSON = { - type: "delta"; - name?: string; - attrs?: { [Key in string | number]: DeltaAttrOpJSON; }; - children?: Array; -}; -export type DeltaListOpJSON = { - type: "insert"; - insert: string | Array; - format?: { - [key: string]: any; - }; - attribution?: Attribution; -} | { - delete: number; -} | { - type: "retain"; - retain: number; - format?: { - [key: string]: any; - }; - attribution?: Attribution; -} | { - type: "modify"; - value: object; -}; -export type DeltaAttrOpJSON = { - type: "insert"; - value: any; - prevValue?: any; - attribution?: Attribution; -} | { - type: "delete"; - prevValue?: any; - attribution?: Attribution; -} | { - type: "modify"; - value: DeltaJSON; -}; -export type ChildrenOpAny = TextOp | InsertOp | DeleteOp | RetainOp | ModifyOp; -export type AttrOpAny = SetAttrOp | DeleteAttrOp | ModifyAttrOp; -export type _OpAny = ChildrenOpAny | AttrOpAny; -export type AddToAttrs = { [K in (Key | keyof Attrs_1)]: (unknown extends Attrs_1[K] ? never : Attrs_1[K]) | (Key extends K ? Val : never); }; -export type MergeAttrs = { [K in (keyof NewAttrs | keyof Attrs_1)]: (unknown extends Attrs_1[K] ? never : Attrs_1[K]) | (unknown extends NewAttrs[K] ? never : NewAttrs[K]); }; -export type DeltaAny = Delta; -export type DeltaBuilderAny = DeltaBuilder; -export type DeltaConf = { - name?: string | undefined; - children?: fingerprintTrait.Fingerprintable; - text?: boolean | undefined; - attrs?: { - [K: string]: fingerprintTrait.Fingerprintable; - [K: number]: fingerprintTrait.Fingerprintable; - } | undefined; - fixed?: boolean | undefined; - recursiveChildren?: boolean | undefined; - recursiveAttrs?: boolean | undefined; -}; -export type DeltaConfGetName = DConf extends { - name: infer Name; -} ? (unknown extends Name ? any : (Exclude)) : any; -export type DeltaConfGetChildren = (DConf extends { - children: infer Children_1; -} ? (unknown extends Children_1 ? any : Children_1) : never) | (DConf extends { - recursiveChildren: true; -} ? Delta : never); -export type DeltaConfGetAllowedChildren = DConf extends { - fixed: true; -} ? DeltaConfGetChildren : any; -export type DeltaConfGetText = 0 extends (1 & DConf) ? string : (DConf extends { - text: true; -} ? string : never); -export type DeltaConfGetAttrs = import("../ts.js").TypeIsAny; -export type DeltaConfGetAllowedAttrs = DConf extends { - fixed: true; -} ? DeltaConfGetAttrs : { - [K: string | number]: any; -}; -export type DeltaConfGetFixed = 0 extends (1 & DConf) ? true : (DConf extends { - fixed: true; -} ? true : false); -export type DeltaConfGetRecursiveChildren = DConf extends { - recursiveChildren: true; -} ? true : false; -export type DeltaConfigGetRecursiveAttrs = DConf extends { - recursiveAttrs: true; -} ? true : false; -/** - * Transform Delta(Builder) to a normal delta. - */ -export type _SanifyDelta = V extends never ? never : (import("../ts.js").TypeIsAny ? Delta : V>); -export type PrettifyDeltaConf = import("../ts.js").Prettify<{ [K in keyof DConf]: K extends "attrs" ? import("../ts.js").Prettify<{ [KA in keyof DConf[K]]: _SanifyDelta; }, 1> : (K extends "children" ? _SanifyDelta : DConf[K]); }, 1>; -export type DeltaConfOverwrite = import("../ts.js").TypeIsAny>; -export type qq = string extends never ? true : false; -import * as s from '../schema.js'; -import * as list from '../list.js'; -import * as equalityTrait from '../trait/equality.js'; -import * as fingerprintTrait from '../trait/fingerprint.js'; -/** - * @template {{[Key in string|number]: any}} Attrs - * @template {string|number} Key - * @template {any} Val - * @typedef {{ [K in (Key | keyof Attrs)]: (unknown extends Attrs[K] ? never : Attrs[K]) | (Key extends K ? Val : never) }} AddToAttrs - */ -/** - * @template {{[Key in string|number|symbol]: any}} Attrs - * @template {{[Key in string|number|symbol]: any}} NewAttrs - * @typedef {{ [K in (keyof NewAttrs | keyof Attrs)]: (unknown extends Attrs[K] ? never : Attrs[K]) | (unknown extends NewAttrs[K] ? never : NewAttrs[K]) }} MergeAttrs - */ -/** - * @typedef {Delta} DeltaAny - */ -/** - * @typedef {DeltaBuilder} DeltaBuilderAny - */ -/** - * @typedef {object} DeltaConf - * @property {string} [DeltaConf.name] - * @property {fingerprintTrait.Fingerprintable} [DeltaConf.children=never] - * @property {boolean} [DeltaConf.text=never] - * @property {{[K:string|number]:fingerprintTrait.Fingerprintable}} [DeltaConf.attrs={}] - * @property {boolean} [DeltaConf.fixed=never] - * @property {boolean} [DeltaConf.recursiveChildren=false] - * @property {boolean} [DeltaConf.recursiveAttrs=false] - */ -/** - * @template {DeltaConf} DConf - * @typedef {DConf extends {name:infer Name} ? (unknown extends Name ? any : (Exclude)) : any} DeltaConfGetName - */ -/** - * @template {DeltaConf} DConf - * @typedef {(DConf extends {children:infer Children} ? (unknown extends Children ? any : Children) : never) | (DConf extends {recursiveChildren:true} ? Delta : never)} DeltaConfGetChildren - */ -/** - * @template {DeltaConf} DConf - * @typedef {DConf extends {fixed:true} ? DeltaConfGetChildren : any } DeltaConfGetAllowedChildren - */ -/** - * @template {DeltaConf} DConf - * @typedef {0 extends (1 & DConf) ? string : (DConf extends {text:true} ? string : never)} DeltaConfGetText - */ -/** - * @template {DeltaConf} DConf - * @typedef {import('../ts.js').TypeIsAny} DeltaConfGetAttrs - */ -/** - * @template {DeltaConf} DConf - * @typedef {DConf extends {fixed:true} ? DeltaConfGetAttrs : {[K:string|number]:any}} DeltaConfGetAllowedAttrs - */ -/** - * @template {DeltaConf} DConf - * @typedef {0 extends (1 & DConf) ? true : (DConf extends { fixed: true } ? true : false)} DeltaConfGetFixed - */ -/** - * @template {DeltaConf} DConf - * @typedef {DConf extends {recursiveChildren:true} ? true : false} DeltaConfGetRecursiveChildren - */ -/** - * @template {DeltaConf} DConf - * @typedef {DConf extends {recursiveAttrs:true} ? true : false} DeltaConfigGetRecursiveAttrs - */ -/** - * Transform Delta(Builder) to a normal delta. - * - * @template V - * @typedef {V extends never ? never : (import('../ts.js').TypeIsAny ? Delta : V>)} _SanifyDelta - */ -/** - * @template {DeltaConf} DConf - * @typedef {import('../ts.js').Prettify<{[K in keyof DConf]: K extends 'attrs' ? import('../ts.js').Prettify<{ [KA in keyof DConf[K]]: _SanifyDelta },1> : (K extends 'children' ? _SanifyDelta : DConf[K]) }, 1>} PrettifyDeltaConf - */ -/** - * @template {DeltaConf} D1 - * @template {DeltaConf} D2 - * @typedef {import('../ts.js').TypeIsAny>} DeltaConfOverwrite - */ -/** - * @template {string} Name - * @template {{[K in string|number]:any}} Attrs - * @template Children - * @template {boolean} Text - */ -declare class DeltaData { - /** - * @param {string?} name - * @param {s.Schema>?} $schema - */ - constructor(name: string | null, $schema: s.Schema> | null); - name: Name; - $schema: s.Schema> | null; - /** - * @type {{ [K in keyof Attrs]?: K extends string|number ? (SetAttrOp|DeleteAttrOp|(Attrs[K] extends never ? never : (Attrs[K] extends Delta ? ModifyAttrOp,K> : never))) : never } - * & { [Symbol.iterator]: () => Iterator<{ [K in keyof Attrs]: K extends string|number ? (SetAttrOp|DeleteAttrOp|(Attrs[K] extends never ? never : (Delta extends Attrs[K] ? ModifyAttrOp,K> : never))) : never }[keyof Attrs]> } - * } - */ - attrs: { [K in keyof Attrs]?: K extends string | number ? (SetAttrOp | DeleteAttrOp | (Attrs[K] extends never ? never : (Attrs[K] extends Delta ? ModifyAttrOp, K> : never))) : never; } & { - [Symbol.iterator]: () => Iterator<{ [K in keyof Attrs]: K extends string | number ? (SetAttrOp | DeleteAttrOp | (Attrs[K] extends never ? never : (Delta extends Attrs[K] ? ModifyAttrOp, K> : never))) : never; }[keyof Attrs]>; - }; - /** - * @type {list.List< - * | (Text extends true ? (RetainOp|TextOp|DeleteOp) : never) - * | (RetainOp|InsertOp|DeleteOp|(Delta extends Children ? ModifyOp> : never)) - * >} - */ - children: list.List<(Text extends true ? (RetainOp | TextOp | DeleteOp) : never) | (RetainOp | InsertOp | DeleteOp | (Delta extends Children ? ModifyOp> : never))>; - childCnt: number; - /** - * @type {any} - */ - origin: any; - /** - * @type {string|null} - */ - _fingerprint: string | null; - isDone: boolean; -} -import * as prng from '../prng.js'; -export {}; -//# sourceMappingURL=delta.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/delta/delta.d.ts.map b/yjs-poll/node_modules/lib0/types/delta/delta.d.ts.map deleted file mode 100644 index 15c7fbc..0000000 --- a/yjs-poll/node_modules/lib0/types/delta/delta.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"delta.d.ts","sourceRoot":"","sources":["../../src/delta/delta.js"],"names":[],"mappings":"AAyBA;;;;;;;;;GASG;AAEH;;GAEG;AACH,2BAFU,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAS1B;AAEL;;GAEG;AAEH;;;;;;;GAOG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AACH,kCAFU,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAM/B;AAeJ;IACE;;;;OAIG;IACH,oBAJW,MAAM,UACN,oBAAoB,GAAC,IAAI,eACzB,WAAW,OAAC,EAoBtB;IAfC;;;OAGG;IACH,iBAFU,MAAM,CAEI;IACpB;;;OAGG;IACH,iBAFU,oBAAoB,GAAC,IAAI,CAEf;IACpB,gCAA8B;IAC9B;;OAEG;IACH,cAFU,MAAM,OAAC,CAEO;IAG1B,8BAEC;IAED;;OAEG;IACH,sBAFW,MAAM,QAMhB;IAED;;OAEG;IACH,YAFY,QAAQ,CAInB;IAED,qBAEC;IAED,0BAMC;IAED;;;;;OAKG;IACH,gBAHW,MAAM,OACN,MAAM,QAOhB;IAED;;OAEG;IACH,UAFY,eAAe,CAK1B;IASD;;OAEG;IACH,qCAFY,MAAM,CAIjB;IAZD;;OAEG;IACH,2CAFW,MAAM,WAIhB;CAQF;AAED;;GAEG;AACH,sBAFmB,YAAY;IAG7B;;;;OAIG;IACH,oBAJW,KAAK,CAAC,YAAY,CAAC,UACnB,oBAAoB,GAAC,IAAI,eACzB,WAAW,OAAC,EAuBtB;I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GAAE,GACxN;QAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,QAAQ,CAAC,GAAG,CAAC,IAAI,MAAM,KAAK,GAAG,CAAC,SAAS,MAAM,GAAC,MAAM,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,GAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,GAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,GAAG,CAAC,KAAK,SAAS,KAAK,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC,KAAK,CAAC,EAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,GAAE,CAAC,MAAM,KAAK,CAAC,CAAC,CAAA;KAAE,CASrR;IAEF;;;;;OAKG;IACH,UALU,IAAI,CAAC,IAAI,CACZ,CAAC,IAAI,SAAS,IAAI,GAAG,CAAC,QAAQ,GAAC,MAAM,GAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,GAC7D,CAAC,QAAQ,GAAC,QAAQ,CAAC,QAAQ,CAAC,GAAC,QAAQ,CAAC,GAAG,CAAC,GAAC,CAAC,KAAK,SAAS,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAC,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CACnH,CAE8C;IAClD,iBAAiB;IACjB;;OAEG;IACH,QAFU,GAAG,CAEK;IAClB;;OAEG;IACH,cAFU,MAAM,GAAC,IAAI,CAEG;IACxB,gBAAmB;CAEtB;sBAn+BqB,YAAY"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/delta/t3.test.d.ts b/yjs-poll/node_modules/lib0/types/delta/t3.test.d.ts deleted file mode 100644 index b449d55..0000000 --- a/yjs-poll/node_modules/lib0/types/delta/t3.test.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -export function transformResult(a: DeltaA, b: DeltaB): TransformResult; -export const transformResultEmpty: TransformResult; -export type TransformResult = { - a: DeltaA | null; - b: DeltaB | null; -}; -export type DeltaTransformer = (t: { - a: DeltaA | null; - b: DeltaB | null; -}) => ({ - a: DeltaA | null; - b: DeltaB | null; -}); -export type Transform = { - applyA: (da: DeltaA) => TransformResult; - applyB: (db: DeltaB) => TransformResult; -}; -import * as delta from './delta.js'; -//# sourceMappingURL=t3.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/delta/t3.test.d.ts.map b/yjs-poll/node_modules/lib0/types/delta/t3.test.d.ts.map deleted file mode 100644 index 3c79a75..0000000 --- a/yjs-poll/node_modules/lib0/types/delta/t3.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"t3.test.d.ts","sourceRoot":"","sources":["../../src/delta/t3.test.js"],"names":[],"mappings":"AAoBO,gCAN4B,MAAM,SAA3B,KAAK,CAAC,YAAY,OAAE,EACC,MAAM,SAA3B,KAAK,CAAC,YAAY,OAAE,KACvB,MAAM,KACN,MAAM,GACL,eAAe,CAAC,MAAM,OAAC,EAAC,MAAM,OAAC,CAAC,CAEO;AACnD,+DAA+D;4BAbnC,MAAM,SAApB,KAAK,CAAC,KAAK,OAAE,EACC,MAAM,SAApB,KAAK,CAAC,KAAK,OAAE,IACd;IAAE,CAAC,EAAE,MAAM,OAAC,CAAC;IAAC,CAAC,EAAE,MAAM,OAAC,CAAA;CAAE;6BAiBT,MAAM,SAAtB,KAAK,CAAC,QAAS,EACC,MAAM,SAAtB,KAAK,CAAC,QAAS,IAChB,CAAC,CAAC,EAAC;IAAC,CAAC,EAAC,MAAM,OAAC,CAAC;IAAA,CAAC,EAAC,MAAM,OAAC,CAAA;CAAC,KAAG,CAAC;IAAC,CAAC,EAAC,MAAM,OAAC,CAAC;IAAA,CAAC,EAAC,MAAM,OAAC,CAAA;CAAC,CAAC;sBA2GpC,MAAM,SAAnB,KAAK,CAAC,KAAM,EACC,MAAM,SAAnB,KAAK,CAAC,KAAM,IACb;IAAE,MAAM,EAAE,CAAC,EAAE,EAAC,MAAM,KAAG,eAAe,CAAC,MAAM,EAAC,MAAM,CAAC,CAAC;IAAC,MAAM,EAAE,CAAC,EAAE,EAAC,MAAM,KAAG,eAAe,CAAC,MAAM,EAAC,MAAM,CAAC,CAAA;CAAE;uBAvIlG,YAAY"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/diff/patience.d.ts b/yjs-poll/node_modules/lib0/types/diff/patience.d.ts deleted file mode 100644 index bb84468..0000000 --- a/yjs-poll/node_modules/lib0/types/diff/patience.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -export function diff(as: Array, bs: Array): Array<{ - index: number; - remove: Array; - insert: Array; -}>; -export function diffSplitBy(a: string, b: string, _regexp: RegExp | string): { - index: number; - remove: string; - insert: string; -}[]; -export function diffAuto(a: string, b: string): { - insert: string; - remove: string; - index: number; -}[]; -//# sourceMappingURL=patience.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/diff/patience.d.ts.map b/yjs-poll/node_modules/lib0/types/diff/patience.d.ts.map deleted file mode 100644 index 1ce1063..0000000 --- a/yjs-poll/node_modules/lib0/types/diff/patience.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"patience.d.ts","sourceRoot":"","sources":["../../src/diff/patience.js"],"names":[],"mappings":"AAoBO,yBAJI,KAAK,CAAC,MAAM,CAAC,MACb,KAAK,CAAC,MAAM,CAAC,GACZ,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CAAC,CAAC,CAShF;AAOM,+BAJI,MAAM,KACN,MAAM,WACN,MAAM,GAAC,MAAM;;;;IAqBvB;AAWM,4BAHI,MAAM,KACN,MAAM;;;;IASP"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/hash/rabin-gf2-polynomial.d.ts b/yjs-poll/node_modules/lib0/types/hash/rabin-gf2-polynomial.d.ts deleted file mode 100644 index d6d03d6..0000000 --- a/yjs-poll/node_modules/lib0/types/hash/rabin-gf2-polynomial.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * This is a GF2 Polynomial abstraction that is not meant for production! - * - * It is easy to understand and it's correctness is as obvious as possible. It can be used to verify - * efficient implementations of algorithms on GF2. - */ -export class GF2Polynomial { - /** - * @type {Set} - */ - degrees: Set; -} -export function createFromBytes(bytes: Uint8Array): GF2Polynomial; -export function toUint8Array(p: GF2Polynomial, byteLength?: number): Uint8Array; -export function createFromUint(uint: number): GF2Polynomial; -export function createRandom(degree: number): GF2Polynomial; -export function getHighestDegree(p: GF2Polynomial): number; -export function addInto(p1: GF2Polynomial, p2: GF2Polynomial): void; -export function orInto(p1: GF2Polynomial, p2: GF2Polynomial): void; -export function add(p1: GF2Polynomial, p2: GF2Polynomial): GF2Polynomial; -export function clone(p: GF2Polynomial): GF2Polynomial; -export function addDegreeInto(p: GF2Polynomial, degree: number): void; -export function multiply(p1: GF2Polynomial, p2: GF2Polynomial): GF2Polynomial; -export function shiftLeft(p: GF2Polynomial, shift: number): GF2Polynomial; -export function mod(p1: GF2Polynomial, p2: GF2Polynomial): GF2Polynomial; -export function modPow(p: GF2Polynomial, e: number, m: GF2Polynomial): GF2Polynomial; -export function gcd(p1: GF2Polynomial, p2: GF2Polynomial): GF2Polynomial; -export function equals(p1: GF2Polynomial, p2: GF2Polynomial): boolean; -export function isIrreducibleBenOr(p: GF2Polynomial): boolean; -export function createIrreducible(degree: number): GF2Polynomial; -export function fingerprint(buf: Uint8Array, m: GF2Polynomial): Uint8Array; -export class RabinPolynomialEncoder { - /** - * @param {GF2Polynomial} m The irreducible polynomial - */ - constructor(m: GF2Polynomial); - fingerprint: GF2Polynomial; - m: GF2Polynomial; - /** - * @param {number} b - */ - write(b: number): void; - getFingerprint(): Uint8Array; -} -//# sourceMappingURL=rabin-gf2-polynomial.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/hash/rabin-gf2-polynomial.d.ts.map b/yjs-poll/node_modules/lib0/types/hash/rabin-gf2-polynomial.d.ts.map deleted file mode 100644 index 1a74de3..0000000 --- a/yjs-poll/node_modules/lib0/types/hash/rabin-gf2-polynomial.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rabin-gf2-polynomial.d.ts","sourceRoot":"","sources":["../../src/hash/rabin-gf2-polynomial.js"],"names":[],"mappings":"AAqBA;;;;;GAKG;AACH;IAEI;;QAEI;IACJ,SAFW,GAAG,CAAC,MAAM,CAAC,CAEE;CAE3B;AAOM,uCAFI,UAAU,iBAcpB;AAQM,gCAHI,aAAa,eACb,MAAM,2BAahB;AAOM,qCAFI,MAAM,iBAQhB;AAOM,qCAFI,MAAM,iBAYhB;AAMM,oCAHI,aAAa,UAG2D;AAU5E,4BAHI,aAAa,MACb,aAAa,QAUvB;AAUM,2BAHI,aAAa,MACb,aAAa,QAMvB;AAUM,wBAHI,aAAa,MACb,aAAa,iBAevB;AASM,yBAFI,aAAa,iBAMvB;AAUM,iCAHI,aAAa,UACb,MAAM,QAQhB;AAQM,6BAHI,aAAa,MACb,aAAa,iBAUvB;AAQM,6BAHI,aAAa,SACb,MAAM,iBAShB;AAQM,wBAHI,aAAa,MACb,aAAa,iBAavB;AAWM,0BAJI,aAAa,KACb,MAAM,KACN,aAAa,iBAcvB;AAQM,wBAHI,aAAa,MACb,aAAa,iBASvB;AAQM,2BAHI,aAAa,MACb,aAAa,WAQvB;AAgCM,sCAFI,aAAa,WAYvB;AAKM,0CAFI,MAAM,iBAOhB;AAQM,iCAHI,UAAU,KACV,aAAa,2BAE0G;AAElI;IACE;;OAEG;IACH,eAFW,aAAa,EAKvB;IAFC,2BAAsC;IACtC,iBAAU;IAGZ;;OAEG;IACH,SAFW,MAAM,QAOhB;IAED,0CAEC;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/hash/rabin-uncached.d.ts b/yjs-poll/node_modules/lib0/types/hash/rabin-uncached.d.ts deleted file mode 100644 index 5adc6e2..0000000 --- a/yjs-poll/node_modules/lib0/types/hash/rabin-uncached.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -export class RabinUncachedEncoder { - /** - * @param {Uint8Array} m assert(m[0] === 1) - */ - constructor(m: Uint8Array); - m: Uint8Array; - blen: number; - bs: Uint8Array; - /** - * This describes the position of the most significant byte (starts with 0 and increases with - * shift) - */ - bpos: number; - /** - * Add/Xor/Substract bytes. - * - * Discards bytes that are out of range. - * @todo put this in function or inline - * - * @param {Uint8Array} cs - */ - add(cs: Uint8Array): void; - /** - * @param {number} byte - */ - write(byte: number): void; - getFingerprint(): Uint8Array; -} -//# sourceMappingURL=rabin-uncached.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/hash/rabin-uncached.d.ts.map b/yjs-poll/node_modules/lib0/types/hash/rabin-uncached.d.ts.map deleted file mode 100644 index 0bee7a3..0000000 --- a/yjs-poll/node_modules/lib0/types/hash/rabin-uncached.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rabin-uncached.d.ts","sourceRoot":"","sources":["../../src/hash/rabin-uncached.js"],"names":[],"mappings":"AAUA;IACE;;OAEG;IACH,eAFW,UAAU,EAWpB;IARC,+BAAU;IACV,aAAwB;IACxB,4BAAmC;IACnC;;;OAGG;IACH,aAAa;IAGf;;;;;;;OAOG;IACH,QAFW,UAAU,QAQpB;IAED;;OAEG;IACH,YAFW,MAAM,QAgBhB;IAED,0CAMC;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/hash/rabin.d.ts b/yjs-poll/node_modules/lib0/types/hash/rabin.d.ts deleted file mode 100644 index cd3061a..0000000 --- a/yjs-poll/node_modules/lib0/types/hash/rabin.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -export const StandardIrreducible8: Uint8Array; -export const StandardIrreducible16: Uint8Array; -export const StandardIrreducible32: Uint8Array; -export const StandardIrreducible64: Uint8Array; -export const StandardIrreducible128: Uint8Array; -export class RabinEncoder { - /** - * @param {Uint8Array} m assert(m[0] === 1) - */ - constructor(m: Uint8Array); - m: Uint8Array; - blen: number; - bs: Uint8Array; - cache: Uint8Array; - /** - * This describes the position of the most significant byte (starts with 0 and increases with - * shift) - */ - bpos: number; - /** - * @param {number} byte - */ - write(byte: number): void; - getFingerprint(): Uint8Array; -} -export function fingerprint(irreducible: Uint8Array, data: Uint8Array): Uint8Array; -//# sourceMappingURL=rabin.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/hash/rabin.d.ts.map b/yjs-poll/node_modules/lib0/types/hash/rabin.d.ts.map deleted file mode 100644 index 18504b6..0000000 --- a/yjs-poll/node_modules/lib0/types/hash/rabin.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rabin.d.ts","sourceRoot":"","sources":["../../src/hash/rabin.js"],"names":[],"mappings":"AAUA,2DAA2E;AAC3E,4DAAiF;AACjF,4DAA2F;AAC3F,4DAA8G;AAC9G,6DAAkJ;AAmClJ;IACE;;OAEG;IACH,eAFW,UAAU,EAYpB;IATC,+BAAU;IACV,aAAwB;IACxB,4BAAmC;IACnC,+BAA2B;IAC3B;;;OAGG;IACH,aAAa;IAGf;;OAEG;IACH,YAFW,MAAM,QAYhB;IAED,0CAMC;CACF;AAMM,yCAHI,UAAU,QACV,UAAU,2BAQpB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/hash/sha256.d.ts b/yjs-poll/node_modules/lib0/types/hash/sha256.d.ts deleted file mode 100644 index b3014a7..0000000 --- a/yjs-poll/node_modules/lib0/types/hash/sha256.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export function digest(data: Uint8Array): Uint8Array; -//# sourceMappingURL=sha256.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/hash/sha256.d.ts.map b/yjs-poll/node_modules/lib0/types/hash/sha256.d.ts.map deleted file mode 100644 index 0d76cff..0000000 --- a/yjs-poll/node_modules/lib0/types/hash/sha256.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha256.d.ts","sourceRoot":"","sources":["../../src/hash/sha256.js"],"names":[],"mappings":"AA+KO,6BAFI,UAAU,2BAEkC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/hash/sha256.node.d.ts b/yjs-poll/node_modules/lib0/types/hash/sha256.node.d.ts deleted file mode 100644 index e5e6591..0000000 --- a/yjs-poll/node_modules/lib0/types/hash/sha256.node.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export function digest(data: Uint8Array): Buffer; -//# sourceMappingURL=sha256.node.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/hash/sha256.node.d.ts.map b/yjs-poll/node_modules/lib0/types/hash/sha256.node.d.ts.map deleted file mode 100644 index 9643cc2..0000000 --- a/yjs-poll/node_modules/lib0/types/hash/sha256.node.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha256.node.d.ts","sourceRoot":"","sources":["../../src/hash/sha256.node.js"],"names":[],"mappings":"AAKO,6BAFI,UAAU,2BAMpB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/prng/Mt19937.d.ts b/yjs-poll/node_modules/lib0/types/prng/Mt19937.d.ts deleted file mode 100644 index 8b499e0..0000000 --- a/yjs-poll/node_modules/lib0/types/prng/Mt19937.d.ts +++ /dev/null @@ -1,29 +0,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: number); - seed: number; - _state: Uint32Array; - _i: number; - /** - * Generate a random signed integer. - * - * @return {Number} A 32 bit signed integer. - */ - next(): number; -} -//# sourceMappingURL=Mt19937.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/prng/Mt19937.d.ts.map b/yjs-poll/node_modules/lib0/types/prng/Mt19937.d.ts.map deleted file mode 100644 index a44f8a8..0000000 --- a/yjs-poll/node_modules/lib0/types/prng/Mt19937.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Mt19937.d.ts","sourceRoot":"","sources":["../../src/prng/Mt19937.js"],"names":[],"mappings":"AA8BA;;;;;;;;;;;;GAYG;AACH;IACE;;OAEG;IACH,kBAFW,MAAM,EAYhB;IATC,aAAgB;IAMhB,iCAAmB;IACnB,WAAW;IAIb;;;;OAIG;IACH,eAYC;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/prng/Xoroshiro128plus.d.ts b/yjs-poll/node_modules/lib0/types/prng/Xoroshiro128plus.d.ts deleted file mode 100644 index 5f2f9fd..0000000 --- a/yjs-poll/node_modules/lib0/types/prng/Xoroshiro128plus.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * 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; - _fresh: boolean; - /** - * @return {number} Float/Double in [0,1) - */ - next(): number; -} -//# sourceMappingURL=Xoroshiro128plus.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/prng/Xoroshiro128plus.d.ts.map b/yjs-poll/node_modules/lib0/types/prng/Xoroshiro128plus.d.ts.map deleted file mode 100644 index acbed76..0000000 --- a/yjs-poll/node_modules/lib0/types/prng/Xoroshiro128plus.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Xoroshiro128plus.d.ts","sourceRoot":"","sources":["../../src/prng/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"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/prng/Xorshift32.d.ts b/yjs-poll/node_modules/lib0/types/prng/Xorshift32.d.ts deleted file mode 100644 index 436b8bc..0000000 --- a/yjs-poll/node_modules/lib0/types/prng/Xorshift32.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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 \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/prng/Xorshift32.d.ts.map b/yjs-poll/node_modules/lib0/types/prng/Xorshift32.d.ts.map deleted file mode 100644 index 46ec4e1..0000000 --- a/yjs-poll/node_modules/lib0/types/prng/Xorshift32.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Xorshift32.d.ts","sourceRoot":"","sources":["../../src/prng/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"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/trait/equality.d.ts b/yjs-poll/node_modules/lib0/types/trait/equality.d.ts deleted file mode 100644 index 1848ba1..0000000 --- a/yjs-poll/node_modules/lib0/types/trait/equality.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const EqualityTraitSymbol: unique symbol; -export function equals(a: NoInfer, b: T): boolean; -export type EqualityTrait = { - [EqualityTraitSymbol]: (other: EqualityTrait) => boolean; -}; -//# sourceMappingURL=equality.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/trait/equality.d.ts.map b/yjs-poll/node_modules/lib0/types/trait/equality.d.ts.map deleted file mode 100644 index cbe1640..0000000 --- a/yjs-poll/node_modules/lib0/types/trait/equality.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"equality.d.ts","sourceRoot":"","sources":["../../src/trait/equality.js"],"names":[],"mappings":"AAAA,gDAAqD;AAyB9C,uBALsB,CAAC,SAAhB,aAAc,KACjB,OAAO,CAAC,CAAC,CAAC,KACV,CAAC,GACA,OAAO,CAEgE;4BAtBtE;IAAE,CAAC,mBAAmB,CAAC,EAAC,CAAC,KAAK,EAAC,aAAa,KAAG,OAAO,CAAA;CAAE"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/trait/fingerprint.d.ts b/yjs-poll/node_modules/lib0/types/trait/fingerprint.d.ts deleted file mode 100644 index 1a31d75..0000000 --- a/yjs-poll/node_modules/lib0/types/trait/fingerprint.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export const FingerprintTraitSymbol: unique symbol; -export function fingerprint(a: Fingerprintable): string; -/** - * When implementing this trait, it is recommended to write some sort of "magic number" first to - * ensure that different types of objects don't have the same fingerprint. - * - * The recommended pracice is to generate a random u32 number as your magic number. e.g. using - * `console.log(random.uint32().toString(16))` - */ -export type Fingerprintable = { - [FingerprintTraitSymbol]: () => string; -} | import("../encoding.js").AnyEncodable; -//# sourceMappingURL=fingerprint.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/trait/fingerprint.d.ts.map b/yjs-poll/node_modules/lib0/types/trait/fingerprint.d.ts.map deleted file mode 100644 index 12a26f3..0000000 --- a/yjs-poll/node_modules/lib0/types/trait/fingerprint.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fingerprint.d.ts","sourceRoot":"","sources":["../../src/trait/fingerprint.js"],"names":[],"mappings":"AAIA,mDAA2D;AAgBpD,+BAHI,eAAe,GACd,MAAM,CAE6P;;;;;;;;8BAPlQ;IAAE,CAAC,sBAAsB,CAAC,EAAC,MAAI,MAAM,CAAA;CAAE,GAAG,OAAO,gBAAgB,EAAE,YAAY"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/trait/traits.d.ts b/yjs-poll/node_modules/lib0/types/trait/traits.d.ts deleted file mode 100644 index e0084f2..0000000 --- a/yjs-poll/node_modules/lib0/types/trait/traits.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./equality.js"; -export * from "./fingerprint.js"; -//# sourceMappingURL=traits.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/types/trait/traits.d.ts.map b/yjs-poll/node_modules/lib0/types/trait/traits.d.ts.map deleted file mode 100644 index 78ca7d7..0000000 --- a/yjs-poll/node_modules/lib0/types/trait/traits.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"traits.d.ts","sourceRoot":"","sources":["../../src/trait/traits.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/url.d.ts b/yjs-poll/node_modules/lib0/url.d.ts deleted file mode 100644 index ed2895c..0000000 --- a/yjs-poll/node_modules/lib0/url.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function decodeQueryParams(url: string): { - [x: string]: string; -}; -export function encodeQueryParams(params: { - [x: string]: string; -}): string; -//# sourceMappingURL=url.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/url.d.ts.map b/yjs-poll/node_modules/lib0/url.d.ts.map deleted file mode 100644 index 4339550..0000000 --- a/yjs-poll/node_modules/lib0/url.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["url.js"],"names":[],"mappings":"AAcO,uCAHI,MAAM;;EAkBhB;AAMM;;IAFK,MAAM,CAGmF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/url.js b/yjs-poll/node_modules/lib0/url.js deleted file mode 100644 index 4419820..0000000 --- a/yjs-poll/node_modules/lib0/url.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Utility module to work with urls. - * - * @module url - */ - -import * as object from './object.js' - -/** - * Parse query parameters from an url. - * - * @param {string} url - * @return {Object} - */ -export const decodeQueryParams = url => { - /** - * @type {Object} - */ - const query = {} - const urlQuerySplit = url.split('?') - const pairs = urlQuerySplit[urlQuerySplit.length - 1].split('&') - for (let i = 0; i < pairs.length; i++) { - const item = pairs[i] - if (item.length > 0) { - const pair = item.split('=') - query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || '') - } - } - return query -} - -/** - * @param {Object} params - * @return {string} - */ -export const encodeQueryParams = params => - object.map(params, (val, key) => `${encodeURIComponent(key)}=${encodeURIComponent(val)}`).join('&') diff --git a/yjs-poll/node_modules/lib0/url.test.d.ts b/yjs-poll/node_modules/lib0/url.test.d.ts deleted file mode 100644 index 027c9ee..0000000 --- a/yjs-poll/node_modules/lib0/url.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testUrlParamQuery(tc: t.TestCase): void; -import * as t from './testing.js'; -//# sourceMappingURL=url.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/url.test.d.ts.map b/yjs-poll/node_modules/lib0/url.test.d.ts.map deleted file mode 100644 index f3c3ee3..0000000 --- a/yjs-poll/node_modules/lib0/url.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"url.test.d.ts","sourceRoot":"","sources":["url.test.js"],"names":[],"mappings":"AAcO,sCAFI,CAAC,CAAC,QAAQ,QAapB;mBAzBkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/webcrypto.d.ts b/yjs-poll/node_modules/lib0/webcrypto.d.ts deleted file mode 100644 index d9e514e..0000000 --- a/yjs-poll/node_modules/lib0/webcrypto.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const subtle: SubtleCrypto; -export const getRandomValues: (array: T) => T; -//# sourceMappingURL=webcrypto.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/webcrypto.d.ts.map b/yjs-poll/node_modules/lib0/webcrypto.d.ts.map deleted file mode 100644 index b0b4611..0000000 --- a/yjs-poll/node_modules/lib0/webcrypto.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"webcrypto.d.ts","sourceRoot":"","sources":["webcrypto.js"],"names":[],"mappings":"AAEA,kCAAmC;AACnC,yEAAkE"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/webcrypto.deno.d.ts b/yjs-poll/node_modules/lib0/webcrypto.deno.d.ts deleted file mode 100644 index ec6b5e5..0000000 --- a/yjs-poll/node_modules/lib0/webcrypto.deno.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const subtle: any; -export const getRandomValues: any; -//# sourceMappingURL=webcrypto.deno.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/webcrypto.deno.d.ts.map b/yjs-poll/node_modules/lib0/webcrypto.deno.d.ts.map deleted file mode 100644 index 73ccad2..0000000 --- a/yjs-poll/node_modules/lib0/webcrypto.deno.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"webcrypto.deno.d.ts","sourceRoot":"","sources":["webcrypto.deno.js"],"names":[],"mappings":"AACA,yBAAwD;AAExD,kCAAuF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/webcrypto.deno.js b/yjs-poll/node_modules/lib0/webcrypto.deno.js deleted file mode 100644 index f94cdac..0000000 --- a/yjs-poll/node_modules/lib0/webcrypto.deno.js +++ /dev/null @@ -1,4 +0,0 @@ -// eslint-disable-next-line -export const subtle = /** @type {any} */ (crypto).subtle -// eslint-disable-next-line -export const getRandomValues = /** @type {any} */ (crypto).getRandomValues.bind(crypto) diff --git a/yjs-poll/node_modules/lib0/webcrypto.js b/yjs-poll/node_modules/lib0/webcrypto.js deleted file mode 100644 index 3849bf4..0000000 --- a/yjs-poll/node_modules/lib0/webcrypto.js +++ /dev/null @@ -1,4 +0,0 @@ -/* eslint-env browser */ - -export const subtle = crypto.subtle -export const getRandomValues = crypto.getRandomValues.bind(crypto) diff --git a/yjs-poll/node_modules/lib0/webcrypto.node.d.ts b/yjs-poll/node_modules/lib0/webcrypto.node.d.ts deleted file mode 100644 index 0026211..0000000 --- a/yjs-poll/node_modules/lib0/webcrypto.node.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const subtle: any; -export const getRandomValues: any; -//# sourceMappingURL=webcrypto.node.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/webcrypto.node.d.ts.map b/yjs-poll/node_modules/lib0/webcrypto.node.d.ts.map deleted file mode 100644 index 5e9eb92..0000000 --- a/yjs-poll/node_modules/lib0/webcrypto.node.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"webcrypto.node.d.ts","sourceRoot":"","sources":["webcrypto.node.js"],"names":[],"mappings":"AAEA,yBAA2D;AAC3D,kCAA6F"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/webcrypto.node.js b/yjs-poll/node_modules/lib0/webcrypto.node.js deleted file mode 100644 index f37a100..0000000 --- a/yjs-poll/node_modules/lib0/webcrypto.node.js +++ /dev/null @@ -1,4 +0,0 @@ -import { webcrypto } from 'node:crypto' - -export const subtle = /** @type {any} */ (webcrypto).subtle -export const getRandomValues = /** @type {any} */ (webcrypto).getRandomValues.bind(webcrypto) diff --git a/yjs-poll/node_modules/lib0/webcrypto.react-native.d.ts b/yjs-poll/node_modules/lib0/webcrypto.react-native.d.ts deleted file mode 100644 index 59dad39..0000000 --- a/yjs-poll/node_modules/lib0/webcrypto.react-native.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const subtle: any; -export const getRandomValues: any; -//# sourceMappingURL=webcrypto.react-native.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/webcrypto.react-native.d.ts.map b/yjs-poll/node_modules/lib0/webcrypto.react-native.d.ts.map deleted file mode 100644 index ae97c73..0000000 --- a/yjs-poll/node_modules/lib0/webcrypto.react-native.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"webcrypto.react-native.d.ts","sourceRoot":"","sources":["webcrypto.react-native.js"],"names":[],"mappings":"AAKA,yBAAsC;AACtC,kCAAwE"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/webcrypto.react-native.js b/yjs-poll/node_modules/lib0/webcrypto.react-native.js deleted file mode 100644 index b16091a..0000000 --- a/yjs-poll/node_modules/lib0/webcrypto.react-native.js +++ /dev/null @@ -1,7 +0,0 @@ -// @ts-ignore -import webcrypto from 'isomorphic-webcrypto/src/react-native' - -webcrypto.ensureSecure() - -export const subtle = webcrypto.subtle -export const getRandomValues = webcrypto.getRandomValues.bind(webcrypto) diff --git a/yjs-poll/node_modules/lib0/websocket.d.ts b/yjs-poll/node_modules/lib0/websocket.d.ts deleted file mode 100644 index 7adeac1..0000000 --- a/yjs-poll/node_modules/lib0/websocket.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @deprecated - * @extends Observable - */ -export class WebsocketClient extends Observable { - /** - * @param {string} url - * @param {object} opts - * @param {'arraybuffer' | 'blob' | null} [opts.binaryType] Set `ws.binaryType` - */ - constructor(url: string, { binaryType }?: { - binaryType?: "arraybuffer" | "blob" | null | undefined; - }); - url: string; - /** - * @type {WebSocket?} - */ - ws: WebSocket | null; - binaryType: "arraybuffer" | "blob" | null; - connected: boolean; - connecting: boolean; - unsuccessfulReconnects: number; - lastMessageReceived: number; - /** - * Whether to connect to other peers or not - * @type {boolean} - */ - shouldConnect: boolean; - _checkInterval: NodeJS.Timeout; - /** - * @param {any} message - */ - send(message: any): void; - disconnect(): void; - connect(): void; -} -import { Observable } from './observable.js'; -//# sourceMappingURL=websocket.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/websocket.d.ts.map b/yjs-poll/node_modules/lib0/websocket.d.ts.map deleted file mode 100644 index 7c2fce6..0000000 --- a/yjs-poll/node_modules/lib0/websocket.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["websocket.js"],"names":[],"mappings":"AAwFA;;;GAGG;AACH;IACE;;;;OAIG;IACH,iBAJW,MAAM,mBAEd;QAA6C,UAAU;KACzD,EA0BA;IAvBC,YAAc;IACd;;OAEG;IACH,IAFU,SAAS,OAAC,CAEN;IACd,0CAAoC;IACpC,mBAAsB;IACtB,oBAAuB;IACvB,+BAA+B;IAC/B,4BAA4B;IAC5B;;;OAGG;IACH,eAFU,OAAO,CAEQ;IACzB,+BAM+B;IAIjC;;OAEG;IACH,cAFW,GAAG,QAMb;IAQD,mBAKC;IAED,gBAKC;CACF;2BA/I0B,iBAAiB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/lib0/websocket.js b/yjs-poll/node_modules/lib0/websocket.js deleted file mode 100644 index 8ce1e8f..0000000 --- a/yjs-poll/node_modules/lib0/websocket.js +++ /dev/null @@ -1,154 +0,0 @@ -/* eslint-env browser */ - -/** - * Tiny websocket connection handler. - * - * Implements exponential backoff reconnects, ping/pong, and a nice event system using [lib0/observable]. - * - * @module websocket - */ - -import { Observable } from './observable.js' -import * as time from './time.js' -import * as math from './math.js' - -const reconnectTimeoutBase = 1200 -const maxReconnectTimeout = 2500 -// @todo - this should depend on awareness.outdatedTime -const messageReconnectTimeout = 30000 - -/** - * @param {WebsocketClient} wsclient - */ -const setupWS = (wsclient) => { - if (wsclient.shouldConnect && wsclient.ws === null) { - const websocket = new WebSocket(wsclient.url) - const binaryType = wsclient.binaryType - /** - * @type {any} - */ - let pingTimeout = null - if (binaryType) { - websocket.binaryType = binaryType - } - wsclient.ws = websocket - wsclient.connecting = true - wsclient.connected = false - websocket.onmessage = event => { - wsclient.lastMessageReceived = time.getUnixTime() - const data = event.data - const message = typeof data === 'string' ? JSON.parse(data) : data - if (message && message.type === 'pong') { - clearTimeout(pingTimeout) - pingTimeout = setTimeout(sendPing, messageReconnectTimeout / 2) - } - wsclient.emit('message', [message, wsclient]) - } - /** - * @param {any} error - */ - const onclose = error => { - if (wsclient.ws !== null) { - wsclient.ws = null - wsclient.connecting = false - if (wsclient.connected) { - wsclient.connected = false - wsclient.emit('disconnect', [{ type: 'disconnect', error }, wsclient]) - } else { - wsclient.unsuccessfulReconnects++ - } - // Start with no reconnect timeout and increase timeout by - // log10(wsUnsuccessfulReconnects). - // The idea is to increase reconnect timeout slowly and have no reconnect - // timeout at the beginning (log(1) = 0) - setTimeout(setupWS, math.min(math.log10(wsclient.unsuccessfulReconnects + 1) * reconnectTimeoutBase, maxReconnectTimeout), wsclient) - } - clearTimeout(pingTimeout) - } - const sendPing = () => { - if (wsclient.ws === websocket) { - wsclient.send({ - type: 'ping' - }) - } - } - websocket.onclose = () => onclose(null) - websocket.onerror = error => onclose(error) - websocket.onopen = () => { - wsclient.lastMessageReceived = time.getUnixTime() - wsclient.connecting = false - wsclient.connected = true - wsclient.unsuccessfulReconnects = 0 - wsclient.emit('connect', [{ type: 'connect' }, wsclient]) - // set ping - pingTimeout = setTimeout(sendPing, messageReconnectTimeout / 2) - } - } -} - -/** - * @deprecated - * @extends Observable - */ -export class WebsocketClient extends Observable { - /** - * @param {string} url - * @param {object} opts - * @param {'arraybuffer' | 'blob' | null} [opts.binaryType] Set `ws.binaryType` - */ - constructor (url, { binaryType } = {}) { - super() - this.url = url - /** - * @type {WebSocket?} - */ - this.ws = null - this.binaryType = binaryType || null - this.connected = false - this.connecting = false - this.unsuccessfulReconnects = 0 - this.lastMessageReceived = 0 - /** - * Whether to connect to other peers or not - * @type {boolean} - */ - this.shouldConnect = true - this._checkInterval = setInterval(() => { - if (this.connected && messageReconnectTimeout < time.getUnixTime() - this.lastMessageReceived) { - // no message received in a long time - not even your own awareness - // updates (which are updated every 15 seconds) - /** @type {WebSocket} */ (this.ws).close() - } - }, messageReconnectTimeout / 2) - setupWS(this) - } - - /** - * @param {any} message - */ - send (message) { - if (this.ws) { - this.ws.send(JSON.stringify(message)) - } - } - - destroy () { - clearInterval(this._checkInterval) - this.disconnect() - super.destroy() - } - - disconnect () { - this.shouldConnect = false - if (this.ws !== null) { - this.ws.close() - } - } - - connect () { - this.shouldConnect = true - if (!this.connected && this.ws === null) { - setupWS(this) - } - } -} diff --git a/yjs-poll/node_modules/ws/LICENSE b/yjs-poll/node_modules/ws/LICENSE deleted file mode 100644 index 1da5b96..0000000 --- a/yjs-poll/node_modules/ws/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2011 Einar Otto Stangvik -Copyright (c) 2013 Arnout Kazemier and contributors -Copyright (c) 2016 Luigi Pinca and contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/yjs-poll/node_modules/ws/README.md b/yjs-poll/node_modules/ws/README.md deleted file mode 100644 index 21f10df..0000000 --- a/yjs-poll/node_modules/ws/README.md +++ /dev/null @@ -1,548 +0,0 @@ -# ws: a Node.js WebSocket library - -[![Version npm](https://img.shields.io/npm/v/ws.svg?logo=npm)](https://www.npmjs.com/package/ws) -[![CI](https://img.shields.io/github/actions/workflow/status/websockets/ws/ci.yml?branch=master&label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster) -[![Coverage Status](https://img.shields.io/coveralls/websockets/ws/master.svg?logo=coveralls)](https://coveralls.io/github/websockets/ws) - -ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and -server implementation. - -Passes the quite extensive Autobahn test suite: [server][server-report], -[client][client-report]. - -**Note**: This module does not work in the browser. The client in the docs is a -reference to a backend with the role of a client in the WebSocket communication. -Browser clients must use the native -[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) -object. To make the same code work seamlessly on Node.js and the browser, you -can use one of the many wrappers available on npm, like -[isomorphic-ws](https://github.com/heineiuo/isomorphic-ws). - -## Table of Contents - -- [Protocol support](#protocol-support) -- [Installing](#installing) - - [Opt-in for performance](#opt-in-for-performance) - - [Legacy opt-in for performance](#legacy-opt-in-for-performance) -- [API docs](#api-docs) -- [WebSocket compression](#websocket-compression) -- [Usage examples](#usage-examples) - - [Sending and receiving text data](#sending-and-receiving-text-data) - - [Sending binary data](#sending-binary-data) - - [Simple server](#simple-server) - - [External HTTP/S server](#external-https-server) - - [Multiple servers sharing a single HTTP/S server](#multiple-servers-sharing-a-single-https-server) - - [Client authentication](#client-authentication) - - [Server broadcast](#server-broadcast) - - [Round-trip time](#round-trip-time) - - [Use the Node.js streams API](#use-the-nodejs-streams-api) - - [Other examples](#other-examples) -- [FAQ](#faq) - - [How to get the IP address of the client?](#how-to-get-the-ip-address-of-the-client) - - [How to detect and close broken connections?](#how-to-detect-and-close-broken-connections) - - [How to connect via a proxy?](#how-to-connect-via-a-proxy) -- [Changelog](#changelog) -- [License](#license) - -## Protocol support - -- **HyBi drafts 07-12** (Use the option `protocolVersion: 8`) -- **HyBi drafts 13-17** (Current default, alternatively option - `protocolVersion: 13`) - -## Installing - -``` -npm install ws -``` - -### Opt-in for performance - -[bufferutil][] is an optional module that can be installed alongside the ws -module: - -``` -npm install --save-optional bufferutil -``` - -This is a binary addon that improves the performance of certain operations such -as masking and unmasking the data payload of the WebSocket frames. Prebuilt -binaries are available for the most popular platforms, so you don't necessarily -need to have a C++ compiler installed on your machine. - -To force ws to not use bufferutil, use the -[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) environment variable. This -can be useful to enhance security in systems where a user can put a package in -the package search path of an application of another user, due to how the -Node.js resolver algorithm works. - -#### Legacy opt-in for performance - -If you are running on an old version of Node.js (prior to v18.14.0), ws also -supports the [utf-8-validate][] module: - -``` -npm install --save-optional utf-8-validate -``` - -This contains a binary polyfill for [`buffer.isUtf8()`][]. - -To force ws not to use utf-8-validate, use the -[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment variable. - -## API docs - -See [`/doc/ws.md`](./doc/ws.md) for Node.js-like documentation of ws classes and -utility functions. - -## WebSocket compression - -ws supports the [permessage-deflate extension][permessage-deflate] which enables -the client and server to negotiate a compression algorithm and its parameters, -and then selectively apply it to the data payloads of each WebSocket message. - -The extension is disabled by default on the server and enabled by default on the -client. It adds a significant overhead in terms of performance and memory -consumption so we suggest to enable it only if it is really needed. - -Note that Node.js has a variety of issues with high-performance compression, -where increased concurrency, especially on Linux, can lead to [catastrophic -memory fragmentation][node-zlib-bug] and slow performance. If you intend to use -permessage-deflate in production, it is worthwhile to set up a test -representative of your workload and ensure Node.js/zlib will handle it with -acceptable performance and memory usage. - -Tuning of permessage-deflate can be done via the options defined below. You can -also use `zlibDeflateOptions` and `zlibInflateOptions`, which is passed directly -into the creation of [raw deflate/inflate streams][node-zlib-deflaterawdocs]. - -See [the docs][ws-server-options] for more options. - -```js -import WebSocket, { WebSocketServer } from 'ws'; - -const wss = new WebSocketServer({ - port: 8080, - perMessageDeflate: { - zlibDeflateOptions: { - // See zlib defaults. - chunkSize: 1024, - memLevel: 7, - level: 3 - }, - zlibInflateOptions: { - chunkSize: 10 * 1024 - }, - // Other options settable: - clientNoContextTakeover: true, // Defaults to negotiated value. - serverNoContextTakeover: true, // Defaults to negotiated value. - serverMaxWindowBits: 10, // Defaults to negotiated value. - // Below options specified as default values. - concurrencyLimit: 10, // Limits zlib concurrency for perf. - threshold: 1024 // Size (in bytes) below which messages - // should not be compressed if context takeover is disabled. - } -}); -``` - -The client will only use the extension if it is supported and enabled on the -server. To always disable the extension on the client, set the -`perMessageDeflate` option to `false`. - -```js -import WebSocket from 'ws'; - -const ws = new WebSocket('ws://www.host.com/path', { - perMessageDeflate: false -}); -``` - -## Usage examples - -### Sending and receiving text data - -```js -import WebSocket from 'ws'; - -const ws = new WebSocket('ws://www.host.com/path'); - -ws.on('error', console.error); - -ws.on('open', function open() { - ws.send('something'); -}); - -ws.on('message', function message(data) { - console.log('received: %s', data); -}); -``` - -### Sending binary data - -```js -import WebSocket from 'ws'; - -const ws = new WebSocket('ws://www.host.com/path'); - -ws.on('error', console.error); - -ws.on('open', function open() { - const array = new Float32Array(5); - - for (var i = 0; i < array.length; ++i) { - array[i] = i / 2; - } - - ws.send(array); -}); -``` - -### Simple server - -```js -import { WebSocketServer } from 'ws'; - -const wss = new WebSocketServer({ port: 8080 }); - -wss.on('connection', function connection(ws) { - ws.on('error', console.error); - - ws.on('message', function message(data) { - console.log('received: %s', data); - }); - - ws.send('something'); -}); -``` - -### External HTTP/S server - -```js -import { createServer } from 'https'; -import { readFileSync } from 'fs'; -import { WebSocketServer } from 'ws'; - -const server = createServer({ - cert: readFileSync('/path/to/cert.pem'), - key: readFileSync('/path/to/key.pem') -}); -const wss = new WebSocketServer({ server }); - -wss.on('connection', function connection(ws) { - ws.on('error', console.error); - - ws.on('message', function message(data) { - console.log('received: %s', data); - }); - - ws.send('something'); -}); - -server.listen(8080); -``` - -### Multiple servers sharing a single HTTP/S server - -```js -import { createServer } from 'http'; -import { WebSocketServer } from 'ws'; - -const server = createServer(); -const wss1 = new WebSocketServer({ noServer: true }); -const wss2 = new WebSocketServer({ noServer: true }); - -wss1.on('connection', function connection(ws) { - ws.on('error', console.error); - - // ... -}); - -wss2.on('connection', function connection(ws) { - ws.on('error', console.error); - - // ... -}); - -server.on('upgrade', function upgrade(request, socket, head) { - const { pathname } = new URL(request.url, 'wss://base.url'); - - if (pathname === '/foo') { - wss1.handleUpgrade(request, socket, head, function done(ws) { - wss1.emit('connection', ws, request); - }); - } else if (pathname === '/bar') { - wss2.handleUpgrade(request, socket, head, function done(ws) { - wss2.emit('connection', ws, request); - }); - } else { - socket.destroy(); - } -}); - -server.listen(8080); -``` - -### Client authentication - -```js -import { createServer } from 'http'; -import { WebSocketServer } from 'ws'; - -function onSocketError(err) { - console.error(err); -} - -const server = createServer(); -const wss = new WebSocketServer({ noServer: true }); - -wss.on('connection', function connection(ws, request, client) { - ws.on('error', console.error); - - ws.on('message', function message(data) { - console.log(`Received message ${data} from user ${client}`); - }); -}); - -server.on('upgrade', function upgrade(request, socket, head) { - socket.on('error', onSocketError); - - // This function is not defined on purpose. Implement it with your own logic. - authenticate(request, function next(err, client) { - if (err || !client) { - socket.write('HTTP/1.1 401 Unauthorized\r\n\r\n'); - socket.destroy(); - return; - } - - socket.removeListener('error', onSocketError); - - wss.handleUpgrade(request, socket, head, function done(ws) { - wss.emit('connection', ws, request, client); - }); - }); -}); - -server.listen(8080); -``` - -Also see the provided [example][session-parse-example] using `express-session`. - -### Server broadcast - -A client WebSocket broadcasting to all connected WebSocket clients, including -itself. - -```js -import WebSocket, { WebSocketServer } from 'ws'; - -const wss = new WebSocketServer({ port: 8080 }); - -wss.on('connection', function connection(ws) { - ws.on('error', console.error); - - ws.on('message', function message(data, isBinary) { - wss.clients.forEach(function each(client) { - if (client.readyState === WebSocket.OPEN) { - client.send(data, { binary: isBinary }); - } - }); - }); -}); -``` - -A client WebSocket broadcasting to every other connected WebSocket clients, -excluding itself. - -```js -import WebSocket, { WebSocketServer } from 'ws'; - -const wss = new WebSocketServer({ port: 8080 }); - -wss.on('connection', function connection(ws) { - ws.on('error', console.error); - - ws.on('message', function message(data, isBinary) { - wss.clients.forEach(function each(client) { - if (client !== ws && client.readyState === WebSocket.OPEN) { - client.send(data, { binary: isBinary }); - } - }); - }); -}); -``` - -### Round-trip time - -```js -import WebSocket from 'ws'; - -const ws = new WebSocket('wss://websocket-echo.com/'); - -ws.on('error', console.error); - -ws.on('open', function open() { - console.log('connected'); - ws.send(Date.now()); -}); - -ws.on('close', function close() { - console.log('disconnected'); -}); - -ws.on('message', function message(data) { - console.log(`Round-trip time: ${Date.now() - data} ms`); - - setTimeout(function timeout() { - ws.send(Date.now()); - }, 500); -}); -``` - -### Use the Node.js streams API - -```js -import WebSocket, { createWebSocketStream } from 'ws'; - -const ws = new WebSocket('wss://websocket-echo.com/'); - -const duplex = createWebSocketStream(ws, { encoding: 'utf8' }); - -duplex.on('error', console.error); - -duplex.pipe(process.stdout); -process.stdin.pipe(duplex); -``` - -### Other examples - -For a full example with a browser client communicating with a ws server, see the -examples folder. - -Otherwise, see the test cases. - -## FAQ - -### How to get the IP address of the client? - -The remote IP address can be obtained from the raw socket. - -```js -import { WebSocketServer } from 'ws'; - -const wss = new WebSocketServer({ port: 8080 }); - -wss.on('connection', function connection(ws, req) { - const ip = req.socket.remoteAddress; - - ws.on('error', console.error); -}); -``` - -When the server runs behind a proxy like NGINX, the de-facto standard is to use -the `X-Forwarded-For` header. - -```js -wss.on('connection', function connection(ws, req) { - const ip = req.headers['x-forwarded-for'].split(',')[0].trim(); - - ws.on('error', console.error); -}); -``` - -### How to detect and close broken connections? - -Sometimes, the link between the server and the client can be interrupted in a -way that keeps both the server and the client unaware of the broken state of the -connection (e.g. when pulling the cord). - -In these cases, ping messages can be used as a means to verify that the remote -endpoint is still responsive. - -```js -import { WebSocketServer } from 'ws'; - -function heartbeat() { - this.isAlive = true; -} - -const wss = new WebSocketServer({ port: 8080 }); - -wss.on('connection', function connection(ws) { - ws.isAlive = true; - ws.on('error', console.error); - ws.on('pong', heartbeat); -}); - -const interval = setInterval(function ping() { - wss.clients.forEach(function each(ws) { - if (ws.isAlive === false) return ws.terminate(); - - ws.isAlive = false; - ws.ping(); - }); -}, 30000); - -wss.on('close', function close() { - clearInterval(interval); -}); -``` - -Pong messages are automatically sent in response to ping messages as required by -the spec. - -Just like the server example above, your clients might as well lose connection -without knowing it. You might want to add a ping listener on your clients to -prevent that. A simple implementation would be: - -```js -import WebSocket from 'ws'; - -function heartbeat() { - clearTimeout(this.pingTimeout); - - // Use `WebSocket#terminate()`, which immediately destroys the connection, - // instead of `WebSocket#close()`, which waits for the close timer. - // Delay should be equal to the interval at which your server - // sends out pings plus a conservative assumption of the latency. - this.pingTimeout = setTimeout(() => { - this.terminate(); - }, 30000 + 1000); -} - -const client = new WebSocket('wss://websocket-echo.com/'); - -client.on('error', console.error); -client.on('open', heartbeat); -client.on('ping', heartbeat); -client.on('close', function clear() { - clearTimeout(this.pingTimeout); -}); -``` - -### How to connect via a proxy? - -Use a custom `http.Agent` implementation like [https-proxy-agent][] or -[socks-proxy-agent][]. - -## Changelog - -We're using the GitHub [releases][changelog] for changelog entries. - -## License - -[MIT](LICENSE) - -[`buffer.isutf8()`]: https://nodejs.org/api/buffer.html#bufferisutf8input -[bufferutil]: https://github.com/websockets/bufferutil -[changelog]: https://github.com/websockets/ws/releases -[client-report]: http://websockets.github.io/ws/autobahn/clients/ -[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent -[node-zlib-bug]: https://github.com/nodejs/node/issues/8871 -[node-zlib-deflaterawdocs]: - https://nodejs.org/api/zlib.html#zlib_zlib_createdeflateraw_options -[permessage-deflate]: https://tools.ietf.org/html/rfc7692 -[server-report]: http://websockets.github.io/ws/autobahn/servers/ -[session-parse-example]: ./examples/express-session-parse -[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent -[utf-8-validate]: https://github.com/websockets/utf-8-validate -[ws-server-options]: ./doc/ws.md#new-websocketserveroptions-callback diff --git a/yjs-poll/node_modules/ws/browser.js b/yjs-poll/node_modules/ws/browser.js deleted file mode 100644 index ca4f628..0000000 --- a/yjs-poll/node_modules/ws/browser.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; - -module.exports = function () { - throw new Error( - 'ws does not work in the browser. Browser clients must use the native ' + - 'WebSocket object' - ); -}; diff --git a/yjs-poll/node_modules/ws/index.js b/yjs-poll/node_modules/ws/index.js deleted file mode 100644 index 41edb3b..0000000 --- a/yjs-poll/node_modules/ws/index.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -const WebSocket = require('./lib/websocket'); - -WebSocket.createWebSocketStream = require('./lib/stream'); -WebSocket.Server = require('./lib/websocket-server'); -WebSocket.Receiver = require('./lib/receiver'); -WebSocket.Sender = require('./lib/sender'); - -WebSocket.WebSocket = WebSocket; -WebSocket.WebSocketServer = WebSocket.Server; - -module.exports = WebSocket; diff --git a/yjs-poll/node_modules/ws/lib/buffer-util.js b/yjs-poll/node_modules/ws/lib/buffer-util.js deleted file mode 100644 index f7536e2..0000000 --- a/yjs-poll/node_modules/ws/lib/buffer-util.js +++ /dev/null @@ -1,131 +0,0 @@ -'use strict'; - -const { EMPTY_BUFFER } = require('./constants'); - -const FastBuffer = Buffer[Symbol.species]; - -/** - * Merges an array of buffers into a new buffer. - * - * @param {Buffer[]} list The array of buffers to concat - * @param {Number} totalLength The total length of buffers in the list - * @return {Buffer} The resulting buffer - * @public - */ -function concat(list, totalLength) { - if (list.length === 0) return EMPTY_BUFFER; - if (list.length === 1) return list[0]; - - const target = Buffer.allocUnsafe(totalLength); - let offset = 0; - - for (let i = 0; i < list.length; i++) { - const buf = list[i]; - target.set(buf, offset); - offset += buf.length; - } - - if (offset < totalLength) { - return new FastBuffer(target.buffer, target.byteOffset, offset); - } - - return target; -} - -/** - * Masks a buffer using the given mask. - * - * @param {Buffer} source The buffer to mask - * @param {Buffer} mask The mask to use - * @param {Buffer} output The buffer where to store the result - * @param {Number} offset The offset at which to start writing - * @param {Number} length The number of bytes to mask. - * @public - */ -function _mask(source, mask, output, offset, length) { - for (let i = 0; i < length; i++) { - output[offset + i] = source[i] ^ mask[i & 3]; - } -} - -/** - * Unmasks a buffer using the given mask. - * - * @param {Buffer} buffer The buffer to unmask - * @param {Buffer} mask The mask to use - * @public - */ -function _unmask(buffer, mask) { - for (let i = 0; i < buffer.length; i++) { - buffer[i] ^= mask[i & 3]; - } -} - -/** - * Converts a buffer to an `ArrayBuffer`. - * - * @param {Buffer} buf The buffer to convert - * @return {ArrayBuffer} Converted buffer - * @public - */ -function toArrayBuffer(buf) { - if (buf.length === buf.buffer.byteLength) { - return buf.buffer; - } - - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length); -} - -/** - * Converts `data` to a `Buffer`. - * - * @param {*} data The data to convert - * @return {Buffer} The buffer - * @throws {TypeError} - * @public - */ -function toBuffer(data) { - toBuffer.readOnly = true; - - if (Buffer.isBuffer(data)) return data; - - let buf; - - if (data instanceof ArrayBuffer) { - buf = new FastBuffer(data); - } else if (ArrayBuffer.isView(data)) { - buf = new FastBuffer(data.buffer, data.byteOffset, data.byteLength); - } else { - buf = Buffer.from(data); - toBuffer.readOnly = false; - } - - return buf; -} - -module.exports = { - concat, - mask: _mask, - toArrayBuffer, - toBuffer, - unmask: _unmask -}; - -/* istanbul ignore else */ -if (!process.env.WS_NO_BUFFER_UTIL) { - try { - const bufferUtil = require('bufferutil'); - - module.exports.mask = function (source, mask, output, offset, length) { - if (length < 48) _mask(source, mask, output, offset, length); - else bufferUtil.mask(source, mask, output, offset, length); - }; - - module.exports.unmask = function (buffer, mask) { - if (buffer.length < 32) _unmask(buffer, mask); - else bufferUtil.unmask(buffer, mask); - }; - } catch (e) { - // Continue regardless of the error. - } -} diff --git a/yjs-poll/node_modules/ws/lib/constants.js b/yjs-poll/node_modules/ws/lib/constants.js deleted file mode 100644 index 69b2fe3..0000000 --- a/yjs-poll/node_modules/ws/lib/constants.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; - -const BINARY_TYPES = ['nodebuffer', 'arraybuffer', 'fragments']; -const hasBlob = typeof Blob !== 'undefined'; - -if (hasBlob) BINARY_TYPES.push('blob'); - -module.exports = { - BINARY_TYPES, - CLOSE_TIMEOUT: 30000, - EMPTY_BUFFER: Buffer.alloc(0), - GUID: '258EAFA5-E914-47DA-95CA-C5AB0DC85B11', - hasBlob, - kForOnEventAttribute: Symbol('kIsForOnEventAttribute'), - kListener: Symbol('kListener'), - kStatusCode: Symbol('status-code'), - kWebSocket: Symbol('websocket'), - NOOP: () => {} -}; diff --git a/yjs-poll/node_modules/ws/lib/event-target.js b/yjs-poll/node_modules/ws/lib/event-target.js deleted file mode 100644 index fea4cbc..0000000 --- a/yjs-poll/node_modules/ws/lib/event-target.js +++ /dev/null @@ -1,292 +0,0 @@ -'use strict'; - -const { kForOnEventAttribute, kListener } = require('./constants'); - -const kCode = Symbol('kCode'); -const kData = Symbol('kData'); -const kError = Symbol('kError'); -const kMessage = Symbol('kMessage'); -const kReason = Symbol('kReason'); -const kTarget = Symbol('kTarget'); -const kType = Symbol('kType'); -const kWasClean = Symbol('kWasClean'); - -/** - * Class representing an event. - */ -class Event { - /** - * Create a new `Event`. - * - * @param {String} type The name of the event - * @throws {TypeError} If the `type` argument is not specified - */ - constructor(type) { - this[kTarget] = null; - this[kType] = type; - } - - /** - * @type {*} - */ - get target() { - return this[kTarget]; - } - - /** - * @type {String} - */ - get type() { - return this[kType]; - } -} - -Object.defineProperty(Event.prototype, 'target', { enumerable: true }); -Object.defineProperty(Event.prototype, 'type', { enumerable: true }); - -/** - * Class representing a close event. - * - * @extends Event - */ -class CloseEvent extends Event { - /** - * Create a new `CloseEvent`. - * - * @param {String} type The name of the event - * @param {Object} [options] A dictionary object that allows for setting - * attributes via object members of the same name - * @param {Number} [options.code=0] The status code explaining why the - * connection was closed - * @param {String} [options.reason=''] A human-readable string explaining why - * the connection was closed - * @param {Boolean} [options.wasClean=false] Indicates whether or not the - * connection was cleanly closed - */ - constructor(type, options = {}) { - super(type); - - this[kCode] = options.code === undefined ? 0 : options.code; - this[kReason] = options.reason === undefined ? '' : options.reason; - this[kWasClean] = options.wasClean === undefined ? false : options.wasClean; - } - - /** - * @type {Number} - */ - get code() { - return this[kCode]; - } - - /** - * @type {String} - */ - get reason() { - return this[kReason]; - } - - /** - * @type {Boolean} - */ - get wasClean() { - return this[kWasClean]; - } -} - -Object.defineProperty(CloseEvent.prototype, 'code', { enumerable: true }); -Object.defineProperty(CloseEvent.prototype, 'reason', { enumerable: true }); -Object.defineProperty(CloseEvent.prototype, 'wasClean', { enumerable: true }); - -/** - * Class representing an error event. - * - * @extends Event - */ -class ErrorEvent extends Event { - /** - * Create a new `ErrorEvent`. - * - * @param {String} type The name of the event - * @param {Object} [options] A dictionary object that allows for setting - * attributes via object members of the same name - * @param {*} [options.error=null] The error that generated this event - * @param {String} [options.message=''] The error message - */ - constructor(type, options = {}) { - super(type); - - this[kError] = options.error === undefined ? null : options.error; - this[kMessage] = options.message === undefined ? '' : options.message; - } - - /** - * @type {*} - */ - get error() { - return this[kError]; - } - - /** - * @type {String} - */ - get message() { - return this[kMessage]; - } -} - -Object.defineProperty(ErrorEvent.prototype, 'error', { enumerable: true }); -Object.defineProperty(ErrorEvent.prototype, 'message', { enumerable: true }); - -/** - * Class representing a message event. - * - * @extends Event - */ -class MessageEvent extends Event { - /** - * Create a new `MessageEvent`. - * - * @param {String} type The name of the event - * @param {Object} [options] A dictionary object that allows for setting - * attributes via object members of the same name - * @param {*} [options.data=null] The message content - */ - constructor(type, options = {}) { - super(type); - - this[kData] = options.data === undefined ? null : options.data; - } - - /** - * @type {*} - */ - get data() { - return this[kData]; - } -} - -Object.defineProperty(MessageEvent.prototype, 'data', { enumerable: true }); - -/** - * This provides methods for emulating the `EventTarget` interface. It's not - * meant to be used directly. - * - * @mixin - */ -const EventTarget = { - /** - * Register an event listener. - * - * @param {String} type A string representing the event type to listen for - * @param {(Function|Object)} handler The listener to add - * @param {Object} [options] An options object specifies characteristics about - * the event listener - * @param {Boolean} [options.once=false] A `Boolean` indicating that the - * listener should be invoked at most once after being added. If `true`, - * the listener would be automatically removed when invoked. - * @public - */ - addEventListener(type, handler, options = {}) { - for (const listener of this.listeners(type)) { - if ( - !options[kForOnEventAttribute] && - listener[kListener] === handler && - !listener[kForOnEventAttribute] - ) { - return; - } - } - - let wrapper; - - if (type === 'message') { - wrapper = function onMessage(data, isBinary) { - const event = new MessageEvent('message', { - data: isBinary ? data : data.toString() - }); - - event[kTarget] = this; - callListener(handler, this, event); - }; - } else if (type === 'close') { - wrapper = function onClose(code, message) { - const event = new CloseEvent('close', { - code, - reason: message.toString(), - wasClean: this._closeFrameReceived && this._closeFrameSent - }); - - event[kTarget] = this; - callListener(handler, this, event); - }; - } else if (type === 'error') { - wrapper = function onError(error) { - const event = new ErrorEvent('error', { - error, - message: error.message - }); - - event[kTarget] = this; - callListener(handler, this, event); - }; - } else if (type === 'open') { - wrapper = function onOpen() { - const event = new Event('open'); - - event[kTarget] = this; - callListener(handler, this, event); - }; - } else { - return; - } - - wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute]; - wrapper[kListener] = handler; - - if (options.once) { - this.once(type, wrapper); - } else { - this.on(type, wrapper); - } - }, - - /** - * Remove an event listener. - * - * @param {String} type A string representing the event type to remove - * @param {(Function|Object)} handler The listener to remove - * @public - */ - removeEventListener(type, handler) { - for (const listener of this.listeners(type)) { - if (listener[kListener] === handler && !listener[kForOnEventAttribute]) { - this.removeListener(type, listener); - break; - } - } - } -}; - -module.exports = { - CloseEvent, - ErrorEvent, - Event, - EventTarget, - MessageEvent -}; - -/** - * Call an event listener - * - * @param {(Function|Object)} listener The listener to call - * @param {*} thisArg The value to use as `this`` when calling the listener - * @param {Event} event The event to pass to the listener - * @private - */ -function callListener(listener, thisArg, event) { - if (typeof listener === 'object' && listener.handleEvent) { - listener.handleEvent.call(listener, event); - } else { - listener.call(thisArg, event); - } -} diff --git a/yjs-poll/node_modules/ws/lib/extension.js b/yjs-poll/node_modules/ws/lib/extension.js deleted file mode 100644 index 3d7895c..0000000 --- a/yjs-poll/node_modules/ws/lib/extension.js +++ /dev/null @@ -1,203 +0,0 @@ -'use strict'; - -const { tokenChars } = require('./validation'); - -/** - * Adds an offer to the map of extension offers or a parameter to the map of - * parameters. - * - * @param {Object} dest The map of extension offers or parameters - * @param {String} name The extension or parameter name - * @param {(Object|Boolean|String)} elem The extension parameters or the - * parameter value - * @private - */ -function push(dest, name, elem) { - if (dest[name] === undefined) dest[name] = [elem]; - else dest[name].push(elem); -} - -/** - * Parses the `Sec-WebSocket-Extensions` header into an object. - * - * @param {String} header The field value of the header - * @return {Object} The parsed object - * @public - */ -function parse(header) { - const offers = Object.create(null); - let params = Object.create(null); - let mustUnescape = false; - let isEscaping = false; - let inQuotes = false; - let extensionName; - let paramName; - let start = -1; - let code = -1; - let end = -1; - let i = 0; - - for (; i < header.length; i++) { - code = header.charCodeAt(i); - - if (extensionName === undefined) { - if (end === -1 && tokenChars[code] === 1) { - if (start === -1) start = i; - } else if ( - i !== 0 && - (code === 0x20 /* ' ' */ || code === 0x09) /* '\t' */ - ) { - if (end === -1 && start !== -1) end = i; - } else if (code === 0x3b /* ';' */ || code === 0x2c /* ',' */) { - if (start === -1) { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - - if (end === -1) end = i; - const name = header.slice(start, end); - if (code === 0x2c) { - push(offers, name, params); - params = Object.create(null); - } else { - extensionName = name; - } - - start = end = -1; - } else { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - } else if (paramName === undefined) { - if (end === -1 && tokenChars[code] === 1) { - if (start === -1) start = i; - } else if (code === 0x20 || code === 0x09) { - if (end === -1 && start !== -1) end = i; - } else if (code === 0x3b || code === 0x2c) { - if (start === -1) { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - - if (end === -1) end = i; - push(params, header.slice(start, end), true); - if (code === 0x2c) { - push(offers, extensionName, params); - params = Object.create(null); - extensionName = undefined; - } - - start = end = -1; - } else if (code === 0x3d /* '=' */ && start !== -1 && end === -1) { - paramName = header.slice(start, i); - start = end = -1; - } else { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - } else { - // - // The value of a quoted-string after unescaping must conform to the - // token ABNF, so only token characters are valid. - // Ref: https://tools.ietf.org/html/rfc6455#section-9.1 - // - if (isEscaping) { - if (tokenChars[code] !== 1) { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - if (start === -1) start = i; - else if (!mustUnescape) mustUnescape = true; - isEscaping = false; - } else if (inQuotes) { - if (tokenChars[code] === 1) { - if (start === -1) start = i; - } else if (code === 0x22 /* '"' */ && start !== -1) { - inQuotes = false; - end = i; - } else if (code === 0x5c /* '\' */) { - isEscaping = true; - } else { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - } else if (code === 0x22 && header.charCodeAt(i - 1) === 0x3d) { - inQuotes = true; - } else if (end === -1 && tokenChars[code] === 1) { - if (start === -1) start = i; - } else if (start !== -1 && (code === 0x20 || code === 0x09)) { - if (end === -1) end = i; - } else if (code === 0x3b || code === 0x2c) { - if (start === -1) { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - - if (end === -1) end = i; - let value = header.slice(start, end); - if (mustUnescape) { - value = value.replace(/\\/g, ''); - mustUnescape = false; - } - push(params, paramName, value); - if (code === 0x2c) { - push(offers, extensionName, params); - params = Object.create(null); - extensionName = undefined; - } - - paramName = undefined; - start = end = -1; - } else { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - } - } - - if (start === -1 || inQuotes || code === 0x20 || code === 0x09) { - throw new SyntaxError('Unexpected end of input'); - } - - if (end === -1) end = i; - const token = header.slice(start, end); - if (extensionName === undefined) { - push(offers, token, params); - } else { - if (paramName === undefined) { - push(params, token, true); - } else if (mustUnescape) { - push(params, paramName, token.replace(/\\/g, '')); - } else { - push(params, paramName, token); - } - push(offers, extensionName, params); - } - - return offers; -} - -/** - * Builds the `Sec-WebSocket-Extensions` header field value. - * - * @param {Object} extensions The map of extensions and parameters to format - * @return {String} A string representing the given object - * @public - */ -function format(extensions) { - return Object.keys(extensions) - .map((extension) => { - let configurations = extensions[extension]; - if (!Array.isArray(configurations)) configurations = [configurations]; - return configurations - .map((params) => { - return [extension] - .concat( - Object.keys(params).map((k) => { - let values = params[k]; - if (!Array.isArray(values)) values = [values]; - return values - .map((v) => (v === true ? k : `${k}=${v}`)) - .join('; '); - }) - ) - .join('; '); - }) - .join(', '); - }) - .join(', '); -} - -module.exports = { format, parse }; diff --git a/yjs-poll/node_modules/ws/lib/limiter.js b/yjs-poll/node_modules/ws/lib/limiter.js deleted file mode 100644 index 3fd3578..0000000 --- a/yjs-poll/node_modules/ws/lib/limiter.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; - -const kDone = Symbol('kDone'); -const kRun = Symbol('kRun'); - -/** - * A very simple job queue with adjustable concurrency. Adapted from - * https://github.com/STRML/async-limiter - */ -class Limiter { - /** - * Creates a new `Limiter`. - * - * @param {Number} [concurrency=Infinity] The maximum number of jobs allowed - * to run concurrently - */ - constructor(concurrency) { - this[kDone] = () => { - this.pending--; - this[kRun](); - }; - this.concurrency = concurrency || Infinity; - this.jobs = []; - this.pending = 0; - } - - /** - * Adds a job to the queue. - * - * @param {Function} job The job to run - * @public - */ - add(job) { - this.jobs.push(job); - this[kRun](); - } - - /** - * Removes a job from the queue and runs it if possible. - * - * @private - */ - [kRun]() { - if (this.pending === this.concurrency) return; - - if (this.jobs.length) { - const job = this.jobs.shift(); - - this.pending++; - job(this[kDone]); - } - } -} - -module.exports = Limiter; diff --git a/yjs-poll/node_modules/ws/lib/permessage-deflate.js b/yjs-poll/node_modules/ws/lib/permessage-deflate.js deleted file mode 100644 index 41ff70e..0000000 --- a/yjs-poll/node_modules/ws/lib/permessage-deflate.js +++ /dev/null @@ -1,528 +0,0 @@ -'use strict'; - -const zlib = require('zlib'); - -const bufferUtil = require('./buffer-util'); -const Limiter = require('./limiter'); -const { kStatusCode } = require('./constants'); - -const FastBuffer = Buffer[Symbol.species]; -const TRAILER = Buffer.from([0x00, 0x00, 0xff, 0xff]); -const kPerMessageDeflate = Symbol('permessage-deflate'); -const kTotalLength = Symbol('total-length'); -const kCallback = Symbol('callback'); -const kBuffers = Symbol('buffers'); -const kError = Symbol('error'); - -// -// We limit zlib concurrency, which prevents severe memory fragmentation -// as documented in https://github.com/nodejs/node/issues/8871#issuecomment-250915913 -// and https://github.com/websockets/ws/issues/1202 -// -// Intentionally global; it's the global thread pool that's an issue. -// -let zlibLimiter; - -/** - * permessage-deflate implementation. - */ -class PerMessageDeflate { - /** - * Creates a PerMessageDeflate instance. - * - * @param {Object} [options] Configuration options - * @param {(Boolean|Number)} [options.clientMaxWindowBits] Advertise support - * for, or request, a custom client window size - * @param {Boolean} [options.clientNoContextTakeover=false] Advertise/ - * acknowledge disabling of client context takeover - * @param {Number} [options.concurrencyLimit=10] The number of concurrent - * calls to zlib - * @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the - * use of a custom server window size - * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept - * disabling of server context takeover - * @param {Number} [options.threshold=1024] Size (in bytes) below which - * messages should not be compressed if context takeover is disabled - * @param {Object} [options.zlibDeflateOptions] Options to pass to zlib on - * deflate - * @param {Object} [options.zlibInflateOptions] Options to pass to zlib on - * inflate - * @param {Boolean} [isServer=false] Create the instance in either server or - * client mode - * @param {Number} [maxPayload=0] The maximum allowed message length - */ - constructor(options, isServer, maxPayload) { - this._maxPayload = maxPayload | 0; - this._options = options || {}; - this._threshold = - this._options.threshold !== undefined ? this._options.threshold : 1024; - this._isServer = !!isServer; - this._deflate = null; - this._inflate = null; - - this.params = null; - - if (!zlibLimiter) { - const concurrency = - this._options.concurrencyLimit !== undefined - ? this._options.concurrencyLimit - : 10; - zlibLimiter = new Limiter(concurrency); - } - } - - /** - * @type {String} - */ - static get extensionName() { - return 'permessage-deflate'; - } - - /** - * Create an extension negotiation offer. - * - * @return {Object} Extension parameters - * @public - */ - offer() { - const params = {}; - - if (this._options.serverNoContextTakeover) { - params.server_no_context_takeover = true; - } - if (this._options.clientNoContextTakeover) { - params.client_no_context_takeover = true; - } - if (this._options.serverMaxWindowBits) { - params.server_max_window_bits = this._options.serverMaxWindowBits; - } - if (this._options.clientMaxWindowBits) { - params.client_max_window_bits = this._options.clientMaxWindowBits; - } else if (this._options.clientMaxWindowBits == null) { - params.client_max_window_bits = true; - } - - return params; - } - - /** - * Accept an extension negotiation offer/response. - * - * @param {Array} configurations The extension negotiation offers/reponse - * @return {Object} Accepted configuration - * @public - */ - accept(configurations) { - configurations = this.normalizeParams(configurations); - - this.params = this._isServer - ? this.acceptAsServer(configurations) - : this.acceptAsClient(configurations); - - return this.params; - } - - /** - * Releases all resources used by the extension. - * - * @public - */ - cleanup() { - if (this._inflate) { - this._inflate.close(); - this._inflate = null; - } - - if (this._deflate) { - const callback = this._deflate[kCallback]; - - this._deflate.close(); - this._deflate = null; - - if (callback) { - callback( - new Error( - 'The deflate stream was closed while data was being processed' - ) - ); - } - } - } - - /** - * Accept an extension negotiation offer. - * - * @param {Array} offers The extension negotiation offers - * @return {Object} Accepted configuration - * @private - */ - acceptAsServer(offers) { - const opts = this._options; - const accepted = offers.find((params) => { - if ( - (opts.serverNoContextTakeover === false && - params.server_no_context_takeover) || - (params.server_max_window_bits && - (opts.serverMaxWindowBits === false || - (typeof opts.serverMaxWindowBits === 'number' && - opts.serverMaxWindowBits > params.server_max_window_bits))) || - (typeof opts.clientMaxWindowBits === 'number' && - !params.client_max_window_bits) - ) { - return false; - } - - return true; - }); - - if (!accepted) { - throw new Error('None of the extension offers can be accepted'); - } - - if (opts.serverNoContextTakeover) { - accepted.server_no_context_takeover = true; - } - if (opts.clientNoContextTakeover) { - accepted.client_no_context_takeover = true; - } - if (typeof opts.serverMaxWindowBits === 'number') { - accepted.server_max_window_bits = opts.serverMaxWindowBits; - } - if (typeof opts.clientMaxWindowBits === 'number') { - accepted.client_max_window_bits = opts.clientMaxWindowBits; - } else if ( - accepted.client_max_window_bits === true || - opts.clientMaxWindowBits === false - ) { - delete accepted.client_max_window_bits; - } - - return accepted; - } - - /** - * Accept the extension negotiation response. - * - * @param {Array} response The extension negotiation response - * @return {Object} Accepted configuration - * @private - */ - acceptAsClient(response) { - const params = response[0]; - - if ( - this._options.clientNoContextTakeover === false && - params.client_no_context_takeover - ) { - throw new Error('Unexpected parameter "client_no_context_takeover"'); - } - - if (!params.client_max_window_bits) { - if (typeof this._options.clientMaxWindowBits === 'number') { - params.client_max_window_bits = this._options.clientMaxWindowBits; - } - } else if ( - this._options.clientMaxWindowBits === false || - (typeof this._options.clientMaxWindowBits === 'number' && - params.client_max_window_bits > this._options.clientMaxWindowBits) - ) { - throw new Error( - 'Unexpected or invalid parameter "client_max_window_bits"' - ); - } - - return params; - } - - /** - * Normalize parameters. - * - * @param {Array} configurations The extension negotiation offers/reponse - * @return {Array} The offers/response with normalized parameters - * @private - */ - normalizeParams(configurations) { - configurations.forEach((params) => { - Object.keys(params).forEach((key) => { - let value = params[key]; - - if (value.length > 1) { - throw new Error(`Parameter "${key}" must have only a single value`); - } - - value = value[0]; - - if (key === 'client_max_window_bits') { - if (value !== true) { - const num = +value; - if (!Number.isInteger(num) || num < 8 || num > 15) { - throw new TypeError( - `Invalid value for parameter "${key}": ${value}` - ); - } - value = num; - } else if (!this._isServer) { - throw new TypeError( - `Invalid value for parameter "${key}": ${value}` - ); - } - } else if (key === 'server_max_window_bits') { - const num = +value; - if (!Number.isInteger(num) || num < 8 || num > 15) { - throw new TypeError( - `Invalid value for parameter "${key}": ${value}` - ); - } - value = num; - } else if ( - key === 'client_no_context_takeover' || - key === 'server_no_context_takeover' - ) { - if (value !== true) { - throw new TypeError( - `Invalid value for parameter "${key}": ${value}` - ); - } - } else { - throw new Error(`Unknown parameter "${key}"`); - } - - params[key] = value; - }); - }); - - return configurations; - } - - /** - * Decompress data. Concurrency limited. - * - * @param {Buffer} data Compressed data - * @param {Boolean} fin Specifies whether or not this is the last fragment - * @param {Function} callback Callback - * @public - */ - decompress(data, fin, callback) { - zlibLimiter.add((done) => { - this._decompress(data, fin, (err, result) => { - done(); - callback(err, result); - }); - }); - } - - /** - * Compress data. Concurrency limited. - * - * @param {(Buffer|String)} data Data to compress - * @param {Boolean} fin Specifies whether or not this is the last fragment - * @param {Function} callback Callback - * @public - */ - compress(data, fin, callback) { - zlibLimiter.add((done) => { - this._compress(data, fin, (err, result) => { - done(); - callback(err, result); - }); - }); - } - - /** - * Decompress data. - * - * @param {Buffer} data Compressed data - * @param {Boolean} fin Specifies whether or not this is the last fragment - * @param {Function} callback Callback - * @private - */ - _decompress(data, fin, callback) { - const endpoint = this._isServer ? 'client' : 'server'; - - if (!this._inflate) { - const key = `${endpoint}_max_window_bits`; - const windowBits = - typeof this.params[key] !== 'number' - ? zlib.Z_DEFAULT_WINDOWBITS - : this.params[key]; - - this._inflate = zlib.createInflateRaw({ - ...this._options.zlibInflateOptions, - windowBits - }); - this._inflate[kPerMessageDeflate] = this; - this._inflate[kTotalLength] = 0; - this._inflate[kBuffers] = []; - this._inflate.on('error', inflateOnError); - this._inflate.on('data', inflateOnData); - } - - this._inflate[kCallback] = callback; - - this._inflate.write(data); - if (fin) this._inflate.write(TRAILER); - - this._inflate.flush(() => { - const err = this._inflate[kError]; - - if (err) { - this._inflate.close(); - this._inflate = null; - callback(err); - return; - } - - const data = bufferUtil.concat( - this._inflate[kBuffers], - this._inflate[kTotalLength] - ); - - if (this._inflate._readableState.endEmitted) { - this._inflate.close(); - this._inflate = null; - } else { - this._inflate[kTotalLength] = 0; - this._inflate[kBuffers] = []; - - if (fin && this.params[`${endpoint}_no_context_takeover`]) { - this._inflate.reset(); - } - } - - callback(null, data); - }); - } - - /** - * Compress data. - * - * @param {(Buffer|String)} data Data to compress - * @param {Boolean} fin Specifies whether or not this is the last fragment - * @param {Function} callback Callback - * @private - */ - _compress(data, fin, callback) { - const endpoint = this._isServer ? 'server' : 'client'; - - if (!this._deflate) { - const key = `${endpoint}_max_window_bits`; - const windowBits = - typeof this.params[key] !== 'number' - ? zlib.Z_DEFAULT_WINDOWBITS - : this.params[key]; - - this._deflate = zlib.createDeflateRaw({ - ...this._options.zlibDeflateOptions, - windowBits - }); - - this._deflate[kTotalLength] = 0; - this._deflate[kBuffers] = []; - - this._deflate.on('data', deflateOnData); - } - - this._deflate[kCallback] = callback; - - this._deflate.write(data); - this._deflate.flush(zlib.Z_SYNC_FLUSH, () => { - if (!this._deflate) { - // - // The deflate stream was closed while data was being processed. - // - return; - } - - let data = bufferUtil.concat( - this._deflate[kBuffers], - this._deflate[kTotalLength] - ); - - if (fin) { - data = new FastBuffer(data.buffer, data.byteOffset, data.length - 4); - } - - // - // Ensure that the callback will not be called again in - // `PerMessageDeflate#cleanup()`. - // - this._deflate[kCallback] = null; - - this._deflate[kTotalLength] = 0; - this._deflate[kBuffers] = []; - - if (fin && this.params[`${endpoint}_no_context_takeover`]) { - this._deflate.reset(); - } - - callback(null, data); - }); - } -} - -module.exports = PerMessageDeflate; - -/** - * The listener of the `zlib.DeflateRaw` stream `'data'` event. - * - * @param {Buffer} chunk A chunk of data - * @private - */ -function deflateOnData(chunk) { - this[kBuffers].push(chunk); - this[kTotalLength] += chunk.length; -} - -/** - * The listener of the `zlib.InflateRaw` stream `'data'` event. - * - * @param {Buffer} chunk A chunk of data - * @private - */ -function inflateOnData(chunk) { - this[kTotalLength] += chunk.length; - - if ( - this[kPerMessageDeflate]._maxPayload < 1 || - this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload - ) { - this[kBuffers].push(chunk); - return; - } - - this[kError] = new RangeError('Max payload size exceeded'); - this[kError].code = 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'; - this[kError][kStatusCode] = 1009; - this.removeListener('data', inflateOnData); - - // - // The choice to employ `zlib.reset()` over `zlib.close()` is dictated by the - // fact that in Node.js versions prior to 13.10.0, the callback for - // `zlib.flush()` is not called if `zlib.close()` is used. Utilizing - // `zlib.reset()` ensures that either the callback is invoked or an error is - // emitted. - // - this.reset(); -} - -/** - * The listener of the `zlib.InflateRaw` stream `'error'` event. - * - * @param {Error} err The emitted error - * @private - */ -function inflateOnError(err) { - // - // There is no need to call `Zlib#close()` as the handle is automatically - // closed when an error is emitted. - // - this[kPerMessageDeflate]._inflate = null; - - if (this[kError]) { - this[kCallback](this[kError]); - return; - } - - err[kStatusCode] = 1007; - this[kCallback](err); -} diff --git a/yjs-poll/node_modules/ws/lib/receiver.js b/yjs-poll/node_modules/ws/lib/receiver.js deleted file mode 100644 index 54d9b4f..0000000 --- a/yjs-poll/node_modules/ws/lib/receiver.js +++ /dev/null @@ -1,706 +0,0 @@ -'use strict'; - -const { Writable } = require('stream'); - -const PerMessageDeflate = require('./permessage-deflate'); -const { - BINARY_TYPES, - EMPTY_BUFFER, - kStatusCode, - kWebSocket -} = require('./constants'); -const { concat, toArrayBuffer, unmask } = require('./buffer-util'); -const { isValidStatusCode, isValidUTF8 } = require('./validation'); - -const FastBuffer = Buffer[Symbol.species]; - -const GET_INFO = 0; -const GET_PAYLOAD_LENGTH_16 = 1; -const GET_PAYLOAD_LENGTH_64 = 2; -const GET_MASK = 3; -const GET_DATA = 4; -const INFLATING = 5; -const DEFER_EVENT = 6; - -/** - * HyBi Receiver implementation. - * - * @extends Writable - */ -class Receiver extends Writable { - /** - * Creates a Receiver instance. - * - * @param {Object} [options] Options object - * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether - * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted - * multiple times in the same tick - * @param {String} [options.binaryType=nodebuffer] The type for binary data - * @param {Object} [options.extensions] An object containing the negotiated - * extensions - * @param {Boolean} [options.isServer=false] Specifies whether to operate in - * client or server mode - * @param {Number} [options.maxPayload=0] The maximum allowed message length - * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or - * not to skip UTF-8 validation for text and close messages - */ - constructor(options = {}) { - super(); - - this._allowSynchronousEvents = - options.allowSynchronousEvents !== undefined - ? options.allowSynchronousEvents - : true; - this._binaryType = options.binaryType || BINARY_TYPES[0]; - this._extensions = options.extensions || {}; - this._isServer = !!options.isServer; - this._maxPayload = options.maxPayload | 0; - this._skipUTF8Validation = !!options.skipUTF8Validation; - this[kWebSocket] = undefined; - - this._bufferedBytes = 0; - this._buffers = []; - - this._compressed = false; - this._payloadLength = 0; - this._mask = undefined; - this._fragmented = 0; - this._masked = false; - this._fin = false; - this._opcode = 0; - - this._totalPayloadLength = 0; - this._messageLength = 0; - this._fragments = []; - - this._errored = false; - this._loop = false; - this._state = GET_INFO; - } - - /** - * Implements `Writable.prototype._write()`. - * - * @param {Buffer} chunk The chunk of data to write - * @param {String} encoding The character encoding of `chunk` - * @param {Function} cb Callback - * @private - */ - _write(chunk, encoding, cb) { - if (this._opcode === 0x08 && this._state == GET_INFO) return cb(); - - this._bufferedBytes += chunk.length; - this._buffers.push(chunk); - this.startLoop(cb); - } - - /** - * Consumes `n` bytes from the buffered data. - * - * @param {Number} n The number of bytes to consume - * @return {Buffer} The consumed bytes - * @private - */ - consume(n) { - this._bufferedBytes -= n; - - if (n === this._buffers[0].length) return this._buffers.shift(); - - if (n < this._buffers[0].length) { - const buf = this._buffers[0]; - this._buffers[0] = new FastBuffer( - buf.buffer, - buf.byteOffset + n, - buf.length - n - ); - - return new FastBuffer(buf.buffer, buf.byteOffset, n); - } - - const dst = Buffer.allocUnsafe(n); - - do { - const buf = this._buffers[0]; - const offset = dst.length - n; - - if (n >= buf.length) { - dst.set(this._buffers.shift(), offset); - } else { - dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset); - this._buffers[0] = new FastBuffer( - buf.buffer, - buf.byteOffset + n, - buf.length - n - ); - } - - n -= buf.length; - } while (n > 0); - - return dst; - } - - /** - * Starts the parsing loop. - * - * @param {Function} cb Callback - * @private - */ - startLoop(cb) { - this._loop = true; - - do { - switch (this._state) { - case GET_INFO: - this.getInfo(cb); - break; - case GET_PAYLOAD_LENGTH_16: - this.getPayloadLength16(cb); - break; - case GET_PAYLOAD_LENGTH_64: - this.getPayloadLength64(cb); - break; - case GET_MASK: - this.getMask(); - break; - case GET_DATA: - this.getData(cb); - break; - case INFLATING: - case DEFER_EVENT: - this._loop = false; - return; - } - } while (this._loop); - - if (!this._errored) cb(); - } - - /** - * Reads the first two bytes of a frame. - * - * @param {Function} cb Callback - * @private - */ - getInfo(cb) { - if (this._bufferedBytes < 2) { - this._loop = false; - return; - } - - const buf = this.consume(2); - - if ((buf[0] & 0x30) !== 0x00) { - const error = this.createError( - RangeError, - 'RSV2 and RSV3 must be clear', - true, - 1002, - 'WS_ERR_UNEXPECTED_RSV_2_3' - ); - - cb(error); - return; - } - - const compressed = (buf[0] & 0x40) === 0x40; - - if (compressed && !this._extensions[PerMessageDeflate.extensionName]) { - const error = this.createError( - RangeError, - 'RSV1 must be clear', - true, - 1002, - 'WS_ERR_UNEXPECTED_RSV_1' - ); - - cb(error); - return; - } - - this._fin = (buf[0] & 0x80) === 0x80; - this._opcode = buf[0] & 0x0f; - this._payloadLength = buf[1] & 0x7f; - - if (this._opcode === 0x00) { - if (compressed) { - const error = this.createError( - RangeError, - 'RSV1 must be clear', - true, - 1002, - 'WS_ERR_UNEXPECTED_RSV_1' - ); - - cb(error); - return; - } - - if (!this._fragmented) { - const error = this.createError( - RangeError, - 'invalid opcode 0', - true, - 1002, - 'WS_ERR_INVALID_OPCODE' - ); - - cb(error); - return; - } - - this._opcode = this._fragmented; - } else if (this._opcode === 0x01 || this._opcode === 0x02) { - if (this._fragmented) { - const error = this.createError( - RangeError, - `invalid opcode ${this._opcode}`, - true, - 1002, - 'WS_ERR_INVALID_OPCODE' - ); - - cb(error); - return; - } - - this._compressed = compressed; - } else if (this._opcode > 0x07 && this._opcode < 0x0b) { - if (!this._fin) { - const error = this.createError( - RangeError, - 'FIN must be set', - true, - 1002, - 'WS_ERR_EXPECTED_FIN' - ); - - cb(error); - return; - } - - if (compressed) { - const error = this.createError( - RangeError, - 'RSV1 must be clear', - true, - 1002, - 'WS_ERR_UNEXPECTED_RSV_1' - ); - - cb(error); - return; - } - - if ( - this._payloadLength > 0x7d || - (this._opcode === 0x08 && this._payloadLength === 1) - ) { - const error = this.createError( - RangeError, - `invalid payload length ${this._payloadLength}`, - true, - 1002, - 'WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH' - ); - - cb(error); - return; - } - } else { - const error = this.createError( - RangeError, - `invalid opcode ${this._opcode}`, - true, - 1002, - 'WS_ERR_INVALID_OPCODE' - ); - - cb(error); - return; - } - - if (!this._fin && !this._fragmented) this._fragmented = this._opcode; - this._masked = (buf[1] & 0x80) === 0x80; - - if (this._isServer) { - if (!this._masked) { - const error = this.createError( - RangeError, - 'MASK must be set', - true, - 1002, - 'WS_ERR_EXPECTED_MASK' - ); - - cb(error); - return; - } - } else if (this._masked) { - const error = this.createError( - RangeError, - 'MASK must be clear', - true, - 1002, - 'WS_ERR_UNEXPECTED_MASK' - ); - - cb(error); - return; - } - - if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16; - else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64; - else this.haveLength(cb); - } - - /** - * Gets extended payload length (7+16). - * - * @param {Function} cb Callback - * @private - */ - getPayloadLength16(cb) { - if (this._bufferedBytes < 2) { - this._loop = false; - return; - } - - this._payloadLength = this.consume(2).readUInt16BE(0); - this.haveLength(cb); - } - - /** - * Gets extended payload length (7+64). - * - * @param {Function} cb Callback - * @private - */ - getPayloadLength64(cb) { - if (this._bufferedBytes < 8) { - this._loop = false; - return; - } - - const buf = this.consume(8); - const num = buf.readUInt32BE(0); - - // - // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned - // if payload length is greater than this number. - // - if (num > Math.pow(2, 53 - 32) - 1) { - const error = this.createError( - RangeError, - 'Unsupported WebSocket frame: payload length > 2^53 - 1', - false, - 1009, - 'WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH' - ); - - cb(error); - return; - } - - this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4); - this.haveLength(cb); - } - - /** - * Payload length has been read. - * - * @param {Function} cb Callback - * @private - */ - haveLength(cb) { - if (this._payloadLength && this._opcode < 0x08) { - this._totalPayloadLength += this._payloadLength; - if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) { - const error = this.createError( - RangeError, - 'Max payload size exceeded', - false, - 1009, - 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH' - ); - - cb(error); - return; - } - } - - if (this._masked) this._state = GET_MASK; - else this._state = GET_DATA; - } - - /** - * Reads mask bytes. - * - * @private - */ - getMask() { - if (this._bufferedBytes < 4) { - this._loop = false; - return; - } - - this._mask = this.consume(4); - this._state = GET_DATA; - } - - /** - * Reads data bytes. - * - * @param {Function} cb Callback - * @private - */ - getData(cb) { - let data = EMPTY_BUFFER; - - if (this._payloadLength) { - if (this._bufferedBytes < this._payloadLength) { - this._loop = false; - return; - } - - data = this.consume(this._payloadLength); - - if ( - this._masked && - (this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3]) !== 0 - ) { - unmask(data, this._mask); - } - } - - if (this._opcode > 0x07) { - this.controlMessage(data, cb); - return; - } - - if (this._compressed) { - this._state = INFLATING; - this.decompress(data, cb); - return; - } - - if (data.length) { - // - // This message is not compressed so its length is the sum of the payload - // length of all fragments. - // - this._messageLength = this._totalPayloadLength; - this._fragments.push(data); - } - - this.dataMessage(cb); - } - - /** - * Decompresses data. - * - * @param {Buffer} data Compressed data - * @param {Function} cb Callback - * @private - */ - decompress(data, cb) { - const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; - - perMessageDeflate.decompress(data, this._fin, (err, buf) => { - if (err) return cb(err); - - if (buf.length) { - this._messageLength += buf.length; - if (this._messageLength > this._maxPayload && this._maxPayload > 0) { - const error = this.createError( - RangeError, - 'Max payload size exceeded', - false, - 1009, - 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH' - ); - - cb(error); - return; - } - - this._fragments.push(buf); - } - - this.dataMessage(cb); - if (this._state === GET_INFO) this.startLoop(cb); - }); - } - - /** - * Handles a data message. - * - * @param {Function} cb Callback - * @private - */ - dataMessage(cb) { - if (!this._fin) { - this._state = GET_INFO; - return; - } - - const messageLength = this._messageLength; - const fragments = this._fragments; - - this._totalPayloadLength = 0; - this._messageLength = 0; - this._fragmented = 0; - this._fragments = []; - - if (this._opcode === 2) { - let data; - - if (this._binaryType === 'nodebuffer') { - data = concat(fragments, messageLength); - } else if (this._binaryType === 'arraybuffer') { - data = toArrayBuffer(concat(fragments, messageLength)); - } else if (this._binaryType === 'blob') { - data = new Blob(fragments); - } else { - data = fragments; - } - - if (this._allowSynchronousEvents) { - this.emit('message', data, true); - this._state = GET_INFO; - } else { - this._state = DEFER_EVENT; - setImmediate(() => { - this.emit('message', data, true); - this._state = GET_INFO; - this.startLoop(cb); - }); - } - } else { - const buf = concat(fragments, messageLength); - - if (!this._skipUTF8Validation && !isValidUTF8(buf)) { - const error = this.createError( - Error, - 'invalid UTF-8 sequence', - true, - 1007, - 'WS_ERR_INVALID_UTF8' - ); - - cb(error); - return; - } - - if (this._state === INFLATING || this._allowSynchronousEvents) { - this.emit('message', buf, false); - this._state = GET_INFO; - } else { - this._state = DEFER_EVENT; - setImmediate(() => { - this.emit('message', buf, false); - this._state = GET_INFO; - this.startLoop(cb); - }); - } - } - } - - /** - * Handles a control message. - * - * @param {Buffer} data Data to handle - * @return {(Error|RangeError|undefined)} A possible error - * @private - */ - controlMessage(data, cb) { - if (this._opcode === 0x08) { - if (data.length === 0) { - this._loop = false; - this.emit('conclude', 1005, EMPTY_BUFFER); - this.end(); - } else { - const code = data.readUInt16BE(0); - - if (!isValidStatusCode(code)) { - const error = this.createError( - RangeError, - `invalid status code ${code}`, - true, - 1002, - 'WS_ERR_INVALID_CLOSE_CODE' - ); - - cb(error); - return; - } - - const buf = new FastBuffer( - data.buffer, - data.byteOffset + 2, - data.length - 2 - ); - - if (!this._skipUTF8Validation && !isValidUTF8(buf)) { - const error = this.createError( - Error, - 'invalid UTF-8 sequence', - true, - 1007, - 'WS_ERR_INVALID_UTF8' - ); - - cb(error); - return; - } - - this._loop = false; - this.emit('conclude', code, buf); - this.end(); - } - - this._state = GET_INFO; - return; - } - - if (this._allowSynchronousEvents) { - this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data); - this._state = GET_INFO; - } else { - this._state = DEFER_EVENT; - setImmediate(() => { - this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data); - this._state = GET_INFO; - this.startLoop(cb); - }); - } - } - - /** - * Builds an error object. - * - * @param {function(new:Error|RangeError)} ErrorCtor The error constructor - * @param {String} message The error message - * @param {Boolean} prefix Specifies whether or not to add a default prefix to - * `message` - * @param {Number} statusCode The status code - * @param {String} errorCode The exposed error code - * @return {(Error|RangeError)} The error - * @private - */ - createError(ErrorCtor, message, prefix, statusCode, errorCode) { - this._loop = false; - this._errored = true; - - const err = new ErrorCtor( - prefix ? `Invalid WebSocket frame: ${message}` : message - ); - - Error.captureStackTrace(err, this.createError); - err.code = errorCode; - err[kStatusCode] = statusCode; - return err; - } -} - -module.exports = Receiver; diff --git a/yjs-poll/node_modules/ws/lib/sender.js b/yjs-poll/node_modules/ws/lib/sender.js deleted file mode 100644 index a8b1da3..0000000 --- a/yjs-poll/node_modules/ws/lib/sender.js +++ /dev/null @@ -1,602 +0,0 @@ -/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex" }] */ - -'use strict'; - -const { Duplex } = require('stream'); -const { randomFillSync } = require('crypto'); - -const PerMessageDeflate = require('./permessage-deflate'); -const { EMPTY_BUFFER, kWebSocket, NOOP } = require('./constants'); -const { isBlob, isValidStatusCode } = require('./validation'); -const { mask: applyMask, toBuffer } = require('./buffer-util'); - -const kByteLength = Symbol('kByteLength'); -const maskBuffer = Buffer.alloc(4); -const RANDOM_POOL_SIZE = 8 * 1024; -let randomPool; -let randomPoolPointer = RANDOM_POOL_SIZE; - -const DEFAULT = 0; -const DEFLATING = 1; -const GET_BLOB_DATA = 2; - -/** - * HyBi Sender implementation. - */ -class Sender { - /** - * Creates a Sender instance. - * - * @param {Duplex} socket The connection socket - * @param {Object} [extensions] An object containing the negotiated extensions - * @param {Function} [generateMask] The function used to generate the masking - * key - */ - constructor(socket, extensions, generateMask) { - this._extensions = extensions || {}; - - if (generateMask) { - this._generateMask = generateMask; - this._maskBuffer = Buffer.alloc(4); - } - - this._socket = socket; - - this._firstFragment = true; - this._compress = false; - - this._bufferedBytes = 0; - this._queue = []; - this._state = DEFAULT; - this.onerror = NOOP; - this[kWebSocket] = undefined; - } - - /** - * Frames a piece of data according to the HyBi WebSocket protocol. - * - * @param {(Buffer|String)} data The data to frame - * @param {Object} options Options object - * @param {Boolean} [options.fin=false] Specifies whether or not to set the - * FIN bit - * @param {Function} [options.generateMask] The function used to generate the - * masking key - * @param {Boolean} [options.mask=false] Specifies whether or not to mask - * `data` - * @param {Buffer} [options.maskBuffer] The buffer used to store the masking - * key - * @param {Number} options.opcode The opcode - * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be - * modified - * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the - * RSV1 bit - * @return {(Buffer|String)[]} The framed data - * @public - */ - static frame(data, options) { - let mask; - let merge = false; - let offset = 2; - let skipMasking = false; - - if (options.mask) { - mask = options.maskBuffer || maskBuffer; - - if (options.generateMask) { - options.generateMask(mask); - } else { - if (randomPoolPointer === RANDOM_POOL_SIZE) { - /* istanbul ignore else */ - if (randomPool === undefined) { - // - // This is lazily initialized because server-sent frames must not - // be masked so it may never be used. - // - randomPool = Buffer.alloc(RANDOM_POOL_SIZE); - } - - randomFillSync(randomPool, 0, RANDOM_POOL_SIZE); - randomPoolPointer = 0; - } - - mask[0] = randomPool[randomPoolPointer++]; - mask[1] = randomPool[randomPoolPointer++]; - mask[2] = randomPool[randomPoolPointer++]; - mask[3] = randomPool[randomPoolPointer++]; - } - - skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0; - offset = 6; - } - - let dataLength; - - if (typeof data === 'string') { - if ( - (!options.mask || skipMasking) && - options[kByteLength] !== undefined - ) { - dataLength = options[kByteLength]; - } else { - data = Buffer.from(data); - dataLength = data.length; - } - } else { - dataLength = data.length; - merge = options.mask && options.readOnly && !skipMasking; - } - - let payloadLength = dataLength; - - if (dataLength >= 65536) { - offset += 8; - payloadLength = 127; - } else if (dataLength > 125) { - offset += 2; - payloadLength = 126; - } - - const target = Buffer.allocUnsafe(merge ? dataLength + offset : offset); - - target[0] = options.fin ? options.opcode | 0x80 : options.opcode; - if (options.rsv1) target[0] |= 0x40; - - target[1] = payloadLength; - - if (payloadLength === 126) { - target.writeUInt16BE(dataLength, 2); - } else if (payloadLength === 127) { - target[2] = target[3] = 0; - target.writeUIntBE(dataLength, 4, 6); - } - - if (!options.mask) return [target, data]; - - target[1] |= 0x80; - target[offset - 4] = mask[0]; - target[offset - 3] = mask[1]; - target[offset - 2] = mask[2]; - target[offset - 1] = mask[3]; - - if (skipMasking) return [target, data]; - - if (merge) { - applyMask(data, mask, target, offset, dataLength); - return [target]; - } - - applyMask(data, mask, data, 0, dataLength); - return [target, data]; - } - - /** - * Sends a close message to the other peer. - * - * @param {Number} [code] The status code component of the body - * @param {(String|Buffer)} [data] The message component of the body - * @param {Boolean} [mask=false] Specifies whether or not to mask the message - * @param {Function} [cb] Callback - * @public - */ - close(code, data, mask, cb) { - let buf; - - if (code === undefined) { - buf = EMPTY_BUFFER; - } else if (typeof code !== 'number' || !isValidStatusCode(code)) { - throw new TypeError('First argument must be a valid error code number'); - } else if (data === undefined || !data.length) { - buf = Buffer.allocUnsafe(2); - buf.writeUInt16BE(code, 0); - } else { - const length = Buffer.byteLength(data); - - if (length > 123) { - throw new RangeError('The message must not be greater than 123 bytes'); - } - - buf = Buffer.allocUnsafe(2 + length); - buf.writeUInt16BE(code, 0); - - if (typeof data === 'string') { - buf.write(data, 2); - } else { - buf.set(data, 2); - } - } - - const options = { - [kByteLength]: buf.length, - fin: true, - generateMask: this._generateMask, - mask, - maskBuffer: this._maskBuffer, - opcode: 0x08, - readOnly: false, - rsv1: false - }; - - if (this._state !== DEFAULT) { - this.enqueue([this.dispatch, buf, false, options, cb]); - } else { - this.sendFrame(Sender.frame(buf, options), cb); - } - } - - /** - * Sends a ping message to the other peer. - * - * @param {*} data The message to send - * @param {Boolean} [mask=false] Specifies whether or not to mask `data` - * @param {Function} [cb] Callback - * @public - */ - ping(data, mask, cb) { - let byteLength; - let readOnly; - - if (typeof data === 'string') { - byteLength = Buffer.byteLength(data); - readOnly = false; - } else if (isBlob(data)) { - byteLength = data.size; - readOnly = false; - } else { - data = toBuffer(data); - byteLength = data.length; - readOnly = toBuffer.readOnly; - } - - if (byteLength > 125) { - throw new RangeError('The data size must not be greater than 125 bytes'); - } - - const options = { - [kByteLength]: byteLength, - fin: true, - generateMask: this._generateMask, - mask, - maskBuffer: this._maskBuffer, - opcode: 0x09, - readOnly, - rsv1: false - }; - - if (isBlob(data)) { - if (this._state !== DEFAULT) { - this.enqueue([this.getBlobData, data, false, options, cb]); - } else { - this.getBlobData(data, false, options, cb); - } - } else if (this._state !== DEFAULT) { - this.enqueue([this.dispatch, data, false, options, cb]); - } else { - this.sendFrame(Sender.frame(data, options), cb); - } - } - - /** - * Sends a pong message to the other peer. - * - * @param {*} data The message to send - * @param {Boolean} [mask=false] Specifies whether or not to mask `data` - * @param {Function} [cb] Callback - * @public - */ - pong(data, mask, cb) { - let byteLength; - let readOnly; - - if (typeof data === 'string') { - byteLength = Buffer.byteLength(data); - readOnly = false; - } else if (isBlob(data)) { - byteLength = data.size; - readOnly = false; - } else { - data = toBuffer(data); - byteLength = data.length; - readOnly = toBuffer.readOnly; - } - - if (byteLength > 125) { - throw new RangeError('The data size must not be greater than 125 bytes'); - } - - const options = { - [kByteLength]: byteLength, - fin: true, - generateMask: this._generateMask, - mask, - maskBuffer: this._maskBuffer, - opcode: 0x0a, - readOnly, - rsv1: false - }; - - if (isBlob(data)) { - if (this._state !== DEFAULT) { - this.enqueue([this.getBlobData, data, false, options, cb]); - } else { - this.getBlobData(data, false, options, cb); - } - } else if (this._state !== DEFAULT) { - this.enqueue([this.dispatch, data, false, options, cb]); - } else { - this.sendFrame(Sender.frame(data, options), cb); - } - } - - /** - * Sends a data message to the other peer. - * - * @param {*} data The message to send - * @param {Object} options Options object - * @param {Boolean} [options.binary=false] Specifies whether `data` is binary - * or text - * @param {Boolean} [options.compress=false] Specifies whether or not to - * compress `data` - * @param {Boolean} [options.fin=false] Specifies whether the fragment is the - * last one - * @param {Boolean} [options.mask=false] Specifies whether or not to mask - * `data` - * @param {Function} [cb] Callback - * @public - */ - send(data, options, cb) { - const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; - let opcode = options.binary ? 2 : 1; - let rsv1 = options.compress; - - let byteLength; - let readOnly; - - if (typeof data === 'string') { - byteLength = Buffer.byteLength(data); - readOnly = false; - } else if (isBlob(data)) { - byteLength = data.size; - readOnly = false; - } else { - data = toBuffer(data); - byteLength = data.length; - readOnly = toBuffer.readOnly; - } - - if (this._firstFragment) { - this._firstFragment = false; - if ( - rsv1 && - perMessageDeflate && - perMessageDeflate.params[ - perMessageDeflate._isServer - ? 'server_no_context_takeover' - : 'client_no_context_takeover' - ] - ) { - rsv1 = byteLength >= perMessageDeflate._threshold; - } - this._compress = rsv1; - } else { - rsv1 = false; - opcode = 0; - } - - if (options.fin) this._firstFragment = true; - - const opts = { - [kByteLength]: byteLength, - fin: options.fin, - generateMask: this._generateMask, - mask: options.mask, - maskBuffer: this._maskBuffer, - opcode, - readOnly, - rsv1 - }; - - if (isBlob(data)) { - if (this._state !== DEFAULT) { - this.enqueue([this.getBlobData, data, this._compress, opts, cb]); - } else { - this.getBlobData(data, this._compress, opts, cb); - } - } else if (this._state !== DEFAULT) { - this.enqueue([this.dispatch, data, this._compress, opts, cb]); - } else { - this.dispatch(data, this._compress, opts, cb); - } - } - - /** - * Gets the contents of a blob as binary data. - * - * @param {Blob} blob The blob - * @param {Boolean} [compress=false] Specifies whether or not to compress - * the data - * @param {Object} options Options object - * @param {Boolean} [options.fin=false] Specifies whether or not to set the - * FIN bit - * @param {Function} [options.generateMask] The function used to generate the - * masking key - * @param {Boolean} [options.mask=false] Specifies whether or not to mask - * `data` - * @param {Buffer} [options.maskBuffer] The buffer used to store the masking - * key - * @param {Number} options.opcode The opcode - * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be - * modified - * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the - * RSV1 bit - * @param {Function} [cb] Callback - * @private - */ - getBlobData(blob, compress, options, cb) { - this._bufferedBytes += options[kByteLength]; - this._state = GET_BLOB_DATA; - - blob - .arrayBuffer() - .then((arrayBuffer) => { - if (this._socket.destroyed) { - const err = new Error( - 'The socket was closed while the blob was being read' - ); - - // - // `callCallbacks` is called in the next tick to ensure that errors - // that might be thrown in the callbacks behave like errors thrown - // outside the promise chain. - // - process.nextTick(callCallbacks, this, err, cb); - return; - } - - this._bufferedBytes -= options[kByteLength]; - const data = toBuffer(arrayBuffer); - - if (!compress) { - this._state = DEFAULT; - this.sendFrame(Sender.frame(data, options), cb); - this.dequeue(); - } else { - this.dispatch(data, compress, options, cb); - } - }) - .catch((err) => { - // - // `onError` is called in the next tick for the same reason that - // `callCallbacks` above is. - // - process.nextTick(onError, this, err, cb); - }); - } - - /** - * Dispatches a message. - * - * @param {(Buffer|String)} data The message to send - * @param {Boolean} [compress=false] Specifies whether or not to compress - * `data` - * @param {Object} options Options object - * @param {Boolean} [options.fin=false] Specifies whether or not to set the - * FIN bit - * @param {Function} [options.generateMask] The function used to generate the - * masking key - * @param {Boolean} [options.mask=false] Specifies whether or not to mask - * `data` - * @param {Buffer} [options.maskBuffer] The buffer used to store the masking - * key - * @param {Number} options.opcode The opcode - * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be - * modified - * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the - * RSV1 bit - * @param {Function} [cb] Callback - * @private - */ - dispatch(data, compress, options, cb) { - if (!compress) { - this.sendFrame(Sender.frame(data, options), cb); - return; - } - - const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; - - this._bufferedBytes += options[kByteLength]; - this._state = DEFLATING; - perMessageDeflate.compress(data, options.fin, (_, buf) => { - if (this._socket.destroyed) { - const err = new Error( - 'The socket was closed while data was being compressed' - ); - - callCallbacks(this, err, cb); - return; - } - - this._bufferedBytes -= options[kByteLength]; - this._state = DEFAULT; - options.readOnly = false; - this.sendFrame(Sender.frame(buf, options), cb); - this.dequeue(); - }); - } - - /** - * Executes queued send operations. - * - * @private - */ - dequeue() { - while (this._state === DEFAULT && this._queue.length) { - const params = this._queue.shift(); - - this._bufferedBytes -= params[3][kByteLength]; - Reflect.apply(params[0], this, params.slice(1)); - } - } - - /** - * Enqueues a send operation. - * - * @param {Array} params Send operation parameters. - * @private - */ - enqueue(params) { - this._bufferedBytes += params[3][kByteLength]; - this._queue.push(params); - } - - /** - * Sends a frame. - * - * @param {(Buffer | String)[]} list The frame to send - * @param {Function} [cb] Callback - * @private - */ - sendFrame(list, cb) { - if (list.length === 2) { - this._socket.cork(); - this._socket.write(list[0]); - this._socket.write(list[1], cb); - this._socket.uncork(); - } else { - this._socket.write(list[0], cb); - } - } -} - -module.exports = Sender; - -/** - * Calls queued callbacks with an error. - * - * @param {Sender} sender The `Sender` instance - * @param {Error} err The error to call the callbacks with - * @param {Function} [cb] The first callback - * @private - */ -function callCallbacks(sender, err, cb) { - if (typeof cb === 'function') cb(err); - - for (let i = 0; i < sender._queue.length; i++) { - const params = sender._queue[i]; - const callback = params[params.length - 1]; - - if (typeof callback === 'function') callback(err); - } -} - -/** - * Handles a `Sender` error. - * - * @param {Sender} sender The `Sender` instance - * @param {Error} err The error - * @param {Function} [cb] The first pending callback - * @private - */ -function onError(sender, err, cb) { - callCallbacks(sender, err, cb); - sender.onerror(err); -} diff --git a/yjs-poll/node_modules/ws/lib/stream.js b/yjs-poll/node_modules/ws/lib/stream.js deleted file mode 100644 index 4c58c91..0000000 --- a/yjs-poll/node_modules/ws/lib/stream.js +++ /dev/null @@ -1,161 +0,0 @@ -/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^WebSocket$" }] */ -'use strict'; - -const WebSocket = require('./websocket'); -const { Duplex } = require('stream'); - -/** - * Emits the `'close'` event on a stream. - * - * @param {Duplex} stream The stream. - * @private - */ -function emitClose(stream) { - stream.emit('close'); -} - -/** - * The listener of the `'end'` event. - * - * @private - */ -function duplexOnEnd() { - if (!this.destroyed && this._writableState.finished) { - this.destroy(); - } -} - -/** - * The listener of the `'error'` event. - * - * @param {Error} err The error - * @private - */ -function duplexOnError(err) { - this.removeListener('error', duplexOnError); - this.destroy(); - if (this.listenerCount('error') === 0) { - // Do not suppress the throwing behavior. - this.emit('error', err); - } -} - -/** - * Wraps a `WebSocket` in a duplex stream. - * - * @param {WebSocket} ws The `WebSocket` to wrap - * @param {Object} [options] The options for the `Duplex` constructor - * @return {Duplex} The duplex stream - * @public - */ -function createWebSocketStream(ws, options) { - let terminateOnDestroy = true; - - const duplex = new Duplex({ - ...options, - autoDestroy: false, - emitClose: false, - objectMode: false, - writableObjectMode: false - }); - - ws.on('message', function message(msg, isBinary) { - const data = - !isBinary && duplex._readableState.objectMode ? msg.toString() : msg; - - if (!duplex.push(data)) ws.pause(); - }); - - ws.once('error', function error(err) { - if (duplex.destroyed) return; - - // Prevent `ws.terminate()` from being called by `duplex._destroy()`. - // - // - If the `'error'` event is emitted before the `'open'` event, then - // `ws.terminate()` is a noop as no socket is assigned. - // - Otherwise, the error is re-emitted by the listener of the `'error'` - // event of the `Receiver` object. The listener already closes the - // connection by calling `ws.close()`. This allows a close frame to be - // sent to the other peer. If `ws.terminate()` is called right after this, - // then the close frame might not be sent. - terminateOnDestroy = false; - duplex.destroy(err); - }); - - ws.once('close', function close() { - if (duplex.destroyed) return; - - duplex.push(null); - }); - - duplex._destroy = function (err, callback) { - if (ws.readyState === ws.CLOSED) { - callback(err); - process.nextTick(emitClose, duplex); - return; - } - - let called = false; - - ws.once('error', function error(err) { - called = true; - callback(err); - }); - - ws.once('close', function close() { - if (!called) callback(err); - process.nextTick(emitClose, duplex); - }); - - if (terminateOnDestroy) ws.terminate(); - }; - - duplex._final = function (callback) { - if (ws.readyState === ws.CONNECTING) { - ws.once('open', function open() { - duplex._final(callback); - }); - return; - } - - // If the value of the `_socket` property is `null` it means that `ws` is a - // client websocket and the handshake failed. In fact, when this happens, a - // socket is never assigned to the websocket. Wait for the `'error'` event - // that will be emitted by the websocket. - if (ws._socket === null) return; - - if (ws._socket._writableState.finished) { - callback(); - if (duplex._readableState.endEmitted) duplex.destroy(); - } else { - ws._socket.once('finish', function finish() { - // `duplex` is not destroyed here because the `'end'` event will be - // emitted on `duplex` after this `'finish'` event. The EOF signaling - // `null` chunk is, in fact, pushed when the websocket emits `'close'`. - callback(); - }); - ws.close(); - } - }; - - duplex._read = function () { - if (ws.isPaused) ws.resume(); - }; - - duplex._write = function (chunk, encoding, callback) { - if (ws.readyState === ws.CONNECTING) { - ws.once('open', function open() { - duplex._write(chunk, encoding, callback); - }); - return; - } - - ws.send(chunk, callback); - }; - - duplex.on('end', duplexOnEnd); - duplex.on('error', duplexOnError); - return duplex; -} - -module.exports = createWebSocketStream; diff --git a/yjs-poll/node_modules/ws/lib/subprotocol.js b/yjs-poll/node_modules/ws/lib/subprotocol.js deleted file mode 100644 index d4381e8..0000000 --- a/yjs-poll/node_modules/ws/lib/subprotocol.js +++ /dev/null @@ -1,62 +0,0 @@ -'use strict'; - -const { tokenChars } = require('./validation'); - -/** - * Parses the `Sec-WebSocket-Protocol` header into a set of subprotocol names. - * - * @param {String} header The field value of the header - * @return {Set} The subprotocol names - * @public - */ -function parse(header) { - const protocols = new Set(); - let start = -1; - let end = -1; - let i = 0; - - for (i; i < header.length; i++) { - const code = header.charCodeAt(i); - - if (end === -1 && tokenChars[code] === 1) { - if (start === -1) start = i; - } else if ( - i !== 0 && - (code === 0x20 /* ' ' */ || code === 0x09) /* '\t' */ - ) { - if (end === -1 && start !== -1) end = i; - } else if (code === 0x2c /* ',' */) { - if (start === -1) { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - - if (end === -1) end = i; - - const protocol = header.slice(start, end); - - if (protocols.has(protocol)) { - throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`); - } - - protocols.add(protocol); - start = end = -1; - } else { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - } - - if (start === -1 || end !== -1) { - throw new SyntaxError('Unexpected end of input'); - } - - const protocol = header.slice(start, i); - - if (protocols.has(protocol)) { - throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`); - } - - protocols.add(protocol); - return protocols; -} - -module.exports = { parse }; diff --git a/yjs-poll/node_modules/ws/lib/validation.js b/yjs-poll/node_modules/ws/lib/validation.js deleted file mode 100644 index 4a2e68d..0000000 --- a/yjs-poll/node_modules/ws/lib/validation.js +++ /dev/null @@ -1,152 +0,0 @@ -'use strict'; - -const { isUtf8 } = require('buffer'); - -const { hasBlob } = require('./constants'); - -// -// Allowed token characters: -// -// '!', '#', '$', '%', '&', ''', '*', '+', '-', -// '.', 0-9, A-Z, '^', '_', '`', a-z, '|', '~' -// -// tokenChars[32] === 0 // ' ' -// tokenChars[33] === 1 // '!' -// tokenChars[34] === 0 // '"' -// ... -// -// prettier-ignore -const tokenChars = [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31 - 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, // 32 - 47 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63 - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, // 80 - 95 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0 // 112 - 127 -]; - -/** - * Checks if a status code is allowed in a close frame. - * - * @param {Number} code The status code - * @return {Boolean} `true` if the status code is valid, else `false` - * @public - */ -function isValidStatusCode(code) { - return ( - (code >= 1000 && - code <= 1014 && - code !== 1004 && - code !== 1005 && - code !== 1006) || - (code >= 3000 && code <= 4999) - ); -} - -/** - * Checks if a given buffer contains only correct UTF-8. - * Ported from https://www.cl.cam.ac.uk/%7Emgk25/ucs/utf8_check.c by - * Markus Kuhn. - * - * @param {Buffer} buf The buffer to check - * @return {Boolean} `true` if `buf` contains only correct UTF-8, else `false` - * @public - */ -function _isValidUTF8(buf) { - const len = buf.length; - let i = 0; - - while (i < len) { - if ((buf[i] & 0x80) === 0) { - // 0xxxxxxx - i++; - } else if ((buf[i] & 0xe0) === 0xc0) { - // 110xxxxx 10xxxxxx - if ( - i + 1 === len || - (buf[i + 1] & 0xc0) !== 0x80 || - (buf[i] & 0xfe) === 0xc0 // Overlong - ) { - return false; - } - - i += 2; - } else if ((buf[i] & 0xf0) === 0xe0) { - // 1110xxxx 10xxxxxx 10xxxxxx - if ( - i + 2 >= len || - (buf[i + 1] & 0xc0) !== 0x80 || - (buf[i + 2] & 0xc0) !== 0x80 || - (buf[i] === 0xe0 && (buf[i + 1] & 0xe0) === 0x80) || // Overlong - (buf[i] === 0xed && (buf[i + 1] & 0xe0) === 0xa0) // Surrogate (U+D800 - U+DFFF) - ) { - return false; - } - - i += 3; - } else if ((buf[i] & 0xf8) === 0xf0) { - // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - if ( - i + 3 >= len || - (buf[i + 1] & 0xc0) !== 0x80 || - (buf[i + 2] & 0xc0) !== 0x80 || - (buf[i + 3] & 0xc0) !== 0x80 || - (buf[i] === 0xf0 && (buf[i + 1] & 0xf0) === 0x80) || // Overlong - (buf[i] === 0xf4 && buf[i + 1] > 0x8f) || - buf[i] > 0xf4 // > U+10FFFF - ) { - return false; - } - - i += 4; - } else { - return false; - } - } - - return true; -} - -/** - * Determines whether a value is a `Blob`. - * - * @param {*} value The value to be tested - * @return {Boolean} `true` if `value` is a `Blob`, else `false` - * @private - */ -function isBlob(value) { - return ( - hasBlob && - typeof value === 'object' && - typeof value.arrayBuffer === 'function' && - typeof value.type === 'string' && - typeof value.stream === 'function' && - (value[Symbol.toStringTag] === 'Blob' || - value[Symbol.toStringTag] === 'File') - ); -} - -module.exports = { - isBlob, - isValidStatusCode, - isValidUTF8: _isValidUTF8, - tokenChars -}; - -if (isUtf8) { - module.exports.isValidUTF8 = function (buf) { - return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf); - }; -} /* istanbul ignore else */ else if (!process.env.WS_NO_UTF_8_VALIDATE) { - try { - const isValidUTF8 = require('utf-8-validate'); - - module.exports.isValidUTF8 = function (buf) { - return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf); - }; - } catch (e) { - // Continue regardless of the error. - } -} diff --git a/yjs-poll/node_modules/ws/lib/websocket-server.js b/yjs-poll/node_modules/ws/lib/websocket-server.js deleted file mode 100644 index 75e04c1..0000000 --- a/yjs-poll/node_modules/ws/lib/websocket-server.js +++ /dev/null @@ -1,554 +0,0 @@ -/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex$", "caughtErrors": "none" }] */ - -'use strict'; - -const EventEmitter = require('events'); -const http = require('http'); -const { Duplex } = require('stream'); -const { createHash } = require('crypto'); - -const extension = require('./extension'); -const PerMessageDeflate = require('./permessage-deflate'); -const subprotocol = require('./subprotocol'); -const WebSocket = require('./websocket'); -const { CLOSE_TIMEOUT, GUID, kWebSocket } = require('./constants'); - -const keyRegex = /^[+/0-9A-Za-z]{22}==$/; - -const RUNNING = 0; -const CLOSING = 1; -const CLOSED = 2; - -/** - * Class representing a WebSocket server. - * - * @extends EventEmitter - */ -class WebSocketServer extends EventEmitter { - /** - * Create a `WebSocketServer` instance. - * - * @param {Object} options Configuration options - * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether - * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted - * multiple times in the same tick - * @param {Boolean} [options.autoPong=true] Specifies whether or not to - * automatically send a pong in response to a ping - * @param {Number} [options.backlog=511] The maximum length of the queue of - * pending connections - * @param {Boolean} [options.clientTracking=true] Specifies whether or not to - * track clients - * @param {Number} [options.closeTimeout=30000] Duration in milliseconds to - * wait for the closing handshake to finish after `websocket.close()` is - * called - * @param {Function} [options.handleProtocols] A hook to handle protocols - * @param {String} [options.host] The hostname where to bind the server - * @param {Number} [options.maxPayload=104857600] The maximum allowed message - * size - * @param {Boolean} [options.noServer=false] Enable no server mode - * @param {String} [options.path] Accept only connections matching this path - * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable - * permessage-deflate - * @param {Number} [options.port] The port where to bind the server - * @param {(http.Server|https.Server)} [options.server] A pre-created HTTP/S - * server to use - * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or - * not to skip UTF-8 validation for text and close messages - * @param {Function} [options.verifyClient] A hook to reject connections - * @param {Function} [options.WebSocket=WebSocket] Specifies the `WebSocket` - * class to use. It must be the `WebSocket` class or class that extends it - * @param {Function} [callback] A listener for the `listening` event - */ - constructor(options, callback) { - super(); - - options = { - allowSynchronousEvents: true, - autoPong: true, - maxPayload: 100 * 1024 * 1024, - skipUTF8Validation: false, - perMessageDeflate: false, - handleProtocols: null, - clientTracking: true, - closeTimeout: CLOSE_TIMEOUT, - verifyClient: null, - noServer: false, - backlog: null, // use default (511 as implemented in net.js) - server: null, - host: null, - path: null, - port: null, - WebSocket, - ...options - }; - - if ( - (options.port == null && !options.server && !options.noServer) || - (options.port != null && (options.server || options.noServer)) || - (options.server && options.noServer) - ) { - throw new TypeError( - 'One and only one of the "port", "server", or "noServer" options ' + - 'must be specified' - ); - } - - if (options.port != null) { - this._server = http.createServer((req, res) => { - const body = http.STATUS_CODES[426]; - - res.writeHead(426, { - 'Content-Length': body.length, - 'Content-Type': 'text/plain' - }); - res.end(body); - }); - this._server.listen( - options.port, - options.host, - options.backlog, - callback - ); - } else if (options.server) { - this._server = options.server; - } - - if (this._server) { - const emitConnection = this.emit.bind(this, 'connection'); - - this._removeListeners = addListeners(this._server, { - listening: this.emit.bind(this, 'listening'), - error: this.emit.bind(this, 'error'), - upgrade: (req, socket, head) => { - this.handleUpgrade(req, socket, head, emitConnection); - } - }); - } - - if (options.perMessageDeflate === true) options.perMessageDeflate = {}; - if (options.clientTracking) { - this.clients = new Set(); - this._shouldEmitClose = false; - } - - this.options = options; - this._state = RUNNING; - } - - /** - * Returns the bound address, the address family name, and port of the server - * as reported by the operating system if listening on an IP socket. - * If the server is listening on a pipe or UNIX domain socket, the name is - * returned as a string. - * - * @return {(Object|String|null)} The address of the server - * @public - */ - address() { - if (this.options.noServer) { - throw new Error('The server is operating in "noServer" mode'); - } - - if (!this._server) return null; - return this._server.address(); - } - - /** - * Stop the server from accepting new connections and emit the `'close'` event - * when all existing connections are closed. - * - * @param {Function} [cb] A one-time listener for the `'close'` event - * @public - */ - close(cb) { - if (this._state === CLOSED) { - if (cb) { - this.once('close', () => { - cb(new Error('The server is not running')); - }); - } - - process.nextTick(emitClose, this); - return; - } - - if (cb) this.once('close', cb); - - if (this._state === CLOSING) return; - this._state = CLOSING; - - if (this.options.noServer || this.options.server) { - if (this._server) { - this._removeListeners(); - this._removeListeners = this._server = null; - } - - if (this.clients) { - if (!this.clients.size) { - process.nextTick(emitClose, this); - } else { - this._shouldEmitClose = true; - } - } else { - process.nextTick(emitClose, this); - } - } else { - const server = this._server; - - this._removeListeners(); - this._removeListeners = this._server = null; - - // - // The HTTP/S server was created internally. Close it, and rely on its - // `'close'` event. - // - server.close(() => { - emitClose(this); - }); - } - } - - /** - * See if a given request should be handled by this server instance. - * - * @param {http.IncomingMessage} req Request object to inspect - * @return {Boolean} `true` if the request is valid, else `false` - * @public - */ - shouldHandle(req) { - if (this.options.path) { - const index = req.url.indexOf('?'); - const pathname = index !== -1 ? req.url.slice(0, index) : req.url; - - if (pathname !== this.options.path) return false; - } - - return true; - } - - /** - * Handle a HTTP Upgrade request. - * - * @param {http.IncomingMessage} req The request object - * @param {Duplex} socket The network socket between the server and client - * @param {Buffer} head The first packet of the upgraded stream - * @param {Function} cb Callback - * @public - */ - handleUpgrade(req, socket, head, cb) { - socket.on('error', socketOnError); - - const key = req.headers['sec-websocket-key']; - const upgrade = req.headers.upgrade; - const version = +req.headers['sec-websocket-version']; - - if (req.method !== 'GET') { - const message = 'Invalid HTTP method'; - abortHandshakeOrEmitwsClientError(this, req, socket, 405, message); - return; - } - - if (upgrade === undefined || upgrade.toLowerCase() !== 'websocket') { - const message = 'Invalid Upgrade header'; - abortHandshakeOrEmitwsClientError(this, req, socket, 400, message); - return; - } - - if (key === undefined || !keyRegex.test(key)) { - const message = 'Missing or invalid Sec-WebSocket-Key header'; - abortHandshakeOrEmitwsClientError(this, req, socket, 400, message); - return; - } - - if (version !== 13 && version !== 8) { - const message = 'Missing or invalid Sec-WebSocket-Version header'; - abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, { - 'Sec-WebSocket-Version': '13, 8' - }); - return; - } - - if (!this.shouldHandle(req)) { - abortHandshake(socket, 400); - return; - } - - const secWebSocketProtocol = req.headers['sec-websocket-protocol']; - let protocols = new Set(); - - if (secWebSocketProtocol !== undefined) { - try { - protocols = subprotocol.parse(secWebSocketProtocol); - } catch (err) { - const message = 'Invalid Sec-WebSocket-Protocol header'; - abortHandshakeOrEmitwsClientError(this, req, socket, 400, message); - return; - } - } - - const secWebSocketExtensions = req.headers['sec-websocket-extensions']; - const extensions = {}; - - if ( - this.options.perMessageDeflate && - secWebSocketExtensions !== undefined - ) { - const perMessageDeflate = new PerMessageDeflate( - this.options.perMessageDeflate, - true, - this.options.maxPayload - ); - - try { - const offers = extension.parse(secWebSocketExtensions); - - if (offers[PerMessageDeflate.extensionName]) { - perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]); - extensions[PerMessageDeflate.extensionName] = perMessageDeflate; - } - } catch (err) { - const message = - 'Invalid or unacceptable Sec-WebSocket-Extensions header'; - abortHandshakeOrEmitwsClientError(this, req, socket, 400, message); - return; - } - } - - // - // Optionally call external client verification handler. - // - if (this.options.verifyClient) { - const info = { - origin: - req.headers[`${version === 8 ? 'sec-websocket-origin' : 'origin'}`], - secure: !!(req.socket.authorized || req.socket.encrypted), - req - }; - - if (this.options.verifyClient.length === 2) { - this.options.verifyClient(info, (verified, code, message, headers) => { - if (!verified) { - return abortHandshake(socket, code || 401, message, headers); - } - - this.completeUpgrade( - extensions, - key, - protocols, - req, - socket, - head, - cb - ); - }); - return; - } - - if (!this.options.verifyClient(info)) return abortHandshake(socket, 401); - } - - this.completeUpgrade(extensions, key, protocols, req, socket, head, cb); - } - - /** - * Upgrade the connection to WebSocket. - * - * @param {Object} extensions The accepted extensions - * @param {String} key The value of the `Sec-WebSocket-Key` header - * @param {Set} protocols The subprotocols - * @param {http.IncomingMessage} req The request object - * @param {Duplex} socket The network socket between the server and client - * @param {Buffer} head The first packet of the upgraded stream - * @param {Function} cb Callback - * @throws {Error} If called more than once with the same socket - * @private - */ - completeUpgrade(extensions, key, protocols, req, socket, head, cb) { - // - // Destroy the socket if the client has already sent a FIN packet. - // - if (!socket.readable || !socket.writable) return socket.destroy(); - - if (socket[kWebSocket]) { - throw new Error( - 'server.handleUpgrade() was called more than once with the same ' + - 'socket, possibly due to a misconfiguration' - ); - } - - if (this._state > RUNNING) return abortHandshake(socket, 503); - - const digest = createHash('sha1') - .update(key + GUID) - .digest('base64'); - - const headers = [ - 'HTTP/1.1 101 Switching Protocols', - 'Upgrade: websocket', - 'Connection: Upgrade', - `Sec-WebSocket-Accept: ${digest}` - ]; - - const ws = new this.options.WebSocket(null, undefined, this.options); - - if (protocols.size) { - // - // Optionally call external protocol selection handler. - // - const protocol = this.options.handleProtocols - ? this.options.handleProtocols(protocols, req) - : protocols.values().next().value; - - if (protocol) { - headers.push(`Sec-WebSocket-Protocol: ${protocol}`); - ws._protocol = protocol; - } - } - - if (extensions[PerMessageDeflate.extensionName]) { - const params = extensions[PerMessageDeflate.extensionName].params; - const value = extension.format({ - [PerMessageDeflate.extensionName]: [params] - }); - headers.push(`Sec-WebSocket-Extensions: ${value}`); - ws._extensions = extensions; - } - - // - // Allow external modification/inspection of handshake headers. - // - this.emit('headers', headers, req); - - socket.write(headers.concat('\r\n').join('\r\n')); - socket.removeListener('error', socketOnError); - - ws.setSocket(socket, head, { - allowSynchronousEvents: this.options.allowSynchronousEvents, - maxPayload: this.options.maxPayload, - skipUTF8Validation: this.options.skipUTF8Validation - }); - - if (this.clients) { - this.clients.add(ws); - ws.on('close', () => { - this.clients.delete(ws); - - if (this._shouldEmitClose && !this.clients.size) { - process.nextTick(emitClose, this); - } - }); - } - - cb(ws, req); - } -} - -module.exports = WebSocketServer; - -/** - * Add event listeners on an `EventEmitter` using a map of - * pairs. - * - * @param {EventEmitter} server The event emitter - * @param {Object.} map The listeners to add - * @return {Function} A function that will remove the added listeners when - * called - * @private - */ -function addListeners(server, map) { - for (const event of Object.keys(map)) server.on(event, map[event]); - - return function removeListeners() { - for (const event of Object.keys(map)) { - server.removeListener(event, map[event]); - } - }; -} - -/** - * Emit a `'close'` event on an `EventEmitter`. - * - * @param {EventEmitter} server The event emitter - * @private - */ -function emitClose(server) { - server._state = CLOSED; - server.emit('close'); -} - -/** - * Handle socket errors. - * - * @private - */ -function socketOnError() { - this.destroy(); -} - -/** - * Close the connection when preconditions are not fulfilled. - * - * @param {Duplex} socket The socket of the upgrade request - * @param {Number} code The HTTP response status code - * @param {String} [message] The HTTP response body - * @param {Object} [headers] Additional HTTP response headers - * @private - */ -function abortHandshake(socket, code, message, headers) { - // - // The socket is writable unless the user destroyed or ended it before calling - // `server.handleUpgrade()` or in the `verifyClient` function, which is a user - // error. Handling this does not make much sense as the worst that can happen - // is that some of the data written by the user might be discarded due to the - // call to `socket.end()` below, which triggers an `'error'` event that in - // turn causes the socket to be destroyed. - // - message = message || http.STATUS_CODES[code]; - headers = { - Connection: 'close', - 'Content-Type': 'text/html', - 'Content-Length': Buffer.byteLength(message), - ...headers - }; - - socket.once('finish', socket.destroy); - - socket.end( - `HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r\n` + - Object.keys(headers) - .map((h) => `${h}: ${headers[h]}`) - .join('\r\n') + - '\r\n\r\n' + - message - ); -} - -/** - * Emit a `'wsClientError'` event on a `WebSocketServer` if there is at least - * one listener for it, otherwise call `abortHandshake()`. - * - * @param {WebSocketServer} server The WebSocket server - * @param {http.IncomingMessage} req The request object - * @param {Duplex} socket The socket of the upgrade request - * @param {Number} code The HTTP response status code - * @param {String} message The HTTP response body - * @param {Object} [headers] The HTTP response headers - * @private - */ -function abortHandshakeOrEmitwsClientError( - server, - req, - socket, - code, - message, - headers -) { - if (server.listenerCount('wsClientError')) { - const err = new Error(message); - Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError); - - server.emit('wsClientError', err, socket, req); - } else { - abortHandshake(socket, code, message, headers); - } -} diff --git a/yjs-poll/node_modules/ws/lib/websocket.js b/yjs-poll/node_modules/ws/lib/websocket.js deleted file mode 100644 index 0da2949..0000000 --- a/yjs-poll/node_modules/ws/lib/websocket.js +++ /dev/null @@ -1,1393 +0,0 @@ -/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex|Readable$", "caughtErrors": "none" }] */ - -'use strict'; - -const EventEmitter = require('events'); -const https = require('https'); -const http = require('http'); -const net = require('net'); -const tls = require('tls'); -const { randomBytes, createHash } = require('crypto'); -const { Duplex, Readable } = require('stream'); -const { URL } = require('url'); - -const PerMessageDeflate = require('./permessage-deflate'); -const Receiver = require('./receiver'); -const Sender = require('./sender'); -const { isBlob } = require('./validation'); - -const { - BINARY_TYPES, - CLOSE_TIMEOUT, - EMPTY_BUFFER, - GUID, - kForOnEventAttribute, - kListener, - kStatusCode, - kWebSocket, - NOOP -} = require('./constants'); -const { - EventTarget: { addEventListener, removeEventListener } -} = require('./event-target'); -const { format, parse } = require('./extension'); -const { toBuffer } = require('./buffer-util'); - -const kAborted = Symbol('kAborted'); -const protocolVersions = [8, 13]; -const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED']; -const subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/; - -/** - * Class representing a WebSocket. - * - * @extends EventEmitter - */ -class WebSocket extends EventEmitter { - /** - * Create a new `WebSocket`. - * - * @param {(String|URL)} address The URL to which to connect - * @param {(String|String[])} [protocols] The subprotocols - * @param {Object} [options] Connection options - */ - constructor(address, protocols, options) { - super(); - - this._binaryType = BINARY_TYPES[0]; - this._closeCode = 1006; - this._closeFrameReceived = false; - this._closeFrameSent = false; - this._closeMessage = EMPTY_BUFFER; - this._closeTimer = null; - this._errorEmitted = false; - this._extensions = {}; - this._paused = false; - this._protocol = ''; - this._readyState = WebSocket.CONNECTING; - this._receiver = null; - this._sender = null; - this._socket = null; - - if (address !== null) { - this._bufferedAmount = 0; - this._isServer = false; - this._redirects = 0; - - if (protocols === undefined) { - protocols = []; - } else if (!Array.isArray(protocols)) { - if (typeof protocols === 'object' && protocols !== null) { - options = protocols; - protocols = []; - } else { - protocols = [protocols]; - } - } - - initAsClient(this, address, protocols, options); - } else { - this._autoPong = options.autoPong; - this._closeTimeout = options.closeTimeout; - this._isServer = true; - } - } - - /** - * For historical reasons, the custom "nodebuffer" type is used by the default - * instead of "blob". - * - * @type {String} - */ - get binaryType() { - return this._binaryType; - } - - set binaryType(type) { - if (!BINARY_TYPES.includes(type)) return; - - this._binaryType = type; - - // - // Allow to change `binaryType` on the fly. - // - if (this._receiver) this._receiver._binaryType = type; - } - - /** - * @type {Number} - */ - get bufferedAmount() { - if (!this._socket) return this._bufferedAmount; - - return this._socket._writableState.length + this._sender._bufferedBytes; - } - - /** - * @type {String} - */ - get extensions() { - return Object.keys(this._extensions).join(); - } - - /** - * @type {Boolean} - */ - get isPaused() { - return this._paused; - } - - /** - * @type {Function} - */ - /* istanbul ignore next */ - get onclose() { - return null; - } - - /** - * @type {Function} - */ - /* istanbul ignore next */ - get onerror() { - return null; - } - - /** - * @type {Function} - */ - /* istanbul ignore next */ - get onopen() { - return null; - } - - /** - * @type {Function} - */ - /* istanbul ignore next */ - get onmessage() { - return null; - } - - /** - * @type {String} - */ - get protocol() { - return this._protocol; - } - - /** - * @type {Number} - */ - get readyState() { - return this._readyState; - } - - /** - * @type {String} - */ - get url() { - return this._url; - } - - /** - * Set up the socket and the internal resources. - * - * @param {Duplex} socket The network socket between the server and client - * @param {Buffer} head The first packet of the upgraded stream - * @param {Object} options Options object - * @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether - * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted - * multiple times in the same tick - * @param {Function} [options.generateMask] The function used to generate the - * masking key - * @param {Number} [options.maxPayload=0] The maximum allowed message size - * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or - * not to skip UTF-8 validation for text and close messages - * @private - */ - setSocket(socket, head, options) { - const receiver = new Receiver({ - allowSynchronousEvents: options.allowSynchronousEvents, - binaryType: this.binaryType, - extensions: this._extensions, - isServer: this._isServer, - maxPayload: options.maxPayload, - skipUTF8Validation: options.skipUTF8Validation - }); - - const sender = new Sender(socket, this._extensions, options.generateMask); - - this._receiver = receiver; - this._sender = sender; - this._socket = socket; - - receiver[kWebSocket] = this; - sender[kWebSocket] = this; - socket[kWebSocket] = this; - - receiver.on('conclude', receiverOnConclude); - receiver.on('drain', receiverOnDrain); - receiver.on('error', receiverOnError); - receiver.on('message', receiverOnMessage); - receiver.on('ping', receiverOnPing); - receiver.on('pong', receiverOnPong); - - sender.onerror = senderOnError; - - // - // These methods may not be available if `socket` is just a `Duplex`. - // - if (socket.setTimeout) socket.setTimeout(0); - if (socket.setNoDelay) socket.setNoDelay(); - - if (head.length > 0) socket.unshift(head); - - socket.on('close', socketOnClose); - socket.on('data', socketOnData); - socket.on('end', socketOnEnd); - socket.on('error', socketOnError); - - this._readyState = WebSocket.OPEN; - this.emit('open'); - } - - /** - * Emit the `'close'` event. - * - * @private - */ - emitClose() { - if (!this._socket) { - this._readyState = WebSocket.CLOSED; - this.emit('close', this._closeCode, this._closeMessage); - return; - } - - if (this._extensions[PerMessageDeflate.extensionName]) { - this._extensions[PerMessageDeflate.extensionName].cleanup(); - } - - this._receiver.removeAllListeners(); - this._readyState = WebSocket.CLOSED; - this.emit('close', this._closeCode, this._closeMessage); - } - - /** - * Start a closing handshake. - * - * +----------+ +-----------+ +----------+ - * - - -|ws.close()|-->|close frame|-->|ws.close()|- - - - * | +----------+ +-----------+ +----------+ | - * +----------+ +-----------+ | - * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING - * +----------+ +-----------+ | - * | | | +---+ | - * +------------------------+-->|fin| - - - - - * | +---+ | +---+ - * - - - - -|fin|<---------------------+ - * +---+ - * - * @param {Number} [code] Status code explaining why the connection is closing - * @param {(String|Buffer)} [data] The reason why the connection is - * closing - * @public - */ - close(code, data) { - if (this.readyState === WebSocket.CLOSED) return; - if (this.readyState === WebSocket.CONNECTING) { - const msg = 'WebSocket was closed before the connection was established'; - abortHandshake(this, this._req, msg); - return; - } - - if (this.readyState === WebSocket.CLOSING) { - if ( - this._closeFrameSent && - (this._closeFrameReceived || this._receiver._writableState.errorEmitted) - ) { - this._socket.end(); - } - - return; - } - - this._readyState = WebSocket.CLOSING; - this._sender.close(code, data, !this._isServer, (err) => { - // - // This error is handled by the `'error'` listener on the socket. We only - // want to know if the close frame has been sent here. - // - if (err) return; - - this._closeFrameSent = true; - - if ( - this._closeFrameReceived || - this._receiver._writableState.errorEmitted - ) { - this._socket.end(); - } - }); - - setCloseTimer(this); - } - - /** - * Pause the socket. - * - * @public - */ - pause() { - if ( - this.readyState === WebSocket.CONNECTING || - this.readyState === WebSocket.CLOSED - ) { - return; - } - - this._paused = true; - this._socket.pause(); - } - - /** - * Send a ping. - * - * @param {*} [data] The data to send - * @param {Boolean} [mask] Indicates whether or not to mask `data` - * @param {Function} [cb] Callback which is executed when the ping is sent - * @public - */ - ping(data, mask, cb) { - if (this.readyState === WebSocket.CONNECTING) { - throw new Error('WebSocket is not open: readyState 0 (CONNECTING)'); - } - - if (typeof data === 'function') { - cb = data; - data = mask = undefined; - } else if (typeof mask === 'function') { - cb = mask; - mask = undefined; - } - - if (typeof data === 'number') data = data.toString(); - - if (this.readyState !== WebSocket.OPEN) { - sendAfterClose(this, data, cb); - return; - } - - if (mask === undefined) mask = !this._isServer; - this._sender.ping(data || EMPTY_BUFFER, mask, cb); - } - - /** - * Send a pong. - * - * @param {*} [data] The data to send - * @param {Boolean} [mask] Indicates whether or not to mask `data` - * @param {Function} [cb] Callback which is executed when the pong is sent - * @public - */ - pong(data, mask, cb) { - if (this.readyState === WebSocket.CONNECTING) { - throw new Error('WebSocket is not open: readyState 0 (CONNECTING)'); - } - - if (typeof data === 'function') { - cb = data; - data = mask = undefined; - } else if (typeof mask === 'function') { - cb = mask; - mask = undefined; - } - - if (typeof data === 'number') data = data.toString(); - - if (this.readyState !== WebSocket.OPEN) { - sendAfterClose(this, data, cb); - return; - } - - if (mask === undefined) mask = !this._isServer; - this._sender.pong(data || EMPTY_BUFFER, mask, cb); - } - - /** - * Resume the socket. - * - * @public - */ - resume() { - if ( - this.readyState === WebSocket.CONNECTING || - this.readyState === WebSocket.CLOSED - ) { - return; - } - - this._paused = false; - if (!this._receiver._writableState.needDrain) this._socket.resume(); - } - - /** - * Send a data message. - * - * @param {*} data The message to send - * @param {Object} [options] Options object - * @param {Boolean} [options.binary] Specifies whether `data` is binary or - * text - * @param {Boolean} [options.compress] Specifies whether or not to compress - * `data` - * @param {Boolean} [options.fin=true] Specifies whether the fragment is the - * last one - * @param {Boolean} [options.mask] Specifies whether or not to mask `data` - * @param {Function} [cb] Callback which is executed when data is written out - * @public - */ - send(data, options, cb) { - if (this.readyState === WebSocket.CONNECTING) { - throw new Error('WebSocket is not open: readyState 0 (CONNECTING)'); - } - - if (typeof options === 'function') { - cb = options; - options = {}; - } - - if (typeof data === 'number') data = data.toString(); - - if (this.readyState !== WebSocket.OPEN) { - sendAfterClose(this, data, cb); - return; - } - - const opts = { - binary: typeof data !== 'string', - mask: !this._isServer, - compress: true, - fin: true, - ...options - }; - - if (!this._extensions[PerMessageDeflate.extensionName]) { - opts.compress = false; - } - - this._sender.send(data || EMPTY_BUFFER, opts, cb); - } - - /** - * Forcibly close the connection. - * - * @public - */ - terminate() { - if (this.readyState === WebSocket.CLOSED) return; - if (this.readyState === WebSocket.CONNECTING) { - const msg = 'WebSocket was closed before the connection was established'; - abortHandshake(this, this._req, msg); - return; - } - - if (this._socket) { - this._readyState = WebSocket.CLOSING; - this._socket.destroy(); - } - } -} - -/** - * @constant {Number} CONNECTING - * @memberof WebSocket - */ -Object.defineProperty(WebSocket, 'CONNECTING', { - enumerable: true, - value: readyStates.indexOf('CONNECTING') -}); - -/** - * @constant {Number} CONNECTING - * @memberof WebSocket.prototype - */ -Object.defineProperty(WebSocket.prototype, 'CONNECTING', { - enumerable: true, - value: readyStates.indexOf('CONNECTING') -}); - -/** - * @constant {Number} OPEN - * @memberof WebSocket - */ -Object.defineProperty(WebSocket, 'OPEN', { - enumerable: true, - value: readyStates.indexOf('OPEN') -}); - -/** - * @constant {Number} OPEN - * @memberof WebSocket.prototype - */ -Object.defineProperty(WebSocket.prototype, 'OPEN', { - enumerable: true, - value: readyStates.indexOf('OPEN') -}); - -/** - * @constant {Number} CLOSING - * @memberof WebSocket - */ -Object.defineProperty(WebSocket, 'CLOSING', { - enumerable: true, - value: readyStates.indexOf('CLOSING') -}); - -/** - * @constant {Number} CLOSING - * @memberof WebSocket.prototype - */ -Object.defineProperty(WebSocket.prototype, 'CLOSING', { - enumerable: true, - value: readyStates.indexOf('CLOSING') -}); - -/** - * @constant {Number} CLOSED - * @memberof WebSocket - */ -Object.defineProperty(WebSocket, 'CLOSED', { - enumerable: true, - value: readyStates.indexOf('CLOSED') -}); - -/** - * @constant {Number} CLOSED - * @memberof WebSocket.prototype - */ -Object.defineProperty(WebSocket.prototype, 'CLOSED', { - enumerable: true, - value: readyStates.indexOf('CLOSED') -}); - -[ - 'binaryType', - 'bufferedAmount', - 'extensions', - 'isPaused', - 'protocol', - 'readyState', - 'url' -].forEach((property) => { - Object.defineProperty(WebSocket.prototype, property, { enumerable: true }); -}); - -// -// Add the `onopen`, `onerror`, `onclose`, and `onmessage` attributes. -// See https://html.spec.whatwg.org/multipage/comms.html#the-websocket-interface -// -['open', 'error', 'close', 'message'].forEach((method) => { - Object.defineProperty(WebSocket.prototype, `on${method}`, { - enumerable: true, - get() { - for (const listener of this.listeners(method)) { - if (listener[kForOnEventAttribute]) return listener[kListener]; - } - - return null; - }, - set(handler) { - for (const listener of this.listeners(method)) { - if (listener[kForOnEventAttribute]) { - this.removeListener(method, listener); - break; - } - } - - if (typeof handler !== 'function') return; - - this.addEventListener(method, handler, { - [kForOnEventAttribute]: true - }); - } - }); -}); - -WebSocket.prototype.addEventListener = addEventListener; -WebSocket.prototype.removeEventListener = removeEventListener; - -module.exports = WebSocket; - -/** - * Initialize a WebSocket client. - * - * @param {WebSocket} websocket The client to initialize - * @param {(String|URL)} address The URL to which to connect - * @param {Array} protocols The subprotocols - * @param {Object} [options] Connection options - * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether any - * of the `'message'`, `'ping'`, and `'pong'` events can be emitted multiple - * times in the same tick - * @param {Boolean} [options.autoPong=true] Specifies whether or not to - * automatically send a pong in response to a ping - * @param {Number} [options.closeTimeout=30000] Duration in milliseconds to wait - * for the closing handshake to finish after `websocket.close()` is called - * @param {Function} [options.finishRequest] A function which can be used to - * customize the headers of each http request before it is sent - * @param {Boolean} [options.followRedirects=false] Whether or not to follow - * redirects - * @param {Function} [options.generateMask] The function used to generate the - * masking key - * @param {Number} [options.handshakeTimeout] Timeout in milliseconds for the - * handshake request - * @param {Number} [options.maxPayload=104857600] The maximum allowed message - * size - * @param {Number} [options.maxRedirects=10] The maximum number of redirects - * allowed - * @param {String} [options.origin] Value of the `Origin` or - * `Sec-WebSocket-Origin` header - * @param {(Boolean|Object)} [options.perMessageDeflate=true] Enable/disable - * permessage-deflate - * @param {Number} [options.protocolVersion=13] Value of the - * `Sec-WebSocket-Version` header - * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or - * not to skip UTF-8 validation for text and close messages - * @private - */ -function initAsClient(websocket, address, protocols, options) { - const opts = { - allowSynchronousEvents: true, - autoPong: true, - closeTimeout: CLOSE_TIMEOUT, - protocolVersion: protocolVersions[1], - maxPayload: 100 * 1024 * 1024, - skipUTF8Validation: false, - perMessageDeflate: true, - followRedirects: false, - maxRedirects: 10, - ...options, - socketPath: undefined, - hostname: undefined, - protocol: undefined, - timeout: undefined, - method: 'GET', - host: undefined, - path: undefined, - port: undefined - }; - - websocket._autoPong = opts.autoPong; - websocket._closeTimeout = opts.closeTimeout; - - if (!protocolVersions.includes(opts.protocolVersion)) { - throw new RangeError( - `Unsupported protocol version: ${opts.protocolVersion} ` + - `(supported versions: ${protocolVersions.join(', ')})` - ); - } - - let parsedUrl; - - if (address instanceof URL) { - parsedUrl = address; - } else { - try { - parsedUrl = new URL(address); - } catch (e) { - throw new SyntaxError(`Invalid URL: ${address}`); - } - } - - if (parsedUrl.protocol === 'http:') { - parsedUrl.protocol = 'ws:'; - } else if (parsedUrl.protocol === 'https:') { - parsedUrl.protocol = 'wss:'; - } - - websocket._url = parsedUrl.href; - - const isSecure = parsedUrl.protocol === 'wss:'; - const isIpcUrl = parsedUrl.protocol === 'ws+unix:'; - let invalidUrlMessage; - - if (parsedUrl.protocol !== 'ws:' && !isSecure && !isIpcUrl) { - invalidUrlMessage = - 'The URL\'s protocol must be one of "ws:", "wss:", ' + - '"http:", "https:", or "ws+unix:"'; - } else if (isIpcUrl && !parsedUrl.pathname) { - invalidUrlMessage = "The URL's pathname is empty"; - } else if (parsedUrl.hash) { - invalidUrlMessage = 'The URL contains a fragment identifier'; - } - - if (invalidUrlMessage) { - const err = new SyntaxError(invalidUrlMessage); - - if (websocket._redirects === 0) { - throw err; - } else { - emitErrorAndClose(websocket, err); - return; - } - } - - const defaultPort = isSecure ? 443 : 80; - const key = randomBytes(16).toString('base64'); - const request = isSecure ? https.request : http.request; - const protocolSet = new Set(); - let perMessageDeflate; - - opts.createConnection = - opts.createConnection || (isSecure ? tlsConnect : netConnect); - opts.defaultPort = opts.defaultPort || defaultPort; - opts.port = parsedUrl.port || defaultPort; - opts.host = parsedUrl.hostname.startsWith('[') - ? parsedUrl.hostname.slice(1, -1) - : parsedUrl.hostname; - opts.headers = { - ...opts.headers, - 'Sec-WebSocket-Version': opts.protocolVersion, - 'Sec-WebSocket-Key': key, - Connection: 'Upgrade', - Upgrade: 'websocket' - }; - opts.path = parsedUrl.pathname + parsedUrl.search; - opts.timeout = opts.handshakeTimeout; - - if (opts.perMessageDeflate) { - perMessageDeflate = new PerMessageDeflate( - opts.perMessageDeflate !== true ? opts.perMessageDeflate : {}, - false, - opts.maxPayload - ); - opts.headers['Sec-WebSocket-Extensions'] = format({ - [PerMessageDeflate.extensionName]: perMessageDeflate.offer() - }); - } - if (protocols.length) { - for (const protocol of protocols) { - if ( - typeof protocol !== 'string' || - !subprotocolRegex.test(protocol) || - protocolSet.has(protocol) - ) { - throw new SyntaxError( - 'An invalid or duplicated subprotocol was specified' - ); - } - - protocolSet.add(protocol); - } - - opts.headers['Sec-WebSocket-Protocol'] = protocols.join(','); - } - if (opts.origin) { - if (opts.protocolVersion < 13) { - opts.headers['Sec-WebSocket-Origin'] = opts.origin; - } else { - opts.headers.Origin = opts.origin; - } - } - if (parsedUrl.username || parsedUrl.password) { - opts.auth = `${parsedUrl.username}:${parsedUrl.password}`; - } - - if (isIpcUrl) { - const parts = opts.path.split(':'); - - opts.socketPath = parts[0]; - opts.path = parts[1]; - } - - let req; - - if (opts.followRedirects) { - if (websocket._redirects === 0) { - websocket._originalIpc = isIpcUrl; - websocket._originalSecure = isSecure; - websocket._originalHostOrSocketPath = isIpcUrl - ? opts.socketPath - : parsedUrl.host; - - const headers = options && options.headers; - - // - // Shallow copy the user provided options so that headers can be changed - // without mutating the original object. - // - options = { ...options, headers: {} }; - - if (headers) { - for (const [key, value] of Object.entries(headers)) { - options.headers[key.toLowerCase()] = value; - } - } - } else if (websocket.listenerCount('redirect') === 0) { - const isSameHost = isIpcUrl - ? websocket._originalIpc - ? opts.socketPath === websocket._originalHostOrSocketPath - : false - : websocket._originalIpc - ? false - : parsedUrl.host === websocket._originalHostOrSocketPath; - - if (!isSameHost || (websocket._originalSecure && !isSecure)) { - // - // Match curl 7.77.0 behavior and drop the following headers. These - // headers are also dropped when following a redirect to a subdomain. - // - delete opts.headers.authorization; - delete opts.headers.cookie; - - if (!isSameHost) delete opts.headers.host; - - opts.auth = undefined; - } - } - - // - // Match curl 7.77.0 behavior and make the first `Authorization` header win. - // If the `Authorization` header is set, then there is nothing to do as it - // will take precedence. - // - if (opts.auth && !options.headers.authorization) { - options.headers.authorization = - 'Basic ' + Buffer.from(opts.auth).toString('base64'); - } - - req = websocket._req = request(opts); - - if (websocket._redirects) { - // - // Unlike what is done for the `'upgrade'` event, no early exit is - // triggered here if the user calls `websocket.close()` or - // `websocket.terminate()` from a listener of the `'redirect'` event. This - // is because the user can also call `request.destroy()` with an error - // before calling `websocket.close()` or `websocket.terminate()` and this - // would result in an error being emitted on the `request` object with no - // `'error'` event listeners attached. - // - websocket.emit('redirect', websocket.url, req); - } - } else { - req = websocket._req = request(opts); - } - - if (opts.timeout) { - req.on('timeout', () => { - abortHandshake(websocket, req, 'Opening handshake has timed out'); - }); - } - - req.on('error', (err) => { - if (req === null || req[kAborted]) return; - - req = websocket._req = null; - emitErrorAndClose(websocket, err); - }); - - req.on('response', (res) => { - const location = res.headers.location; - const statusCode = res.statusCode; - - if ( - location && - opts.followRedirects && - statusCode >= 300 && - statusCode < 400 - ) { - if (++websocket._redirects > opts.maxRedirects) { - abortHandshake(websocket, req, 'Maximum redirects exceeded'); - return; - } - - req.abort(); - - let addr; - - try { - addr = new URL(location, address); - } catch (e) { - const err = new SyntaxError(`Invalid URL: ${location}`); - emitErrorAndClose(websocket, err); - return; - } - - initAsClient(websocket, addr, protocols, options); - } else if (!websocket.emit('unexpected-response', req, res)) { - abortHandshake( - websocket, - req, - `Unexpected server response: ${res.statusCode}` - ); - } - }); - - req.on('upgrade', (res, socket, head) => { - websocket.emit('upgrade', res); - - // - // The user may have closed the connection from a listener of the - // `'upgrade'` event. - // - if (websocket.readyState !== WebSocket.CONNECTING) return; - - req = websocket._req = null; - - const upgrade = res.headers.upgrade; - - if (upgrade === undefined || upgrade.toLowerCase() !== 'websocket') { - abortHandshake(websocket, socket, 'Invalid Upgrade header'); - return; - } - - const digest = createHash('sha1') - .update(key + GUID) - .digest('base64'); - - if (res.headers['sec-websocket-accept'] !== digest) { - abortHandshake(websocket, socket, 'Invalid Sec-WebSocket-Accept header'); - return; - } - - const serverProt = res.headers['sec-websocket-protocol']; - let protError; - - if (serverProt !== undefined) { - if (!protocolSet.size) { - protError = 'Server sent a subprotocol but none was requested'; - } else if (!protocolSet.has(serverProt)) { - protError = 'Server sent an invalid subprotocol'; - } - } else if (protocolSet.size) { - protError = 'Server sent no subprotocol'; - } - - if (protError) { - abortHandshake(websocket, socket, protError); - return; - } - - if (serverProt) websocket._protocol = serverProt; - - const secWebSocketExtensions = res.headers['sec-websocket-extensions']; - - if (secWebSocketExtensions !== undefined) { - if (!perMessageDeflate) { - const message = - 'Server sent a Sec-WebSocket-Extensions header but no extension ' + - 'was requested'; - abortHandshake(websocket, socket, message); - return; - } - - let extensions; - - try { - extensions = parse(secWebSocketExtensions); - } catch (err) { - const message = 'Invalid Sec-WebSocket-Extensions header'; - abortHandshake(websocket, socket, message); - return; - } - - const extensionNames = Object.keys(extensions); - - if ( - extensionNames.length !== 1 || - extensionNames[0] !== PerMessageDeflate.extensionName - ) { - const message = 'Server indicated an extension that was not requested'; - abortHandshake(websocket, socket, message); - return; - } - - try { - perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]); - } catch (err) { - const message = 'Invalid Sec-WebSocket-Extensions header'; - abortHandshake(websocket, socket, message); - return; - } - - websocket._extensions[PerMessageDeflate.extensionName] = - perMessageDeflate; - } - - websocket.setSocket(socket, head, { - allowSynchronousEvents: opts.allowSynchronousEvents, - generateMask: opts.generateMask, - maxPayload: opts.maxPayload, - skipUTF8Validation: opts.skipUTF8Validation - }); - }); - - if (opts.finishRequest) { - opts.finishRequest(req, websocket); - } else { - req.end(); - } -} - -/** - * Emit the `'error'` and `'close'` events. - * - * @param {WebSocket} websocket The WebSocket instance - * @param {Error} The error to emit - * @private - */ -function emitErrorAndClose(websocket, err) { - websocket._readyState = WebSocket.CLOSING; - // - // The following assignment is practically useless and is done only for - // consistency. - // - websocket._errorEmitted = true; - websocket.emit('error', err); - websocket.emitClose(); -} - -/** - * Create a `net.Socket` and initiate a connection. - * - * @param {Object} options Connection options - * @return {net.Socket} The newly created socket used to start the connection - * @private - */ -function netConnect(options) { - options.path = options.socketPath; - return net.connect(options); -} - -/** - * Create a `tls.TLSSocket` and initiate a connection. - * - * @param {Object} options Connection options - * @return {tls.TLSSocket} The newly created socket used to start the connection - * @private - */ -function tlsConnect(options) { - options.path = undefined; - - if (!options.servername && options.servername !== '') { - options.servername = net.isIP(options.host) ? '' : options.host; - } - - return tls.connect(options); -} - -/** - * Abort the handshake and emit an error. - * - * @param {WebSocket} websocket The WebSocket instance - * @param {(http.ClientRequest|net.Socket|tls.Socket)} stream The request to - * abort or the socket to destroy - * @param {String} message The error message - * @private - */ -function abortHandshake(websocket, stream, message) { - websocket._readyState = WebSocket.CLOSING; - - const err = new Error(message); - Error.captureStackTrace(err, abortHandshake); - - if (stream.setHeader) { - stream[kAborted] = true; - stream.abort(); - - if (stream.socket && !stream.socket.destroyed) { - // - // On Node.js >= 14.3.0 `request.abort()` does not destroy the socket if - // called after the request completed. See - // https://github.com/websockets/ws/issues/1869. - // - stream.socket.destroy(); - } - - process.nextTick(emitErrorAndClose, websocket, err); - } else { - stream.destroy(err); - stream.once('error', websocket.emit.bind(websocket, 'error')); - stream.once('close', websocket.emitClose.bind(websocket)); - } -} - -/** - * Handle cases where the `ping()`, `pong()`, or `send()` methods are called - * when the `readyState` attribute is `CLOSING` or `CLOSED`. - * - * @param {WebSocket} websocket The WebSocket instance - * @param {*} [data] The data to send - * @param {Function} [cb] Callback - * @private - */ -function sendAfterClose(websocket, data, cb) { - if (data) { - const length = isBlob(data) ? data.size : toBuffer(data).length; - - // - // The `_bufferedAmount` property is used only when the peer is a client and - // the opening handshake fails. Under these circumstances, in fact, the - // `setSocket()` method is not called, so the `_socket` and `_sender` - // properties are set to `null`. - // - if (websocket._socket) websocket._sender._bufferedBytes += length; - else websocket._bufferedAmount += length; - } - - if (cb) { - const err = new Error( - `WebSocket is not open: readyState ${websocket.readyState} ` + - `(${readyStates[websocket.readyState]})` - ); - process.nextTick(cb, err); - } -} - -/** - * The listener of the `Receiver` `'conclude'` event. - * - * @param {Number} code The status code - * @param {Buffer} reason The reason for closing - * @private - */ -function receiverOnConclude(code, reason) { - const websocket = this[kWebSocket]; - - websocket._closeFrameReceived = true; - websocket._closeMessage = reason; - websocket._closeCode = code; - - if (websocket._socket[kWebSocket] === undefined) return; - - websocket._socket.removeListener('data', socketOnData); - process.nextTick(resume, websocket._socket); - - if (code === 1005) websocket.close(); - else websocket.close(code, reason); -} - -/** - * The listener of the `Receiver` `'drain'` event. - * - * @private - */ -function receiverOnDrain() { - const websocket = this[kWebSocket]; - - if (!websocket.isPaused) websocket._socket.resume(); -} - -/** - * The listener of the `Receiver` `'error'` event. - * - * @param {(RangeError|Error)} err The emitted error - * @private - */ -function receiverOnError(err) { - const websocket = this[kWebSocket]; - - if (websocket._socket[kWebSocket] !== undefined) { - websocket._socket.removeListener('data', socketOnData); - - // - // On Node.js < 14.0.0 the `'error'` event is emitted synchronously. See - // https://github.com/websockets/ws/issues/1940. - // - process.nextTick(resume, websocket._socket); - - websocket.close(err[kStatusCode]); - } - - if (!websocket._errorEmitted) { - websocket._errorEmitted = true; - websocket.emit('error', err); - } -} - -/** - * The listener of the `Receiver` `'finish'` event. - * - * @private - */ -function receiverOnFinish() { - this[kWebSocket].emitClose(); -} - -/** - * The listener of the `Receiver` `'message'` event. - * - * @param {Buffer|ArrayBuffer|Buffer[])} data The message - * @param {Boolean} isBinary Specifies whether the message is binary or not - * @private - */ -function receiverOnMessage(data, isBinary) { - this[kWebSocket].emit('message', data, isBinary); -} - -/** - * The listener of the `Receiver` `'ping'` event. - * - * @param {Buffer} data The data included in the ping frame - * @private - */ -function receiverOnPing(data) { - const websocket = this[kWebSocket]; - - if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP); - websocket.emit('ping', data); -} - -/** - * The listener of the `Receiver` `'pong'` event. - * - * @param {Buffer} data The data included in the pong frame - * @private - */ -function receiverOnPong(data) { - this[kWebSocket].emit('pong', data); -} - -/** - * Resume a readable stream - * - * @param {Readable} stream The readable stream - * @private - */ -function resume(stream) { - stream.resume(); -} - -/** - * The `Sender` error event handler. - * - * @param {Error} The error - * @private - */ -function senderOnError(err) { - const websocket = this[kWebSocket]; - - if (websocket.readyState === WebSocket.CLOSED) return; - if (websocket.readyState === WebSocket.OPEN) { - websocket._readyState = WebSocket.CLOSING; - setCloseTimer(websocket); - } - - // - // `socket.end()` is used instead of `socket.destroy()` to allow the other - // peer to finish sending queued data. There is no need to set a timer here - // because `CLOSING` means that it is already set or not needed. - // - this._socket.end(); - - if (!websocket._errorEmitted) { - websocket._errorEmitted = true; - websocket.emit('error', err); - } -} - -/** - * Set a timer to destroy the underlying raw socket of a WebSocket. - * - * @param {WebSocket} websocket The WebSocket instance - * @private - */ -function setCloseTimer(websocket) { - websocket._closeTimer = setTimeout( - websocket._socket.destroy.bind(websocket._socket), - websocket._closeTimeout - ); -} - -/** - * The listener of the socket `'close'` event. - * - * @private - */ -function socketOnClose() { - const websocket = this[kWebSocket]; - - this.removeListener('close', socketOnClose); - this.removeListener('data', socketOnData); - this.removeListener('end', socketOnEnd); - - websocket._readyState = WebSocket.CLOSING; - - // - // The close frame might not have been received or the `'end'` event emitted, - // for example, if the socket was destroyed due to an error. Ensure that the - // `receiver` stream is closed after writing any remaining buffered data to - // it. If the readable side of the socket is in flowing mode then there is no - // buffered data as everything has been already written. If instead, the - // socket is paused, any possible buffered data will be read as a single - // chunk. - // - if ( - !this._readableState.endEmitted && - !websocket._closeFrameReceived && - !websocket._receiver._writableState.errorEmitted && - this._readableState.length !== 0 - ) { - const chunk = this.read(this._readableState.length); - - websocket._receiver.write(chunk); - } - - websocket._receiver.end(); - - this[kWebSocket] = undefined; - - clearTimeout(websocket._closeTimer); - - if ( - websocket._receiver._writableState.finished || - websocket._receiver._writableState.errorEmitted - ) { - websocket.emitClose(); - } else { - websocket._receiver.on('error', receiverOnFinish); - websocket._receiver.on('finish', receiverOnFinish); - } -} - -/** - * The listener of the socket `'data'` event. - * - * @param {Buffer} chunk A chunk of data - * @private - */ -function socketOnData(chunk) { - if (!this[kWebSocket]._receiver.write(chunk)) { - this.pause(); - } -} - -/** - * The listener of the socket `'end'` event. - * - * @private - */ -function socketOnEnd() { - const websocket = this[kWebSocket]; - - websocket._readyState = WebSocket.CLOSING; - websocket._receiver.end(); - this.end(); -} - -/** - * The listener of the socket `'error'` event. - * - * @private - */ -function socketOnError() { - const websocket = this[kWebSocket]; - - this.removeListener('error', socketOnError); - this.on('error', NOOP); - - if (websocket) { - websocket._readyState = WebSocket.CLOSING; - this.destroy(); - } -} diff --git a/yjs-poll/node_modules/ws/package.json b/yjs-poll/node_modules/ws/package.json deleted file mode 100644 index 91b8269..0000000 --- a/yjs-poll/node_modules/ws/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "ws", - "version": "8.19.0", - "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js", - "keywords": [ - "HyBi", - "Push", - "RFC-6455", - "WebSocket", - "WebSockets", - "real-time" - ], - "homepage": "https://github.com/websockets/ws", - "bugs": "https://github.com/websockets/ws/issues", - "repository": { - "type": "git", - "url": "git+https://github.com/websockets/ws.git" - }, - "author": "Einar Otto Stangvik (http://2x.io)", - "license": "MIT", - "main": "index.js", - "exports": { - ".": { - "browser": "./browser.js", - "import": "./wrapper.mjs", - "require": "./index.js" - }, - "./package.json": "./package.json" - }, - "browser": "browser.js", - "engines": { - "node": ">=10.0.0" - }, - "files": [ - "browser.js", - "index.js", - "lib/*.js", - "wrapper.mjs" - ], - "scripts": { - "test": "nyc --reporter=lcov --reporter=text mocha --throw-deprecation test/*.test.js", - "integration": "mocha --throw-deprecation test/*.integration.js", - "lint": "eslint . && prettier --check --ignore-path .gitignore \"**/*.{json,md,yaml,yml}\"" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - }, - "devDependencies": { - "benchmark": "^2.1.4", - "bufferutil": "^4.0.1", - "eslint": "^9.0.0", - "eslint-config-prettier": "^10.0.1", - "eslint-plugin-prettier": "^5.0.0", - "globals": "^16.0.0", - "mocha": "^8.4.0", - "nyc": "^15.0.0", - "prettier": "^3.0.0", - "utf-8-validate": "^6.0.0" - } -} diff --git a/yjs-poll/node_modules/ws/wrapper.mjs b/yjs-poll/node_modules/ws/wrapper.mjs deleted file mode 100644 index 7245ad1..0000000 --- a/yjs-poll/node_modules/ws/wrapper.mjs +++ /dev/null @@ -1,8 +0,0 @@ -import createWebSocketStream from './lib/stream.js'; -import Receiver from './lib/receiver.js'; -import Sender from './lib/sender.js'; -import WebSocket from './lib/websocket.js'; -import WebSocketServer from './lib/websocket-server.js'; - -export { createWebSocketStream, Receiver, Sender, WebSocket, WebSocketServer }; -export default WebSocket; diff --git a/yjs-poll/node_modules/y-protocols/LICENSE b/yjs-poll/node_modules/y-protocols/LICENSE deleted file mode 100644 index ac0e51d..0000000 --- a/yjs-poll/node_modules/y-protocols/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2019 Kevin Jahns . - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/yjs-poll/node_modules/y-protocols/README.md b/yjs-poll/node_modules/y-protocols/README.md deleted file mode 100644 index 1c05bad..0000000 --- a/yjs-poll/node_modules/y-protocols/README.md +++ /dev/null @@ -1,78 +0,0 @@ -# Yjs Protocols -> Binary encoding protocols for *syncing*, *awareness*, and *history information* - -This API is unstable and subject to change. - -## API - -### Awareness Protocol - -```js -import * as awarenessProtocol from 'y-protocols/awareness.js' -``` - -The Awareness protocol implements a simple network agnostic algorithm that -manages user status (who is online?) and propagate awareness information like -cursor location, username, or email address. Each client can update its own -local state and listen to state changes of remote clients. - -Each client has an awareness state. Remote awareness are stored in a Map that -maps from remote client id to remote awareness state. An *awareness state* is an -increasing clock attached to a schemaless json object. - -Whenever the client changes its local state, it increases the clock and -propagates its own awareness state to all peers. When a client receives a remote -awareness state, and overwrites the clients state if the received state is newer -than the local awareness state for that client. If the state is `null`, the -client is marked as offline. If a client doesn't receive updates from a remote -peer for 30 seconds, it marks the remote client as offline. Hence each client -must broadcast its own awareness state in a regular interval to make sure that -remote clients don't mark it as offline. - -#### awarenessProtocol.Awareness Class - -```js -const ydoc = new Y.Doc() -const awareness = new awarenessProtocol.Awareness(ydoc) -``` - -

- clientID:number -
A unique identifier that identifies this client.
- getLocalState():Object<string,any>|null -
Get the local awareness state.
- setLocalState(Object<string,any>|null) -
-Set/Update the local awareness state. Set `null` to mark the local client as -offline. -
- setLocalStateField(string, any) -
-Only update a single field on the local awareness object. Does not do -anything if the local state is not set. -
- getStates():Map<number,Object<string,any>> -
-Get all client awareness states (remote and local). Maps from clientID to -awareness state. -
- -on('change', ({ added: Array<number>, updated: Array<number> -removed: Array<number> }, [transactionOrigin:any]) => ..) - -
-Listen to remote and local state changes on the awareness instance. -
- -on('update', ({ added: Array<number>, updated: Array<number> -removed: Array<number> }, [transactionOrigin:any]) => ..) - -
-Listen to remote and local awareness changes on the awareness instance. -This event is called even when the awarenes state does not change. -
-
- -### License - -[The MIT License](./LICENSE) © Kevin Jahns diff --git a/yjs-poll/node_modules/y-protocols/auth.d.ts b/yjs-poll/node_modules/y-protocols/auth.d.ts deleted file mode 100644 index 5027d56..0000000 --- a/yjs-poll/node_modules/y-protocols/auth.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export const messagePermissionDenied: 0; -export function writePermissionDenied(encoder: encoding.Encoder, reason: string): void; -export function readAuthMessage(decoder: decoding.Decoder, y: Y.Doc, permissionDeniedHandler: PermissionDeniedHandler): void; -export type PermissionDeniedHandler = (y: any, reason: string) => any; -import * as encoding from 'lib0/encoding'; -import * as decoding from 'lib0/decoding'; -import * as Y from 'yjs'; -//# sourceMappingURL=auth.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/y-protocols/auth.d.ts.map b/yjs-poll/node_modules/y-protocols/auth.d.ts.map deleted file mode 100644 index 09e077f..0000000 --- a/yjs-poll/node_modules/y-protocols/auth.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["auth.js"],"names":[],"mappings":"AAKA,wCAAwC;AAMjC,+CAHI,SAAS,OAAO,UAChB,MAAM,QAKhB;AAcM,yCAJI,SAAS,OAAO,KAChB,EAAE,GAAG,2BACL,uBAAuB,QAMjC;0CAdU,GAAG,UACH,MAAM;0BAjBS,eAAe;0BACf,eAAe;mBAFtB,KAAK"} \ No newline at end of file diff --git a/yjs-poll/node_modules/y-protocols/auth.js b/yjs-poll/node_modules/y-protocols/auth.js deleted file mode 100644 index ab9eedd..0000000 --- a/yjs-poll/node_modules/y-protocols/auth.js +++ /dev/null @@ -1,33 +0,0 @@ - -import * as Y from 'yjs' // eslint-disable-line -import * as encoding from 'lib0/encoding' -import * as decoding from 'lib0/decoding' - -export const messagePermissionDenied = 0 - -/** - * @param {encoding.Encoder} encoder - * @param {string} reason - */ -export const writePermissionDenied = (encoder, reason) => { - encoding.writeVarUint(encoder, messagePermissionDenied) - encoding.writeVarString(encoder, reason) -} - -/** - * @callback PermissionDeniedHandler - * @param {any} y - * @param {string} reason - */ - -/** - * - * @param {decoding.Decoder} decoder - * @param {Y.Doc} y - * @param {PermissionDeniedHandler} permissionDeniedHandler - */ -export const readAuthMessage = (decoder, y, permissionDeniedHandler) => { - switch (decoding.readVarUint(decoder)) { - case messagePermissionDenied: permissionDeniedHandler(y, decoding.readVarString(decoder)) - } -} diff --git a/yjs-poll/node_modules/y-protocols/awareness.d.ts b/yjs-poll/node_modules/y-protocols/awareness.d.ts deleted file mode 100644 index a0e3b1c..0000000 --- a/yjs-poll/node_modules/y-protocols/awareness.d.ts +++ /dev/null @@ -1,86 +0,0 @@ -export const outdatedTimeout: 30000; -/** - * @typedef {Object} MetaClientState - * @property {number} MetaClientState.clock - * @property {number} MetaClientState.lastUpdated unix timestamp - */ -/** - * The Awareness class implements a simple shared state protocol that can be used for non-persistent data like awareness information - * (cursor, username, status, ..). Each client can update its own local state and listen to state changes of - * remote clients. Every client may set a state of a remote peer to `null` to mark the client as offline. - * - * Each client is identified by a unique client id (something we borrow from `doc.clientID`). A client can override - * its own state by propagating a message with an increasing timestamp (`clock`). If such a message is received, it is - * applied if the known state of that client is older than the new state (`clock < newClock`). If a client thinks that - * a remote client is offline, it may propagate a message with - * `{ clock: currentClientClock, state: null, client: remoteClient }`. If such a - * message is received, and the known clock of that client equals the received clock, it will override the state with `null`. - * - * Before a client disconnects, it should propagate a `null` state with an updated clock. - * - * Awareness states must be updated every 30 seconds. Otherwise the Awareness instance will delete the client state. - * - * @extends {Observable} - */ -export class Awareness extends Observable { - /** - * @param {Y.Doc} doc - */ - constructor(doc: Y.Doc); - doc: Y.Doc; - /** - * @type {number} - */ - clientID: number; - /** - * Maps from client id to client state - * @type {Map>} - */ - states: Map; - /** - * @type {Map} - */ - meta: Map; - _checkInterval: any; - /** - * @return {Object|null} - */ - getLocalState(): { - [x: string]: any; - } | null; - /** - * @param {Object|null} state - */ - setLocalState(state: { - [x: string]: any; - } | null): void; - /** - * @param {string} field - * @param {any} value - */ - setLocalStateField(field: string, value: any): void; - /** - * @return {Map>} - */ - getStates(): Map; -} -export function removeAwarenessStates(awareness: Awareness, clients: Array, origin: any): void; -export function encodeAwarenessUpdate(awareness: Awareness, clients: Array, states?: Map): Uint8Array; -export function modifyAwarenessUpdate(update: Uint8Array, modify: (arg0: any) => any): Uint8Array; -export function applyAwarenessUpdate(awareness: Awareness, update: Uint8Array, origin: any): void; -export type MetaClientState = { - clock: number; - /** - * unix timestamp - */ - lastUpdated: number; -}; -import { Observable } from 'lib0/observable'; -import * as Y from 'yjs'; -//# sourceMappingURL=awareness.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/y-protocols/awareness.d.ts.map b/yjs-poll/node_modules/y-protocols/awareness.d.ts.map deleted file mode 100644 index c50efbe..0000000 --- a/yjs-poll/node_modules/y-protocols/awareness.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"awareness.d.ts","sourceRoot":"","sources":["awareness.js"],"names":[],"mappings":"AAYA,oCAAoC;AAEpC;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH;IACE;;OAEG;IACH,iBAFW,EAAE,GAAG,EAyCf;IArCC,WAAc;IACd;;OAEG;IACH,UAFU,MAAM,CAEY;IAC5B;;;OAGG;IACH,QAFU,IAAI,MAAM;YAAS,MAAM,GAAE,GAAG;MAAE,CAEnB;IACvB;;OAEG;IACH,MAFU,IAAI,MAAM,EAAE,eAAe,CAAC,CAEjB;IACrB,oBAkBqC;IAcvC;;OAEG;IACH,iBAFY;YAAO,MAAM,GAAC,GAAG;QAAE,IAAI,CAIlC;IAED;;OAEG;IACH,qBAFW;YAAO,MAAM,GAAC,GAAG;QAAE,IAAI,QAoCjC;IAED;;;OAGG;IACH,0BAHW,MAAM,SACN,GAAG,QAUb;IAED;;OAEG;IACH,aAFY,IAAI,MAAM;YAAQ,MAAM,GAAC,GAAG;MAAE,CAIzC;CACF;AAUM,iDAJI,SAAS,WACT,MAAM,MAAM,CAAC,UACb,GAAG,QAsBb;AAOM,iDAJI,SAAS,WACT,MAAM,MAAM,CAAC;;KACZ,UAAU,CAerB;AAYM,8CAJI,UAAU,iBACD,GAAG,KAAE,GAAG,GAChB,UAAU,CAiBrB;AAOM,gDAJI,SAAS,UACT,UAAU,UACV,GAAG,QAwDb;;WAtRa,MAAM;;;;iBACN,MAAM;;2BATO,iBAAiB;mBAEzB,KAAK"} \ No newline at end of file diff --git a/yjs-poll/node_modules/y-protocols/awareness.js b/yjs-poll/node_modules/y-protocols/awareness.js deleted file mode 100644 index 8f9ae94..0000000 --- a/yjs-poll/node_modules/y-protocols/awareness.js +++ /dev/null @@ -1,295 +0,0 @@ -/** - * @module awareness-protocol - */ - -import * as encoding from 'lib0/encoding' -import * as decoding from 'lib0/decoding' -import * as time from 'lib0/time' -import * as math from 'lib0/math' -import { Observable } from 'lib0/observable' -import * as f from 'lib0/function' -import * as Y from 'yjs' // eslint-disable-line - -export const outdatedTimeout = 30000 - -/** - * @typedef {Object} MetaClientState - * @property {number} MetaClientState.clock - * @property {number} MetaClientState.lastUpdated unix timestamp - */ - -/** - * The Awareness class implements a simple shared state protocol that can be used for non-persistent data like awareness information - * (cursor, username, status, ..). Each client can update its own local state and listen to state changes of - * remote clients. Every client may set a state of a remote peer to `null` to mark the client as offline. - * - * Each client is identified by a unique client id (something we borrow from `doc.clientID`). A client can override - * its own state by propagating a message with an increasing timestamp (`clock`). If such a message is received, it is - * applied if the known state of that client is older than the new state (`clock < newClock`). If a client thinks that - * a remote client is offline, it may propagate a message with - * `{ clock: currentClientClock, state: null, client: remoteClient }`. If such a - * message is received, and the known clock of that client equals the received clock, it will override the state with `null`. - * - * Before a client disconnects, it should propagate a `null` state with an updated clock. - * - * Awareness states must be updated every 30 seconds. Otherwise the Awareness instance will delete the client state. - * - * @extends {Observable} - */ -export class Awareness extends Observable { - /** - * @param {Y.Doc} doc - */ - constructor (doc) { - super() - this.doc = doc - /** - * @type {number} - */ - this.clientID = doc.clientID - /** - * Maps from client id to client state - * @type {Map>} - */ - this.states = new Map() - /** - * @type {Map} - */ - this.meta = new Map() - this._checkInterval = /** @type {any} */ (setInterval(() => { - const now = time.getUnixTime() - if (this.getLocalState() !== null && (outdatedTimeout / 2 <= now - /** @type {{lastUpdated:number}} */ (this.meta.get(this.clientID)).lastUpdated)) { - // renew local clock - this.setLocalState(this.getLocalState()) - } - /** - * @type {Array} - */ - const remove = [] - this.meta.forEach((meta, clientid) => { - if (clientid !== this.clientID && outdatedTimeout <= now - meta.lastUpdated && this.states.has(clientid)) { - remove.push(clientid) - } - }) - if (remove.length > 0) { - removeAwarenessStates(this, remove, 'timeout') - } - }, math.floor(outdatedTimeout / 10))) - doc.on('destroy', () => { - this.destroy() - }) - this.setLocalState({}) - } - - destroy () { - this.emit('destroy', [this]) - this.setLocalState(null) - super.destroy() - clearInterval(this._checkInterval) - } - - /** - * @return {Object|null} - */ - getLocalState () { - return this.states.get(this.clientID) || null - } - - /** - * @param {Object|null} state - */ - setLocalState (state) { - const clientID = this.clientID - const currLocalMeta = this.meta.get(clientID) - const clock = currLocalMeta === undefined ? 0 : currLocalMeta.clock + 1 - const prevState = this.states.get(clientID) - if (state === null) { - this.states.delete(clientID) - } else { - this.states.set(clientID, state) - } - this.meta.set(clientID, { - clock, - lastUpdated: time.getUnixTime() - }) - const added = [] - const updated = [] - const filteredUpdated = [] - const removed = [] - if (state === null) { - removed.push(clientID) - } else if (prevState == null) { - if (state != null) { - added.push(clientID) - } - } else { - updated.push(clientID) - if (!f.equalityDeep(prevState, state)) { - filteredUpdated.push(clientID) - } - } - if (added.length > 0 || filteredUpdated.length > 0 || removed.length > 0) { - this.emit('change', [{ added, updated: filteredUpdated, removed }, 'local']) - } - this.emit('update', [{ added, updated, removed }, 'local']) - } - - /** - * @param {string} field - * @param {any} value - */ - setLocalStateField (field, value) { - const state = this.getLocalState() - if (state !== null) { - this.setLocalState({ - ...state, - [field]: value - }) - } - } - - /** - * @return {Map>} - */ - getStates () { - return this.states - } -} - -/** - * Mark (remote) clients as inactive and remove them from the list of active peers. - * This change will be propagated to remote clients. - * - * @param {Awareness} awareness - * @param {Array} clients - * @param {any} origin - */ -export const removeAwarenessStates = (awareness, clients, origin) => { - const removed = [] - for (let i = 0; i < clients.length; i++) { - const clientID = clients[i] - if (awareness.states.has(clientID)) { - awareness.states.delete(clientID) - if (clientID === awareness.clientID) { - const curMeta = /** @type {MetaClientState} */ (awareness.meta.get(clientID)) - awareness.meta.set(clientID, { - clock: curMeta.clock + 1, - lastUpdated: time.getUnixTime() - }) - } - removed.push(clientID) - } - } - if (removed.length > 0) { - awareness.emit('change', [{ added: [], updated: [], removed }, origin]) - awareness.emit('update', [{ added: [], updated: [], removed }, origin]) - } -} - -/** - * @param {Awareness} awareness - * @param {Array} clients - * @return {Uint8Array} - */ -export const encodeAwarenessUpdate = (awareness, clients, states = awareness.states) => { - const len = clients.length - const encoder = encoding.createEncoder() - encoding.writeVarUint(encoder, len) - for (let i = 0; i < len; i++) { - const clientID = clients[i] - const state = states.get(clientID) || null - const clock = /** @type {MetaClientState} */ (awareness.meta.get(clientID)).clock - encoding.writeVarUint(encoder, clientID) - encoding.writeVarUint(encoder, clock) - encoding.writeVarString(encoder, JSON.stringify(state)) - } - return encoding.toUint8Array(encoder) -} - -/** - * Modify the content of an awareness update before re-encoding it to an awareness update. - * - * This might be useful when you have a central server that wants to ensure that clients - * cant hijack somebody elses identity. - * - * @param {Uint8Array} update - * @param {function(any):any} modify - * @return {Uint8Array} - */ -export const modifyAwarenessUpdate = (update, modify) => { - const decoder = decoding.createDecoder(update) - const encoder = encoding.createEncoder() - const len = decoding.readVarUint(decoder) - encoding.writeVarUint(encoder, len) - for (let i = 0; i < len; i++) { - const clientID = decoding.readVarUint(decoder) - const clock = decoding.readVarUint(decoder) - const state = JSON.parse(decoding.readVarString(decoder)) - const modifiedState = modify(state) - encoding.writeVarUint(encoder, clientID) - encoding.writeVarUint(encoder, clock) - encoding.writeVarString(encoder, JSON.stringify(modifiedState)) - } - return encoding.toUint8Array(encoder) -} - -/** - * @param {Awareness} awareness - * @param {Uint8Array} update - * @param {any} origin This will be added to the emitted change event - */ -export const applyAwarenessUpdate = (awareness, update, origin) => { - const decoder = decoding.createDecoder(update) - const timestamp = time.getUnixTime() - const added = [] - const updated = [] - const filteredUpdated = [] - const removed = [] - const len = decoding.readVarUint(decoder) - for (let i = 0; i < len; i++) { - const clientID = decoding.readVarUint(decoder) - let clock = decoding.readVarUint(decoder) - const state = JSON.parse(decoding.readVarString(decoder)) - const clientMeta = awareness.meta.get(clientID) - const prevState = awareness.states.get(clientID) - const currClock = clientMeta === undefined ? 0 : clientMeta.clock - if (currClock < clock || (currClock === clock && state === null && awareness.states.has(clientID))) { - if (state === null) { - // never let a remote client remove this local state - if (clientID === awareness.clientID && awareness.getLocalState() != null) { - // remote client removed the local state. Do not remote state. Broadcast a message indicating - // that this client still exists by increasing the clock - clock++ - } else { - awareness.states.delete(clientID) - } - } else { - awareness.states.set(clientID, state) - } - awareness.meta.set(clientID, { - clock, - lastUpdated: timestamp - }) - if (clientMeta === undefined && state !== null) { - added.push(clientID) - } else if (clientMeta !== undefined && state === null) { - removed.push(clientID) - } else if (state !== null) { - if (!f.equalityDeep(state, prevState)) { - filteredUpdated.push(clientID) - } - updated.push(clientID) - } - } - } - if (added.length > 0 || filteredUpdated.length > 0 || removed.length > 0) { - awareness.emit('change', [{ - added, updated: filteredUpdated, removed - }, origin]) - } - if (added.length > 0 || updated.length > 0 || removed.length > 0) { - awareness.emit('update', [{ - added, updated, removed - }, origin]) - } -} diff --git a/yjs-poll/node_modules/y-protocols/awareness.test.d.ts b/yjs-poll/node_modules/y-protocols/awareness.test.d.ts deleted file mode 100644 index 161948c..0000000 --- a/yjs-poll/node_modules/y-protocols/awareness.test.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function testAwareness(tc: t.TestCase): void; -import * as t from 'lib0/testing'; -//# sourceMappingURL=awareness.test.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/y-protocols/awareness.test.d.ts.map b/yjs-poll/node_modules/y-protocols/awareness.test.d.ts.map deleted file mode 100644 index 6097e52..0000000 --- a/yjs-poll/node_modules/y-protocols/awareness.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"awareness.test.d.ts","sourceRoot":"","sources":["awareness.test.js"],"names":[],"mappings":"AAQO,kCAFI,EAAE,QAAQ,QA8CpB;mBAlDkB,cAAc"} \ No newline at end of file diff --git a/yjs-poll/node_modules/y-protocols/awareness.test.js b/yjs-poll/node_modules/y-protocols/awareness.test.js deleted file mode 100644 index 0f17a6c..0000000 --- a/yjs-poll/node_modules/y-protocols/awareness.test.js +++ /dev/null @@ -1,53 +0,0 @@ - -import * as Y from 'yjs' -import * as t from 'lib0/testing' -import * as awareness from './awareness' - -/** - * @param {t.TestCase} tc - */ -export const testAwareness = tc => { - const doc1 = new Y.Doc() - doc1.clientID = 0 - const doc2 = new Y.Doc() - doc2.clientID = 1 - const aw1 = new awareness.Awareness(doc1) - const aw2 = new awareness.Awareness(doc2) - aw1.on('update', /** @param {any} p */ ({ added, updated, removed }) => { - const enc = awareness.encodeAwarenessUpdate(aw1, added.concat(updated).concat(removed)) - awareness.applyAwarenessUpdate(aw2, enc, 'custom') - }) - let lastChangeLocal = /** @type {any} */ (null) - aw1.on('change', /** @param {any} change */ change => { - lastChangeLocal = change - }) - let lastChange = /** @type {any} */ (null) - aw2.on('change', /** @param {any} change */ change => { - lastChange = change - }) - aw1.setLocalState({ x: 3 }) - t.compare(aw2.getStates().get(0), { x: 3 }) - t.assert(/** @type {any} */ (aw2.meta.get(0)).clock === 1) - t.compare(lastChange.added, [0]) - // When creating an Awareness instance, the the local client is already marked as available, so it is not updated. - t.compare(lastChangeLocal, { added: [], updated: [0], removed: [] }) - - // update state - lastChange = null - lastChangeLocal = null - aw1.setLocalState({ x: 4 }) - t.compare(aw2.getStates().get(0), { x: 4 }) - t.compare(lastChangeLocal, { added: [], updated: [0], removed: [] }) - t.compare(lastChangeLocal, lastChange) - - lastChange = null - lastChangeLocal = null - aw1.setLocalState({ x: 4 }) - t.assert(lastChange === null) - t.assert(/** @type {any} */ (aw2.meta.get(0)).clock === 3) - t.compare(lastChangeLocal, lastChange) - aw1.setLocalState(null) - t.assert(lastChange.removed.length === 1) - t.compare(aw1.getStates().get(0), undefined) - t.compare(lastChangeLocal, lastChange) -} diff --git a/yjs-poll/node_modules/y-protocols/dist/auth.cjs b/yjs-poll/node_modules/y-protocols/dist/auth.cjs deleted file mode 100644 index ac53c60..0000000 --- a/yjs-poll/node_modules/y-protocols/dist/auth.cjs +++ /dev/null @@ -1,59 +0,0 @@ -'use strict'; - -require('yjs'); -var encoding = require('lib0/dist/encoding.cjs'); -var decoding = require('lib0/dist/decoding.cjs'); - -function _interopNamespaceDefault(e) { - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n.default = e; - return Object.freeze(n); -} - -var encoding__namespace = /*#__PURE__*/_interopNamespaceDefault(encoding); -var decoding__namespace = /*#__PURE__*/_interopNamespaceDefault(decoding); - -const messagePermissionDenied = 0; - -/** - * @param {encoding.Encoder} encoder - * @param {string} reason - */ -const writePermissionDenied = (encoder, reason) => { - encoding__namespace.writeVarUint(encoder, messagePermissionDenied); - encoding__namespace.writeVarString(encoder, reason); -}; - -/** - * @callback PermissionDeniedHandler - * @param {any} y - * @param {string} reason - */ - -/** - * - * @param {decoding.Decoder} decoder - * @param {Y.Doc} y - * @param {PermissionDeniedHandler} permissionDeniedHandler - */ -const readAuthMessage = (decoder, y, permissionDeniedHandler) => { - switch (decoding__namespace.readVarUint(decoder)) { - case messagePermissionDenied: permissionDeniedHandler(y, decoding__namespace.readVarString(decoder)); - } -}; - -exports.messagePermissionDenied = messagePermissionDenied; -exports.readAuthMessage = readAuthMessage; -exports.writePermissionDenied = writePermissionDenied; -//# sourceMappingURL=auth.cjs.map diff --git a/yjs-poll/node_modules/y-protocols/dist/auth.cjs.map b/yjs-poll/node_modules/y-protocols/dist/auth.cjs.map deleted file mode 100644 index 2278981..0000000 --- a/yjs-poll/node_modules/y-protocols/dist/auth.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"auth.cjs","sources":["../auth.js"],"sourcesContent":["\nimport * as Y from 'yjs' // eslint-disable-line\nimport * as encoding from 'lib0/encoding'\nimport * as decoding from 'lib0/decoding'\n\nexport const messagePermissionDenied = 0\n\n/**\n * @param {encoding.Encoder} encoder\n * @param {string} reason\n */\nexport const writePermissionDenied = (encoder, reason) => {\n encoding.writeVarUint(encoder, messagePermissionDenied)\n encoding.writeVarString(encoder, reason)\n}\n\n/**\n * @callback PermissionDeniedHandler\n * @param {any} y\n * @param {string} reason\n */\n\n/**\n *\n * @param {decoding.Decoder} decoder\n * @param {Y.Doc} y\n * @param {PermissionDeniedHandler} permissionDeniedHandler\n */\nexport const readAuthMessage = (decoder, y, permissionDeniedHandler) => {\n switch (decoding.readVarUint(decoder)) {\n case messagePermissionDenied: permissionDeniedHandler(y, decoding.readVarString(decoder))\n }\n}\n"],"names":["encoding","decoding"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKY,MAAC,uBAAuB,GAAG,EAAC;AACxC;AACA;AACA;AACA;AACA;AACY,MAAC,qBAAqB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK;AAC1D,EAAEA,mBAAQ,CAAC,YAAY,CAAC,OAAO,EAAE,uBAAuB,EAAC;AACzD,EAAEA,mBAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAC;AAC1C,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,eAAe,GAAG,CAAC,OAAO,EAAE,CAAC,EAAE,uBAAuB,KAAK;AACxE,EAAE,QAAQC,mBAAQ,CAAC,WAAW,CAAC,OAAO,CAAC;AACvC,IAAI,KAAK,uBAAuB,EAAE,uBAAuB,CAAC,CAAC,EAAEA,mBAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,EAAC;AAC7F,GAAG;AACH;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/y-protocols/dist/awareness.cjs b/yjs-poll/node_modules/y-protocols/dist/awareness.cjs deleted file mode 100644 index 884c8d9..0000000 --- a/yjs-poll/node_modules/y-protocols/dist/awareness.cjs +++ /dev/null @@ -1,329 +0,0 @@ -'use strict'; - -var encoding = require('lib0/dist/encoding.cjs'); -var decoding = require('lib0/dist/decoding.cjs'); -var time = require('lib0/dist/time.cjs'); -var math = require('lib0/dist/math.cjs'); -var observable = require('lib0/dist/observable.cjs'); -var f = require('lib0/dist/function.cjs'); -require('yjs'); - -function _interopNamespaceDefault(e) { - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n.default = e; - return Object.freeze(n); -} - -var encoding__namespace = /*#__PURE__*/_interopNamespaceDefault(encoding); -var decoding__namespace = /*#__PURE__*/_interopNamespaceDefault(decoding); -var time__namespace = /*#__PURE__*/_interopNamespaceDefault(time); -var math__namespace = /*#__PURE__*/_interopNamespaceDefault(math); -var f__namespace = /*#__PURE__*/_interopNamespaceDefault(f); - -/** - * @module awareness-protocol - */ - - -const outdatedTimeout = 30000; - -/** - * @typedef {Object} MetaClientState - * @property {number} MetaClientState.clock - * @property {number} MetaClientState.lastUpdated unix timestamp - */ - -/** - * The Awareness class implements a simple shared state protocol that can be used for non-persistent data like awareness information - * (cursor, username, status, ..). Each client can update its own local state and listen to state changes of - * remote clients. Every client may set a state of a remote peer to `null` to mark the client as offline. - * - * Each client is identified by a unique client id (something we borrow from `doc.clientID`). A client can override - * its own state by propagating a message with an increasing timestamp (`clock`). If such a message is received, it is - * applied if the known state of that client is older than the new state (`clock < newClock`). If a client thinks that - * a remote client is offline, it may propagate a message with - * `{ clock: currentClientClock, state: null, client: remoteClient }`. If such a - * message is received, and the known clock of that client equals the received clock, it will override the state with `null`. - * - * Before a client disconnects, it should propagate a `null` state with an updated clock. - * - * Awareness states must be updated every 30 seconds. Otherwise the Awareness instance will delete the client state. - * - * @extends {Observable} - */ -class Awareness extends observable.Observable { - /** - * @param {Y.Doc} doc - */ - constructor (doc) { - super(); - this.doc = doc; - /** - * @type {number} - */ - this.clientID = doc.clientID; - /** - * Maps from client id to client state - * @type {Map>} - */ - this.states = new Map(); - /** - * @type {Map} - */ - this.meta = new Map(); - this._checkInterval = /** @type {any} */ (setInterval(() => { - const now = time__namespace.getUnixTime(); - if (this.getLocalState() !== null && (outdatedTimeout / 2 <= now - /** @type {{lastUpdated:number}} */ (this.meta.get(this.clientID)).lastUpdated)) { - // renew local clock - this.setLocalState(this.getLocalState()); - } - /** - * @type {Array} - */ - const remove = []; - this.meta.forEach((meta, clientid) => { - if (clientid !== this.clientID && outdatedTimeout <= now - meta.lastUpdated && this.states.has(clientid)) { - remove.push(clientid); - } - }); - if (remove.length > 0) { - removeAwarenessStates(this, remove, 'timeout'); - } - }, math__namespace.floor(outdatedTimeout / 10))); - doc.on('destroy', () => { - this.destroy(); - }); - this.setLocalState({}); - } - - destroy () { - this.emit('destroy', [this]); - this.setLocalState(null); - super.destroy(); - clearInterval(this._checkInterval); - } - - /** - * @return {Object|null} - */ - getLocalState () { - return this.states.get(this.clientID) || null - } - - /** - * @param {Object|null} state - */ - setLocalState (state) { - const clientID = this.clientID; - const currLocalMeta = this.meta.get(clientID); - const clock = currLocalMeta === undefined ? 0 : currLocalMeta.clock + 1; - const prevState = this.states.get(clientID); - if (state === null) { - this.states.delete(clientID); - } else { - this.states.set(clientID, state); - } - this.meta.set(clientID, { - clock, - lastUpdated: time__namespace.getUnixTime() - }); - const added = []; - const updated = []; - const filteredUpdated = []; - const removed = []; - if (state === null) { - removed.push(clientID); - } else if (prevState == null) { - if (state != null) { - added.push(clientID); - } - } else { - updated.push(clientID); - if (!f__namespace.equalityDeep(prevState, state)) { - filteredUpdated.push(clientID); - } - } - if (added.length > 0 || filteredUpdated.length > 0 || removed.length > 0) { - this.emit('change', [{ added, updated: filteredUpdated, removed }, 'local']); - } - this.emit('update', [{ added, updated, removed }, 'local']); - } - - /** - * @param {string} field - * @param {any} value - */ - setLocalStateField (field, value) { - const state = this.getLocalState(); - if (state !== null) { - this.setLocalState({ - ...state, - [field]: value - }); - } - } - - /** - * @return {Map>} - */ - getStates () { - return this.states - } -} - -/** - * Mark (remote) clients as inactive and remove them from the list of active peers. - * This change will be propagated to remote clients. - * - * @param {Awareness} awareness - * @param {Array} clients - * @param {any} origin - */ -const removeAwarenessStates = (awareness, clients, origin) => { - const removed = []; - for (let i = 0; i < clients.length; i++) { - const clientID = clients[i]; - if (awareness.states.has(clientID)) { - awareness.states.delete(clientID); - if (clientID === awareness.clientID) { - const curMeta = /** @type {MetaClientState} */ (awareness.meta.get(clientID)); - awareness.meta.set(clientID, { - clock: curMeta.clock + 1, - lastUpdated: time__namespace.getUnixTime() - }); - } - removed.push(clientID); - } - } - if (removed.length > 0) { - awareness.emit('change', [{ added: [], updated: [], removed }, origin]); - awareness.emit('update', [{ added: [], updated: [], removed }, origin]); - } -}; - -/** - * @param {Awareness} awareness - * @param {Array} clients - * @return {Uint8Array} - */ -const encodeAwarenessUpdate = (awareness, clients, states = awareness.states) => { - const len = clients.length; - const encoder = encoding__namespace.createEncoder(); - encoding__namespace.writeVarUint(encoder, len); - for (let i = 0; i < len; i++) { - const clientID = clients[i]; - const state = states.get(clientID) || null; - const clock = /** @type {MetaClientState} */ (awareness.meta.get(clientID)).clock; - encoding__namespace.writeVarUint(encoder, clientID); - encoding__namespace.writeVarUint(encoder, clock); - encoding__namespace.writeVarString(encoder, JSON.stringify(state)); - } - return encoding__namespace.toUint8Array(encoder) -}; - -/** - * Modify the content of an awareness update before re-encoding it to an awareness update. - * - * This might be useful when you have a central server that wants to ensure that clients - * cant hijack somebody elses identity. - * - * @param {Uint8Array} update - * @param {function(any):any} modify - * @return {Uint8Array} - */ -const modifyAwarenessUpdate = (update, modify) => { - const decoder = decoding__namespace.createDecoder(update); - const encoder = encoding__namespace.createEncoder(); - const len = decoding__namespace.readVarUint(decoder); - encoding__namespace.writeVarUint(encoder, len); - for (let i = 0; i < len; i++) { - const clientID = decoding__namespace.readVarUint(decoder); - const clock = decoding__namespace.readVarUint(decoder); - const state = JSON.parse(decoding__namespace.readVarString(decoder)); - const modifiedState = modify(state); - encoding__namespace.writeVarUint(encoder, clientID); - encoding__namespace.writeVarUint(encoder, clock); - encoding__namespace.writeVarString(encoder, JSON.stringify(modifiedState)); - } - return encoding__namespace.toUint8Array(encoder) -}; - -/** - * @param {Awareness} awareness - * @param {Uint8Array} update - * @param {any} origin This will be added to the emitted change event - */ -const applyAwarenessUpdate = (awareness, update, origin) => { - const decoder = decoding__namespace.createDecoder(update); - const timestamp = time__namespace.getUnixTime(); - const added = []; - const updated = []; - const filteredUpdated = []; - const removed = []; - const len = decoding__namespace.readVarUint(decoder); - for (let i = 0; i < len; i++) { - const clientID = decoding__namespace.readVarUint(decoder); - let clock = decoding__namespace.readVarUint(decoder); - const state = JSON.parse(decoding__namespace.readVarString(decoder)); - const clientMeta = awareness.meta.get(clientID); - const prevState = awareness.states.get(clientID); - const currClock = clientMeta === undefined ? 0 : clientMeta.clock; - if (currClock < clock || (currClock === clock && state === null && awareness.states.has(clientID))) { - if (state === null) { - // never let a remote client remove this local state - if (clientID === awareness.clientID && awareness.getLocalState() != null) { - // remote client removed the local state. Do not remote state. Broadcast a message indicating - // that this client still exists by increasing the clock - clock++; - } else { - awareness.states.delete(clientID); - } - } else { - awareness.states.set(clientID, state); - } - awareness.meta.set(clientID, { - clock, - lastUpdated: timestamp - }); - if (clientMeta === undefined && state !== null) { - added.push(clientID); - } else if (clientMeta !== undefined && state === null) { - removed.push(clientID); - } else if (state !== null) { - if (!f__namespace.equalityDeep(state, prevState)) { - filteredUpdated.push(clientID); - } - updated.push(clientID); - } - } - } - if (added.length > 0 || filteredUpdated.length > 0 || removed.length > 0) { - awareness.emit('change', [{ - added, updated: filteredUpdated, removed - }, origin]); - } - if (added.length > 0 || updated.length > 0 || removed.length > 0) { - awareness.emit('update', [{ - added, updated, removed - }, origin]); - } -}; - -exports.Awareness = Awareness; -exports.applyAwarenessUpdate = applyAwarenessUpdate; -exports.encodeAwarenessUpdate = encodeAwarenessUpdate; -exports.modifyAwarenessUpdate = modifyAwarenessUpdate; -exports.outdatedTimeout = outdatedTimeout; -exports.removeAwarenessStates = removeAwarenessStates; -//# sourceMappingURL=awareness.cjs.map diff --git a/yjs-poll/node_modules/y-protocols/dist/awareness.cjs.map b/yjs-poll/node_modules/y-protocols/dist/awareness.cjs.map deleted file mode 100644 index 9ef4168..0000000 --- a/yjs-poll/node_modules/y-protocols/dist/awareness.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"awareness.cjs","sources":["../awareness.js"],"sourcesContent":["/**\n * @module awareness-protocol\n */\n\nimport * as encoding from 'lib0/encoding'\nimport * as decoding from 'lib0/decoding'\nimport * as time from 'lib0/time'\nimport * as math from 'lib0/math'\nimport { Observable } from 'lib0/observable'\nimport * as f from 'lib0/function'\nimport * as Y from 'yjs' // eslint-disable-line\n\nexport const outdatedTimeout = 30000\n\n/**\n * @typedef {Object} MetaClientState\n * @property {number} MetaClientState.clock\n * @property {number} MetaClientState.lastUpdated unix timestamp\n */\n\n/**\n * The Awareness class implements a simple shared state protocol that can be used for non-persistent data like awareness information\n * (cursor, username, status, ..). Each client can update its own local state and listen to state changes of\n * remote clients. Every client may set a state of a remote peer to `null` to mark the client as offline.\n *\n * Each client is identified by a unique client id (something we borrow from `doc.clientID`). A client can override\n * its own state by propagating a message with an increasing timestamp (`clock`). If such a message is received, it is\n * applied if the known state of that client is older than the new state (`clock < newClock`). If a client thinks that\n * a remote client is offline, it may propagate a message with\n * `{ clock: currentClientClock, state: null, client: remoteClient }`. If such a\n * message is received, and the known clock of that client equals the received clock, it will override the state with `null`.\n *\n * Before a client disconnects, it should propagate a `null` state with an updated clock.\n *\n * Awareness states must be updated every 30 seconds. Otherwise the Awareness instance will delete the client state.\n *\n * @extends {Observable}\n */\nexport class Awareness extends Observable {\n /**\n * @param {Y.Doc} doc\n */\n constructor (doc) {\n super()\n this.doc = doc\n /**\n * @type {number}\n */\n this.clientID = doc.clientID\n /**\n * Maps from client id to client state\n * @type {Map>}\n */\n this.states = new Map()\n /**\n * @type {Map}\n */\n this.meta = new Map()\n this._checkInterval = /** @type {any} */ (setInterval(() => {\n const now = time.getUnixTime()\n if (this.getLocalState() !== null && (outdatedTimeout / 2 <= now - /** @type {{lastUpdated:number}} */ (this.meta.get(this.clientID)).lastUpdated)) {\n // renew local clock\n this.setLocalState(this.getLocalState())\n }\n /**\n * @type {Array}\n */\n const remove = []\n this.meta.forEach((meta, clientid) => {\n if (clientid !== this.clientID && outdatedTimeout <= now - meta.lastUpdated && this.states.has(clientid)) {\n remove.push(clientid)\n }\n })\n if (remove.length > 0) {\n removeAwarenessStates(this, remove, 'timeout')\n }\n }, math.floor(outdatedTimeout / 10)))\n doc.on('destroy', () => {\n this.destroy()\n })\n this.setLocalState({})\n }\n\n destroy () {\n this.emit('destroy', [this])\n this.setLocalState(null)\n super.destroy()\n clearInterval(this._checkInterval)\n }\n\n /**\n * @return {Object|null}\n */\n getLocalState () {\n return this.states.get(this.clientID) || null\n }\n\n /**\n * @param {Object|null} state\n */\n setLocalState (state) {\n const clientID = this.clientID\n const currLocalMeta = this.meta.get(clientID)\n const clock = currLocalMeta === undefined ? 0 : currLocalMeta.clock + 1\n const prevState = this.states.get(clientID)\n if (state === null) {\n this.states.delete(clientID)\n } else {\n this.states.set(clientID, state)\n }\n this.meta.set(clientID, {\n clock,\n lastUpdated: time.getUnixTime()\n })\n const added = []\n const updated = []\n const filteredUpdated = []\n const removed = []\n if (state === null) {\n removed.push(clientID)\n } else if (prevState == null) {\n if (state != null) {\n added.push(clientID)\n }\n } else {\n updated.push(clientID)\n if (!f.equalityDeep(prevState, state)) {\n filteredUpdated.push(clientID)\n }\n }\n if (added.length > 0 || filteredUpdated.length > 0 || removed.length > 0) {\n this.emit('change', [{ added, updated: filteredUpdated, removed }, 'local'])\n }\n this.emit('update', [{ added, updated, removed }, 'local'])\n }\n\n /**\n * @param {string} field\n * @param {any} value\n */\n setLocalStateField (field, value) {\n const state = this.getLocalState()\n if (state !== null) {\n this.setLocalState({\n ...state,\n [field]: value\n })\n }\n }\n\n /**\n * @return {Map>}\n */\n getStates () {\n return this.states\n }\n}\n\n/**\n * Mark (remote) clients as inactive and remove them from the list of active peers.\n * This change will be propagated to remote clients.\n *\n * @param {Awareness} awareness\n * @param {Array} clients\n * @param {any} origin\n */\nexport const removeAwarenessStates = (awareness, clients, origin) => {\n const removed = []\n for (let i = 0; i < clients.length; i++) {\n const clientID = clients[i]\n if (awareness.states.has(clientID)) {\n awareness.states.delete(clientID)\n if (clientID === awareness.clientID) {\n const curMeta = /** @type {MetaClientState} */ (awareness.meta.get(clientID))\n awareness.meta.set(clientID, {\n clock: curMeta.clock + 1,\n lastUpdated: time.getUnixTime()\n })\n }\n removed.push(clientID)\n }\n }\n if (removed.length > 0) {\n awareness.emit('change', [{ added: [], updated: [], removed }, origin])\n awareness.emit('update', [{ added: [], updated: [], removed }, origin])\n }\n}\n\n/**\n * @param {Awareness} awareness\n * @param {Array} clients\n * @return {Uint8Array}\n */\nexport const encodeAwarenessUpdate = (awareness, clients, states = awareness.states) => {\n const len = clients.length\n const encoder = encoding.createEncoder()\n encoding.writeVarUint(encoder, len)\n for (let i = 0; i < len; i++) {\n const clientID = clients[i]\n const state = states.get(clientID) || null\n const clock = /** @type {MetaClientState} */ (awareness.meta.get(clientID)).clock\n encoding.writeVarUint(encoder, clientID)\n encoding.writeVarUint(encoder, clock)\n encoding.writeVarString(encoder, JSON.stringify(state))\n }\n return encoding.toUint8Array(encoder)\n}\n\n/**\n * Modify the content of an awareness update before re-encoding it to an awareness update.\n *\n * This might be useful when you have a central server that wants to ensure that clients\n * cant hijack somebody elses identity.\n *\n * @param {Uint8Array} update\n * @param {function(any):any} modify\n * @return {Uint8Array}\n */\nexport const modifyAwarenessUpdate = (update, modify) => {\n const decoder = decoding.createDecoder(update)\n const encoder = encoding.createEncoder()\n const len = decoding.readVarUint(decoder)\n encoding.writeVarUint(encoder, len)\n for (let i = 0; i < len; i++) {\n const clientID = decoding.readVarUint(decoder)\n const clock = decoding.readVarUint(decoder)\n const state = JSON.parse(decoding.readVarString(decoder))\n const modifiedState = modify(state)\n encoding.writeVarUint(encoder, clientID)\n encoding.writeVarUint(encoder, clock)\n encoding.writeVarString(encoder, JSON.stringify(modifiedState))\n }\n return encoding.toUint8Array(encoder)\n}\n\n/**\n * @param {Awareness} awareness\n * @param {Uint8Array} update\n * @param {any} origin This will be added to the emitted change event\n */\nexport const applyAwarenessUpdate = (awareness, update, origin) => {\n const decoder = decoding.createDecoder(update)\n const timestamp = time.getUnixTime()\n const added = []\n const updated = []\n const filteredUpdated = []\n const removed = []\n const len = decoding.readVarUint(decoder)\n for (let i = 0; i < len; i++) {\n const clientID = decoding.readVarUint(decoder)\n let clock = decoding.readVarUint(decoder)\n const state = JSON.parse(decoding.readVarString(decoder))\n const clientMeta = awareness.meta.get(clientID)\n const prevState = awareness.states.get(clientID)\n const currClock = clientMeta === undefined ? 0 : clientMeta.clock\n if (currClock < clock || (currClock === clock && state === null && awareness.states.has(clientID))) {\n if (state === null) {\n // never let a remote client remove this local state\n if (clientID === awareness.clientID && awareness.getLocalState() != null) {\n // remote client removed the local state. Do not remote state. Broadcast a message indicating\n // that this client still exists by increasing the clock\n clock++\n } else {\n awareness.states.delete(clientID)\n }\n } else {\n awareness.states.set(clientID, state)\n }\n awareness.meta.set(clientID, {\n clock,\n lastUpdated: timestamp\n })\n if (clientMeta === undefined && state !== null) {\n added.push(clientID)\n } else if (clientMeta !== undefined && state === null) {\n removed.push(clientID)\n } else if (state !== null) {\n if (!f.equalityDeep(state, prevState)) {\n filteredUpdated.push(clientID)\n }\n updated.push(clientID)\n }\n }\n }\n if (added.length > 0 || filteredUpdated.length > 0 || removed.length > 0) {\n awareness.emit('change', [{\n added, updated: filteredUpdated, removed\n }, origin])\n }\n if (added.length > 0 || updated.length > 0 || removed.length > 0) {\n awareness.emit('update', [{\n added, updated, removed\n }, origin])\n }\n}\n"],"names":["Observable","time","math","f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AC,QAAQ,EAAE,CAAC;AAC9B,MAAM,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO;AAC9C,KAAK,EAAE,MAAM,CAAC,EAAC;AACf,GAAG;AACH,EAAE,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;AACpE,IAAI,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;AAC9B,MAAM,KAAK,EAAE,OAAO,EAAE,OAAO;AAC7B,KAAK,EAAE,MAAM,CAAC,EAAC;AACf,GAAG;AACH;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/y-protocols/dist/sync.cjs b/yjs-poll/node_modules/y-protocols/dist/sync.cjs deleted file mode 100644 index f4b8e37..0000000 --- a/yjs-poll/node_modules/y-protocols/dist/sync.cjs +++ /dev/null @@ -1,170 +0,0 @@ -'use strict'; - -var encoding = require('lib0/dist/encoding.cjs'); -var decoding = require('lib0/dist/decoding.cjs'); -var Y = require('yjs'); - -function _interopNamespaceDefault(e) { - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n.default = e; - return Object.freeze(n); -} - -var encoding__namespace = /*#__PURE__*/_interopNamespaceDefault(encoding); -var decoding__namespace = /*#__PURE__*/_interopNamespaceDefault(decoding); -var Y__namespace = /*#__PURE__*/_interopNamespaceDefault(Y); - -/** - * @module sync-protocol - */ - - -/** - * @typedef {Map} StateMap - */ - -/** - * Core Yjs defines two message types: - * • YjsSyncStep1: Includes the State Set of the sending client. When received, the client should reply with YjsSyncStep2. - * • YjsSyncStep2: Includes all missing structs and the complete delete set. When received, the client is assured that it - * received all information from the remote client. - * - * In a peer-to-peer network, you may want to introduce a SyncDone message type. Both parties should initiate the connection - * with SyncStep1. When a client received SyncStep2, it should reply with SyncDone. When the local client received both - * SyncStep2 and SyncDone, it is assured that it is synced to the remote client. - * - * In a client-server model, you want to handle this differently: The client should initiate the connection with SyncStep1. - * When the server receives SyncStep1, it should reply with SyncStep2 immediately followed by SyncStep1. The client replies - * with SyncStep2 when it receives SyncStep1. Optionally the server may send a SyncDone after it received SyncStep2, so the - * client knows that the sync is finished. There are two reasons for this more elaborated sync model: 1. This protocol can - * easily be implemented on top of http and websockets. 2. The server should only reply to requests, and not initiate them. - * Therefore it is necessary that the client initiates the sync. - * - * Construction of a message: - * [messageType : varUint, message definition..] - * - * Note: A message does not include information about the room name. This must to be handled by the upper layer protocol! - * - * stringify[messageType] stringifies a message definition (messageType is already read from the bufffer) - */ - -const messageYjsSyncStep1 = 0; -const messageYjsSyncStep2 = 1; -const messageYjsUpdate = 2; - -/** - * Create a sync step 1 message based on the state of the current shared document. - * - * @param {encoding.Encoder} encoder - * @param {Y.Doc} doc - */ -const writeSyncStep1 = (encoder, doc) => { - encoding__namespace.writeVarUint(encoder, messageYjsSyncStep1); - const sv = Y__namespace.encodeStateVector(doc); - encoding__namespace.writeVarUint8Array(encoder, sv); -}; - -/** - * @param {encoding.Encoder} encoder - * @param {Y.Doc} doc - * @param {Uint8Array} [encodedStateVector] - */ -const writeSyncStep2 = (encoder, doc, encodedStateVector) => { - encoding__namespace.writeVarUint(encoder, messageYjsSyncStep2); - encoding__namespace.writeVarUint8Array(encoder, Y__namespace.encodeStateAsUpdate(doc, encodedStateVector)); -}; - -/** - * Read SyncStep1 message and reply with SyncStep2. - * - * @param {decoding.Decoder} decoder The reply to the received message - * @param {encoding.Encoder} encoder The received message - * @param {Y.Doc} doc - */ -const readSyncStep1 = (decoder, encoder, doc) => - writeSyncStep2(encoder, doc, decoding__namespace.readVarUint8Array(decoder)); - -/** - * Read and apply Structs and then DeleteStore to a y instance. - * - * @param {decoding.Decoder} decoder - * @param {Y.Doc} doc - * @param {any} transactionOrigin - * @param {(error:Error)=>any} [errorHandler] - */ -const readSyncStep2 = (decoder, doc, transactionOrigin, errorHandler) => { - try { - Y__namespace.applyUpdate(doc, decoding__namespace.readVarUint8Array(decoder), transactionOrigin); - } catch (error) { - if (errorHandler != null) errorHandler(/** @type {Error} */ (error)); - // This catches errors that are thrown by event handlers - console.error('Caught error while handling a Yjs update', error); - } -}; - -/** - * @param {encoding.Encoder} encoder - * @param {Uint8Array} update - */ -const writeUpdate = (encoder, update) => { - encoding__namespace.writeVarUint(encoder, messageYjsUpdate); - encoding__namespace.writeVarUint8Array(encoder, update); -}; - -/** - * Read and apply Structs and then DeleteStore to a y instance. - * - * @param {decoding.Decoder} decoder - * @param {Y.Doc} doc - * @param {any} transactionOrigin - * @param {(error:Error)=>any} [errorHandler] - */ -const readUpdate = readSyncStep2; - -/** - * @param {decoding.Decoder} decoder A message received from another client - * @param {encoding.Encoder} encoder The reply message. Does not need to be sent if empty. - * @param {Y.Doc} doc - * @param {any} transactionOrigin - * @param {(error:Error)=>any} [errorHandler] Optional error handler that catches errors when reading Yjs messages. - */ -const readSyncMessage = (decoder, encoder, doc, transactionOrigin, errorHandler) => { - const messageType = decoding__namespace.readVarUint(decoder); - switch (messageType) { - case messageYjsSyncStep1: - readSyncStep1(decoder, encoder, doc); - break - case messageYjsSyncStep2: - readSyncStep2(decoder, doc, transactionOrigin, errorHandler); - break - case messageYjsUpdate: - readUpdate(decoder, doc, transactionOrigin, errorHandler); - break - default: - throw new Error('Unknown message type') - } - return messageType -}; - -exports.messageYjsSyncStep1 = messageYjsSyncStep1; -exports.messageYjsSyncStep2 = messageYjsSyncStep2; -exports.messageYjsUpdate = messageYjsUpdate; -exports.readSyncMessage = readSyncMessage; -exports.readSyncStep1 = readSyncStep1; -exports.readSyncStep2 = readSyncStep2; -exports.readUpdate = readUpdate; -exports.writeSyncStep1 = writeSyncStep1; -exports.writeSyncStep2 = writeSyncStep2; -exports.writeUpdate = writeUpdate; -//# sourceMappingURL=sync.cjs.map diff --git a/yjs-poll/node_modules/y-protocols/dist/sync.cjs.map b/yjs-poll/node_modules/y-protocols/dist/sync.cjs.map deleted file mode 100644 index 98c64a4..0000000 --- a/yjs-poll/node_modules/y-protocols/dist/sync.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sync.cjs","sources":["../sync.js"],"sourcesContent":["/**\n * @module sync-protocol\n */\n\nimport * as encoding from 'lib0/encoding'\nimport * as decoding from 'lib0/decoding'\nimport * as Y from 'yjs'\n\n/**\n * @typedef {Map} StateMap\n */\n\n/**\n * Core Yjs defines two message types:\n * • YjsSyncStep1: Includes the State Set of the sending client. When received, the client should reply with YjsSyncStep2.\n * • YjsSyncStep2: Includes all missing structs and the complete delete set. When received, the client is assured that it\n * received all information from the remote client.\n *\n * In a peer-to-peer network, you may want to introduce a SyncDone message type. Both parties should initiate the connection\n * with SyncStep1. When a client received SyncStep2, it should reply with SyncDone. When the local client received both\n * SyncStep2 and SyncDone, it is assured that it is synced to the remote client.\n *\n * In a client-server model, you want to handle this differently: The client should initiate the connection with SyncStep1.\n * When the server receives SyncStep1, it should reply with SyncStep2 immediately followed by SyncStep1. The client replies\n * with SyncStep2 when it receives SyncStep1. Optionally the server may send a SyncDone after it received SyncStep2, so the\n * client knows that the sync is finished. There are two reasons for this more elaborated sync model: 1. This protocol can\n * easily be implemented on top of http and websockets. 2. The server should only reply to requests, and not initiate them.\n * Therefore it is necessary that the client initiates the sync.\n *\n * Construction of a message:\n * [messageType : varUint, message definition..]\n *\n * Note: A message does not include information about the room name. This must to be handled by the upper layer protocol!\n *\n * stringify[messageType] stringifies a message definition (messageType is already read from the bufffer)\n */\n\nexport const messageYjsSyncStep1 = 0\nexport const messageYjsSyncStep2 = 1\nexport const messageYjsUpdate = 2\n\n/**\n * Create a sync step 1 message based on the state of the current shared document.\n *\n * @param {encoding.Encoder} encoder\n * @param {Y.Doc} doc\n */\nexport const writeSyncStep1 = (encoder, doc) => {\n encoding.writeVarUint(encoder, messageYjsSyncStep1)\n const sv = Y.encodeStateVector(doc)\n encoding.writeVarUint8Array(encoder, sv)\n}\n\n/**\n * @param {encoding.Encoder} encoder\n * @param {Y.Doc} doc\n * @param {Uint8Array} [encodedStateVector]\n */\nexport const writeSyncStep2 = (encoder, doc, encodedStateVector) => {\n encoding.writeVarUint(encoder, messageYjsSyncStep2)\n encoding.writeVarUint8Array(encoder, Y.encodeStateAsUpdate(doc, encodedStateVector))\n}\n\n/**\n * Read SyncStep1 message and reply with SyncStep2.\n *\n * @param {decoding.Decoder} decoder The reply to the received message\n * @param {encoding.Encoder} encoder The received message\n * @param {Y.Doc} doc\n */\nexport const readSyncStep1 = (decoder, encoder, doc) =>\n writeSyncStep2(encoder, doc, decoding.readVarUint8Array(decoder))\n\n/**\n * Read and apply Structs and then DeleteStore to a y instance.\n *\n * @param {decoding.Decoder} decoder\n * @param {Y.Doc} doc\n * @param {any} transactionOrigin\n * @param {(error:Error)=>any} [errorHandler]\n */\nexport const readSyncStep2 = (decoder, doc, transactionOrigin, errorHandler) => {\n try {\n Y.applyUpdate(doc, decoding.readVarUint8Array(decoder), transactionOrigin)\n } catch (error) {\n if (errorHandler != null) errorHandler(/** @type {Error} */ (error))\n // This catches errors that are thrown by event handlers\n console.error('Caught error while handling a Yjs update', error)\n }\n}\n\n/**\n * @param {encoding.Encoder} encoder\n * @param {Uint8Array} update\n */\nexport const writeUpdate = (encoder, update) => {\n encoding.writeVarUint(encoder, messageYjsUpdate)\n encoding.writeVarUint8Array(encoder, update)\n}\n\n/**\n * Read and apply Structs and then DeleteStore to a y instance.\n *\n * @param {decoding.Decoder} decoder\n * @param {Y.Doc} doc\n * @param {any} transactionOrigin\n * @param {(error:Error)=>any} [errorHandler]\n */\nexport const readUpdate = readSyncStep2\n\n/**\n * @param {decoding.Decoder} decoder A message received from another client\n * @param {encoding.Encoder} encoder The reply message. Does not need to be sent if empty.\n * @param {Y.Doc} doc\n * @param {any} transactionOrigin\n * @param {(error:Error)=>any} [errorHandler] Optional error handler that catches errors when reading Yjs messages.\n */\nexport const readSyncMessage = (decoder, encoder, doc, transactionOrigin, errorHandler) => {\n const messageType = decoding.readVarUint(decoder)\n switch (messageType) {\n case messageYjsSyncStep1:\n readSyncStep1(decoder, encoder, doc)\n break\n case messageYjsSyncStep2:\n readSyncStep2(decoder, doc, transactionOrigin, errorHandler)\n break\n case messageYjsUpdate:\n readUpdate(decoder, doc, transactionOrigin, errorHandler)\n break\n default:\n throw new Error('Unknown message type')\n }\n return messageType\n}\n"],"names":["encoding","Y","decoding"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,mBAAmB,GAAG,EAAC;AACxB,MAAC,mBAAmB,GAAG,EAAC;AACxB,MAAC,gBAAgB,GAAG,EAAC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAG,CAAC,OAAO,EAAE,GAAG,KAAK;AAChD,EAAEA,mBAAQ,CAAC,YAAY,CAAC,OAAO,EAAE,mBAAmB,EAAC;AACrD,EAAE,MAAM,EAAE,GAAGC,YAAC,CAAC,iBAAiB,CAAC,GAAG,EAAC;AACrC,EAAED,mBAAQ,CAAC,kBAAkB,CAAC,OAAO,EAAE,EAAE,EAAC;AAC1C,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,kBAAkB,KAAK;AACpE,EAAEA,mBAAQ,CAAC,YAAY,CAAC,OAAO,EAAE,mBAAmB,EAAC;AACrD,EAAEA,mBAAQ,CAAC,kBAAkB,CAAC,OAAO,EAAEC,YAAC,CAAC,mBAAmB,CAAC,GAAG,EAAE,kBAAkB,CAAC,EAAC;AACtF,EAAC;AACD;AACA;AACA;AACA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;AAC1C,MAAM,KAAK;AACX,IAAI,KAAK,mBAAmB;AAC5B,MAAM,aAAa,CAAC,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,YAAY,EAAC;AAClE,MAAM,KAAK;AACX,IAAI,KAAK,gBAAgB;AACzB,MAAM,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,YAAY,EAAC;AAC/D,MAAM,KAAK;AACX,IAAI;AACJ,MAAM,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;AAC7C,GAAG;AACH,EAAE,OAAO,WAAW;AACpB;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/y-protocols/dist/test.cjs b/yjs-poll/node_modules/y-protocols/dist/test.cjs deleted file mode 100644 index ab18bf9..0000000 --- a/yjs-poll/node_modules/y-protocols/dist/test.cjs +++ /dev/null @@ -1,103 +0,0 @@ -'use strict'; - -var t = require('lib0/dist/testing.cjs'); -var log = require('lib0/dist/logging.cjs'); -var Y = require('yjs'); -var awareness$1 = require('./awareness.cjs'); -var environment = require('lib0/dist/environment.cjs'); -require('lib0/dist/encoding.cjs'); -require('lib0/dist/decoding.cjs'); -require('lib0/dist/time.cjs'); -require('lib0/dist/math.cjs'); -require('lib0/dist/observable.cjs'); -require('lib0/dist/function.cjs'); - -function _interopNamespaceDefault(e) { - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n.default = e; - return Object.freeze(n); -} - -var t__namespace = /*#__PURE__*/_interopNamespaceDefault(t); -var log__namespace = /*#__PURE__*/_interopNamespaceDefault(log); -var Y__namespace = /*#__PURE__*/_interopNamespaceDefault(Y); - -/** - * @param {t.TestCase} tc - */ -const testAwareness = tc => { - const doc1 = new Y__namespace.Doc(); - doc1.clientID = 0; - const doc2 = new Y__namespace.Doc(); - doc2.clientID = 1; - const aw1 = new awareness$1.Awareness(doc1); - const aw2 = new awareness$1.Awareness(doc2); - aw1.on('update', /** @param {any} p */ ({ added, updated, removed }) => { - const enc = awareness$1.encodeAwarenessUpdate(aw1, added.concat(updated).concat(removed)); - awareness$1.applyAwarenessUpdate(aw2, enc, 'custom'); - }); - let lastChangeLocal = /** @type {any} */ (null); - aw1.on('change', /** @param {any} change */ change => { - lastChangeLocal = change; - }); - let lastChange = /** @type {any} */ (null); - aw2.on('change', /** @param {any} change */ change => { - lastChange = change; - }); - aw1.setLocalState({ x: 3 }); - t__namespace.compare(aw2.getStates().get(0), { x: 3 }); - t__namespace.assert(/** @type {any} */ (aw2.meta.get(0)).clock === 1); - t__namespace.compare(lastChange.added, [0]); - // When creating an Awareness instance, the the local client is already marked as available, so it is not updated. - t__namespace.compare(lastChangeLocal, { added: [], updated: [0], removed: [] }); - - // update state - lastChange = null; - lastChangeLocal = null; - aw1.setLocalState({ x: 4 }); - t__namespace.compare(aw2.getStates().get(0), { x: 4 }); - t__namespace.compare(lastChangeLocal, { added: [], updated: [0], removed: [] }); - t__namespace.compare(lastChangeLocal, lastChange); - - lastChange = null; - lastChangeLocal = null; - aw1.setLocalState({ x: 4 }); - t__namespace.assert(lastChange === null); - t__namespace.assert(/** @type {any} */ (aw2.meta.get(0)).clock === 3); - t__namespace.compare(lastChangeLocal, lastChange); - aw1.setLocalState(null); - t__namespace.assert(lastChange.removed.length === 1); - t__namespace.compare(aw1.getStates().get(0), undefined); - t__namespace.compare(lastChangeLocal, lastChange); -}; - -var awareness = /*#__PURE__*/Object.freeze({ - __proto__: null, - testAwareness: testAwareness -}); - -/* istanbul ignore if */ -if (environment.isBrowser) { - log__namespace.createVConsole(document.body); -} - -t.runTests({ - awareness -}).then(success => { - /* istanbul ignore next */ - if (environment.isNode) { - process.exit(success ? 0 : 1); - } -}); -//# sourceMappingURL=test.cjs.map diff --git a/yjs-poll/node_modules/y-protocols/dist/test.cjs.map b/yjs-poll/node_modules/y-protocols/dist/test.cjs.map deleted file mode 100644 index f689286..0000000 --- a/yjs-poll/node_modules/y-protocols/dist/test.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.cjs","sources":["../awareness.test.js","../test.js"],"sourcesContent":["\nimport * as Y from 'yjs'\nimport * as t from 'lib0/testing'\nimport * as awareness from './awareness'\n\n/**\n * @param {t.TestCase} tc\n */\nexport const testAwareness = tc => {\n const doc1 = new Y.Doc()\n doc1.clientID = 0\n const doc2 = new Y.Doc()\n doc2.clientID = 1\n const aw1 = new awareness.Awareness(doc1)\n const aw2 = new awareness.Awareness(doc2)\n aw1.on('update', /** @param {any} p */ ({ added, updated, removed }) => {\n const enc = awareness.encodeAwarenessUpdate(aw1, added.concat(updated).concat(removed))\n awareness.applyAwarenessUpdate(aw2, enc, 'custom')\n })\n let lastChangeLocal = /** @type {any} */ (null)\n aw1.on('change', /** @param {any} change */ change => {\n lastChangeLocal = change\n })\n let lastChange = /** @type {any} */ (null)\n aw2.on('change', /** @param {any} change */ change => {\n lastChange = change\n })\n aw1.setLocalState({ x: 3 })\n t.compare(aw2.getStates().get(0), { x: 3 })\n t.assert(/** @type {any} */ (aw2.meta.get(0)).clock === 1)\n t.compare(lastChange.added, [0])\n // When creating an Awareness instance, the the local client is already marked as available, so it is not updated.\n t.compare(lastChangeLocal, { added: [], updated: [0], removed: [] })\n\n // update state\n lastChange = null\n lastChangeLocal = null\n aw1.setLocalState({ x: 4 })\n t.compare(aw2.getStates().get(0), { x: 4 })\n t.compare(lastChangeLocal, { added: [], updated: [0], removed: [] })\n t.compare(lastChangeLocal, lastChange)\n\n lastChange = null\n lastChangeLocal = null\n aw1.setLocalState({ x: 4 })\n t.assert(lastChange === null)\n t.assert(/** @type {any} */ (aw2.meta.get(0)).clock === 3)\n t.compare(lastChangeLocal, lastChange)\n aw1.setLocalState(null)\n t.assert(lastChange.removed.length === 1)\n t.compare(aw1.getStates().get(0), undefined)\n t.compare(lastChangeLocal, lastChange)\n}\n","import { runTests } from 'lib0/testing'\nimport * as log from 'lib0/logging'\nimport * as awareness from './awareness.test.js'\n\nimport { isBrowser, isNode } from 'lib0/environment'\n\n/* istanbul ignore if */\nif (isBrowser) {\n log.createVConsole(document.body)\n}\n\nrunTests({\n awareness\n}).then(success => {\n /* istanbul ignore next */\n if (isNode) {\n process.exit(success ? 0 : 1)\n }\n})\n"],"names":["Y","awareness.Awareness","awareness.encodeAwarenessUpdate","awareness.applyAwarenessUpdate","t","isBrowser","log","runTests","isNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA;AACA;AACA;AACO,MAAM,aAAa,GAAG,EAAE,IAAI;AACnC,EAAE,MAAM,IAAI,GAAG,IAAIA,YAAC,CAAC,GAAG,GAAE;AAC1B,EAAE,IAAI,CAAC,QAAQ,GAAG,EAAC;AACnB,EAAE,MAAM,IAAI,GAAG,IAAIA,YAAC,CAAC,GAAG,GAAE;AAC1B,EAAE,IAAI,CAAC,QAAQ,GAAG,EAAC;AACnB,EAAE,MAAM,GAAG,GAAG,IAAIC,qBAAmB,CAAC,IAAI,EAAC;AAC3C,EAAE,MAAM,GAAG,GAAG,IAAIA,qBAAmB,CAAC,IAAI,EAAC;AAC3C,EAAE,GAAG,CAAC,EAAE,CAAC,QAAQ,wBAAwB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK;AAC1E,IAAI,MAAM,GAAG,GAAGC,iCAA+B,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAC;AAC3F,IAAIC,gCAA8B,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAC;AACtD,GAAG,EAAC;AACJ,EAAE,IAAI,eAAe,uBAAuB,IAAI,EAAC;AACjD,EAAE,GAAG,CAAC,EAAE,CAAC,QAAQ,6BAA6B,MAAM,IAAI;AACxD,IAAI,eAAe,GAAG,OAAM;AAC5B,GAAG,EAA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AAU,GAAG,KAAI;AACnB,EAAE,eAAe,GAAG,KAAI;AACxB,EAAE,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAC;AAC7B,EAAEA,YAAC,CAAC,MAAM,CAAC,UAAU,KAAK,IAAI,EAAC;AAC/B,EAAEA,YAAC,CAAC,MAAM,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,EAAC;AAC5D,EAAEA,YAAC,CAAC,OAAO,CAAC,eAAe,EAAE,UAAU,EAAC;AACxC,EAAE,GAAG,CAAC,aAAa,CAAC,IAAI,EAAC;AACzB,EAAEA,YAAC,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAC;AAC3C,EAAEA,YAAC,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,SAAS,EAAC;AAC9C,EAAEA,YAAC,CAAC,OAAO,CAAC,eAAe,EAAE,UAAU,EAAC;AACxC;;;;;;;AC9CA;AACA,IAAIC,qBAAS,EAAE;AACf,EAAEC,cAAG,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAC;AACnC,CAAC;AACD;AACAC,UAAQ,CAAC;AACT,EAAE,SAAS;AACX,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI;AACnB;AACA,EAAE,IAAIC,kBAAM,EAAE;AACd,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC,EAAC;AACjC,GAAG;AACH,CAAC;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/y-protocols/dist/test.js b/yjs-poll/node_modules/y-protocols/dist/test.js deleted file mode 100644 index 61e4a38..0000000 --- a/yjs-poll/node_modules/y-protocols/dist/test.js +++ /dev/null @@ -1,9921 +0,0 @@ -(function () { - 'use strict'; - - /** - * Utility module to work with key-value stores. - * - * @module map - */ - - /** - * Creates a new Map instance. - * - * @function - * @return {Map} - * - * @function - */ - const create$6 = () => new Map(); - - /** - * Copy a Map object into a fresh Map object. - * - * @function - * @template X,Y - * @param {Map} m - * @return {Map} - */ - const copy = m => { - const r = create$6(); - m.forEach((v, k) => { r.set(k, v); }); - return r - }; - - /** - * Get map property. Create T if property is undefined and set T on map. - * - * ```js - * const listeners = map.setIfUndefined(events, 'eventName', set.create) - * listeners.add(listener) - * ``` - * - * @function - * @template V,K - * @template {Map} MAP - * @param {MAP} map - * @param {K} key - * @param {function():V} createT - * @return {V} - */ - const setIfUndefined = (map, key, createT) => { - let set = map.get(key); - if (set === undefined) { - map.set(key, set = createT()); - } - return set - }; - - /** - * Creates an Array and populates it with the content of all key-value pairs using the `f(value, key)` function. - * - * @function - * @template K - * @template V - * @template R - * @param {Map} m - * @param {function(V,K):R} f - * @return {Array} - */ - const map$1 = (m, f) => { - const res = []; - for (const [key, value] of m) { - res.push(f(value, key)); - } - return res - }; - - /** - * Tests whether any key-value pairs pass the test implemented by `f(value, key)`. - * - * @todo should rename to some - similarly to Array.some - * - * @function - * @template K - * @template V - * @param {Map} m - * @param {function(V,K):boolean} f - * @return {boolean} - */ - const any = (m, f) => { - for (const [key, value] of m) { - if (f(value, key)) { - return true - } - } - return false - }; - - /** - * Utility module to work with sets. - * - * @module set - */ - - const create$5 = () => new Set(); - - /** - * Utility module to work with Arrays. - * - * @module array - */ - - - /** - * Return the last element of an array. The element must exist - * - * @template L - * @param {ArrayLike} arr - * @return {L} - */ - const last = arr => arr[arr.length - 1]; - - /** - * Transforms something array-like to an actual Array. - * - * @function - * @template T - * @param {ArrayLike|Iterable} arraylike - * @return {T} - */ - const from = Array.from; - - const isArray = Array.isArray; - - /** - * @param {string} s - * @return {string} - */ - const toLowerCase = s => s.toLowerCase(); - - const trimLeftRegex = /^\s*/g; - - /** - * @param {string} s - * @return {string} - */ - const trimLeft = s => s.replace(trimLeftRegex, ''); - - const fromCamelCaseRegex = /([A-Z])/g; - - /** - * @param {string} s - * @param {string} separator - * @return {string} - */ - const fromCamelCase = (s, separator) => trimLeft(s.replace(fromCamelCaseRegex, match => `${separator}${toLowerCase(match)}`)); - - /** - * @param {string} str - * @return {Uint8Array} - */ - const _encodeUtf8Polyfill = str => { - const encodedString = unescape(encodeURIComponent(str)); - const len = encodedString.length; - const buf = new Uint8Array(len); - for (let i = 0; i < len; i++) { - buf[i] = /** @type {number} */ (encodedString.codePointAt(i)); - } - return buf - }; - - /* c8 ignore next */ - const utf8TextEncoder = /** @type {TextEncoder} */ (typeof TextEncoder !== 'undefined' ? new TextEncoder() : null); - - /** - * @param {string} str - * @return {Uint8Array} - */ - const _encodeUtf8Native = str => utf8TextEncoder.encode(str); - - /** - * @param {string} str - * @return {Uint8Array} - */ - /* c8 ignore next */ - const encodeUtf8 = utf8TextEncoder ? _encodeUtf8Native : _encodeUtf8Polyfill; - - /* c8 ignore next */ - let utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }); - - /* c8 ignore start */ - if (utf8TextDecoder && utf8TextDecoder.decode(new Uint8Array()).length === 1) { - // Safari doesn't handle BOM correctly. - // This fixes a bug in Safari 13.0.5 where it produces a BOM the first time it is called. - // utf8TextDecoder.decode(new Uint8Array()).length === 1 on the first call and - // utf8TextDecoder.decode(new Uint8Array()).length === 1 on the second call - // Another issue is that from then on no BOM chars are recognized anymore - /* c8 ignore next */ - utf8TextDecoder = null; - } - - /** - * Often used conditions. - * - * @module conditions - */ - - /** - * @template T - * @param {T|null|undefined} v - * @return {T|null} - */ - /* c8 ignore next */ - const undefinedToNull = v => v === undefined ? null : v; - - /* eslint-env browser */ - - /** - * Isomorphic variable storage. - * - * Uses LocalStorage in the browser and falls back to in-memory storage. - * - * @module storage - */ - - /* c8 ignore start */ - class VarStoragePolyfill { - constructor () { - this.map = new Map(); - } - - /** - * @param {string} key - * @param {any} newValue - */ - setItem (key, newValue) { - this.map.set(key, newValue); - } - - /** - * @param {string} key - */ - getItem (key) { - return this.map.get(key) - } - } - /* c8 ignore stop */ - - /** - * @type {any} - */ - let _localStorage = new VarStoragePolyfill(); - let usePolyfill = true; - - /* c8 ignore start */ - try { - // if the same-origin rule is violated, accessing localStorage might thrown an error - if (typeof localStorage !== 'undefined') { - _localStorage = localStorage; - usePolyfill = false; - } - } catch (e) { } - /* c8 ignore stop */ - - /** - * This is basically localStorage in browser, or a polyfill in nodejs - */ - /* c8 ignore next */ - const varStorage = _localStorage; - - /** - * Utility functions for working with EcmaScript objects. - * - * @module object - */ - - - /** - * Object.assign - */ - const assign = Object.assign; - - /** - * @param {Object} obj - */ - const keys = Object.keys; - - /** - * @template V - * @param {{[k:string]:V}} obj - * @param {function(V,string):any} f - */ - const forEach$1 = (obj, f) => { - for (const key in obj) { - f(obj[key], key); - } - }; - - /** - * @todo implement mapToArray & map - * - * @template R - * @param {Object} obj - * @param {function(any,string):R} f - * @return {Array} - */ - const map = (obj, f) => { - const results = []; - for (const key in obj) { - results.push(f(obj[key], key)); - } - return results - }; - - /** - * @param {Object} obj - * @return {number} - */ - const length$1 = obj => keys(obj).length; - - /** - * @param {Object|undefined} obj - */ - const isEmpty = obj => { - // eslint-disable-next-line - for (const _k in obj) { - return false - } - return true - }; - - /** - * @param {Object} obj - * @param {function(any,string):boolean} f - * @return {boolean} - */ - const every = (obj, f) => { - for (const key in obj) { - if (!f(obj[key], key)) { - return false - } - } - return true - }; - - /** - * Calls `Object.prototype.hasOwnProperty`. - * - * @param {any} obj - * @param {string|symbol} key - * @return {boolean} - */ - const hasProperty = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key); - - /** - * @param {Object} a - * @param {Object} b - * @return {boolean} - */ - const equalFlat = (a, b) => a === b || (length$1(a) === length$1(b) && every(a, (val, key) => (val !== undefined || hasProperty(b, key)) && b[key] === val)); - - /** - * Common functions and function call helpers. - * - * @module function - */ - - - /** - * Calls all functions in `fs` with args. Only throws after all functions were called. - * - * @param {Array} fs - * @param {Array} args - */ - const callAll = (fs, args, i = 0) => { - try { - for (; i < fs.length; i++) { - fs[i](...args); - } - } finally { - if (i < fs.length) { - callAll(fs, args, i + 1); - } - } - }; - - /** - * @template T - * - * @param {T} a - * @param {T} b - * @return {boolean} - */ - const equalityStrict = (a, b) => a === b; - - /* c8 ignore start */ - - /** - * @param {any} a - * @param {any} b - * @return {boolean} - */ - const equalityDeep = (a, b) => { - if (a == null || b == null) { - return equalityStrict(a, b) - } - if (a.constructor !== b.constructor) { - return false - } - if (a === b) { - return true - } - switch (a.constructor) { - case ArrayBuffer: - a = new Uint8Array(a); - b = new Uint8Array(b); - // eslint-disable-next-line no-fallthrough - case Uint8Array: { - if (a.byteLength !== b.byteLength) { - return false - } - for (let i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false - } - } - break - } - case Set: { - if (a.size !== b.size) { - return false - } - for (const value of a) { - if (!b.has(value)) { - return false - } - } - break - } - case Map: { - if (a.size !== b.size) { - return false - } - for (const key of a.keys()) { - if (!b.has(key) || !equalityDeep(a.get(key), b.get(key))) { - return false - } - } - break - } - case Object: - if (length$1(a) !== length$1(b)) { - return false - } - for (const key in a) { - if (!hasProperty(a, key) || !equalityDeep(a[key], b[key])) { - return false - } - } - break - case Array: - if (a.length !== b.length) { - return false - } - for (let i = 0; i < a.length; i++) { - if (!equalityDeep(a[i], b[i])) { - return false - } - } - break - default: - return false - } - return true - }; - - /** - * @template V - * @template {V} OPTS - * - * @param {V} value - * @param {Array} options - */ - // @ts-ignore - const isOneOf = (value, options) => options.includes(value); - - /** - * Isomorphic module to work access the environment (query params, env variables). - * - * @module map - */ - - - /* c8 ignore next */ - // @ts-ignore - const isNode = typeof process !== 'undefined' && process.release && - /node|io\.js/.test(process.release.name); - /* c8 ignore next */ - const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && !isNode; - - /** - * @type {Map} - */ - let params; - - /* c8 ignore start */ - const computeParams = () => { - if (params === undefined) { - if (isNode) { - params = create$6(); - const pargs = process.argv; - let currParamName = null; - for (let i = 0; i < pargs.length; i++) { - const parg = pargs[i]; - if (parg[0] === '-') { - if (currParamName !== null) { - params.set(currParamName, ''); - } - currParamName = parg; - } else { - if (currParamName !== null) { - params.set(currParamName, parg); - currParamName = null; - } - } - } - if (currParamName !== null) { - params.set(currParamName, ''); - } - // in ReactNative for example this would not be true (unless connected to the Remote Debugger) - } else if (typeof location === 'object') { - params = create$6(); // eslint-disable-next-line no-undef - (location.search || '?').slice(1).split('&').forEach((kv) => { - if (kv.length !== 0) { - const [key, value] = kv.split('='); - params.set(`--${fromCamelCase(key, '-')}`, value); - params.set(`-${fromCamelCase(key, '-')}`, value); - } - }); - } else { - params = create$6(); - } - } - return params - }; - /* c8 ignore stop */ - - /** - * @param {string} name - * @return {boolean} - */ - /* c8 ignore next */ - const hasParam = (name) => computeParams().has(name); - - /** - * @param {string} name - * @param {string} defaultVal - * @return {string} - */ - /* c8 ignore next 2 */ - const getParam = (name, defaultVal) => - computeParams().get(name) || defaultVal; - - /** - * @param {string} name - * @return {string|null} - */ - /* c8 ignore next 4 */ - const getVariable = (name) => - isNode - ? undefinedToNull(process.env[name.toUpperCase()]) - : undefinedToNull(varStorage.getItem(name)); - - /** - * @param {string} name - * @return {boolean} - */ - /* c8 ignore next 2 */ - const hasConf = (name) => - hasParam('--' + name) || getVariable(name) !== null; - - /* c8 ignore next */ - hasConf('production'); - - /* c8 ignore next 2 */ - const forceColor = isNode && - isOneOf(process.env.FORCE_COLOR, ['true', '1', '2']); - - /* c8 ignore start */ - const supportsColor = !hasParam('no-colors') && - (!isNode || process.stdout.isTTY || forceColor) && ( - !isNode || hasParam('color') || forceColor || - getVariable('COLORTERM') !== null || - (getVariable('TERM') || '').includes('color') - ); - /* c8 ignore stop */ - - /** - * Working with value pairs. - * - * @module pair - */ - - /** - * @template L,R - */ - class Pair { - /** - * @param {L} left - * @param {R} right - */ - constructor (left, right) { - this.left = left; - this.right = right; - } - } - - /** - * @template L,R - * @param {L} left - * @param {R} right - * @return {Pair} - */ - const create$4 = (left, right) => new Pair(left, right); - - /** - * @template L,R - * @param {Array>} arr - * @param {function(L, R):any} f - */ - const forEach = (arr, f) => arr.forEach(p => f(p.left, p.right)); - - /* eslint-env browser */ - - - /* c8 ignore start */ - /** - * @type {Document} - */ - const doc = /** @type {Document} */ (typeof document !== 'undefined' ? document : {}); - - /** - * @param {string} name - * @return {HTMLElement} - */ - const createElement = name => doc.createElement(name); - - /** - * @return {DocumentFragment} - */ - const createDocumentFragment = () => doc.createDocumentFragment(); - - /** - * @param {string} text - * @return {Text} - */ - const createTextNode = text => doc.createTextNode(text); - - /** @type {DOMParser} */ (typeof DOMParser !== 'undefined' ? new DOMParser() : null); - - /** - * @param {Element} el - * @param {Array>} attrs Array of key-value pairs - * @return {Element} - */ - const setAttributes = (el, attrs) => { - forEach(attrs, (key, value) => { - if (value === false) { - el.removeAttribute(key); - } else if (value === true) { - el.setAttribute(key, ''); - } else { - // @ts-ignore - el.setAttribute(key, value); - } - }); - return el - }; - - /** - * @param {Array|HTMLCollection} children - * @return {DocumentFragment} - */ - const fragment = children => { - const fragment = createDocumentFragment(); - for (let i = 0; i < children.length; i++) { - appendChild(fragment, children[i]); - } - return fragment - }; - - /** - * @param {Element} parent - * @param {Array} nodes - * @return {Element} - */ - const append = (parent, nodes) => { - appendChild(parent, fragment(nodes)); - return parent - }; - - /** - * @param {EventTarget} el - * @param {string} name - * @param {EventListener} f - */ - const addEventListener = (el, name, f) => el.addEventListener(name, f); - - /** - * @param {string} name - * @param {Array|pair.Pair>} attrs Array of key-value pairs - * @param {Array} children - * @return {Element} - */ - const element = (name, attrs = [], children = []) => - append(setAttributes(createElement(name), attrs), children); - - /** - * @param {string} t - * @return {Text} - */ - const text = createTextNode; - - /** - * @param {Map} m - * @return {string} - */ - const mapToStyleString = m => map$1(m, (value, key) => `${key}:${value};`).join(''); - - /** - * @param {Node} parent - * @param {Node} child - * @return {Node} - */ - const appendChild = (parent, child) => parent.appendChild(child); - - doc.ELEMENT_NODE; - doc.TEXT_NODE; - doc.CDATA_SECTION_NODE; - doc.COMMENT_NODE; - doc.DOCUMENT_NODE; - doc.DOCUMENT_TYPE_NODE; - doc.DOCUMENT_FRAGMENT_NODE; - /* c8 ignore stop */ - - /** - * JSON utility functions. - * - * @module json - */ - - /** - * Transform JavaScript object to JSON. - * - * @param {any} object - * @return {string} - */ - const stringify = JSON.stringify; - - /* global requestIdleCallback, requestAnimationFrame, cancelIdleCallback, cancelAnimationFrame */ - - /** - * Utility module to work with EcmaScript's event loop. - * - * @module eventloop - */ - - /** - * @type {Array} - */ - let queue = []; - - const _runQueue = () => { - for (let i = 0; i < queue.length; i++) { - queue[i](); - } - queue = []; - }; - - /** - * @param {function():void} f - */ - const enqueue = f => { - queue.push(f); - if (queue.length === 1) { - setTimeout(_runQueue, 0); - } - }; - - /** - * Common Math expressions. - * - * @module math - */ - - const floor = Math.floor; - const ceil = Math.ceil; - const abs = Math.abs; - const round = Math.round; - const log10 = Math.log10; - - /** - * @function - * @param {number} a - * @param {number} b - * @return {number} The sum of a and b - */ - const add = (a, b) => a + b; - - /** - * @function - * @param {number} a - * @param {number} b - * @return {number} The smaller element of a and b - */ - const min = (a, b) => a < b ? a : b; - - /** - * @function - * @param {number} a - * @param {number} b - * @return {number} The bigger element of a and b - */ - const max = (a, b) => a > b ? a : b; - /** - * Base 10 exponential function. Returns the value of 10 raised to the power of pow. - * - * @param {number} exp - * @return {number} - */ - const exp10 = exp => Math.pow(10, exp); - - /** - * @param {number} n - * @return {boolean} Wether n is negative. This function also differentiates between -0 and +0 - */ - const isNegativeZero = n => n !== 0 ? n < 0 : 1 / n < 0; - - /** - * Utility module to work with EcmaScript Symbols. - * - * @module symbol - */ - - /** - * Return fresh symbol. - * - * @return {Symbol} - */ - const create$3 = Symbol; - - /** - * Utility module to convert metric values. - * - * @module metric - */ - - - const prefixUp = ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; - const prefixDown = ['', 'm', 'μ', 'n', 'p', 'f', 'a', 'z', 'y']; - - /** - * Calculate the metric prefix for a number. Assumes E.g. `prefix(1000) = { n: 1, prefix: 'k' }` - * - * @param {number} n - * @param {number} [baseMultiplier] Multiplier of the base (10^(3*baseMultiplier)). E.g. `convert(time, -3)` if time is already in milli seconds - * @return {{n:number,prefix:string}} - */ - const prefix = (n, baseMultiplier = 0) => { - const nPow = n === 0 ? 0 : log10(n); - let mult = 0; - while (nPow < mult * 3 && baseMultiplier > -8) { - baseMultiplier--; - mult--; - } - while (nPow >= 3 + mult * 3 && baseMultiplier < 8) { - baseMultiplier++; - mult++; - } - const prefix = baseMultiplier < 0 ? prefixDown[-baseMultiplier] : prefixUp[baseMultiplier]; - return { - n: round((mult > 0 ? n / exp10(mult * 3) : n * exp10(mult * -3)) * 1e12) / 1e12, - prefix - } - }; - - /** - * Utility module to work with time. - * - * @module time - */ - - - /** - * Return current unix time. - * - * @return {number} - */ - const getUnixTime = Date.now; - - /** - * Transform time (in ms) to a human readable format. E.g. 1100 => 1.1s. 60s => 1min. .001 => 10μs. - * - * @param {number} d duration in milliseconds - * @return {string} humanized approximation of time - */ - const humanizeDuration = d => { - if (d < 60000) { - const p = prefix(d, -1); - return round(p.n * 100) / 100 + p.prefix + 's' - } - d = floor(d / 1000); - const seconds = d % 60; - const minutes = floor(d / 60) % 60; - const hours = floor(d / 3600) % 24; - const days = floor(d / 86400); - if (days > 0) { - return days + 'd' + ((hours > 0 || minutes > 30) ? ' ' + (minutes > 30 ? hours + 1 : hours) + 'h' : '') - } - if (hours > 0) { - /* c8 ignore next */ - return hours + 'h' + ((minutes > 0 || seconds > 30) ? ' ' + (seconds > 30 ? minutes + 1 : minutes) + 'min' : '') - } - return minutes + 'min' + (seconds > 0 ? ' ' + seconds + 's' : '') - }; - - const BOLD = create$3(); - const UNBOLD = create$3(); - const BLUE = create$3(); - const GREY = create$3(); - const GREEN = create$3(); - const RED = create$3(); - const PURPLE = create$3(); - const ORANGE = create$3(); - const UNCOLOR = create$3(); - - /* c8 ignore start */ - /** - * @param {Array} args - * @return {Array} - */ - const computeNoColorLoggingArgs = args => { - const logArgs = []; - // try with formatting until we find something unsupported - let i = 0; - for (; i < args.length; i++) { - const arg = args[i]; - if (arg.constructor === String || arg.constructor === Number) ; else if (arg.constructor === Object) { - logArgs.push(JSON.stringify(arg)); - } - } - return logArgs - }; - /* c8 ignore stop */ - - /** - * Isomorphic logging module with support for colors! - * - * @module logging - */ - - - /** - * @type {Object>} - */ - const _browserStyleMap = { - [BOLD]: create$4('font-weight', 'bold'), - [UNBOLD]: create$4('font-weight', 'normal'), - [BLUE]: create$4('color', 'blue'), - [GREEN]: create$4('color', 'green'), - [GREY]: create$4('color', 'grey'), - [RED]: create$4('color', 'red'), - [PURPLE]: create$4('color', 'purple'), - [ORANGE]: create$4('color', 'orange'), // not well supported in chrome when debugging node with inspector - TODO: deprecate - [UNCOLOR]: create$4('color', 'black') - }; - - /** - * @param {Array} args - * @return {Array} - */ - /* c8 ignore start */ - const computeBrowserLoggingArgs = (args) => { - const strBuilder = []; - const styles = []; - const currentStyle = create$6(); - /** - * @type {Array} - */ - let logArgs = []; - // try with formatting until we find something unsupported - let i = 0; - for (; i < args.length; i++) { - const arg = args[i]; - // @ts-ignore - const style = _browserStyleMap[arg]; - if (style !== undefined) { - currentStyle.set(style.left, style.right); - } else { - if (arg.constructor === String || arg.constructor === Number) { - const style = mapToStyleString(currentStyle); - if (i > 0 || style.length > 0) { - strBuilder.push('%c' + arg); - styles.push(style); - } else { - strBuilder.push(arg); - } - } else { - break - } - } - } - if (i > 0) { - // create logArgs with what we have so far - logArgs = styles; - logArgs.unshift(strBuilder.join('')); - } - // append the rest - for (; i < args.length; i++) { - const arg = args[i]; - if (!(arg instanceof Symbol)) { - logArgs.push(arg); - } - } - return logArgs - }; - /* c8 ignore stop */ - - /* c8 ignore start */ - const computeLoggingArgs = supportsColor - ? computeBrowserLoggingArgs - : computeNoColorLoggingArgs; - /* c8 ignore stop */ - - /** - * @param {Array} args - */ - const print = (...args) => { - console.log(...computeLoggingArgs(args)); - /* c8 ignore next */ - vconsoles.forEach((vc) => vc.print(args)); - }; - /* c8 ignore stop */ - - /** - * @param {Error} err - */ - /* c8 ignore start */ - const printError = (err) => { - console.error(err); - vconsoles.forEach((vc) => vc.printError(err)); - }; - /* c8 ignore stop */ - - /** - * @param {string} url image location - * @param {number} height height of the image in pixel - */ - /* c8 ignore start */ - const printImg = (url, height) => { - if (isBrowser) { - console.log( - '%c ', - `font-size: ${height}px; background-size: contain; background-repeat: no-repeat; background-image: url(${url})` - ); - // console.log('%c ', `font-size: ${height}x; background: url(${url}) no-repeat;`) - } - vconsoles.forEach((vc) => vc.printImg(url, height)); - }; - /* c8 ignore stop */ - - /** - * @param {string} base64 - * @param {number} height - */ - /* c8 ignore next 2 */ - const printImgBase64 = (base64, height) => - printImg(`data:image/gif;base64,${base64}`, height); - - /** - * @param {Array} args - */ - const group = (...args) => { - console.group(...computeLoggingArgs(args)); - /* c8 ignore next */ - vconsoles.forEach((vc) => vc.group(args)); - }; - - /** - * @param {Array} args - */ - const groupCollapsed = (...args) => { - console.groupCollapsed(...computeLoggingArgs(args)); - /* c8 ignore next */ - vconsoles.forEach((vc) => vc.groupCollapsed(args)); - }; - - const groupEnd = () => { - console.groupEnd(); - /* c8 ignore next */ - vconsoles.forEach((vc) => vc.groupEnd()); - }; - - const vconsoles = create$5(); - - /** - * @param {Array} args - * @return {Array} - */ - /* c8 ignore start */ - const _computeLineSpans = (args) => { - const spans = []; - const currentStyle = new Map(); - // try with formatting until we find something unsupported - let i = 0; - for (; i < args.length; i++) { - const arg = args[i]; - // @ts-ignore - const style = _browserStyleMap[arg]; - if (style !== undefined) { - currentStyle.set(style.left, style.right); - } else { - if (arg.constructor === String || arg.constructor === Number) { - // @ts-ignore - const span = element('span', [ - create$4('style', mapToStyleString(currentStyle)) - ], [text(arg.toString())]); - if (span.innerHTML === '') { - span.innerHTML = ' '; - } - spans.push(span); - } else { - break - } - } - } - // append the rest - for (; i < args.length; i++) { - let content = args[i]; - if (!(content instanceof Symbol)) { - if (content.constructor !== String && content.constructor !== Number) { - content = ' ' + stringify(content) + ' '; - } - spans.push( - element('span', [], [text(/** @type {string} */ (content))]) - ); - } - } - return spans - }; - /* c8 ignore stop */ - - const lineStyle = - 'font-family:monospace;border-bottom:1px solid #e2e2e2;padding:2px;'; - - /* c8 ignore start */ - class VConsole { - /** - * @param {Element} dom - */ - constructor (dom) { - this.dom = dom; - /** - * @type {Element} - */ - this.ccontainer = this.dom; - this.depth = 0; - vconsoles.add(this); - } - - /** - * @param {Array} args - * @param {boolean} collapsed - */ - group (args, collapsed = false) { - enqueue(() => { - const triangleDown = element('span', [ - create$4('hidden', collapsed), - create$4('style', 'color:grey;font-size:120%;') - ], [text('▼')]); - const triangleRight = element('span', [ - create$4('hidden', !collapsed), - create$4('style', 'color:grey;font-size:125%;') - ], [text('▶')]); - const content = element( - 'div', - [create$4( - 'style', - `${lineStyle};padding-left:${this.depth * 10}px` - )], - [triangleDown, triangleRight, text(' ')].concat( - _computeLineSpans(args) - ) - ); - const nextContainer = element('div', [ - create$4('hidden', collapsed) - ]); - const nextLine = element('div', [], [content, nextContainer]); - append(this.ccontainer, [nextLine]); - this.ccontainer = nextContainer; - this.depth++; - // when header is clicked, collapse/uncollapse container - addEventListener(content, 'click', (_event) => { - nextContainer.toggleAttribute('hidden'); - triangleDown.toggleAttribute('hidden'); - triangleRight.toggleAttribute('hidden'); - }); - }); - } - - /** - * @param {Array} args - */ - groupCollapsed (args) { - this.group(args, true); - } - - groupEnd () { - enqueue(() => { - if (this.depth > 0) { - this.depth--; - // @ts-ignore - this.ccontainer = this.ccontainer.parentElement.parentElement; - } - }); - } - - /** - * @param {Array} args - */ - print (args) { - enqueue(() => { - append(this.ccontainer, [ - element('div', [ - create$4( - 'style', - `${lineStyle};padding-left:${this.depth * 10}px` - ) - ], _computeLineSpans(args)) - ]); - }); - } - - /** - * @param {Error} err - */ - printError (err) { - this.print([RED, BOLD, err.toString()]); - } - - /** - * @param {string} url - * @param {number} height - */ - printImg (url, height) { - enqueue(() => { - append(this.ccontainer, [ - element('img', [ - create$4('src', url), - create$4('height', `${round(height * 1.5)}px`) - ]) - ]); - }); - } - - /** - * @param {Node} node - */ - printDom (node) { - enqueue(() => { - append(this.ccontainer, [node]); - }); - } - - destroy () { - enqueue(() => { - vconsoles.delete(this); - }); - } - } - /* c8 ignore stop */ - - /** - * @param {Element} dom - */ - /* c8 ignore next */ - const createVConsole = (dom) => new VConsole(dom); - - /* eslint-env browser */ - - /** - * Binary data constants. - * - * @module binary - */ - - /** - * n-th bit activated. - * - * @type {number} - */ - const BIT1 = 1; - const BIT2 = 2; - const BIT3 = 4; - const BIT4 = 8; - const BIT6 = 32; - const BIT7 = 64; - const BIT8 = 128; - const BITS5 = 31; - const BITS6 = 63; - const BITS7 = 127; - /** - * @type {number} - */ - const BITS31 = 0x7FFFFFFF; - /** - * @type {number} - */ - const BITS32 = 0xFFFFFFFF; - - /* eslint-env browser */ - - const getRandomValues = crypto.getRandomValues.bind(crypto); - - /** - * Isomorphic module for true random numbers / buffers / uuids. - * - * Attention: falls back to Math.random if the browser does not support crypto. - * - * @module random - */ - - - const uint32 = () => getRandomValues(new Uint32Array(1))[0]; - - // @ts-ignore - const uuidv4Template = [1e7] + -1e3 + -4e3 + -8e3 + -1e11; - - /** - * @return {string} - */ - const uuidv4 = () => uuidv4Template.replace(/[018]/g, /** @param {number} c */ c => - (c ^ uint32() & 15 >> c / 4).toString(16) - ); - - /** - * @module prng - */ - - - /** - * Xorshift32 is a very simple but elegang PRNG with a period of `2^32-1`. - */ - 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) / (BITS32 + 1) - } - } - - /** - * @module prng - */ - - - /** - * 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) - */ - 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() * 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) / (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) / (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 - #include - - 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; - } - */ - - /** - * Utility helpers for working with numbers. - * - * @module number - */ - - - const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER; - - /* c8 ignore next */ - const isInteger = Number.isInteger || (num => typeof num === 'number' && isFinite(num) && floor(num) === num); - - /** - * Efficient schema-less binary encoding with support for variable length encoding. - * - * Use [lib0/encoding] with [lib0/decoding]. Every encoding function has a corresponding decoding function. - * - * Encodes numbers in little-endian order (least to most significant byte order) - * and is compatible with Golang's binary encoding (https://golang.org/pkg/encoding/binary/) - * which is also used in Protocol Buffers. - * - * ```js - * // encoding step - * const encoder = encoding.createEncoder() - * encoding.writeVarUint(encoder, 256) - * encoding.writeVarString(encoder, 'Hello world!') - * const buf = encoding.toUint8Array(encoder) - * ``` - * - * ```js - * // decoding step - * const decoder = decoding.createDecoder(buf) - * decoding.readVarUint(decoder) // => 256 - * decoding.readVarString(decoder) // => 'Hello world!' - * decoding.hasContent(decoder) // => false - all data is read - * ``` - * - * @module encoding - */ - - - /** - * A BinaryEncoder handles the encoding to an Uint8Array. - */ - class Encoder { - constructor () { - this.cpos = 0; - this.cbuf = new Uint8Array(100); - /** - * @type {Array} - */ - this.bufs = []; - } - } - - /** - * @function - * @return {Encoder} - */ - const createEncoder = () => new Encoder(); - - /** - * The current length of the encoded data. - * - * @function - * @param {Encoder} encoder - * @return {number} - */ - const length = encoder => { - let len = encoder.cpos; - for (let i = 0; i < encoder.bufs.length; i++) { - len += encoder.bufs[i].length; - } - return len - }; - - /** - * Transform to Uint8Array. - * - * @function - * @param {Encoder} encoder - * @return {Uint8Array} The created ArrayBuffer. - */ - const toUint8Array = encoder => { - const uint8arr = new Uint8Array(length(encoder)); - let curPos = 0; - for (let i = 0; i < encoder.bufs.length; i++) { - const d = encoder.bufs[i]; - uint8arr.set(d, curPos); - curPos += d.length; - } - uint8arr.set(createUint8ArrayViewFromArrayBuffer(encoder.cbuf.buffer, 0, encoder.cpos), curPos); - return uint8arr - }; - - /** - * Verify that it is possible to write `len` bytes wtihout checking. If - * necessary, a new Buffer with the required length is attached. - * - * @param {Encoder} encoder - * @param {number} len - */ - const verifyLen = (encoder, len) => { - const bufferLen = encoder.cbuf.length; - if (bufferLen - encoder.cpos < len) { - encoder.bufs.push(createUint8ArrayViewFromArrayBuffer(encoder.cbuf.buffer, 0, encoder.cpos)); - encoder.cbuf = new Uint8Array(max(bufferLen, len) * 2); - encoder.cpos = 0; - } - }; - - /** - * Write one byte to the encoder. - * - * @function - * @param {Encoder} encoder - * @param {number} num The byte that is to be encoded. - */ - const write = (encoder, num) => { - const bufferLen = encoder.cbuf.length; - if (encoder.cpos === bufferLen) { - encoder.bufs.push(encoder.cbuf); - encoder.cbuf = new Uint8Array(bufferLen * 2); - encoder.cpos = 0; - } - encoder.cbuf[encoder.cpos++] = num; - }; - - /** - * Write one byte as an unsigned integer. - * - * @function - * @param {Encoder} encoder - * @param {number} num The number that is to be encoded. - */ - const writeUint8 = write; - - /** - * Write a variable length unsigned integer. Max encodable integer is 2^53. - * - * @function - * @param {Encoder} encoder - * @param {number} num The number that is to be encoded. - */ - const writeVarUint = (encoder, num) => { - while (num > BITS7) { - write(encoder, BIT8 | (BITS7 & num)); - num = floor(num / 128); // shift >>> 7 - } - write(encoder, BITS7 & num); - }; - - /** - * Write a variable length integer. - * - * We use the 7th bit instead for signaling that this is a negative number. - * - * @function - * @param {Encoder} encoder - * @param {number} num The number that is to be encoded. - */ - const writeVarInt = (encoder, num) => { - const isNegative = isNegativeZero(num); - if (isNegative) { - num = -num; - } - // |- whether to continue reading |- whether is negative |- number - write(encoder, (num > BITS6 ? BIT8 : 0) | (isNegative ? BIT7 : 0) | (BITS6 & num)); - num = floor(num / 64); // shift >>> 6 - // We don't need to consider the case of num === 0 so we can use a different - // pattern here than above. - while (num > 0) { - write(encoder, (num > BITS7 ? BIT8 : 0) | (BITS7 & num)); - num = floor(num / 128); // shift >>> 7 - } - }; - - /** - * A cache to store strings temporarily - */ - const _strBuffer = new Uint8Array(30000); - const _maxStrBSize = _strBuffer.length / 3; - - /** - * Write a variable length string. - * - * @function - * @param {Encoder} encoder - * @param {String} str The string that is to be encoded. - */ - const _writeVarStringNative = (encoder, str) => { - if (str.length < _maxStrBSize) { - // We can encode the string into the existing buffer - /* c8 ignore next */ - const written = utf8TextEncoder.encodeInto(str, _strBuffer).written || 0; - writeVarUint(encoder, written); - for (let i = 0; i < written; i++) { - write(encoder, _strBuffer[i]); - } - } else { - writeVarUint8Array(encoder, encodeUtf8(str)); - } - }; - - /** - * Write a variable length string. - * - * @function - * @param {Encoder} encoder - * @param {String} str The string that is to be encoded. - */ - const _writeVarStringPolyfill = (encoder, str) => { - const encodedString = unescape(encodeURIComponent(str)); - const len = encodedString.length; - writeVarUint(encoder, len); - for (let i = 0; i < len; i++) { - write(encoder, /** @type {number} */ (encodedString.codePointAt(i))); - } - }; - - /** - * Write a variable length string. - * - * @function - * @param {Encoder} encoder - * @param {String} str The string that is to be encoded. - */ - /* c8 ignore next */ - const writeVarString = (utf8TextEncoder && /** @type {any} */ (utf8TextEncoder).encodeInto) ? _writeVarStringNative : _writeVarStringPolyfill; - - /** - * Append fixed-length Uint8Array to the encoder. - * - * @function - * @param {Encoder} encoder - * @param {Uint8Array} uint8Array - */ - const writeUint8Array = (encoder, uint8Array) => { - const bufferLen = encoder.cbuf.length; - const cpos = encoder.cpos; - const leftCopyLen = min(bufferLen - cpos, uint8Array.length); - const rightCopyLen = uint8Array.length - leftCopyLen; - encoder.cbuf.set(uint8Array.subarray(0, leftCopyLen), cpos); - encoder.cpos += leftCopyLen; - if (rightCopyLen > 0) { - // Still something to write, write right half.. - // Append new buffer - encoder.bufs.push(encoder.cbuf); - // must have at least size of remaining buffer - encoder.cbuf = new Uint8Array(max(bufferLen * 2, rightCopyLen)); - // copy array - encoder.cbuf.set(uint8Array.subarray(leftCopyLen)); - encoder.cpos = rightCopyLen; - } - }; - - /** - * Append an Uint8Array to Encoder. - * - * @function - * @param {Encoder} encoder - * @param {Uint8Array} uint8Array - */ - const writeVarUint8Array = (encoder, uint8Array) => { - writeVarUint(encoder, uint8Array.byteLength); - writeUint8Array(encoder, uint8Array); - }; - - /** - * Create an DataView of the next `len` bytes. Use it to write data after - * calling this function. - * - * ```js - * // write float32 using DataView - * const dv = writeOnDataView(encoder, 4) - * dv.setFloat32(0, 1.1) - * // read float32 using DataView - * const dv = readFromDataView(encoder, 4) - * dv.getFloat32(0) // => 1.100000023841858 (leaving it to the reader to find out why this is the correct result) - * ``` - * - * @param {Encoder} encoder - * @param {number} len - * @return {DataView} - */ - const writeOnDataView = (encoder, len) => { - verifyLen(encoder, len); - const dview = new DataView(encoder.cbuf.buffer, encoder.cpos, len); - encoder.cpos += len; - return dview - }; - - /** - * @param {Encoder} encoder - * @param {number} num - */ - const writeFloat32 = (encoder, num) => writeOnDataView(encoder, 4).setFloat32(0, num, false); - - /** - * @param {Encoder} encoder - * @param {number} num - */ - const writeFloat64 = (encoder, num) => writeOnDataView(encoder, 8).setFloat64(0, num, false); - - /** - * @param {Encoder} encoder - * @param {bigint} num - */ - const writeBigInt64 = (encoder, num) => /** @type {any} */ (writeOnDataView(encoder, 8)).setBigInt64(0, num, false); - - const floatTestBed = new DataView(new ArrayBuffer(4)); - /** - * Check if a number can be encoded as a 32 bit float. - * - * @param {number} num - * @return {boolean} - */ - const isFloat32 = num => { - floatTestBed.setFloat32(0, num); - return floatTestBed.getFloat32(0) === num - }; - - /** - * Encode data with efficient binary format. - * - * Differences to JSON: - * • Transforms data to a binary format (not to a string) - * • Encodes undefined, NaN, and ArrayBuffer (these can't be represented in JSON) - * • Numbers are efficiently encoded either as a variable length integer, as a - * 32 bit float, as a 64 bit float, or as a 64 bit bigint. - * - * Encoding table: - * - * | Data Type | Prefix | Encoding Method | Comment | - * | ------------------- | -------- | ------------------ | ------- | - * | undefined | 127 | | Functions, symbol, and everything that cannot be identified is encoded as undefined | - * | null | 126 | | | - * | integer | 125 | writeVarInt | Only encodes 32 bit signed integers | - * | float32 | 124 | writeFloat32 | | - * | float64 | 123 | writeFloat64 | | - * | bigint | 122 | writeBigInt64 | | - * | boolean (false) | 121 | | True and false are different data types so we save the following byte | - * | boolean (true) | 120 | | - 0b01111000 so the last bit determines whether true or false | - * | string | 119 | writeVarString | | - * | object | 118 | custom | Writes {length} then {length} key-value pairs | - * | array | 117 | custom | Writes {length} then {length} json values | - * | Uint8Array | 116 | writeVarUint8Array | We use Uint8Array for any kind of binary data | - * - * Reasons for the decreasing prefix: - * We need the first bit for extendability (later we may want to encode the - * prefix with writeVarUint). The remaining 7 bits are divided as follows: - * [0-30] the beginning of the data range is used for custom purposes - * (defined by the function that uses this library) - * [31-127] the end of the data range is used for data encoding by - * lib0/encoding.js - * - * @param {Encoder} encoder - * @param {undefined|null|number|bigint|boolean|string|Object|Array|Uint8Array} data - */ - const writeAny = (encoder, data) => { - switch (typeof data) { - case 'string': - // TYPE 119: STRING - write(encoder, 119); - writeVarString(encoder, data); - break - case 'number': - if (isInteger(data) && abs(data) <= BITS31) { - // TYPE 125: INTEGER - write(encoder, 125); - writeVarInt(encoder, data); - } else if (isFloat32(data)) { - // TYPE 124: FLOAT32 - write(encoder, 124); - writeFloat32(encoder, data); - } else { - // TYPE 123: FLOAT64 - write(encoder, 123); - writeFloat64(encoder, data); - } - break - case 'bigint': - // TYPE 122: BigInt - write(encoder, 122); - writeBigInt64(encoder, data); - break - case 'object': - if (data === null) { - // TYPE 126: null - write(encoder, 126); - } else if (isArray(data)) { - // TYPE 117: Array - write(encoder, 117); - writeVarUint(encoder, data.length); - for (let i = 0; i < data.length; i++) { - writeAny(encoder, data[i]); - } - } else if (data instanceof Uint8Array) { - // TYPE 116: ArrayBuffer - write(encoder, 116); - writeVarUint8Array(encoder, data); - } else { - // TYPE 118: Object - write(encoder, 118); - const keys = Object.keys(data); - writeVarUint(encoder, keys.length); - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; - writeVarString(encoder, key); - writeAny(encoder, data[key]); - } - } - break - case 'boolean': - // TYPE 120/121: boolean (true/false) - write(encoder, data ? 120 : 121); - break - default: - // TYPE 127: undefined - write(encoder, 127); - } - }; - - /** - * Now come a few stateful encoder that have their own classes. - */ - - /** - * Basic Run Length Encoder - a basic compression implementation. - * - * Encodes [1,1,1,7] to [1,3,7,1] (3 times 1, 1 time 7). This encoder might do more harm than good if there are a lot of values that are not repeated. - * - * It was originally used for image compression. Cool .. article http://csbruce.com/cbm/transactor/pdfs/trans_v7_i06.pdf - * - * @note T must not be null! - * - * @template T - */ - class RleEncoder extends Encoder { - /** - * @param {function(Encoder, T):void} writer - */ - constructor (writer) { - super(); - /** - * The writer - */ - this.w = writer; - /** - * Current state - * @type {T|null} - */ - this.s = null; - this.count = 0; - } - - /** - * @param {T} v - */ - write (v) { - if (this.s === v) { - this.count++; - } else { - if (this.count > 0) { - // flush counter, unless this is the first value (count = 0) - writeVarUint(this, this.count - 1); // since count is always > 0, we can decrement by one. non-standard encoding ftw - } - this.count = 1; - // write first value - this.w(this, v); - this.s = v; - } - } - } - - /** - * @param {UintOptRleEncoder} encoder - */ - const flushUintOptRleEncoder = encoder => { - if (encoder.count > 0) { - // flush counter, unless this is the first value (count = 0) - // case 1: just a single value. set sign to positive - // case 2: write several values. set sign to negative to indicate that there is a length coming - writeVarInt(encoder.encoder, encoder.count === 1 ? encoder.s : -encoder.s); - if (encoder.count > 1) { - writeVarUint(encoder.encoder, encoder.count - 2); // since count is always > 1, we can decrement by one. non-standard encoding ftw - } - } - }; - - /** - * Optimized Rle encoder that does not suffer from the mentioned problem of the basic Rle encoder. - * - * Internally uses VarInt encoder to write unsigned integers. If the input occurs multiple times, we write - * write it as a negative number. The UintOptRleDecoder then understands that it needs to read a count. - * - * Encodes [1,2,3,3,3] as [1,2,-3,3] (once 1, once 2, three times 3) - */ - class UintOptRleEncoder { - constructor () { - this.encoder = new Encoder(); - /** - * @type {number} - */ - this.s = 0; - this.count = 0; - } - - /** - * @param {number} v - */ - write (v) { - if (this.s === v) { - this.count++; - } else { - flushUintOptRleEncoder(this); - this.count = 1; - this.s = v; - } - } - - toUint8Array () { - flushUintOptRleEncoder(this); - return toUint8Array(this.encoder) - } - } - - /** - * @param {IntDiffOptRleEncoder} encoder - */ - const flushIntDiffOptRleEncoder = encoder => { - if (encoder.count > 0) { - // 31 bit making up the diff | wether to write the counter - // const encodedDiff = encoder.diff << 1 | (encoder.count === 1 ? 0 : 1) - const encodedDiff = encoder.diff * 2 + (encoder.count === 1 ? 0 : 1); - // flush counter, unless this is the first value (count = 0) - // case 1: just a single value. set first bit to positive - // case 2: write several values. set first bit to negative to indicate that there is a length coming - writeVarInt(encoder.encoder, encodedDiff); - if (encoder.count > 1) { - writeVarUint(encoder.encoder, encoder.count - 2); // since count is always > 1, we can decrement by one. non-standard encoding ftw - } - } - }; - - /** - * A combination of the IntDiffEncoder and the UintOptRleEncoder. - * - * The count approach is similar to the UintDiffOptRleEncoder, but instead of using the negative bitflag, it encodes - * in the LSB whether a count is to be read. Therefore this Encoder only supports 31 bit integers! - * - * Encodes [1, 2, 3, 2] as [3, 1, 6, -1] (more specifically [(1 << 1) | 1, (3 << 0) | 0, -1]) - * - * Internally uses variable length encoding. Contrary to normal UintVar encoding, the first byte contains: - * * 1 bit that denotes whether the next value is a count (LSB) - * * 1 bit that denotes whether this value is negative (MSB - 1) - * * 1 bit that denotes whether to continue reading the variable length integer (MSB) - * - * Therefore, only five bits remain to encode diff ranges. - * - * Use this Encoder only when appropriate. In most cases, this is probably a bad idea. - */ - class IntDiffOptRleEncoder { - constructor () { - this.encoder = new Encoder(); - /** - * @type {number} - */ - this.s = 0; - this.count = 0; - this.diff = 0; - } - - /** - * @param {number} v - */ - write (v) { - if (this.diff === v - this.s) { - this.s = v; - this.count++; - } else { - flushIntDiffOptRleEncoder(this); - this.count = 1; - this.diff = v - this.s; - this.s = v; - } - } - - toUint8Array () { - flushIntDiffOptRleEncoder(this); - return toUint8Array(this.encoder) - } - } - - /** - * Optimized String Encoder. - * - * Encoding many small strings in a simple Encoder is not very efficient. The function call to decode a string takes some time and creates references that must be eventually deleted. - * In practice, when decoding several million small strings, the GC will kick in more and more often to collect orphaned string objects (or maybe there is another reason?). - * - * This string encoder solves the above problem. All strings are concatenated and written as a single string using a single encoding call. - * - * The lengths are encoded using a UintOptRleEncoder. - */ - class StringEncoder { - constructor () { - /** - * @type {Array} - */ - this.sarr = []; - this.s = ''; - this.lensE = new UintOptRleEncoder(); - } - - /** - * @param {string} string - */ - write (string) { - this.s += string; - if (this.s.length > 19) { - this.sarr.push(this.s); - this.s = ''; - } - this.lensE.write(string.length); - } - - toUint8Array () { - const encoder = new Encoder(); - this.sarr.push(this.s); - this.s = ''; - writeVarString(encoder, this.sarr.join('')); - writeUint8Array(encoder, this.lensE.toUint8Array()); - return toUint8Array(encoder) - } - } - - /** - * Error helpers. - * - * @module error - */ - - /** - * @param {string} s - * @return {Error} - */ - /* c8 ignore next */ - const create$2 = s => new Error(s); - - /** - * @throws {Error} - * @return {never} - */ - /* c8 ignore next 3 */ - const methodUnimplemented = () => { - throw create$2('Method unimplemented') - }; - - /** - * @throws {Error} - * @return {never} - */ - /* c8 ignore next 3 */ - const unexpectedCase = () => { - throw create$2('Unexpected case') - }; - - /** - * Efficient schema-less binary decoding with support for variable length encoding. - * - * Use [lib0/decoding] with [lib0/encoding]. Every encoding function has a corresponding decoding function. - * - * Encodes numbers in little-endian order (least to most significant byte order) - * and is compatible with Golang's binary encoding (https://golang.org/pkg/encoding/binary/) - * which is also used in Protocol Buffers. - * - * ```js - * // encoding step - * const encoder = encoding.createEncoder() - * encoding.writeVarUint(encoder, 256) - * encoding.writeVarString(encoder, 'Hello world!') - * const buf = encoding.toUint8Array(encoder) - * ``` - * - * ```js - * // decoding step - * const decoder = decoding.createDecoder(buf) - * decoding.readVarUint(decoder) // => 256 - * decoding.readVarString(decoder) // => 'Hello world!' - * decoding.hasContent(decoder) // => false - all data is read - * ``` - * - * @module decoding - */ - - - const errorUnexpectedEndOfArray = create$2('Unexpected end of array'); - const errorIntegerOutOfRange = create$2('Integer out of Range'); - - /** - * A Decoder handles the decoding of an Uint8Array. - */ - class Decoder { - /** - * @param {Uint8Array} uint8Array Binary data to decode - */ - constructor (uint8Array) { - /** - * Decoding target. - * - * @type {Uint8Array} - */ - this.arr = uint8Array; - /** - * Current decoding position. - * - * @type {number} - */ - this.pos = 0; - } - } - - /** - * @function - * @param {Uint8Array} uint8Array - * @return {Decoder} - */ - const createDecoder = uint8Array => new Decoder(uint8Array); - - /** - * Create an Uint8Array view of the next `len` bytes and advance the position by `len`. - * - * Important: The Uint8Array still points to the underlying ArrayBuffer. Make sure to discard the result as soon as possible to prevent any memory leaks. - * Use `buffer.copyUint8Array` to copy the result into a new Uint8Array. - * - * @function - * @param {Decoder} decoder The decoder instance - * @param {number} len The length of bytes to read - * @return {Uint8Array} - */ - const readUint8Array = (decoder, len) => { - const view = createUint8ArrayViewFromArrayBuffer(decoder.arr.buffer, decoder.pos + decoder.arr.byteOffset, len); - decoder.pos += len; - return view - }; - - /** - * Read variable length Uint8Array. - * - * Important: The Uint8Array still points to the underlying ArrayBuffer. Make sure to discard the result as soon as possible to prevent any memory leaks. - * Use `buffer.copyUint8Array` to copy the result into a new Uint8Array. - * - * @function - * @param {Decoder} decoder - * @return {Uint8Array} - */ - const readVarUint8Array = decoder => readUint8Array(decoder, readVarUint(decoder)); - - /** - * Read one byte as unsigned integer. - * @function - * @param {Decoder} decoder The decoder instance - * @return {number} Unsigned 8-bit integer - */ - const readUint8 = decoder => decoder.arr[decoder.pos++]; - - /** - * Read unsigned integer (32bit) with variable length. - * 1/8th of the storage is used as encoding overhead. - * * numbers < 2^7 is stored in one bytlength - * * numbers < 2^14 is stored in two bylength - * - * @function - * @param {Decoder} decoder - * @return {number} An unsigned integer.length - */ - const readVarUint = decoder => { - let num = 0; - let mult = 1; - const len = decoder.arr.length; - while (decoder.pos < len) { - const r = decoder.arr[decoder.pos++]; - // num = num | ((r & binary.BITS7) << len) - num = num + (r & BITS7) * mult; // shift $r << (7*#iterations) and add it to num - mult *= 128; // next iteration, shift 7 "more" to the left - if (r < BIT8) { - return num - } - /* c8 ignore start */ - if (num > MAX_SAFE_INTEGER) { - throw errorIntegerOutOfRange - } - /* c8 ignore stop */ - } - throw errorUnexpectedEndOfArray - }; - - /** - * We don't test this function anymore as we use native decoding/encoding by default now. - * Better not modify this anymore.. - * - * Transforming utf8 to a string is pretty expensive. The code performs 10x better - * when String.fromCodePoint is fed with all characters as arguments. - * But most environments have a maximum number of arguments per functions. - * For effiency reasons we apply a maximum of 10000 characters at once. - * - * @function - * @param {Decoder} decoder - * @return {String} The read String. - */ - /* c8 ignore start */ - const _readVarStringPolyfill = decoder => { - let remainingLen = readVarUint(decoder); - if (remainingLen === 0) { - return '' - } else { - let encodedString = String.fromCodePoint(readUint8(decoder)); // remember to decrease remainingLen - if (--remainingLen < 100) { // do not create a Uint8Array for small strings - while (remainingLen--) { - encodedString += String.fromCodePoint(readUint8(decoder)); - } - } else { - while (remainingLen > 0) { - const nextLen = remainingLen < 10000 ? remainingLen : 10000; - // this is dangerous, we create a fresh array view from the existing buffer - const bytes = decoder.arr.subarray(decoder.pos, decoder.pos + nextLen); - decoder.pos += nextLen; - // Starting with ES5.1 we can supply a generic array-like object as arguments - encodedString += String.fromCodePoint.apply(null, /** @type {any} */ (bytes)); - remainingLen -= nextLen; - } - } - return decodeURIComponent(escape(encodedString)) - } - }; - /* c8 ignore stop */ - - /** - * @function - * @param {Decoder} decoder - * @return {String} The read String - */ - const _readVarStringNative = decoder => - /** @type any */ (utf8TextDecoder).decode(readVarUint8Array(decoder)); - - /** - * Read string of variable length - * * varUint is used to store the length of the string - * - * @function - * @param {Decoder} decoder - * @return {String} The read String - * - */ - /* c8 ignore next */ - const readVarString = utf8TextDecoder ? _readVarStringNative : _readVarStringPolyfill; - - /** - * Utility functions to work with buffers (Uint8Array). - * - * @module buffer - */ - - - /** - * Create Uint8Array with initial content from buffer - * - * @param {ArrayBuffer} buffer - * @param {number} byteOffset - * @param {number} length - */ - const createUint8ArrayViewFromArrayBuffer = (buffer, byteOffset, length) => new Uint8Array(buffer, byteOffset, length); - - /** - * Fast Pseudo Random Number Generators. - * - * Given a seed a PRNG generates a sequence of numbers that cannot be reasonably predicted. - * Two PRNGs must generate the same random sequence of numbers if given the same seed. - * - * @module prng - */ - - - /** - * Description of the function - * @callback generatorNext - * @return {number} A random float in the cange of [0,1) - */ - - /** - * A random type generator. - * - * @typedef {Object} PRNG - * @property {generatorNext} next Generate new number - */ - const DefaultPRNG = Xoroshiro128plus; - - /** - * Create a Xoroshiro128plus Pseudo-Random-Number-Generator. - * This is the fastest full-period generator passing BigCrush without systematic failures. - * But there are more PRNGs available in ./PRNG/. - * - * @param {number} seed A positive 32bit integer. Do not use negative numbers. - * @return {PRNG} - */ - const create$1 = seed => new DefaultPRNG(seed); - /* c8 ignore stop */ - - /** - * Utility helpers for generating statistics. - * - * @module statistics - */ - - - /** - * @param {Array} arr Array of values - * @return {number} Returns null if the array is empty - */ - const median = arr => arr.length === 0 ? NaN : (arr.length % 2 === 1 ? arr[(arr.length - 1) / 2] : (arr[floor((arr.length - 1) / 2)] + arr[ceil((arr.length - 1) / 2)]) / 2); - - /** - * @param {Array} arr - * @return {number} - */ - const average = arr => arr.reduce(add, 0) / arr.length; - - /** - * Utility helpers to work with promises. - * - * @module promise - */ - - - /** - * @template T - * @callback PromiseResolve - * @param {T|PromiseLike} [result] - */ - - /** - * @template T - * @param {function(PromiseResolve,function(Error):void):any} f - * @return {Promise} - */ - const create = f => /** @type {Promise} */ (new Promise(f)); - - /** - * `Promise.all` wait for all promises in the array to resolve and return the result - * @template {unknown[] | []} PS - * - * @param {PS} ps - * @return {Promise<{ -readonly [P in keyof PS]: Awaited }>} - */ - Promise.all.bind(Promise); - - /** - * Checks if an object is a promise using ducktyping. - * - * Promises are often polyfilled, so it makes sense to add some additional guarantees if the user of this - * library has some insane environment where global Promise objects are overwritten. - * - * @param {any} p - * @return {boolean} - */ - const isPromise = p => p instanceof Promise || (p && p.then && p.catch && p.finally); - - /* eslint-env browser */ - - const measure = performance.measure.bind(performance); - const now = performance.now.bind(performance); - const mark = performance.mark.bind(performance); - - /** - * Testing framework with support for generating tests. - * - * ```js - * // test.js template for creating a test executable - * import { runTests } from 'lib0/testing' - * import * as log from 'lib0/logging' - * import * as mod1 from './mod1.test.js' - * import * as mod2 from './mod2.test.js' - - * import { isBrowser, isNode } from 'lib0/environment.js' - * - * if (isBrowser) { - * // optional: if this is ran in the browser, attach a virtual console to the dom - * log.createVConsole(document.body) - * } - * - * runTests({ - * mod1, - * mod2, - * }).then(success => { - * if (isNode) { - * process.exit(success ? 0 : 1) - * } - * }) - * ``` - * - * ```js - * // mod1.test.js - * /** - * * runTests automatically tests all exported functions that start with "test". - * * The name of the function should be in camelCase and is used for the logging output. - * * - * * @param {t.TestCase} tc - * *\/ - * export const testMyFirstTest = tc => { - * t.compare({ a: 4 }, { a: 4 }, 'objects are equal') - * } - * ``` - * - * Now you can simply run `node test.js` to run your test or run test.js in the browser. - * - * @module testing - */ - - - hasConf('extensive'); - - /* c8 ignore next */ - const envSeed = hasParam('--seed') ? Number.parseInt(getParam('--seed', '0')) : null; - - class TestCase { - /** - * @param {string} moduleName - * @param {string} testName - */ - constructor (moduleName, testName) { - /** - * @type {string} - */ - this.moduleName = moduleName; - /** - * @type {string} - */ - this.testName = testName; - /** - * This type can store custom information related to the TestCase - * - * @type {Map} - */ - this.meta = new Map(); - this._seed = null; - this._prng = null; - } - - resetSeed () { - this._seed = null; - this._prng = null; - } - - /** - * @type {number} - */ - /* c8 ignore next */ - get seed () { - /* c8 ignore else */ - if (this._seed === null) { - /* c8 ignore next */ - this._seed = envSeed === null ? uint32() : envSeed; - } - return this._seed - } - - /** - * A PRNG for this test case. Use only this PRNG for randomness to make the test case reproducible. - * - * @type {prng.PRNG} - */ - get prng () { - /* c8 ignore else */ - if (this._prng === null) { - this._prng = create$1(this.seed); - } - return this._prng - } - } - - const repetitionTime = Number(getParam('--repetition-time', '50')); - /* c8 ignore next */ - const testFilter = hasParam('--filter') ? getParam('--filter', '') : null; - - /* c8 ignore next */ - const testFilterRegExp = testFilter !== null ? new RegExp(testFilter) : /.*/; - - const repeatTestRegex = /^(repeat|repeating)\s/; - - /** - * @param {string} moduleName - * @param {string} name - * @param {function(TestCase):void|Promise} f - * @param {number} i - * @param {number} numberOfTests - */ - const run = async (moduleName, name, f, i, numberOfTests) => { - const uncamelized = fromCamelCase(name.slice(4), ' '); - const filtered = !testFilterRegExp.test(`[${i + 1}/${numberOfTests}] ${moduleName}: ${uncamelized}`); - /* c8 ignore next 3 */ - if (filtered) { - return true - } - const tc = new TestCase(moduleName, name); - const repeat = repeatTestRegex.test(uncamelized); - const groupArgs = [GREY, `[${i + 1}/${numberOfTests}] `, PURPLE, `${moduleName}: `, BLUE, uncamelized]; - /* c8 ignore next 5 */ - if (testFilter === null) { - groupCollapsed(...groupArgs); - } else { - group(...groupArgs); - } - const times = []; - const start = now(); - let lastTime = start; - /** - * @type {any} - */ - let err = null; - mark(`${name}-start`); - do { - try { - const p = f(tc); - if (isPromise(p)) { - await p; - } - } catch (_err) { - err = _err; - } - const currTime = now(); - times.push(currTime - lastTime); - lastTime = currTime; - if (repeat && err === null && (lastTime - start) < repetitionTime) { - tc.resetSeed(); - } else { - break - } - } while (err === null && (lastTime - start) < repetitionTime) - mark(`${name}-end`); - /* c8 ignore next 3 */ - if (err !== null && err.constructor !== SkipError) { - printError(err); - } - measure(name, `${name}-start`, `${name}-end`); - groupEnd(); - const duration = lastTime - start; - let success = true; - times.sort((a, b) => a - b); - /* c8 ignore next 3 */ - const againMessage = isBrowser - ? ` - ${window.location.host + window.location.pathname}?filter=\\[${i + 1}/${tc._seed === null ? '' : `&seed=${tc._seed}`}` - : `\nrepeat: npm run test -- --filter "\\[${i + 1}/" ${tc._seed === null ? '' : `--seed ${tc._seed}`}`; - const timeInfo = (repeat && err === null) - ? ` - ${times.length} repetitions in ${humanizeDuration(duration)} (best: ${humanizeDuration(times[0])}, worst: ${humanizeDuration(last(times))}, median: ${humanizeDuration(median(times))}, average: ${humanizeDuration(average(times))})` - : ` in ${humanizeDuration(duration)}`; - if (err !== null) { - /* c8 ignore start */ - if (err.constructor === SkipError) { - print(GREY, BOLD, 'Skipped: ', UNBOLD, uncamelized); - } else { - success = false; - print(RED, BOLD, 'Failure: ', UNBOLD, UNCOLOR, uncamelized, GREY, timeInfo, againMessage); - } - /* c8 ignore stop */ - } else { - print(GREEN, BOLD, 'Success: ', UNBOLD, UNCOLOR, uncamelized, GREY, timeInfo, againMessage); - } - return success - }; - - /** - * @param {any} _constructor - * @param {any} a - * @param {any} b - * @param {string} path - * @throws {TestError} - */ - const compareValues = (_constructor, a, b, path) => { - if (a !== b) { - fail(`Values ${stringify(a)} and ${stringify(b)} don't match (${path})`); - } - return true - }; - - /** - * @param {string?} message - * @param {string} reason - * @param {string} path - * @throws {TestError} - */ - const _failMessage = (message, reason, path) => fail( - message === null - ? `${reason} ${path}` - : `${message} (${reason}) ${path}` - ); - - /** - * @param {any} a - * @param {any} b - * @param {string} path - * @param {string?} message - * @param {function(any,any,any,string,any):boolean} customCompare - */ - const _compare = (a, b, path, message, customCompare) => { - // we don't use assert here because we want to test all branches (istanbul errors if one branch is not tested) - if (a == null || b == null) { - return compareValues(null, a, b, path) - } - if (a.constructor !== b.constructor) { - _failMessage(message, 'Constructors don\'t match', path); - } - let success = true; - switch (a.constructor) { - case ArrayBuffer: - a = new Uint8Array(a); - b = new Uint8Array(b); - // eslint-disable-next-line no-fallthrough - case Uint8Array: { - if (a.byteLength !== b.byteLength) { - _failMessage(message, 'ArrayBuffer lengths match', path); - } - for (let i = 0; success && i < a.length; i++) { - success = success && a[i] === b[i]; - } - break - } - case Set: { - if (a.size !== b.size) { - _failMessage(message, 'Sets have different number of attributes', path); - } - // @ts-ignore - a.forEach(value => { - if (!b.has(value)) { - _failMessage(message, `b.${path} does have ${value}`, path); - } - }); - break - } - case Map: { - if (a.size !== b.size) { - _failMessage(message, 'Maps have different number of attributes', path); - } - // @ts-ignore - a.forEach((value, key) => { - if (!b.has(key)) { - _failMessage(message, `Property ${path}["${key}"] does not exist on second argument`, path); - } - _compare(value, b.get(key), `${path}["${key}"]`, message, customCompare); - }); - break - } - case Object: - if (length$1(a) !== length$1(b)) { - _failMessage(message, 'Objects have a different number of attributes', path); - } - forEach$1(a, (value, key) => { - if (!hasProperty(b, key)) { - _failMessage(message, `Property ${path} does not exist on second argument`, path); - } - _compare(value, b[key], `${path}["${key}"]`, message, customCompare); - }); - break - case Array: - if (a.length !== b.length) { - _failMessage(message, 'Arrays have a different number of attributes', path); - } - // @ts-ignore - a.forEach((value, i) => _compare(value, b[i], `${path}[${i}]`, message, customCompare)); - break - /* c8 ignore next 4 */ - default: - if (!customCompare(a.constructor, a, b, path, compareValues)) { - _failMessage(message, `Values ${stringify(a)} and ${stringify(b)} don't match`, path); - } - } - assert(success, message); - return true - }; - - /** - * @template T - * @param {T} a - * @param {T} b - * @param {string?} [message] - * @param {function(any,T,T,string,any):boolean} [customCompare] - */ - const compare = (a, b, message = null, customCompare = compareValues) => _compare(a, b, 'obj', message, customCompare); - - /** - * @template T - * @param {T} property - * @param {string?} [message] - * @return {asserts property is NonNullable} - * @throws {TestError} - */ - /* c8 ignore next */ - const assert = (property, message = null) => { property || fail(`Assertion failed${message !== null ? `: ${message}` : ''}`); }; - - /** - * @param {Object>>} tests - */ - const runTests = async tests => { - /** - * @param {string} testname - */ - const filterTest = testname => testname.startsWith('test') || testname.startsWith('benchmark'); - const numberOfTests = map(tests, mod => map(mod, (f, fname) => /* c8 ignore next */ f && filterTest(fname) ? 1 : 0).reduce(add, 0)).reduce(add, 0); - let successfulTests = 0; - let testnumber = 0; - const start = now(); - for (const modName in tests) { - const mod = tests[modName]; - for (const fname in mod) { - const f = mod[fname]; - /* c8 ignore else */ - if (f && filterTest(fname)) { - const repeatEachTest = 1; - let success = true; - for (let i = 0; success && i < repeatEachTest; i++) { - success = await run(modName, fname, f, testnumber, numberOfTests); - } - testnumber++; - /* c8 ignore else */ - if (success) { - successfulTests++; - } - } - } - } - const end = now(); - print(''); - const success = successfulTests === numberOfTests; - /* c8 ignore start */ - if (success) { - print(GREEN, BOLD, 'All tests successful!', GREY, UNBOLD, ` in ${humanizeDuration(end - start)}`); - printImgBase64(nyanCatImage, 50); - } else { - const failedTests = numberOfTests - successfulTests; - print(RED, BOLD, `> ${failedTests} test${failedTests > 1 ? 's' : ''} failed`); - } - /* c8 ignore stop */ - return success - }; - - class TestError extends Error {} - - /** - * @param {string} reason - * @throws {TestError} - */ - const fail = reason => { - print(RED, BOLD, 'X ', UNBOLD, reason); - throw new TestError('Test Failed') - }; - - class SkipError extends Error {} - - // eslint-disable-next-line - const nyanCatImage = 'R0lGODlhjABMAPcAAMiSE0xMTEzMzUKJzjQ0NFsoKPc7//FM/9mH/z9x0HIiIoKCgmBHN+frGSkZLdDQ0LCwsDk71g0KCUzDdrQQEOFz/8yYdelmBdTiHFxcXDU2erR/mLrTHCgoKK5szBQUFNgSCTk6ymfpCB9VZS2Bl+cGBt2N8kWm0uDcGXhZR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5GtRMPnnll1eiOTjUXK7G5+CInrnmoXf+eeqWf8655adPzroanqN+eeyUm7665TNMsQlnUCgh/PDCu1JFD/6ZqPzyvhJgEOxHRH8EGaITIf0R7oh+/RGiV3I99ZdbL332l2/f/fVEVH/962qYf7k76ItOxhEzuABkBhbkr//++aeQyf0ADKDzDBKGArbhgG3wQwEL6AcEtmGBBnQgBMPgQAUusIEInKADHwjBCkIQgwfUoAQ7iEALMtAPa5iEfbTQIT0YgTxGKJAMvfSFDhDoHgT4AgE6hBA/+GEQ2AgiNvy84EMfekGI2BhEEf1QAyQuEYhCJGIRjyhEJRaxiUJ8IhKlaEQkWtGHWAyiFqO4RC/UIIUl2s4H9PAlw+lrBPHQQ4UCtDU7vJEgbsijHvfIxz768Y+ADKQgB0lIQGJjDdvZjkBstJ3EHCSRRLLRHQnCiEoSJAKVrOQcCCKGTDIiApTMpBgIMgdPbnIgncxkQTw5yoGUMpOnFEgqLRnKSrZSIK/U5Ag+kLjEDaSXCQGmQHzJpWIasyV3OaYyl8nMZi7nLsl0ZkagKc1qWvOa2JxLNLPJzW6+ZZvevAhdwrkStJCTI2gZ5zknos51shOc7oynPOdJz3ra857hDAgAOw=='; - - /** - * Observable class prototype. - * - * @module observable - */ - - - /* c8 ignore start */ - /** - * Handles named events. - * - * @deprecated - * @template N - */ - class Observable { - constructor () { - /** - * Some desc. - * @type {Map} - */ - this._observers = create$6(); - } - - /** - * @param {N} name - * @param {function} f - */ - on (name, f) { - setIfUndefined(this._observers, name, create$5).add(f); - } - - /** - * @param {N} name - * @param {function} f - */ - once (name, f) { - /** - * @param {...any} args - */ - const _f = (...args) => { - this.off(name, _f); - f(...args); - }; - this.on(name, _f); - } - - /** - * @param {N} name - * @param {function} f - */ - off (name, f) { - const observers = this._observers.get(name); - if (observers !== undefined) { - observers.delete(f); - if (observers.size === 0) { - this._observers.delete(name); - } - } - } - - /** - * Emit a named event. All registered event listeners that listen to the - * specified name will receive the event. - * - * @todo This should catch exceptions - * - * @param {N} name The event name. - * @param {Array} args The arguments that are applied to the event listener. - */ - emit (name, args) { - // copy all listeners to an array first to make sure that no event is emitted to listeners that are subscribed while the event handler is called. - return from((this._observers.get(name) || create$6()).values()).forEach(f => f(...args)) - } - - destroy () { - this._observers = create$6(); - } - } - /* c8 ignore end */ - - /** - * Utility module to create and manipulate Iterators. - * - * @module iterator - */ - - - /** - * @template T - * @param {function():IteratorResult} next - * @return {IterableIterator} - */ - const createIterator = next => ({ - /** - * @return {IterableIterator} - */ - [Symbol.iterator] () { - return this - }, - // @ts-ignore - next - }); - - /** - * @template T - * @param {Iterator} iterator - * @param {function(T):boolean} filter - */ - const iteratorFilter = (iterator, filter) => createIterator(() => { - let res; - do { - res = iterator.next(); - } while (!res.done && !filter(res.value)) - return res - }); - - /** - * @template T,M - * @param {Iterator} iterator - * @param {function(T):M} fmap - */ - const iteratorMap = (iterator, fmap) => createIterator(() => { - const { done, value } = iterator.next(); - return { done, value: done ? undefined : fmap(value) } - }); - - class DeleteItem { - /** - * @param {number} clock - * @param {number} len - */ - constructor (clock, len) { - /** - * @type {number} - */ - this.clock = clock; - /** - * @type {number} - */ - this.len = len; - } - } - - /** - * We no longer maintain a DeleteStore. DeleteSet is a temporary object that is created when needed. - * - When created in a transaction, it must only be accessed after sorting, and merging - * - This DeleteSet is send to other clients - * - We do not create a DeleteSet when we send a sync message. The DeleteSet message is created directly from StructStore - * - We read a DeleteSet as part of a sync/update message. In this case the DeleteSet is already sorted and merged. - */ - class DeleteSet { - constructor () { - /** - * @type {Map>} - */ - this.clients = new Map(); - } - } - - /** - * Iterate over all structs that the DeleteSet gc's. - * - * @param {Transaction} transaction - * @param {DeleteSet} ds - * @param {function(GC|Item):void} f - * - * @function - */ - const iterateDeletedStructs = (transaction, ds, f) => - ds.clients.forEach((deletes, clientid) => { - const structs = /** @type {Array} */ (transaction.doc.store.clients.get(clientid)); - for (let i = 0; i < deletes.length; i++) { - const del = deletes[i]; - iterateStructs(transaction, structs, del.clock, del.len, f); - } - }); - - /** - * @param {Array} dis - * @param {number} clock - * @return {number|null} - * - * @private - * @function - */ - const findIndexDS = (dis, clock) => { - let left = 0; - let right = dis.length - 1; - while (left <= right) { - const midindex = floor((left + right) / 2); - const mid = dis[midindex]; - const midclock = mid.clock; - if (midclock <= clock) { - if (clock < midclock + mid.len) { - return midindex - } - left = midindex + 1; - } else { - right = midindex - 1; - } - } - return null - }; - - /** - * @param {DeleteSet} ds - * @param {ID} id - * @return {boolean} - * - * @private - * @function - */ - const isDeleted = (ds, id) => { - const dis = ds.clients.get(id.client); - return dis !== undefined && findIndexDS(dis, id.clock) !== null - }; - - /** - * @param {DeleteSet} ds - * - * @private - * @function - */ - const sortAndMergeDeleteSet = ds => { - ds.clients.forEach(dels => { - dels.sort((a, b) => a.clock - b.clock); - // merge items without filtering or splicing the array - // i is the current pointer - // j refers to the current insert position for the pointed item - // try to merge dels[i] into dels[j-1] or set dels[j]=dels[i] - let i, j; - for (i = 1, j = 1; i < dels.length; i++) { - const left = dels[j - 1]; - const right = dels[i]; - if (left.clock + left.len >= right.clock) { - left.len = max(left.len, right.clock + right.len - left.clock); - } else { - if (j < i) { - dels[j] = right; - } - j++; - } - } - dels.length = j; - }); - }; - - /** - * @param {DeleteSet} ds - * @param {number} client - * @param {number} clock - * @param {number} length - * - * @private - * @function - */ - const addToDeleteSet = (ds, client, clock, length) => { - setIfUndefined(ds.clients, client, () => /** @type {Array} */ ([])).push(new DeleteItem(clock, length)); - }; - - /** - * @param {DSEncoderV1 | DSEncoderV2} encoder - * @param {DeleteSet} ds - * - * @private - * @function - */ - const writeDeleteSet = (encoder, ds) => { - writeVarUint(encoder.restEncoder, ds.clients.size); - - // Ensure that the delete set is written in a deterministic order - from(ds.clients.entries()) - .sort((a, b) => b[0] - a[0]) - .forEach(([client, dsitems]) => { - encoder.resetDsCurVal(); - writeVarUint(encoder.restEncoder, client); - const len = dsitems.length; - writeVarUint(encoder.restEncoder, len); - for (let i = 0; i < len; i++) { - const item = dsitems[i]; - encoder.writeDsClock(item.clock); - encoder.writeDsLen(item.len); - } - }); - }; - - /** - * @module Y - */ - - const generateNewClientId = uint32; - - /** - * @typedef {Object} DocOpts - * @property {boolean} [DocOpts.gc=true] Disable garbage collection (default: gc=true) - * @property {function(Item):boolean} [DocOpts.gcFilter] Will be called before an Item is garbage collected. Return false to keep the Item. - * @property {string} [DocOpts.guid] Define a globally unique identifier for this document - * @property {string | null} [DocOpts.collectionid] Associate this document with a collection. This only plays a role if your provider has a concept of collection. - * @property {any} [DocOpts.meta] Any kind of meta information you want to associate with this document. If this is a subdocument, remote peers will store the meta information as well. - * @property {boolean} [DocOpts.autoLoad] If a subdocument, automatically load document. If this is a subdocument, remote peers will load the document as well automatically. - * @property {boolean} [DocOpts.shouldLoad] Whether the document should be synced by the provider now. This is toggled to true when you call ydoc.load() - */ - - /** - * A Yjs instance handles the state of shared data. - * @extends Observable - */ - class Doc extends Observable { - /** - * @param {DocOpts} opts configuration - */ - constructor ({ guid = uuidv4(), collectionid = null, gc = true, gcFilter = () => true, meta = null, autoLoad = false, shouldLoad = true } = {}) { - super(); - this.gc = gc; - this.gcFilter = gcFilter; - this.clientID = generateNewClientId(); - this.guid = guid; - this.collectionid = collectionid; - /** - * @type {Map>>} - */ - this.share = new Map(); - this.store = new StructStore(); - /** - * @type {Transaction | null} - */ - this._transaction = null; - /** - * @type {Array} - */ - this._transactionCleanups = []; - /** - * @type {Set} - */ - this.subdocs = new Set(); - /** - * If this document is a subdocument - a document integrated into another document - then _item is defined. - * @type {Item?} - */ - this._item = null; - this.shouldLoad = shouldLoad; - this.autoLoad = autoLoad; - this.meta = meta; - /** - * This is set to true when the persistence provider loaded the document from the database or when the `sync` event fires. - * Note that not all providers implement this feature. Provider authors are encouraged to fire the `load` event when the doc content is loaded from the database. - * - * @type {boolean} - */ - this.isLoaded = false; - /** - * This is set to true when the connection provider has successfully synced with a backend. - * Note that when using peer-to-peer providers this event may not provide very useful. - * Also note that not all providers implement this feature. Provider authors are encouraged to fire - * the `sync` event when the doc has been synced (with `true` as a parameter) or if connection is - * lost (with false as a parameter). - */ - this.isSynced = false; - /** - * Promise that resolves once the document has been loaded from a presistence provider. - */ - this.whenLoaded = create(resolve => { - this.on('load', () => { - this.isLoaded = true; - resolve(this); - }); - }); - const provideSyncedPromise = () => create(resolve => { - /** - * @param {boolean} isSynced - */ - const eventHandler = (isSynced) => { - if (isSynced === undefined || isSynced === true) { - this.off('sync', eventHandler); - resolve(); - } - }; - this.on('sync', eventHandler); - }); - this.on('sync', isSynced => { - if (isSynced === false && this.isSynced) { - this.whenSynced = provideSyncedPromise(); - } - this.isSynced = isSynced === undefined || isSynced === true; - if (!this.isLoaded) { - this.emit('load', []); - } - }); - /** - * Promise that resolves once the document has been synced with a backend. - * This promise is recreated when the connection is lost. - * Note the documentation about the `isSynced` property. - */ - this.whenSynced = provideSyncedPromise(); - } - - /** - * Notify the parent document that you request to load data into this subdocument (if it is a subdocument). - * - * `load()` might be used in the future to request any provider to load the most current data. - * - * It is safe to call `load()` multiple times. - */ - load () { - const item = this._item; - if (item !== null && !this.shouldLoad) { - transact(/** @type {any} */ (item.parent).doc, transaction => { - transaction.subdocsLoaded.add(this); - }, null, true); - } - this.shouldLoad = true; - } - - getSubdocs () { - return this.subdocs - } - - getSubdocGuids () { - return new Set(from(this.subdocs).map(doc => doc.guid)) - } - - /** - * Changes that happen inside of a transaction are bundled. This means that - * the observer fires _after_ the transaction is finished and that all changes - * that happened inside of the transaction are sent as one message to the - * other peers. - * - * @template T - * @param {function(Transaction):T} f The function that should be executed as a transaction - * @param {any} [origin] Origin of who started the transaction. Will be stored on transaction.origin - * @return T - * - * @public - */ - transact (f, origin = null) { - return transact(this, f, origin) - } - - /** - * Define a shared data type. - * - * Multiple calls of `y.get(name, TypeConstructor)` yield the same result - * and do not overwrite each other. I.e. - * `y.define(name, Y.Array) === y.define(name, Y.Array)` - * - * After this method is called, the type is also available on `y.share.get(name)`. - * - * *Best Practices:* - * Define all types right after the Yjs instance is created and store them in a separate object. - * Also use the typed methods `getText(name)`, `getArray(name)`, .. - * - * @example - * const y = new Y(..) - * const appState = { - * document: y.getText('document') - * comments: y.getArray('comments') - * } - * - * @param {string} name - * @param {Function} TypeConstructor The constructor of the type definition. E.g. Y.Text, Y.Array, Y.Map, ... - * @return {AbstractType} The created type. Constructed with TypeConstructor - * - * @public - */ - get (name, TypeConstructor = AbstractType) { - const type = setIfUndefined(this.share, name, () => { - // @ts-ignore - const t = new TypeConstructor(); - t._integrate(this, null); - return t - }); - const Constr = type.constructor; - if (TypeConstructor !== AbstractType && Constr !== TypeConstructor) { - if (Constr === AbstractType) { - // @ts-ignore - const t = new TypeConstructor(); - t._map = type._map; - type._map.forEach(/** @param {Item?} n */ n => { - for (; n !== null; n = n.left) { - // @ts-ignore - n.parent = t; - } - }); - t._start = type._start; - for (let n = t._start; n !== null; n = n.right) { - n.parent = t; - } - t._length = type._length; - this.share.set(name, t); - t._integrate(this, null); - return t - } else { - throw new Error(`Type with the name ${name} has already been defined with a different constructor`) - } - } - return type - } - - /** - * @template T - * @param {string} [name] - * @return {YArray} - * - * @public - */ - getArray (name = '') { - // @ts-ignore - return this.get(name, YArray) - } - - /** - * @param {string} [name] - * @return {YText} - * - * @public - */ - getText (name = '') { - // @ts-ignore - return this.get(name, YText) - } - - /** - * @template T - * @param {string} [name] - * @return {YMap} - * - * @public - */ - getMap (name = '') { - // @ts-ignore - return this.get(name, YMap) - } - - /** - * @param {string} [name] - * @return {YXmlFragment} - * - * @public - */ - getXmlFragment (name = '') { - // @ts-ignore - return this.get(name, YXmlFragment) - } - - /** - * Converts the entire document into a js object, recursively traversing each yjs type - * Doesn't log types that have not been defined (using ydoc.getType(..)). - * - * @deprecated Do not use this method and rather call toJSON directly on the shared types. - * - * @return {Object} - */ - toJSON () { - /** - * @type {Object} - */ - const doc = {}; - - this.share.forEach((value, key) => { - doc[key] = value.toJSON(); - }); - - return doc - } - - /** - * Emit `destroy` event and unregister all event handlers. - */ - destroy () { - from(this.subdocs).forEach(subdoc => subdoc.destroy()); - const item = this._item; - if (item !== null) { - this._item = null; - const content = /** @type {ContentDoc} */ (item.content); - content.doc = new Doc({ guid: this.guid, ...content.opts, shouldLoad: false }); - content.doc._item = item; - transact(/** @type {any} */ (item).parent.doc, transaction => { - const doc = content.doc; - if (!item.deleted) { - transaction.subdocsAdded.add(doc); - } - transaction.subdocsRemoved.add(this); - }, null, true); - } - this.emit('destroyed', [true]); - this.emit('destroy', [this]); - super.destroy(); - } - - /** - * @param {string} eventName - * @param {function(...any):any} f - */ - on (eventName, f) { - super.on(eventName, f); - } - - /** - * @param {string} eventName - * @param {function} f - */ - off (eventName, f) { - super.off(eventName, f); - } - } - - class DSEncoderV1 { - constructor () { - this.restEncoder = createEncoder(); - } - - toUint8Array () { - return toUint8Array(this.restEncoder) - } - - resetDsCurVal () { - // nop - } - - /** - * @param {number} clock - */ - writeDsClock (clock) { - writeVarUint(this.restEncoder, clock); - } - - /** - * @param {number} len - */ - writeDsLen (len) { - writeVarUint(this.restEncoder, len); - } - } - - class UpdateEncoderV1 extends DSEncoderV1 { - /** - * @param {ID} id - */ - writeLeftID (id) { - writeVarUint(this.restEncoder, id.client); - writeVarUint(this.restEncoder, id.clock); - } - - /** - * @param {ID} id - */ - writeRightID (id) { - writeVarUint(this.restEncoder, id.client); - writeVarUint(this.restEncoder, id.clock); - } - - /** - * Use writeClient and writeClock instead of writeID if possible. - * @param {number} client - */ - writeClient (client) { - writeVarUint(this.restEncoder, client); - } - - /** - * @param {number} info An unsigned 8-bit integer - */ - writeInfo (info) { - writeUint8(this.restEncoder, info); - } - - /** - * @param {string} s - */ - writeString (s) { - writeVarString(this.restEncoder, s); - } - - /** - * @param {boolean} isYKey - */ - writeParentInfo (isYKey) { - writeVarUint(this.restEncoder, isYKey ? 1 : 0); - } - - /** - * @param {number} info An unsigned 8-bit integer - */ - writeTypeRef (info) { - writeVarUint(this.restEncoder, info); - } - - /** - * Write len of a struct - well suited for Opt RLE encoder. - * - * @param {number} len - */ - writeLen (len) { - writeVarUint(this.restEncoder, len); - } - - /** - * @param {any} any - */ - writeAny (any) { - writeAny(this.restEncoder, any); - } - - /** - * @param {Uint8Array} buf - */ - writeBuf (buf) { - writeVarUint8Array(this.restEncoder, buf); - } - - /** - * @param {any} embed - */ - writeJSON (embed) { - writeVarString(this.restEncoder, JSON.stringify(embed)); - } - - /** - * @param {string} key - */ - writeKey (key) { - writeVarString(this.restEncoder, key); - } - } - - class DSEncoderV2 { - constructor () { - this.restEncoder = createEncoder(); // encodes all the rest / non-optimized - this.dsCurrVal = 0; - } - - toUint8Array () { - return toUint8Array(this.restEncoder) - } - - resetDsCurVal () { - this.dsCurrVal = 0; - } - - /** - * @param {number} clock - */ - writeDsClock (clock) { - const diff = clock - this.dsCurrVal; - this.dsCurrVal = clock; - writeVarUint(this.restEncoder, diff); - } - - /** - * @param {number} len - */ - writeDsLen (len) { - if (len === 0) { - unexpectedCase(); - } - writeVarUint(this.restEncoder, len - 1); - this.dsCurrVal += len; - } - } - - class UpdateEncoderV2 extends DSEncoderV2 { - constructor () { - super(); - /** - * @type {Map} - */ - this.keyMap = new Map(); - /** - * Refers to the next uniqe key-identifier to me used. - * See writeKey method for more information. - * - * @type {number} - */ - this.keyClock = 0; - this.keyClockEncoder = new IntDiffOptRleEncoder(); - this.clientEncoder = new UintOptRleEncoder(); - this.leftClockEncoder = new IntDiffOptRleEncoder(); - this.rightClockEncoder = new IntDiffOptRleEncoder(); - this.infoEncoder = new RleEncoder(writeUint8); - this.stringEncoder = new StringEncoder(); - this.parentInfoEncoder = new RleEncoder(writeUint8); - this.typeRefEncoder = new UintOptRleEncoder(); - this.lenEncoder = new UintOptRleEncoder(); - } - - toUint8Array () { - const encoder = createEncoder(); - writeVarUint(encoder, 0); // this is a feature flag that we might use in the future - writeVarUint8Array(encoder, this.keyClockEncoder.toUint8Array()); - writeVarUint8Array(encoder, this.clientEncoder.toUint8Array()); - writeVarUint8Array(encoder, this.leftClockEncoder.toUint8Array()); - writeVarUint8Array(encoder, this.rightClockEncoder.toUint8Array()); - writeVarUint8Array(encoder, toUint8Array(this.infoEncoder)); - writeVarUint8Array(encoder, this.stringEncoder.toUint8Array()); - writeVarUint8Array(encoder, toUint8Array(this.parentInfoEncoder)); - writeVarUint8Array(encoder, this.typeRefEncoder.toUint8Array()); - writeVarUint8Array(encoder, this.lenEncoder.toUint8Array()); - // @note The rest encoder is appended! (note the missing var) - writeUint8Array(encoder, toUint8Array(this.restEncoder)); - return toUint8Array(encoder) - } - - /** - * @param {ID} id - */ - writeLeftID (id) { - this.clientEncoder.write(id.client); - this.leftClockEncoder.write(id.clock); - } - - /** - * @param {ID} id - */ - writeRightID (id) { - this.clientEncoder.write(id.client); - this.rightClockEncoder.write(id.clock); - } - - /** - * @param {number} client - */ - writeClient (client) { - this.clientEncoder.write(client); - } - - /** - * @param {number} info An unsigned 8-bit integer - */ - writeInfo (info) { - this.infoEncoder.write(info); - } - - /** - * @param {string} s - */ - writeString (s) { - this.stringEncoder.write(s); - } - - /** - * @param {boolean} isYKey - */ - writeParentInfo (isYKey) { - this.parentInfoEncoder.write(isYKey ? 1 : 0); - } - - /** - * @param {number} info An unsigned 8-bit integer - */ - writeTypeRef (info) { - this.typeRefEncoder.write(info); - } - - /** - * Write len of a struct - well suited for Opt RLE encoder. - * - * @param {number} len - */ - writeLen (len) { - this.lenEncoder.write(len); - } - - /** - * @param {any} any - */ - writeAny (any) { - writeAny(this.restEncoder, any); - } - - /** - * @param {Uint8Array} buf - */ - writeBuf (buf) { - writeVarUint8Array(this.restEncoder, buf); - } - - /** - * This is mainly here for legacy purposes. - * - * Initial we incoded objects using JSON. Now we use the much faster lib0/any-encoder. This method mainly exists for legacy purposes for the v1 encoder. - * - * @param {any} embed - */ - writeJSON (embed) { - writeAny(this.restEncoder, embed); - } - - /** - * Property keys are often reused. For example, in y-prosemirror the key `bold` might - * occur very often. For a 3d application, the key `position` might occur very often. - * - * We cache these keys in a Map and refer to them via a unique number. - * - * @param {string} key - */ - writeKey (key) { - const clock = this.keyMap.get(key); - if (clock === undefined) { - /** - * @todo uncomment to introduce this feature finally - * - * Background. The ContentFormat object was always encoded using writeKey, but the decoder used to use readString. - * Furthermore, I forgot to set the keyclock. So everything was working fine. - * - * However, this feature here is basically useless as it is not being used (it actually only consumes extra memory). - * - * I don't know yet how to reintroduce this feature.. - * - * Older clients won't be able to read updates when we reintroduce this feature. So this should probably be done using a flag. - * - */ - // this.keyMap.set(key, this.keyClock) - this.keyClockEncoder.write(this.keyClock++); - this.stringEncoder.write(key); - } else { - this.keyClockEncoder.write(clock); - } - } - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {Array} structs All structs by `client` - * @param {number} client - * @param {number} clock write structs starting with `ID(client,clock)` - * - * @function - */ - const writeStructs = (encoder, structs, client, clock) => { - // write first id - clock = max(clock, structs[0].id.clock); // make sure the first id exists - const startNewStructs = findIndexSS(structs, clock); - // write # encoded structs - writeVarUint(encoder.restEncoder, structs.length - startNewStructs); - encoder.writeClient(client); - writeVarUint(encoder.restEncoder, clock); - const firstStruct = structs[startNewStructs]; - // write first struct with an offset - firstStruct.write(encoder, clock - firstStruct.id.clock); - for (let i = startNewStructs + 1; i < structs.length; i++) { - structs[i].write(encoder, 0); - } - }; - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {StructStore} store - * @param {Map} _sm - * - * @private - * @function - */ - const writeClientsStructs = (encoder, store, _sm) => { - // we filter all valid _sm entries into sm - const sm = new Map(); - _sm.forEach((clock, client) => { - // only write if new structs are available - if (getState(store, client) > clock) { - sm.set(client, clock); - } - }); - getStateVector(store).forEach((_clock, client) => { - if (!_sm.has(client)) { - sm.set(client, 0); - } - }); - // write # states that were updated - writeVarUint(encoder.restEncoder, sm.size); - // Write items with higher client ids first - // This heavily improves the conflict algorithm. - from(sm.entries()).sort((a, b) => b[0] - a[0]).forEach(([client, clock]) => { - writeStructs(encoder, /** @type {Array} */ (store.clients.get(client)), client, clock); - }); - }; - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {Transaction} transaction - * - * @private - * @function - */ - const writeStructsFromTransaction = (encoder, transaction) => writeClientsStructs(encoder, transaction.doc.store, transaction.beforeState); - - /** - * General event handler implementation. - * - * @template ARG0, ARG1 - * - * @private - */ - class EventHandler { - constructor () { - /** - * @type {Array} - */ - this.l = []; - } - } - - /** - * @template ARG0,ARG1 - * @returns {EventHandler} - * - * @private - * @function - */ - const createEventHandler = () => new EventHandler(); - - /** - * Adds an event listener that is called when - * {@link EventHandler#callEventListeners} is called. - * - * @template ARG0,ARG1 - * @param {EventHandler} eventHandler - * @param {function(ARG0,ARG1):void} f The event handler. - * - * @private - * @function - */ - const addEventHandlerListener = (eventHandler, f) => - eventHandler.l.push(f); - - /** - * Removes an event listener. - * - * @template ARG0,ARG1 - * @param {EventHandler} eventHandler - * @param {function(ARG0,ARG1):void} f The event handler that was added with - * {@link EventHandler#addEventListener} - * - * @private - * @function - */ - const removeEventHandlerListener = (eventHandler, f) => { - const l = eventHandler.l; - const len = l.length; - eventHandler.l = l.filter(g => f !== g); - if (len === eventHandler.l.length) { - console.error('[yjs] Tried to remove event handler that doesn\'t exist.'); - } - }; - - /** - * Call all event listeners that were added via - * {@link EventHandler#addEventListener}. - * - * @template ARG0,ARG1 - * @param {EventHandler} eventHandler - * @param {ARG0} arg0 - * @param {ARG1} arg1 - * - * @private - * @function - */ - const callEventHandlerListeners = (eventHandler, arg0, arg1) => - callAll(eventHandler.l, [arg0, arg1]); - - class ID { - /** - * @param {number} client client id - * @param {number} clock unique per client id, continuous number - */ - constructor (client, clock) { - /** - * Client id - * @type {number} - */ - this.client = client; - /** - * unique per client id, continuous number - * @type {number} - */ - this.clock = clock; - } - } - - /** - * @param {ID | null} a - * @param {ID | null} b - * @return {boolean} - * - * @function - */ - const compareIDs = (a, b) => a === b || (a !== null && b !== null && a.client === b.client && a.clock === b.clock); - - /** - * @param {number} client - * @param {number} clock - * - * @private - * @function - */ - const createID = (client, clock) => new ID(client, clock); - - /** - * The top types are mapped from y.share.get(keyname) => type. - * `type` does not store any information about the `keyname`. - * This function finds the correct `keyname` for `type` and throws otherwise. - * - * @param {AbstractType} type - * @return {string} - * - * @private - * @function - */ - const findRootTypeKey = type => { - // @ts-ignore _y must be defined, otherwise unexpected case - for (const [key, value] of type.doc.share.entries()) { - if (value === type) { - return key - } - } - throw unexpectedCase() - }; - - /** - * @param {Item} item - * @param {Snapshot|undefined} snapshot - * - * @protected - * @function - */ - const isVisible = (item, snapshot) => snapshot === undefined - ? !item.deleted - : snapshot.sv.has(item.id.client) && (snapshot.sv.get(item.id.client) || 0) > item.id.clock && !isDeleted(snapshot.ds, item.id); - - /** - * @param {Transaction} transaction - * @param {Snapshot} snapshot - */ - const splitSnapshotAffectedStructs = (transaction, snapshot) => { - const meta = setIfUndefined(transaction.meta, splitSnapshotAffectedStructs, create$5); - const store = transaction.doc.store; - // check if we already split for this snapshot - if (!meta.has(snapshot)) { - snapshot.sv.forEach((clock, client) => { - if (clock < getState(store, client)) { - getItemCleanStart(transaction, createID(client, clock)); - } - }); - iterateDeletedStructs(transaction, snapshot.ds, _item => {}); - meta.add(snapshot); - } - }; - - class StructStore { - constructor () { - /** - * @type {Map>} - */ - this.clients = new Map(); - /** - * @type {null | { missing: Map, update: Uint8Array }} - */ - this.pendingStructs = null; - /** - * @type {null | Uint8Array} - */ - this.pendingDs = null; - } - } - - /** - * Return the states as a Map. - * Note that clock refers to the next expected clock id. - * - * @param {StructStore} store - * @return {Map} - * - * @public - * @function - */ - const getStateVector = store => { - const sm = new Map(); - store.clients.forEach((structs, client) => { - const struct = structs[structs.length - 1]; - sm.set(client, struct.id.clock + struct.length); - }); - return sm - }; - - /** - * @param {StructStore} store - * @param {number} client - * @return {number} - * - * @public - * @function - */ - const getState = (store, client) => { - const structs = store.clients.get(client); - if (structs === undefined) { - return 0 - } - const lastStruct = structs[structs.length - 1]; - return lastStruct.id.clock + lastStruct.length - }; - - /** - * @param {StructStore} store - * @param {GC|Item} struct - * - * @private - * @function - */ - const addStruct = (store, struct) => { - let structs = store.clients.get(struct.id.client); - if (structs === undefined) { - structs = []; - store.clients.set(struct.id.client, structs); - } else { - const lastStruct = structs[structs.length - 1]; - if (lastStruct.id.clock + lastStruct.length !== struct.id.clock) { - throw unexpectedCase() - } - } - structs.push(struct); - }; - - /** - * Perform a binary search on a sorted array - * @param {Array} structs - * @param {number} clock - * @return {number} - * - * @private - * @function - */ - const findIndexSS = (structs, clock) => { - let left = 0; - let right = structs.length - 1; - let mid = structs[right]; - let midclock = mid.id.clock; - if (midclock === clock) { - return right - } - // @todo does it even make sense to pivot the search? - // If a good split misses, it might actually increase the time to find the correct item. - // Currently, the only advantage is that search with pivoting might find the item on the first try. - let midindex = floor((clock / (midclock + mid.length - 1)) * right); // pivoting the search - while (left <= right) { - mid = structs[midindex]; - midclock = mid.id.clock; - if (midclock <= clock) { - if (clock < midclock + mid.length) { - return midindex - } - left = midindex + 1; - } else { - right = midindex - 1; - } - midindex = floor((left + right) / 2); - } - // Always check state before looking for a struct in StructStore - // Therefore the case of not finding a struct is unexpected - throw unexpectedCase() - }; - - /** - * Expects that id is actually in store. This function throws or is an infinite loop otherwise. - * - * @param {StructStore} store - * @param {ID} id - * @return {GC|Item} - * - * @private - * @function - */ - const find = (store, id) => { - /** - * @type {Array} - */ - // @ts-ignore - const structs = store.clients.get(id.client); - return structs[findIndexSS(structs, id.clock)] - }; - - /** - * Expects that id is actually in store. This function throws or is an infinite loop otherwise. - * @private - * @function - */ - const getItem = /** @type {function(StructStore,ID):Item} */ (find); - - /** - * @param {Transaction} transaction - * @param {Array} structs - * @param {number} clock - */ - const findIndexCleanStart = (transaction, structs, clock) => { - const index = findIndexSS(structs, clock); - const struct = structs[index]; - if (struct.id.clock < clock && struct instanceof Item) { - structs.splice(index + 1, 0, splitItem(transaction, struct, clock - struct.id.clock)); - return index + 1 - } - return index - }; - - /** - * Expects that id is actually in store. This function throws or is an infinite loop otherwise. - * - * @param {Transaction} transaction - * @param {ID} id - * @return {Item} - * - * @private - * @function - */ - const getItemCleanStart = (transaction, id) => { - const structs = /** @type {Array} */ (transaction.doc.store.clients.get(id.client)); - return structs[findIndexCleanStart(transaction, structs, id.clock)] - }; - - /** - * Expects that id is actually in store. This function throws or is an infinite loop otherwise. - * - * @param {Transaction} transaction - * @param {StructStore} store - * @param {ID} id - * @return {Item} - * - * @private - * @function - */ - const getItemCleanEnd = (transaction, store, id) => { - /** - * @type {Array} - */ - // @ts-ignore - const structs = store.clients.get(id.client); - const index = findIndexSS(structs, id.clock); - const struct = structs[index]; - if (id.clock !== struct.id.clock + struct.length - 1 && struct.constructor !== GC) { - structs.splice(index + 1, 0, splitItem(transaction, struct, id.clock - struct.id.clock + 1)); - } - return struct - }; - - /** - * Replace `item` with `newitem` in store - * @param {StructStore} store - * @param {GC|Item} struct - * @param {GC|Item} newStruct - * - * @private - * @function - */ - const replaceStruct = (store, struct, newStruct) => { - const structs = /** @type {Array} */ (store.clients.get(struct.id.client)); - structs[findIndexSS(structs, struct.id.clock)] = newStruct; - }; - - /** - * Iterate over a range of structs - * - * @param {Transaction} transaction - * @param {Array} structs - * @param {number} clockStart Inclusive start - * @param {number} len - * @param {function(GC|Item):void} f - * - * @function - */ - const iterateStructs = (transaction, structs, clockStart, len, f) => { - if (len === 0) { - return - } - const clockEnd = clockStart + len; - let index = findIndexCleanStart(transaction, structs, clockStart); - let struct; - do { - struct = structs[index++]; - if (clockEnd < struct.id.clock + struct.length) { - findIndexCleanStart(transaction, structs, clockEnd); - } - f(struct); - } while (index < structs.length && structs[index].id.clock < clockEnd) - }; - - /** - * A transaction is created for every change on the Yjs model. It is possible - * to bundle changes on the Yjs model in a single transaction to - * minimize the number on messages sent and the number of observer calls. - * If possible the user of this library should bundle as many changes as - * possible. Here is an example to illustrate the advantages of bundling: - * - * @example - * const map = y.define('map', YMap) - * // Log content when change is triggered - * map.observe(() => { - * console.log('change triggered') - * }) - * // Each change on the map type triggers a log message: - * map.set('a', 0) // => "change triggered" - * map.set('b', 0) // => "change triggered" - * // When put in a transaction, it will trigger the log after the transaction: - * y.transact(() => { - * map.set('a', 1) - * map.set('b', 1) - * }) // => "change triggered" - * - * @public - */ - class Transaction { - /** - * @param {Doc} doc - * @param {any} origin - * @param {boolean} local - */ - constructor (doc, origin, local) { - /** - * The Yjs instance. - * @type {Doc} - */ - this.doc = doc; - /** - * Describes the set of deleted items by ids - * @type {DeleteSet} - */ - this.deleteSet = new DeleteSet(); - /** - * Holds the state before the transaction started. - * @type {Map} - */ - this.beforeState = getStateVector(doc.store); - /** - * Holds the state after the transaction. - * @type {Map} - */ - this.afterState = new Map(); - /** - * All types that were directly modified (property added or child - * inserted/deleted). New types are not included in this Set. - * Maps from type to parentSubs (`item.parentSub = null` for YArray) - * @type {Map>,Set>} - */ - this.changed = new Map(); - /** - * Stores the events for the types that observe also child elements. - * It is mainly used by `observeDeep`. - * @type {Map>,Array>>} - */ - this.changedParentTypes = new Map(); - /** - * @type {Array} - */ - this._mergeStructs = []; - /** - * @type {any} - */ - this.origin = origin; - /** - * Stores meta information on the transaction - * @type {Map} - */ - this.meta = new Map(); - /** - * Whether this change originates from this doc. - * @type {boolean} - */ - this.local = local; - /** - * @type {Set} - */ - this.subdocsAdded = new Set(); - /** - * @type {Set} - */ - this.subdocsRemoved = new Set(); - /** - * @type {Set} - */ - this.subdocsLoaded = new Set(); - /** - * @type {boolean} - */ - this._needFormattingCleanup = false; - } - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {Transaction} transaction - * @return {boolean} Whether data was written. - */ - const writeUpdateMessageFromTransaction = (encoder, transaction) => { - if (transaction.deleteSet.clients.size === 0 && !any(transaction.afterState, (clock, client) => transaction.beforeState.get(client) !== clock)) { - return false - } - sortAndMergeDeleteSet(transaction.deleteSet); - writeStructsFromTransaction(encoder, transaction); - writeDeleteSet(encoder, transaction.deleteSet); - return true - }; - - /** - * If `type.parent` was added in current transaction, `type` technically - * did not change, it was just added and we should not fire events for `type`. - * - * @param {Transaction} transaction - * @param {AbstractType>} type - * @param {string|null} parentSub - */ - const addChangedTypeToTransaction = (transaction, type, parentSub) => { - const item = type._item; - if (item === null || (item.id.clock < (transaction.beforeState.get(item.id.client) || 0) && !item.deleted)) { - setIfUndefined(transaction.changed, type, create$5).add(parentSub); - } - }; - - /** - * @param {Array} structs - * @param {number} pos - * @return {number} # of merged structs - */ - const tryToMergeWithLefts = (structs, pos) => { - let right = structs[pos]; - let left = structs[pos - 1]; - let i = pos; - for (; i > 0; right = left, left = structs[--i - 1]) { - if (left.deleted === right.deleted && left.constructor === right.constructor) { - if (left.mergeWith(right)) { - if (right instanceof Item && right.parentSub !== null && /** @type {AbstractType} */ (right.parent)._map.get(right.parentSub) === right) { - /** @type {AbstractType} */ (right.parent)._map.set(right.parentSub, /** @type {Item} */ (left)); - } - continue - } - } - break - } - const merged = pos - i; - if (merged) { - // remove all merged structs from the array - structs.splice(pos + 1 - merged, merged); - } - return merged - }; - - /** - * @param {DeleteSet} ds - * @param {StructStore} store - * @param {function(Item):boolean} gcFilter - */ - const tryGcDeleteSet = (ds, store, gcFilter) => { - for (const [client, deleteItems] of ds.clients.entries()) { - const structs = /** @type {Array} */ (store.clients.get(client)); - for (let di = deleteItems.length - 1; di >= 0; di--) { - const deleteItem = deleteItems[di]; - const endDeleteItemClock = deleteItem.clock + deleteItem.len; - for ( - let si = findIndexSS(structs, deleteItem.clock), struct = structs[si]; - si < structs.length && struct.id.clock < endDeleteItemClock; - struct = structs[++si] - ) { - const struct = structs[si]; - if (deleteItem.clock + deleteItem.len <= struct.id.clock) { - break - } - if (struct instanceof Item && struct.deleted && !struct.keep && gcFilter(struct)) { - struct.gc(store, false); - } - } - } - } - }; - - /** - * @param {DeleteSet} ds - * @param {StructStore} store - */ - const tryMergeDeleteSet = (ds, store) => { - // try to merge deleted / gc'd items - // merge from right to left for better efficiecy and so we don't miss any merge targets - ds.clients.forEach((deleteItems, client) => { - const structs = /** @type {Array} */ (store.clients.get(client)); - for (let di = deleteItems.length - 1; di >= 0; di--) { - const deleteItem = deleteItems[di]; - // start with merging the item next to the last deleted item - const mostRightIndexToCheck = min(structs.length - 1, 1 + findIndexSS(structs, deleteItem.clock + deleteItem.len - 1)); - for ( - let si = mostRightIndexToCheck, struct = structs[si]; - si > 0 && struct.id.clock >= deleteItem.clock; - struct = structs[si] - ) { - si -= 1 + tryToMergeWithLefts(structs, si); - } - } - }); - }; - - /** - * @param {Array} transactionCleanups - * @param {number} i - */ - const cleanupTransactions = (transactionCleanups, i) => { - if (i < transactionCleanups.length) { - const transaction = transactionCleanups[i]; - const doc = transaction.doc; - const store = doc.store; - const ds = transaction.deleteSet; - const mergeStructs = transaction._mergeStructs; - try { - sortAndMergeDeleteSet(ds); - transaction.afterState = getStateVector(transaction.doc.store); - doc.emit('beforeObserverCalls', [transaction, doc]); - /** - * An array of event callbacks. - * - * Each callback is called even if the other ones throw errors. - * - * @type {Array} - */ - const fs = []; - // observe events on changed types - transaction.changed.forEach((subs, itemtype) => - fs.push(() => { - if (itemtype._item === null || !itemtype._item.deleted) { - itemtype._callObserver(transaction, subs); - } - }) - ); - fs.push(() => { - // deep observe events - transaction.changedParentTypes.forEach((events, type) => { - // We need to think about the possibility that the user transforms the - // Y.Doc in the event. - if (type._dEH.l.length > 0 && (type._item === null || !type._item.deleted)) { - events = events - .filter(event => - event.target._item === null || !event.target._item.deleted - ); - events - .forEach(event => { - event.currentTarget = type; - // path is relative to the current target - event._path = null; - }); - // sort events by path length so that top-level events are fired first. - events - .sort((event1, event2) => event1.path.length - event2.path.length); - // We don't need to check for events.length - // because we know it has at least one element - callEventHandlerListeners(type._dEH, events, transaction); - } - }); - }); - fs.push(() => doc.emit('afterTransaction', [transaction, doc])); - callAll(fs, []); - if (transaction._needFormattingCleanup) { - cleanupYTextAfterTransaction(transaction); - } - } finally { - // Replace deleted items with ItemDeleted / GC. - // This is where content is actually remove from the Yjs Doc. - if (doc.gc) { - tryGcDeleteSet(ds, store, doc.gcFilter); - } - tryMergeDeleteSet(ds, store); - - // on all affected store.clients props, try to merge - transaction.afterState.forEach((clock, client) => { - const beforeClock = transaction.beforeState.get(client) || 0; - if (beforeClock !== clock) { - const structs = /** @type {Array} */ (store.clients.get(client)); - // we iterate from right to left so we can safely remove entries - const firstChangePos = max(findIndexSS(structs, beforeClock), 1); - for (let i = structs.length - 1; i >= firstChangePos;) { - i -= 1 + tryToMergeWithLefts(structs, i); - } - } - }); - // try to merge mergeStructs - // @todo: it makes more sense to transform mergeStructs to a DS, sort it, and merge from right to left - // but at the moment DS does not handle duplicates - for (let i = mergeStructs.length - 1; i >= 0; i--) { - const { client, clock } = mergeStructs[i].id; - const structs = /** @type {Array} */ (store.clients.get(client)); - const replacedStructPos = findIndexSS(structs, clock); - if (replacedStructPos + 1 < structs.length) { - if (tryToMergeWithLefts(structs, replacedStructPos + 1) > 1) { - continue // no need to perform next check, both are already merged - } - } - if (replacedStructPos > 0) { - tryToMergeWithLefts(structs, replacedStructPos); - } - } - if (!transaction.local && transaction.afterState.get(doc.clientID) !== transaction.beforeState.get(doc.clientID)) { - print(ORANGE, BOLD, '[yjs] ', UNBOLD, RED, 'Changed the client-id because another client seems to be using it.'); - doc.clientID = generateNewClientId(); - } - // @todo Merge all the transactions into one and provide send the data as a single update message - doc.emit('afterTransactionCleanup', [transaction, doc]); - if (doc._observers.has('update')) { - const encoder = new UpdateEncoderV1(); - const hasContent = writeUpdateMessageFromTransaction(encoder, transaction); - if (hasContent) { - doc.emit('update', [encoder.toUint8Array(), transaction.origin, doc, transaction]); - } - } - if (doc._observers.has('updateV2')) { - const encoder = new UpdateEncoderV2(); - const hasContent = writeUpdateMessageFromTransaction(encoder, transaction); - if (hasContent) { - doc.emit('updateV2', [encoder.toUint8Array(), transaction.origin, doc, transaction]); - } - } - const { subdocsAdded, subdocsLoaded, subdocsRemoved } = transaction; - if (subdocsAdded.size > 0 || subdocsRemoved.size > 0 || subdocsLoaded.size > 0) { - subdocsAdded.forEach(subdoc => { - subdoc.clientID = doc.clientID; - if (subdoc.collectionid == null) { - subdoc.collectionid = doc.collectionid; - } - doc.subdocs.add(subdoc); - }); - subdocsRemoved.forEach(subdoc => doc.subdocs.delete(subdoc)); - doc.emit('subdocs', [{ loaded: subdocsLoaded, added: subdocsAdded, removed: subdocsRemoved }, doc, transaction]); - subdocsRemoved.forEach(subdoc => subdoc.destroy()); - } - - if (transactionCleanups.length <= i + 1) { - doc._transactionCleanups = []; - doc.emit('afterAllTransactions', [doc, transactionCleanups]); - } else { - cleanupTransactions(transactionCleanups, i + 1); - } - } - } - }; - - /** - * Implements the functionality of `y.transact(()=>{..})` - * - * @template T - * @param {Doc} doc - * @param {function(Transaction):T} f - * @param {any} [origin=true] - * @return {T} - * - * @function - */ - const transact = (doc, f, origin = null, local = true) => { - const transactionCleanups = doc._transactionCleanups; - let initialCall = false; - /** - * @type {any} - */ - let result = null; - if (doc._transaction === null) { - initialCall = true; - doc._transaction = new Transaction(doc, origin, local); - transactionCleanups.push(doc._transaction); - if (transactionCleanups.length === 1) { - doc.emit('beforeAllTransactions', [doc]); - } - doc.emit('beforeTransaction', [doc._transaction, doc]); - } - try { - result = f(doc._transaction); - } finally { - if (initialCall) { - const finishCleanup = doc._transaction === transactionCleanups[0]; - doc._transaction = null; - if (finishCleanup) { - // The first transaction ended, now process observer calls. - // Observer call may create new transactions for which we need to call the observers and do cleanup. - // We don't want to nest these calls, so we execute these calls one after - // another. - // Also we need to ensure that all cleanups are called, even if the - // observes throw errors. - // This file is full of hacky try {} finally {} blocks to ensure that an - // event can throw errors and also that the cleanup is called. - cleanupTransactions(transactionCleanups, 0); - } - } - } - return result - }; - - const errorComputeChanges = 'You must not compute changes after the event-handler fired.'; - - /** - * @template {AbstractType} T - * YEvent describes the changes on a YType. - */ - class YEvent { - /** - * @param {T} target The changed type. - * @param {Transaction} transaction - */ - constructor (target, transaction) { - /** - * The type on which this event was created on. - * @type {T} - */ - this.target = target; - /** - * The current target on which the observe callback is called. - * @type {AbstractType} - */ - this.currentTarget = target; - /** - * The transaction that triggered this event. - * @type {Transaction} - */ - this.transaction = transaction; - /** - * @type {Object|null} - */ - this._changes = null; - /** - * @type {null | Map} - */ - this._keys = null; - /** - * @type {null | Array<{ insert?: string | Array | object | AbstractType, retain?: number, delete?: number, attributes?: Object }>} - */ - this._delta = null; - /** - * @type {Array|null} - */ - this._path = null; - } - - /** - * Computes the path from `y` to the changed type. - * - * @todo v14 should standardize on path: Array<{parent, index}> because that is easier to work with. - * - * The following property holds: - * @example - * let type = y - * event.path.forEach(dir => { - * type = type.get(dir) - * }) - * type === event.target // => true - */ - get path () { - return this._path || (this._path = getPathTo(this.currentTarget, this.target)) - } - - /** - * Check if a struct is deleted by this event. - * - * In contrast to change.deleted, this method also returns true if the struct was added and then deleted. - * - * @param {AbstractStruct} struct - * @return {boolean} - */ - deletes (struct) { - return isDeleted(this.transaction.deleteSet, struct.id) - } - - /** - * @type {Map} - */ - get keys () { - if (this._keys === null) { - if (this.transaction.doc._transactionCleanups.length === 0) { - throw create$2(errorComputeChanges) - } - const keys = new Map(); - const target = this.target; - const changed = /** @type Set */ (this.transaction.changed.get(target)); - changed.forEach(key => { - if (key !== null) { - const item = /** @type {Item} */ (target._map.get(key)); - /** - * @type {'delete' | 'add' | 'update'} - */ - let action; - let oldValue; - if (this.adds(item)) { - let prev = item.left; - while (prev !== null && this.adds(prev)) { - prev = prev.left; - } - if (this.deletes(item)) { - if (prev !== null && this.deletes(prev)) { - action = 'delete'; - oldValue = last(prev.content.getContent()); - } else { - return - } - } else { - if (prev !== null && this.deletes(prev)) { - action = 'update'; - oldValue = last(prev.content.getContent()); - } else { - action = 'add'; - oldValue = undefined; - } - } - } else { - if (this.deletes(item)) { - action = 'delete'; - oldValue = last(/** @type {Item} */ item.content.getContent()); - } else { - return // nop - } - } - keys.set(key, { action, oldValue }); - } - }); - this._keys = keys; - } - return this._keys - } - - /** - * This is a computed property. Note that this can only be safely computed during the - * event call. Computing this property after other changes happened might result in - * unexpected behavior (incorrect computation of deltas). A safe way to collect changes - * is to store the `changes` or the `delta` object. Avoid storing the `transaction` object. - * - * @type {Array<{insert?: string | Array | object | AbstractType, retain?: number, delete?: number, attributes?: Object}>} - */ - get delta () { - return this.changes.delta - } - - /** - * Check if a struct is added by this event. - * - * In contrast to change.deleted, this method also returns true if the struct was added and then deleted. - * - * @param {AbstractStruct} struct - * @return {boolean} - */ - adds (struct) { - return struct.id.clock >= (this.transaction.beforeState.get(struct.id.client) || 0) - } - - /** - * This is a computed property. Note that this can only be safely computed during the - * event call. Computing this property after other changes happened might result in - * unexpected behavior (incorrect computation of deltas). A safe way to collect changes - * is to store the `changes` or the `delta` object. Avoid storing the `transaction` object. - * - * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string, delete?:number, retain?:number}>}} - */ - get changes () { - let changes = this._changes; - if (changes === null) { - if (this.transaction.doc._transactionCleanups.length === 0) { - throw create$2(errorComputeChanges) - } - const target = this.target; - const added = create$5(); - const deleted = create$5(); - /** - * @type {Array<{insert:Array}|{delete:number}|{retain:number}>} - */ - const delta = []; - changes = { - added, - deleted, - delta, - keys: this.keys - }; - const changed = /** @type Set */ (this.transaction.changed.get(target)); - if (changed.has(null)) { - /** - * @type {any} - */ - let lastOp = null; - const packOp = () => { - if (lastOp) { - delta.push(lastOp); - } - }; - for (let item = target._start; item !== null; item = item.right) { - if (item.deleted) { - if (this.deletes(item) && !this.adds(item)) { - if (lastOp === null || lastOp.delete === undefined) { - packOp(); - lastOp = { delete: 0 }; - } - lastOp.delete += item.length; - deleted.add(item); - } // else nop - } else { - if (this.adds(item)) { - if (lastOp === null || lastOp.insert === undefined) { - packOp(); - lastOp = { insert: [] }; - } - lastOp.insert = lastOp.insert.concat(item.content.getContent()); - added.add(item); - } else { - if (lastOp === null || lastOp.retain === undefined) { - packOp(); - lastOp = { retain: 0 }; - } - lastOp.retain += item.length; - } - } - } - if (lastOp !== null && lastOp.retain === undefined) { - packOp(); - } - } - this._changes = changes; - } - return /** @type {any} */ (changes) - } - } - - /** - * Compute the path from this type to the specified target. - * - * @example - * // `child` should be accessible via `type.get(path[0]).get(path[1])..` - * const path = type.getPathTo(child) - * // assuming `type instanceof YArray` - * console.log(path) // might look like => [2, 'key1'] - * child === type.get(path[0]).get(path[1]) - * - * @param {AbstractType} parent - * @param {AbstractType} child target - * @return {Array} Path to the target - * - * @private - * @function - */ - const getPathTo = (parent, child) => { - const path = []; - while (child._item !== null && child !== parent) { - if (child._item.parentSub !== null) { - // parent is map-ish - path.unshift(child._item.parentSub); - } else { - // parent is array-ish - let i = 0; - let c = /** @type {AbstractType} */ (child._item.parent)._start; - while (c !== child._item && c !== null) { - if (!c.deleted) { - i++; - } - c = c.right; - } - path.unshift(i); - } - child = /** @type {AbstractType} */ (child._item.parent); - } - return path - }; - - const maxSearchMarker = 80; - - /** - * A unique timestamp that identifies each marker. - * - * Time is relative,.. this is more like an ever-increasing clock. - * - * @type {number} - */ - let globalSearchMarkerTimestamp = 0; - - class ArraySearchMarker { - /** - * @param {Item} p - * @param {number} index - */ - constructor (p, index) { - p.marker = true; - this.p = p; - this.index = index; - this.timestamp = globalSearchMarkerTimestamp++; - } - } - - /** - * @param {ArraySearchMarker} marker - */ - const refreshMarkerTimestamp = marker => { marker.timestamp = globalSearchMarkerTimestamp++; }; - - /** - * This is rather complex so this function is the only thing that should overwrite a marker - * - * @param {ArraySearchMarker} marker - * @param {Item} p - * @param {number} index - */ - const overwriteMarker = (marker, p, index) => { - marker.p.marker = false; - marker.p = p; - p.marker = true; - marker.index = index; - marker.timestamp = globalSearchMarkerTimestamp++; - }; - - /** - * @param {Array} searchMarker - * @param {Item} p - * @param {number} index - */ - const markPosition = (searchMarker, p, index) => { - if (searchMarker.length >= maxSearchMarker) { - // override oldest marker (we don't want to create more objects) - const marker = searchMarker.reduce((a, b) => a.timestamp < b.timestamp ? a : b); - overwriteMarker(marker, p, index); - return marker - } else { - // create new marker - const pm = new ArraySearchMarker(p, index); - searchMarker.push(pm); - return pm - } - }; - - /** - * Search marker help us to find positions in the associative array faster. - * - * They speed up the process of finding a position without much bookkeeping. - * - * A maximum of `maxSearchMarker` objects are created. - * - * This function always returns a refreshed marker (updated timestamp) - * - * @param {AbstractType} yarray - * @param {number} index - */ - const findMarker = (yarray, index) => { - if (yarray._start === null || index === 0 || yarray._searchMarker === null) { - return null - } - const marker = yarray._searchMarker.length === 0 ? null : yarray._searchMarker.reduce((a, b) => abs(index - a.index) < abs(index - b.index) ? a : b); - let p = yarray._start; - let pindex = 0; - if (marker !== null) { - p = marker.p; - pindex = marker.index; - refreshMarkerTimestamp(marker); // we used it, we might need to use it again - } - // iterate to right if possible - while (p.right !== null && pindex < index) { - if (!p.deleted && p.countable) { - if (index < pindex + p.length) { - break - } - pindex += p.length; - } - p = p.right; - } - // iterate to left if necessary (might be that pindex > index) - while (p.left !== null && pindex > index) { - p = p.left; - if (!p.deleted && p.countable) { - pindex -= p.length; - } - } - // we want to make sure that p can't be merged with left, because that would screw up everything - // in that cas just return what we have (it is most likely the best marker anyway) - // iterate to left until p can't be merged with left - while (p.left !== null && p.left.id.client === p.id.client && p.left.id.clock + p.left.length === p.id.clock) { - p = p.left; - if (!p.deleted && p.countable) { - pindex -= p.length; - } - } - - // @todo remove! - // assure position - // { - // let start = yarray._start - // let pos = 0 - // while (start !== p) { - // if (!start.deleted && start.countable) { - // pos += start.length - // } - // start = /** @type {Item} */ (start.right) - // } - // if (pos !== pindex) { - // debugger - // throw new Error('Gotcha position fail!') - // } - // } - // if (marker) { - // if (window.lengthes == null) { - // window.lengthes = [] - // window.getLengthes = () => window.lengthes.sort((a, b) => a - b) - // } - // window.lengthes.push(marker.index - pindex) - // console.log('distance', marker.index - pindex, 'len', p && p.parent.length) - // } - if (marker !== null && abs(marker.index - pindex) < /** @type {YText|YArray} */ (p.parent).length / maxSearchMarker) { - // adjust existing marker - overwriteMarker(marker, p, pindex); - return marker - } else { - // create new marker - return markPosition(yarray._searchMarker, p, pindex) - } - }; - - /** - * Update markers when a change happened. - * - * This should be called before doing a deletion! - * - * @param {Array} searchMarker - * @param {number} index - * @param {number} len If insertion, len is positive. If deletion, len is negative. - */ - const updateMarkerChanges = (searchMarker, index, len) => { - for (let i = searchMarker.length - 1; i >= 0; i--) { - const m = searchMarker[i]; - if (len > 0) { - /** - * @type {Item|null} - */ - let p = m.p; - p.marker = false; - // Ideally we just want to do a simple position comparison, but this will only work if - // search markers don't point to deleted items for formats. - // Iterate marker to prev undeleted countable position so we know what to do when updating a position - while (p && (p.deleted || !p.countable)) { - p = p.left; - if (p && !p.deleted && p.countable) { - // adjust position. the loop should break now - m.index -= p.length; - } - } - if (p === null || p.marker === true) { - // remove search marker if updated position is null or if position is already marked - searchMarker.splice(i, 1); - continue - } - m.p = p; - p.marker = true; - } - if (index < m.index || (len > 0 && index === m.index)) { // a simple index <= m.index check would actually suffice - m.index = max(index, m.index + len); - } - } - }; - - /** - * Call event listeners with an event. This will also add an event to all - * parents (for `.observeDeep` handlers). - * - * @template EventType - * @param {AbstractType} type - * @param {Transaction} transaction - * @param {EventType} event - */ - const callTypeObservers = (type, transaction, event) => { - const changedType = type; - const changedParentTypes = transaction.changedParentTypes; - while (true) { - // @ts-ignore - setIfUndefined(changedParentTypes, type, () => []).push(event); - if (type._item === null) { - break - } - type = /** @type {AbstractType} */ (type._item.parent); - } - callEventHandlerListeners(changedType._eH, event, transaction); - }; - - /** - * @template EventType - * Abstract Yjs Type class - */ - class AbstractType { - constructor () { - /** - * @type {Item|null} - */ - this._item = null; - /** - * @type {Map} - */ - this._map = new Map(); - /** - * @type {Item|null} - */ - this._start = null; - /** - * @type {Doc|null} - */ - this.doc = null; - this._length = 0; - /** - * Event handlers - * @type {EventHandler} - */ - this._eH = createEventHandler(); - /** - * Deep event handlers - * @type {EventHandler>,Transaction>} - */ - this._dEH = createEventHandler(); - /** - * @type {null | Array} - */ - this._searchMarker = null; - } - - /** - * @return {AbstractType|null} - */ - get parent () { - return this._item ? /** @type {AbstractType} */ (this._item.parent) : null - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item|null} item - */ - _integrate (y, item) { - this.doc = y; - this._item = item; - } - - /** - * @return {AbstractType} - */ - _copy () { - throw methodUnimplemented() - } - - /** - * @return {AbstractType} - */ - clone () { - throw methodUnimplemented() - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} _encoder - */ - _write (_encoder) { } - - /** - * The first non-deleted item - */ - get _first () { - let n = this._start; - while (n !== null && n.deleted) { - n = n.right; - } - return n - } - - /** - * Creates YEvent and calls all type observers. - * Must be implemented by each type. - * - * @param {Transaction} transaction - * @param {Set} _parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, _parentSubs) { - if (!transaction.local && this._searchMarker) { - this._searchMarker.length = 0; - } - } - - /** - * Observe all events that are created on this type. - * - * @param {function(EventType, Transaction):void} f Observer function - */ - observe (f) { - addEventHandlerListener(this._eH, f); - } - - /** - * Observe all events that are created by this type and its children. - * - * @param {function(Array>,Transaction):void} f Observer function - */ - observeDeep (f) { - addEventHandlerListener(this._dEH, f); - } - - /** - * Unregister an observer function. - * - * @param {function(EventType,Transaction):void} f Observer function - */ - unobserve (f) { - removeEventHandlerListener(this._eH, f); - } - - /** - * Unregister an observer function. - * - * @param {function(Array>,Transaction):void} f Observer function - */ - unobserveDeep (f) { - removeEventHandlerListener(this._dEH, f); - } - - /** - * @abstract - * @return {any} - */ - toJSON () {} - } - - /** - * @param {AbstractType} type - * @param {number} start - * @param {number} end - * @return {Array} - * - * @private - * @function - */ - const typeListSlice = (type, start, end) => { - if (start < 0) { - start = type._length + start; - } - if (end < 0) { - end = type._length + end; - } - let len = end - start; - const cs = []; - let n = type._start; - while (n !== null && len > 0) { - if (n.countable && !n.deleted) { - const c = n.content.getContent(); - if (c.length <= start) { - start -= c.length; - } else { - for (let i = start; i < c.length && len > 0; i++) { - cs.push(c[i]); - len--; - } - start = 0; - } - } - n = n.right; - } - return cs - }; - - /** - * @param {AbstractType} type - * @return {Array} - * - * @private - * @function - */ - const typeListToArray = type => { - const cs = []; - let n = type._start; - while (n !== null) { - if (n.countable && !n.deleted) { - const c = n.content.getContent(); - for (let i = 0; i < c.length; i++) { - cs.push(c[i]); - } - } - n = n.right; - } - return cs - }; - - /** - * Executes a provided function on once on overy element of this YArray. - * - * @param {AbstractType} type - * @param {function(any,number,any):void} f A function to execute on every element of this YArray. - * - * @private - * @function - */ - const typeListForEach = (type, f) => { - let index = 0; - let n = type._start; - while (n !== null) { - if (n.countable && !n.deleted) { - const c = n.content.getContent(); - for (let i = 0; i < c.length; i++) { - f(c[i], index++, type); - } - } - n = n.right; - } - }; - - /** - * @template C,R - * @param {AbstractType} type - * @param {function(C,number,AbstractType):R} f - * @return {Array} - * - * @private - * @function - */ - const typeListMap = (type, f) => { - /** - * @type {Array} - */ - const result = []; - typeListForEach(type, (c, i) => { - result.push(f(c, i, type)); - }); - return result - }; - - /** - * @param {AbstractType} type - * @return {IterableIterator} - * - * @private - * @function - */ - const typeListCreateIterator = type => { - let n = type._start; - /** - * @type {Array|null} - */ - let currentContent = null; - let currentContentIndex = 0; - return { - [Symbol.iterator] () { - return this - }, - next: () => { - // find some content - if (currentContent === null) { - while (n !== null && n.deleted) { - n = n.right; - } - // check if we reached the end, no need to check currentContent, because it does not exist - if (n === null) { - return { - done: true, - value: undefined - } - } - // we found n, so we can set currentContent - currentContent = n.content.getContent(); - currentContentIndex = 0; - n = n.right; // we used the content of n, now iterate to next - } - const value = currentContent[currentContentIndex++]; - // check if we need to empty currentContent - if (currentContent.length <= currentContentIndex) { - currentContent = null; - } - return { - done: false, - value - } - } - } - }; - - /** - * @param {AbstractType} type - * @param {number} index - * @return {any} - * - * @private - * @function - */ - const typeListGet = (type, index) => { - const marker = findMarker(type, index); - let n = type._start; - if (marker !== null) { - n = marker.p; - index -= marker.index; - } - for (; n !== null; n = n.right) { - if (!n.deleted && n.countable) { - if (index < n.length) { - return n.content.getContent()[index] - } - index -= n.length; - } - } - }; - - /** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {Item?} referenceItem - * @param {Array|Array|boolean|number|null|string|Uint8Array>} content - * - * @private - * @function - */ - const typeListInsertGenericsAfter = (transaction, parent, referenceItem, content) => { - let left = referenceItem; - const doc = transaction.doc; - const ownClientId = doc.clientID; - const store = doc.store; - const right = referenceItem === null ? parent._start : referenceItem.right; - /** - * @type {Array|number|null>} - */ - let jsonContent = []; - const packJsonContent = () => { - if (jsonContent.length > 0) { - left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentAny(jsonContent)); - left.integrate(transaction, 0); - jsonContent = []; - } - }; - content.forEach(c => { - if (c === null) { - jsonContent.push(c); - } else { - switch (c.constructor) { - case Number: - case Object: - case Boolean: - case Array: - case String: - jsonContent.push(c); - break - default: - packJsonContent(); - switch (c.constructor) { - case Uint8Array: - case ArrayBuffer: - left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentBinary(new Uint8Array(/** @type {Uint8Array} */ (c)))); - left.integrate(transaction, 0); - break - case Doc: - left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentDoc(/** @type {Doc} */ (c))); - left.integrate(transaction, 0); - break - default: - if (c instanceof AbstractType) { - left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentType(c)); - left.integrate(transaction, 0); - } else { - throw new Error('Unexpected content type in insert operation') - } - } - } - } - }); - packJsonContent(); - }; - - const lengthExceeded = create$2('Length exceeded!'); - - /** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {number} index - * @param {Array|Array|number|null|string|Uint8Array>} content - * - * @private - * @function - */ - const typeListInsertGenerics = (transaction, parent, index, content) => { - if (index > parent._length) { - throw lengthExceeded - } - if (index === 0) { - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, index, content.length); - } - return typeListInsertGenericsAfter(transaction, parent, null, content) - } - const startIndex = index; - const marker = findMarker(parent, index); - let n = parent._start; - if (marker !== null) { - n = marker.p; - index -= marker.index; - // we need to iterate one to the left so that the algorithm works - if (index === 0) { - // @todo refactor this as it actually doesn't consider formats - n = n.prev; // important! get the left undeleted item so that we can actually decrease index - index += (n && n.countable && !n.deleted) ? n.length : 0; - } - } - for (; n !== null; n = n.right) { - if (!n.deleted && n.countable) { - if (index <= n.length) { - if (index < n.length) { - // insert in-between - getItemCleanStart(transaction, createID(n.id.client, n.id.clock + index)); - } - break - } - index -= n.length; - } - } - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, startIndex, content.length); - } - return typeListInsertGenericsAfter(transaction, parent, n, content) - }; - - /** - * Pushing content is special as we generally want to push after the last item. So we don't have to update - * the serach marker. - * - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {Array|Array|number|null|string|Uint8Array>} content - * - * @private - * @function - */ - const typeListPushGenerics = (transaction, parent, content) => { - // Use the marker with the highest index and iterate to the right. - const marker = (parent._searchMarker || []).reduce((maxMarker, currMarker) => currMarker.index > maxMarker.index ? currMarker : maxMarker, { index: 0, p: parent._start }); - let n = marker.p; - if (n) { - while (n.right) { - n = n.right; - } - } - return typeListInsertGenericsAfter(transaction, parent, n, content) - }; - - /** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {number} index - * @param {number} length - * - * @private - * @function - */ - const typeListDelete = (transaction, parent, index, length) => { - if (length === 0) { return } - const startIndex = index; - const startLength = length; - const marker = findMarker(parent, index); - let n = parent._start; - if (marker !== null) { - n = marker.p; - index -= marker.index; - } - // compute the first item to be deleted - for (; n !== null && index > 0; n = n.right) { - if (!n.deleted && n.countable) { - if (index < n.length) { - getItemCleanStart(transaction, createID(n.id.client, n.id.clock + index)); - } - index -= n.length; - } - } - // delete all items until done - while (length > 0 && n !== null) { - if (!n.deleted) { - if (length < n.length) { - getItemCleanStart(transaction, createID(n.id.client, n.id.clock + length)); - } - n.delete(transaction); - length -= n.length; - } - n = n.right; - } - if (length > 0) { - throw lengthExceeded - } - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, startIndex, -startLength + length /* in case we remove the above exception */); - } - }; - - /** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {string} key - * - * @private - * @function - */ - const typeMapDelete = (transaction, parent, key) => { - const c = parent._map.get(key); - if (c !== undefined) { - c.delete(transaction); - } - }; - - /** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {string} key - * @param {Object|number|null|Array|string|Uint8Array|AbstractType} value - * - * @private - * @function - */ - const typeMapSet = (transaction, parent, key, value) => { - const left = parent._map.get(key) || null; - const doc = transaction.doc; - const ownClientId = doc.clientID; - let content; - if (value == null) { - content = new ContentAny([value]); - } else { - switch (value.constructor) { - case Number: - case Object: - case Boolean: - case Array: - case String: - content = new ContentAny([value]); - break - case Uint8Array: - content = new ContentBinary(/** @type {Uint8Array} */ (value)); - break - case Doc: - content = new ContentDoc(/** @type {Doc} */ (value)); - break - default: - if (value instanceof AbstractType) { - content = new ContentType(value); - } else { - throw new Error('Unexpected content type') - } - } - } - new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, null, null, parent, key, content).integrate(transaction, 0); - }; - - /** - * @param {AbstractType} parent - * @param {string} key - * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined} - * - * @private - * @function - */ - const typeMapGet = (parent, key) => { - const val = parent._map.get(key); - return val !== undefined && !val.deleted ? val.content.getContent()[val.length - 1] : undefined - }; - - /** - * @param {AbstractType} parent - * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined>} - * - * @private - * @function - */ - const typeMapGetAll = (parent) => { - /** - * @type {Object} - */ - const res = {}; - parent._map.forEach((value, key) => { - if (!value.deleted) { - res[key] = value.content.getContent()[value.length - 1]; - } - }); - return res - }; - - /** - * @param {AbstractType} parent - * @param {string} key - * @return {boolean} - * - * @private - * @function - */ - const typeMapHas = (parent, key) => { - const val = parent._map.get(key); - return val !== undefined && !val.deleted - }; - - /** - * @param {Map} map - * @return {IterableIterator>} - * - * @private - * @function - */ - const createMapIterator = map => iteratorFilter(map.entries(), /** @param {any} entry */ entry => !entry[1].deleted); - - /** - * @module YArray - */ - - /** - * Event that describes the changes on a YArray - * @template T - * @extends YEvent> - */ - class YArrayEvent extends YEvent { - /** - * @param {YArray} yarray The changed type - * @param {Transaction} transaction The transaction object - */ - constructor (yarray, transaction) { - super(yarray, transaction); - this._transaction = transaction; - } - } - - /** - * A shared Array implementation. - * @template T - * @extends AbstractType> - * @implements {Iterable} - */ - class YArray extends AbstractType { - constructor () { - super(); - /** - * @type {Array?} - * @private - */ - this._prelimContent = []; - /** - * @type {Array} - */ - this._searchMarker = []; - } - - /** - * Construct a new YArray containing the specified items. - * @template {Object|Array|number|null|string|Uint8Array} T - * @param {Array} items - * @return {YArray} - */ - static from (items) { - /** - * @type {YArray} - */ - const a = new YArray(); - a.push(items); - return a - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item); - this.insert(0, /** @type {Array} */ (this._prelimContent)); - this._prelimContent = null; - } - - /** - * @return {YArray} - */ - _copy () { - return new YArray() - } - - /** - * @return {YArray} - */ - clone () { - /** - * @type {YArray} - */ - const arr = new YArray(); - arr.insert(0, this.toArray().map(el => - el instanceof AbstractType ? /** @type {typeof el} */ (el.clone()) : el - )); - return arr - } - - get length () { - return this._prelimContent === null ? this._length : this._prelimContent.length - } - - /** - * Creates YArrayEvent and calls observers. - * - * @param {Transaction} transaction - * @param {Set} parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, parentSubs) { - super._callObserver(transaction, parentSubs); - callTypeObservers(this, transaction, new YArrayEvent(this, transaction)); - } - - /** - * Inserts new content at an index. - * - * Important: This function expects an array of content. Not just a content - * object. The reason for this "weirdness" is that inserting several elements - * is very efficient when it is done as a single operation. - * - * @example - * // Insert character 'a' at position 0 - * yarray.insert(0, ['a']) - * // Insert numbers 1, 2 at position 1 - * yarray.insert(1, [1, 2]) - * - * @param {number} index The index to insert content at. - * @param {Array} content The array of content - */ - insert (index, content) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListInsertGenerics(transaction, this, index, /** @type {any} */ (content)); - }); - } else { - /** @type {Array} */ (this._prelimContent).splice(index, 0, ...content); - } - } - - /** - * Appends content to this YArray. - * - * @param {Array} content Array of content to append. - * - * @todo Use the following implementation in all types. - */ - push (content) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListPushGenerics(transaction, this, /** @type {any} */ (content)); - }); - } else { - /** @type {Array} */ (this._prelimContent).push(...content); - } - } - - /** - * Preppends content to this YArray. - * - * @param {Array} content Array of content to preppend. - */ - unshift (content) { - this.insert(0, content); - } - - /** - * Deletes elements starting from an index. - * - * @param {number} index Index at which to start deleting elements - * @param {number} length The number of elements to remove. Defaults to 1. - */ - delete (index, length = 1) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListDelete(transaction, this, index, length); - }); - } else { - /** @type {Array} */ (this._prelimContent).splice(index, length); - } - } - - /** - * Returns the i-th element from a YArray. - * - * @param {number} index The index of the element to return from the YArray - * @return {T} - */ - get (index) { - return typeListGet(this, index) - } - - /** - * Transforms this YArray to a JavaScript Array. - * - * @return {Array} - */ - toArray () { - return typeListToArray(this) - } - - /** - * Transforms this YArray to a JavaScript Array. - * - * @param {number} [start] - * @param {number} [end] - * @return {Array} - */ - slice (start = 0, end = this.length) { - return typeListSlice(this, start, end) - } - - /** - * Transforms this Shared Type to a JSON object. - * - * @return {Array} - */ - toJSON () { - return this.map(c => c instanceof AbstractType ? c.toJSON() : c) - } - - /** - * Returns an Array with the result of calling a provided function on every - * element of this YArray. - * - * @template M - * @param {function(T,number,YArray):M} f Function that produces an element of the new Array - * @return {Array} A new array with each element being the result of the - * callback function - */ - map (f) { - return typeListMap(this, /** @type {any} */ (f)) - } - - /** - * Executes a provided function once on overy element of this YArray. - * - * @param {function(T,number,YArray):void} f A function to execute on every element of this YArray. - */ - forEach (f) { - typeListForEach(this, f); - } - - /** - * @return {IterableIterator} - */ - [Symbol.iterator] () { - return typeListCreateIterator(this) - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - */ - _write (encoder) { - encoder.writeTypeRef(YArrayRefID); - } - } - - /** - * @template T - * @extends YEvent> - * Event that describes the changes on a YMap. - */ - class YMapEvent extends YEvent { - /** - * @param {YMap} ymap The YArray that changed. - * @param {Transaction} transaction - * @param {Set} subs The keys that changed. - */ - constructor (ymap, transaction, subs) { - super(ymap, transaction); - this.keysChanged = subs; - } - } - - /** - * @template MapType - * A shared Map implementation. - * - * @extends AbstractType> - * @implements {Iterable} - */ - class YMap extends AbstractType { - /** - * - * @param {Iterable=} entries - an optional iterable to initialize the YMap - */ - constructor (entries) { - super(); - /** - * @type {Map?} - * @private - */ - this._prelimContent = null; - - if (entries === undefined) { - this._prelimContent = new Map(); - } else { - this._prelimContent = new Map(entries); - } - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item) - ;/** @type {Map} */ (this._prelimContent).forEach((value, key) => { - this.set(key, value); - }); - this._prelimContent = null; - } - - /** - * @return {YMap} - */ - _copy () { - return new YMap() - } - - /** - * @return {YMap} - */ - clone () { - /** - * @type {YMap} - */ - const map = new YMap(); - this.forEach((value, key) => { - map.set(key, value instanceof AbstractType ? /** @type {typeof value} */ (value.clone()) : value); - }); - return map - } - - /** - * Creates YMapEvent and calls observers. - * - * @param {Transaction} transaction - * @param {Set} parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, parentSubs) { - callTypeObservers(this, transaction, new YMapEvent(this, transaction, parentSubs)); - } - - /** - * Transforms this Shared Type to a JSON object. - * - * @return {Object} - */ - toJSON () { - /** - * @type {Object} - */ - const map = {}; - this._map.forEach((item, key) => { - if (!item.deleted) { - const v = item.content.getContent()[item.length - 1]; - map[key] = v instanceof AbstractType ? v.toJSON() : v; - } - }); - return map - } - - /** - * Returns the size of the YMap (count of key/value pairs) - * - * @return {number} - */ - get size () { - return [...createMapIterator(this._map)].length - } - - /** - * Returns the keys for each element in the YMap Type. - * - * @return {IterableIterator} - */ - keys () { - return iteratorMap(createMapIterator(this._map), /** @param {any} v */ v => v[0]) - } - - /** - * Returns the values for each element in the YMap Type. - * - * @return {IterableIterator} - */ - values () { - return iteratorMap(createMapIterator(this._map), /** @param {any} v */ v => v[1].content.getContent()[v[1].length - 1]) - } - - /** - * Returns an Iterator of [key, value] pairs - * - * @return {IterableIterator} - */ - entries () { - return iteratorMap(createMapIterator(this._map), /** @param {any} v */ v => [v[0], v[1].content.getContent()[v[1].length - 1]]) - } - - /** - * Executes a provided function on once on every key-value pair. - * - * @param {function(MapType,string,YMap):void} f A function to execute on every element of this YArray. - */ - forEach (f) { - this._map.forEach((item, key) => { - if (!item.deleted) { - f(item.content.getContent()[item.length - 1], key, this); - } - }); - } - - /** - * Returns an Iterator of [key, value] pairs - * - * @return {IterableIterator} - */ - [Symbol.iterator] () { - return this.entries() - } - - /** - * Remove a specified element from this YMap. - * - * @param {string} key The key of the element to remove. - */ - delete (key) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapDelete(transaction, this, key); - }); - } else { - /** @type {Map} */ (this._prelimContent).delete(key); - } - } - - /** - * Adds or updates an element with a specified key and value. - * @template {MapType} VAL - * - * @param {string} key The key of the element to add to this YMap - * @param {VAL} value The value of the element to add - * @return {VAL} - */ - set (key, value) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapSet(transaction, this, key, /** @type {any} */ (value)); - }); - } else { - /** @type {Map} */ (this._prelimContent).set(key, value); - } - return value - } - - /** - * Returns a specified element from this YMap. - * - * @param {string} key - * @return {MapType|undefined} - */ - get (key) { - return /** @type {any} */ (typeMapGet(this, key)) - } - - /** - * Returns a boolean indicating whether the specified key exists or not. - * - * @param {string} key The key to test. - * @return {boolean} - */ - has (key) { - return typeMapHas(this, key) - } - - /** - * Removes all elements from this YMap. - */ - clear () { - if (this.doc !== null) { - transact(this.doc, transaction => { - this.forEach(function (_value, key, map) { - typeMapDelete(transaction, map, key); - }); - }); - } else { - /** @type {Map} */ (this._prelimContent).clear(); - } - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - */ - _write (encoder) { - encoder.writeTypeRef(YMapRefID); - } - } - - /** - * @param {any} a - * @param {any} b - * @return {boolean} - */ - const equalAttrs = (a, b) => a === b || (typeof a === 'object' && typeof b === 'object' && a && b && equalFlat(a, b)); - - class ItemTextListPosition { - /** - * @param {Item|null} left - * @param {Item|null} right - * @param {number} index - * @param {Map} currentAttributes - */ - constructor (left, right, index, currentAttributes) { - this.left = left; - this.right = right; - this.index = index; - this.currentAttributes = currentAttributes; - } - - /** - * Only call this if you know that this.right is defined - */ - forward () { - if (this.right === null) { - unexpectedCase(); - } - switch (this.right.content.constructor) { - case ContentFormat: - if (!this.right.deleted) { - updateCurrentAttributes(this.currentAttributes, /** @type {ContentFormat} */ (this.right.content)); - } - break - default: - if (!this.right.deleted) { - this.index += this.right.length; - } - break - } - this.left = this.right; - this.right = this.right.right; - } - } - - /** - * @param {Transaction} transaction - * @param {ItemTextListPosition} pos - * @param {number} count steps to move forward - * @return {ItemTextListPosition} - * - * @private - * @function - */ - const findNextPosition = (transaction, pos, count) => { - while (pos.right !== null && count > 0) { - switch (pos.right.content.constructor) { - case ContentFormat: - if (!pos.right.deleted) { - updateCurrentAttributes(pos.currentAttributes, /** @type {ContentFormat} */ (pos.right.content)); - } - break - default: - if (!pos.right.deleted) { - if (count < pos.right.length) { - // split right - getItemCleanStart(transaction, createID(pos.right.id.client, pos.right.id.clock + count)); - } - pos.index += pos.right.length; - count -= pos.right.length; - } - break - } - pos.left = pos.right; - pos.right = pos.right.right; - // pos.forward() - we don't forward because that would halve the performance because we already do the checks above - } - return pos - }; - - /** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {number} index - * @return {ItemTextListPosition} - * - * @private - * @function - */ - const findPosition = (transaction, parent, index) => { - const currentAttributes = new Map(); - const marker = findMarker(parent, index); - if (marker) { - const pos = new ItemTextListPosition(marker.p.left, marker.p, marker.index, currentAttributes); - return findNextPosition(transaction, pos, index - marker.index) - } else { - const pos = new ItemTextListPosition(null, parent._start, 0, currentAttributes); - return findNextPosition(transaction, pos, index) - } - }; - - /** - * Negate applied formats - * - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {ItemTextListPosition} currPos - * @param {Map} negatedAttributes - * - * @private - * @function - */ - const insertNegatedAttributes = (transaction, parent, currPos, negatedAttributes) => { - // check if we really need to remove attributes - while ( - currPos.right !== null && ( - currPos.right.deleted === true || ( - currPos.right.content.constructor === ContentFormat && - equalAttrs(negatedAttributes.get(/** @type {ContentFormat} */ (currPos.right.content).key), /** @type {ContentFormat} */ (currPos.right.content).value) - ) - ) - ) { - if (!currPos.right.deleted) { - negatedAttributes.delete(/** @type {ContentFormat} */ (currPos.right.content).key); - } - currPos.forward(); - } - const doc = transaction.doc; - const ownClientId = doc.clientID; - negatedAttributes.forEach((val, key) => { - const left = currPos.left; - const right = currPos.right; - const nextFormat = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentFormat(key, val)); - nextFormat.integrate(transaction, 0); - currPos.right = nextFormat; - currPos.forward(); - }); - }; - - /** - * @param {Map} currentAttributes - * @param {ContentFormat} format - * - * @private - * @function - */ - const updateCurrentAttributes = (currentAttributes, format) => { - const { key, value } = format; - if (value === null) { - currentAttributes.delete(key); - } else { - currentAttributes.set(key, value); - } - }; - - /** - * @param {ItemTextListPosition} currPos - * @param {Object} attributes - * - * @private - * @function - */ - const minimizeAttributeChanges = (currPos, attributes) => { - // go right while attributes[right.key] === right.value (or right is deleted) - while (true) { - if (currPos.right === null) { - break - } else if (currPos.right.deleted || (currPos.right.content.constructor === ContentFormat && equalAttrs(attributes[(/** @type {ContentFormat} */ (currPos.right.content)).key] || null, /** @type {ContentFormat} */ (currPos.right.content).value))) ; else { - break - } - currPos.forward(); - } - }; - - /** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {ItemTextListPosition} currPos - * @param {Object} attributes - * @return {Map} - * - * @private - * @function - **/ - const insertAttributes = (transaction, parent, currPos, attributes) => { - const doc = transaction.doc; - const ownClientId = doc.clientID; - const negatedAttributes = new Map(); - // insert format-start items - for (const key in attributes) { - const val = attributes[key]; - const currentVal = currPos.currentAttributes.get(key) || null; - if (!equalAttrs(currentVal, val)) { - // save negated attribute (set null if currentVal undefined) - negatedAttributes.set(key, currentVal); - const { left, right } = currPos; - currPos.right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentFormat(key, val)); - currPos.right.integrate(transaction, 0); - currPos.forward(); - } - } - return negatedAttributes - }; - - /** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {ItemTextListPosition} currPos - * @param {string|object|AbstractType} text - * @param {Object} attributes - * - * @private - * @function - **/ - const insertText = (transaction, parent, currPos, text, attributes) => { - currPos.currentAttributes.forEach((_val, key) => { - if (attributes[key] === undefined) { - attributes[key] = null; - } - }); - const doc = transaction.doc; - const ownClientId = doc.clientID; - minimizeAttributeChanges(currPos, attributes); - const negatedAttributes = insertAttributes(transaction, parent, currPos, attributes); - // insert content - const content = text.constructor === String ? new ContentString(/** @type {string} */ (text)) : (text instanceof AbstractType ? new ContentType(text) : new ContentEmbed(text)); - let { left, right, index } = currPos; - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, currPos.index, content.getLength()); - } - right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, content); - right.integrate(transaction, 0); - currPos.right = right; - currPos.index = index; - currPos.forward(); - insertNegatedAttributes(transaction, parent, currPos, negatedAttributes); - }; - - /** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {ItemTextListPosition} currPos - * @param {number} length - * @param {Object} attributes - * - * @private - * @function - */ - const formatText = (transaction, parent, currPos, length, attributes) => { - const doc = transaction.doc; - const ownClientId = doc.clientID; - minimizeAttributeChanges(currPos, attributes); - const negatedAttributes = insertAttributes(transaction, parent, currPos, attributes); - // iterate until first non-format or null is found - // delete all formats with attributes[format.key] != null - // also check the attributes after the first non-format as we do not want to insert redundant negated attributes there - // eslint-disable-next-line no-labels - iterationLoop: while ( - currPos.right !== null && - (length > 0 || - ( - negatedAttributes.size > 0 && - (currPos.right.deleted || currPos.right.content.constructor === ContentFormat) - ) - ) - ) { - if (!currPos.right.deleted) { - switch (currPos.right.content.constructor) { - case ContentFormat: { - const { key, value } = /** @type {ContentFormat} */ (currPos.right.content); - const attr = attributes[key]; - if (attr !== undefined) { - if (equalAttrs(attr, value)) { - negatedAttributes.delete(key); - } else { - if (length === 0) { - // no need to further extend negatedAttributes - // eslint-disable-next-line no-labels - break iterationLoop - } - negatedAttributes.set(key, value); - } - currPos.right.delete(transaction); - } else { - currPos.currentAttributes.set(key, value); - } - break - } - default: - if (length < currPos.right.length) { - getItemCleanStart(transaction, createID(currPos.right.id.client, currPos.right.id.clock + length)); - } - length -= currPos.right.length; - break - } - } - currPos.forward(); - } - // Quill just assumes that the editor starts with a newline and that it always - // ends with a newline. We only insert that newline when a new newline is - // inserted - i.e when length is bigger than type.length - if (length > 0) { - let newlines = ''; - for (; length > 0; length--) { - newlines += '\n'; - } - currPos.right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), currPos.left, currPos.left && currPos.left.lastId, currPos.right, currPos.right && currPos.right.id, parent, null, new ContentString(newlines)); - currPos.right.integrate(transaction, 0); - currPos.forward(); - } - insertNegatedAttributes(transaction, parent, currPos, negatedAttributes); - }; - - /** - * Call this function after string content has been deleted in order to - * clean up formatting Items. - * - * @param {Transaction} transaction - * @param {Item} start - * @param {Item|null} curr exclusive end, automatically iterates to the next Content Item - * @param {Map} startAttributes - * @param {Map} currAttributes - * @return {number} The amount of formatting Items deleted. - * - * @function - */ - const cleanupFormattingGap = (transaction, start, curr, startAttributes, currAttributes) => { - /** - * @type {Item|null} - */ - let end = start; - /** - * @type {Map} - */ - const endFormats = create$6(); - while (end && (!end.countable || end.deleted)) { - if (!end.deleted && end.content.constructor === ContentFormat) { - const cf = /** @type {ContentFormat} */ (end.content); - endFormats.set(cf.key, cf); - } - end = end.right; - } - let cleanups = 0; - let reachedCurr = false; - while (start !== end) { - if (curr === start) { - reachedCurr = true; - } - if (!start.deleted) { - const content = start.content; - switch (content.constructor) { - case ContentFormat: { - const { key, value } = /** @type {ContentFormat} */ (content); - const startAttrValue = startAttributes.get(key) || null; - if (endFormats.get(key) !== content || startAttrValue === value) { - // Either this format is overwritten or it is not necessary because the attribute already existed. - start.delete(transaction); - cleanups++; - if (!reachedCurr && (currAttributes.get(key) || null) === value && startAttrValue !== value) { - if (startAttrValue === null) { - currAttributes.delete(key); - } else { - currAttributes.set(key, startAttrValue); - } - } - } - if (!reachedCurr && !start.deleted) { - updateCurrentAttributes(currAttributes, /** @type {ContentFormat} */ (content)); - } - break - } - } - } - start = /** @type {Item} */ (start.right); - } - return cleanups - }; - - /** - * @param {Transaction} transaction - * @param {Item | null} item - */ - const cleanupContextlessFormattingGap = (transaction, item) => { - // iterate until item.right is null or content - while (item && item.right && (item.right.deleted || !item.right.countable)) { - item = item.right; - } - const attrs = new Set(); - // iterate back until a content item is found - while (item && (item.deleted || !item.countable)) { - if (!item.deleted && item.content.constructor === ContentFormat) { - const key = /** @type {ContentFormat} */ (item.content).key; - if (attrs.has(key)) { - item.delete(transaction); - } else { - attrs.add(key); - } - } - item = item.left; - } - }; - - /** - * This function is experimental and subject to change / be removed. - * - * Ideally, we don't need this function at all. Formatting attributes should be cleaned up - * automatically after each change. This function iterates twice over the complete YText type - * and removes unnecessary formatting attributes. This is also helpful for testing. - * - * This function won't be exported anymore as soon as there is confidence that the YText type works as intended. - * - * @param {YText} type - * @return {number} How many formatting attributes have been cleaned up. - */ - const cleanupYTextFormatting = type => { - let res = 0; - transact(/** @type {Doc} */ (type.doc), transaction => { - let start = /** @type {Item} */ (type._start); - let end = type._start; - let startAttributes = create$6(); - const currentAttributes = copy(startAttributes); - while (end) { - if (end.deleted === false) { - switch (end.content.constructor) { - case ContentFormat: - updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (end.content)); - break - default: - res += cleanupFormattingGap(transaction, start, end, startAttributes, currentAttributes); - startAttributes = copy(currentAttributes); - start = end; - break - } - } - end = end.right; - } - }); - return res - }; - - /** - * This will be called by the transction once the event handlers are called to potentially cleanup - * formatting attributes. - * - * @param {Transaction} transaction - */ - const cleanupYTextAfterTransaction = transaction => { - /** - * @type {Set} - */ - const needFullCleanup = new Set(); - // check if another formatting item was inserted - const doc = transaction.doc; - for (const [client, afterClock] of transaction.afterState.entries()) { - const clock = transaction.beforeState.get(client) || 0; - if (afterClock === clock) { - continue - } - iterateStructs(transaction, /** @type {Array} */ (doc.store.clients.get(client)), clock, afterClock, item => { - if ( - !item.deleted && /** @type {Item} */ (item).content.constructor === ContentFormat && item.constructor !== GC - ) { - needFullCleanup.add(/** @type {any} */ (item).parent); - } - }); - } - // cleanup in a new transaction - transact(doc, (t) => { - iterateDeletedStructs(transaction, transaction.deleteSet, item => { - if (item instanceof GC || !(/** @type {YText} */ (item.parent)._hasFormatting) || needFullCleanup.has(/** @type {YText} */ (item.parent))) { - return - } - const parent = /** @type {YText} */ (item.parent); - if (item.content.constructor === ContentFormat) { - needFullCleanup.add(parent); - } else { - // If no formatting attribute was inserted or deleted, we can make due with contextless - // formatting cleanups. - // Contextless: it is not necessary to compute currentAttributes for the affected position. - cleanupContextlessFormattingGap(t, item); - } - }); - // If a formatting item was inserted, we simply clean the whole type. - // We need to compute currentAttributes for the current position anyway. - for (const yText of needFullCleanup) { - cleanupYTextFormatting(yText); - } - }); - }; - - /** - * @param {Transaction} transaction - * @param {ItemTextListPosition} currPos - * @param {number} length - * @return {ItemTextListPosition} - * - * @private - * @function - */ - const deleteText = (transaction, currPos, length) => { - const startLength = length; - const startAttrs = copy(currPos.currentAttributes); - const start = currPos.right; - while (length > 0 && currPos.right !== null) { - if (currPos.right.deleted === false) { - switch (currPos.right.content.constructor) { - case ContentType: - case ContentEmbed: - case ContentString: - if (length < currPos.right.length) { - getItemCleanStart(transaction, createID(currPos.right.id.client, currPos.right.id.clock + length)); - } - length -= currPos.right.length; - currPos.right.delete(transaction); - break - } - } - currPos.forward(); - } - if (start) { - cleanupFormattingGap(transaction, start, currPos.right, startAttrs, currPos.currentAttributes); - } - const parent = /** @type {AbstractType} */ (/** @type {Item} */ (currPos.left || currPos.right).parent); - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, currPos.index, -startLength + length); - } - return currPos - }; - - /** - * The Quill Delta format represents changes on a text document with - * formatting information. For mor information visit {@link https://quilljs.com/docs/delta/|Quill Delta} - * - * @example - * { - * ops: [ - * { insert: 'Gandalf', attributes: { bold: true } }, - * { insert: ' the ' }, - * { insert: 'Grey', attributes: { color: '#cccccc' } } - * ] - * } - * - */ - - /** - * Attributes that can be assigned to a selection of text. - * - * @example - * { - * bold: true, - * font-size: '40px' - * } - * - * @typedef {Object} TextAttributes - */ - - /** - * @extends YEvent - * Event that describes the changes on a YText type. - */ - class YTextEvent extends YEvent { - /** - * @param {YText} ytext - * @param {Transaction} transaction - * @param {Set} subs The keys that changed - */ - constructor (ytext, transaction, subs) { - super(ytext, transaction); - /** - * Whether the children changed. - * @type {Boolean} - * @private - */ - this.childListChanged = false; - /** - * Set of all changed attributes. - * @type {Set} - */ - this.keysChanged = new Set(); - subs.forEach((sub) => { - if (sub === null) { - this.childListChanged = true; - } else { - this.keysChanged.add(sub); - } - }); - } - - /** - * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string, delete?:number, retain?:number}>}} - */ - get changes () { - if (this._changes === null) { - /** - * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string|AbstractType|object, delete?:number, retain?:number}>}} - */ - const changes = { - keys: this.keys, - delta: this.delta, - added: new Set(), - deleted: new Set() - }; - this._changes = changes; - } - return /** @type {any} */ (this._changes) - } - - /** - * Compute the changes in the delta format. - * A {@link https://quilljs.com/docs/delta/|Quill Delta}) that represents the changes on the document. - * - * @type {Array<{insert?:string|object|AbstractType, delete?:number, retain?:number, attributes?: Object}>} - * - * @public - */ - get delta () { - if (this._delta === null) { - const y = /** @type {Doc} */ (this.target.doc); - /** - * @type {Array<{insert?:string|object|AbstractType, delete?:number, retain?:number, attributes?: Object}>} - */ - const delta = []; - transact(y, transaction => { - const currentAttributes = new Map(); // saves all current attributes for insert - const oldAttributes = new Map(); - let item = this.target._start; - /** - * @type {string?} - */ - let action = null; - /** - * @type {Object} - */ - const attributes = {}; // counts added or removed new attributes for retain - /** - * @type {string|object} - */ - let insert = ''; - let retain = 0; - let deleteLen = 0; - const addOp = () => { - if (action !== null) { - /** - * @type {any} - */ - let op = null; - switch (action) { - case 'delete': - if (deleteLen > 0) { - op = { delete: deleteLen }; - } - deleteLen = 0; - break - case 'insert': - if (typeof insert === 'object' || insert.length > 0) { - op = { insert }; - if (currentAttributes.size > 0) { - op.attributes = {}; - currentAttributes.forEach((value, key) => { - if (value !== null) { - op.attributes[key] = value; - } - }); - } - } - insert = ''; - break - case 'retain': - if (retain > 0) { - op = { retain }; - if (!isEmpty(attributes)) { - op.attributes = assign({}, attributes); - } - } - retain = 0; - break - } - if (op) delta.push(op); - action = null; - } - }; - while (item !== null) { - switch (item.content.constructor) { - case ContentType: - case ContentEmbed: - if (this.adds(item)) { - if (!this.deletes(item)) { - addOp(); - action = 'insert'; - insert = item.content.getContent()[0]; - addOp(); - } - } else if (this.deletes(item)) { - if (action !== 'delete') { - addOp(); - action = 'delete'; - } - deleteLen += 1; - } else if (!item.deleted) { - if (action !== 'retain') { - addOp(); - action = 'retain'; - } - retain += 1; - } - break - case ContentString: - if (this.adds(item)) { - if (!this.deletes(item)) { - if (action !== 'insert') { - addOp(); - action = 'insert'; - } - insert += /** @type {ContentString} */ (item.content).str; - } - } else if (this.deletes(item)) { - if (action !== 'delete') { - addOp(); - action = 'delete'; - } - deleteLen += item.length; - } else if (!item.deleted) { - if (action !== 'retain') { - addOp(); - action = 'retain'; - } - retain += item.length; - } - break - case ContentFormat: { - const { key, value } = /** @type {ContentFormat} */ (item.content); - if (this.adds(item)) { - if (!this.deletes(item)) { - const curVal = currentAttributes.get(key) || null; - if (!equalAttrs(curVal, value)) { - if (action === 'retain') { - addOp(); - } - if (equalAttrs(value, (oldAttributes.get(key) || null))) { - delete attributes[key]; - } else { - attributes[key] = value; - } - } else if (value !== null) { - item.delete(transaction); - } - } - } else if (this.deletes(item)) { - oldAttributes.set(key, value); - const curVal = currentAttributes.get(key) || null; - if (!equalAttrs(curVal, value)) { - if (action === 'retain') { - addOp(); - } - attributes[key] = curVal; - } - } else if (!item.deleted) { - oldAttributes.set(key, value); - const attr = attributes[key]; - if (attr !== undefined) { - if (!equalAttrs(attr, value)) { - if (action === 'retain') { - addOp(); - } - if (value === null) { - delete attributes[key]; - } else { - attributes[key] = value; - } - } else if (attr !== null) { // this will be cleaned up automatically by the contextless cleanup function - item.delete(transaction); - } - } - } - if (!item.deleted) { - if (action === 'insert') { - addOp(); - } - updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (item.content)); - } - break - } - } - item = item.right; - } - addOp(); - while (delta.length > 0) { - const lastOp = delta[delta.length - 1]; - if (lastOp.retain !== undefined && lastOp.attributes === undefined) { - // retain delta's if they don't assign attributes - delta.pop(); - } else { - break - } - } - }); - this._delta = delta; - } - return /** @type {any} */ (this._delta) - } - } - - /** - * Type that represents text with formatting information. - * - * This type replaces y-richtext as this implementation is able to handle - * block formats (format information on a paragraph), embeds (complex elements - * like pictures and videos), and text formats (**bold**, *italic*). - * - * @extends AbstractType - */ - class YText extends AbstractType { - /** - * @param {String} [string] The initial value of the YText. - */ - constructor (string) { - super(); - /** - * Array of pending operations on this type - * @type {Array?} - */ - this._pending = string !== undefined ? [() => this.insert(0, string)] : []; - /** - * @type {Array|null} - */ - this._searchMarker = []; - /** - * Whether this YText contains formatting attributes. - * This flag is updated when a formatting item is integrated (see ContentFormat.integrate) - */ - this._hasFormatting = false; - } - - /** - * Number of characters of this text type. - * - * @type {number} - */ - get length () { - return this._length - } - - /** - * @param {Doc} y - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item); - try { - /** @type {Array} */ (this._pending).forEach(f => f()); - } catch (e) { - console.error(e); - } - this._pending = null; - } - - _copy () { - return new YText() - } - - /** - * @return {YText} - */ - clone () { - const text = new YText(); - text.applyDelta(this.toDelta()); - return text - } - - /** - * Creates YTextEvent and calls observers. - * - * @param {Transaction} transaction - * @param {Set} parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, parentSubs) { - super._callObserver(transaction, parentSubs); - const event = new YTextEvent(this, transaction, parentSubs); - callTypeObservers(this, transaction, event); - // If a remote change happened, we try to cleanup potential formatting duplicates. - if (!transaction.local && this._hasFormatting) { - transaction._needFormattingCleanup = true; - } - } - - /** - * Returns the unformatted string representation of this YText type. - * - * @public - */ - toString () { - let str = ''; - /** - * @type {Item|null} - */ - let n = this._start; - while (n !== null) { - if (!n.deleted && n.countable && n.content.constructor === ContentString) { - str += /** @type {ContentString} */ (n.content).str; - } - n = n.right; - } - return str - } - - /** - * Returns the unformatted string representation of this YText type. - * - * @return {string} - * @public - */ - toJSON () { - return this.toString() - } - - /** - * Apply a {@link Delta} on this shared YText type. - * - * @param {any} delta The changes to apply on this element. - * @param {object} opts - * @param {boolean} [opts.sanitize] Sanitize input delta. Removes ending newlines if set to true. - * - * - * @public - */ - applyDelta (delta, { sanitize = true } = {}) { - if (this.doc !== null) { - transact(this.doc, transaction => { - const currPos = new ItemTextListPosition(null, this._start, 0, new Map()); - for (let i = 0; i < delta.length; i++) { - const op = delta[i]; - if (op.insert !== undefined) { - // Quill assumes that the content starts with an empty paragraph. - // Yjs/Y.Text assumes that it starts empty. We always hide that - // there is a newline at the end of the content. - // If we omit this step, clients will see a different number of - // paragraphs, but nothing bad will happen. - const ins = (!sanitize && typeof op.insert === 'string' && i === delta.length - 1 && currPos.right === null && op.insert.slice(-1) === '\n') ? op.insert.slice(0, -1) : op.insert; - if (typeof ins !== 'string' || ins.length > 0) { - insertText(transaction, this, currPos, ins, op.attributes || {}); - } - } else if (op.retain !== undefined) { - formatText(transaction, this, currPos, op.retain, op.attributes || {}); - } else if (op.delete !== undefined) { - deleteText(transaction, currPos, op.delete); - } - } - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.applyDelta(delta)); - } - } - - /** - * Returns the Delta representation of this YText type. - * - * @param {Snapshot} [snapshot] - * @param {Snapshot} [prevSnapshot] - * @param {function('removed' | 'added', ID):any} [computeYChange] - * @return {any} The Delta representation of this type. - * - * @public - */ - toDelta (snapshot, prevSnapshot, computeYChange) { - /** - * @type{Array} - */ - const ops = []; - const currentAttributes = new Map(); - const doc = /** @type {Doc} */ (this.doc); - let str = ''; - let n = this._start; - function packStr () { - if (str.length > 0) { - // pack str with attributes to ops - /** - * @type {Object} - */ - const attributes = {}; - let addAttributes = false; - currentAttributes.forEach((value, key) => { - addAttributes = true; - attributes[key] = value; - }); - /** - * @type {Object} - */ - const op = { insert: str }; - if (addAttributes) { - op.attributes = attributes; - } - ops.push(op); - str = ''; - } - } - const computeDelta = () => { - while (n !== null) { - if (isVisible(n, snapshot) || (prevSnapshot !== undefined && isVisible(n, prevSnapshot))) { - switch (n.content.constructor) { - case ContentString: { - const cur = currentAttributes.get('ychange'); - if (snapshot !== undefined && !isVisible(n, snapshot)) { - if (cur === undefined || cur.user !== n.id.client || cur.type !== 'removed') { - packStr(); - currentAttributes.set('ychange', computeYChange ? computeYChange('removed', n.id) : { type: 'removed' }); - } - } else if (prevSnapshot !== undefined && !isVisible(n, prevSnapshot)) { - if (cur === undefined || cur.user !== n.id.client || cur.type !== 'added') { - packStr(); - currentAttributes.set('ychange', computeYChange ? computeYChange('added', n.id) : { type: 'added' }); - } - } else if (cur !== undefined) { - packStr(); - currentAttributes.delete('ychange'); - } - str += /** @type {ContentString} */ (n.content).str; - break - } - case ContentType: - case ContentEmbed: { - packStr(); - /** - * @type {Object} - */ - const op = { - insert: n.content.getContent()[0] - }; - if (currentAttributes.size > 0) { - const attrs = /** @type {Object} */ ({}); - op.attributes = attrs; - currentAttributes.forEach((value, key) => { - attrs[key] = value; - }); - } - ops.push(op); - break - } - case ContentFormat: - if (isVisible(n, snapshot)) { - packStr(); - updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (n.content)); - } - break - } - } - n = n.right; - } - packStr(); - }; - if (snapshot || prevSnapshot) { - // snapshots are merged again after the transaction, so we need to keep the - // transaction alive until we are done - transact(doc, transaction => { - if (snapshot) { - splitSnapshotAffectedStructs(transaction, snapshot); - } - if (prevSnapshot) { - splitSnapshotAffectedStructs(transaction, prevSnapshot); - } - computeDelta(); - }, 'cleanup'); - } else { - computeDelta(); - } - return ops - } - - /** - * Insert text at a given index. - * - * @param {number} index The index at which to start inserting. - * @param {String} text The text to insert at the specified position. - * @param {TextAttributes} [attributes] Optionally define some formatting - * information to apply on the inserted - * Text. - * @public - */ - insert (index, text, attributes) { - if (text.length <= 0) { - return - } - const y = this.doc; - if (y !== null) { - transact(y, transaction => { - const pos = findPosition(transaction, this, index); - if (!attributes) { - attributes = {}; - // @ts-ignore - pos.currentAttributes.forEach((v, k) => { attributes[k] = v; }); - } - insertText(transaction, this, pos, text, attributes); - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.insert(index, text, attributes)); - } - } - - /** - * Inserts an embed at a index. - * - * @param {number} index The index to insert the embed at. - * @param {Object | AbstractType} embed The Object that represents the embed. - * @param {TextAttributes} attributes Attribute information to apply on the - * embed - * - * @public - */ - insertEmbed (index, embed, attributes = {}) { - const y = this.doc; - if (y !== null) { - transact(y, transaction => { - const pos = findPosition(transaction, this, index); - insertText(transaction, this, pos, embed, attributes); - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.insertEmbed(index, embed, attributes)); - } - } - - /** - * Deletes text starting from an index. - * - * @param {number} index Index at which to start deleting. - * @param {number} length The number of characters to remove. Defaults to 1. - * - * @public - */ - delete (index, length) { - if (length === 0) { - return - } - const y = this.doc; - if (y !== null) { - transact(y, transaction => { - deleteText(transaction, findPosition(transaction, this, index), length); - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.delete(index, length)); - } - } - - /** - * Assigns properties to a range of text. - * - * @param {number} index The position where to start formatting. - * @param {number} length The amount of characters to assign properties to. - * @param {TextAttributes} attributes Attribute information to apply on the - * text. - * - * @public - */ - format (index, length, attributes) { - if (length === 0) { - return - } - const y = this.doc; - if (y !== null) { - transact(y, transaction => { - const pos = findPosition(transaction, this, index); - if (pos.right === null) { - return - } - formatText(transaction, this, pos, length, attributes); - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.format(index, length, attributes)); - } - } - - /** - * Removes an attribute. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @param {String} attributeName The attribute name that is to be removed. - * - * @public - */ - removeAttribute (attributeName) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapDelete(transaction, this, attributeName); - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.removeAttribute(attributeName)); - } - } - - /** - * Sets or updates an attribute. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @param {String} attributeName The attribute name that is to be set. - * @param {any} attributeValue The attribute value that is to be set. - * - * @public - */ - setAttribute (attributeName, attributeValue) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapSet(transaction, this, attributeName, attributeValue); - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.setAttribute(attributeName, attributeValue)); - } - } - - /** - * Returns an attribute value that belongs to the attribute name. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @param {String} attributeName The attribute name that identifies the - * queried value. - * @return {any} The queried attribute value. - * - * @public - */ - getAttribute (attributeName) { - return /** @type {any} */ (typeMapGet(this, attributeName)) - } - - /** - * Returns all attribute name/value pairs in a JSON Object. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @return {Object} A JSON Object that describes the attributes. - * - * @public - */ - getAttributes () { - return typeMapGetAll(this) - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - */ - _write (encoder) { - encoder.writeTypeRef(YTextRefID); - } - } - - /** - * @module YXml - */ - - /** - * Define the elements to which a set of CSS queries apply. - * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors|CSS_Selectors} - * - * @example - * query = '.classSelector' - * query = 'nodeSelector' - * query = '#idSelector' - * - * @typedef {string} CSS_Selector - */ - - /** - * Dom filter function. - * - * @callback domFilter - * @param {string} nodeName The nodeName of the element - * @param {Map} attributes The map of attributes. - * @return {boolean} Whether to include the Dom node in the YXmlElement. - */ - - /** - * Represents a subset of the nodes of a YXmlElement / YXmlFragment and a - * position within them. - * - * Can be created with {@link YXmlFragment#createTreeWalker} - * - * @public - * @implements {Iterable} - */ - class YXmlTreeWalker { - /** - * @param {YXmlFragment | YXmlElement} root - * @param {function(AbstractType):boolean} [f] - */ - constructor (root, f = () => true) { - this._filter = f; - this._root = root; - /** - * @type {Item} - */ - this._currentNode = /** @type {Item} */ (root._start); - this._firstCall = true; - } - - [Symbol.iterator] () { - return this - } - - /** - * Get the next node. - * - * @return {IteratorResult} The next node. - * - * @public - */ - next () { - /** - * @type {Item|null} - */ - let n = this._currentNode; - let type = n && n.content && /** @type {any} */ (n.content).type; - if (n !== null && (!this._firstCall || n.deleted || !this._filter(type))) { // if first call, we check if we can use the first item - do { - type = /** @type {any} */ (n.content).type; - if (!n.deleted && (type.constructor === YXmlElement || type.constructor === YXmlFragment) && type._start !== null) { - // walk down in the tree - n = type._start; - } else { - // walk right or up in the tree - while (n !== null) { - if (n.right !== null) { - n = n.right; - break - } else if (n.parent === this._root) { - n = null; - } else { - n = /** @type {AbstractType} */ (n.parent)._item; - } - } - } - } while (n !== null && (n.deleted || !this._filter(/** @type {ContentType} */ (n.content).type))) - } - this._firstCall = false; - if (n === null) { - // @ts-ignore - return { value: undefined, done: true } - } - this._currentNode = n; - return { value: /** @type {any} */ (n.content).type, done: false } - } - } - - /** - * Represents a list of {@link YXmlElement}.and {@link YXmlText} types. - * A YxmlFragment is similar to a {@link YXmlElement}, but it does not have a - * nodeName and it does not have attributes. Though it can be bound to a DOM - * element - in this case the attributes and the nodeName are not shared. - * - * @public - * @extends AbstractType - */ - class YXmlFragment extends AbstractType { - constructor () { - super(); - /** - * @type {Array|null} - */ - this._prelimContent = []; - } - - /** - * @type {YXmlElement|YXmlText|null} - */ - get firstChild () { - const first = this._first; - return first ? first.content.getContent()[0] : null - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item); - this.insert(0, /** @type {Array} */ (this._prelimContent)); - this._prelimContent = null; - } - - _copy () { - return new YXmlFragment() - } - - /** - * @return {YXmlFragment} - */ - clone () { - const el = new YXmlFragment(); - // @ts-ignore - el.insert(0, this.toArray().map(item => item instanceof AbstractType ? item.clone() : item)); - return el - } - - get length () { - return this._prelimContent === null ? this._length : this._prelimContent.length - } - - /** - * Create a subtree of childNodes. - * - * @example - * const walker = elem.createTreeWalker(dom => dom.nodeName === 'div') - * for (let node in walker) { - * // `node` is a div node - * nop(node) - * } - * - * @param {function(AbstractType):boolean} filter Function that is called on each child element and - * returns a Boolean indicating whether the child - * is to be included in the subtree. - * @return {YXmlTreeWalker} A subtree and a position within it. - * - * @public - */ - createTreeWalker (filter) { - return new YXmlTreeWalker(this, filter) - } - - /** - * Returns the first YXmlElement that matches the query. - * Similar to DOM's {@link querySelector}. - * - * Query support: - * - tagname - * TODO: - * - id - * - attribute - * - * @param {CSS_Selector} query The query on the children. - * @return {YXmlElement|YXmlText|YXmlHook|null} The first element that matches the query or null. - * - * @public - */ - querySelector (query) { - query = query.toUpperCase(); - // @ts-ignore - const iterator = new YXmlTreeWalker(this, element => element.nodeName && element.nodeName.toUpperCase() === query); - const next = iterator.next(); - if (next.done) { - return null - } else { - return next.value - } - } - - /** - * Returns all YXmlElements that match the query. - * Similar to Dom's {@link querySelectorAll}. - * - * @todo Does not yet support all queries. Currently only query by tagName. - * - * @param {CSS_Selector} query The query on the children - * @return {Array} The elements that match this query. - * - * @public - */ - querySelectorAll (query) { - query = query.toUpperCase(); - // @ts-ignore - return from(new YXmlTreeWalker(this, element => element.nodeName && element.nodeName.toUpperCase() === query)) - } - - /** - * Creates YXmlEvent and calls observers. - * - * @param {Transaction} transaction - * @param {Set} parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, parentSubs) { - callTypeObservers(this, transaction, new YXmlEvent(this, parentSubs, transaction)); - } - - /** - * Get the string representation of all the children of this YXmlFragment. - * - * @return {string} The string representation of all children. - */ - toString () { - return typeListMap(this, xml => xml.toString()).join('') - } - - /** - * @return {string} - */ - toJSON () { - return this.toString() - } - - /** - * Creates a Dom Element that mirrors this YXmlElement. - * - * @param {Document} [_document=document] The document object (you must define - * this when calling this method in - * nodejs) - * @param {Object} [hooks={}] Optional property to customize how hooks - * are presented in the DOM - * @param {any} [binding] You should not set this property. This is - * used if DomBinding wants to create a - * association to the created DOM type. - * @return {Node} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element} - * - * @public - */ - toDOM (_document = document, hooks = {}, binding) { - const fragment = _document.createDocumentFragment(); - if (binding !== undefined) { - binding._createAssociation(fragment, this); - } - typeListForEach(this, xmlType => { - fragment.insertBefore(xmlType.toDOM(_document, hooks, binding), null); - }); - return fragment - } - - /** - * Inserts new content at an index. - * - * @example - * // Insert character 'a' at position 0 - * xml.insert(0, [new Y.XmlText('text')]) - * - * @param {number} index The index to insert content at - * @param {Array} content The array of content - */ - insert (index, content) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListInsertGenerics(transaction, this, index, content); - }); - } else { - // @ts-ignore _prelimContent is defined because this is not yet integrated - this._prelimContent.splice(index, 0, ...content); - } - } - - /** - * Inserts new content at an index. - * - * @example - * // Insert character 'a' at position 0 - * xml.insert(0, [new Y.XmlText('text')]) - * - * @param {null|Item|YXmlElement|YXmlText} ref The index to insert content at - * @param {Array} content The array of content - */ - insertAfter (ref, content) { - if (this.doc !== null) { - transact(this.doc, transaction => { - const refItem = (ref && ref instanceof AbstractType) ? ref._item : ref; - typeListInsertGenericsAfter(transaction, this, refItem, content); - }); - } else { - const pc = /** @type {Array} */ (this._prelimContent); - const index = ref === null ? 0 : pc.findIndex(el => el === ref) + 1; - if (index === 0 && ref !== null) { - throw create$2('Reference item not found') - } - pc.splice(index, 0, ...content); - } - } - - /** - * Deletes elements starting from an index. - * - * @param {number} index Index at which to start deleting elements - * @param {number} [length=1] The number of elements to remove. Defaults to 1. - */ - delete (index, length = 1) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListDelete(transaction, this, index, length); - }); - } else { - // @ts-ignore _prelimContent is defined because this is not yet integrated - this._prelimContent.splice(index, length); - } - } - - /** - * Transforms this YArray to a JavaScript Array. - * - * @return {Array} - */ - toArray () { - return typeListToArray(this) - } - - /** - * Appends content to this YArray. - * - * @param {Array} content Array of content to append. - */ - push (content) { - this.insert(this.length, content); - } - - /** - * Preppends content to this YArray. - * - * @param {Array} content Array of content to preppend. - */ - unshift (content) { - this.insert(0, content); - } - - /** - * Returns the i-th element from a YArray. - * - * @param {number} index The index of the element to return from the YArray - * @return {YXmlElement|YXmlText} - */ - get (index) { - return typeListGet(this, index) - } - - /** - * Transforms this YArray to a JavaScript Array. - * - * @param {number} [start] - * @param {number} [end] - * @return {Array} - */ - slice (start = 0, end = this.length) { - return typeListSlice(this, start, end) - } - - /** - * Executes a provided function on once on overy child element. - * - * @param {function(YXmlElement|YXmlText,number, typeof self):void} f A function to execute on every element of this YArray. - */ - forEach (f) { - typeListForEach(this, f); - } - - /** - * Transform the properties of this type to binary and write it to an - * BinaryEncoder. - * - * This is called when this Item is sent to a remote peer. - * - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - */ - _write (encoder) { - encoder.writeTypeRef(YXmlFragmentRefID); - } - } - - /** - * @typedef {Object|number|null|Array|string|Uint8Array|AbstractType} ValueTypes - */ - - /** - * An YXmlElement imitates the behavior of a - * {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element}. - * - * * An YXmlElement has attributes (key value pairs) - * * An YXmlElement has childElements that must inherit from YXmlElement - * - * @template {{ [key: string]: ValueTypes }} [KV={ [key: string]: string }] - */ - class YXmlElement extends YXmlFragment { - constructor (nodeName = 'UNDEFINED') { - super(); - this.nodeName = nodeName; - /** - * @type {Map|null} - */ - this._prelimAttrs = new Map(); - } - - /** - * @type {YXmlElement|YXmlText|null} - */ - get nextSibling () { - const n = this._item ? this._item.next : null; - return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null - } - - /** - * @type {YXmlElement|YXmlText|null} - */ - get prevSibling () { - const n = this._item ? this._item.prev : null; - return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item) - ;(/** @type {Map} */ (this._prelimAttrs)).forEach((value, key) => { - this.setAttribute(key, value); - }); - this._prelimAttrs = null; - } - - /** - * Creates an Item with the same effect as this Item (without position effect) - * - * @return {YXmlElement} - */ - _copy () { - return new YXmlElement(this.nodeName) - } - - /** - * @return {YXmlElement} - */ - clone () { - /** - * @type {YXmlElement} - */ - const el = new YXmlElement(this.nodeName); - const attrs = this.getAttributes(); - forEach$1(attrs, (value, key) => { - if (typeof value === 'string') { - el.setAttribute(key, value); - } - }); - // @ts-ignore - el.insert(0, this.toArray().map(item => item instanceof AbstractType ? item.clone() : item)); - return el - } - - /** - * Returns the XML serialization of this YXmlElement. - * The attributes are ordered by attribute-name, so you can easily use this - * method to compare YXmlElements - * - * @return {string} The string representation of this type. - * - * @public - */ - toString () { - const attrs = this.getAttributes(); - const stringBuilder = []; - const keys = []; - for (const key in attrs) { - keys.push(key); - } - keys.sort(); - const keysLen = keys.length; - for (let i = 0; i < keysLen; i++) { - const key = keys[i]; - stringBuilder.push(key + '="' + attrs[key] + '"'); - } - const nodeName = this.nodeName.toLocaleLowerCase(); - const attrsString = stringBuilder.length > 0 ? ' ' + stringBuilder.join(' ') : ''; - return `<${nodeName}${attrsString}>${super.toString()}` - } - - /** - * Removes an attribute from this YXmlElement. - * - * @param {string} attributeName The attribute name that is to be removed. - * - * @public - */ - removeAttribute (attributeName) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapDelete(transaction, this, attributeName); - }); - } else { - /** @type {Map} */ (this._prelimAttrs).delete(attributeName); - } - } - - /** - * Sets or updates an attribute. - * - * @template {keyof KV & string} KEY - * - * @param {KEY} attributeName The attribute name that is to be set. - * @param {KV[KEY]} attributeValue The attribute value that is to be set. - * - * @public - */ - setAttribute (attributeName, attributeValue) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapSet(transaction, this, attributeName, attributeValue); - }); - } else { - /** @type {Map} */ (this._prelimAttrs).set(attributeName, attributeValue); - } - } - - /** - * Returns an attribute value that belongs to the attribute name. - * - * @template {keyof KV & string} KEY - * - * @param {KEY} attributeName The attribute name that identifies the - * queried value. - * @return {KV[KEY]|undefined} The queried attribute value. - * - * @public - */ - getAttribute (attributeName) { - return /** @type {any} */ (typeMapGet(this, attributeName)) - } - - /** - * Returns whether an attribute exists - * - * @param {string} attributeName The attribute name to check for existence. - * @return {boolean} whether the attribute exists. - * - * @public - */ - hasAttribute (attributeName) { - return /** @type {any} */ (typeMapHas(this, attributeName)) - } - - /** - * Returns all attribute name/value pairs in a JSON Object. - * - * @return {{ [Key in Extract]?: KV[Key]}} A JSON Object that describes the attributes. - * - * @public - */ - getAttributes () { - return /** @type {any} */ (typeMapGetAll(this)) - } - - /** - * Creates a Dom Element that mirrors this YXmlElement. - * - * @param {Document} [_document=document] The document object (you must define - * this when calling this method in - * nodejs) - * @param {Object} [hooks={}] Optional property to customize how hooks - * are presented in the DOM - * @param {any} [binding] You should not set this property. This is - * used if DomBinding wants to create a - * association to the created DOM type. - * @return {Node} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element} - * - * @public - */ - toDOM (_document = document, hooks = {}, binding) { - const dom = _document.createElement(this.nodeName); - const attrs = this.getAttributes(); - for (const key in attrs) { - const value = attrs[key]; - if (typeof value === 'string') { - dom.setAttribute(key, value); - } - } - typeListForEach(this, yxml => { - dom.appendChild(yxml.toDOM(_document, hooks, binding)); - }); - if (binding !== undefined) { - binding._createAssociation(dom, this); - } - return dom - } - - /** - * Transform the properties of this type to binary and write it to an - * BinaryEncoder. - * - * This is called when this Item is sent to a remote peer. - * - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - */ - _write (encoder) { - encoder.writeTypeRef(YXmlElementRefID); - encoder.writeKey(this.nodeName); - } - } - - /** - * @extends YEvent - * An Event that describes changes on a YXml Element or Yxml Fragment - */ - class YXmlEvent extends YEvent { - /** - * @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created. - * @param {Set} subs The set of changed attributes. `null` is included if the - * child list changed. - * @param {Transaction} transaction The transaction instance with wich the - * change was created. - */ - constructor (target, subs, transaction) { - super(target, transaction); - /** - * Whether the children changed. - * @type {Boolean} - * @private - */ - this.childListChanged = false; - /** - * Set of all changed attributes. - * @type {Set} - */ - this.attributesChanged = new Set(); - subs.forEach((sub) => { - if (sub === null) { - this.childListChanged = true; - } else { - this.attributesChanged.add(sub); - } - }); - } - } - - class AbstractStruct { - /** - * @param {ID} id - * @param {number} length - */ - constructor (id, length) { - this.id = id; - this.length = length; - } - - /** - * @type {boolean} - */ - get deleted () { - throw methodUnimplemented() - } - - /** - * Merge this struct with the item to the right. - * This method is already assuming that `this.id.clock + this.length === this.id.clock`. - * Also this method does *not* remove right from StructStore! - * @param {AbstractStruct} right - * @return {boolean} wether this merged with right - */ - mergeWith (right) { - return false - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - * @param {number} offset - * @param {number} encodingRef - */ - write (encoder, offset, encodingRef) { - throw methodUnimplemented() - } - - /** - * @param {Transaction} transaction - * @param {number} offset - */ - integrate (transaction, offset) { - throw methodUnimplemented() - } - } - - const structGCRefNumber = 0; - - /** - * @private - */ - class GC extends AbstractStruct { - get deleted () { - return true - } - - delete () {} - - /** - * @param {GC} right - * @return {boolean} - */ - mergeWith (right) { - if (this.constructor !== right.constructor) { - return false - } - this.length += right.length; - return true - } - - /** - * @param {Transaction} transaction - * @param {number} offset - */ - integrate (transaction, offset) { - if (offset > 0) { - this.id.clock += offset; - this.length -= offset; - } - addStruct(transaction.doc.store, this); - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeInfo(structGCRefNumber); - encoder.writeLen(this.length - offset); - } - - /** - * @param {Transaction} transaction - * @param {StructStore} store - * @return {null | number} - */ - getMissing (transaction, store) { - return null - } - } - - class ContentBinary { - /** - * @param {Uint8Array} content - */ - constructor (content) { - this.content = content; - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [this.content] - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentBinary} - */ - copy () { - return new ContentBinary(this.content) - } - - /** - * @param {number} offset - * @return {ContentBinary} - */ - splice (offset) { - throw methodUnimplemented() - } - - /** - * @param {ContentBinary} right - * @return {boolean} - */ - mergeWith (right) { - return false - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) {} - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeBuf(this.content); - } - - /** - * @return {number} - */ - getRef () { - return 3 - } - } - - class ContentDeleted { - /** - * @param {number} len - */ - constructor (len) { - this.len = len; - } - - /** - * @return {number} - */ - getLength () { - return this.len - } - - /** - * @return {Array} - */ - getContent () { - return [] - } - - /** - * @return {boolean} - */ - isCountable () { - return false - } - - /** - * @return {ContentDeleted} - */ - copy () { - return new ContentDeleted(this.len) - } - - /** - * @param {number} offset - * @return {ContentDeleted} - */ - splice (offset) { - const right = new ContentDeleted(this.len - offset); - this.len = offset; - return right - } - - /** - * @param {ContentDeleted} right - * @return {boolean} - */ - mergeWith (right) { - this.len += right.len; - return true - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) { - addToDeleteSet(transaction.deleteSet, item.id.client, item.id.clock, this.len); - item.markDeleted(); - } - - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeLen(this.len - offset); - } - - /** - * @return {number} - */ - getRef () { - return 1 - } - } - - /** - * @param {string} guid - * @param {Object} opts - */ - const createDocFromOpts = (guid, opts) => new Doc({ guid, ...opts, shouldLoad: opts.shouldLoad || opts.autoLoad || false }); - - /** - * @private - */ - class ContentDoc { - /** - * @param {Doc} doc - */ - constructor (doc) { - if (doc._item) { - console.error('This document was already integrated as a sub-document. You should create a second instance instead with the same guid.'); - } - /** - * @type {Doc} - */ - this.doc = doc; - /** - * @type {any} - */ - const opts = {}; - this.opts = opts; - if (!doc.gc) { - opts.gc = false; - } - if (doc.autoLoad) { - opts.autoLoad = true; - } - if (doc.meta !== null) { - opts.meta = doc.meta; - } - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [this.doc] - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentDoc} - */ - copy () { - return new ContentDoc(createDocFromOpts(this.doc.guid, this.opts)) - } - - /** - * @param {number} offset - * @return {ContentDoc} - */ - splice (offset) { - throw methodUnimplemented() - } - - /** - * @param {ContentDoc} right - * @return {boolean} - */ - mergeWith (right) { - return false - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) { - // this needs to be reflected in doc.destroy as well - this.doc._item = item; - transaction.subdocsAdded.add(this.doc); - if (this.doc.shouldLoad) { - transaction.subdocsLoaded.add(this.doc); - } - } - - /** - * @param {Transaction} transaction - */ - delete (transaction) { - if (transaction.subdocsAdded.has(this.doc)) { - transaction.subdocsAdded.delete(this.doc); - } else { - transaction.subdocsRemoved.add(this.doc); - } - } - - /** - * @param {StructStore} store - */ - gc (store) { } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeString(this.doc.guid); - encoder.writeAny(this.opts); - } - - /** - * @return {number} - */ - getRef () { - return 9 - } - } - - /** - * @private - */ - class ContentEmbed { - /** - * @param {Object} embed - */ - constructor (embed) { - this.embed = embed; - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [this.embed] - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentEmbed} - */ - copy () { - return new ContentEmbed(this.embed) - } - - /** - * @param {number} offset - * @return {ContentEmbed} - */ - splice (offset) { - throw methodUnimplemented() - } - - /** - * @param {ContentEmbed} right - * @return {boolean} - */ - mergeWith (right) { - return false - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) {} - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeJSON(this.embed); - } - - /** - * @return {number} - */ - getRef () { - return 5 - } - } - - /** - * @private - */ - class ContentFormat { - /** - * @param {string} key - * @param {Object} value - */ - constructor (key, value) { - this.key = key; - this.value = value; - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [] - } - - /** - * @return {boolean} - */ - isCountable () { - return false - } - - /** - * @return {ContentFormat} - */ - copy () { - return new ContentFormat(this.key, this.value) - } - - /** - * @param {number} _offset - * @return {ContentFormat} - */ - splice (_offset) { - throw methodUnimplemented() - } - - /** - * @param {ContentFormat} _right - * @return {boolean} - */ - mergeWith (_right) { - return false - } - - /** - * @param {Transaction} _transaction - * @param {Item} item - */ - integrate (_transaction, item) { - // @todo searchmarker are currently unsupported for rich text documents - const p = /** @type {YText} */ (item.parent); - p._searchMarker = null; - p._hasFormatting = true; - } - - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeKey(this.key); - encoder.writeJSON(this.value); - } - - /** - * @return {number} - */ - getRef () { - return 6 - } - } - - class ContentAny { - /** - * @param {Array} arr - */ - constructor (arr) { - /** - * @type {Array} - */ - this.arr = arr; - } - - /** - * @return {number} - */ - getLength () { - return this.arr.length - } - - /** - * @return {Array} - */ - getContent () { - return this.arr - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentAny} - */ - copy () { - return new ContentAny(this.arr) - } - - /** - * @param {number} offset - * @return {ContentAny} - */ - splice (offset) { - const right = new ContentAny(this.arr.slice(offset)); - this.arr = this.arr.slice(0, offset); - return right - } - - /** - * @param {ContentAny} right - * @return {boolean} - */ - mergeWith (right) { - this.arr = this.arr.concat(right.arr); - return true - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) {} - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - const len = this.arr.length; - encoder.writeLen(len - offset); - for (let i = offset; i < len; i++) { - const c = this.arr[i]; - encoder.writeAny(c); - } - } - - /** - * @return {number} - */ - getRef () { - return 8 - } - } - - /** - * @private - */ - class ContentString { - /** - * @param {string} str - */ - constructor (str) { - /** - * @type {string} - */ - this.str = str; - } - - /** - * @return {number} - */ - getLength () { - return this.str.length - } - - /** - * @return {Array} - */ - getContent () { - return this.str.split('') - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentString} - */ - copy () { - return new ContentString(this.str) - } - - /** - * @param {number} offset - * @return {ContentString} - */ - splice (offset) { - const right = new ContentString(this.str.slice(offset)); - this.str = this.str.slice(0, offset); - - // Prevent encoding invalid documents because of splitting of surrogate pairs: https://github.com/yjs/yjs/issues/248 - const firstCharCode = this.str.charCodeAt(offset - 1); - if (firstCharCode >= 0xD800 && firstCharCode <= 0xDBFF) { - // Last character of the left split is the start of a surrogate utf16/ucs2 pair. - // We don't support splitting of surrogate pairs because this may lead to invalid documents. - // Replace the invalid character with a unicode replacement character (� / U+FFFD) - this.str = this.str.slice(0, offset - 1) + '�'; - // replace right as well - right.str = '�' + right.str.slice(1); - } - return right - } - - /** - * @param {ContentString} right - * @return {boolean} - */ - mergeWith (right) { - this.str += right.str; - return true - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) {} - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeString(offset === 0 ? this.str : this.str.slice(offset)); - } - - /** - * @return {number} - */ - getRef () { - return 4 - } - } - - const YArrayRefID = 0; - const YMapRefID = 1; - const YTextRefID = 2; - const YXmlElementRefID = 3; - const YXmlFragmentRefID = 4; - - /** - * @private - */ - class ContentType { - /** - * @param {AbstractType} type - */ - constructor (type) { - /** - * @type {AbstractType} - */ - this.type = type; - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [this.type] - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentType} - */ - copy () { - return new ContentType(this.type._copy()) - } - - /** - * @param {number} offset - * @return {ContentType} - */ - splice (offset) { - throw methodUnimplemented() - } - - /** - * @param {ContentType} right - * @return {boolean} - */ - mergeWith (right) { - return false - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) { - this.type._integrate(transaction.doc, item); - } - - /** - * @param {Transaction} transaction - */ - delete (transaction) { - let item = this.type._start; - while (item !== null) { - if (!item.deleted) { - item.delete(transaction); - } else if (item.id.clock < (transaction.beforeState.get(item.id.client) || 0)) { - // This will be gc'd later and we want to merge it if possible - // We try to merge all deleted items after each transaction, - // but we have no knowledge about that this needs to be merged - // since it is not in transaction.ds. Hence we add it to transaction._mergeStructs - transaction._mergeStructs.push(item); - } - item = item.right; - } - this.type._map.forEach(item => { - if (!item.deleted) { - item.delete(transaction); - } else if (item.id.clock < (transaction.beforeState.get(item.id.client) || 0)) { - // same as above - transaction._mergeStructs.push(item); - } - }); - transaction.changed.delete(this.type); - } - - /** - * @param {StructStore} store - */ - gc (store) { - let item = this.type._start; - while (item !== null) { - item.gc(store, true); - item = item.right; - } - this.type._start = null; - this.type._map.forEach(/** @param {Item | null} item */ (item) => { - while (item !== null) { - item.gc(store, true); - item = item.left; - } - }); - this.type._map = new Map(); - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - this.type._write(encoder); - } - - /** - * @return {number} - */ - getRef () { - return 7 - } - } - - /** - * Split leftItem into two items - * @param {Transaction} transaction - * @param {Item} leftItem - * @param {number} diff - * @return {Item} - * - * @function - * @private - */ - const splitItem = (transaction, leftItem, diff) => { - // create rightItem - const { client, clock } = leftItem.id; - const rightItem = new Item( - createID(client, clock + diff), - leftItem, - createID(client, clock + diff - 1), - leftItem.right, - leftItem.rightOrigin, - leftItem.parent, - leftItem.parentSub, - leftItem.content.splice(diff) - ); - if (leftItem.deleted) { - rightItem.markDeleted(); - } - if (leftItem.keep) { - rightItem.keep = true; - } - if (leftItem.redone !== null) { - rightItem.redone = createID(leftItem.redone.client, leftItem.redone.clock + diff); - } - // update left (do not set leftItem.rightOrigin as it will lead to problems when syncing) - leftItem.right = rightItem; - // update right - if (rightItem.right !== null) { - rightItem.right.left = rightItem; - } - // right is more specific. - transaction._mergeStructs.push(rightItem); - // update parent._map - if (rightItem.parentSub !== null && rightItem.right === null) { - /** @type {AbstractType} */ (rightItem.parent)._map.set(rightItem.parentSub, rightItem); - } - leftItem.length = diff; - return rightItem - }; - - /** - * Abstract class that represents any content. - */ - class Item extends AbstractStruct { - /** - * @param {ID} id - * @param {Item | null} left - * @param {ID | null} origin - * @param {Item | null} right - * @param {ID | null} rightOrigin - * @param {AbstractType|ID|null} parent Is a type if integrated, is null if it is possible to copy parent from left or right, is ID before integration to search for it. - * @param {string | null} parentSub - * @param {AbstractContent} content - */ - constructor (id, left, origin, right, rightOrigin, parent, parentSub, content) { - super(id, content.getLength()); - /** - * The item that was originally to the left of this item. - * @type {ID | null} - */ - this.origin = origin; - /** - * The item that is currently to the left of this item. - * @type {Item | null} - */ - this.left = left; - /** - * The item that is currently to the right of this item. - * @type {Item | null} - */ - this.right = right; - /** - * The item that was originally to the right of this item. - * @type {ID | null} - */ - this.rightOrigin = rightOrigin; - /** - * @type {AbstractType|ID|null} - */ - this.parent = parent; - /** - * If the parent refers to this item with some kind of key (e.g. YMap, the - * key is specified here. The key is then used to refer to the list in which - * to insert this item. If `parentSub = null` type._start is the list in - * which to insert to. Otherwise it is `parent._map`. - * @type {String | null} - */ - this.parentSub = parentSub; - /** - * If this type's effect is redone this type refers to the type that undid - * this operation. - * @type {ID | null} - */ - this.redone = null; - /** - * @type {AbstractContent} - */ - this.content = content; - /** - * bit1: keep - * bit2: countable - * bit3: deleted - * bit4: mark - mark node as fast-search-marker - * @type {number} byte - */ - this.info = this.content.isCountable() ? BIT2 : 0; - } - - /** - * This is used to mark the item as an indexed fast-search marker - * - * @type {boolean} - */ - set marker (isMarked) { - if (((this.info & BIT4) > 0) !== isMarked) { - this.info ^= BIT4; - } - } - - get marker () { - return (this.info & BIT4) > 0 - } - - /** - * If true, do not garbage collect this Item. - */ - get keep () { - return (this.info & BIT1) > 0 - } - - set keep (doKeep) { - if (this.keep !== doKeep) { - this.info ^= BIT1; - } - } - - get countable () { - return (this.info & BIT2) > 0 - } - - /** - * Whether this item was deleted or not. - * @type {Boolean} - */ - get deleted () { - return (this.info & BIT3) > 0 - } - - set deleted (doDelete) { - if (this.deleted !== doDelete) { - this.info ^= BIT3; - } - } - - markDeleted () { - this.info |= BIT3; - } - - /** - * Return the creator clientID of the missing op or define missing items and return null. - * - * @param {Transaction} transaction - * @param {StructStore} store - * @return {null | number} - */ - getMissing (transaction, store) { - if (this.origin && this.origin.client !== this.id.client && this.origin.clock >= getState(store, this.origin.client)) { - return this.origin.client - } - if (this.rightOrigin && this.rightOrigin.client !== this.id.client && this.rightOrigin.clock >= getState(store, this.rightOrigin.client)) { - return this.rightOrigin.client - } - if (this.parent && this.parent.constructor === ID && this.id.client !== this.parent.client && this.parent.clock >= getState(store, this.parent.client)) { - return this.parent.client - } - - // We have all missing ids, now find the items - - if (this.origin) { - this.left = getItemCleanEnd(transaction, store, this.origin); - this.origin = this.left.lastId; - } - if (this.rightOrigin) { - this.right = getItemCleanStart(transaction, this.rightOrigin); - this.rightOrigin = this.right.id; - } - if ((this.left && this.left.constructor === GC) || (this.right && this.right.constructor === GC)) { - this.parent = null; - } - // only set parent if this shouldn't be garbage collected - if (!this.parent) { - if (this.left && this.left.constructor === Item) { - this.parent = this.left.parent; - this.parentSub = this.left.parentSub; - } - if (this.right && this.right.constructor === Item) { - this.parent = this.right.parent; - this.parentSub = this.right.parentSub; - } - } else if (this.parent.constructor === ID) { - const parentItem = getItem(store, this.parent); - if (parentItem.constructor === GC) { - this.parent = null; - } else { - this.parent = /** @type {ContentType} */ (parentItem.content).type; - } - } - return null - } - - /** - * @param {Transaction} transaction - * @param {number} offset - */ - integrate (transaction, offset) { - if (offset > 0) { - this.id.clock += offset; - this.left = getItemCleanEnd(transaction, transaction.doc.store, createID(this.id.client, this.id.clock - 1)); - this.origin = this.left.lastId; - this.content = this.content.splice(offset); - this.length -= offset; - } - - if (this.parent) { - if ((!this.left && (!this.right || this.right.left !== null)) || (this.left && this.left.right !== this.right)) { - /** - * @type {Item|null} - */ - let left = this.left; - - /** - * @type {Item|null} - */ - let o; - // set o to the first conflicting item - if (left !== null) { - o = left.right; - } else if (this.parentSub !== null) { - o = /** @type {AbstractType} */ (this.parent)._map.get(this.parentSub) || null; - while (o !== null && o.left !== null) { - o = o.left; - } - } else { - o = /** @type {AbstractType} */ (this.parent)._start; - } - // TODO: use something like DeleteSet here (a tree implementation would be best) - // @todo use global set definitions - /** - * @type {Set} - */ - const conflictingItems = new Set(); - /** - * @type {Set} - */ - const itemsBeforeOrigin = new Set(); - // Let c in conflictingItems, b in itemsBeforeOrigin - // ***{origin}bbbb{this}{c,b}{c,b}{o}*** - // Note that conflictingItems is a subset of itemsBeforeOrigin - while (o !== null && o !== this.right) { - itemsBeforeOrigin.add(o); - conflictingItems.add(o); - if (compareIDs(this.origin, o.origin)) { - // case 1 - if (o.id.client < this.id.client) { - left = o; - conflictingItems.clear(); - } else if (compareIDs(this.rightOrigin, o.rightOrigin)) { - // this and o are conflicting and point to the same integration points. The id decides which item comes first. - // Since this is to the left of o, we can break here - break - } // else, o might be integrated before an item that this conflicts with. If so, we will find it in the next iterations - } else if (o.origin !== null && itemsBeforeOrigin.has(getItem(transaction.doc.store, o.origin))) { // use getItem instead of getItemCleanEnd because we don't want / need to split items. - // case 2 - if (!conflictingItems.has(getItem(transaction.doc.store, o.origin))) { - left = o; - conflictingItems.clear(); - } - } else { - break - } - o = o.right; - } - this.left = left; - } - // reconnect left/right + update parent map/start if necessary - if (this.left !== null) { - const right = this.left.right; - this.right = right; - this.left.right = this; - } else { - let r; - if (this.parentSub !== null) { - r = /** @type {AbstractType} */ (this.parent)._map.get(this.parentSub) || null; - while (r !== null && r.left !== null) { - r = r.left; - } - } else { - r = /** @type {AbstractType} */ (this.parent)._start - ;/** @type {AbstractType} */ (this.parent)._start = this; - } - this.right = r; - } - if (this.right !== null) { - this.right.left = this; - } else if (this.parentSub !== null) { - // set as current parent value if right === null and this is parentSub - /** @type {AbstractType} */ (this.parent)._map.set(this.parentSub, this); - if (this.left !== null) { - // this is the current attribute value of parent. delete right - this.left.delete(transaction); - } - } - // adjust length of parent - if (this.parentSub === null && this.countable && !this.deleted) { - /** @type {AbstractType} */ (this.parent)._length += this.length; - } - addStruct(transaction.doc.store, this); - this.content.integrate(transaction, this); - // add parent to transaction.changed - addChangedTypeToTransaction(transaction, /** @type {AbstractType} */ (this.parent), this.parentSub); - if ((/** @type {AbstractType} */ (this.parent)._item !== null && /** @type {AbstractType} */ (this.parent)._item.deleted) || (this.parentSub !== null && this.right !== null)) { - // delete if parent is deleted or if this is not the current attribute value of parent - this.delete(transaction); - } - } else { - // parent is not defined. Integrate GC struct instead - new GC(this.id, this.length).integrate(transaction, 0); - } - } - - /** - * Returns the next non-deleted item - */ - get next () { - let n = this.right; - while (n !== null && n.deleted) { - n = n.right; - } - return n - } - - /** - * Returns the previous non-deleted item - */ - get prev () { - let n = this.left; - while (n !== null && n.deleted) { - n = n.left; - } - return n - } - - /** - * Computes the last content address of this Item. - */ - get lastId () { - // allocating ids is pretty costly because of the amount of ids created, so we try to reuse whenever possible - return this.length === 1 ? this.id : createID(this.id.client, this.id.clock + this.length - 1) - } - - /** - * Try to merge two items - * - * @param {Item} right - * @return {boolean} - */ - mergeWith (right) { - if ( - this.constructor === right.constructor && - compareIDs(right.origin, this.lastId) && - this.right === right && - compareIDs(this.rightOrigin, right.rightOrigin) && - this.id.client === right.id.client && - this.id.clock + this.length === right.id.clock && - this.deleted === right.deleted && - this.redone === null && - right.redone === null && - this.content.constructor === right.content.constructor && - this.content.mergeWith(right.content) - ) { - const searchMarker = /** @type {AbstractType} */ (this.parent)._searchMarker; - if (searchMarker) { - searchMarker.forEach(marker => { - if (marker.p === right) { - // right is going to be "forgotten" so we need to update the marker - marker.p = this; - // adjust marker index - if (!this.deleted && this.countable) { - marker.index -= this.length; - } - } - }); - } - if (right.keep) { - this.keep = true; - } - this.right = right.right; - if (this.right !== null) { - this.right.left = this; - } - this.length += right.length; - return true - } - return false - } - - /** - * Mark this Item as deleted. - * - * @param {Transaction} transaction - */ - delete (transaction) { - if (!this.deleted) { - const parent = /** @type {AbstractType} */ (this.parent); - // adjust the length of parent - if (this.countable && this.parentSub === null) { - parent._length -= this.length; - } - this.markDeleted(); - addToDeleteSet(transaction.deleteSet, this.id.client, this.id.clock, this.length); - addChangedTypeToTransaction(transaction, parent, this.parentSub); - this.content.delete(transaction); - } - } - - /** - * @param {StructStore} store - * @param {boolean} parentGCd - */ - gc (store, parentGCd) { - if (!this.deleted) { - throw unexpectedCase() - } - this.content.gc(store); - if (parentGCd) { - replaceStruct(store, this, new GC(this.id, this.length)); - } else { - this.content = new ContentDeleted(this.length); - } - } - - /** - * Transform the properties of this type to binary and write it to an - * BinaryEncoder. - * - * This is called when this Item is sent to a remote peer. - * - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - * @param {number} offset - */ - write (encoder, offset) { - const origin = offset > 0 ? createID(this.id.client, this.id.clock + offset - 1) : this.origin; - const rightOrigin = this.rightOrigin; - const parentSub = this.parentSub; - const info = (this.content.getRef() & BITS5) | - (origin === null ? 0 : BIT8) | // origin is defined - (rightOrigin === null ? 0 : BIT7) | // right origin is defined - (parentSub === null ? 0 : BIT6); // parentSub is non-null - encoder.writeInfo(info); - if (origin !== null) { - encoder.writeLeftID(origin); - } - if (rightOrigin !== null) { - encoder.writeRightID(rightOrigin); - } - if (origin === null && rightOrigin === null) { - const parent = /** @type {AbstractType} */ (this.parent); - if (parent._item !== undefined) { - const parentItem = parent._item; - if (parentItem === null) { - // parent type on y._map - // find the correct key - const ykey = findRootTypeKey(parent); - encoder.writeParentInfo(true); // write parentYKey - encoder.writeString(ykey); - } else { - encoder.writeParentInfo(false); // write parent id - encoder.writeLeftID(parentItem.id); - } - } else if (parent.constructor === String) { // this edge case was added by differential updates - encoder.writeParentInfo(true); // write parentYKey - encoder.writeString(parent); - } else if (parent.constructor === ID) { - encoder.writeParentInfo(false); // write parent id - encoder.writeLeftID(parent); - } else { - unexpectedCase(); - } - if (parentSub !== null) { - encoder.writeString(parentSub); - } - } - this.content.write(encoder, offset); - } - } - - /** eslint-env browser */ - - const glo = /** @type {any} */ (typeof globalThis !== 'undefined' - ? globalThis - : typeof window !== 'undefined' - ? window - // @ts-ignore - : typeof global !== 'undefined' ? global : {}); - - const importIdentifier = '__ $YJS$ __'; - - if (glo[importIdentifier] === true) { - /** - * Dear reader of this message. Please take this seriously. - * - * If you see this message, make sure that you only import one version of Yjs. In many cases, - * your package manager installs two versions of Yjs that are used by different packages within your project. - * Another reason for this message is that some parts of your project use the commonjs version of Yjs - * and others use the EcmaScript version of Yjs. - * - * This often leads to issues that are hard to debug. We often need to perform constructor checks, - * e.g. `struct instanceof GC`. If you imported different versions of Yjs, it is impossible for us to - * do the constructor checks anymore - which might break the CRDT algorithm. - * - * https://github.com/yjs/yjs/issues/438 - */ - console.error('Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438'); - } - glo[importIdentifier] = true; - - /** - * @module awareness-protocol - */ - - - const outdatedTimeout = 30000; - - /** - * @typedef {Object} MetaClientState - * @property {number} MetaClientState.clock - * @property {number} MetaClientState.lastUpdated unix timestamp - */ - - /** - * The Awareness class implements a simple shared state protocol that can be used for non-persistent data like awareness information - * (cursor, username, status, ..). Each client can update its own local state and listen to state changes of - * remote clients. Every client may set a state of a remote peer to `null` to mark the client as offline. - * - * Each client is identified by a unique client id (something we borrow from `doc.clientID`). A client can override - * its own state by propagating a message with an increasing timestamp (`clock`). If such a message is received, it is - * applied if the known state of that client is older than the new state (`clock < newClock`). If a client thinks that - * a remote client is offline, it may propagate a message with - * `{ clock: currentClientClock, state: null, client: remoteClient }`. If such a - * message is received, and the known clock of that client equals the received clock, it will override the state with `null`. - * - * Before a client disconnects, it should propagate a `null` state with an updated clock. - * - * Awareness states must be updated every 30 seconds. Otherwise the Awareness instance will delete the client state. - * - * @extends {Observable} - */ - class Awareness extends Observable { - /** - * @param {Y.Doc} doc - */ - constructor (doc) { - super(); - this.doc = doc; - /** - * @type {number} - */ - this.clientID = doc.clientID; - /** - * Maps from client id to client state - * @type {Map>} - */ - this.states = new Map(); - /** - * @type {Map} - */ - this.meta = new Map(); - this._checkInterval = /** @type {any} */ (setInterval(() => { - const now = getUnixTime(); - if (this.getLocalState() !== null && (outdatedTimeout / 2 <= now - /** @type {{lastUpdated:number}} */ (this.meta.get(this.clientID)).lastUpdated)) { - // renew local clock - this.setLocalState(this.getLocalState()); - } - /** - * @type {Array} - */ - const remove = []; - this.meta.forEach((meta, clientid) => { - if (clientid !== this.clientID && outdatedTimeout <= now - meta.lastUpdated && this.states.has(clientid)) { - remove.push(clientid); - } - }); - if (remove.length > 0) { - removeAwarenessStates(this, remove, 'timeout'); - } - }, floor(outdatedTimeout / 10))); - doc.on('destroy', () => { - this.destroy(); - }); - this.setLocalState({}); - } - - destroy () { - this.emit('destroy', [this]); - this.setLocalState(null); - super.destroy(); - clearInterval(this._checkInterval); - } - - /** - * @return {Object|null} - */ - getLocalState () { - return this.states.get(this.clientID) || null - } - - /** - * @param {Object|null} state - */ - setLocalState (state) { - const clientID = this.clientID; - const currLocalMeta = this.meta.get(clientID); - const clock = currLocalMeta === undefined ? 0 : currLocalMeta.clock + 1; - const prevState = this.states.get(clientID); - if (state === null) { - this.states.delete(clientID); - } else { - this.states.set(clientID, state); - } - this.meta.set(clientID, { - clock, - lastUpdated: getUnixTime() - }); - const added = []; - const updated = []; - const filteredUpdated = []; - const removed = []; - if (state === null) { - removed.push(clientID); - } else if (prevState == null) { - if (state != null) { - added.push(clientID); - } - } else { - updated.push(clientID); - if (!equalityDeep(prevState, state)) { - filteredUpdated.push(clientID); - } - } - if (added.length > 0 || filteredUpdated.length > 0 || removed.length > 0) { - this.emit('change', [{ added, updated: filteredUpdated, removed }, 'local']); - } - this.emit('update', [{ added, updated, removed }, 'local']); - } - - /** - * @param {string} field - * @param {any} value - */ - setLocalStateField (field, value) { - const state = this.getLocalState(); - if (state !== null) { - this.setLocalState({ - ...state, - [field]: value - }); - } - } - - /** - * @return {Map>} - */ - getStates () { - return this.states - } - } - - /** - * Mark (remote) clients as inactive and remove them from the list of active peers. - * This change will be propagated to remote clients. - * - * @param {Awareness} awareness - * @param {Array} clients - * @param {any} origin - */ - const removeAwarenessStates = (awareness, clients, origin) => { - const removed = []; - for (let i = 0; i < clients.length; i++) { - const clientID = clients[i]; - if (awareness.states.has(clientID)) { - awareness.states.delete(clientID); - if (clientID === awareness.clientID) { - const curMeta = /** @type {MetaClientState} */ (awareness.meta.get(clientID)); - awareness.meta.set(clientID, { - clock: curMeta.clock + 1, - lastUpdated: getUnixTime() - }); - } - removed.push(clientID); - } - } - if (removed.length > 0) { - awareness.emit('change', [{ added: [], updated: [], removed }, origin]); - awareness.emit('update', [{ added: [], updated: [], removed }, origin]); - } - }; - - /** - * @param {Awareness} awareness - * @param {Array} clients - * @return {Uint8Array} - */ - const encodeAwarenessUpdate = (awareness, clients, states = awareness.states) => { - const len = clients.length; - const encoder = createEncoder(); - writeVarUint(encoder, len); - for (let i = 0; i < len; i++) { - const clientID = clients[i]; - const state = states.get(clientID) || null; - const clock = /** @type {MetaClientState} */ (awareness.meta.get(clientID)).clock; - writeVarUint(encoder, clientID); - writeVarUint(encoder, clock); - writeVarString(encoder, JSON.stringify(state)); - } - return toUint8Array(encoder) - }; - - /** - * @param {Awareness} awareness - * @param {Uint8Array} update - * @param {any} origin This will be added to the emitted change event - */ - const applyAwarenessUpdate = (awareness, update, origin) => { - const decoder = createDecoder(update); - const timestamp = getUnixTime(); - const added = []; - const updated = []; - const filteredUpdated = []; - const removed = []; - const len = readVarUint(decoder); - for (let i = 0; i < len; i++) { - const clientID = readVarUint(decoder); - let clock = readVarUint(decoder); - const state = JSON.parse(readVarString(decoder)); - const clientMeta = awareness.meta.get(clientID); - const prevState = awareness.states.get(clientID); - const currClock = clientMeta === undefined ? 0 : clientMeta.clock; - if (currClock < clock || (currClock === clock && state === null && awareness.states.has(clientID))) { - if (state === null) { - // never let a remote client remove this local state - if (clientID === awareness.clientID && awareness.getLocalState() != null) { - // remote client removed the local state. Do not remote state. Broadcast a message indicating - // that this client still exists by increasing the clock - clock++; - } else { - awareness.states.delete(clientID); - } - } else { - awareness.states.set(clientID, state); - } - awareness.meta.set(clientID, { - clock, - lastUpdated: timestamp - }); - if (clientMeta === undefined && state !== null) { - added.push(clientID); - } else if (clientMeta !== undefined && state === null) { - removed.push(clientID); - } else if (state !== null) { - if (!equalityDeep(state, prevState)) { - filteredUpdated.push(clientID); - } - updated.push(clientID); - } - } - } - if (added.length > 0 || filteredUpdated.length > 0 || removed.length > 0) { - awareness.emit('change', [{ - added, updated: filteredUpdated, removed - }, origin]); - } - if (added.length > 0 || updated.length > 0 || removed.length > 0) { - awareness.emit('update', [{ - added, updated, removed - }, origin]); - } - }; - - /** - * @param {t.TestCase} tc - */ - const testAwareness = tc => { - const doc1 = new Doc(); - doc1.clientID = 0; - const doc2 = new Doc(); - doc2.clientID = 1; - const aw1 = new Awareness(doc1); - const aw2 = new Awareness(doc2); - aw1.on('update', /** @param {any} p */ ({ added, updated, removed }) => { - const enc = encodeAwarenessUpdate(aw1, added.concat(updated).concat(removed)); - applyAwarenessUpdate(aw2, enc, 'custom'); - }); - let lastChangeLocal = /** @type {any} */ (null); - aw1.on('change', /** @param {any} change */ change => { - lastChangeLocal = change; - }); - let lastChange = /** @type {any} */ (null); - aw2.on('change', /** @param {any} change */ change => { - lastChange = change; - }); - aw1.setLocalState({ x: 3 }); - compare(aw2.getStates().get(0), { x: 3 }); - assert(/** @type {any} */ (aw2.meta.get(0)).clock === 1); - compare(lastChange.added, [0]); - // When creating an Awareness instance, the the local client is already marked as available, so it is not updated. - compare(lastChangeLocal, { added: [], updated: [0], removed: [] }); - - // update state - lastChange = null; - lastChangeLocal = null; - aw1.setLocalState({ x: 4 }); - compare(aw2.getStates().get(0), { x: 4 }); - compare(lastChangeLocal, { added: [], updated: [0], removed: [] }); - compare(lastChangeLocal, lastChange); - - lastChange = null; - lastChangeLocal = null; - aw1.setLocalState({ x: 4 }); - assert(lastChange === null); - assert(/** @type {any} */ (aw2.meta.get(0)).clock === 3); - compare(lastChangeLocal, lastChange); - aw1.setLocalState(null); - assert(lastChange.removed.length === 1); - compare(aw1.getStates().get(0), undefined); - compare(lastChangeLocal, lastChange); - }; - - var awareness = /*#__PURE__*/Object.freeze({ - __proto__: null, - testAwareness: testAwareness - }); - - /* istanbul ignore if */ - if (isBrowser) { - createVConsole(document.body); - } - - runTests({ - awareness - }).then(success => { - /* istanbul ignore next */ - if (isNode) { - process.exit(success ? 0 : 1); - } - }); - -})(); -//# sourceMappingURL=test.js.map diff --git a/yjs-poll/node_modules/y-protocols/dist/test.js.map b/yjs-poll/node_modules/y-protocols/dist/test.js.map deleted file mode 100644 index 38100c3..0000000 --- a/yjs-poll/node_modules/y-protocols/dist/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sources":["../node_modules/lib0/map.js","../node_modules/lib0/set.js","../node_modules/lib0/array.js","../node_modules/lib0/string.js","../node_modules/lib0/conditions.js","../node_modules/lib0/storage.js","../node_modules/lib0/object.js","../node_modules/lib0/function.js","../node_modules/lib0/environment.js","../node_modules/lib0/pair.js","../node_modules/lib0/dom.js","../node_modules/lib0/json.js","../node_modules/lib0/eventloop.js","../node_modules/lib0/math.js","../node_modules/lib0/symbol.js","../node_modules/lib0/metric.js","../node_modules/lib0/time.js","../node_modules/lib0/logging.common.js","../node_modules/lib0/logging.js","../node_modules/lib0/binary.js","../node_modules/lib0/webcrypto.js","../node_modules/lib0/random.js","../node_modules/lib0/prng/Xorshift32.js","../node_modules/lib0/prng/Xoroshiro128plus.js","../node_modules/lib0/number.js","../node_modules/lib0/encoding.js","../node_modules/lib0/error.js","../node_modules/lib0/decoding.js","../node_modules/lib0/buffer.js","../node_modules/lib0/prng.js","../node_modules/lib0/statistics.js","../node_modules/lib0/promise.js","../node_modules/lib0/performance.js","../node_modules/lib0/testing.js","../node_modules/lib0/observable.js","../node_modules/lib0/iterator.js","../node_modules/yjs/dist/yjs.mjs","../awareness.js","../awareness.test.js","../test.js"],"sourcesContent":["/**\n * Utility module to work with key-value stores.\n *\n * @module map\n */\n\n/**\n * Creates a new Map instance.\n *\n * @function\n * @return {Map}\n *\n * @function\n */\nexport const create = () => new Map()\n\n/**\n * Copy a Map object into a fresh Map object.\n *\n * @function\n * @template X,Y\n * @param {Map} m\n * @return {Map}\n */\nexport const copy = m => {\n const r = create()\n m.forEach((v, k) => { r.set(k, v) })\n return r\n}\n\n/**\n * Get map property. Create T if property is undefined and set T on map.\n *\n * ```js\n * const listeners = map.setIfUndefined(events, 'eventName', set.create)\n * listeners.add(listener)\n * ```\n *\n * @function\n * @template V,K\n * @template {Map} MAP\n * @param {MAP} map\n * @param {K} key\n * @param {function():V} createT\n * @return {V}\n */\nexport const setIfUndefined = (map, key, createT) => {\n let set = map.get(key)\n if (set === undefined) {\n map.set(key, set = createT())\n }\n return set\n}\n\n/**\n * Creates an Array and populates it with the content of all key-value pairs using the `f(value, key)` function.\n *\n * @function\n * @template K\n * @template V\n * @template R\n * @param {Map} m\n * @param {function(V,K):R} f\n * @return {Array}\n */\nexport const map = (m, f) => {\n const res = []\n for (const [key, value] of m) {\n res.push(f(value, key))\n }\n return res\n}\n\n/**\n * Tests whether any key-value pairs pass the test implemented by `f(value, key)`.\n *\n * @todo should rename to some - similarly to Array.some\n *\n * @function\n * @template K\n * @template V\n * @param {Map} m\n * @param {function(V,K):boolean} f\n * @return {boolean}\n */\nexport const any = (m, f) => {\n for (const [key, value] of m) {\n if (f(value, key)) {\n return true\n }\n }\n return false\n}\n\n/**\n * Tests whether all key-value pairs pass the test implemented by `f(value, key)`.\n *\n * @function\n * @template K\n * @template V\n * @param {Map} m\n * @param {function(V,K):boolean} f\n * @return {boolean}\n */\nexport const all = (m, f) => {\n for (const [key, value] of m) {\n if (!f(value, key)) {\n return false\n }\n }\n return true\n}\n","/**\n * Utility module to work with sets.\n *\n * @module set\n */\n\nexport const create = () => new Set()\n\n/**\n * @template T\n * @param {Set} set\n * @return {Array}\n */\nexport const toArray = set => Array.from(set)\n\n/**\n * @template T\n * @param {Set} set\n * @return {T}\n */\nexport const first = set =>\n set.values().next().value || undefined\n\n/**\n * @template T\n * @param {Iterable} entries\n * @return {Set}\n */\nexport const from = entries => new Set(entries)\n","/**\n * Utility module to work with Arrays.\n *\n * @module array\n */\n\nimport * as set from './set.js'\n\n/**\n * Return the last element of an array. The element must exist\n *\n * @template L\n * @param {ArrayLike} arr\n * @return {L}\n */\nexport const last = arr => arr[arr.length - 1]\n\n/**\n * @template C\n * @return {Array}\n */\nexport const create = () => /** @type {Array} */ ([])\n\n/**\n * @template D\n * @param {Array} a\n * @return {Array}\n */\nexport const copy = a => /** @type {Array} */ (a.slice())\n\n/**\n * Append elements from src to dest\n *\n * @template M\n * @param {Array} dest\n * @param {Array} src\n */\nexport const appendTo = (dest, src) => {\n for (let i = 0; i < src.length; i++) {\n dest.push(src[i])\n }\n}\n\n/**\n * Transforms something array-like to an actual Array.\n *\n * @function\n * @template T\n * @param {ArrayLike|Iterable} arraylike\n * @return {T}\n */\nexport const from = Array.from\n\n/**\n * True iff condition holds on every element in the Array.\n *\n * @function\n * @template ITEM\n * @template {ArrayLike} ARR\n *\n * @param {ARR} arr\n * @param {function(ITEM, number, ARR):boolean} f\n * @return {boolean}\n */\nexport const every = (arr, f) => {\n for (let i = 0; i < arr.length; i++) {\n if (!f(arr[i], i, arr)) {\n return false\n }\n }\n return true\n}\n\n/**\n * True iff condition holds on some element in the Array.\n *\n * @function\n * @template S\n * @template {ArrayLike} ARR\n * @param {ARR} arr\n * @param {function(S, number, ARR):boolean} f\n * @return {boolean}\n */\nexport const some = (arr, f) => {\n for (let i = 0; i < arr.length; i++) {\n if (f(arr[i], i, arr)) {\n return true\n }\n }\n return false\n}\n\n/**\n * @template ELEM\n *\n * @param {ArrayLike} a\n * @param {ArrayLike} b\n * @return {boolean}\n */\nexport const equalFlat = (a, b) => a.length === b.length && every(a, (item, index) => item === b[index])\n\n/**\n * @template ELEM\n * @param {Array>} arr\n * @return {Array}\n */\nexport const flatten = arr => fold(arr, /** @type {Array} */ ([]), (acc, val) => acc.concat(val))\n\n/**\n * @template T\n * @param {number} len\n * @param {function(number, Array):T} f\n * @return {Array}\n */\nexport const unfold = (len, f) => {\n const array = new Array(len)\n for (let i = 0; i < len; i++) {\n array[i] = f(i, array)\n }\n return array\n}\n\n/**\n * @template T\n * @template RESULT\n * @param {Array} arr\n * @param {RESULT} seed\n * @param {function(RESULT, T, number):RESULT} folder\n */\nexport const fold = (arr, seed, folder) => arr.reduce(folder, seed)\n\nexport const isArray = Array.isArray\n\n/**\n * @template T\n * @param {Array} arr\n * @return {Array}\n */\nexport const unique = arr => from(set.from(arr))\n\n/**\n * @template T\n * @template M\n * @param {ArrayLike} arr\n * @param {function(T):M} mapper\n * @return {Array}\n */\nexport const uniqueBy = (arr, mapper) => {\n /**\n * @type {Set}\n */\n const happened = set.create()\n /**\n * @type {Array}\n */\n const result = []\n for (let i = 0; i < arr.length; i++) {\n const el = arr[i]\n const mapped = mapper(el)\n if (!happened.has(mapped)) {\n happened.add(mapped)\n result.push(el)\n }\n }\n return result\n}\n\n/**\n * @template {ArrayLike} ARR\n * @template {function(ARR extends ArrayLike ? T : never, number, ARR):any} MAPPER\n * @param {ARR} arr\n * @param {MAPPER} mapper\n * @return {Array}\n */\nexport const map = (arr, mapper) => {\n /**\n * @type {Array}\n */\n const res = Array(arr.length)\n for (let i = 0; i < arr.length; i++) {\n res[i] = mapper(/** @type {any} */ (arr[i]), i, /** @type {any} */ (arr))\n }\n return /** @type {any} */ (res)\n}\n","import * as array from './array.js'\n\n/**\n * Utility module to work with strings.\n *\n * @module string\n */\n\nexport const fromCharCode = String.fromCharCode\nexport const fromCodePoint = String.fromCodePoint\n\n/**\n * The largest utf16 character.\n * Corresponds to Uint8Array([255, 255]) or charcodeof(2x2^8)\n */\nexport const MAX_UTF16_CHARACTER = fromCharCode(65535)\n\n/**\n * @param {string} s\n * @return {string}\n */\nconst toLowerCase = s => s.toLowerCase()\n\nconst trimLeftRegex = /^\\s*/g\n\n/**\n * @param {string} s\n * @return {string}\n */\nexport const trimLeft = s => s.replace(trimLeftRegex, '')\n\nconst fromCamelCaseRegex = /([A-Z])/g\n\n/**\n * @param {string} s\n * @param {string} separator\n * @return {string}\n */\nexport const fromCamelCase = (s, separator) => trimLeft(s.replace(fromCamelCaseRegex, match => `${separator}${toLowerCase(match)}`))\n\n/**\n * Compute the utf8ByteLength\n * @param {string} str\n * @return {number}\n */\nexport const utf8ByteLength = str => unescape(encodeURIComponent(str)).length\n\n/**\n * @param {string} str\n * @return {Uint8Array}\n */\nexport const _encodeUtf8Polyfill = str => {\n const encodedString = unescape(encodeURIComponent(str))\n const len = encodedString.length\n const buf = new Uint8Array(len)\n for (let i = 0; i < len; i++) {\n buf[i] = /** @type {number} */ (encodedString.codePointAt(i))\n }\n return buf\n}\n\n/* c8 ignore next */\nexport const utf8TextEncoder = /** @type {TextEncoder} */ (typeof TextEncoder !== 'undefined' ? new TextEncoder() : null)\n\n/**\n * @param {string} str\n * @return {Uint8Array}\n */\nexport const _encodeUtf8Native = str => utf8TextEncoder.encode(str)\n\n/**\n * @param {string} str\n * @return {Uint8Array}\n */\n/* c8 ignore next */\nexport const encodeUtf8 = utf8TextEncoder ? _encodeUtf8Native : _encodeUtf8Polyfill\n\n/**\n * @param {Uint8Array} buf\n * @return {string}\n */\nexport const _decodeUtf8Polyfill = buf => {\n let remainingLen = buf.length\n let encodedString = ''\n let bufPos = 0\n while (remainingLen > 0) {\n const nextLen = remainingLen < 10000 ? remainingLen : 10000\n const bytes = buf.subarray(bufPos, bufPos + nextLen)\n bufPos += nextLen\n // Starting with ES5.1 we can supply a generic array-like object as arguments\n encodedString += String.fromCodePoint.apply(null, /** @type {any} */ (bytes))\n remainingLen -= nextLen\n }\n return decodeURIComponent(escape(encodedString))\n}\n\n/* c8 ignore next */\nexport let utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf-8', { fatal: true, ignoreBOM: true })\n\n/* c8 ignore start */\nif (utf8TextDecoder && utf8TextDecoder.decode(new Uint8Array()).length === 1) {\n // Safari doesn't handle BOM correctly.\n // This fixes a bug in Safari 13.0.5 where it produces a BOM the first time it is called.\n // utf8TextDecoder.decode(new Uint8Array()).length === 1 on the first call and\n // utf8TextDecoder.decode(new Uint8Array()).length === 1 on the second call\n // Another issue is that from then on no BOM chars are recognized anymore\n /* c8 ignore next */\n utf8TextDecoder = null\n}\n/* c8 ignore stop */\n\n/**\n * @param {Uint8Array} buf\n * @return {string}\n */\nexport const _decodeUtf8Native = buf => /** @type {TextDecoder} */ (utf8TextDecoder).decode(buf)\n\n/**\n * @param {Uint8Array} buf\n * @return {string}\n */\n/* c8 ignore next */\nexport const decodeUtf8 = utf8TextDecoder ? _decodeUtf8Native : _decodeUtf8Polyfill\n\n/**\n * @param {string} str The initial string\n * @param {number} index Starting position\n * @param {number} remove Number of characters to remove\n * @param {string} insert New content to insert\n */\nexport const splice = (str, index, remove, insert = '') => str.slice(0, index) + insert + str.slice(index + remove)\n\n/**\n * @param {string} source\n * @param {number} n\n */\nexport const repeat = (source, n) => array.unfold(n, () => source).join('')\n","/**\n * Often used conditions.\n *\n * @module conditions\n */\n\n/**\n * @template T\n * @param {T|null|undefined} v\n * @return {T|null}\n */\n/* c8 ignore next */\nexport const undefinedToNull = v => v === undefined ? null : v\n","/* eslint-env browser */\n\n/**\n * Isomorphic variable storage.\n *\n * Uses LocalStorage in the browser and falls back to in-memory storage.\n *\n * @module storage\n */\n\n/* c8 ignore start */\nclass VarStoragePolyfill {\n constructor () {\n this.map = new Map()\n }\n\n /**\n * @param {string} key\n * @param {any} newValue\n */\n setItem (key, newValue) {\n this.map.set(key, newValue)\n }\n\n /**\n * @param {string} key\n */\n getItem (key) {\n return this.map.get(key)\n }\n}\n/* c8 ignore stop */\n\n/**\n * @type {any}\n */\nlet _localStorage = new VarStoragePolyfill()\nlet usePolyfill = true\n\n/* c8 ignore start */\ntry {\n // if the same-origin rule is violated, accessing localStorage might thrown an error\n if (typeof localStorage !== 'undefined') {\n _localStorage = localStorage\n usePolyfill = false\n }\n} catch (e) { }\n/* c8 ignore stop */\n\n/**\n * This is basically localStorage in browser, or a polyfill in nodejs\n */\n/* c8 ignore next */\nexport const varStorage = _localStorage\n\n/**\n * A polyfill for `addEventListener('storage', event => {..})` that does nothing if the polyfill is being used.\n *\n * @param {function({ key: string, newValue: string, oldValue: string }): void} eventHandler\n * @function\n */\n/* c8 ignore next */\nexport const onChange = eventHandler => usePolyfill || addEventListener('storage', /** @type {any} */ (eventHandler))\n\n/**\n * A polyfill for `removeEventListener('storage', event => {..})` that does nothing if the polyfill is being used.\n *\n * @param {function({ key: string, newValue: string, oldValue: string }): void} eventHandler\n * @function\n */\n/* c8 ignore next */\nexport const offChange = eventHandler => usePolyfill || removeEventListener('storage', /** @type {any} */ (eventHandler))\n","/**\n * Utility functions for working with EcmaScript objects.\n *\n * @module object\n */\n\n/**\n * @return {Object} obj\n */\nexport const create = () => Object.create(null)\n\n/**\n * Object.assign\n */\nexport const assign = Object.assign\n\n/**\n * @param {Object} obj\n */\nexport const keys = Object.keys\n\n/**\n * @template V\n * @param {{[k:string]:V}} obj\n * @param {function(V,string):any} f\n */\nexport const forEach = (obj, f) => {\n for (const key in obj) {\n f(obj[key], key)\n }\n}\n\n/**\n * @todo implement mapToArray & map\n *\n * @template R\n * @param {Object} obj\n * @param {function(any,string):R} f\n * @return {Array}\n */\nexport const map = (obj, f) => {\n const results = []\n for (const key in obj) {\n results.push(f(obj[key], key))\n }\n return results\n}\n\n/**\n * @param {Object} obj\n * @return {number}\n */\nexport const length = obj => keys(obj).length\n\n/**\n * @param {Object} obj\n * @param {function(any,string):boolean} f\n * @return {boolean}\n */\nexport const some = (obj, f) => {\n for (const key in obj) {\n if (f(obj[key], key)) {\n return true\n }\n }\n return false\n}\n\n/**\n * @param {Object|undefined} obj\n */\nexport const isEmpty = obj => {\n // eslint-disable-next-line\n for (const _k in obj) {\n return false\n }\n return true\n}\n\n/**\n * @param {Object} obj\n * @param {function(any,string):boolean} f\n * @return {boolean}\n */\nexport const every = (obj, f) => {\n for (const key in obj) {\n if (!f(obj[key], key)) {\n return false\n }\n }\n return true\n}\n\n/**\n * Calls `Object.prototype.hasOwnProperty`.\n *\n * @param {any} obj\n * @param {string|symbol} key\n * @return {boolean}\n */\nexport const hasProperty = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key)\n\n/**\n * @param {Object} a\n * @param {Object} b\n * @return {boolean}\n */\nexport const equalFlat = (a, b) => a === b || (length(a) === length(b) && every(a, (val, key) => (val !== undefined || hasProperty(b, key)) && b[key] === val))\n","/**\n * Common functions and function call helpers.\n *\n * @module function\n */\n\nimport * as array from './array.js'\nimport * as object from './object.js'\n\n/**\n * Calls all functions in `fs` with args. Only throws after all functions were called.\n *\n * @param {Array} fs\n * @param {Array} args\n */\nexport const callAll = (fs, args, i = 0) => {\n try {\n for (; i < fs.length; i++) {\n fs[i](...args)\n }\n } finally {\n if (i < fs.length) {\n callAll(fs, args, i + 1)\n }\n }\n}\n\nexport const nop = () => {}\n\n/**\n * @template T\n * @param {function():T} f\n * @return {T}\n */\nexport const apply = f => f()\n\n/**\n * @template A\n *\n * @param {A} a\n * @return {A}\n */\nexport const id = a => a\n\n/**\n * @template T\n *\n * @param {T} a\n * @param {T} b\n * @return {boolean}\n */\nexport const equalityStrict = (a, b) => a === b\n\n/**\n * @template T\n *\n * @param {Array|object} a\n * @param {Array|object} b\n * @return {boolean}\n */\nexport const equalityFlat = (a, b) => a === b || (a != null && b != null && a.constructor === b.constructor && ((array.isArray(a) && array.equalFlat(a, /** @type {Array} */ (b))) || (typeof a === 'object' && object.equalFlat(a, b))))\n\n/* c8 ignore start */\n\n/**\n * @param {any} a\n * @param {any} b\n * @return {boolean}\n */\nexport const equalityDeep = (a, b) => {\n if (a == null || b == null) {\n return equalityStrict(a, b)\n }\n if (a.constructor !== b.constructor) {\n return false\n }\n if (a === b) {\n return true\n }\n switch (a.constructor) {\n case ArrayBuffer:\n a = new Uint8Array(a)\n b = new Uint8Array(b)\n // eslint-disable-next-line no-fallthrough\n case Uint8Array: {\n if (a.byteLength !== b.byteLength) {\n return false\n }\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false\n }\n }\n break\n }\n case Set: {\n if (a.size !== b.size) {\n return false\n }\n for (const value of a) {\n if (!b.has(value)) {\n return false\n }\n }\n break\n }\n case Map: {\n if (a.size !== b.size) {\n return false\n }\n for (const key of a.keys()) {\n if (!b.has(key) || !equalityDeep(a.get(key), b.get(key))) {\n return false\n }\n }\n break\n }\n case Object:\n if (object.length(a) !== object.length(b)) {\n return false\n }\n for (const key in a) {\n if (!object.hasProperty(a, key) || !equalityDeep(a[key], b[key])) {\n return false\n }\n }\n break\n case Array:\n if (a.length !== b.length) {\n return false\n }\n for (let i = 0; i < a.length; i++) {\n if (!equalityDeep(a[i], b[i])) {\n return false\n }\n }\n break\n default:\n return false\n }\n return true\n}\n\n/**\n * @template V\n * @template {V} OPTS\n *\n * @param {V} value\n * @param {Array} options\n */\n// @ts-ignore\nexport const isOneOf = (value, options) => options.includes(value)\n/* c8 ignore stop */\n\nexport const isArray = array.isArray\n\n/**\n * @param {any} s\n * @return {s is String}\n */\nexport const isString = (s) => s && s.constructor === String\n\n/**\n * @param {any} n\n * @return {n is Number}\n */\nexport const isNumber = n => n != null && n.constructor === Number\n\n/**\n * @template {abstract new (...args: any) => any} TYPE\n * @param {any} n\n * @param {TYPE} T\n * @return {n is InstanceType}\n */\nexport const is = (n, T) => n && n.constructor === T\n\n/**\n * @template {abstract new (...args: any) => any} TYPE\n * @param {TYPE} T\n */\nexport const isTemplate = (T) =>\n /**\n * @param {any} n\n * @return {n is InstanceType}\n **/\n n => n && n.constructor === T\n","/**\n * Isomorphic module to work access the environment (query params, env variables).\n *\n * @module map\n */\n\nimport * as map from './map.js'\nimport * as string from './string.js'\nimport * as conditions from './conditions.js'\nimport * as storage from './storage.js'\nimport * as f from './function.js'\n\n/* c8 ignore next */\n// @ts-ignore\nexport const isNode = typeof process !== 'undefined' && process.release &&\n /node|io\\.js/.test(process.release.name)\n/* c8 ignore next */\nexport const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && !isNode\n/* c8 ignore next 3 */\nexport const isMac = typeof navigator !== 'undefined'\n ? /Mac/.test(navigator.platform)\n : false\n\n/**\n * @type {Map}\n */\nlet params\nconst args = []\n\n/* c8 ignore start */\nconst computeParams = () => {\n if (params === undefined) {\n if (isNode) {\n params = map.create()\n const pargs = process.argv\n let currParamName = null\n for (let i = 0; i < pargs.length; i++) {\n const parg = pargs[i]\n if (parg[0] === '-') {\n if (currParamName !== null) {\n params.set(currParamName, '')\n }\n currParamName = parg\n } else {\n if (currParamName !== null) {\n params.set(currParamName, parg)\n currParamName = null\n } else {\n args.push(parg)\n }\n }\n }\n if (currParamName !== null) {\n params.set(currParamName, '')\n }\n // in ReactNative for example this would not be true (unless connected to the Remote Debugger)\n } else if (typeof location === 'object') {\n params = map.create(); // eslint-disable-next-line no-undef\n (location.search || '?').slice(1).split('&').forEach((kv) => {\n if (kv.length !== 0) {\n const [key, value] = kv.split('=')\n params.set(`--${string.fromCamelCase(key, '-')}`, value)\n params.set(`-${string.fromCamelCase(key, '-')}`, value)\n }\n })\n } else {\n params = map.create()\n }\n }\n return params\n}\n/* c8 ignore stop */\n\n/**\n * @param {string} name\n * @return {boolean}\n */\n/* c8 ignore next */\nexport const hasParam = (name) => computeParams().has(name)\n\n/**\n * @param {string} name\n * @param {string} defaultVal\n * @return {string}\n */\n/* c8 ignore next 2 */\nexport const getParam = (name, defaultVal) =>\n computeParams().get(name) || defaultVal\n\n/**\n * @param {string} name\n * @return {string|null}\n */\n/* c8 ignore next 4 */\nexport const getVariable = (name) =>\n isNode\n ? conditions.undefinedToNull(process.env[name.toUpperCase()])\n : conditions.undefinedToNull(storage.varStorage.getItem(name))\n\n/**\n * @param {string} name\n * @return {string|null}\n */\n/* c8 ignore next 2 */\nexport const getConf = (name) =>\n computeParams().get('--' + name) || getVariable(name)\n\n/**\n * @param {string} name\n * @return {boolean}\n */\n/* c8 ignore next 2 */\nexport const hasConf = (name) =>\n hasParam('--' + name) || getVariable(name) !== null\n\n/* c8 ignore next */\nexport const production = hasConf('production')\n\n/* c8 ignore next 2 */\nconst forceColor = isNode &&\n f.isOneOf(process.env.FORCE_COLOR, ['true', '1', '2'])\n\n/* c8 ignore start */\nexport const supportsColor = !hasParam('no-colors') &&\n (!isNode || process.stdout.isTTY || forceColor) && (\n !isNode || hasParam('color') || forceColor ||\n getVariable('COLORTERM') !== null ||\n (getVariable('TERM') || '').includes('color')\n)\n/* c8 ignore stop */\n","/**\n * Working with value pairs.\n *\n * @module pair\n */\n\n/**\n * @template L,R\n */\nexport class Pair {\n /**\n * @param {L} left\n * @param {R} right\n */\n constructor (left, right) {\n this.left = left\n this.right = right\n }\n}\n\n/**\n * @template L,R\n * @param {L} left\n * @param {R} right\n * @return {Pair}\n */\nexport const create = (left, right) => new Pair(left, right)\n\n/**\n * @template L,R\n * @param {R} right\n * @param {L} left\n * @return {Pair}\n */\nexport const createReversed = (right, left) => new Pair(left, right)\n\n/**\n * @template L,R\n * @param {Array>} arr\n * @param {function(L, R):any} f\n */\nexport const forEach = (arr, f) => arr.forEach(p => f(p.left, p.right))\n\n/**\n * @template L,R,X\n * @param {Array>} arr\n * @param {function(L, R):X} f\n * @return {Array}\n */\nexport const map = (arr, f) => arr.map(p => f(p.left, p.right))\n","/* eslint-env browser */\n\n/**\n * Utility module to work with the DOM.\n *\n * @module dom\n */\n\nimport * as pair from './pair.js'\nimport * as map from './map.js'\n\n/* c8 ignore start */\n/**\n * @type {Document}\n */\nexport const doc = /** @type {Document} */ (typeof document !== 'undefined' ? document : {})\n\n/**\n * @param {string} name\n * @return {HTMLElement}\n */\nexport const createElement = name => doc.createElement(name)\n\n/**\n * @return {DocumentFragment}\n */\nexport const createDocumentFragment = () => doc.createDocumentFragment()\n\n/**\n * @param {string} text\n * @return {Text}\n */\nexport const createTextNode = text => doc.createTextNode(text)\n\nexport const domParser = /** @type {DOMParser} */ (typeof DOMParser !== 'undefined' ? new DOMParser() : null)\n\n/**\n * @param {HTMLElement} el\n * @param {string} name\n * @param {Object} opts\n */\nexport const emitCustomEvent = (el, name, opts) => el.dispatchEvent(new CustomEvent(name, opts))\n\n/**\n * @param {Element} el\n * @param {Array>} attrs Array of key-value pairs\n * @return {Element}\n */\nexport const setAttributes = (el, attrs) => {\n pair.forEach(attrs, (key, value) => {\n if (value === false) {\n el.removeAttribute(key)\n } else if (value === true) {\n el.setAttribute(key, '')\n } else {\n // @ts-ignore\n el.setAttribute(key, value)\n }\n })\n return el\n}\n\n/**\n * @param {Element} el\n * @param {Map} attrs Array of key-value pairs\n * @return {Element}\n */\nexport const setAttributesMap = (el, attrs) => {\n attrs.forEach((value, key) => { el.setAttribute(key, value) })\n return el\n}\n\n/**\n * @param {Array|HTMLCollection} children\n * @return {DocumentFragment}\n */\nexport const fragment = children => {\n const fragment = createDocumentFragment()\n for (let i = 0; i < children.length; i++) {\n appendChild(fragment, children[i])\n }\n return fragment\n}\n\n/**\n * @param {Element} parent\n * @param {Array} nodes\n * @return {Element}\n */\nexport const append = (parent, nodes) => {\n appendChild(parent, fragment(nodes))\n return parent\n}\n\n/**\n * @param {HTMLElement} el\n */\nexport const remove = el => el.remove()\n\n/**\n * @param {EventTarget} el\n * @param {string} name\n * @param {EventListener} f\n */\nexport const addEventListener = (el, name, f) => el.addEventListener(name, f)\n\n/**\n * @param {EventTarget} el\n * @param {string} name\n * @param {EventListener} f\n */\nexport const removeEventListener = (el, name, f) => el.removeEventListener(name, f)\n\n/**\n * @param {Node} node\n * @param {Array>} listeners\n * @return {Node}\n */\nexport const addEventListeners = (node, listeners) => {\n pair.forEach(listeners, (name, f) => addEventListener(node, name, f))\n return node\n}\n\n/**\n * @param {Node} node\n * @param {Array>} listeners\n * @return {Node}\n */\nexport const removeEventListeners = (node, listeners) => {\n pair.forEach(listeners, (name, f) => removeEventListener(node, name, f))\n return node\n}\n\n/**\n * @param {string} name\n * @param {Array|pair.Pair>} attrs Array of key-value pairs\n * @param {Array} children\n * @return {Element}\n */\nexport const element = (name, attrs = [], children = []) =>\n append(setAttributes(createElement(name), attrs), children)\n\n/**\n * @param {number} width\n * @param {number} height\n */\nexport const canvas = (width, height) => {\n const c = /** @type {HTMLCanvasElement} */ (createElement('canvas'))\n c.height = height\n c.width = width\n return c\n}\n\n/**\n * @param {string} t\n * @return {Text}\n */\nexport const text = createTextNode\n\n/**\n * @param {pair.Pair} pair\n */\nexport const pairToStyleString = pair => `${pair.left}:${pair.right};`\n\n/**\n * @param {Array>} pairs\n * @return {string}\n */\nexport const pairsToStyleString = pairs => pairs.map(pairToStyleString).join('')\n\n/**\n * @param {Map} m\n * @return {string}\n */\nexport const mapToStyleString = m => map.map(m, (value, key) => `${key}:${value};`).join('')\n\n/**\n * @todo should always query on a dom element\n *\n * @param {HTMLElement|ShadowRoot} el\n * @param {string} query\n * @return {HTMLElement | null}\n */\nexport const querySelector = (el, query) => el.querySelector(query)\n\n/**\n * @param {HTMLElement|ShadowRoot} el\n * @param {string} query\n * @return {NodeListOf}\n */\nexport const querySelectorAll = (el, query) => el.querySelectorAll(query)\n\n/**\n * @param {string} id\n * @return {HTMLElement}\n */\nexport const getElementById = id => /** @type {HTMLElement} */ (doc.getElementById(id))\n\n/**\n * @param {string} html\n * @return {HTMLElement}\n */\nconst _parse = html => domParser.parseFromString(`${html}`, 'text/html').body\n\n/**\n * @param {string} html\n * @return {DocumentFragment}\n */\nexport const parseFragment = html => fragment(/** @type {any} */ (_parse(html).childNodes))\n\n/**\n * @param {string} html\n * @return {HTMLElement}\n */\nexport const parseElement = html => /** @type HTMLElement */ (_parse(html).firstElementChild)\n\n/**\n * @param {HTMLElement} oldEl\n * @param {HTMLElement|DocumentFragment} newEl\n */\nexport const replaceWith = (oldEl, newEl) => oldEl.replaceWith(newEl)\n\n/**\n * @param {HTMLElement} parent\n * @param {HTMLElement} el\n * @param {Node|null} ref\n * @return {HTMLElement}\n */\nexport const insertBefore = (parent, el, ref) => parent.insertBefore(el, ref)\n\n/**\n * @param {Node} parent\n * @param {Node} child\n * @return {Node}\n */\nexport const appendChild = (parent, child) => parent.appendChild(child)\n\nexport const ELEMENT_NODE = doc.ELEMENT_NODE\nexport const TEXT_NODE = doc.TEXT_NODE\nexport const CDATA_SECTION_NODE = doc.CDATA_SECTION_NODE\nexport const COMMENT_NODE = doc.COMMENT_NODE\nexport const DOCUMENT_NODE = doc.DOCUMENT_NODE\nexport const DOCUMENT_TYPE_NODE = doc.DOCUMENT_TYPE_NODE\nexport const DOCUMENT_FRAGMENT_NODE = doc.DOCUMENT_FRAGMENT_NODE\n\n/**\n * @param {any} node\n * @param {number} type\n */\nexport const checkNodeType = (node, type) => node.nodeType === type\n\n/**\n * @param {Node} parent\n * @param {HTMLElement} child\n */\nexport const isParentOf = (parent, child) => {\n let p = child.parentNode\n while (p && p !== parent) {\n p = p.parentNode\n }\n return p === parent\n}\n/* c8 ignore stop */\n","/**\n * JSON utility functions.\n *\n * @module json\n */\n\n/**\n * Transform JavaScript object to JSON.\n *\n * @param {any} object\n * @return {string}\n */\nexport const stringify = JSON.stringify\n\n/**\n * Parse JSON object.\n *\n * @param {string} json\n * @return {any}\n */\nexport const parse = JSON.parse\n","/* global requestIdleCallback, requestAnimationFrame, cancelIdleCallback, cancelAnimationFrame */\n\n/**\n * Utility module to work with EcmaScript's event loop.\n *\n * @module eventloop\n */\n\n/**\n * @type {Array}\n */\nlet queue = []\n\nconst _runQueue = () => {\n for (let i = 0; i < queue.length; i++) {\n queue[i]()\n }\n queue = []\n}\n\n/**\n * @param {function():void} f\n */\nexport const enqueue = f => {\n queue.push(f)\n if (queue.length === 1) {\n setTimeout(_runQueue, 0)\n }\n}\n\n/**\n * @typedef {Object} TimeoutObject\n * @property {function} TimeoutObject.destroy\n */\n\n/**\n * @param {function(number):void} clearFunction\n */\nconst createTimeoutClass = clearFunction => class TT {\n /**\n * @param {number} timeoutId\n */\n constructor (timeoutId) {\n this._ = timeoutId\n }\n\n destroy () {\n clearFunction(this._)\n }\n}\n\nconst Timeout = createTimeoutClass(clearTimeout)\n\n/**\n * @param {number} timeout\n * @param {function} callback\n * @return {TimeoutObject}\n */\nexport const timeout = (timeout, callback) => new Timeout(setTimeout(callback, timeout))\n\nconst Interval = createTimeoutClass(clearInterval)\n\n/**\n * @param {number} timeout\n * @param {function} callback\n * @return {TimeoutObject}\n */\nexport const interval = (timeout, callback) => new Interval(setInterval(callback, timeout))\n\n/* c8 ignore next */\nexport const Animation = createTimeoutClass(arg => typeof requestAnimationFrame !== 'undefined' && cancelAnimationFrame(arg))\n\n/**\n * @param {function(number):void} cb\n * @return {TimeoutObject}\n */\n/* c8 ignore next */\nexport const animationFrame = cb => typeof requestAnimationFrame === 'undefined' ? timeout(0, cb) : new Animation(requestAnimationFrame(cb))\n\n/* c8 ignore next */\n// @ts-ignore\nconst Idle = createTimeoutClass(arg => typeof cancelIdleCallback !== 'undefined' && cancelIdleCallback(arg))\n\n/**\n * Note: this is experimental and is probably only useful in browsers.\n *\n * @param {function} cb\n * @return {TimeoutObject}\n */\n/* c8 ignore next 2 */\n// @ts-ignore\nexport const idleCallback = cb => typeof requestIdleCallback !== 'undefined' ? new Idle(requestIdleCallback(cb)) : timeout(1000, cb)\n\n/**\n * @param {number} timeout Timeout of the debounce action\n * @return {function(function():void):void}\n */\nexport const createDebouncer = timeout => {\n let timer = -1\n return f => {\n clearTimeout(timer)\n if (f) {\n timer = /** @type {any} */ (setTimeout(f, timeout))\n }\n }\n}\n","/**\n * Common Math expressions.\n *\n * @module math\n */\n\nexport const floor = Math.floor\nexport const ceil = Math.ceil\nexport const abs = Math.abs\nexport const imul = Math.imul\nexport const round = Math.round\nexport const log10 = Math.log10\nexport const log2 = Math.log2\nexport const log = Math.log\nexport const sqrt = Math.sqrt\n\n/**\n * @function\n * @param {number} a\n * @param {number} b\n * @return {number} The sum of a and b\n */\nexport const add = (a, b) => a + b\n\n/**\n * @function\n * @param {number} a\n * @param {number} b\n * @return {number} The smaller element of a and b\n */\nexport const min = (a, b) => a < b ? a : b\n\n/**\n * @function\n * @param {number} a\n * @param {number} b\n * @return {number} The bigger element of a and b\n */\nexport const max = (a, b) => a > b ? a : b\n\nexport const isNaN = Number.isNaN\n\nexport const pow = Math.pow\n/**\n * Base 10 exponential function. Returns the value of 10 raised to the power of pow.\n *\n * @param {number} exp\n * @return {number}\n */\nexport const exp10 = exp => Math.pow(10, exp)\n\nexport const sign = Math.sign\n\n/**\n * @param {number} n\n * @return {boolean} Wether n is negative. This function also differentiates between -0 and +0\n */\nexport const isNegativeZero = n => n !== 0 ? n < 0 : 1 / n < 0\n","/**\n * Utility module to work with EcmaScript Symbols.\n *\n * @module symbol\n */\n\n/**\n * Return fresh symbol.\n *\n * @return {Symbol}\n */\nexport const create = Symbol\n\n/**\n * @param {any} s\n * @return {boolean}\n */\nexport const isSymbol = s => typeof s === 'symbol'\n","/**\n * Utility module to convert metric values.\n *\n * @module metric\n */\n\nimport * as math from './math.js'\n\nexport const yotta = 1e24\nexport const zetta = 1e21\nexport const exa = 1e18\nexport const peta = 1e15\nexport const tera = 1e12\nexport const giga = 1e9\nexport const mega = 1e6\nexport const kilo = 1e3\nexport const hecto = 1e2\nexport const deca = 10\nexport const deci = 0.1\nexport const centi = 0.01\nexport const milli = 1e-3\nexport const micro = 1e-6\nexport const nano = 1e-9\nexport const pico = 1e-12\nexport const femto = 1e-15\nexport const atto = 1e-18\nexport const zepto = 1e-21\nexport const yocto = 1e-24\n\nconst prefixUp = ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']\nconst prefixDown = ['', 'm', 'μ', 'n', 'p', 'f', 'a', 'z', 'y']\n\n/**\n * Calculate the metric prefix for a number. Assumes E.g. `prefix(1000) = { n: 1, prefix: 'k' }`\n *\n * @param {number} n\n * @param {number} [baseMultiplier] Multiplier of the base (10^(3*baseMultiplier)). E.g. `convert(time, -3)` if time is already in milli seconds\n * @return {{n:number,prefix:string}}\n */\nexport const prefix = (n, baseMultiplier = 0) => {\n const nPow = n === 0 ? 0 : math.log10(n)\n let mult = 0\n while (nPow < mult * 3 && baseMultiplier > -8) {\n baseMultiplier--\n mult--\n }\n while (nPow >= 3 + mult * 3 && baseMultiplier < 8) {\n baseMultiplier++\n mult++\n }\n const prefix = baseMultiplier < 0 ? prefixDown[-baseMultiplier] : prefixUp[baseMultiplier]\n return {\n n: math.round((mult > 0 ? n / math.exp10(mult * 3) : n * math.exp10(mult * -3)) * 1e12) / 1e12,\n prefix\n }\n}\n","/**\n * Utility module to work with time.\n *\n * @module time\n */\n\nimport * as metric from './metric.js'\nimport * as math from './math.js'\n\n/**\n * Return current time.\n *\n * @return {Date}\n */\nexport const getDate = () => new Date()\n\n/**\n * Return current unix time.\n *\n * @return {number}\n */\nexport const getUnixTime = Date.now\n\n/**\n * Transform time (in ms) to a human readable format. E.g. 1100 => 1.1s. 60s => 1min. .001 => 10μs.\n *\n * @param {number} d duration in milliseconds\n * @return {string} humanized approximation of time\n */\nexport const humanizeDuration = d => {\n if (d < 60000) {\n const p = metric.prefix(d, -1)\n return math.round(p.n * 100) / 100 + p.prefix + 's'\n }\n d = math.floor(d / 1000)\n const seconds = d % 60\n const minutes = math.floor(d / 60) % 60\n const hours = math.floor(d / 3600) % 24\n const days = math.floor(d / 86400)\n if (days > 0) {\n return days + 'd' + ((hours > 0 || minutes > 30) ? ' ' + (minutes > 30 ? hours + 1 : hours) + 'h' : '')\n }\n if (hours > 0) {\n /* c8 ignore next */\n return hours + 'h' + ((minutes > 0 || seconds > 30) ? ' ' + (seconds > 30 ? minutes + 1 : minutes) + 'min' : '')\n }\n return minutes + 'min' + (seconds > 0 ? ' ' + seconds + 's' : '')\n}\n","import * as symbol from './symbol.js'\nimport * as time from './time.js'\nimport * as env from './environment.js'\nimport * as func from './function.js'\n\nexport const BOLD = symbol.create()\nexport const UNBOLD = symbol.create()\nexport const BLUE = symbol.create()\nexport const GREY = symbol.create()\nexport const GREEN = symbol.create()\nexport const RED = symbol.create()\nexport const PURPLE = symbol.create()\nexport const ORANGE = symbol.create()\nexport const UNCOLOR = symbol.create()\n\n/* c8 ignore start */\n/**\n * @param {Array} args\n * @return {Array}\n */\nexport const computeNoColorLoggingArgs = args => {\n const strBuilder = []\n const logArgs = []\n // try with formatting until we find something unsupported\n let i = 0\n for (; i < args.length; i++) {\n const arg = args[i]\n if (arg.constructor === String || arg.constructor === Number) {\n strBuilder.push(arg)\n } else if (arg.constructor === Object) {\n logArgs.push(JSON.stringify(arg))\n }\n }\n return logArgs\n}\n/* c8 ignore stop */\n\nconst loggingColors = [GREEN, PURPLE, ORANGE, BLUE]\nlet nextColor = 0\nlet lastLoggingTime = time.getUnixTime()\n\n/* c8 ignore start */\n/**\n * @param {function(...any):void} _print\n * @param {string} moduleName\n * @return {function(...any):void}\n */\nexport const createModuleLogger = (_print, moduleName) => {\n const color = loggingColors[nextColor]\n const debugRegexVar = env.getVariable('log')\n const doLogging = debugRegexVar !== null &&\n (debugRegexVar === '*' || debugRegexVar === 'true' ||\n new RegExp(debugRegexVar, 'gi').test(moduleName))\n nextColor = (nextColor + 1) % loggingColors.length\n moduleName += ': '\n return !doLogging\n ? func.nop\n : (...args) => {\n const timeNow = time.getUnixTime()\n const timeDiff = timeNow - lastLoggingTime\n lastLoggingTime = timeNow\n _print(\n color,\n moduleName,\n UNCOLOR,\n ...args.map((arg) =>\n (typeof arg === 'string' || typeof arg === 'symbol')\n ? arg\n : JSON.stringify(arg)\n ),\n color,\n ' +' + timeDiff + 'ms'\n )\n }\n}\n/* c8 ignore stop */\n","/**\n * Isomorphic logging module with support for colors!\n *\n * @module logging\n */\n\nimport * as env from './environment.js'\nimport * as set from './set.js'\nimport * as pair from './pair.js'\nimport * as dom from './dom.js'\nimport * as json from './json.js'\nimport * as map from './map.js'\nimport * as eventloop from './eventloop.js'\nimport * as math from './math.js'\nimport * as common from './logging.common.js'\n\nexport { BOLD, UNBOLD, BLUE, GREY, GREEN, RED, PURPLE, ORANGE, UNCOLOR } from './logging.common.js'\n\n/**\n * @type {Object>}\n */\nconst _browserStyleMap = {\n [common.BOLD]: pair.create('font-weight', 'bold'),\n [common.UNBOLD]: pair.create('font-weight', 'normal'),\n [common.BLUE]: pair.create('color', 'blue'),\n [common.GREEN]: pair.create('color', 'green'),\n [common.GREY]: pair.create('color', 'grey'),\n [common.RED]: pair.create('color', 'red'),\n [common.PURPLE]: pair.create('color', 'purple'),\n [common.ORANGE]: pair.create('color', 'orange'), // not well supported in chrome when debugging node with inspector - TODO: deprecate\n [common.UNCOLOR]: pair.create('color', 'black')\n}\n\n/**\n * @param {Array} args\n * @return {Array}\n */\n/* c8 ignore start */\nconst computeBrowserLoggingArgs = (args) => {\n const strBuilder = []\n const styles = []\n const currentStyle = map.create()\n /**\n * @type {Array}\n */\n let logArgs = []\n // try with formatting until we find something unsupported\n let i = 0\n for (; i < args.length; i++) {\n const arg = args[i]\n // @ts-ignore\n const style = _browserStyleMap[arg]\n if (style !== undefined) {\n currentStyle.set(style.left, style.right)\n } else {\n if (arg.constructor === String || arg.constructor === Number) {\n const style = dom.mapToStyleString(currentStyle)\n if (i > 0 || style.length > 0) {\n strBuilder.push('%c' + arg)\n styles.push(style)\n } else {\n strBuilder.push(arg)\n }\n } else {\n break\n }\n }\n }\n if (i > 0) {\n // create logArgs with what we have so far\n logArgs = styles\n logArgs.unshift(strBuilder.join(''))\n }\n // append the rest\n for (; i < args.length; i++) {\n const arg = args[i]\n if (!(arg instanceof Symbol)) {\n logArgs.push(arg)\n }\n }\n return logArgs\n}\n/* c8 ignore stop */\n\n/* c8 ignore start */\nconst computeLoggingArgs = env.supportsColor\n ? computeBrowserLoggingArgs\n : common.computeNoColorLoggingArgs\n/* c8 ignore stop */\n\n/**\n * @param {Array} args\n */\nexport const print = (...args) => {\n console.log(...computeLoggingArgs(args))\n /* c8 ignore next */\n vconsoles.forEach((vc) => vc.print(args))\n}\n\n/* c8 ignore start */\n/**\n * @param {Array} args\n */\nexport const warn = (...args) => {\n console.warn(...computeLoggingArgs(args))\n args.unshift(common.ORANGE)\n vconsoles.forEach((vc) => vc.print(args))\n}\n/* c8 ignore stop */\n\n/**\n * @param {Error} err\n */\n/* c8 ignore start */\nexport const printError = (err) => {\n console.error(err)\n vconsoles.forEach((vc) => vc.printError(err))\n}\n/* c8 ignore stop */\n\n/**\n * @param {string} url image location\n * @param {number} height height of the image in pixel\n */\n/* c8 ignore start */\nexport const printImg = (url, height) => {\n if (env.isBrowser) {\n console.log(\n '%c ',\n `font-size: ${height}px; background-size: contain; background-repeat: no-repeat; background-image: url(${url})`\n )\n // console.log('%c ', `font-size: ${height}x; background: url(${url}) no-repeat;`)\n }\n vconsoles.forEach((vc) => vc.printImg(url, height))\n}\n/* c8 ignore stop */\n\n/**\n * @param {string} base64\n * @param {number} height\n */\n/* c8 ignore next 2 */\nexport const printImgBase64 = (base64, height) =>\n printImg(`data:image/gif;base64,${base64}`, height)\n\n/**\n * @param {Array} args\n */\nexport const group = (...args) => {\n console.group(...computeLoggingArgs(args))\n /* c8 ignore next */\n vconsoles.forEach((vc) => vc.group(args))\n}\n\n/**\n * @param {Array} args\n */\nexport const groupCollapsed = (...args) => {\n console.groupCollapsed(...computeLoggingArgs(args))\n /* c8 ignore next */\n vconsoles.forEach((vc) => vc.groupCollapsed(args))\n}\n\nexport const groupEnd = () => {\n console.groupEnd()\n /* c8 ignore next */\n vconsoles.forEach((vc) => vc.groupEnd())\n}\n\n/**\n * @param {function():Node} createNode\n */\n/* c8 ignore next 2 */\nexport const printDom = (createNode) =>\n vconsoles.forEach((vc) => vc.printDom(createNode()))\n\n/**\n * @param {HTMLCanvasElement} canvas\n * @param {number} height\n */\n/* c8 ignore next 2 */\nexport const printCanvas = (canvas, height) =>\n printImg(canvas.toDataURL(), height)\n\nexport const vconsoles = set.create()\n\n/**\n * @param {Array} args\n * @return {Array}\n */\n/* c8 ignore start */\nconst _computeLineSpans = (args) => {\n const spans = []\n const currentStyle = new Map()\n // try with formatting until we find something unsupported\n let i = 0\n for (; i < args.length; i++) {\n const arg = args[i]\n // @ts-ignore\n const style = _browserStyleMap[arg]\n if (style !== undefined) {\n currentStyle.set(style.left, style.right)\n } else {\n if (arg.constructor === String || arg.constructor === Number) {\n // @ts-ignore\n const span = dom.element('span', [\n pair.create('style', dom.mapToStyleString(currentStyle))\n ], [dom.text(arg.toString())])\n if (span.innerHTML === '') {\n span.innerHTML = ' '\n }\n spans.push(span)\n } else {\n break\n }\n }\n }\n // append the rest\n for (; i < args.length; i++) {\n let content = args[i]\n if (!(content instanceof Symbol)) {\n if (content.constructor !== String && content.constructor !== Number) {\n content = ' ' + json.stringify(content) + ' '\n }\n spans.push(\n dom.element('span', [], [dom.text(/** @type {string} */ (content))])\n )\n }\n }\n return spans\n}\n/* c8 ignore stop */\n\nconst lineStyle =\n 'font-family:monospace;border-bottom:1px solid #e2e2e2;padding:2px;'\n\n/* c8 ignore start */\nexport class VConsole {\n /**\n * @param {Element} dom\n */\n constructor (dom) {\n this.dom = dom\n /**\n * @type {Element}\n */\n this.ccontainer = this.dom\n this.depth = 0\n vconsoles.add(this)\n }\n\n /**\n * @param {Array} args\n * @param {boolean} collapsed\n */\n group (args, collapsed = false) {\n eventloop.enqueue(() => {\n const triangleDown = dom.element('span', [\n pair.create('hidden', collapsed),\n pair.create('style', 'color:grey;font-size:120%;')\n ], [dom.text('▼')])\n const triangleRight = dom.element('span', [\n pair.create('hidden', !collapsed),\n pair.create('style', 'color:grey;font-size:125%;')\n ], [dom.text('▶')])\n const content = dom.element(\n 'div',\n [pair.create(\n 'style',\n `${lineStyle};padding-left:${this.depth * 10}px`\n )],\n [triangleDown, triangleRight, dom.text(' ')].concat(\n _computeLineSpans(args)\n )\n )\n const nextContainer = dom.element('div', [\n pair.create('hidden', collapsed)\n ])\n const nextLine = dom.element('div', [], [content, nextContainer])\n dom.append(this.ccontainer, [nextLine])\n this.ccontainer = nextContainer\n this.depth++\n // when header is clicked, collapse/uncollapse container\n dom.addEventListener(content, 'click', (_event) => {\n nextContainer.toggleAttribute('hidden')\n triangleDown.toggleAttribute('hidden')\n triangleRight.toggleAttribute('hidden')\n })\n })\n }\n\n /**\n * @param {Array} args\n */\n groupCollapsed (args) {\n this.group(args, true)\n }\n\n groupEnd () {\n eventloop.enqueue(() => {\n if (this.depth > 0) {\n this.depth--\n // @ts-ignore\n this.ccontainer = this.ccontainer.parentElement.parentElement\n }\n })\n }\n\n /**\n * @param {Array} args\n */\n print (args) {\n eventloop.enqueue(() => {\n dom.append(this.ccontainer, [\n dom.element('div', [\n pair.create(\n 'style',\n `${lineStyle};padding-left:${this.depth * 10}px`\n )\n ], _computeLineSpans(args))\n ])\n })\n }\n\n /**\n * @param {Error} err\n */\n printError (err) {\n this.print([common.RED, common.BOLD, err.toString()])\n }\n\n /**\n * @param {string} url\n * @param {number} height\n */\n printImg (url, height) {\n eventloop.enqueue(() => {\n dom.append(this.ccontainer, [\n dom.element('img', [\n pair.create('src', url),\n pair.create('height', `${math.round(height * 1.5)}px`)\n ])\n ])\n })\n }\n\n /**\n * @param {Node} node\n */\n printDom (node) {\n eventloop.enqueue(() => {\n dom.append(this.ccontainer, [node])\n })\n }\n\n destroy () {\n eventloop.enqueue(() => {\n vconsoles.delete(this)\n })\n }\n}\n/* c8 ignore stop */\n\n/**\n * @param {Element} dom\n */\n/* c8 ignore next */\nexport const createVConsole = (dom) => new VConsole(dom)\n\n/**\n * @param {string} moduleName\n * @return {function(...any):void}\n */\nexport const createModuleLogger = (moduleName) => common.createModuleLogger(print, moduleName)\n","/* eslint-env browser */\n\n/**\n * Binary data constants.\n *\n * @module binary\n */\n\n/**\n * n-th bit activated.\n *\n * @type {number}\n */\nexport const BIT1 = 1\nexport const BIT2 = 2\nexport const BIT3 = 4\nexport const BIT4 = 8\nexport const BIT5 = 16\nexport const BIT6 = 32\nexport const BIT7 = 64\nexport const BIT8 = 128\nexport const BIT9 = 256\nexport const BIT10 = 512\nexport const BIT11 = 1024\nexport const BIT12 = 2048\nexport const BIT13 = 4096\nexport const BIT14 = 8192\nexport const BIT15 = 16384\nexport const BIT16 = 32768\nexport const BIT17 = 65536\nexport const BIT18 = 1 << 17\nexport const BIT19 = 1 << 18\nexport const BIT20 = 1 << 19\nexport const BIT21 = 1 << 20\nexport const BIT22 = 1 << 21\nexport const BIT23 = 1 << 22\nexport const BIT24 = 1 << 23\nexport const BIT25 = 1 << 24\nexport const BIT26 = 1 << 25\nexport const BIT27 = 1 << 26\nexport const BIT28 = 1 << 27\nexport const BIT29 = 1 << 28\nexport const BIT30 = 1 << 29\nexport const BIT31 = 1 << 30\nexport const BIT32 = 1 << 31\n\n/**\n * First n bits activated.\n *\n * @type {number}\n */\nexport const BITS0 = 0\nexport const BITS1 = 1\nexport const BITS2 = 3\nexport const BITS3 = 7\nexport const BITS4 = 15\nexport const BITS5 = 31\nexport const BITS6 = 63\nexport const BITS7 = 127\nexport const BITS8 = 255\nexport const BITS9 = 511\nexport const BITS10 = 1023\nexport const BITS11 = 2047\nexport const BITS12 = 4095\nexport const BITS13 = 8191\nexport const BITS14 = 16383\nexport const BITS15 = 32767\nexport const BITS16 = 65535\nexport const BITS17 = BIT18 - 1\nexport const BITS18 = BIT19 - 1\nexport const BITS19 = BIT20 - 1\nexport const BITS20 = BIT21 - 1\nexport const BITS21 = BIT22 - 1\nexport const BITS22 = BIT23 - 1\nexport const BITS23 = BIT24 - 1\nexport const BITS24 = BIT25 - 1\nexport const BITS25 = BIT26 - 1\nexport const BITS26 = BIT27 - 1\nexport const BITS27 = BIT28 - 1\nexport const BITS28 = BIT29 - 1\nexport const BITS29 = BIT30 - 1\nexport const BITS30 = BIT31 - 1\n/**\n * @type {number}\n */\nexport const BITS31 = 0x7FFFFFFF\n/**\n * @type {number}\n */\nexport const BITS32 = 0xFFFFFFFF\n","/* eslint-env browser */\n\nexport const subtle = crypto.subtle\nexport const getRandomValues = crypto.getRandomValues.bind(crypto)\n","/**\n * Isomorphic module for true random numbers / buffers / uuids.\n *\n * Attention: falls back to Math.random if the browser does not support crypto.\n *\n * @module random\n */\n\nimport * as math from './math.js'\nimport * as binary from './binary.js'\nimport { getRandomValues } from 'lib0/webcrypto'\n\nexport const rand = Math.random\n\nexport const uint32 = () => getRandomValues(new Uint32Array(1))[0]\n\nexport const uint53 = () => {\n const arr = getRandomValues(new Uint32Array(8))\n return (arr[0] & binary.BITS21) * (binary.BITS32 + 1) + (arr[1] >>> 0)\n}\n\n/**\n * @template T\n * @param {Array} arr\n * @return {T}\n */\nexport const oneOf = arr => arr[math.floor(rand() * arr.length)]\n\n// @ts-ignore\nconst uuidv4Template = [1e7] + -1e3 + -4e3 + -8e3 + -1e11\n\n/**\n * @return {string}\n */\nexport const uuidv4 = () => uuidv4Template.replace(/[018]/g, /** @param {number} c */ c =>\n (c ^ uint32() & 15 >> c / 4).toString(16)\n)\n","/**\n * @module prng\n */\n\nimport * as binary from '../binary.js'\n\n/**\n * Xorshift32 is a very simple but elegang PRNG with a period of `2^32-1`.\n */\nexport class Xorshift32 {\n /**\n * @param {number} seed Unsigned 32 bit number\n */\n constructor (seed) {\n this.seed = seed\n /**\n * @type {number}\n */\n this._state = seed\n }\n\n /**\n * Generate a random signed integer.\n *\n * @return {Number} A 32 bit signed integer.\n */\n next () {\n let x = this._state\n x ^= x << 13\n x ^= x >> 17\n x ^= x << 5\n this._state = x\n return (x >>> 0) / (binary.BITS32 + 1)\n }\n}\n","/**\n * @module prng\n */\n\nimport { Xorshift32 } from './Xorshift32.js'\nimport * as binary from '../binary.js'\n\n/**\n * This is a variant of xoroshiro128plus - the fastest full-period generator passing BigCrush without systematic failures.\n *\n * This implementation follows the idea of the original xoroshiro128plus implementation,\n * but is optimized for the JavaScript runtime. I.e.\n * * The operations are performed on 32bit integers (the original implementation works with 64bit values).\n * * The initial 128bit state is computed based on a 32bit seed and Xorshift32.\n * * This implementation returns two 32bit values based on the 64bit value that is computed by xoroshiro128plus.\n * Caution: The last addition step works slightly different than in the original implementation - the add carry of the\n * first 32bit addition is not carried over to the last 32bit.\n *\n * [Reference implementation](http://vigna.di.unimi.it/xorshift/xoroshiro128plus.c)\n */\nexport class Xoroshiro128plus {\n /**\n * @param {number} seed Unsigned 32 bit number\n */\n constructor (seed) {\n this.seed = seed\n // This is a variant of Xoroshiro128plus to fill the initial state\n const xorshift32 = new Xorshift32(seed)\n this.state = new Uint32Array(4)\n for (let i = 0; i < 4; i++) {\n this.state[i] = xorshift32.next() * binary.BITS32\n }\n this._fresh = true\n }\n\n /**\n * @return {number} Float/Double in [0,1)\n */\n next () {\n const state = this.state\n if (this._fresh) {\n this._fresh = false\n return ((state[0] + state[2]) >>> 0) / (binary.BITS32 + 1)\n } else {\n this._fresh = true\n const s0 = state[0]\n const s1 = state[1]\n const s2 = state[2] ^ s0\n const s3 = state[3] ^ s1\n // function js_rotl (x, k) {\n // k = k - 32\n // const x1 = x[0]\n // const x2 = x[1]\n // x[0] = x2 << k | x1 >>> (32 - k)\n // x[1] = x1 << k | x2 >>> (32 - k)\n // }\n // rotl(s0, 55) // k = 23 = 55 - 32; j = 9 = 32 - 23\n state[0] = (s1 << 23 | s0 >>> 9) ^ s2 ^ (s2 << 14 | s3 >>> 18)\n state[1] = (s0 << 23 | s1 >>> 9) ^ s3 ^ (s3 << 14)\n // rol(s1, 36) // k = 4 = 36 - 32; j = 23 = 32 - 9\n state[2] = s3 << 4 | s2 >>> 28\n state[3] = s2 << 4 | s3 >>> 28\n return (((state[1] + state[3]) >>> 0) / (binary.BITS32 + 1))\n }\n }\n}\n\n/*\n// Reference implementation\n// Source: http://vigna.di.unimi.it/xorshift/xoroshiro128plus.c\n// By David Blackman and Sebastiano Vigna\n// Who published the reference implementation under Public Domain (CC0)\n\n#include \n#include \n\nuint64_t s[2];\n\nstatic inline uint64_t rotl(const uint64_t x, int k) {\n return (x << k) | (x >> (64 - k));\n}\n\nuint64_t next(void) {\n const uint64_t s0 = s[0];\n uint64_t s1 = s[1];\n s1 ^= s0;\n s[0] = rotl(s0, 55) ^ s1 ^ (s1 << 14); // a, b\n s[1] = rotl(s1, 36); // c\n return (s[0] + s[1]) & 0xFFFFFFFF;\n}\n\nint main(void)\n{\n int i;\n s[0] = 1111 | (1337ul << 32);\n s[1] = 1234 | (9999ul << 32);\n\n printf(\"1000 outputs of genrand_int31()\\n\");\n for (i=0; i<100; i++) {\n printf(\"%10lu \", i);\n printf(\"%10lu \", next());\n printf(\"- %10lu \", s[0] >> 32);\n printf(\"%10lu \", (s[0] << 32) >> 32);\n printf(\"%10lu \", s[1] >> 32);\n printf(\"%10lu \", (s[1] << 32) >> 32);\n printf(\"\\n\");\n // if (i%5==4) printf(\"\\n\");\n }\n return 0;\n}\n*/\n","/**\n * Utility helpers for working with numbers.\n *\n * @module number\n */\n\nimport * as math from './math.js'\nimport * as binary from './binary.js'\n\nexport const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER\nexport const MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER\n\nexport const LOWEST_INT32 = 1 << 31\nexport const HIGHEST_INT32 = binary.BITS31\nexport const HIGHEST_UINT32 = binary.BITS32\n\n/* c8 ignore next */\nexport const isInteger = Number.isInteger || (num => typeof num === 'number' && isFinite(num) && math.floor(num) === num)\nexport const isNaN = Number.isNaN\nexport const parseInt = Number.parseInt\n\n/**\n * Count the number of \"1\" bits in an unsigned 32bit number.\n *\n * Super fun bitcount algorithm by Brian Kernighan.\n *\n * @param {number} n\n */\nexport const countBits = n => {\n n &= binary.BITS32\n let count = 0\n while (n) {\n n &= (n - 1)\n count++\n }\n return count\n}\n","/**\n * Efficient schema-less binary encoding with support for variable length encoding.\n *\n * Use [lib0/encoding] with [lib0/decoding]. Every encoding function has a corresponding decoding function.\n *\n * Encodes numbers in little-endian order (least to most significant byte order)\n * and is compatible with Golang's binary encoding (https://golang.org/pkg/encoding/binary/)\n * which is also used in Protocol Buffers.\n *\n * ```js\n * // encoding step\n * const encoder = encoding.createEncoder()\n * encoding.writeVarUint(encoder, 256)\n * encoding.writeVarString(encoder, 'Hello world!')\n * const buf = encoding.toUint8Array(encoder)\n * ```\n *\n * ```js\n * // decoding step\n * const decoder = decoding.createDecoder(buf)\n * decoding.readVarUint(decoder) // => 256\n * decoding.readVarString(decoder) // => 'Hello world!'\n * decoding.hasContent(decoder) // => false - all data is read\n * ```\n *\n * @module encoding\n */\n\nimport * as buffer from './buffer.js'\nimport * as math from './math.js'\nimport * as number from './number.js'\nimport * as binary from './binary.js'\nimport * as string from './string.js'\nimport * as array from './array.js'\n\n/**\n * A BinaryEncoder handles the encoding to an Uint8Array.\n */\nexport class Encoder {\n constructor () {\n this.cpos = 0\n this.cbuf = new Uint8Array(100)\n /**\n * @type {Array}\n */\n this.bufs = []\n }\n}\n\n/**\n * @function\n * @return {Encoder}\n */\nexport const createEncoder = () => new Encoder()\n\n/**\n * @param {function(Encoder):void} f\n */\nexport const encode = (f) => {\n const encoder = createEncoder()\n f(encoder)\n return toUint8Array(encoder)\n}\n\n/**\n * The current length of the encoded data.\n *\n * @function\n * @param {Encoder} encoder\n * @return {number}\n */\nexport const length = encoder => {\n let len = encoder.cpos\n for (let i = 0; i < encoder.bufs.length; i++) {\n len += encoder.bufs[i].length\n }\n return len\n}\n\n/**\n * Check whether encoder is empty.\n *\n * @function\n * @param {Encoder} encoder\n * @return {boolean}\n */\nexport const hasContent = encoder => encoder.cpos > 0 || encoder.bufs.length > 0\n\n/**\n * Transform to Uint8Array.\n *\n * @function\n * @param {Encoder} encoder\n * @return {Uint8Array} The created ArrayBuffer.\n */\nexport const toUint8Array = encoder => {\n const uint8arr = new Uint8Array(length(encoder))\n let curPos = 0\n for (let i = 0; i < encoder.bufs.length; i++) {\n const d = encoder.bufs[i]\n uint8arr.set(d, curPos)\n curPos += d.length\n }\n uint8arr.set(buffer.createUint8ArrayViewFromArrayBuffer(encoder.cbuf.buffer, 0, encoder.cpos), curPos)\n return uint8arr\n}\n\n/**\n * Verify that it is possible to write `len` bytes wtihout checking. If\n * necessary, a new Buffer with the required length is attached.\n *\n * @param {Encoder} encoder\n * @param {number} len\n */\nexport const verifyLen = (encoder, len) => {\n const bufferLen = encoder.cbuf.length\n if (bufferLen - encoder.cpos < len) {\n encoder.bufs.push(buffer.createUint8ArrayViewFromArrayBuffer(encoder.cbuf.buffer, 0, encoder.cpos))\n encoder.cbuf = new Uint8Array(math.max(bufferLen, len) * 2)\n encoder.cpos = 0\n }\n}\n\n/**\n * Write one byte to the encoder.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The byte that is to be encoded.\n */\nexport const write = (encoder, num) => {\n const bufferLen = encoder.cbuf.length\n if (encoder.cpos === bufferLen) {\n encoder.bufs.push(encoder.cbuf)\n encoder.cbuf = new Uint8Array(bufferLen * 2)\n encoder.cpos = 0\n }\n encoder.cbuf[encoder.cpos++] = num\n}\n\n/**\n * Write one byte at a specific position.\n * Position must already be written (i.e. encoder.length > pos)\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} pos Position to which to write data\n * @param {number} num Unsigned 8-bit integer\n */\nexport const set = (encoder, pos, num) => {\n let buffer = null\n // iterate all buffers and adjust position\n for (let i = 0; i < encoder.bufs.length && buffer === null; i++) {\n const b = encoder.bufs[i]\n if (pos < b.length) {\n buffer = b // found buffer\n } else {\n pos -= b.length\n }\n }\n if (buffer === null) {\n // use current buffer\n buffer = encoder.cbuf\n }\n buffer[pos] = num\n}\n\n/**\n * Write one byte as an unsigned integer.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The number that is to be encoded.\n */\nexport const writeUint8 = write\n\n/**\n * Write one byte as an unsigned Integer at a specific location.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} pos The location where the data will be written.\n * @param {number} num The number that is to be encoded.\n */\nexport const setUint8 = set\n\n/**\n * Write two bytes as an unsigned integer.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The number that is to be encoded.\n */\nexport const writeUint16 = (encoder, num) => {\n write(encoder, num & binary.BITS8)\n write(encoder, (num >>> 8) & binary.BITS8)\n}\n/**\n * Write two bytes as an unsigned integer at a specific location.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} pos The location where the data will be written.\n * @param {number} num The number that is to be encoded.\n */\nexport const setUint16 = (encoder, pos, num) => {\n set(encoder, pos, num & binary.BITS8)\n set(encoder, pos + 1, (num >>> 8) & binary.BITS8)\n}\n\n/**\n * Write two bytes as an unsigned integer\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The number that is to be encoded.\n */\nexport const writeUint32 = (encoder, num) => {\n for (let i = 0; i < 4; i++) {\n write(encoder, num & binary.BITS8)\n num >>>= 8\n }\n}\n\n/**\n * Write two bytes as an unsigned integer in big endian order.\n * (most significant byte first)\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The number that is to be encoded.\n */\nexport const writeUint32BigEndian = (encoder, num) => {\n for (let i = 3; i >= 0; i--) {\n write(encoder, (num >>> (8 * i)) & binary.BITS8)\n }\n}\n\n/**\n * Write two bytes as an unsigned integer at a specific location.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} pos The location where the data will be written.\n * @param {number} num The number that is to be encoded.\n */\nexport const setUint32 = (encoder, pos, num) => {\n for (let i = 0; i < 4; i++) {\n set(encoder, pos + i, num & binary.BITS8)\n num >>>= 8\n }\n}\n\n/**\n * Write a variable length unsigned integer. Max encodable integer is 2^53.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The number that is to be encoded.\n */\nexport const writeVarUint = (encoder, num) => {\n while (num > binary.BITS7) {\n write(encoder, binary.BIT8 | (binary.BITS7 & num))\n num = math.floor(num / 128) // shift >>> 7\n }\n write(encoder, binary.BITS7 & num)\n}\n\n/**\n * Write a variable length integer.\n *\n * We use the 7th bit instead for signaling that this is a negative number.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The number that is to be encoded.\n */\nexport const writeVarInt = (encoder, num) => {\n const isNegative = math.isNegativeZero(num)\n if (isNegative) {\n num = -num\n }\n // |- whether to continue reading |- whether is negative |- number\n write(encoder, (num > binary.BITS6 ? binary.BIT8 : 0) | (isNegative ? binary.BIT7 : 0) | (binary.BITS6 & num))\n num = math.floor(num / 64) // shift >>> 6\n // We don't need to consider the case of num === 0 so we can use a different\n // pattern here than above.\n while (num > 0) {\n write(encoder, (num > binary.BITS7 ? binary.BIT8 : 0) | (binary.BITS7 & num))\n num = math.floor(num / 128) // shift >>> 7\n }\n}\n\n/**\n * A cache to store strings temporarily\n */\nconst _strBuffer = new Uint8Array(30000)\nconst _maxStrBSize = _strBuffer.length / 3\n\n/**\n * Write a variable length string.\n *\n * @function\n * @param {Encoder} encoder\n * @param {String} str The string that is to be encoded.\n */\nexport const _writeVarStringNative = (encoder, str) => {\n if (str.length < _maxStrBSize) {\n // We can encode the string into the existing buffer\n /* c8 ignore next */\n const written = string.utf8TextEncoder.encodeInto(str, _strBuffer).written || 0\n writeVarUint(encoder, written)\n for (let i = 0; i < written; i++) {\n write(encoder, _strBuffer[i])\n }\n } else {\n writeVarUint8Array(encoder, string.encodeUtf8(str))\n }\n}\n\n/**\n * Write a variable length string.\n *\n * @function\n * @param {Encoder} encoder\n * @param {String} str The string that is to be encoded.\n */\nexport const _writeVarStringPolyfill = (encoder, str) => {\n const encodedString = unescape(encodeURIComponent(str))\n const len = encodedString.length\n writeVarUint(encoder, len)\n for (let i = 0; i < len; i++) {\n write(encoder, /** @type {number} */ (encodedString.codePointAt(i)))\n }\n}\n\n/**\n * Write a variable length string.\n *\n * @function\n * @param {Encoder} encoder\n * @param {String} str The string that is to be encoded.\n */\n/* c8 ignore next */\nexport const writeVarString = (string.utf8TextEncoder && /** @type {any} */ (string.utf8TextEncoder).encodeInto) ? _writeVarStringNative : _writeVarStringPolyfill\n\n/**\n * Write a string terminated by a special byte sequence. This is not very performant and is\n * generally discouraged. However, the resulting byte arrays are lexiographically ordered which\n * makes this a nice feature for databases.\n *\n * The string will be encoded using utf8 and then terminated and escaped using writeTerminatingUint8Array.\n *\n * @function\n * @param {Encoder} encoder\n * @param {String} str The string that is to be encoded.\n */\nexport const writeTerminatedString = (encoder, str) =>\n writeTerminatedUint8Array(encoder, string.encodeUtf8(str))\n\n/**\n * Write a terminating Uint8Array. Note that this is not performant and is generally\n * discouraged. There are few situations when this is needed.\n *\n * We use 0x0 as a terminating character. 0x1 serves as an escape character for 0x0 and 0x1.\n *\n * Example: [0,1,2] is encoded to [1,0,1,1,2,0]. 0x0, and 0x1 needed to be escaped using 0x1. Then\n * the result is terminated using the 0x0 character.\n *\n * This is basically how many systems implement null terminated strings. However, we use an escape\n * character 0x1 to avoid issues and potenial attacks on our database (if this is used as a key\n * encoder for NoSql databases).\n *\n * @function\n * @param {Encoder} encoder\n * @param {Uint8Array} buf The string that is to be encoded.\n */\nexport const writeTerminatedUint8Array = (encoder, buf) => {\n for (let i = 0; i < buf.length; i++) {\n const b = buf[i]\n if (b === 0 || b === 1) {\n write(encoder, 1)\n }\n write(encoder, buf[i])\n }\n write(encoder, 0)\n}\n\n/**\n * Write the content of another Encoder.\n *\n * @TODO: can be improved!\n * - Note: Should consider that when appending a lot of small Encoders, we should rather clone than referencing the old structure.\n * Encoders start with a rather big initial buffer.\n *\n * @function\n * @param {Encoder} encoder The enUint8Arr\n * @param {Encoder} append The BinaryEncoder to be written.\n */\nexport const writeBinaryEncoder = (encoder, append) => writeUint8Array(encoder, toUint8Array(append))\n\n/**\n * Append fixed-length Uint8Array to the encoder.\n *\n * @function\n * @param {Encoder} encoder\n * @param {Uint8Array} uint8Array\n */\nexport const writeUint8Array = (encoder, uint8Array) => {\n const bufferLen = encoder.cbuf.length\n const cpos = encoder.cpos\n const leftCopyLen = math.min(bufferLen - cpos, uint8Array.length)\n const rightCopyLen = uint8Array.length - leftCopyLen\n encoder.cbuf.set(uint8Array.subarray(0, leftCopyLen), cpos)\n encoder.cpos += leftCopyLen\n if (rightCopyLen > 0) {\n // Still something to write, write right half..\n // Append new buffer\n encoder.bufs.push(encoder.cbuf)\n // must have at least size of remaining buffer\n encoder.cbuf = new Uint8Array(math.max(bufferLen * 2, rightCopyLen))\n // copy array\n encoder.cbuf.set(uint8Array.subarray(leftCopyLen))\n encoder.cpos = rightCopyLen\n }\n}\n\n/**\n * Append an Uint8Array to Encoder.\n *\n * @function\n * @param {Encoder} encoder\n * @param {Uint8Array} uint8Array\n */\nexport const writeVarUint8Array = (encoder, uint8Array) => {\n writeVarUint(encoder, uint8Array.byteLength)\n writeUint8Array(encoder, uint8Array)\n}\n\n/**\n * Create an DataView of the next `len` bytes. Use it to write data after\n * calling this function.\n *\n * ```js\n * // write float32 using DataView\n * const dv = writeOnDataView(encoder, 4)\n * dv.setFloat32(0, 1.1)\n * // read float32 using DataView\n * const dv = readFromDataView(encoder, 4)\n * dv.getFloat32(0) // => 1.100000023841858 (leaving it to the reader to find out why this is the correct result)\n * ```\n *\n * @param {Encoder} encoder\n * @param {number} len\n * @return {DataView}\n */\nexport const writeOnDataView = (encoder, len) => {\n verifyLen(encoder, len)\n const dview = new DataView(encoder.cbuf.buffer, encoder.cpos, len)\n encoder.cpos += len\n return dview\n}\n\n/**\n * @param {Encoder} encoder\n * @param {number} num\n */\nexport const writeFloat32 = (encoder, num) => writeOnDataView(encoder, 4).setFloat32(0, num, false)\n\n/**\n * @param {Encoder} encoder\n * @param {number} num\n */\nexport const writeFloat64 = (encoder, num) => writeOnDataView(encoder, 8).setFloat64(0, num, false)\n\n/**\n * @param {Encoder} encoder\n * @param {bigint} num\n */\nexport const writeBigInt64 = (encoder, num) => /** @type {any} */ (writeOnDataView(encoder, 8)).setBigInt64(0, num, false)\n\n/**\n * @param {Encoder} encoder\n * @param {bigint} num\n */\nexport const writeBigUint64 = (encoder, num) => /** @type {any} */ (writeOnDataView(encoder, 8)).setBigUint64(0, num, false)\n\nconst floatTestBed = new DataView(new ArrayBuffer(4))\n/**\n * Check if a number can be encoded as a 32 bit float.\n *\n * @param {number} num\n * @return {boolean}\n */\nconst isFloat32 = num => {\n floatTestBed.setFloat32(0, num)\n return floatTestBed.getFloat32(0) === num\n}\n\n/**\n * Encode data with efficient binary format.\n *\n * Differences to JSON:\n * • Transforms data to a binary format (not to a string)\n * • Encodes undefined, NaN, and ArrayBuffer (these can't be represented in JSON)\n * • Numbers are efficiently encoded either as a variable length integer, as a\n * 32 bit float, as a 64 bit float, or as a 64 bit bigint.\n *\n * Encoding table:\n *\n * | Data Type | Prefix | Encoding Method | Comment |\n * | ------------------- | -------- | ------------------ | ------- |\n * | undefined | 127 | | Functions, symbol, and everything that cannot be identified is encoded as undefined |\n * | null | 126 | | |\n * | integer | 125 | writeVarInt | Only encodes 32 bit signed integers |\n * | float32 | 124 | writeFloat32 | |\n * | float64 | 123 | writeFloat64 | |\n * | bigint | 122 | writeBigInt64 | |\n * | boolean (false) | 121 | | True and false are different data types so we save the following byte |\n * | boolean (true) | 120 | | - 0b01111000 so the last bit determines whether true or false |\n * | string | 119 | writeVarString | |\n * | object | 118 | custom | Writes {length} then {length} key-value pairs |\n * | array | 117 | custom | Writes {length} then {length} json values |\n * | Uint8Array | 116 | writeVarUint8Array | We use Uint8Array for any kind of binary data |\n *\n * Reasons for the decreasing prefix:\n * We need the first bit for extendability (later we may want to encode the\n * prefix with writeVarUint). The remaining 7 bits are divided as follows:\n * [0-30] the beginning of the data range is used for custom purposes\n * (defined by the function that uses this library)\n * [31-127] the end of the data range is used for data encoding by\n * lib0/encoding.js\n *\n * @param {Encoder} encoder\n * @param {undefined|null|number|bigint|boolean|string|Object|Array|Uint8Array} data\n */\nexport const writeAny = (encoder, data) => {\n switch (typeof data) {\n case 'string':\n // TYPE 119: STRING\n write(encoder, 119)\n writeVarString(encoder, data)\n break\n case 'number':\n if (number.isInteger(data) && math.abs(data) <= binary.BITS31) {\n // TYPE 125: INTEGER\n write(encoder, 125)\n writeVarInt(encoder, data)\n } else if (isFloat32(data)) {\n // TYPE 124: FLOAT32\n write(encoder, 124)\n writeFloat32(encoder, data)\n } else {\n // TYPE 123: FLOAT64\n write(encoder, 123)\n writeFloat64(encoder, data)\n }\n break\n case 'bigint':\n // TYPE 122: BigInt\n write(encoder, 122)\n writeBigInt64(encoder, data)\n break\n case 'object':\n if (data === null) {\n // TYPE 126: null\n write(encoder, 126)\n } else if (array.isArray(data)) {\n // TYPE 117: Array\n write(encoder, 117)\n writeVarUint(encoder, data.length)\n for (let i = 0; i < data.length; i++) {\n writeAny(encoder, data[i])\n }\n } else if (data instanceof Uint8Array) {\n // TYPE 116: ArrayBuffer\n write(encoder, 116)\n writeVarUint8Array(encoder, data)\n } else {\n // TYPE 118: Object\n write(encoder, 118)\n const keys = Object.keys(data)\n writeVarUint(encoder, keys.length)\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i]\n writeVarString(encoder, key)\n writeAny(encoder, data[key])\n }\n }\n break\n case 'boolean':\n // TYPE 120/121: boolean (true/false)\n write(encoder, data ? 120 : 121)\n break\n default:\n // TYPE 127: undefined\n write(encoder, 127)\n }\n}\n\n/**\n * Now come a few stateful encoder that have their own classes.\n */\n\n/**\n * Basic Run Length Encoder - a basic compression implementation.\n *\n * Encodes [1,1,1,7] to [1,3,7,1] (3 times 1, 1 time 7). This encoder might do more harm than good if there are a lot of values that are not repeated.\n *\n * It was originally used for image compression. Cool .. article http://csbruce.com/cbm/transactor/pdfs/trans_v7_i06.pdf\n *\n * @note T must not be null!\n *\n * @template T\n */\nexport class RleEncoder extends Encoder {\n /**\n * @param {function(Encoder, T):void} writer\n */\n constructor (writer) {\n super()\n /**\n * The writer\n */\n this.w = writer\n /**\n * Current state\n * @type {T|null}\n */\n this.s = null\n this.count = 0\n }\n\n /**\n * @param {T} v\n */\n write (v) {\n if (this.s === v) {\n this.count++\n } else {\n if (this.count > 0) {\n // flush counter, unless this is the first value (count = 0)\n writeVarUint(this, this.count - 1) // since count is always > 0, we can decrement by one. non-standard encoding ftw\n }\n this.count = 1\n // write first value\n this.w(this, v)\n this.s = v\n }\n }\n}\n\n/**\n * Basic diff decoder using variable length encoding.\n *\n * Encodes the values [3, 1100, 1101, 1050, 0] to [3, 1097, 1, -51, -1050] using writeVarInt.\n */\nexport class IntDiffEncoder extends Encoder {\n /**\n * @param {number} start\n */\n constructor (start) {\n super()\n /**\n * Current state\n * @type {number}\n */\n this.s = start\n }\n\n /**\n * @param {number} v\n */\n write (v) {\n writeVarInt(this, v - this.s)\n this.s = v\n }\n}\n\n/**\n * A combination of IntDiffEncoder and RleEncoder.\n *\n * Basically first writes the IntDiffEncoder and then counts duplicate diffs using RleEncoding.\n *\n * Encodes the values [1,1,1,2,3,4,5,6] as [1,1,0,2,1,5] (RLE([1,0,0,1,1,1,1,1]) ⇒ RleIntDiff[1,1,0,2,1,5])\n */\nexport class RleIntDiffEncoder extends Encoder {\n /**\n * @param {number} start\n */\n constructor (start) {\n super()\n /**\n * Current state\n * @type {number}\n */\n this.s = start\n this.count = 0\n }\n\n /**\n * @param {number} v\n */\n write (v) {\n if (this.s === v && this.count > 0) {\n this.count++\n } else {\n if (this.count > 0) {\n // flush counter, unless this is the first value (count = 0)\n writeVarUint(this, this.count - 1) // since count is always > 0, we can decrement by one. non-standard encoding ftw\n }\n this.count = 1\n // write first value\n writeVarInt(this, v - this.s)\n this.s = v\n }\n }\n}\n\n/**\n * @param {UintOptRleEncoder} encoder\n */\nconst flushUintOptRleEncoder = encoder => {\n if (encoder.count > 0) {\n // flush counter, unless this is the first value (count = 0)\n // case 1: just a single value. set sign to positive\n // case 2: write several values. set sign to negative to indicate that there is a length coming\n writeVarInt(encoder.encoder, encoder.count === 1 ? encoder.s : -encoder.s)\n if (encoder.count > 1) {\n writeVarUint(encoder.encoder, encoder.count - 2) // since count is always > 1, we can decrement by one. non-standard encoding ftw\n }\n }\n}\n\n/**\n * Optimized Rle encoder that does not suffer from the mentioned problem of the basic Rle encoder.\n *\n * Internally uses VarInt encoder to write unsigned integers. If the input occurs multiple times, we write\n * write it as a negative number. The UintOptRleDecoder then understands that it needs to read a count.\n *\n * Encodes [1,2,3,3,3] as [1,2,-3,3] (once 1, once 2, three times 3)\n */\nexport class UintOptRleEncoder {\n constructor () {\n this.encoder = new Encoder()\n /**\n * @type {number}\n */\n this.s = 0\n this.count = 0\n }\n\n /**\n * @param {number} v\n */\n write (v) {\n if (this.s === v) {\n this.count++\n } else {\n flushUintOptRleEncoder(this)\n this.count = 1\n this.s = v\n }\n }\n\n toUint8Array () {\n flushUintOptRleEncoder(this)\n return toUint8Array(this.encoder)\n }\n}\n\n/**\n * Increasing Uint Optimized RLE Encoder\n *\n * The RLE encoder counts the number of same occurences of the same value.\n * The IncUintOptRle encoder counts if the value increases.\n * I.e. 7, 8, 9, 10 will be encoded as [-7, 4]. 1, 3, 5 will be encoded\n * as [1, 3, 5].\n */\nexport class IncUintOptRleEncoder {\n constructor () {\n this.encoder = new Encoder()\n /**\n * @type {number}\n */\n this.s = 0\n this.count = 0\n }\n\n /**\n * @param {number} v\n */\n write (v) {\n if (this.s + this.count === v) {\n this.count++\n } else {\n flushUintOptRleEncoder(this)\n this.count = 1\n this.s = v\n }\n }\n\n toUint8Array () {\n flushUintOptRleEncoder(this)\n return toUint8Array(this.encoder)\n }\n}\n\n/**\n * @param {IntDiffOptRleEncoder} encoder\n */\nconst flushIntDiffOptRleEncoder = encoder => {\n if (encoder.count > 0) {\n // 31 bit making up the diff | wether to write the counter\n // const encodedDiff = encoder.diff << 1 | (encoder.count === 1 ? 0 : 1)\n const encodedDiff = encoder.diff * 2 + (encoder.count === 1 ? 0 : 1)\n // flush counter, unless this is the first value (count = 0)\n // case 1: just a single value. set first bit to positive\n // case 2: write several values. set first bit to negative to indicate that there is a length coming\n writeVarInt(encoder.encoder, encodedDiff)\n if (encoder.count > 1) {\n writeVarUint(encoder.encoder, encoder.count - 2) // since count is always > 1, we can decrement by one. non-standard encoding ftw\n }\n }\n}\n\n/**\n * A combination of the IntDiffEncoder and the UintOptRleEncoder.\n *\n * The count approach is similar to the UintDiffOptRleEncoder, but instead of using the negative bitflag, it encodes\n * in the LSB whether a count is to be read. Therefore this Encoder only supports 31 bit integers!\n *\n * Encodes [1, 2, 3, 2] as [3, 1, 6, -1] (more specifically [(1 << 1) | 1, (3 << 0) | 0, -1])\n *\n * Internally uses variable length encoding. Contrary to normal UintVar encoding, the first byte contains:\n * * 1 bit that denotes whether the next value is a count (LSB)\n * * 1 bit that denotes whether this value is negative (MSB - 1)\n * * 1 bit that denotes whether to continue reading the variable length integer (MSB)\n *\n * Therefore, only five bits remain to encode diff ranges.\n *\n * Use this Encoder only when appropriate. In most cases, this is probably a bad idea.\n */\nexport class IntDiffOptRleEncoder {\n constructor () {\n this.encoder = new Encoder()\n /**\n * @type {number}\n */\n this.s = 0\n this.count = 0\n this.diff = 0\n }\n\n /**\n * @param {number} v\n */\n write (v) {\n if (this.diff === v - this.s) {\n this.s = v\n this.count++\n } else {\n flushIntDiffOptRleEncoder(this)\n this.count = 1\n this.diff = v - this.s\n this.s = v\n }\n }\n\n toUint8Array () {\n flushIntDiffOptRleEncoder(this)\n return toUint8Array(this.encoder)\n }\n}\n\n/**\n * Optimized String Encoder.\n *\n * Encoding many small strings in a simple Encoder is not very efficient. The function call to decode a string takes some time and creates references that must be eventually deleted.\n * In practice, when decoding several million small strings, the GC will kick in more and more often to collect orphaned string objects (or maybe there is another reason?).\n *\n * This string encoder solves the above problem. All strings are concatenated and written as a single string using a single encoding call.\n *\n * The lengths are encoded using a UintOptRleEncoder.\n */\nexport class StringEncoder {\n constructor () {\n /**\n * @type {Array}\n */\n this.sarr = []\n this.s = ''\n this.lensE = new UintOptRleEncoder()\n }\n\n /**\n * @param {string} string\n */\n write (string) {\n this.s += string\n if (this.s.length > 19) {\n this.sarr.push(this.s)\n this.s = ''\n }\n this.lensE.write(string.length)\n }\n\n toUint8Array () {\n const encoder = new Encoder()\n this.sarr.push(this.s)\n this.s = ''\n writeVarString(encoder, this.sarr.join(''))\n writeUint8Array(encoder, this.lensE.toUint8Array())\n return toUint8Array(encoder)\n }\n}\n","/**\n * Error helpers.\n *\n * @module error\n */\n\n/**\n * @param {string} s\n * @return {Error}\n */\n/* c8 ignore next */\nexport const create = s => new Error(s)\n\n/**\n * @throws {Error}\n * @return {never}\n */\n/* c8 ignore next 3 */\nexport const methodUnimplemented = () => {\n throw create('Method unimplemented')\n}\n\n/**\n * @throws {Error}\n * @return {never}\n */\n/* c8 ignore next 3 */\nexport const unexpectedCase = () => {\n throw create('Unexpected case')\n}\n","/**\n * Efficient schema-less binary decoding with support for variable length encoding.\n *\n * Use [lib0/decoding] with [lib0/encoding]. Every encoding function has a corresponding decoding function.\n *\n * Encodes numbers in little-endian order (least to most significant byte order)\n * and is compatible with Golang's binary encoding (https://golang.org/pkg/encoding/binary/)\n * which is also used in Protocol Buffers.\n *\n * ```js\n * // encoding step\n * const encoder = encoding.createEncoder()\n * encoding.writeVarUint(encoder, 256)\n * encoding.writeVarString(encoder, 'Hello world!')\n * const buf = encoding.toUint8Array(encoder)\n * ```\n *\n * ```js\n * // decoding step\n * const decoder = decoding.createDecoder(buf)\n * decoding.readVarUint(decoder) // => 256\n * decoding.readVarString(decoder) // => 'Hello world!'\n * decoding.hasContent(decoder) // => false - all data is read\n * ```\n *\n * @module decoding\n */\n\nimport * as buffer from './buffer.js'\nimport * as binary from './binary.js'\nimport * as math from './math.js'\nimport * as number from './number.js'\nimport * as string from './string.js'\nimport * as error from './error.js'\nimport * as encoding from './encoding.js'\n\nconst errorUnexpectedEndOfArray = error.create('Unexpected end of array')\nconst errorIntegerOutOfRange = error.create('Integer out of Range')\n\n/**\n * A Decoder handles the decoding of an Uint8Array.\n */\nexport class Decoder {\n /**\n * @param {Uint8Array} uint8Array Binary data to decode\n */\n constructor (uint8Array) {\n /**\n * Decoding target.\n *\n * @type {Uint8Array}\n */\n this.arr = uint8Array\n /**\n * Current decoding position.\n *\n * @type {number}\n */\n this.pos = 0\n }\n}\n\n/**\n * @function\n * @param {Uint8Array} uint8Array\n * @return {Decoder}\n */\nexport const createDecoder = uint8Array => new Decoder(uint8Array)\n\n/**\n * @function\n * @param {Decoder} decoder\n * @return {boolean}\n */\nexport const hasContent = decoder => decoder.pos !== decoder.arr.length\n\n/**\n * Clone a decoder instance.\n * Optionally set a new position parameter.\n *\n * @function\n * @param {Decoder} decoder The decoder instance\n * @param {number} [newPos] Defaults to current position\n * @return {Decoder} A clone of `decoder`\n */\nexport const clone = (decoder, newPos = decoder.pos) => {\n const _decoder = createDecoder(decoder.arr)\n _decoder.pos = newPos\n return _decoder\n}\n\n/**\n * Create an Uint8Array view of the next `len` bytes and advance the position by `len`.\n *\n * Important: The Uint8Array still points to the underlying ArrayBuffer. Make sure to discard the result as soon as possible to prevent any memory leaks.\n * Use `buffer.copyUint8Array` to copy the result into a new Uint8Array.\n *\n * @function\n * @param {Decoder} decoder The decoder instance\n * @param {number} len The length of bytes to read\n * @return {Uint8Array}\n */\nexport const readUint8Array = (decoder, len) => {\n const view = buffer.createUint8ArrayViewFromArrayBuffer(decoder.arr.buffer, decoder.pos + decoder.arr.byteOffset, len)\n decoder.pos += len\n return view\n}\n\n/**\n * Read variable length Uint8Array.\n *\n * Important: The Uint8Array still points to the underlying ArrayBuffer. Make sure to discard the result as soon as possible to prevent any memory leaks.\n * Use `buffer.copyUint8Array` to copy the result into a new Uint8Array.\n *\n * @function\n * @param {Decoder} decoder\n * @return {Uint8Array}\n */\nexport const readVarUint8Array = decoder => readUint8Array(decoder, readVarUint(decoder))\n\n/**\n * Read the rest of the content as an ArrayBuffer\n * @function\n * @param {Decoder} decoder\n * @return {Uint8Array}\n */\nexport const readTailAsUint8Array = decoder => readUint8Array(decoder, decoder.arr.length - decoder.pos)\n\n/**\n * Skip one byte, jump to the next position.\n * @function\n * @param {Decoder} decoder The decoder instance\n * @return {number} The next position\n */\nexport const skip8 = decoder => decoder.pos++\n\n/**\n * Read one byte as unsigned integer.\n * @function\n * @param {Decoder} decoder The decoder instance\n * @return {number} Unsigned 8-bit integer\n */\nexport const readUint8 = decoder => decoder.arr[decoder.pos++]\n\n/**\n * Read 2 bytes as unsigned integer.\n *\n * @function\n * @param {Decoder} decoder\n * @return {number} An unsigned integer.\n */\nexport const readUint16 = decoder => {\n const uint =\n decoder.arr[decoder.pos] +\n (decoder.arr[decoder.pos + 1] << 8)\n decoder.pos += 2\n return uint\n}\n\n/**\n * Read 4 bytes as unsigned integer.\n *\n * @function\n * @param {Decoder} decoder\n * @return {number} An unsigned integer.\n */\nexport const readUint32 = decoder => {\n const uint =\n (decoder.arr[decoder.pos] +\n (decoder.arr[decoder.pos + 1] << 8) +\n (decoder.arr[decoder.pos + 2] << 16) +\n (decoder.arr[decoder.pos + 3] << 24)) >>> 0\n decoder.pos += 4\n return uint\n}\n\n/**\n * Read 4 bytes as unsigned integer in big endian order.\n * (most significant byte first)\n *\n * @function\n * @param {Decoder} decoder\n * @return {number} An unsigned integer.\n */\nexport const readUint32BigEndian = decoder => {\n const uint =\n (decoder.arr[decoder.pos + 3] +\n (decoder.arr[decoder.pos + 2] << 8) +\n (decoder.arr[decoder.pos + 1] << 16) +\n (decoder.arr[decoder.pos] << 24)) >>> 0\n decoder.pos += 4\n return uint\n}\n\n/**\n * Look ahead without incrementing the position\n * to the next byte and read it as unsigned integer.\n *\n * @function\n * @param {Decoder} decoder\n * @return {number} An unsigned integer.\n */\nexport const peekUint8 = decoder => decoder.arr[decoder.pos]\n\n/**\n * Look ahead without incrementing the position\n * to the next byte and read it as unsigned integer.\n *\n * @function\n * @param {Decoder} decoder\n * @return {number} An unsigned integer.\n */\nexport const peekUint16 = decoder =>\n decoder.arr[decoder.pos] +\n (decoder.arr[decoder.pos + 1] << 8)\n\n/**\n * Look ahead without incrementing the position\n * to the next byte and read it as unsigned integer.\n *\n * @function\n * @param {Decoder} decoder\n * @return {number} An unsigned integer.\n */\nexport const peekUint32 = decoder => (\n decoder.arr[decoder.pos] +\n (decoder.arr[decoder.pos + 1] << 8) +\n (decoder.arr[decoder.pos + 2] << 16) +\n (decoder.arr[decoder.pos + 3] << 24)\n) >>> 0\n\n/**\n * Read unsigned integer (32bit) with variable length.\n * 1/8th of the storage is used as encoding overhead.\n * * numbers < 2^7 is stored in one bytlength\n * * numbers < 2^14 is stored in two bylength\n *\n * @function\n * @param {Decoder} decoder\n * @return {number} An unsigned integer.length\n */\nexport const readVarUint = decoder => {\n let num = 0\n let mult = 1\n const len = decoder.arr.length\n while (decoder.pos < len) {\n const r = decoder.arr[decoder.pos++]\n // num = num | ((r & binary.BITS7) << len)\n num = num + (r & binary.BITS7) * mult // shift $r << (7*#iterations) and add it to num\n mult *= 128 // next iteration, shift 7 \"more\" to the left\n if (r < binary.BIT8) {\n return num\n }\n /* c8 ignore start */\n if (num > number.MAX_SAFE_INTEGER) {\n throw errorIntegerOutOfRange\n }\n /* c8 ignore stop */\n }\n throw errorUnexpectedEndOfArray\n}\n\n/**\n * Read signed integer (32bit) with variable length.\n * 1/8th of the storage is used as encoding overhead.\n * * numbers < 2^7 is stored in one bytlength\n * * numbers < 2^14 is stored in two bylength\n * @todo This should probably create the inverse ~num if number is negative - but this would be a breaking change.\n *\n * @function\n * @param {Decoder} decoder\n * @return {number} An unsigned integer.length\n */\nexport const readVarInt = decoder => {\n let r = decoder.arr[decoder.pos++]\n let num = r & binary.BITS6\n let mult = 64\n const sign = (r & binary.BIT7) > 0 ? -1 : 1\n if ((r & binary.BIT8) === 0) {\n // don't continue reading\n return sign * num\n }\n const len = decoder.arr.length\n while (decoder.pos < len) {\n r = decoder.arr[decoder.pos++]\n // num = num | ((r & binary.BITS7) << len)\n num = num + (r & binary.BITS7) * mult\n mult *= 128\n if (r < binary.BIT8) {\n return sign * num\n }\n /* c8 ignore start */\n if (num > number.MAX_SAFE_INTEGER) {\n throw errorIntegerOutOfRange\n }\n /* c8 ignore stop */\n }\n throw errorUnexpectedEndOfArray\n}\n\n/**\n * Look ahead and read varUint without incrementing position\n *\n * @function\n * @param {Decoder} decoder\n * @return {number}\n */\nexport const peekVarUint = decoder => {\n const pos = decoder.pos\n const s = readVarUint(decoder)\n decoder.pos = pos\n return s\n}\n\n/**\n * Look ahead and read varUint without incrementing position\n *\n * @function\n * @param {Decoder} decoder\n * @return {number}\n */\nexport const peekVarInt = decoder => {\n const pos = decoder.pos\n const s = readVarInt(decoder)\n decoder.pos = pos\n return s\n}\n\n/**\n * We don't test this function anymore as we use native decoding/encoding by default now.\n * Better not modify this anymore..\n *\n * Transforming utf8 to a string is pretty expensive. The code performs 10x better\n * when String.fromCodePoint is fed with all characters as arguments.\n * But most environments have a maximum number of arguments per functions.\n * For effiency reasons we apply a maximum of 10000 characters at once.\n *\n * @function\n * @param {Decoder} decoder\n * @return {String} The read String.\n */\n/* c8 ignore start */\nexport const _readVarStringPolyfill = decoder => {\n let remainingLen = readVarUint(decoder)\n if (remainingLen === 0) {\n return ''\n } else {\n let encodedString = String.fromCodePoint(readUint8(decoder)) // remember to decrease remainingLen\n if (--remainingLen < 100) { // do not create a Uint8Array for small strings\n while (remainingLen--) {\n encodedString += String.fromCodePoint(readUint8(decoder))\n }\n } else {\n while (remainingLen > 0) {\n const nextLen = remainingLen < 10000 ? remainingLen : 10000\n // this is dangerous, we create a fresh array view from the existing buffer\n const bytes = decoder.arr.subarray(decoder.pos, decoder.pos + nextLen)\n decoder.pos += nextLen\n // Starting with ES5.1 we can supply a generic array-like object as arguments\n encodedString += String.fromCodePoint.apply(null, /** @type {any} */ (bytes))\n remainingLen -= nextLen\n }\n }\n return decodeURIComponent(escape(encodedString))\n }\n}\n/* c8 ignore stop */\n\n/**\n * @function\n * @param {Decoder} decoder\n * @return {String} The read String\n */\nexport const _readVarStringNative = decoder =>\n /** @type any */ (string.utf8TextDecoder).decode(readVarUint8Array(decoder))\n\n/**\n * Read string of variable length\n * * varUint is used to store the length of the string\n *\n * @function\n * @param {Decoder} decoder\n * @return {String} The read String\n *\n */\n/* c8 ignore next */\nexport const readVarString = string.utf8TextDecoder ? _readVarStringNative : _readVarStringPolyfill\n\n/**\n * @param {Decoder} decoder\n * @return {Uint8Array}\n */\nexport const readTerminatedUint8Array = decoder => {\n const encoder = encoding.createEncoder()\n let b\n while (true) {\n b = readUint8(decoder)\n if (b === 0) {\n return encoding.toUint8Array(encoder)\n }\n if (b === 1) {\n b = readUint8(decoder)\n }\n encoding.write(encoder, b)\n }\n}\n\n/**\n * @param {Decoder} decoder\n * @return {string}\n */\nexport const readTerminatedString = decoder => string.decodeUtf8(readTerminatedUint8Array(decoder))\n\n/**\n * Look ahead and read varString without incrementing position\n *\n * @function\n * @param {Decoder} decoder\n * @return {string}\n */\nexport const peekVarString = decoder => {\n const pos = decoder.pos\n const s = readVarString(decoder)\n decoder.pos = pos\n return s\n}\n\n/**\n * @param {Decoder} decoder\n * @param {number} len\n * @return {DataView}\n */\nexport const readFromDataView = (decoder, len) => {\n const dv = new DataView(decoder.arr.buffer, decoder.arr.byteOffset + decoder.pos, len)\n decoder.pos += len\n return dv\n}\n\n/**\n * @param {Decoder} decoder\n */\nexport const readFloat32 = decoder => readFromDataView(decoder, 4).getFloat32(0, false)\n\n/**\n * @param {Decoder} decoder\n */\nexport const readFloat64 = decoder => readFromDataView(decoder, 8).getFloat64(0, false)\n\n/**\n * @param {Decoder} decoder\n */\nexport const readBigInt64 = decoder => /** @type {any} */ (readFromDataView(decoder, 8)).getBigInt64(0, false)\n\n/**\n * @param {Decoder} decoder\n */\nexport const readBigUint64 = decoder => /** @type {any} */ (readFromDataView(decoder, 8)).getBigUint64(0, false)\n\n/**\n * @type {Array}\n */\nconst readAnyLookupTable = [\n decoder => undefined, // CASE 127: undefined\n decoder => null, // CASE 126: null\n readVarInt, // CASE 125: integer\n readFloat32, // CASE 124: float32\n readFloat64, // CASE 123: float64\n readBigInt64, // CASE 122: bigint\n decoder => false, // CASE 121: boolean (false)\n decoder => true, // CASE 120: boolean (true)\n readVarString, // CASE 119: string\n decoder => { // CASE 118: object\n const len = readVarUint(decoder)\n /**\n * @type {Object}\n */\n const obj = {}\n for (let i = 0; i < len; i++) {\n const key = readVarString(decoder)\n obj[key] = readAny(decoder)\n }\n return obj\n },\n decoder => { // CASE 117: array\n const len = readVarUint(decoder)\n const arr = []\n for (let i = 0; i < len; i++) {\n arr.push(readAny(decoder))\n }\n return arr\n },\n readVarUint8Array // CASE 116: Uint8Array\n]\n\n/**\n * @param {Decoder} decoder\n */\nexport const readAny = decoder => readAnyLookupTable[127 - readUint8(decoder)](decoder)\n\n/**\n * T must not be null.\n *\n * @template T\n */\nexport class RleDecoder extends Decoder {\n /**\n * @param {Uint8Array} uint8Array\n * @param {function(Decoder):T} reader\n */\n constructor (uint8Array, reader) {\n super(uint8Array)\n /**\n * The reader\n */\n this.reader = reader\n /**\n * Current state\n * @type {T|null}\n */\n this.s = null\n this.count = 0\n }\n\n read () {\n if (this.count === 0) {\n this.s = this.reader(this)\n if (hasContent(this)) {\n this.count = readVarUint(this) + 1 // see encoder implementation for the reason why this is incremented\n } else {\n this.count = -1 // read the current value forever\n }\n }\n this.count--\n return /** @type {T} */ (this.s)\n }\n}\n\nexport class IntDiffDecoder extends Decoder {\n /**\n * @param {Uint8Array} uint8Array\n * @param {number} start\n */\n constructor (uint8Array, start) {\n super(uint8Array)\n /**\n * Current state\n * @type {number}\n */\n this.s = start\n }\n\n /**\n * @return {number}\n */\n read () {\n this.s += readVarInt(this)\n return this.s\n }\n}\n\nexport class RleIntDiffDecoder extends Decoder {\n /**\n * @param {Uint8Array} uint8Array\n * @param {number} start\n */\n constructor (uint8Array, start) {\n super(uint8Array)\n /**\n * Current state\n * @type {number}\n */\n this.s = start\n this.count = 0\n }\n\n /**\n * @return {number}\n */\n read () {\n if (this.count === 0) {\n this.s += readVarInt(this)\n if (hasContent(this)) {\n this.count = readVarUint(this) + 1 // see encoder implementation for the reason why this is incremented\n } else {\n this.count = -1 // read the current value forever\n }\n }\n this.count--\n return /** @type {number} */ (this.s)\n }\n}\n\nexport class UintOptRleDecoder extends Decoder {\n /**\n * @param {Uint8Array} uint8Array\n */\n constructor (uint8Array) {\n super(uint8Array)\n /**\n * @type {number}\n */\n this.s = 0\n this.count = 0\n }\n\n read () {\n if (this.count === 0) {\n this.s = readVarInt(this)\n // if the sign is negative, we read the count too, otherwise count is 1\n const isNegative = math.isNegativeZero(this.s)\n this.count = 1\n if (isNegative) {\n this.s = -this.s\n this.count = readVarUint(this) + 2\n }\n }\n this.count--\n return /** @type {number} */ (this.s)\n }\n}\n\nexport class IncUintOptRleDecoder extends Decoder {\n /**\n * @param {Uint8Array} uint8Array\n */\n constructor (uint8Array) {\n super(uint8Array)\n /**\n * @type {number}\n */\n this.s = 0\n this.count = 0\n }\n\n read () {\n if (this.count === 0) {\n this.s = readVarInt(this)\n // if the sign is negative, we read the count too, otherwise count is 1\n const isNegative = math.isNegativeZero(this.s)\n this.count = 1\n if (isNegative) {\n this.s = -this.s\n this.count = readVarUint(this) + 2\n }\n }\n this.count--\n return /** @type {number} */ (this.s++)\n }\n}\n\nexport class IntDiffOptRleDecoder extends Decoder {\n /**\n * @param {Uint8Array} uint8Array\n */\n constructor (uint8Array) {\n super(uint8Array)\n /**\n * @type {number}\n */\n this.s = 0\n this.count = 0\n this.diff = 0\n }\n\n /**\n * @return {number}\n */\n read () {\n if (this.count === 0) {\n const diff = readVarInt(this)\n // if the first bit is set, we read more data\n const hasCount = diff & 1\n this.diff = math.floor(diff / 2) // shift >> 1\n this.count = 1\n if (hasCount) {\n this.count = readVarUint(this) + 2\n }\n }\n this.s += this.diff\n this.count--\n return this.s\n }\n}\n\nexport class StringDecoder {\n /**\n * @param {Uint8Array} uint8Array\n */\n constructor (uint8Array) {\n this.decoder = new UintOptRleDecoder(uint8Array)\n this.str = readVarString(this.decoder)\n /**\n * @type {number}\n */\n this.spos = 0\n }\n\n /**\n * @return {string}\n */\n read () {\n const end = this.spos + this.decoder.read()\n const res = this.str.slice(this.spos, end)\n this.spos = end\n return res\n }\n}\n","/**\n * Utility functions to work with buffers (Uint8Array).\n *\n * @module buffer\n */\n\nimport * as string from './string.js'\nimport * as env from './environment.js'\nimport * as array from './array.js'\nimport * as math from './math.js'\nimport * as encoding from './encoding.js'\nimport * as decoding from './decoding.js'\n\n/**\n * @param {number} len\n */\nexport const createUint8ArrayFromLen = len => new Uint8Array(len)\n\n/**\n * Create Uint8Array with initial content from buffer\n *\n * @param {ArrayBuffer} buffer\n * @param {number} byteOffset\n * @param {number} length\n */\nexport const createUint8ArrayViewFromArrayBuffer = (buffer, byteOffset, length) => new Uint8Array(buffer, byteOffset, length)\n\n/**\n * Create Uint8Array with initial content from buffer\n *\n * @param {ArrayBuffer} buffer\n */\nexport const createUint8ArrayFromArrayBuffer = buffer => new Uint8Array(buffer)\n\n/* c8 ignore start */\n/**\n * @param {Uint8Array} bytes\n * @return {string}\n */\nconst toBase64Browser = bytes => {\n let s = ''\n for (let i = 0; i < bytes.byteLength; i++) {\n s += string.fromCharCode(bytes[i])\n }\n // eslint-disable-next-line no-undef\n return btoa(s)\n}\n/* c8 ignore stop */\n\n/**\n * @param {Uint8Array} bytes\n * @return {string}\n */\nconst toBase64Node = bytes => Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString('base64')\n\n/* c8 ignore start */\n/**\n * @param {string} s\n * @return {Uint8Array}\n */\nconst fromBase64Browser = s => {\n // eslint-disable-next-line no-undef\n const a = atob(s)\n const bytes = createUint8ArrayFromLen(a.length)\n for (let i = 0; i < a.length; i++) {\n bytes[i] = a.charCodeAt(i)\n }\n return bytes\n}\n/* c8 ignore stop */\n\n/**\n * @param {string} s\n */\nconst fromBase64Node = s => {\n const buf = Buffer.from(s, 'base64')\n return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength)\n}\n\n/* c8 ignore next */\nexport const toBase64 = env.isBrowser ? toBase64Browser : toBase64Node\n\n/* c8 ignore next */\nexport const fromBase64 = env.isBrowser ? fromBase64Browser : fromBase64Node\n\n/**\n * Implements base64url - see https://datatracker.ietf.org/doc/html/rfc4648#section-5\n * @param {Uint8Array} buf\n */\nexport const toBase64UrlEncoded = buf => toBase64(buf).replaceAll('+', '-').replaceAll('/', '_').replaceAll('=', '')\n\n/**\n * @param {string} base64\n */\nexport const fromBase64UrlEncoded = base64 => fromBase64(base64.replaceAll('-', '+').replaceAll('_', '/'))\n\n/**\n * Base64 is always a more efficient choice. This exists for utility purposes only.\n *\n * @param {Uint8Array} buf\n */\nexport const toHexString = buf => array.map(buf, b => b.toString(16).padStart(2, '0')).join('')\n\n/**\n * Note: This function expects that the hex doesn't start with 0x..\n *\n * @param {string} hex\n */\nexport const fromHexString = hex => {\n const hlen = hex.length\n const buf = new Uint8Array(math.ceil(hlen / 2))\n for (let i = 0; i < hlen; i += 2) {\n buf[buf.length - i / 2 - 1] = Number.parseInt(hex.slice(hlen - i - 2, hlen - i), 16)\n }\n return buf\n}\n\n/**\n * Copy the content of an Uint8Array view to a new ArrayBuffer.\n *\n * @param {Uint8Array} uint8Array\n * @return {Uint8Array}\n */\nexport const copyUint8Array = uint8Array => {\n const newBuf = createUint8ArrayFromLen(uint8Array.byteLength)\n newBuf.set(uint8Array)\n return newBuf\n}\n\n/**\n * Encode anything as a UInt8Array. It's a pun on typescripts's `any` type.\n * See encoding.writeAny for more information.\n *\n * @param {any} data\n * @return {Uint8Array}\n */\nexport const encodeAny = data => {\n const encoder = encoding.createEncoder()\n encoding.writeAny(encoder, data)\n return encoding.toUint8Array(encoder)\n}\n\n/**\n * Decode an any-encoded value.\n *\n * @param {Uint8Array} buf\n * @return {any}\n */\nexport const decodeAny = buf => decoding.readAny(decoding.createDecoder(buf))\n\n/**\n * Shift Byte Array {N} bits to the left. Does not expand byte array.\n *\n * @param {Uint8Array} bs\n * @param {number} N should be in the range of [0-7]\n */\nexport const shiftNBitsLeft = (bs, N) => {\n if (N === 0) return bs\n bs = new Uint8Array(bs)\n bs[0] <<= N\n for (let i = 1; i < bs.length; i++) {\n bs[i - 1] |= bs[i] >>> (8 - N)\n bs[i] <<= N\n }\n return bs\n}\n","/**\n * Fast Pseudo Random Number Generators.\n *\n * Given a seed a PRNG generates a sequence of numbers that cannot be reasonably predicted.\n * Two PRNGs must generate the same random sequence of numbers if given the same seed.\n *\n * @module prng\n */\n\nimport * as binary from './binary.js'\nimport { fromCharCode, fromCodePoint } from './string.js'\nimport * as math from './math.js'\nimport { Xoroshiro128plus } from './prng/Xoroshiro128plus.js'\nimport * as buffer from './buffer.js'\n\n/**\n * Description of the function\n * @callback generatorNext\n * @return {number} A random float in the cange of [0,1)\n */\n\n/**\n * A random type generator.\n *\n * @typedef {Object} PRNG\n * @property {generatorNext} next Generate new number\n */\nexport const DefaultPRNG = Xoroshiro128plus\n\n/**\n * Create a Xoroshiro128plus Pseudo-Random-Number-Generator.\n * This is the fastest full-period generator passing BigCrush without systematic failures.\n * But there are more PRNGs available in ./PRNG/.\n *\n * @param {number} seed A positive 32bit integer. Do not use negative numbers.\n * @return {PRNG}\n */\nexport const create = seed => new DefaultPRNG(seed)\n\n/**\n * Generates a single random bool.\n *\n * @param {PRNG} gen A random number generator.\n * @return {Boolean} A random boolean\n */\nexport const bool = gen => (gen.next() >= 0.5)\n\n/**\n * Generates a random integer with 53 bit resolution.\n *\n * @param {PRNG} gen A random number generator.\n * @param {Number} min The lower bound of the allowed return values (inclusive).\n * @param {Number} max The upper bound of the allowed return values (inclusive).\n * @return {Number} A random integer on [min, max]\n */\nexport const int53 = (gen, min, max) => math.floor(gen.next() * (max + 1 - min) + min)\n\n/**\n * Generates a random integer with 53 bit resolution.\n *\n * @param {PRNG} gen A random number generator.\n * @param {Number} min The lower bound of the allowed return values (inclusive).\n * @param {Number} max The upper bound of the allowed return values (inclusive).\n * @return {Number} A random integer on [min, max]\n */\nexport const uint53 = (gen, min, max) => math.abs(int53(gen, min, max))\n\n/**\n * Generates a random integer with 32 bit resolution.\n *\n * @param {PRNG} gen A random number generator.\n * @param {Number} min The lower bound of the allowed return values (inclusive).\n * @param {Number} max The upper bound of the allowed return values (inclusive).\n * @return {Number} A random integer on [min, max]\n */\nexport const int32 = (gen, min, max) => math.floor(gen.next() * (max + 1 - min) + min)\n\n/**\n * Generates a random integer with 53 bit resolution.\n *\n * @param {PRNG} gen A random number generator.\n * @param {Number} min The lower bound of the allowed return values (inclusive).\n * @param {Number} max The upper bound of the allowed return values (inclusive).\n * @return {Number} A random integer on [min, max]\n */\nexport const uint32 = (gen, min, max) => int32(gen, min, max) >>> 0\n\n/**\n * @deprecated\n * Optimized version of prng.int32. It has the same precision as prng.int32, but should be preferred when\n * openaring on smaller ranges.\n *\n * @param {PRNG} gen A random number generator.\n * @param {Number} min The lower bound of the allowed return values (inclusive).\n * @param {Number} max The upper bound of the allowed return values (inclusive). The max inclusive number is `binary.BITS31-1`\n * @return {Number} A random integer on [min, max]\n */\nexport const int31 = (gen, min, max) => int32(gen, min, max)\n\n/**\n * Generates a random real on [0, 1) with 53 bit resolution.\n *\n * @param {PRNG} gen A random number generator.\n * @return {Number} A random real number on [0, 1).\n */\nexport const real53 = gen => gen.next() // (((gen.next() >>> 5) * binary.BIT26) + (gen.next() >>> 6)) / MAX_SAFE_INTEGER\n\n/**\n * Generates a random character from char code 32 - 126. I.e. Characters, Numbers, special characters, and Space:\n *\n * @param {PRNG} gen A random number generator.\n * @return {string}\n *\n * (Space)!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[/]^_`abcdefghijklmnopqrstuvwxyz{|}~\n */\nexport const char = gen => fromCharCode(int31(gen, 32, 126))\n\n/**\n * @param {PRNG} gen\n * @return {string} A single letter (a-z)\n */\nexport const letter = gen => fromCharCode(int31(gen, 97, 122))\n\n/**\n * @param {PRNG} gen\n * @param {number} [minLen=0]\n * @param {number} [maxLen=20]\n * @return {string} A random word (0-20 characters) without spaces consisting of letters (a-z)\n */\nexport const word = (gen, minLen = 0, maxLen = 20) => {\n const len = int31(gen, minLen, maxLen)\n let str = ''\n for (let i = 0; i < len; i++) {\n str += letter(gen)\n }\n return str\n}\n\n/**\n * TODO: this function produces invalid runes. Does not cover all of utf16!!\n *\n * @param {PRNG} gen\n * @return {string}\n */\nexport const utf16Rune = gen => {\n const codepoint = int31(gen, 0, 256)\n return fromCodePoint(codepoint)\n}\n\n/**\n * @param {PRNG} gen\n * @param {number} [maxlen = 20]\n */\nexport const utf16String = (gen, maxlen = 20) => {\n const len = int31(gen, 0, maxlen)\n let str = ''\n for (let i = 0; i < len; i++) {\n str += utf16Rune(gen)\n }\n return str\n}\n\n/**\n * Returns one element of a given array.\n *\n * @param {PRNG} gen A random number generator.\n * @param {Array} array Non empty Array of possible values.\n * @return {T} One of the values of the supplied Array.\n * @template T\n */\nexport const oneOf = (gen, array) => array[int31(gen, 0, array.length - 1)]\n\n/**\n * @param {PRNG} gen\n * @param {number} len\n * @return {Uint8Array}\n */\nexport const uint8Array = (gen, len) => {\n const buf = buffer.createUint8ArrayFromLen(len)\n for (let i = 0; i < buf.length; i++) {\n buf[i] = int32(gen, 0, binary.BITS8)\n }\n return buf\n}\n\n/* c8 ignore start */\n/**\n * @param {PRNG} gen\n * @param {number} len\n * @return {Uint16Array}\n */\nexport const uint16Array = (gen, len) => new Uint16Array(uint8Array(gen, len * 2).buffer)\n\n/**\n * @param {PRNG} gen\n * @param {number} len\n * @return {Uint32Array}\n */\nexport const uint32Array = (gen, len) => new Uint32Array(uint8Array(gen, len * 4).buffer)\n/* c8 ignore stop */\n","/**\n * Utility helpers for generating statistics.\n *\n * @module statistics\n */\n\nimport * as math from './math.js'\n\n/**\n * @param {Array} arr Array of values\n * @return {number} Returns null if the array is empty\n */\nexport const median = arr => arr.length === 0 ? NaN : (arr.length % 2 === 1 ? arr[(arr.length - 1) / 2] : (arr[math.floor((arr.length - 1) / 2)] + arr[math.ceil((arr.length - 1) / 2)]) / 2)\n\n/**\n * @param {Array} arr\n * @return {number}\n */\nexport const average = arr => arr.reduce(math.add, 0) / arr.length\n","/**\n * Utility helpers to work with promises.\n *\n * @module promise\n */\n\nimport * as time from './time.js'\n\n/**\n * @template T\n * @callback PromiseResolve\n * @param {T|PromiseLike} [result]\n */\n\n/**\n * @template T\n * @param {function(PromiseResolve,function(Error):void):any} f\n * @return {Promise}\n */\nexport const create = f => /** @type {Promise} */ (new Promise(f))\n\n/**\n * @param {function(function():void,function(Error):void):void} f\n * @return {Promise}\n */\nexport const createEmpty = f => new Promise(f)\n\n/**\n * `Promise.all` wait for all promises in the array to resolve and return the result\n * @template {unknown[] | []} PS\n *\n * @param {PS} ps\n * @return {Promise<{ -readonly [P in keyof PS]: Awaited }>}\n */\nexport const all = Promise.all.bind(Promise)\n\n/**\n * @param {Error} [reason]\n * @return {Promise}\n */\nexport const reject = reason => Promise.reject(reason)\n\n/**\n * @template T\n * @param {T|void} res\n * @return {Promise}\n */\nexport const resolve = res => Promise.resolve(res)\n\n/**\n * @template T\n * @param {T} res\n * @return {Promise}\n */\nexport const resolveWith = res => Promise.resolve(res)\n\n/**\n * @todo Next version, reorder parameters: check, [timeout, [intervalResolution]]\n *\n * @param {number} timeout\n * @param {function():boolean} check\n * @param {number} [intervalResolution]\n * @return {Promise}\n */\nexport const until = (timeout, check, intervalResolution = 10) => create((resolve, reject) => {\n const startTime = time.getUnixTime()\n const hasTimeout = timeout > 0\n const untilInterval = () => {\n if (check()) {\n clearInterval(intervalHandle)\n resolve()\n } else if (hasTimeout) {\n /* c8 ignore else */\n if (time.getUnixTime() - startTime > timeout) {\n clearInterval(intervalHandle)\n reject(new Error('Timeout'))\n }\n }\n }\n const intervalHandle = setInterval(untilInterval, intervalResolution)\n})\n\n/**\n * @param {number} timeout\n * @return {Promise}\n */\nexport const wait = timeout => create((resolve, reject) => setTimeout(resolve, timeout))\n\n/**\n * Checks if an object is a promise using ducktyping.\n *\n * Promises are often polyfilled, so it makes sense to add some additional guarantees if the user of this\n * library has some insane environment where global Promise objects are overwritten.\n *\n * @param {any} p\n * @return {boolean}\n */\nexport const isPromise = p => p instanceof Promise || (p && p.then && p.catch && p.finally)\n","/* eslint-env browser */\n\nexport const measure = performance.measure.bind(performance)\nexport const now = performance.now.bind(performance)\nexport const mark = performance.mark.bind(performance)\n","/**\n * Testing framework with support for generating tests.\n *\n * ```js\n * // test.js template for creating a test executable\n * import { runTests } from 'lib0/testing'\n * import * as log from 'lib0/logging'\n * import * as mod1 from './mod1.test.js'\n * import * as mod2 from './mod2.test.js'\n\n * import { isBrowser, isNode } from 'lib0/environment.js'\n *\n * if (isBrowser) {\n * // optional: if this is ran in the browser, attach a virtual console to the dom\n * log.createVConsole(document.body)\n * }\n *\n * runTests({\n * mod1,\n * mod2,\n * }).then(success => {\n * if (isNode) {\n * process.exit(success ? 0 : 1)\n * }\n * })\n * ```\n *\n * ```js\n * // mod1.test.js\n * /**\n * * runTests automatically tests all exported functions that start with \"test\".\n * * The name of the function should be in camelCase and is used for the logging output.\n * *\n * * @param {t.TestCase} tc\n * *\\/\n * export const testMyFirstTest = tc => {\n * t.compare({ a: 4 }, { a: 4 }, 'objects are equal')\n * }\n * ```\n *\n * Now you can simply run `node test.js` to run your test or run test.js in the browser.\n *\n * @module testing\n */\n\nimport * as log from 'lib0/logging'\nimport { simpleDiffString } from './diff.js'\nimport * as object from './object.js'\nimport * as string from './string.js'\nimport * as math from './math.js'\nimport * as random from './random.js'\nimport * as prng from './prng.js'\nimport * as statistics from './statistics.js'\nimport * as array from './array.js'\nimport * as env from './environment.js'\nimport * as json from './json.js'\nimport * as time from './time.js'\nimport * as promise from './promise.js'\nimport * as performance from 'lib0/performance'\n\nexport { production } from './environment.js'\n\nexport const extensive = env.hasConf('extensive')\n\n/* c8 ignore next */\nexport const envSeed = env.hasParam('--seed') ? Number.parseInt(env.getParam('--seed', '0')) : null\n\nexport class TestCase {\n /**\n * @param {string} moduleName\n * @param {string} testName\n */\n constructor (moduleName, testName) {\n /**\n * @type {string}\n */\n this.moduleName = moduleName\n /**\n * @type {string}\n */\n this.testName = testName\n /**\n * This type can store custom information related to the TestCase\n *\n * @type {Map}\n */\n this.meta = new Map()\n this._seed = null\n this._prng = null\n }\n\n resetSeed () {\n this._seed = null\n this._prng = null\n }\n\n /**\n * @type {number}\n */\n /* c8 ignore next */\n get seed () {\n /* c8 ignore else */\n if (this._seed === null) {\n /* c8 ignore next */\n this._seed = envSeed === null ? random.uint32() : envSeed\n }\n return this._seed\n }\n\n /**\n * A PRNG for this test case. Use only this PRNG for randomness to make the test case reproducible.\n *\n * @type {prng.PRNG}\n */\n get prng () {\n /* c8 ignore else */\n if (this._prng === null) {\n this._prng = prng.create(this.seed)\n }\n return this._prng\n }\n}\n\nexport const repetitionTime = Number(env.getParam('--repetition-time', '50'))\n/* c8 ignore next */\nconst testFilter = env.hasParam('--filter') ? env.getParam('--filter', '') : null\n\n/* c8 ignore next */\nconst testFilterRegExp = testFilter !== null ? new RegExp(testFilter) : /.*/\n\nconst repeatTestRegex = /^(repeat|repeating)\\s/\n\n/**\n * @param {string} moduleName\n * @param {string} name\n * @param {function(TestCase):void|Promise} f\n * @param {number} i\n * @param {number} numberOfTests\n */\nexport const run = async (moduleName, name, f, i, numberOfTests) => {\n const uncamelized = string.fromCamelCase(name.slice(4), ' ')\n const filtered = !testFilterRegExp.test(`[${i + 1}/${numberOfTests}] ${moduleName}: ${uncamelized}`)\n /* c8 ignore next 3 */\n if (filtered) {\n return true\n }\n const tc = new TestCase(moduleName, name)\n const repeat = repeatTestRegex.test(uncamelized)\n const groupArgs = [log.GREY, `[${i + 1}/${numberOfTests}] `, log.PURPLE, `${moduleName}: `, log.BLUE, uncamelized]\n /* c8 ignore next 5 */\n if (testFilter === null) {\n log.groupCollapsed(...groupArgs)\n } else {\n log.group(...groupArgs)\n }\n const times = []\n const start = performance.now()\n let lastTime = start\n /**\n * @type {any}\n */\n let err = null\n performance.mark(`${name}-start`)\n do {\n try {\n const p = f(tc)\n if (promise.isPromise(p)) {\n await p\n }\n } catch (_err) {\n err = _err\n }\n const currTime = performance.now()\n times.push(currTime - lastTime)\n lastTime = currTime\n if (repeat && err === null && (lastTime - start) < repetitionTime) {\n tc.resetSeed()\n } else {\n break\n }\n } while (err === null && (lastTime - start) < repetitionTime)\n performance.mark(`${name}-end`)\n /* c8 ignore next 3 */\n if (err !== null && err.constructor !== SkipError) {\n log.printError(err)\n }\n performance.measure(name, `${name}-start`, `${name}-end`)\n log.groupEnd()\n const duration = lastTime - start\n let success = true\n times.sort((a, b) => a - b)\n /* c8 ignore next 3 */\n const againMessage = env.isBrowser\n ? ` - ${window.location.host + window.location.pathname}?filter=\\\\[${i + 1}/${tc._seed === null ? '' : `&seed=${tc._seed}`}`\n : `\\nrepeat: npm run test -- --filter \"\\\\[${i + 1}/\" ${tc._seed === null ? '' : `--seed ${tc._seed}`}`\n const timeInfo = (repeat && err === null)\n ? ` - ${times.length} repetitions in ${time.humanizeDuration(duration)} (best: ${time.humanizeDuration(times[0])}, worst: ${time.humanizeDuration(array.last(times))}, median: ${time.humanizeDuration(statistics.median(times))}, average: ${time.humanizeDuration(statistics.average(times))})`\n : ` in ${time.humanizeDuration(duration)}`\n if (err !== null) {\n /* c8 ignore start */\n if (err.constructor === SkipError) {\n log.print(log.GREY, log.BOLD, 'Skipped: ', log.UNBOLD, uncamelized)\n } else {\n success = false\n log.print(log.RED, log.BOLD, 'Failure: ', log.UNBOLD, log.UNCOLOR, uncamelized, log.GREY, timeInfo, againMessage)\n }\n /* c8 ignore stop */\n } else {\n log.print(log.GREEN, log.BOLD, 'Success: ', log.UNBOLD, log.UNCOLOR, uncamelized, log.GREY, timeInfo, againMessage)\n }\n return success\n}\n\n/**\n * Describe what you are currently testing. The message will be logged.\n *\n * ```js\n * export const testMyFirstTest = tc => {\n * t.describe('crunching numbers', 'already crunched 4 numbers!') // the optional second argument can describe the state.\n * }\n * ```\n *\n * @param {string} description\n * @param {string} info\n */\nexport const describe = (description, info = '') => log.print(log.BLUE, description, ' ', log.GREY, info)\n\n/**\n * Describe the state of the current computation.\n * ```js\n * export const testMyFirstTest = tc => {\n * t.info(already crunched 4 numbers!') // the optional second argument can describe the state.\n * }\n * ```\n *\n * @param {string} info\n */\nexport const info = info => describe('', info)\n\nexport const printDom = log.printDom\n\nexport const printCanvas = log.printCanvas\n\n/**\n * Group outputs in a collapsible category.\n *\n * ```js\n * export const testMyFirstTest = tc => {\n * t.group('subtest 1', () => {\n * t.describe('this message is part of a collapsible section')\n * })\n * await t.groupAsync('subtest async 2', async () => {\n * await someaction()\n * t.describe('this message is part of a collapsible section')\n * })\n * }\n * ```\n *\n * @param {string} description\n * @param {function(...any):void} f\n */\nexport const group = (description, f) => {\n log.group(log.BLUE, description)\n try {\n f()\n } finally {\n log.groupEnd()\n }\n}\n\n/**\n * Group outputs in a collapsible category.\n *\n * ```js\n * export const testMyFirstTest = async tc => {\n * t.group('subtest 1', () => {\n * t.describe('this message is part of a collapsible section')\n * })\n * await t.groupAsync('subtest async 2', async () => {\n * await someaction()\n * t.describe('this message is part of a collapsible section')\n * })\n * }\n * ```\n *\n * @param {string} description\n * @param {function(...any):Promise} f\n */\nexport const groupAsync = async (description, f) => {\n log.group(log.BLUE, description)\n try {\n await f()\n } finally {\n log.groupEnd()\n }\n}\n\n/**\n * Measure the time that it takes to calculate something.\n *\n * ```js\n * export const testMyFirstTest = async tc => {\n * t.measureTime('measurement', () => {\n * heavyCalculation()\n * })\n * await t.groupAsync('async measurement', async () => {\n * await heavyAsyncCalculation()\n * })\n * }\n * ```\n *\n * @param {string} message\n * @param {function(...any):void} f\n * @return {number} Returns a promise that resolves the measured duration to apply f\n */\nexport const measureTime = (message, f) => {\n let duration\n const start = performance.now()\n try {\n f()\n } finally {\n duration = performance.now() - start\n log.print(log.PURPLE, message, log.GREY, ` ${time.humanizeDuration(duration)}`)\n }\n return duration\n}\n\n/**\n * Measure the time that it takes to calculate something.\n *\n * ```js\n * export const testMyFirstTest = async tc => {\n * t.measureTimeAsync('measurement', async () => {\n * await heavyCalculation()\n * })\n * await t.groupAsync('async measurement', async () => {\n * await heavyAsyncCalculation()\n * })\n * }\n * ```\n *\n * @param {string} message\n * @param {function(...any):Promise} f\n * @return {Promise} Returns a promise that resolves the measured duration to apply f\n */\nexport const measureTimeAsync = async (message, f) => {\n let duration\n const start = performance.now()\n try {\n await f()\n } finally {\n duration = performance.now() - start\n log.print(log.PURPLE, message, log.GREY, ` ${time.humanizeDuration(duration)}`)\n }\n return duration\n}\n\n/**\n * @template T\n * @param {Array} as\n * @param {Array} bs\n * @param {string} [m]\n * @return {boolean}\n */\nexport const compareArrays = (as, bs, m = 'Arrays match') => {\n if (as.length !== bs.length) {\n fail(m)\n }\n for (let i = 0; i < as.length; i++) {\n if (as[i] !== bs[i]) {\n fail(m)\n }\n }\n return true\n}\n\n/**\n * @param {string} a\n * @param {string} b\n * @param {string} [m]\n * @throws {TestError} Throws if tests fails\n */\nexport const compareStrings = (a, b, m = 'Strings match') => {\n if (a !== b) {\n const diff = simpleDiffString(a, b)\n log.print(log.GREY, a.slice(0, diff.index), log.RED, a.slice(diff.index, diff.remove), log.GREEN, diff.insert, log.GREY, a.slice(diff.index + diff.remove))\n fail(m)\n }\n}\n\n/**\n * @template K,V\n * @param {Object} a\n * @param {Object} b\n * @param {string} [m]\n * @throws {TestError} Throws if test fails\n */\nexport const compareObjects = (a, b, m = 'Objects match') => { object.equalFlat(a, b) || fail(m) }\n\n/**\n * @param {any} _constructor\n * @param {any} a\n * @param {any} b\n * @param {string} path\n * @throws {TestError}\n */\nconst compareValues = (_constructor, a, b, path) => {\n if (a !== b) {\n fail(`Values ${json.stringify(a)} and ${json.stringify(b)} don't match (${path})`)\n }\n return true\n}\n\n/**\n * @param {string?} message\n * @param {string} reason\n * @param {string} path\n * @throws {TestError}\n */\nconst _failMessage = (message, reason, path) => fail(\n message === null\n ? `${reason} ${path}`\n : `${message} (${reason}) ${path}`\n)\n\n/**\n * @param {any} a\n * @param {any} b\n * @param {string} path\n * @param {string?} message\n * @param {function(any,any,any,string,any):boolean} customCompare\n */\nconst _compare = (a, b, path, message, customCompare) => {\n // we don't use assert here because we want to test all branches (istanbul errors if one branch is not tested)\n if (a == null || b == null) {\n return compareValues(null, a, b, path)\n }\n if (a.constructor !== b.constructor) {\n _failMessage(message, 'Constructors don\\'t match', path)\n }\n let success = true\n switch (a.constructor) {\n case ArrayBuffer:\n a = new Uint8Array(a)\n b = new Uint8Array(b)\n // eslint-disable-next-line no-fallthrough\n case Uint8Array: {\n if (a.byteLength !== b.byteLength) {\n _failMessage(message, 'ArrayBuffer lengths match', path)\n }\n for (let i = 0; success && i < a.length; i++) {\n success = success && a[i] === b[i]\n }\n break\n }\n case Set: {\n if (a.size !== b.size) {\n _failMessage(message, 'Sets have different number of attributes', path)\n }\n // @ts-ignore\n a.forEach(value => {\n if (!b.has(value)) {\n _failMessage(message, `b.${path} does have ${value}`, path)\n }\n })\n break\n }\n case Map: {\n if (a.size !== b.size) {\n _failMessage(message, 'Maps have different number of attributes', path)\n }\n // @ts-ignore\n a.forEach((value, key) => {\n if (!b.has(key)) {\n _failMessage(message, `Property ${path}[\"${key}\"] does not exist on second argument`, path)\n }\n _compare(value, b.get(key), `${path}[\"${key}\"]`, message, customCompare)\n })\n break\n }\n case Object:\n if (object.length(a) !== object.length(b)) {\n _failMessage(message, 'Objects have a different number of attributes', path)\n }\n object.forEach(a, (value, key) => {\n if (!object.hasProperty(b, key)) {\n _failMessage(message, `Property ${path} does not exist on second argument`, path)\n }\n _compare(value, b[key], `${path}[\"${key}\"]`, message, customCompare)\n })\n break\n case Array:\n if (a.length !== b.length) {\n _failMessage(message, 'Arrays have a different number of attributes', path)\n }\n // @ts-ignore\n a.forEach((value, i) => _compare(value, b[i], `${path}[${i}]`, message, customCompare))\n break\n /* c8 ignore next 4 */\n default:\n if (!customCompare(a.constructor, a, b, path, compareValues)) {\n _failMessage(message, `Values ${json.stringify(a)} and ${json.stringify(b)} don't match`, path)\n }\n }\n assert(success, message)\n return true\n}\n\n/**\n * @template T\n * @param {T} a\n * @param {T} b\n * @param {string?} [message]\n * @param {function(any,T,T,string,any):boolean} [customCompare]\n */\nexport const compare = (a, b, message = null, customCompare = compareValues) => _compare(a, b, 'obj', message, customCompare)\n\n/**\n * @template T\n * @param {T} property\n * @param {string?} [message]\n * @return {asserts property is NonNullable}\n * @throws {TestError}\n */\n/* c8 ignore next */\nexport const assert = (property, message = null) => { property || fail(`Assertion failed${message !== null ? `: ${message}` : ''}`) }\n\n/**\n * @param {function(...any):Promise} f\n */\nexport const promiseRejected = async f => {\n try {\n await f()\n } catch (err) {\n return\n }\n fail('Expected promise to fail')\n}\n\n/**\n * @param {function(...any):void} f\n * @throws {TestError}\n */\nexport const fails = f => {\n try {\n f()\n } catch (_err) {\n log.print(log.GREEN, '⇖ This Error was expected')\n return\n }\n fail('Expected this to fail')\n}\n\n/**\n * @param {function(...any):Promise} f\n * @throws {TestError}\n */\nexport const failsAsync = async f => {\n try {\n await f()\n } catch (_err) {\n log.print(log.GREEN, '⇖ This Error was expected')\n return\n }\n fail('Expected this to fail')\n}\n\n/**\n * @param {Object>>} tests\n */\nexport const runTests = async tests => {\n /**\n * @param {string} testname\n */\n const filterTest = testname => testname.startsWith('test') || testname.startsWith('benchmark')\n const numberOfTests = object.map(tests, mod => object.map(mod, (f, fname) => /* c8 ignore next */ f && filterTest(fname) ? 1 : 0).reduce(math.add, 0)).reduce(math.add, 0)\n let successfulTests = 0\n let testnumber = 0\n const start = performance.now()\n for (const modName in tests) {\n const mod = tests[modName]\n for (const fname in mod) {\n const f = mod[fname]\n /* c8 ignore else */\n if (f && filterTest(fname)) {\n const repeatEachTest = 1\n let success = true\n for (let i = 0; success && i < repeatEachTest; i++) {\n success = await run(modName, fname, f, testnumber, numberOfTests)\n }\n testnumber++\n /* c8 ignore else */\n if (success) {\n successfulTests++\n }\n }\n }\n }\n const end = performance.now()\n log.print('')\n const success = successfulTests === numberOfTests\n /* c8 ignore start */\n if (success) {\n log.print(log.GREEN, log.BOLD, 'All tests successful!', log.GREY, log.UNBOLD, ` in ${time.humanizeDuration(end - start)}`)\n log.printImgBase64(nyanCatImage, 50)\n } else {\n const failedTests = numberOfTests - successfulTests\n log.print(log.RED, log.BOLD, `> ${failedTests} test${failedTests > 1 ? 's' : ''} failed`)\n }\n /* c8 ignore stop */\n return success\n}\n\nclass TestError extends Error {}\n\n/**\n * @param {string} reason\n * @throws {TestError}\n */\nexport const fail = reason => {\n log.print(log.RED, log.BOLD, 'X ', log.UNBOLD, reason)\n throw new TestError('Test Failed')\n}\n\nclass SkipError extends Error {}\n\n/**\n * @param {boolean} cond If true, this tests will be skipped\n * @throws {SkipError}\n */\nexport const skip = (cond = true) => {\n if (cond) {\n throw new SkipError('skipping..')\n }\n}\n\n// eslint-disable-next-line\nconst nyanCatImage = 'R0lGODlhjABMAPcAAMiSE0xMTEzMzUKJzjQ0NFsoKPc7//FM/9mH/z9x0HIiIoKCgmBHN+frGSkZLdDQ0LCwsDk71g0KCUzDdrQQEOFz/8yYdelmBdTiHFxcXDU2erR/mLrTHCgoKK5szBQUFNgSCTk6ymfpCB9VZS2Bl+cGBt2N8kWm0uDcGXhZRUvGq94NCFPhDiwsLGVlZTgqIPMDA1g3aEzS5D6xAURERDtG9JmBjJsZGWs2AD1W6Hp6eswyDeJ4CFNTU1LcEoJRmTMzSd14CTg5ser2GmDzBd17/xkZGUzMvoSMDiEhIfKruCwNAJaWlvRzA8kNDXDrCfi0pe1U/+GS6SZrAB4eHpZwVhoabsx9oiYmJt/TGHFxcYyMjOid0+Zl/0rF6j09PeRr/0zU9DxO6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7iEALMtAPa5iEfbTQIT0YgTxGKJAMvfSFDhDoHgT4AgE6hBA/+GEQ2AgiNvy84EMfekGI2BhEEf1QAyQuEYhCJGIRjyhEJRaxiUJ8IhKlaEQkWtGHWAyiFqO4RC/UIIUl2s4H9PAlw+lrBPHQQ4UCtDU7vJEgbsijHvfIxz768Y+ADKQgB0lIQGJjDdvZjkBstJ3EHCSRRLLRHQnCiEoSJAKVrOQcCCKGTDIiApTMpBgIMgdPbnIgncxkQTw5yoGUMpOnFEgqLRnKSrZSIK/U5Ag+kLjEDaSXCQGmQHzJpWIasyV3OaYyl8nMZi7nLsl0ZkagKc1qWvOa2JxLNLPJzW6+ZZvevAhdwrkStJCTI2gZ5zknos51shOc7oynPOdJz3ra857hDAgAOw=='\n","/**\n * Observable class prototype.\n *\n * @module observable\n */\n\nimport * as map from './map.js'\nimport * as set from './set.js'\nimport * as array from './array.js'\n\n/**\n * Handles named events.\n * @experimental\n *\n * This is basically a (better typed) duplicate of Observable, which will replace Observable in the\n * next release.\n *\n * @template {{[key: string]: function(...any):void}} EVENTS\n */\nexport class ObservableV2 {\n constructor () {\n /**\n * Some desc.\n * @type {Map>}\n */\n this._observers = map.create()\n }\n\n /**\n * @template {string} NAME\n * @param {NAME} name\n * @param {EVENTS[NAME]} f\n */\n on (name, f) {\n map.setIfUndefined(this._observers, /** @type {string} */ (name), set.create).add(f)\n return f\n }\n\n /**\n * @template {string} NAME\n * @param {NAME} name\n * @param {EVENTS[NAME]} f\n */\n once (name, f) {\n /**\n * @param {...any} args\n */\n const _f = (...args) => {\n this.off(name, /** @type {any} */ (_f))\n f(...args)\n }\n this.on(name, /** @type {any} */ (_f))\n }\n\n /**\n * @template {string} NAME\n * @param {NAME} name\n * @param {EVENTS[NAME]} f\n */\n off (name, f) {\n const observers = this._observers.get(name)\n if (observers !== undefined) {\n observers.delete(f)\n if (observers.size === 0) {\n this._observers.delete(name)\n }\n }\n }\n\n /**\n * Emit a named event. All registered event listeners that listen to the\n * specified name will receive the event.\n *\n * @todo This should catch exceptions\n *\n * @template {string} NAME\n * @param {NAME} name The event name.\n * @param {Parameters} args The arguments that are applied to the event listener.\n */\n emit (name, args) {\n // copy all listeners to an array first to make sure that no event is emitted to listeners that are subscribed while the event handler is called.\n return array.from((this._observers.get(name) || map.create()).values()).forEach(f => f(...args))\n }\n\n destroy () {\n this._observers = map.create()\n }\n}\n\n/* c8 ignore start */\n/**\n * Handles named events.\n *\n * @deprecated\n * @template N\n */\nexport class Observable {\n constructor () {\n /**\n * Some desc.\n * @type {Map}\n */\n this._observers = map.create()\n }\n\n /**\n * @param {N} name\n * @param {function} f\n */\n on (name, f) {\n map.setIfUndefined(this._observers, name, set.create).add(f)\n }\n\n /**\n * @param {N} name\n * @param {function} f\n */\n once (name, f) {\n /**\n * @param {...any} args\n */\n const _f = (...args) => {\n this.off(name, _f)\n f(...args)\n }\n this.on(name, _f)\n }\n\n /**\n * @param {N} name\n * @param {function} f\n */\n off (name, f) {\n const observers = this._observers.get(name)\n if (observers !== undefined) {\n observers.delete(f)\n if (observers.size === 0) {\n this._observers.delete(name)\n }\n }\n }\n\n /**\n * Emit a named event. All registered event listeners that listen to the\n * specified name will receive the event.\n *\n * @todo This should catch exceptions\n *\n * @param {N} name The event name.\n * @param {Array} args The arguments that are applied to the event listener.\n */\n emit (name, args) {\n // copy all listeners to an array first to make sure that no event is emitted to listeners that are subscribed while the event handler is called.\n return array.from((this._observers.get(name) || map.create()).values()).forEach(f => f(...args))\n }\n\n destroy () {\n this._observers = map.create()\n }\n}\n/* c8 ignore end */\n","/**\n * Utility module to create and manipulate Iterators.\n *\n * @module iterator\n */\n\n/**\n * @template T,R\n * @param {Iterator} iterator\n * @param {function(T):R} f\n * @return {IterableIterator}\n */\nexport const mapIterator = (iterator, f) => ({\n [Symbol.iterator] () {\n return this\n },\n // @ts-ignore\n next () {\n const r = iterator.next()\n return { value: r.done ? undefined : f(r.value), done: r.done }\n }\n})\n\n/**\n * @template T\n * @param {function():IteratorResult} next\n * @return {IterableIterator}\n */\nexport const createIterator = next => ({\n /**\n * @return {IterableIterator}\n */\n [Symbol.iterator] () {\n return this\n },\n // @ts-ignore\n next\n})\n\n/**\n * @template T\n * @param {Iterator} iterator\n * @param {function(T):boolean} filter\n */\nexport const iteratorFilter = (iterator, filter) => createIterator(() => {\n let res\n do {\n res = iterator.next()\n } while (!res.done && !filter(res.value))\n return res\n})\n\n/**\n * @template T,M\n * @param {Iterator} iterator\n * @param {function(T):M} fmap\n */\nexport const iteratorMap = (iterator, fmap) => createIterator(() => {\n const { done, value } = iterator.next()\n return { done, value: done ? undefined : fmap(value) }\n})\n","import { Observable } from 'lib0/observable';\nimport * as array from 'lib0/array';\nimport * as math from 'lib0/math';\nimport * as map from 'lib0/map';\nimport * as encoding from 'lib0/encoding';\nimport * as decoding from 'lib0/decoding';\nimport * as random from 'lib0/random';\nimport * as promise from 'lib0/promise';\nimport * as buffer from 'lib0/buffer';\nimport * as error from 'lib0/error';\nimport * as binary from 'lib0/binary';\nimport * as f from 'lib0/function';\nimport { callAll } from 'lib0/function';\nimport * as set from 'lib0/set';\nimport * as logging from 'lib0/logging';\nimport * as time from 'lib0/time';\nimport * as string from 'lib0/string';\nimport * as iterator from 'lib0/iterator';\nimport * as object from 'lib0/object';\n\n/**\n * This is an abstract interface that all Connectors should implement to keep them interchangeable.\n *\n * @note This interface is experimental and it is not advised to actually inherit this class.\n * It just serves as typing information.\n *\n * @extends {Observable}\n */\nclass AbstractConnector extends Observable {\n /**\n * @param {Doc} ydoc\n * @param {any} awareness\n */\n constructor (ydoc, awareness) {\n super();\n this.doc = ydoc;\n this.awareness = awareness;\n }\n}\n\nclass DeleteItem {\n /**\n * @param {number} clock\n * @param {number} len\n */\n constructor (clock, len) {\n /**\n * @type {number}\n */\n this.clock = clock;\n /**\n * @type {number}\n */\n this.len = len;\n }\n}\n\n/**\n * We no longer maintain a DeleteStore. DeleteSet is a temporary object that is created when needed.\n * - When created in a transaction, it must only be accessed after sorting, and merging\n * - This DeleteSet is send to other clients\n * - We do not create a DeleteSet when we send a sync message. The DeleteSet message is created directly from StructStore\n * - We read a DeleteSet as part of a sync/update message. In this case the DeleteSet is already sorted and merged.\n */\nclass DeleteSet {\n constructor () {\n /**\n * @type {Map>}\n */\n this.clients = new Map();\n }\n}\n\n/**\n * Iterate over all structs that the DeleteSet gc's.\n *\n * @param {Transaction} transaction\n * @param {DeleteSet} ds\n * @param {function(GC|Item):void} f\n *\n * @function\n */\nconst iterateDeletedStructs = (transaction, ds, f) =>\n ds.clients.forEach((deletes, clientid) => {\n const structs = /** @type {Array} */ (transaction.doc.store.clients.get(clientid));\n for (let i = 0; i < deletes.length; i++) {\n const del = deletes[i];\n iterateStructs(transaction, structs, del.clock, del.len, f);\n }\n });\n\n/**\n * @param {Array} dis\n * @param {number} clock\n * @return {number|null}\n *\n * @private\n * @function\n */\nconst findIndexDS = (dis, clock) => {\n let left = 0;\n let right = dis.length - 1;\n while (left <= right) {\n const midindex = math.floor((left + right) / 2);\n const mid = dis[midindex];\n const midclock = mid.clock;\n if (midclock <= clock) {\n if (clock < midclock + mid.len) {\n return midindex\n }\n left = midindex + 1;\n } else {\n right = midindex - 1;\n }\n }\n return null\n};\n\n/**\n * @param {DeleteSet} ds\n * @param {ID} id\n * @return {boolean}\n *\n * @private\n * @function\n */\nconst isDeleted = (ds, id) => {\n const dis = ds.clients.get(id.client);\n return dis !== undefined && findIndexDS(dis, id.clock) !== null\n};\n\n/**\n * @param {DeleteSet} ds\n *\n * @private\n * @function\n */\nconst sortAndMergeDeleteSet = ds => {\n ds.clients.forEach(dels => {\n dels.sort((a, b) => a.clock - b.clock);\n // merge items without filtering or splicing the array\n // i is the current pointer\n // j refers to the current insert position for the pointed item\n // try to merge dels[i] into dels[j-1] or set dels[j]=dels[i]\n let i, j;\n for (i = 1, j = 1; i < dels.length; i++) {\n const left = dels[j - 1];\n const right = dels[i];\n if (left.clock + left.len >= right.clock) {\n left.len = math.max(left.len, right.clock + right.len - left.clock);\n } else {\n if (j < i) {\n dels[j] = right;\n }\n j++;\n }\n }\n dels.length = j;\n });\n};\n\n/**\n * @param {Array} dss\n * @return {DeleteSet} A fresh DeleteSet\n */\nconst mergeDeleteSets = dss => {\n const merged = new DeleteSet();\n for (let dssI = 0; dssI < dss.length; dssI++) {\n dss[dssI].clients.forEach((delsLeft, client) => {\n if (!merged.clients.has(client)) {\n // Write all missing keys from current ds and all following.\n // If merged already contains `client` current ds has already been added.\n /**\n * @type {Array}\n */\n const dels = delsLeft.slice();\n for (let i = dssI + 1; i < dss.length; i++) {\n array.appendTo(dels, dss[i].clients.get(client) || []);\n }\n merged.clients.set(client, dels);\n }\n });\n }\n sortAndMergeDeleteSet(merged);\n return merged\n};\n\n/**\n * @param {DeleteSet} ds\n * @param {number} client\n * @param {number} clock\n * @param {number} length\n *\n * @private\n * @function\n */\nconst addToDeleteSet = (ds, client, clock, length) => {\n map.setIfUndefined(ds.clients, client, () => /** @type {Array} */ ([])).push(new DeleteItem(clock, length));\n};\n\nconst createDeleteSet = () => new DeleteSet();\n\n/**\n * @param {StructStore} ss\n * @return {DeleteSet} Merged and sorted DeleteSet\n *\n * @private\n * @function\n */\nconst createDeleteSetFromStructStore = ss => {\n const ds = createDeleteSet();\n ss.clients.forEach((structs, client) => {\n /**\n * @type {Array}\n */\n const dsitems = [];\n for (let i = 0; i < structs.length; i++) {\n const struct = structs[i];\n if (struct.deleted) {\n const clock = struct.id.clock;\n let len = struct.length;\n if (i + 1 < structs.length) {\n for (let next = structs[i + 1]; i + 1 < structs.length && next.deleted; next = structs[++i + 1]) {\n len += next.length;\n }\n }\n dsitems.push(new DeleteItem(clock, len));\n }\n }\n if (dsitems.length > 0) {\n ds.clients.set(client, dsitems);\n }\n });\n return ds\n};\n\n/**\n * @param {DSEncoderV1 | DSEncoderV2} encoder\n * @param {DeleteSet} ds\n *\n * @private\n * @function\n */\nconst writeDeleteSet = (encoder, ds) => {\n encoding.writeVarUint(encoder.restEncoder, ds.clients.size);\n\n // Ensure that the delete set is written in a deterministic order\n array.from(ds.clients.entries())\n .sort((a, b) => b[0] - a[0])\n .forEach(([client, dsitems]) => {\n encoder.resetDsCurVal();\n encoding.writeVarUint(encoder.restEncoder, client);\n const len = dsitems.length;\n encoding.writeVarUint(encoder.restEncoder, len);\n for (let i = 0; i < len; i++) {\n const item = dsitems[i];\n encoder.writeDsClock(item.clock);\n encoder.writeDsLen(item.len);\n }\n });\n};\n\n/**\n * @param {DSDecoderV1 | DSDecoderV2} decoder\n * @return {DeleteSet}\n *\n * @private\n * @function\n */\nconst readDeleteSet = decoder => {\n const ds = new DeleteSet();\n const numClients = decoding.readVarUint(decoder.restDecoder);\n for (let i = 0; i < numClients; i++) {\n decoder.resetDsCurVal();\n const client = decoding.readVarUint(decoder.restDecoder);\n const numberOfDeletes = decoding.readVarUint(decoder.restDecoder);\n if (numberOfDeletes > 0) {\n const dsField = map.setIfUndefined(ds.clients, client, () => /** @type {Array} */ ([]));\n for (let i = 0; i < numberOfDeletes; i++) {\n dsField.push(new DeleteItem(decoder.readDsClock(), decoder.readDsLen()));\n }\n }\n }\n return ds\n};\n\n/**\n * @todo YDecoder also contains references to String and other Decoders. Would make sense to exchange YDecoder.toUint8Array for YDecoder.DsToUint8Array()..\n */\n\n/**\n * @param {DSDecoderV1 | DSDecoderV2} decoder\n * @param {Transaction} transaction\n * @param {StructStore} store\n * @return {Uint8Array|null} Returns a v2 update containing all deletes that couldn't be applied yet; or null if all deletes were applied successfully.\n *\n * @private\n * @function\n */\nconst readAndApplyDeleteSet = (decoder, transaction, store) => {\n const unappliedDS = new DeleteSet();\n const numClients = decoding.readVarUint(decoder.restDecoder);\n for (let i = 0; i < numClients; i++) {\n decoder.resetDsCurVal();\n const client = decoding.readVarUint(decoder.restDecoder);\n const numberOfDeletes = decoding.readVarUint(decoder.restDecoder);\n const structs = store.clients.get(client) || [];\n const state = getState(store, client);\n for (let i = 0; i < numberOfDeletes; i++) {\n const clock = decoder.readDsClock();\n const clockEnd = clock + decoder.readDsLen();\n if (clock < state) {\n if (state < clockEnd) {\n addToDeleteSet(unappliedDS, client, state, clockEnd - state);\n }\n let index = findIndexSS(structs, clock);\n /**\n * We can ignore the case of GC and Delete structs, because we are going to skip them\n * @type {Item}\n */\n // @ts-ignore\n let struct = structs[index];\n // split the first item if necessary\n if (!struct.deleted && struct.id.clock < clock) {\n structs.splice(index + 1, 0, splitItem(transaction, struct, clock - struct.id.clock));\n index++; // increase we now want to use the next struct\n }\n while (index < structs.length) {\n // @ts-ignore\n struct = structs[index++];\n if (struct.id.clock < clockEnd) {\n if (!struct.deleted) {\n if (clockEnd < struct.id.clock + struct.length) {\n structs.splice(index, 0, splitItem(transaction, struct, clockEnd - struct.id.clock));\n }\n struct.delete(transaction);\n }\n } else {\n break\n }\n }\n } else {\n addToDeleteSet(unappliedDS, client, clock, clockEnd - clock);\n }\n }\n }\n if (unappliedDS.clients.size > 0) {\n const ds = new UpdateEncoderV2();\n encoding.writeVarUint(ds.restEncoder, 0); // encode 0 structs\n writeDeleteSet(ds, unappliedDS);\n return ds.toUint8Array()\n }\n return null\n};\n\n/**\n * @param {DeleteSet} ds1\n * @param {DeleteSet} ds2\n */\nconst equalDeleteSets = (ds1, ds2) => {\n if (ds1.clients.size !== ds2.clients.size) return false\n for (const [client, deleteItems1] of ds1.clients.entries()) {\n const deleteItems2 = /** @type {Array} */ (ds2.clients.get(client));\n if (deleteItems2 === undefined || deleteItems1.length !== deleteItems2.length) return false\n for (let i = 0; i < deleteItems1.length; i++) {\n const di1 = deleteItems1[i];\n const di2 = deleteItems2[i];\n if (di1.clock !== di2.clock || di1.len !== di2.len) {\n return false\n }\n }\n }\n return true\n};\n\n/**\n * @module Y\n */\n\nconst generateNewClientId = random.uint32;\n\n/**\n * @typedef {Object} DocOpts\n * @property {boolean} [DocOpts.gc=true] Disable garbage collection (default: gc=true)\n * @property {function(Item):boolean} [DocOpts.gcFilter] Will be called before an Item is garbage collected. Return false to keep the Item.\n * @property {string} [DocOpts.guid] Define a globally unique identifier for this document\n * @property {string | null} [DocOpts.collectionid] Associate this document with a collection. This only plays a role if your provider has a concept of collection.\n * @property {any} [DocOpts.meta] Any kind of meta information you want to associate with this document. If this is a subdocument, remote peers will store the meta information as well.\n * @property {boolean} [DocOpts.autoLoad] If a subdocument, automatically load document. If this is a subdocument, remote peers will load the document as well automatically.\n * @property {boolean} [DocOpts.shouldLoad] Whether the document should be synced by the provider now. This is toggled to true when you call ydoc.load()\n */\n\n/**\n * A Yjs instance handles the state of shared data.\n * @extends Observable\n */\nclass Doc extends Observable {\n /**\n * @param {DocOpts} opts configuration\n */\n constructor ({ guid = random.uuidv4(), collectionid = null, gc = true, gcFilter = () => true, meta = null, autoLoad = false, shouldLoad = true } = {}) {\n super();\n this.gc = gc;\n this.gcFilter = gcFilter;\n this.clientID = generateNewClientId();\n this.guid = guid;\n this.collectionid = collectionid;\n /**\n * @type {Map>>}\n */\n this.share = new Map();\n this.store = new StructStore();\n /**\n * @type {Transaction | null}\n */\n this._transaction = null;\n /**\n * @type {Array}\n */\n this._transactionCleanups = [];\n /**\n * @type {Set}\n */\n this.subdocs = new Set();\n /**\n * If this document is a subdocument - a document integrated into another document - then _item is defined.\n * @type {Item?}\n */\n this._item = null;\n this.shouldLoad = shouldLoad;\n this.autoLoad = autoLoad;\n this.meta = meta;\n /**\n * This is set to true when the persistence provider loaded the document from the database or when the `sync` event fires.\n * Note that not all providers implement this feature. Provider authors are encouraged to fire the `load` event when the doc content is loaded from the database.\n *\n * @type {boolean}\n */\n this.isLoaded = false;\n /**\n * This is set to true when the connection provider has successfully synced with a backend.\n * Note that when using peer-to-peer providers this event may not provide very useful.\n * Also note that not all providers implement this feature. Provider authors are encouraged to fire\n * the `sync` event when the doc has been synced (with `true` as a parameter) or if connection is\n * lost (with false as a parameter).\n */\n this.isSynced = false;\n /**\n * Promise that resolves once the document has been loaded from a presistence provider.\n */\n this.whenLoaded = promise.create(resolve => {\n this.on('load', () => {\n this.isLoaded = true;\n resolve(this);\n });\n });\n const provideSyncedPromise = () => promise.create(resolve => {\n /**\n * @param {boolean} isSynced\n */\n const eventHandler = (isSynced) => {\n if (isSynced === undefined || isSynced === true) {\n this.off('sync', eventHandler);\n resolve();\n }\n };\n this.on('sync', eventHandler);\n });\n this.on('sync', isSynced => {\n if (isSynced === false && this.isSynced) {\n this.whenSynced = provideSyncedPromise();\n }\n this.isSynced = isSynced === undefined || isSynced === true;\n if (!this.isLoaded) {\n this.emit('load', []);\n }\n });\n /**\n * Promise that resolves once the document has been synced with a backend.\n * This promise is recreated when the connection is lost.\n * Note the documentation about the `isSynced` property.\n */\n this.whenSynced = provideSyncedPromise();\n }\n\n /**\n * Notify the parent document that you request to load data into this subdocument (if it is a subdocument).\n *\n * `load()` might be used in the future to request any provider to load the most current data.\n *\n * It is safe to call `load()` multiple times.\n */\n load () {\n const item = this._item;\n if (item !== null && !this.shouldLoad) {\n transact(/** @type {any} */ (item.parent).doc, transaction => {\n transaction.subdocsLoaded.add(this);\n }, null, true);\n }\n this.shouldLoad = true;\n }\n\n getSubdocs () {\n return this.subdocs\n }\n\n getSubdocGuids () {\n return new Set(array.from(this.subdocs).map(doc => doc.guid))\n }\n\n /**\n * Changes that happen inside of a transaction are bundled. This means that\n * the observer fires _after_ the transaction is finished and that all changes\n * that happened inside of the transaction are sent as one message to the\n * other peers.\n *\n * @template T\n * @param {function(Transaction):T} f The function that should be executed as a transaction\n * @param {any} [origin] Origin of who started the transaction. Will be stored on transaction.origin\n * @return T\n *\n * @public\n */\n transact (f, origin = null) {\n return transact(this, f, origin)\n }\n\n /**\n * Define a shared data type.\n *\n * Multiple calls of `y.get(name, TypeConstructor)` yield the same result\n * and do not overwrite each other. I.e.\n * `y.define(name, Y.Array) === y.define(name, Y.Array)`\n *\n * After this method is called, the type is also available on `y.share.get(name)`.\n *\n * *Best Practices:*\n * Define all types right after the Yjs instance is created and store them in a separate object.\n * Also use the typed methods `getText(name)`, `getArray(name)`, ..\n *\n * @example\n * const y = new Y(..)\n * const appState = {\n * document: y.getText('document')\n * comments: y.getArray('comments')\n * }\n *\n * @param {string} name\n * @param {Function} TypeConstructor The constructor of the type definition. E.g. Y.Text, Y.Array, Y.Map, ...\n * @return {AbstractType} The created type. Constructed with TypeConstructor\n *\n * @public\n */\n get (name, TypeConstructor = AbstractType) {\n const type = map.setIfUndefined(this.share, name, () => {\n // @ts-ignore\n const t = new TypeConstructor();\n t._integrate(this, null);\n return t\n });\n const Constr = type.constructor;\n if (TypeConstructor !== AbstractType && Constr !== TypeConstructor) {\n if (Constr === AbstractType) {\n // @ts-ignore\n const t = new TypeConstructor();\n t._map = type._map;\n type._map.forEach(/** @param {Item?} n */ n => {\n for (; n !== null; n = n.left) {\n // @ts-ignore\n n.parent = t;\n }\n });\n t._start = type._start;\n for (let n = t._start; n !== null; n = n.right) {\n n.parent = t;\n }\n t._length = type._length;\n this.share.set(name, t);\n t._integrate(this, null);\n return t\n } else {\n throw new Error(`Type with the name ${name} has already been defined with a different constructor`)\n }\n }\n return type\n }\n\n /**\n * @template T\n * @param {string} [name]\n * @return {YArray}\n *\n * @public\n */\n getArray (name = '') {\n // @ts-ignore\n return this.get(name, YArray)\n }\n\n /**\n * @param {string} [name]\n * @return {YText}\n *\n * @public\n */\n getText (name = '') {\n // @ts-ignore\n return this.get(name, YText)\n }\n\n /**\n * @template T\n * @param {string} [name]\n * @return {YMap}\n *\n * @public\n */\n getMap (name = '') {\n // @ts-ignore\n return this.get(name, YMap)\n }\n\n /**\n * @param {string} [name]\n * @return {YXmlFragment}\n *\n * @public\n */\n getXmlFragment (name = '') {\n // @ts-ignore\n return this.get(name, YXmlFragment)\n }\n\n /**\n * Converts the entire document into a js object, recursively traversing each yjs type\n * Doesn't log types that have not been defined (using ydoc.getType(..)).\n *\n * @deprecated Do not use this method and rather call toJSON directly on the shared types.\n *\n * @return {Object}\n */\n toJSON () {\n /**\n * @type {Object}\n */\n const doc = {};\n\n this.share.forEach((value, key) => {\n doc[key] = value.toJSON();\n });\n\n return doc\n }\n\n /**\n * Emit `destroy` event and unregister all event handlers.\n */\n destroy () {\n array.from(this.subdocs).forEach(subdoc => subdoc.destroy());\n const item = this._item;\n if (item !== null) {\n this._item = null;\n const content = /** @type {ContentDoc} */ (item.content);\n content.doc = new Doc({ guid: this.guid, ...content.opts, shouldLoad: false });\n content.doc._item = item;\n transact(/** @type {any} */ (item).parent.doc, transaction => {\n const doc = content.doc;\n if (!item.deleted) {\n transaction.subdocsAdded.add(doc);\n }\n transaction.subdocsRemoved.add(this);\n }, null, true);\n }\n this.emit('destroyed', [true]);\n this.emit('destroy', [this]);\n super.destroy();\n }\n\n /**\n * @param {string} eventName\n * @param {function(...any):any} f\n */\n on (eventName, f) {\n super.on(eventName, f);\n }\n\n /**\n * @param {string} eventName\n * @param {function} f\n */\n off (eventName, f) {\n super.off(eventName, f);\n }\n}\n\nclass DSDecoderV1 {\n /**\n * @param {decoding.Decoder} decoder\n */\n constructor (decoder) {\n this.restDecoder = decoder;\n }\n\n resetDsCurVal () {\n // nop\n }\n\n /**\n * @return {number}\n */\n readDsClock () {\n return decoding.readVarUint(this.restDecoder)\n }\n\n /**\n * @return {number}\n */\n readDsLen () {\n return decoding.readVarUint(this.restDecoder)\n }\n}\n\nclass UpdateDecoderV1 extends DSDecoderV1 {\n /**\n * @return {ID}\n */\n readLeftID () {\n return createID(decoding.readVarUint(this.restDecoder), decoding.readVarUint(this.restDecoder))\n }\n\n /**\n * @return {ID}\n */\n readRightID () {\n return createID(decoding.readVarUint(this.restDecoder), decoding.readVarUint(this.restDecoder))\n }\n\n /**\n * Read the next client id.\n * Use this in favor of readID whenever possible to reduce the number of objects created.\n */\n readClient () {\n return decoding.readVarUint(this.restDecoder)\n }\n\n /**\n * @return {number} info An unsigned 8-bit integer\n */\n readInfo () {\n return decoding.readUint8(this.restDecoder)\n }\n\n /**\n * @return {string}\n */\n readString () {\n return decoding.readVarString(this.restDecoder)\n }\n\n /**\n * @return {boolean} isKey\n */\n readParentInfo () {\n return decoding.readVarUint(this.restDecoder) === 1\n }\n\n /**\n * @return {number} info An unsigned 8-bit integer\n */\n readTypeRef () {\n return decoding.readVarUint(this.restDecoder)\n }\n\n /**\n * Write len of a struct - well suited for Opt RLE encoder.\n *\n * @return {number} len\n */\n readLen () {\n return decoding.readVarUint(this.restDecoder)\n }\n\n /**\n * @return {any}\n */\n readAny () {\n return decoding.readAny(this.restDecoder)\n }\n\n /**\n * @return {Uint8Array}\n */\n readBuf () {\n return buffer.copyUint8Array(decoding.readVarUint8Array(this.restDecoder))\n }\n\n /**\n * Legacy implementation uses JSON parse. We use any-decoding in v2.\n *\n * @return {any}\n */\n readJSON () {\n return JSON.parse(decoding.readVarString(this.restDecoder))\n }\n\n /**\n * @return {string}\n */\n readKey () {\n return decoding.readVarString(this.restDecoder)\n }\n}\n\nclass DSDecoderV2 {\n /**\n * @param {decoding.Decoder} decoder\n */\n constructor (decoder) {\n /**\n * @private\n */\n this.dsCurrVal = 0;\n this.restDecoder = decoder;\n }\n\n resetDsCurVal () {\n this.dsCurrVal = 0;\n }\n\n /**\n * @return {number}\n */\n readDsClock () {\n this.dsCurrVal += decoding.readVarUint(this.restDecoder);\n return this.dsCurrVal\n }\n\n /**\n * @return {number}\n */\n readDsLen () {\n const diff = decoding.readVarUint(this.restDecoder) + 1;\n this.dsCurrVal += diff;\n return diff\n }\n}\n\nclass UpdateDecoderV2 extends DSDecoderV2 {\n /**\n * @param {decoding.Decoder} decoder\n */\n constructor (decoder) {\n super(decoder);\n /**\n * List of cached keys. If the keys[id] does not exist, we read a new key\n * from stringEncoder and push it to keys.\n *\n * @type {Array}\n */\n this.keys = [];\n decoding.readVarUint(decoder); // read feature flag - currently unused\n this.keyClockDecoder = new decoding.IntDiffOptRleDecoder(decoding.readVarUint8Array(decoder));\n this.clientDecoder = new decoding.UintOptRleDecoder(decoding.readVarUint8Array(decoder));\n this.leftClockDecoder = new decoding.IntDiffOptRleDecoder(decoding.readVarUint8Array(decoder));\n this.rightClockDecoder = new decoding.IntDiffOptRleDecoder(decoding.readVarUint8Array(decoder));\n this.infoDecoder = new decoding.RleDecoder(decoding.readVarUint8Array(decoder), decoding.readUint8);\n this.stringDecoder = new decoding.StringDecoder(decoding.readVarUint8Array(decoder));\n this.parentInfoDecoder = new decoding.RleDecoder(decoding.readVarUint8Array(decoder), decoding.readUint8);\n this.typeRefDecoder = new decoding.UintOptRleDecoder(decoding.readVarUint8Array(decoder));\n this.lenDecoder = new decoding.UintOptRleDecoder(decoding.readVarUint8Array(decoder));\n }\n\n /**\n * @return {ID}\n */\n readLeftID () {\n return new ID(this.clientDecoder.read(), this.leftClockDecoder.read())\n }\n\n /**\n * @return {ID}\n */\n readRightID () {\n return new ID(this.clientDecoder.read(), this.rightClockDecoder.read())\n }\n\n /**\n * Read the next client id.\n * Use this in favor of readID whenever possible to reduce the number of objects created.\n */\n readClient () {\n return this.clientDecoder.read()\n }\n\n /**\n * @return {number} info An unsigned 8-bit integer\n */\n readInfo () {\n return /** @type {number} */ (this.infoDecoder.read())\n }\n\n /**\n * @return {string}\n */\n readString () {\n return this.stringDecoder.read()\n }\n\n /**\n * @return {boolean}\n */\n readParentInfo () {\n return this.parentInfoDecoder.read() === 1\n }\n\n /**\n * @return {number} An unsigned 8-bit integer\n */\n readTypeRef () {\n return this.typeRefDecoder.read()\n }\n\n /**\n * Write len of a struct - well suited for Opt RLE encoder.\n *\n * @return {number}\n */\n readLen () {\n return this.lenDecoder.read()\n }\n\n /**\n * @return {any}\n */\n readAny () {\n return decoding.readAny(this.restDecoder)\n }\n\n /**\n * @return {Uint8Array}\n */\n readBuf () {\n return decoding.readVarUint8Array(this.restDecoder)\n }\n\n /**\n * This is mainly here for legacy purposes.\n *\n * Initial we incoded objects using JSON. Now we use the much faster lib0/any-encoder. This method mainly exists for legacy purposes for the v1 encoder.\n *\n * @return {any}\n */\n readJSON () {\n return decoding.readAny(this.restDecoder)\n }\n\n /**\n * @return {string}\n */\n readKey () {\n const keyClock = this.keyClockDecoder.read();\n if (keyClock < this.keys.length) {\n return this.keys[keyClock]\n } else {\n const key = this.stringDecoder.read();\n this.keys.push(key);\n return key\n }\n }\n}\n\nclass DSEncoderV1 {\n constructor () {\n this.restEncoder = encoding.createEncoder();\n }\n\n toUint8Array () {\n return encoding.toUint8Array(this.restEncoder)\n }\n\n resetDsCurVal () {\n // nop\n }\n\n /**\n * @param {number} clock\n */\n writeDsClock (clock) {\n encoding.writeVarUint(this.restEncoder, clock);\n }\n\n /**\n * @param {number} len\n */\n writeDsLen (len) {\n encoding.writeVarUint(this.restEncoder, len);\n }\n}\n\nclass UpdateEncoderV1 extends DSEncoderV1 {\n /**\n * @param {ID} id\n */\n writeLeftID (id) {\n encoding.writeVarUint(this.restEncoder, id.client);\n encoding.writeVarUint(this.restEncoder, id.clock);\n }\n\n /**\n * @param {ID} id\n */\n writeRightID (id) {\n encoding.writeVarUint(this.restEncoder, id.client);\n encoding.writeVarUint(this.restEncoder, id.clock);\n }\n\n /**\n * Use writeClient and writeClock instead of writeID if possible.\n * @param {number} client\n */\n writeClient (client) {\n encoding.writeVarUint(this.restEncoder, client);\n }\n\n /**\n * @param {number} info An unsigned 8-bit integer\n */\n writeInfo (info) {\n encoding.writeUint8(this.restEncoder, info);\n }\n\n /**\n * @param {string} s\n */\n writeString (s) {\n encoding.writeVarString(this.restEncoder, s);\n }\n\n /**\n * @param {boolean} isYKey\n */\n writeParentInfo (isYKey) {\n encoding.writeVarUint(this.restEncoder, isYKey ? 1 : 0);\n }\n\n /**\n * @param {number} info An unsigned 8-bit integer\n */\n writeTypeRef (info) {\n encoding.writeVarUint(this.restEncoder, info);\n }\n\n /**\n * Write len of a struct - well suited for Opt RLE encoder.\n *\n * @param {number} len\n */\n writeLen (len) {\n encoding.writeVarUint(this.restEncoder, len);\n }\n\n /**\n * @param {any} any\n */\n writeAny (any) {\n encoding.writeAny(this.restEncoder, any);\n }\n\n /**\n * @param {Uint8Array} buf\n */\n writeBuf (buf) {\n encoding.writeVarUint8Array(this.restEncoder, buf);\n }\n\n /**\n * @param {any} embed\n */\n writeJSON (embed) {\n encoding.writeVarString(this.restEncoder, JSON.stringify(embed));\n }\n\n /**\n * @param {string} key\n */\n writeKey (key) {\n encoding.writeVarString(this.restEncoder, key);\n }\n}\n\nclass DSEncoderV2 {\n constructor () {\n this.restEncoder = encoding.createEncoder(); // encodes all the rest / non-optimized\n this.dsCurrVal = 0;\n }\n\n toUint8Array () {\n return encoding.toUint8Array(this.restEncoder)\n }\n\n resetDsCurVal () {\n this.dsCurrVal = 0;\n }\n\n /**\n * @param {number} clock\n */\n writeDsClock (clock) {\n const diff = clock - this.dsCurrVal;\n this.dsCurrVal = clock;\n encoding.writeVarUint(this.restEncoder, diff);\n }\n\n /**\n * @param {number} len\n */\n writeDsLen (len) {\n if (len === 0) {\n error.unexpectedCase();\n }\n encoding.writeVarUint(this.restEncoder, len - 1);\n this.dsCurrVal += len;\n }\n}\n\nclass UpdateEncoderV2 extends DSEncoderV2 {\n constructor () {\n super();\n /**\n * @type {Map}\n */\n this.keyMap = new Map();\n /**\n * Refers to the next uniqe key-identifier to me used.\n * See writeKey method for more information.\n *\n * @type {number}\n */\n this.keyClock = 0;\n this.keyClockEncoder = new encoding.IntDiffOptRleEncoder();\n this.clientEncoder = new encoding.UintOptRleEncoder();\n this.leftClockEncoder = new encoding.IntDiffOptRleEncoder();\n this.rightClockEncoder = new encoding.IntDiffOptRleEncoder();\n this.infoEncoder = new encoding.RleEncoder(encoding.writeUint8);\n this.stringEncoder = new encoding.StringEncoder();\n this.parentInfoEncoder = new encoding.RleEncoder(encoding.writeUint8);\n this.typeRefEncoder = new encoding.UintOptRleEncoder();\n this.lenEncoder = new encoding.UintOptRleEncoder();\n }\n\n toUint8Array () {\n const encoder = encoding.createEncoder();\n encoding.writeVarUint(encoder, 0); // this is a feature flag that we might use in the future\n encoding.writeVarUint8Array(encoder, this.keyClockEncoder.toUint8Array());\n encoding.writeVarUint8Array(encoder, this.clientEncoder.toUint8Array());\n encoding.writeVarUint8Array(encoder, this.leftClockEncoder.toUint8Array());\n encoding.writeVarUint8Array(encoder, this.rightClockEncoder.toUint8Array());\n encoding.writeVarUint8Array(encoder, encoding.toUint8Array(this.infoEncoder));\n encoding.writeVarUint8Array(encoder, this.stringEncoder.toUint8Array());\n encoding.writeVarUint8Array(encoder, encoding.toUint8Array(this.parentInfoEncoder));\n encoding.writeVarUint8Array(encoder, this.typeRefEncoder.toUint8Array());\n encoding.writeVarUint8Array(encoder, this.lenEncoder.toUint8Array());\n // @note The rest encoder is appended! (note the missing var)\n encoding.writeUint8Array(encoder, encoding.toUint8Array(this.restEncoder));\n return encoding.toUint8Array(encoder)\n }\n\n /**\n * @param {ID} id\n */\n writeLeftID (id) {\n this.clientEncoder.write(id.client);\n this.leftClockEncoder.write(id.clock);\n }\n\n /**\n * @param {ID} id\n */\n writeRightID (id) {\n this.clientEncoder.write(id.client);\n this.rightClockEncoder.write(id.clock);\n }\n\n /**\n * @param {number} client\n */\n writeClient (client) {\n this.clientEncoder.write(client);\n }\n\n /**\n * @param {number} info An unsigned 8-bit integer\n */\n writeInfo (info) {\n this.infoEncoder.write(info);\n }\n\n /**\n * @param {string} s\n */\n writeString (s) {\n this.stringEncoder.write(s);\n }\n\n /**\n * @param {boolean} isYKey\n */\n writeParentInfo (isYKey) {\n this.parentInfoEncoder.write(isYKey ? 1 : 0);\n }\n\n /**\n * @param {number} info An unsigned 8-bit integer\n */\n writeTypeRef (info) {\n this.typeRefEncoder.write(info);\n }\n\n /**\n * Write len of a struct - well suited for Opt RLE encoder.\n *\n * @param {number} len\n */\n writeLen (len) {\n this.lenEncoder.write(len);\n }\n\n /**\n * @param {any} any\n */\n writeAny (any) {\n encoding.writeAny(this.restEncoder, any);\n }\n\n /**\n * @param {Uint8Array} buf\n */\n writeBuf (buf) {\n encoding.writeVarUint8Array(this.restEncoder, buf);\n }\n\n /**\n * This is mainly here for legacy purposes.\n *\n * Initial we incoded objects using JSON. Now we use the much faster lib0/any-encoder. This method mainly exists for legacy purposes for the v1 encoder.\n *\n * @param {any} embed\n */\n writeJSON (embed) {\n encoding.writeAny(this.restEncoder, embed);\n }\n\n /**\n * Property keys are often reused. For example, in y-prosemirror the key `bold` might\n * occur very often. For a 3d application, the key `position` might occur very often.\n *\n * We cache these keys in a Map and refer to them via a unique number.\n *\n * @param {string} key\n */\n writeKey (key) {\n const clock = this.keyMap.get(key);\n if (clock === undefined) {\n /**\n * @todo uncomment to introduce this feature finally\n *\n * Background. The ContentFormat object was always encoded using writeKey, but the decoder used to use readString.\n * Furthermore, I forgot to set the keyclock. So everything was working fine.\n *\n * However, this feature here is basically useless as it is not being used (it actually only consumes extra memory).\n *\n * I don't know yet how to reintroduce this feature..\n *\n * Older clients won't be able to read updates when we reintroduce this feature. So this should probably be done using a flag.\n *\n */\n // this.keyMap.set(key, this.keyClock)\n this.keyClockEncoder.write(this.keyClock++);\n this.stringEncoder.write(key);\n } else {\n this.keyClockEncoder.write(clock);\n }\n }\n}\n\n/**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {Array} structs All structs by `client`\n * @param {number} client\n * @param {number} clock write structs starting with `ID(client,clock)`\n *\n * @function\n */\nconst writeStructs = (encoder, structs, client, clock) => {\n // write first id\n clock = math.max(clock, structs[0].id.clock); // make sure the first id exists\n const startNewStructs = findIndexSS(structs, clock);\n // write # encoded structs\n encoding.writeVarUint(encoder.restEncoder, structs.length - startNewStructs);\n encoder.writeClient(client);\n encoding.writeVarUint(encoder.restEncoder, clock);\n const firstStruct = structs[startNewStructs];\n // write first struct with an offset\n firstStruct.write(encoder, clock - firstStruct.id.clock);\n for (let i = startNewStructs + 1; i < structs.length; i++) {\n structs[i].write(encoder, 0);\n }\n};\n\n/**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {StructStore} store\n * @param {Map} _sm\n *\n * @private\n * @function\n */\nconst writeClientsStructs = (encoder, store, _sm) => {\n // we filter all valid _sm entries into sm\n const sm = new Map();\n _sm.forEach((clock, client) => {\n // only write if new structs are available\n if (getState(store, client) > clock) {\n sm.set(client, clock);\n }\n });\n getStateVector(store).forEach((_clock, client) => {\n if (!_sm.has(client)) {\n sm.set(client, 0);\n }\n });\n // write # states that were updated\n encoding.writeVarUint(encoder.restEncoder, sm.size);\n // Write items with higher client ids first\n // This heavily improves the conflict algorithm.\n array.from(sm.entries()).sort((a, b) => b[0] - a[0]).forEach(([client, clock]) => {\n writeStructs(encoder, /** @type {Array} */ (store.clients.get(client)), client, clock);\n });\n};\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder The decoder object to read data from.\n * @param {Doc} doc\n * @return {Map }>}\n *\n * @private\n * @function\n */\nconst readClientsStructRefs = (decoder, doc) => {\n /**\n * @type {Map }>}\n */\n const clientRefs = map.create();\n const numOfStateUpdates = decoding.readVarUint(decoder.restDecoder);\n for (let i = 0; i < numOfStateUpdates; i++) {\n const numberOfStructs = decoding.readVarUint(decoder.restDecoder);\n /**\n * @type {Array}\n */\n const refs = new Array(numberOfStructs);\n const client = decoder.readClient();\n let clock = decoding.readVarUint(decoder.restDecoder);\n // const start = performance.now()\n clientRefs.set(client, { i: 0, refs });\n for (let i = 0; i < numberOfStructs; i++) {\n const info = decoder.readInfo();\n switch (binary.BITS5 & info) {\n case 0: { // GC\n const len = decoder.readLen();\n refs[i] = new GC(createID(client, clock), len);\n clock += len;\n break\n }\n case 10: { // Skip Struct (nothing to apply)\n // @todo we could reduce the amount of checks by adding Skip struct to clientRefs so we know that something is missing.\n const len = decoding.readVarUint(decoder.restDecoder);\n refs[i] = new Skip(createID(client, clock), len);\n clock += len;\n break\n }\n default: { // Item with content\n /**\n * The optimized implementation doesn't use any variables because inlining variables is faster.\n * Below a non-optimized version is shown that implements the basic algorithm with\n * a few comments\n */\n const cantCopyParentInfo = (info & (binary.BIT7 | binary.BIT8)) === 0;\n // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y`\n // and we read the next string as parentYKey.\n // It indicates how we store/retrieve parent from `y.share`\n // @type {string|null}\n const struct = new Item(\n createID(client, clock),\n null, // leftd\n (info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null, // origin\n null, // right\n (info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null, // right origin\n cantCopyParentInfo ? (decoder.readParentInfo() ? doc.get(decoder.readString()) : decoder.readLeftID()) : null, // parent\n cantCopyParentInfo && (info & binary.BIT6) === binary.BIT6 ? decoder.readString() : null, // parentSub\n readItemContent(decoder, info) // item content\n );\n /* A non-optimized implementation of the above algorithm:\n\n // The item that was originally to the left of this item.\n const origin = (info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null\n // The item that was originally to the right of this item.\n const rightOrigin = (info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null\n const cantCopyParentInfo = (info & (binary.BIT7 | binary.BIT8)) === 0\n const hasParentYKey = cantCopyParentInfo ? decoder.readParentInfo() : false\n // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y`\n // and we read the next string as parentYKey.\n // It indicates how we store/retrieve parent from `y.share`\n // @type {string|null}\n const parentYKey = cantCopyParentInfo && hasParentYKey ? decoder.readString() : null\n\n const struct = new Item(\n createID(client, clock),\n null, // leftd\n origin, // origin\n null, // right\n rightOrigin, // right origin\n cantCopyParentInfo && !hasParentYKey ? decoder.readLeftID() : (parentYKey !== null ? doc.get(parentYKey) : null), // parent\n cantCopyParentInfo && (info & binary.BIT6) === binary.BIT6 ? decoder.readString() : null, // parentSub\n readItemContent(decoder, info) // item content\n )\n */\n refs[i] = struct;\n clock += struct.length;\n }\n }\n }\n // console.log('time to read: ', performance.now() - start) // @todo remove\n }\n return clientRefs\n};\n\n/**\n * Resume computing structs generated by struct readers.\n *\n * While there is something to do, we integrate structs in this order\n * 1. top element on stack, if stack is not empty\n * 2. next element from current struct reader (if empty, use next struct reader)\n *\n * If struct causally depends on another struct (ref.missing), we put next reader of\n * `ref.id.client` on top of stack.\n *\n * At some point we find a struct that has no causal dependencies,\n * then we start emptying the stack.\n *\n * It is not possible to have circles: i.e. struct1 (from client1) depends on struct2 (from client2)\n * depends on struct3 (from client1). Therefore the max stack size is eqaul to `structReaders.length`.\n *\n * This method is implemented in a way so that we can resume computation if this update\n * causally depends on another update.\n *\n * @param {Transaction} transaction\n * @param {StructStore} store\n * @param {Map} clientsStructRefs\n * @return { null | { update: Uint8Array, missing: Map } }\n *\n * @private\n * @function\n */\nconst integrateStructs = (transaction, store, clientsStructRefs) => {\n /**\n * @type {Array}\n */\n const stack = [];\n // sort them so that we take the higher id first, in case of conflicts the lower id will probably not conflict with the id from the higher user.\n let clientsStructRefsIds = array.from(clientsStructRefs.keys()).sort((a, b) => a - b);\n if (clientsStructRefsIds.length === 0) {\n return null\n }\n const getNextStructTarget = () => {\n if (clientsStructRefsIds.length === 0) {\n return null\n }\n let nextStructsTarget = /** @type {{i:number,refs:Array}} */ (clientsStructRefs.get(clientsStructRefsIds[clientsStructRefsIds.length - 1]));\n while (nextStructsTarget.refs.length === nextStructsTarget.i) {\n clientsStructRefsIds.pop();\n if (clientsStructRefsIds.length > 0) {\n nextStructsTarget = /** @type {{i:number,refs:Array}} */ (clientsStructRefs.get(clientsStructRefsIds[clientsStructRefsIds.length - 1]));\n } else {\n return null\n }\n }\n return nextStructsTarget\n };\n let curStructsTarget = getNextStructTarget();\n if (curStructsTarget === null && stack.length === 0) {\n return null\n }\n\n /**\n * @type {StructStore}\n */\n const restStructs = new StructStore();\n const missingSV = new Map();\n /**\n * @param {number} client\n * @param {number} clock\n */\n const updateMissingSv = (client, clock) => {\n const mclock = missingSV.get(client);\n if (mclock == null || mclock > clock) {\n missingSV.set(client, clock);\n }\n };\n /**\n * @type {GC|Item}\n */\n let stackHead = /** @type {any} */ (curStructsTarget).refs[/** @type {any} */ (curStructsTarget).i++];\n // caching the state because it is used very often\n const state = new Map();\n\n const addStackToRestSS = () => {\n for (const item of stack) {\n const client = item.id.client;\n const unapplicableItems = clientsStructRefs.get(client);\n if (unapplicableItems) {\n // decrement because we weren't able to apply previous operation\n unapplicableItems.i--;\n restStructs.clients.set(client, unapplicableItems.refs.slice(unapplicableItems.i));\n clientsStructRefs.delete(client);\n unapplicableItems.i = 0;\n unapplicableItems.refs = [];\n } else {\n // item was the last item on clientsStructRefs and the field was already cleared. Add item to restStructs and continue\n restStructs.clients.set(client, [item]);\n }\n // remove client from clientsStructRefsIds to prevent users from applying the same update again\n clientsStructRefsIds = clientsStructRefsIds.filter(c => c !== client);\n }\n stack.length = 0;\n };\n\n // iterate over all struct readers until we are done\n while (true) {\n if (stackHead.constructor !== Skip) {\n const localClock = map.setIfUndefined(state, stackHead.id.client, () => getState(store, stackHead.id.client));\n const offset = localClock - stackHead.id.clock;\n if (offset < 0) {\n // update from the same client is missing\n stack.push(stackHead);\n updateMissingSv(stackHead.id.client, stackHead.id.clock - 1);\n // hid a dead wall, add all items from stack to restSS\n addStackToRestSS();\n } else {\n const missing = stackHead.getMissing(transaction, store);\n if (missing !== null) {\n stack.push(stackHead);\n // get the struct reader that has the missing struct\n /**\n * @type {{ refs: Array, i: number }}\n */\n const structRefs = clientsStructRefs.get(/** @type {number} */ (missing)) || { refs: [], i: 0 };\n if (structRefs.refs.length === structRefs.i) {\n // This update message causally depends on another update message that doesn't exist yet\n updateMissingSv(/** @type {number} */ (missing), getState(store, missing));\n addStackToRestSS();\n } else {\n stackHead = structRefs.refs[structRefs.i++];\n continue\n }\n } else if (offset === 0 || offset < stackHead.length) {\n // all fine, apply the stackhead\n stackHead.integrate(transaction, offset);\n state.set(stackHead.id.client, stackHead.id.clock + stackHead.length);\n }\n }\n }\n // iterate to next stackHead\n if (stack.length > 0) {\n stackHead = /** @type {GC|Item} */ (stack.pop());\n } else if (curStructsTarget !== null && curStructsTarget.i < curStructsTarget.refs.length) {\n stackHead = /** @type {GC|Item} */ (curStructsTarget.refs[curStructsTarget.i++]);\n } else {\n curStructsTarget = getNextStructTarget();\n if (curStructsTarget === null) {\n // we are done!\n break\n } else {\n stackHead = /** @type {GC|Item} */ (curStructsTarget.refs[curStructsTarget.i++]);\n }\n }\n }\n if (restStructs.clients.size > 0) {\n const encoder = new UpdateEncoderV2();\n writeClientsStructs(encoder, restStructs, new Map());\n // write empty deleteset\n // writeDeleteSet(encoder, new DeleteSet())\n encoding.writeVarUint(encoder.restEncoder, 0); // => no need for an extra function call, just write 0 deletes\n return { missing: missingSV, update: encoder.toUint8Array() }\n }\n return null\n};\n\n/**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {Transaction} transaction\n *\n * @private\n * @function\n */\nconst writeStructsFromTransaction = (encoder, transaction) => writeClientsStructs(encoder, transaction.doc.store, transaction.beforeState);\n\n/**\n * Read and apply a document update.\n *\n * This function has the same effect as `applyUpdate` but accepts an decoder.\n *\n * @param {decoding.Decoder} decoder\n * @param {Doc} ydoc\n * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))`\n * @param {UpdateDecoderV1 | UpdateDecoderV2} [structDecoder]\n *\n * @function\n */\nconst readUpdateV2 = (decoder, ydoc, transactionOrigin, structDecoder = new UpdateDecoderV2(decoder)) =>\n transact(ydoc, transaction => {\n // force that transaction.local is set to non-local\n transaction.local = false;\n let retry = false;\n const doc = transaction.doc;\n const store = doc.store;\n // let start = performance.now()\n const ss = readClientsStructRefs(structDecoder, doc);\n // console.log('time to read structs: ', performance.now() - start) // @todo remove\n // start = performance.now()\n // console.log('time to merge: ', performance.now() - start) // @todo remove\n // start = performance.now()\n const restStructs = integrateStructs(transaction, store, ss);\n const pending = store.pendingStructs;\n if (pending) {\n // check if we can apply something\n for (const [client, clock] of pending.missing) {\n if (clock < getState(store, client)) {\n retry = true;\n break\n }\n }\n if (restStructs) {\n // merge restStructs into store.pending\n for (const [client, clock] of restStructs.missing) {\n const mclock = pending.missing.get(client);\n if (mclock == null || mclock > clock) {\n pending.missing.set(client, clock);\n }\n }\n pending.update = mergeUpdatesV2([pending.update, restStructs.update]);\n }\n } else {\n store.pendingStructs = restStructs;\n }\n // console.log('time to integrate: ', performance.now() - start) // @todo remove\n // start = performance.now()\n const dsRest = readAndApplyDeleteSet(structDecoder, transaction, store);\n if (store.pendingDs) {\n // @todo we could make a lower-bound state-vector check as we do above\n const pendingDSUpdate = new UpdateDecoderV2(decoding.createDecoder(store.pendingDs));\n decoding.readVarUint(pendingDSUpdate.restDecoder); // read 0 structs, because we only encode deletes in pendingdsupdate\n const dsRest2 = readAndApplyDeleteSet(pendingDSUpdate, transaction, store);\n if (dsRest && dsRest2) {\n // case 1: ds1 != null && ds2 != null\n store.pendingDs = mergeUpdatesV2([dsRest, dsRest2]);\n } else {\n // case 2: ds1 != null\n // case 3: ds2 != null\n // case 4: ds1 == null && ds2 == null\n store.pendingDs = dsRest || dsRest2;\n }\n } else {\n // Either dsRest == null && pendingDs == null OR dsRest != null\n store.pendingDs = dsRest;\n }\n // console.log('time to cleanup: ', performance.now() - start) // @todo remove\n // start = performance.now()\n\n // console.log('time to resume delete readers: ', performance.now() - start) // @todo remove\n // start = performance.now()\n if (retry) {\n const update = /** @type {{update: Uint8Array}} */ (store.pendingStructs).update;\n store.pendingStructs = null;\n applyUpdateV2(transaction.doc, update);\n }\n }, transactionOrigin, false);\n\n/**\n * Read and apply a document update.\n *\n * This function has the same effect as `applyUpdate` but accepts an decoder.\n *\n * @param {decoding.Decoder} decoder\n * @param {Doc} ydoc\n * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))`\n *\n * @function\n */\nconst readUpdate = (decoder, ydoc, transactionOrigin) => readUpdateV2(decoder, ydoc, transactionOrigin, new UpdateDecoderV1(decoder));\n\n/**\n * Apply a document update created by, for example, `y.on('update', update => ..)` or `update = encodeStateAsUpdate()`.\n *\n * This function has the same effect as `readUpdate` but accepts an Uint8Array instead of a Decoder.\n *\n * @param {Doc} ydoc\n * @param {Uint8Array} update\n * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))`\n * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder]\n *\n * @function\n */\nconst applyUpdateV2 = (ydoc, update, transactionOrigin, YDecoder = UpdateDecoderV2) => {\n const decoder = decoding.createDecoder(update);\n readUpdateV2(decoder, ydoc, transactionOrigin, new YDecoder(decoder));\n};\n\n/**\n * Apply a document update created by, for example, `y.on('update', update => ..)` or `update = encodeStateAsUpdate()`.\n *\n * This function has the same effect as `readUpdate` but accepts an Uint8Array instead of a Decoder.\n *\n * @param {Doc} ydoc\n * @param {Uint8Array} update\n * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))`\n *\n * @function\n */\nconst applyUpdate = (ydoc, update, transactionOrigin) => applyUpdateV2(ydoc, update, transactionOrigin, UpdateDecoderV1);\n\n/**\n * Write all the document as a single update message. If you specify the state of the remote client (`targetStateVector`) it will\n * only write the operations that are missing.\n *\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {Doc} doc\n * @param {Map} [targetStateVector] The state of the target that receives the update. Leave empty to write all known structs\n *\n * @function\n */\nconst writeStateAsUpdate = (encoder, doc, targetStateVector = new Map()) => {\n writeClientsStructs(encoder, doc.store, targetStateVector);\n writeDeleteSet(encoder, createDeleteSetFromStructStore(doc.store));\n};\n\n/**\n * Write all the document as a single update message that can be applied on the remote document. If you specify the state of the remote client (`targetState`) it will\n * only write the operations that are missing.\n *\n * Use `writeStateAsUpdate` instead if you are working with lib0/encoding.js#Encoder\n *\n * @param {Doc} doc\n * @param {Uint8Array} [encodedTargetStateVector] The state of the target that receives the update. Leave empty to write all known structs\n * @param {UpdateEncoderV1 | UpdateEncoderV2} [encoder]\n * @return {Uint8Array}\n *\n * @function\n */\nconst encodeStateAsUpdateV2 = (doc, encodedTargetStateVector = new Uint8Array([0]), encoder = new UpdateEncoderV2()) => {\n const targetStateVector = decodeStateVector(encodedTargetStateVector);\n writeStateAsUpdate(encoder, doc, targetStateVector);\n const updates = [encoder.toUint8Array()];\n // also add the pending updates (if there are any)\n if (doc.store.pendingDs) {\n updates.push(doc.store.pendingDs);\n }\n if (doc.store.pendingStructs) {\n updates.push(diffUpdateV2(doc.store.pendingStructs.update, encodedTargetStateVector));\n }\n if (updates.length > 1) {\n if (encoder.constructor === UpdateEncoderV1) {\n return mergeUpdates(updates.map((update, i) => i === 0 ? update : convertUpdateFormatV2ToV1(update)))\n } else if (encoder.constructor === UpdateEncoderV2) {\n return mergeUpdatesV2(updates)\n }\n }\n return updates[0]\n};\n\n/**\n * Write all the document as a single update message that can be applied on the remote document. If you specify the state of the remote client (`targetState`) it will\n * only write the operations that are missing.\n *\n * Use `writeStateAsUpdate` instead if you are working with lib0/encoding.js#Encoder\n *\n * @param {Doc} doc\n * @param {Uint8Array} [encodedTargetStateVector] The state of the target that receives the update. Leave empty to write all known structs\n * @return {Uint8Array}\n *\n * @function\n */\nconst encodeStateAsUpdate = (doc, encodedTargetStateVector) => encodeStateAsUpdateV2(doc, encodedTargetStateVector, new UpdateEncoderV1());\n\n/**\n * Read state vector from Decoder and return as Map\n *\n * @param {DSDecoderV1 | DSDecoderV2} decoder\n * @return {Map} Maps `client` to the number next expected `clock` from that client.\n *\n * @function\n */\nconst readStateVector = decoder => {\n const ss = new Map();\n const ssLength = decoding.readVarUint(decoder.restDecoder);\n for (let i = 0; i < ssLength; i++) {\n const client = decoding.readVarUint(decoder.restDecoder);\n const clock = decoding.readVarUint(decoder.restDecoder);\n ss.set(client, clock);\n }\n return ss\n};\n\n/**\n * Read decodedState and return State as Map.\n *\n * @param {Uint8Array} decodedState\n * @return {Map} Maps `client` to the number next expected `clock` from that client.\n *\n * @function\n */\n// export const decodeStateVectorV2 = decodedState => readStateVector(new DSDecoderV2(decoding.createDecoder(decodedState)))\n\n/**\n * Read decodedState and return State as Map.\n *\n * @param {Uint8Array} decodedState\n * @return {Map} Maps `client` to the number next expected `clock` from that client.\n *\n * @function\n */\nconst decodeStateVector = decodedState => readStateVector(new DSDecoderV1(decoding.createDecoder(decodedState)));\n\n/**\n * @param {DSEncoderV1 | DSEncoderV2} encoder\n * @param {Map} sv\n * @function\n */\nconst writeStateVector = (encoder, sv) => {\n encoding.writeVarUint(encoder.restEncoder, sv.size);\n array.from(sv.entries()).sort((a, b) => b[0] - a[0]).forEach(([client, clock]) => {\n encoding.writeVarUint(encoder.restEncoder, client); // @todo use a special client decoder that is based on mapping\n encoding.writeVarUint(encoder.restEncoder, clock);\n });\n return encoder\n};\n\n/**\n * @param {DSEncoderV1 | DSEncoderV2} encoder\n * @param {Doc} doc\n *\n * @function\n */\nconst writeDocumentStateVector = (encoder, doc) => writeStateVector(encoder, getStateVector(doc.store));\n\n/**\n * Encode State as Uint8Array.\n *\n * @param {Doc|Map} doc\n * @param {DSEncoderV1 | DSEncoderV2} [encoder]\n * @return {Uint8Array}\n *\n * @function\n */\nconst encodeStateVectorV2 = (doc, encoder = new DSEncoderV2()) => {\n if (doc instanceof Map) {\n writeStateVector(encoder, doc);\n } else {\n writeDocumentStateVector(encoder, doc);\n }\n return encoder.toUint8Array()\n};\n\n/**\n * Encode State as Uint8Array.\n *\n * @param {Doc|Map} doc\n * @return {Uint8Array}\n *\n * @function\n */\nconst encodeStateVector = doc => encodeStateVectorV2(doc, new DSEncoderV1());\n\n/**\n * General event handler implementation.\n *\n * @template ARG0, ARG1\n *\n * @private\n */\nclass EventHandler {\n constructor () {\n /**\n * @type {Array}\n */\n this.l = [];\n }\n}\n\n/**\n * @template ARG0,ARG1\n * @returns {EventHandler}\n *\n * @private\n * @function\n */\nconst createEventHandler = () => new EventHandler();\n\n/**\n * Adds an event listener that is called when\n * {@link EventHandler#callEventListeners} is called.\n *\n * @template ARG0,ARG1\n * @param {EventHandler} eventHandler\n * @param {function(ARG0,ARG1):void} f The event handler.\n *\n * @private\n * @function\n */\nconst addEventHandlerListener = (eventHandler, f) =>\n eventHandler.l.push(f);\n\n/**\n * Removes an event listener.\n *\n * @template ARG0,ARG1\n * @param {EventHandler} eventHandler\n * @param {function(ARG0,ARG1):void} f The event handler that was added with\n * {@link EventHandler#addEventListener}\n *\n * @private\n * @function\n */\nconst removeEventHandlerListener = (eventHandler, f) => {\n const l = eventHandler.l;\n const len = l.length;\n eventHandler.l = l.filter(g => f !== g);\n if (len === eventHandler.l.length) {\n console.error('[yjs] Tried to remove event handler that doesn\\'t exist.');\n }\n};\n\n/**\n * Call all event listeners that were added via\n * {@link EventHandler#addEventListener}.\n *\n * @template ARG0,ARG1\n * @param {EventHandler} eventHandler\n * @param {ARG0} arg0\n * @param {ARG1} arg1\n *\n * @private\n * @function\n */\nconst callEventHandlerListeners = (eventHandler, arg0, arg1) =>\n f.callAll(eventHandler.l, [arg0, arg1]);\n\nclass ID {\n /**\n * @param {number} client client id\n * @param {number} clock unique per client id, continuous number\n */\n constructor (client, clock) {\n /**\n * Client id\n * @type {number}\n */\n this.client = client;\n /**\n * unique per client id, continuous number\n * @type {number}\n */\n this.clock = clock;\n }\n}\n\n/**\n * @param {ID | null} a\n * @param {ID | null} b\n * @return {boolean}\n *\n * @function\n */\nconst compareIDs = (a, b) => a === b || (a !== null && b !== null && a.client === b.client && a.clock === b.clock);\n\n/**\n * @param {number} client\n * @param {number} clock\n *\n * @private\n * @function\n */\nconst createID = (client, clock) => new ID(client, clock);\n\n/**\n * @param {encoding.Encoder} encoder\n * @param {ID} id\n *\n * @private\n * @function\n */\nconst writeID = (encoder, id) => {\n encoding.writeVarUint(encoder, id.client);\n encoding.writeVarUint(encoder, id.clock);\n};\n\n/**\n * Read ID.\n * * If first varUint read is 0xFFFFFF a RootID is returned.\n * * Otherwise an ID is returned\n *\n * @param {decoding.Decoder} decoder\n * @return {ID}\n *\n * @private\n * @function\n */\nconst readID = decoder =>\n createID(decoding.readVarUint(decoder), decoding.readVarUint(decoder));\n\n/**\n * The top types are mapped from y.share.get(keyname) => type.\n * `type` does not store any information about the `keyname`.\n * This function finds the correct `keyname` for `type` and throws otherwise.\n *\n * @param {AbstractType} type\n * @return {string}\n *\n * @private\n * @function\n */\nconst findRootTypeKey = type => {\n // @ts-ignore _y must be defined, otherwise unexpected case\n for (const [key, value] of type.doc.share.entries()) {\n if (value === type) {\n return key\n }\n }\n throw error.unexpectedCase()\n};\n\n/**\n * Check if `parent` is a parent of `child`.\n *\n * @param {AbstractType} parent\n * @param {Item|null} child\n * @return {Boolean} Whether `parent` is a parent of `child`.\n *\n * @private\n * @function\n */\nconst isParentOf = (parent, child) => {\n while (child !== null) {\n if (child.parent === parent) {\n return true\n }\n child = /** @type {AbstractType} */ (child.parent)._item;\n }\n return false\n};\n\n/**\n * Convenient helper to log type information.\n *\n * Do not use in productive systems as the output can be immense!\n *\n * @param {AbstractType} type\n */\nconst logType = type => {\n const res = [];\n let n = type._start;\n while (n) {\n res.push(n);\n n = n.right;\n }\n console.log('Children: ', res);\n console.log('Children content: ', res.filter(m => !m.deleted).map(m => m.content));\n};\n\nclass PermanentUserData {\n /**\n * @param {Doc} doc\n * @param {YMap} [storeType]\n */\n constructor (doc, storeType = doc.getMap('users')) {\n /**\n * @type {Map}\n */\n const dss = new Map();\n this.yusers = storeType;\n this.doc = doc;\n /**\n * Maps from clientid to userDescription\n *\n * @type {Map}\n */\n this.clients = new Map();\n this.dss = dss;\n /**\n * @param {YMap} user\n * @param {string} userDescription\n */\n const initUser = (user, userDescription) => {\n /**\n * @type {YArray}\n */\n const ds = user.get('ds');\n const ids = user.get('ids');\n const addClientId = /** @param {number} clientid */ clientid => this.clients.set(clientid, userDescription);\n ds.observe(/** @param {YArrayEvent} event */ event => {\n event.changes.added.forEach(item => {\n item.content.getContent().forEach(encodedDs => {\n if (encodedDs instanceof Uint8Array) {\n this.dss.set(userDescription, mergeDeleteSets([this.dss.get(userDescription) || createDeleteSet(), readDeleteSet(new DSDecoderV1(decoding.createDecoder(encodedDs)))]));\n }\n });\n });\n });\n this.dss.set(userDescription, mergeDeleteSets(ds.map(encodedDs => readDeleteSet(new DSDecoderV1(decoding.createDecoder(encodedDs))))));\n ids.observe(/** @param {YArrayEvent} event */ event =>\n event.changes.added.forEach(item => item.content.getContent().forEach(addClientId))\n );\n ids.forEach(addClientId);\n };\n // observe users\n storeType.observe(event => {\n event.keysChanged.forEach(userDescription =>\n initUser(storeType.get(userDescription), userDescription)\n );\n });\n // add intial data\n storeType.forEach(initUser);\n }\n\n /**\n * @param {Doc} doc\n * @param {number} clientid\n * @param {string} userDescription\n * @param {Object} conf\n * @param {function(Transaction, DeleteSet):boolean} [conf.filter]\n */\n setUserMapping (doc, clientid, userDescription, { filter = () => true } = {}) {\n const users = this.yusers;\n let user = users.get(userDescription);\n if (!user) {\n user = new YMap();\n user.set('ids', new YArray());\n user.set('ds', new YArray());\n users.set(userDescription, user);\n }\n user.get('ids').push([clientid]);\n users.observe(_event => {\n setTimeout(() => {\n const userOverwrite = users.get(userDescription);\n if (userOverwrite !== user) {\n // user was overwritten, port all data over to the next user object\n // @todo Experiment with Y.Sets here\n user = userOverwrite;\n // @todo iterate over old type\n this.clients.forEach((_userDescription, clientid) => {\n if (userDescription === _userDescription) {\n user.get('ids').push([clientid]);\n }\n });\n const encoder = new DSEncoderV1();\n const ds = this.dss.get(userDescription);\n if (ds) {\n writeDeleteSet(encoder, ds);\n user.get('ds').push([encoder.toUint8Array()]);\n }\n }\n }, 0);\n });\n doc.on('afterTransaction', /** @param {Transaction} transaction */ transaction => {\n setTimeout(() => {\n const yds = user.get('ds');\n const ds = transaction.deleteSet;\n if (transaction.local && ds.clients.size > 0 && filter(transaction, ds)) {\n const encoder = new DSEncoderV1();\n writeDeleteSet(encoder, ds);\n yds.push([encoder.toUint8Array()]);\n }\n });\n });\n }\n\n /**\n * @param {number} clientid\n * @return {any}\n */\n getUserByClientId (clientid) {\n return this.clients.get(clientid) || null\n }\n\n /**\n * @param {ID} id\n * @return {string | null}\n */\n getUserByDeletedId (id) {\n for (const [userDescription, ds] of this.dss.entries()) {\n if (isDeleted(ds, id)) {\n return userDescription\n }\n }\n return null\n }\n}\n\n/**\n * A relative position is based on the Yjs model and is not affected by document changes.\n * E.g. If you place a relative position before a certain character, it will always point to this character.\n * If you place a relative position at the end of a type, it will always point to the end of the type.\n *\n * A numeric position is often unsuited for user selections, because it does not change when content is inserted\n * before or after.\n *\n * ```Insert(0, 'x')('a|bc') = 'xa|bc'``` Where | is the relative position.\n *\n * One of the properties must be defined.\n *\n * @example\n * // Current cursor position is at position 10\n * const relativePosition = createRelativePositionFromIndex(yText, 10)\n * // modify yText\n * yText.insert(0, 'abc')\n * yText.delete(3, 10)\n * // Compute the cursor position\n * const absolutePosition = createAbsolutePositionFromRelativePosition(y, relativePosition)\n * absolutePosition.type === yText // => true\n * console.log('cursor location is ' + absolutePosition.index) // => cursor location is 3\n *\n */\nclass RelativePosition {\n /**\n * @param {ID|null} type\n * @param {string|null} tname\n * @param {ID|null} item\n * @param {number} assoc\n */\n constructor (type, tname, item, assoc = 0) {\n /**\n * @type {ID|null}\n */\n this.type = type;\n /**\n * @type {string|null}\n */\n this.tname = tname;\n /**\n * @type {ID | null}\n */\n this.item = item;\n /**\n * A relative position is associated to a specific character. By default\n * assoc >= 0, the relative position is associated to the character\n * after the meant position.\n * I.e. position 1 in 'ab' is associated to character 'b'.\n *\n * If assoc < 0, then the relative position is associated to the caharacter\n * before the meant position.\n *\n * @type {number}\n */\n this.assoc = assoc;\n }\n}\n\n/**\n * @param {RelativePosition} rpos\n * @return {any}\n */\nconst relativePositionToJSON = rpos => {\n const json = {};\n if (rpos.type) {\n json.type = rpos.type;\n }\n if (rpos.tname) {\n json.tname = rpos.tname;\n }\n if (rpos.item) {\n json.item = rpos.item;\n }\n if (rpos.assoc != null) {\n json.assoc = rpos.assoc;\n }\n return json\n};\n\n/**\n * @param {any} json\n * @return {RelativePosition}\n *\n * @function\n */\nconst createRelativePositionFromJSON = json => new RelativePosition(json.type == null ? null : createID(json.type.client, json.type.clock), json.tname || null, json.item == null ? null : createID(json.item.client, json.item.clock), json.assoc == null ? 0 : json.assoc);\n\nclass AbsolutePosition {\n /**\n * @param {AbstractType} type\n * @param {number} index\n * @param {number} [assoc]\n */\n constructor (type, index, assoc = 0) {\n /**\n * @type {AbstractType}\n */\n this.type = type;\n /**\n * @type {number}\n */\n this.index = index;\n this.assoc = assoc;\n }\n}\n\n/**\n * @param {AbstractType} type\n * @param {number} index\n * @param {number} [assoc]\n *\n * @function\n */\nconst createAbsolutePosition = (type, index, assoc = 0) => new AbsolutePosition(type, index, assoc);\n\n/**\n * @param {AbstractType} type\n * @param {ID|null} item\n * @param {number} [assoc]\n *\n * @function\n */\nconst createRelativePosition = (type, item, assoc) => {\n let typeid = null;\n let tname = null;\n if (type._item === null) {\n tname = findRootTypeKey(type);\n } else {\n typeid = createID(type._item.id.client, type._item.id.clock);\n }\n return new RelativePosition(typeid, tname, item, assoc)\n};\n\n/**\n * Create a relativePosition based on a absolute position.\n *\n * @param {AbstractType} type The base type (e.g. YText or YArray).\n * @param {number} index The absolute position.\n * @param {number} [assoc]\n * @return {RelativePosition}\n *\n * @function\n */\nconst createRelativePositionFromTypeIndex = (type, index, assoc = 0) => {\n let t = type._start;\n if (assoc < 0) {\n // associated to the left character or the beginning of a type, increment index if possible.\n if (index === 0) {\n return createRelativePosition(type, null, assoc)\n }\n index--;\n }\n while (t !== null) {\n if (!t.deleted && t.countable) {\n if (t.length > index) {\n // case 1: found position somewhere in the linked list\n return createRelativePosition(type, createID(t.id.client, t.id.clock + index), assoc)\n }\n index -= t.length;\n }\n if (t.right === null && assoc < 0) {\n // left-associated position, return last available id\n return createRelativePosition(type, t.lastId, assoc)\n }\n t = t.right;\n }\n return createRelativePosition(type, null, assoc)\n};\n\n/**\n * @param {encoding.Encoder} encoder\n * @param {RelativePosition} rpos\n *\n * @function\n */\nconst writeRelativePosition = (encoder, rpos) => {\n const { type, tname, item, assoc } = rpos;\n if (item !== null) {\n encoding.writeVarUint(encoder, 0);\n writeID(encoder, item);\n } else if (tname !== null) {\n // case 2: found position at the end of the list and type is stored in y.share\n encoding.writeUint8(encoder, 1);\n encoding.writeVarString(encoder, tname);\n } else if (type !== null) {\n // case 3: found position at the end of the list and type is attached to an item\n encoding.writeUint8(encoder, 2);\n writeID(encoder, type);\n } else {\n throw error.unexpectedCase()\n }\n encoding.writeVarInt(encoder, assoc);\n return encoder\n};\n\n/**\n * @param {RelativePosition} rpos\n * @return {Uint8Array}\n */\nconst encodeRelativePosition = rpos => {\n const encoder = encoding.createEncoder();\n writeRelativePosition(encoder, rpos);\n return encoding.toUint8Array(encoder)\n};\n\n/**\n * @param {decoding.Decoder} decoder\n * @return {RelativePosition}\n *\n * @function\n */\nconst readRelativePosition = decoder => {\n let type = null;\n let tname = null;\n let itemID = null;\n switch (decoding.readVarUint(decoder)) {\n case 0:\n // case 1: found position somewhere in the linked list\n itemID = readID(decoder);\n break\n case 1:\n // case 2: found position at the end of the list and type is stored in y.share\n tname = decoding.readVarString(decoder);\n break\n case 2: {\n // case 3: found position at the end of the list and type is attached to an item\n type = readID(decoder);\n }\n }\n const assoc = decoding.hasContent(decoder) ? decoding.readVarInt(decoder) : 0;\n return new RelativePosition(type, tname, itemID, assoc)\n};\n\n/**\n * @param {Uint8Array} uint8Array\n * @return {RelativePosition}\n */\nconst decodeRelativePosition = uint8Array => readRelativePosition(decoding.createDecoder(uint8Array));\n\n/**\n * @param {RelativePosition} rpos\n * @param {Doc} doc\n * @return {AbsolutePosition|null}\n *\n * @function\n */\nconst createAbsolutePositionFromRelativePosition = (rpos, doc) => {\n const store = doc.store;\n const rightID = rpos.item;\n const typeID = rpos.type;\n const tname = rpos.tname;\n const assoc = rpos.assoc;\n let type = null;\n let index = 0;\n if (rightID !== null) {\n if (getState(store, rightID.client) <= rightID.clock) {\n return null\n }\n const res = followRedone(store, rightID);\n const right = res.item;\n if (!(right instanceof Item)) {\n return null\n }\n type = /** @type {AbstractType} */ (right.parent);\n if (type._item === null || !type._item.deleted) {\n index = (right.deleted || !right.countable) ? 0 : (res.diff + (assoc >= 0 ? 0 : 1)); // adjust position based on left association if necessary\n let n = right.left;\n while (n !== null) {\n if (!n.deleted && n.countable) {\n index += n.length;\n }\n n = n.left;\n }\n }\n } else {\n if (tname !== null) {\n type = doc.get(tname);\n } else if (typeID !== null) {\n if (getState(store, typeID.client) <= typeID.clock) {\n // type does not exist yet\n return null\n }\n const { item } = followRedone(store, typeID);\n if (item instanceof Item && item.content instanceof ContentType) {\n type = item.content.type;\n } else {\n // struct is garbage collected\n return null\n }\n } else {\n throw error.unexpectedCase()\n }\n if (assoc >= 0) {\n index = type._length;\n } else {\n index = 0;\n }\n }\n return createAbsolutePosition(type, index, rpos.assoc)\n};\n\n/**\n * @param {RelativePosition|null} a\n * @param {RelativePosition|null} b\n * @return {boolean}\n *\n * @function\n */\nconst compareRelativePositions = (a, b) => a === b || (\n a !== null && b !== null && a.tname === b.tname && compareIDs(a.item, b.item) && compareIDs(a.type, b.type) && a.assoc === b.assoc\n);\n\nclass Snapshot {\n /**\n * @param {DeleteSet} ds\n * @param {Map} sv state map\n */\n constructor (ds, sv) {\n /**\n * @type {DeleteSet}\n */\n this.ds = ds;\n /**\n * State Map\n * @type {Map}\n */\n this.sv = sv;\n }\n}\n\n/**\n * @param {Snapshot} snap1\n * @param {Snapshot} snap2\n * @return {boolean}\n */\nconst equalSnapshots = (snap1, snap2) => {\n const ds1 = snap1.ds.clients;\n const ds2 = snap2.ds.clients;\n const sv1 = snap1.sv;\n const sv2 = snap2.sv;\n if (sv1.size !== sv2.size || ds1.size !== ds2.size) {\n return false\n }\n for (const [key, value] of sv1.entries()) {\n if (sv2.get(key) !== value) {\n return false\n }\n }\n for (const [client, dsitems1] of ds1.entries()) {\n const dsitems2 = ds2.get(client) || [];\n if (dsitems1.length !== dsitems2.length) {\n return false\n }\n for (let i = 0; i < dsitems1.length; i++) {\n const dsitem1 = dsitems1[i];\n const dsitem2 = dsitems2[i];\n if (dsitem1.clock !== dsitem2.clock || dsitem1.len !== dsitem2.len) {\n return false\n }\n }\n }\n return true\n};\n\n/**\n * @param {Snapshot} snapshot\n * @param {DSEncoderV1 | DSEncoderV2} [encoder]\n * @return {Uint8Array}\n */\nconst encodeSnapshotV2 = (snapshot, encoder = new DSEncoderV2()) => {\n writeDeleteSet(encoder, snapshot.ds);\n writeStateVector(encoder, snapshot.sv);\n return encoder.toUint8Array()\n};\n\n/**\n * @param {Snapshot} snapshot\n * @return {Uint8Array}\n */\nconst encodeSnapshot = snapshot => encodeSnapshotV2(snapshot, new DSEncoderV1());\n\n/**\n * @param {Uint8Array} buf\n * @param {DSDecoderV1 | DSDecoderV2} [decoder]\n * @return {Snapshot}\n */\nconst decodeSnapshotV2 = (buf, decoder = new DSDecoderV2(decoding.createDecoder(buf))) => {\n return new Snapshot(readDeleteSet(decoder), readStateVector(decoder))\n};\n\n/**\n * @param {Uint8Array} buf\n * @return {Snapshot}\n */\nconst decodeSnapshot = buf => decodeSnapshotV2(buf, new DSDecoderV1(decoding.createDecoder(buf)));\n\n/**\n * @param {DeleteSet} ds\n * @param {Map} sm\n * @return {Snapshot}\n */\nconst createSnapshot = (ds, sm) => new Snapshot(ds, sm);\n\nconst emptySnapshot = createSnapshot(createDeleteSet(), new Map());\n\n/**\n * @param {Doc} doc\n * @return {Snapshot}\n */\nconst snapshot = doc => createSnapshot(createDeleteSetFromStructStore(doc.store), getStateVector(doc.store));\n\n/**\n * @param {Item} item\n * @param {Snapshot|undefined} snapshot\n *\n * @protected\n * @function\n */\nconst isVisible = (item, snapshot) => snapshot === undefined\n ? !item.deleted\n : snapshot.sv.has(item.id.client) && (snapshot.sv.get(item.id.client) || 0) > item.id.clock && !isDeleted(snapshot.ds, item.id);\n\n/**\n * @param {Transaction} transaction\n * @param {Snapshot} snapshot\n */\nconst splitSnapshotAffectedStructs = (transaction, snapshot) => {\n const meta = map.setIfUndefined(transaction.meta, splitSnapshotAffectedStructs, set.create);\n const store = transaction.doc.store;\n // check if we already split for this snapshot\n if (!meta.has(snapshot)) {\n snapshot.sv.forEach((clock, client) => {\n if (clock < getState(store, client)) {\n getItemCleanStart(transaction, createID(client, clock));\n }\n });\n iterateDeletedStructs(transaction, snapshot.ds, _item => {});\n meta.add(snapshot);\n }\n};\n\n/**\n * @example\n * const ydoc = new Y.Doc({ gc: false })\n * ydoc.getText().insert(0, 'world!')\n * const snapshot = Y.snapshot(ydoc)\n * ydoc.getText().insert(0, 'hello ')\n * const restored = Y.createDocFromSnapshot(ydoc, snapshot)\n * assert(restored.getText().toString() === 'world!')\n *\n * @param {Doc} originDoc\n * @param {Snapshot} snapshot\n * @param {Doc} [newDoc] Optionally, you may define the Yjs document that receives the data from originDoc\n * @return {Doc}\n */\nconst createDocFromSnapshot = (originDoc, snapshot, newDoc = new Doc()) => {\n if (originDoc.gc) {\n // we should not try to restore a GC-ed document, because some of the restored items might have their content deleted\n throw new Error('Garbage-collection must be disabled in `originDoc`!')\n }\n const { sv, ds } = snapshot;\n\n const encoder = new UpdateEncoderV2();\n originDoc.transact(transaction => {\n let size = 0;\n sv.forEach(clock => {\n if (clock > 0) {\n size++;\n }\n });\n encoding.writeVarUint(encoder.restEncoder, size);\n // splitting the structs before writing them to the encoder\n for (const [client, clock] of sv) {\n if (clock === 0) {\n continue\n }\n if (clock < getState(originDoc.store, client)) {\n getItemCleanStart(transaction, createID(client, clock));\n }\n const structs = originDoc.store.clients.get(client) || [];\n const lastStructIndex = findIndexSS(structs, clock - 1);\n // write # encoded structs\n encoding.writeVarUint(encoder.restEncoder, lastStructIndex + 1);\n encoder.writeClient(client);\n // first clock written is 0\n encoding.writeVarUint(encoder.restEncoder, 0);\n for (let i = 0; i <= lastStructIndex; i++) {\n structs[i].write(encoder, 0);\n }\n }\n writeDeleteSet(encoder, ds);\n });\n\n applyUpdateV2(newDoc, encoder.toUint8Array(), 'snapshot');\n return newDoc\n};\n\n/**\n * @param {Snapshot} snapshot\n * @param {Uint8Array} update\n * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder]\n */\nconst snapshotContainsUpdateV2 = (snapshot, update, YDecoder = UpdateDecoderV2) => {\n const updateDecoder = new YDecoder(decoding.createDecoder(update));\n const lazyDecoder = new LazyStructReader(updateDecoder, false);\n for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) {\n if ((snapshot.sv.get(curr.id.client) || 0) < curr.id.clock + curr.length) {\n return false\n }\n }\n const mergedDS = mergeDeleteSets([snapshot.ds, readDeleteSet(updateDecoder)]);\n return equalDeleteSets(snapshot.ds, mergedDS)\n};\n\n/**\n * @param {Snapshot} snapshot\n * @param {Uint8Array} update\n */\nconst snapshotContainsUpdate = (snapshot, update) => snapshotContainsUpdateV2(snapshot, update, UpdateDecoderV1);\n\nclass StructStore {\n constructor () {\n /**\n * @type {Map>}\n */\n this.clients = new Map();\n /**\n * @type {null | { missing: Map, update: Uint8Array }}\n */\n this.pendingStructs = null;\n /**\n * @type {null | Uint8Array}\n */\n this.pendingDs = null;\n }\n}\n\n/**\n * Return the states as a Map.\n * Note that clock refers to the next expected clock id.\n *\n * @param {StructStore} store\n * @return {Map}\n *\n * @public\n * @function\n */\nconst getStateVector = store => {\n const sm = new Map();\n store.clients.forEach((structs, client) => {\n const struct = structs[structs.length - 1];\n sm.set(client, struct.id.clock + struct.length);\n });\n return sm\n};\n\n/**\n * @param {StructStore} store\n * @param {number} client\n * @return {number}\n *\n * @public\n * @function\n */\nconst getState = (store, client) => {\n const structs = store.clients.get(client);\n if (structs === undefined) {\n return 0\n }\n const lastStruct = structs[structs.length - 1];\n return lastStruct.id.clock + lastStruct.length\n};\n\n/**\n * @param {StructStore} store\n * @param {GC|Item} struct\n *\n * @private\n * @function\n */\nconst addStruct = (store, struct) => {\n let structs = store.clients.get(struct.id.client);\n if (structs === undefined) {\n structs = [];\n store.clients.set(struct.id.client, structs);\n } else {\n const lastStruct = structs[structs.length - 1];\n if (lastStruct.id.clock + lastStruct.length !== struct.id.clock) {\n throw error.unexpectedCase()\n }\n }\n structs.push(struct);\n};\n\n/**\n * Perform a binary search on a sorted array\n * @param {Array} structs\n * @param {number} clock\n * @return {number}\n *\n * @private\n * @function\n */\nconst findIndexSS = (structs, clock) => {\n let left = 0;\n let right = structs.length - 1;\n let mid = structs[right];\n let midclock = mid.id.clock;\n if (midclock === clock) {\n return right\n }\n // @todo does it even make sense to pivot the search?\n // If a good split misses, it might actually increase the time to find the correct item.\n // Currently, the only advantage is that search with pivoting might find the item on the first try.\n let midindex = math.floor((clock / (midclock + mid.length - 1)) * right); // pivoting the search\n while (left <= right) {\n mid = structs[midindex];\n midclock = mid.id.clock;\n if (midclock <= clock) {\n if (clock < midclock + mid.length) {\n return midindex\n }\n left = midindex + 1;\n } else {\n right = midindex - 1;\n }\n midindex = math.floor((left + right) / 2);\n }\n // Always check state before looking for a struct in StructStore\n // Therefore the case of not finding a struct is unexpected\n throw error.unexpectedCase()\n};\n\n/**\n * Expects that id is actually in store. This function throws or is an infinite loop otherwise.\n *\n * @param {StructStore} store\n * @param {ID} id\n * @return {GC|Item}\n *\n * @private\n * @function\n */\nconst find = (store, id) => {\n /**\n * @type {Array}\n */\n // @ts-ignore\n const structs = store.clients.get(id.client);\n return structs[findIndexSS(structs, id.clock)]\n};\n\n/**\n * Expects that id is actually in store. This function throws or is an infinite loop otherwise.\n * @private\n * @function\n */\nconst getItem = /** @type {function(StructStore,ID):Item} */ (find);\n\n/**\n * @param {Transaction} transaction\n * @param {Array} structs\n * @param {number} clock\n */\nconst findIndexCleanStart = (transaction, structs, clock) => {\n const index = findIndexSS(structs, clock);\n const struct = structs[index];\n if (struct.id.clock < clock && struct instanceof Item) {\n structs.splice(index + 1, 0, splitItem(transaction, struct, clock - struct.id.clock));\n return index + 1\n }\n return index\n};\n\n/**\n * Expects that id is actually in store. This function throws or is an infinite loop otherwise.\n *\n * @param {Transaction} transaction\n * @param {ID} id\n * @return {Item}\n *\n * @private\n * @function\n */\nconst getItemCleanStart = (transaction, id) => {\n const structs = /** @type {Array} */ (transaction.doc.store.clients.get(id.client));\n return structs[findIndexCleanStart(transaction, structs, id.clock)]\n};\n\n/**\n * Expects that id is actually in store. This function throws or is an infinite loop otherwise.\n *\n * @param {Transaction} transaction\n * @param {StructStore} store\n * @param {ID} id\n * @return {Item}\n *\n * @private\n * @function\n */\nconst getItemCleanEnd = (transaction, store, id) => {\n /**\n * @type {Array}\n */\n // @ts-ignore\n const structs = store.clients.get(id.client);\n const index = findIndexSS(structs, id.clock);\n const struct = structs[index];\n if (id.clock !== struct.id.clock + struct.length - 1 && struct.constructor !== GC) {\n structs.splice(index + 1, 0, splitItem(transaction, struct, id.clock - struct.id.clock + 1));\n }\n return struct\n};\n\n/**\n * Replace `item` with `newitem` in store\n * @param {StructStore} store\n * @param {GC|Item} struct\n * @param {GC|Item} newStruct\n *\n * @private\n * @function\n */\nconst replaceStruct = (store, struct, newStruct) => {\n const structs = /** @type {Array} */ (store.clients.get(struct.id.client));\n structs[findIndexSS(structs, struct.id.clock)] = newStruct;\n};\n\n/**\n * Iterate over a range of structs\n *\n * @param {Transaction} transaction\n * @param {Array} structs\n * @param {number} clockStart Inclusive start\n * @param {number} len\n * @param {function(GC|Item):void} f\n *\n * @function\n */\nconst iterateStructs = (transaction, structs, clockStart, len, f) => {\n if (len === 0) {\n return\n }\n const clockEnd = clockStart + len;\n let index = findIndexCleanStart(transaction, structs, clockStart);\n let struct;\n do {\n struct = structs[index++];\n if (clockEnd < struct.id.clock + struct.length) {\n findIndexCleanStart(transaction, structs, clockEnd);\n }\n f(struct);\n } while (index < structs.length && structs[index].id.clock < clockEnd)\n};\n\n/**\n * A transaction is created for every change on the Yjs model. It is possible\n * to bundle changes on the Yjs model in a single transaction to\n * minimize the number on messages sent and the number of observer calls.\n * If possible the user of this library should bundle as many changes as\n * possible. Here is an example to illustrate the advantages of bundling:\n *\n * @example\n * const map = y.define('map', YMap)\n * // Log content when change is triggered\n * map.observe(() => {\n * console.log('change triggered')\n * })\n * // Each change on the map type triggers a log message:\n * map.set('a', 0) // => \"change triggered\"\n * map.set('b', 0) // => \"change triggered\"\n * // When put in a transaction, it will trigger the log after the transaction:\n * y.transact(() => {\n * map.set('a', 1)\n * map.set('b', 1)\n * }) // => \"change triggered\"\n *\n * @public\n */\nclass Transaction {\n /**\n * @param {Doc} doc\n * @param {any} origin\n * @param {boolean} local\n */\n constructor (doc, origin, local) {\n /**\n * The Yjs instance.\n * @type {Doc}\n */\n this.doc = doc;\n /**\n * Describes the set of deleted items by ids\n * @type {DeleteSet}\n */\n this.deleteSet = new DeleteSet();\n /**\n * Holds the state before the transaction started.\n * @type {Map}\n */\n this.beforeState = getStateVector(doc.store);\n /**\n * Holds the state after the transaction.\n * @type {Map}\n */\n this.afterState = new Map();\n /**\n * All types that were directly modified (property added or child\n * inserted/deleted). New types are not included in this Set.\n * Maps from type to parentSubs (`item.parentSub = null` for YArray)\n * @type {Map>,Set>}\n */\n this.changed = new Map();\n /**\n * Stores the events for the types that observe also child elements.\n * It is mainly used by `observeDeep`.\n * @type {Map>,Array>>}\n */\n this.changedParentTypes = new Map();\n /**\n * @type {Array}\n */\n this._mergeStructs = [];\n /**\n * @type {any}\n */\n this.origin = origin;\n /**\n * Stores meta information on the transaction\n * @type {Map}\n */\n this.meta = new Map();\n /**\n * Whether this change originates from this doc.\n * @type {boolean}\n */\n this.local = local;\n /**\n * @type {Set}\n */\n this.subdocsAdded = new Set();\n /**\n * @type {Set}\n */\n this.subdocsRemoved = new Set();\n /**\n * @type {Set}\n */\n this.subdocsLoaded = new Set();\n /**\n * @type {boolean}\n */\n this._needFormattingCleanup = false;\n }\n}\n\n/**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {Transaction} transaction\n * @return {boolean} Whether data was written.\n */\nconst writeUpdateMessageFromTransaction = (encoder, transaction) => {\n if (transaction.deleteSet.clients.size === 0 && !map.any(transaction.afterState, (clock, client) => transaction.beforeState.get(client) !== clock)) {\n return false\n }\n sortAndMergeDeleteSet(transaction.deleteSet);\n writeStructsFromTransaction(encoder, transaction);\n writeDeleteSet(encoder, transaction.deleteSet);\n return true\n};\n\n/**\n * If `type.parent` was added in current transaction, `type` technically\n * did not change, it was just added and we should not fire events for `type`.\n *\n * @param {Transaction} transaction\n * @param {AbstractType>} type\n * @param {string|null} parentSub\n */\nconst addChangedTypeToTransaction = (transaction, type, parentSub) => {\n const item = type._item;\n if (item === null || (item.id.clock < (transaction.beforeState.get(item.id.client) || 0) && !item.deleted)) {\n map.setIfUndefined(transaction.changed, type, set.create).add(parentSub);\n }\n};\n\n/**\n * @param {Array} structs\n * @param {number} pos\n * @return {number} # of merged structs\n */\nconst tryToMergeWithLefts = (structs, pos) => {\n let right = structs[pos];\n let left = structs[pos - 1];\n let i = pos;\n for (; i > 0; right = left, left = structs[--i - 1]) {\n if (left.deleted === right.deleted && left.constructor === right.constructor) {\n if (left.mergeWith(right)) {\n if (right instanceof Item && right.parentSub !== null && /** @type {AbstractType} */ (right.parent)._map.get(right.parentSub) === right) {\n /** @type {AbstractType} */ (right.parent)._map.set(right.parentSub, /** @type {Item} */ (left));\n }\n continue\n }\n }\n break\n }\n const merged = pos - i;\n if (merged) {\n // remove all merged structs from the array\n structs.splice(pos + 1 - merged, merged);\n }\n return merged\n};\n\n/**\n * @param {DeleteSet} ds\n * @param {StructStore} store\n * @param {function(Item):boolean} gcFilter\n */\nconst tryGcDeleteSet = (ds, store, gcFilter) => {\n for (const [client, deleteItems] of ds.clients.entries()) {\n const structs = /** @type {Array} */ (store.clients.get(client));\n for (let di = deleteItems.length - 1; di >= 0; di--) {\n const deleteItem = deleteItems[di];\n const endDeleteItemClock = deleteItem.clock + deleteItem.len;\n for (\n let si = findIndexSS(structs, deleteItem.clock), struct = structs[si];\n si < structs.length && struct.id.clock < endDeleteItemClock;\n struct = structs[++si]\n ) {\n const struct = structs[si];\n if (deleteItem.clock + deleteItem.len <= struct.id.clock) {\n break\n }\n if (struct instanceof Item && struct.deleted && !struct.keep && gcFilter(struct)) {\n struct.gc(store, false);\n }\n }\n }\n }\n};\n\n/**\n * @param {DeleteSet} ds\n * @param {StructStore} store\n */\nconst tryMergeDeleteSet = (ds, store) => {\n // try to merge deleted / gc'd items\n // merge from right to left for better efficiecy and so we don't miss any merge targets\n ds.clients.forEach((deleteItems, client) => {\n const structs = /** @type {Array} */ (store.clients.get(client));\n for (let di = deleteItems.length - 1; di >= 0; di--) {\n const deleteItem = deleteItems[di];\n // start with merging the item next to the last deleted item\n const mostRightIndexToCheck = math.min(structs.length - 1, 1 + findIndexSS(structs, deleteItem.clock + deleteItem.len - 1));\n for (\n let si = mostRightIndexToCheck, struct = structs[si];\n si > 0 && struct.id.clock >= deleteItem.clock;\n struct = structs[si]\n ) {\n si -= 1 + tryToMergeWithLefts(structs, si);\n }\n }\n });\n};\n\n/**\n * @param {DeleteSet} ds\n * @param {StructStore} store\n * @param {function(Item):boolean} gcFilter\n */\nconst tryGc = (ds, store, gcFilter) => {\n tryGcDeleteSet(ds, store, gcFilter);\n tryMergeDeleteSet(ds, store);\n};\n\n/**\n * @param {Array} transactionCleanups\n * @param {number} i\n */\nconst cleanupTransactions = (transactionCleanups, i) => {\n if (i < transactionCleanups.length) {\n const transaction = transactionCleanups[i];\n const doc = transaction.doc;\n const store = doc.store;\n const ds = transaction.deleteSet;\n const mergeStructs = transaction._mergeStructs;\n try {\n sortAndMergeDeleteSet(ds);\n transaction.afterState = getStateVector(transaction.doc.store);\n doc.emit('beforeObserverCalls', [transaction, doc]);\n /**\n * An array of event callbacks.\n *\n * Each callback is called even if the other ones throw errors.\n *\n * @type {Array}\n */\n const fs = [];\n // observe events on changed types\n transaction.changed.forEach((subs, itemtype) =>\n fs.push(() => {\n if (itemtype._item === null || !itemtype._item.deleted) {\n itemtype._callObserver(transaction, subs);\n }\n })\n );\n fs.push(() => {\n // deep observe events\n transaction.changedParentTypes.forEach((events, type) => {\n // We need to think about the possibility that the user transforms the\n // Y.Doc in the event.\n if (type._dEH.l.length > 0 && (type._item === null || !type._item.deleted)) {\n events = events\n .filter(event =>\n event.target._item === null || !event.target._item.deleted\n );\n events\n .forEach(event => {\n event.currentTarget = type;\n // path is relative to the current target\n event._path = null;\n });\n // sort events by path length so that top-level events are fired first.\n events\n .sort((event1, event2) => event1.path.length - event2.path.length);\n // We don't need to check for events.length\n // because we know it has at least one element\n callEventHandlerListeners(type._dEH, events, transaction);\n }\n });\n });\n fs.push(() => doc.emit('afterTransaction', [transaction, doc]));\n callAll(fs, []);\n if (transaction._needFormattingCleanup) {\n cleanupYTextAfterTransaction(transaction);\n }\n } finally {\n // Replace deleted items with ItemDeleted / GC.\n // This is where content is actually remove from the Yjs Doc.\n if (doc.gc) {\n tryGcDeleteSet(ds, store, doc.gcFilter);\n }\n tryMergeDeleteSet(ds, store);\n\n // on all affected store.clients props, try to merge\n transaction.afterState.forEach((clock, client) => {\n const beforeClock = transaction.beforeState.get(client) || 0;\n if (beforeClock !== clock) {\n const structs = /** @type {Array} */ (store.clients.get(client));\n // we iterate from right to left so we can safely remove entries\n const firstChangePos = math.max(findIndexSS(structs, beforeClock), 1);\n for (let i = structs.length - 1; i >= firstChangePos;) {\n i -= 1 + tryToMergeWithLefts(structs, i);\n }\n }\n });\n // try to merge mergeStructs\n // @todo: it makes more sense to transform mergeStructs to a DS, sort it, and merge from right to left\n // but at the moment DS does not handle duplicates\n for (let i = mergeStructs.length - 1; i >= 0; i--) {\n const { client, clock } = mergeStructs[i].id;\n const structs = /** @type {Array} */ (store.clients.get(client));\n const replacedStructPos = findIndexSS(structs, clock);\n if (replacedStructPos + 1 < structs.length) {\n if (tryToMergeWithLefts(structs, replacedStructPos + 1) > 1) {\n continue // no need to perform next check, both are already merged\n }\n }\n if (replacedStructPos > 0) {\n tryToMergeWithLefts(structs, replacedStructPos);\n }\n }\n if (!transaction.local && transaction.afterState.get(doc.clientID) !== transaction.beforeState.get(doc.clientID)) {\n logging.print(logging.ORANGE, logging.BOLD, '[yjs] ', logging.UNBOLD, logging.RED, 'Changed the client-id because another client seems to be using it.');\n doc.clientID = generateNewClientId();\n }\n // @todo Merge all the transactions into one and provide send the data as a single update message\n doc.emit('afterTransactionCleanup', [transaction, doc]);\n if (doc._observers.has('update')) {\n const encoder = new UpdateEncoderV1();\n const hasContent = writeUpdateMessageFromTransaction(encoder, transaction);\n if (hasContent) {\n doc.emit('update', [encoder.toUint8Array(), transaction.origin, doc, transaction]);\n }\n }\n if (doc._observers.has('updateV2')) {\n const encoder = new UpdateEncoderV2();\n const hasContent = writeUpdateMessageFromTransaction(encoder, transaction);\n if (hasContent) {\n doc.emit('updateV2', [encoder.toUint8Array(), transaction.origin, doc, transaction]);\n }\n }\n const { subdocsAdded, subdocsLoaded, subdocsRemoved } = transaction;\n if (subdocsAdded.size > 0 || subdocsRemoved.size > 0 || subdocsLoaded.size > 0) {\n subdocsAdded.forEach(subdoc => {\n subdoc.clientID = doc.clientID;\n if (subdoc.collectionid == null) {\n subdoc.collectionid = doc.collectionid;\n }\n doc.subdocs.add(subdoc);\n });\n subdocsRemoved.forEach(subdoc => doc.subdocs.delete(subdoc));\n doc.emit('subdocs', [{ loaded: subdocsLoaded, added: subdocsAdded, removed: subdocsRemoved }, doc, transaction]);\n subdocsRemoved.forEach(subdoc => subdoc.destroy());\n }\n\n if (transactionCleanups.length <= i + 1) {\n doc._transactionCleanups = [];\n doc.emit('afterAllTransactions', [doc, transactionCleanups]);\n } else {\n cleanupTransactions(transactionCleanups, i + 1);\n }\n }\n }\n};\n\n/**\n * Implements the functionality of `y.transact(()=>{..})`\n *\n * @template T\n * @param {Doc} doc\n * @param {function(Transaction):T} f\n * @param {any} [origin=true]\n * @return {T}\n *\n * @function\n */\nconst transact = (doc, f, origin = null, local = true) => {\n const transactionCleanups = doc._transactionCleanups;\n let initialCall = false;\n /**\n * @type {any}\n */\n let result = null;\n if (doc._transaction === null) {\n initialCall = true;\n doc._transaction = new Transaction(doc, origin, local);\n transactionCleanups.push(doc._transaction);\n if (transactionCleanups.length === 1) {\n doc.emit('beforeAllTransactions', [doc]);\n }\n doc.emit('beforeTransaction', [doc._transaction, doc]);\n }\n try {\n result = f(doc._transaction);\n } finally {\n if (initialCall) {\n const finishCleanup = doc._transaction === transactionCleanups[0];\n doc._transaction = null;\n if (finishCleanup) {\n // The first transaction ended, now process observer calls.\n // Observer call may create new transactions for which we need to call the observers and do cleanup.\n // We don't want to nest these calls, so we execute these calls one after\n // another.\n // Also we need to ensure that all cleanups are called, even if the\n // observes throw errors.\n // This file is full of hacky try {} finally {} blocks to ensure that an\n // event can throw errors and also that the cleanup is called.\n cleanupTransactions(transactionCleanups, 0);\n }\n }\n }\n return result\n};\n\nclass StackItem {\n /**\n * @param {DeleteSet} deletions\n * @param {DeleteSet} insertions\n */\n constructor (deletions, insertions) {\n this.insertions = insertions;\n this.deletions = deletions;\n /**\n * Use this to save and restore metadata like selection range\n */\n this.meta = new Map();\n }\n}\n/**\n * @param {Transaction} tr\n * @param {UndoManager} um\n * @param {StackItem} stackItem\n */\nconst clearUndoManagerStackItem = (tr, um, stackItem) => {\n iterateDeletedStructs(tr, stackItem.deletions, item => {\n if (item instanceof Item && um.scope.some(type => isParentOf(type, item))) {\n keepItem(item, false);\n }\n });\n};\n\n/**\n * @param {UndoManager} undoManager\n * @param {Array} stack\n * @param {string} eventType\n * @return {StackItem?}\n */\nconst popStackItem = (undoManager, stack, eventType) => {\n /**\n * Whether a change happened\n * @type {StackItem?}\n */\n let result = null;\n /**\n * Keep a reference to the transaction so we can fire the event with the changedParentTypes\n * @type {any}\n */\n let _tr = null;\n const doc = undoManager.doc;\n const scope = undoManager.scope;\n transact(doc, transaction => {\n while (stack.length > 0 && result === null) {\n const store = doc.store;\n const stackItem = /** @type {StackItem} */ (stack.pop());\n /**\n * @type {Set}\n */\n const itemsToRedo = new Set();\n /**\n * @type {Array}\n */\n const itemsToDelete = [];\n let performedChange = false;\n iterateDeletedStructs(transaction, stackItem.insertions, struct => {\n if (struct instanceof Item) {\n if (struct.redone !== null) {\n let { item, diff } = followRedone(store, struct.id);\n if (diff > 0) {\n item = getItemCleanStart(transaction, createID(item.id.client, item.id.clock + diff));\n }\n struct = item;\n }\n if (!struct.deleted && scope.some(type => isParentOf(type, /** @type {Item} */ (struct)))) {\n itemsToDelete.push(struct);\n }\n }\n });\n iterateDeletedStructs(transaction, stackItem.deletions, struct => {\n if (\n struct instanceof Item &&\n scope.some(type => isParentOf(type, struct)) &&\n // Never redo structs in stackItem.insertions because they were created and deleted in the same capture interval.\n !isDeleted(stackItem.insertions, struct.id)\n ) {\n itemsToRedo.add(struct);\n }\n });\n itemsToRedo.forEach(struct => {\n performedChange = redoItem(transaction, struct, itemsToRedo, stackItem.insertions, undoManager.ignoreRemoteMapChanges, undoManager) !== null || performedChange;\n });\n // We want to delete in reverse order so that children are deleted before\n // parents, so we have more information available when items are filtered.\n for (let i = itemsToDelete.length - 1; i >= 0; i--) {\n const item = itemsToDelete[i];\n if (undoManager.deleteFilter(item)) {\n item.delete(transaction);\n performedChange = true;\n }\n }\n result = performedChange ? stackItem : null;\n }\n transaction.changed.forEach((subProps, type) => {\n // destroy search marker if necessary\n if (subProps.has(null) && type._searchMarker) {\n type._searchMarker.length = 0;\n }\n });\n _tr = transaction;\n }, undoManager);\n if (result != null) {\n const changedParentTypes = _tr.changedParentTypes;\n undoManager.emit('stack-item-popped', [{ stackItem: result, type: eventType, changedParentTypes }, undoManager]);\n }\n return result\n};\n\n/**\n * @typedef {Object} UndoManagerOptions\n * @property {number} [UndoManagerOptions.captureTimeout=500]\n * @property {function(Transaction):boolean} [UndoManagerOptions.captureTransaction] Do not capture changes of a Transaction if result false.\n * @property {function(Item):boolean} [UndoManagerOptions.deleteFilter=()=>true] Sometimes\n * it is necessary to filter what an Undo/Redo operation can delete. If this\n * filter returns false, the type/item won't be deleted even it is in the\n * undo/redo scope.\n * @property {Set} [UndoManagerOptions.trackedOrigins=new Set([null])]\n * @property {boolean} [ignoreRemoteMapChanges] Experimental. By default, the UndoManager will never overwrite remote changes. Enable this property to enable overwriting remote changes on key-value changes (Y.Map, properties on Y.Xml, etc..).\n * @property {Doc} [doc] The document that this UndoManager operates on. Only needed if typeScope is empty.\n */\n\n/**\n * Fires 'stack-item-added' event when a stack item was added to either the undo- or\n * the redo-stack. You may store additional stack information via the\n * metadata property on `event.stackItem.meta` (it is a `Map` of metadata properties).\n * Fires 'stack-item-popped' event when a stack item was popped from either the\n * undo- or the redo-stack. You may restore the saved stack information from `event.stackItem.meta`.\n *\n * @extends {Observable<'stack-item-added'|'stack-item-popped'|'stack-cleared'|'stack-item-updated'>}\n */\nclass UndoManager extends Observable {\n /**\n * @param {AbstractType|Array>} typeScope Accepts either a single type, or an array of types\n * @param {UndoManagerOptions} options\n */\n constructor (typeScope, {\n captureTimeout = 500,\n captureTransaction = _tr => true,\n deleteFilter = () => true,\n trackedOrigins = new Set([null]),\n ignoreRemoteMapChanges = false,\n doc = /** @type {Doc} */ (array.isArray(typeScope) ? typeScope[0].doc : typeScope.doc)\n } = {}) {\n super();\n /**\n * @type {Array>}\n */\n this.scope = [];\n this.addToScope(typeScope);\n this.deleteFilter = deleteFilter;\n trackedOrigins.add(this);\n this.trackedOrigins = trackedOrigins;\n this.captureTransaction = captureTransaction;\n /**\n * @type {Array}\n */\n this.undoStack = [];\n /**\n * @type {Array}\n */\n this.redoStack = [];\n /**\n * Whether the client is currently undoing (calling UndoManager.undo)\n *\n * @type {boolean}\n */\n this.undoing = false;\n this.redoing = false;\n this.doc = doc;\n this.lastChange = 0;\n this.ignoreRemoteMapChanges = ignoreRemoteMapChanges;\n this.captureTimeout = captureTimeout;\n /**\n * @param {Transaction} transaction\n */\n this.afterTransactionHandler = transaction => {\n // Only track certain transactions\n if (\n !this.captureTransaction(transaction) ||\n !this.scope.some(type => transaction.changedParentTypes.has(type)) ||\n (!this.trackedOrigins.has(transaction.origin) && (!transaction.origin || !this.trackedOrigins.has(transaction.origin.constructor)))\n ) {\n return\n }\n const undoing = this.undoing;\n const redoing = this.redoing;\n const stack = undoing ? this.redoStack : this.undoStack;\n if (undoing) {\n this.stopCapturing(); // next undo should not be appended to last stack item\n } else if (!redoing) {\n // neither undoing nor redoing: delete redoStack\n this.clear(false, true);\n }\n const insertions = new DeleteSet();\n transaction.afterState.forEach((endClock, client) => {\n const startClock = transaction.beforeState.get(client) || 0;\n const len = endClock - startClock;\n if (len > 0) {\n addToDeleteSet(insertions, client, startClock, len);\n }\n });\n const now = time.getUnixTime();\n let didAdd = false;\n if (this.lastChange > 0 && now - this.lastChange < this.captureTimeout && stack.length > 0 && !undoing && !redoing) {\n // append change to last stack op\n const lastOp = stack[stack.length - 1];\n lastOp.deletions = mergeDeleteSets([lastOp.deletions, transaction.deleteSet]);\n lastOp.insertions = mergeDeleteSets([lastOp.insertions, insertions]);\n } else {\n // create a new stack op\n stack.push(new StackItem(transaction.deleteSet, insertions));\n didAdd = true;\n }\n if (!undoing && !redoing) {\n this.lastChange = now;\n }\n // make sure that deleted structs are not gc'd\n iterateDeletedStructs(transaction, transaction.deleteSet, /** @param {Item|GC} item */ item => {\n if (item instanceof Item && this.scope.some(type => isParentOf(type, item))) {\n keepItem(item, true);\n }\n });\n const changeEvent = [{ stackItem: stack[stack.length - 1], origin: transaction.origin, type: undoing ? 'redo' : 'undo', changedParentTypes: transaction.changedParentTypes }, this];\n if (didAdd) {\n this.emit('stack-item-added', changeEvent);\n } else {\n this.emit('stack-item-updated', changeEvent);\n }\n };\n this.doc.on('afterTransaction', this.afterTransactionHandler);\n this.doc.on('destroy', () => {\n this.destroy();\n });\n }\n\n /**\n * @param {Array> | AbstractType} ytypes\n */\n addToScope (ytypes) {\n ytypes = array.isArray(ytypes) ? ytypes : [ytypes];\n ytypes.forEach(ytype => {\n if (this.scope.every(yt => yt !== ytype)) {\n this.scope.push(ytype);\n }\n });\n }\n\n /**\n * @param {any} origin\n */\n addTrackedOrigin (origin) {\n this.trackedOrigins.add(origin);\n }\n\n /**\n * @param {any} origin\n */\n removeTrackedOrigin (origin) {\n this.trackedOrigins.delete(origin);\n }\n\n clear (clearUndoStack = true, clearRedoStack = true) {\n if ((clearUndoStack && this.canUndo()) || (clearRedoStack && this.canRedo())) {\n this.doc.transact(tr => {\n if (clearUndoStack) {\n this.undoStack.forEach(item => clearUndoManagerStackItem(tr, this, item));\n this.undoStack = [];\n }\n if (clearRedoStack) {\n this.redoStack.forEach(item => clearUndoManagerStackItem(tr, this, item));\n this.redoStack = [];\n }\n this.emit('stack-cleared', [{ undoStackCleared: clearUndoStack, redoStackCleared: clearRedoStack }]);\n });\n }\n }\n\n /**\n * UndoManager merges Undo-StackItem if they are created within time-gap\n * smaller than `options.captureTimeout`. Call `um.stopCapturing()` so that the next\n * StackItem won't be merged.\n *\n *\n * @example\n * // without stopCapturing\n * ytext.insert(0, 'a')\n * ytext.insert(1, 'b')\n * um.undo()\n * ytext.toString() // => '' (note that 'ab' was removed)\n * // with stopCapturing\n * ytext.insert(0, 'a')\n * um.stopCapturing()\n * ytext.insert(0, 'b')\n * um.undo()\n * ytext.toString() // => 'a' (note that only 'b' was removed)\n *\n */\n stopCapturing () {\n this.lastChange = 0;\n }\n\n /**\n * Undo last changes on type.\n *\n * @return {StackItem?} Returns StackItem if a change was applied\n */\n undo () {\n this.undoing = true;\n let res;\n try {\n res = popStackItem(this, this.undoStack, 'undo');\n } finally {\n this.undoing = false;\n }\n return res\n }\n\n /**\n * Redo last undo operation.\n *\n * @return {StackItem?} Returns StackItem if a change was applied\n */\n redo () {\n this.redoing = true;\n let res;\n try {\n res = popStackItem(this, this.redoStack, 'redo');\n } finally {\n this.redoing = false;\n }\n return res\n }\n\n /**\n * Are undo steps available?\n *\n * @return {boolean} `true` if undo is possible\n */\n canUndo () {\n return this.undoStack.length > 0\n }\n\n /**\n * Are redo steps available?\n *\n * @return {boolean} `true` if redo is possible\n */\n canRedo () {\n return this.redoStack.length > 0\n }\n\n destroy () {\n this.trackedOrigins.delete(this);\n this.doc.off('afterTransaction', this.afterTransactionHandler);\n super.destroy();\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n */\nfunction * lazyStructReaderGenerator (decoder) {\n const numOfStateUpdates = decoding.readVarUint(decoder.restDecoder);\n for (let i = 0; i < numOfStateUpdates; i++) {\n const numberOfStructs = decoding.readVarUint(decoder.restDecoder);\n const client = decoder.readClient();\n let clock = decoding.readVarUint(decoder.restDecoder);\n for (let i = 0; i < numberOfStructs; i++) {\n const info = decoder.readInfo();\n // @todo use switch instead of ifs\n if (info === 10) {\n const len = decoding.readVarUint(decoder.restDecoder);\n yield new Skip(createID(client, clock), len);\n clock += len;\n } else if ((binary.BITS5 & info) !== 0) {\n const cantCopyParentInfo = (info & (binary.BIT7 | binary.BIT8)) === 0;\n // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y`\n // and we read the next string as parentYKey.\n // It indicates how we store/retrieve parent from `y.share`\n // @type {string|null}\n const struct = new Item(\n createID(client, clock),\n null, // left\n (info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null, // origin\n null, // right\n (info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null, // right origin\n // @ts-ignore Force writing a string here.\n cantCopyParentInfo ? (decoder.readParentInfo() ? decoder.readString() : decoder.readLeftID()) : null, // parent\n cantCopyParentInfo && (info & binary.BIT6) === binary.BIT6 ? decoder.readString() : null, // parentSub\n readItemContent(decoder, info) // item content\n );\n yield struct;\n clock += struct.length;\n } else {\n const len = decoder.readLen();\n yield new GC(createID(client, clock), len);\n clock += len;\n }\n }\n }\n}\n\nclass LazyStructReader {\n /**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @param {boolean} filterSkips\n */\n constructor (decoder, filterSkips) {\n this.gen = lazyStructReaderGenerator(decoder);\n /**\n * @type {null | Item | Skip | GC}\n */\n this.curr = null;\n this.done = false;\n this.filterSkips = filterSkips;\n this.next();\n }\n\n /**\n * @return {Item | GC | Skip |null}\n */\n next () {\n // ignore \"Skip\" structs\n do {\n this.curr = this.gen.next().value || null;\n } while (this.filterSkips && this.curr !== null && this.curr.constructor === Skip)\n return this.curr\n }\n}\n\n/**\n * @param {Uint8Array} update\n *\n */\nconst logUpdate = update => logUpdateV2(update, UpdateDecoderV1);\n\n/**\n * @param {Uint8Array} update\n * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder]\n *\n */\nconst logUpdateV2 = (update, YDecoder = UpdateDecoderV2) => {\n const structs = [];\n const updateDecoder = new YDecoder(decoding.createDecoder(update));\n const lazyDecoder = new LazyStructReader(updateDecoder, false);\n for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) {\n structs.push(curr);\n }\n logging.print('Structs: ', structs);\n const ds = readDeleteSet(updateDecoder);\n logging.print('DeleteSet: ', ds);\n};\n\n/**\n * @param {Uint8Array} update\n *\n */\nconst decodeUpdate = (update) => decodeUpdateV2(update, UpdateDecoderV1);\n\n/**\n * @param {Uint8Array} update\n * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder]\n *\n */\nconst decodeUpdateV2 = (update, YDecoder = UpdateDecoderV2) => {\n const structs = [];\n const updateDecoder = new YDecoder(decoding.createDecoder(update));\n const lazyDecoder = new LazyStructReader(updateDecoder, false);\n for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) {\n structs.push(curr);\n }\n return {\n structs,\n ds: readDeleteSet(updateDecoder)\n }\n};\n\nclass LazyStructWriter {\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n */\n constructor (encoder) {\n this.currClient = 0;\n this.startClock = 0;\n this.written = 0;\n this.encoder = encoder;\n /**\n * We want to write operations lazily, but also we need to know beforehand how many operations we want to write for each client.\n *\n * This kind of meta-information (#clients, #structs-per-client-written) is written to the restEncoder.\n *\n * We fragment the restEncoder and store a slice of it per-client until we know how many clients there are.\n * When we flush (toUint8Array) we write the restEncoder using the fragments and the meta-information.\n *\n * @type {Array<{ written: number, restEncoder: Uint8Array }>}\n */\n this.clientStructs = [];\n }\n}\n\n/**\n * @param {Array} updates\n * @return {Uint8Array}\n */\nconst mergeUpdates = updates => mergeUpdatesV2(updates, UpdateDecoderV1, UpdateEncoderV1);\n\n/**\n * @param {Uint8Array} update\n * @param {typeof DSEncoderV1 | typeof DSEncoderV2} YEncoder\n * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} YDecoder\n * @return {Uint8Array}\n */\nconst encodeStateVectorFromUpdateV2 = (update, YEncoder = DSEncoderV2, YDecoder = UpdateDecoderV2) => {\n const encoder = new YEncoder();\n const updateDecoder = new LazyStructReader(new YDecoder(decoding.createDecoder(update)), false);\n let curr = updateDecoder.curr;\n if (curr !== null) {\n let size = 0;\n let currClient = curr.id.client;\n let stopCounting = curr.id.clock !== 0; // must start at 0\n let currClock = stopCounting ? 0 : curr.id.clock + curr.length;\n for (; curr !== null; curr = updateDecoder.next()) {\n if (currClient !== curr.id.client) {\n if (currClock !== 0) {\n size++;\n // We found a new client\n // write what we have to the encoder\n encoding.writeVarUint(encoder.restEncoder, currClient);\n encoding.writeVarUint(encoder.restEncoder, currClock);\n }\n currClient = curr.id.client;\n currClock = 0;\n stopCounting = curr.id.clock !== 0;\n }\n // we ignore skips\n if (curr.constructor === Skip) {\n stopCounting = true;\n }\n if (!stopCounting) {\n currClock = curr.id.clock + curr.length;\n }\n }\n // write what we have\n if (currClock !== 0) {\n size++;\n encoding.writeVarUint(encoder.restEncoder, currClient);\n encoding.writeVarUint(encoder.restEncoder, currClock);\n }\n // prepend the size of the state vector\n const enc = encoding.createEncoder();\n encoding.writeVarUint(enc, size);\n encoding.writeBinaryEncoder(enc, encoder.restEncoder);\n encoder.restEncoder = enc;\n return encoder.toUint8Array()\n } else {\n encoding.writeVarUint(encoder.restEncoder, 0);\n return encoder.toUint8Array()\n }\n};\n\n/**\n * @param {Uint8Array} update\n * @return {Uint8Array}\n */\nconst encodeStateVectorFromUpdate = update => encodeStateVectorFromUpdateV2(update, DSEncoderV1, UpdateDecoderV1);\n\n/**\n * @param {Uint8Array} update\n * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} YDecoder\n * @return {{ from: Map, to: Map }}\n */\nconst parseUpdateMetaV2 = (update, YDecoder = UpdateDecoderV2) => {\n /**\n * @type {Map}\n */\n const from = new Map();\n /**\n * @type {Map}\n */\n const to = new Map();\n const updateDecoder = new LazyStructReader(new YDecoder(decoding.createDecoder(update)), false);\n let curr = updateDecoder.curr;\n if (curr !== null) {\n let currClient = curr.id.client;\n let currClock = curr.id.clock;\n // write the beginning to `from`\n from.set(currClient, currClock);\n for (; curr !== null; curr = updateDecoder.next()) {\n if (currClient !== curr.id.client) {\n // We found a new client\n // write the end to `to`\n to.set(currClient, currClock);\n // write the beginning to `from`\n from.set(curr.id.client, curr.id.clock);\n // update currClient\n currClient = curr.id.client;\n }\n currClock = curr.id.clock + curr.length;\n }\n // write the end to `to`\n to.set(currClient, currClock);\n }\n return { from, to }\n};\n\n/**\n * @param {Uint8Array} update\n * @return {{ from: Map, to: Map }}\n */\nconst parseUpdateMeta = update => parseUpdateMetaV2(update, UpdateDecoderV1);\n\n/**\n * This method is intended to slice any kind of struct and retrieve the right part.\n * It does not handle side-effects, so it should only be used by the lazy-encoder.\n *\n * @param {Item | GC | Skip} left\n * @param {number} diff\n * @return {Item | GC}\n */\nconst sliceStruct = (left, diff) => {\n if (left.constructor === GC) {\n const { client, clock } = left.id;\n return new GC(createID(client, clock + diff), left.length - diff)\n } else if (left.constructor === Skip) {\n const { client, clock } = left.id;\n return new Skip(createID(client, clock + diff), left.length - diff)\n } else {\n const leftItem = /** @type {Item} */ (left);\n const { client, clock } = leftItem.id;\n return new Item(\n createID(client, clock + diff),\n null,\n createID(client, clock + diff - 1),\n null,\n leftItem.rightOrigin,\n leftItem.parent,\n leftItem.parentSub,\n leftItem.content.splice(diff)\n )\n }\n};\n\n/**\n *\n * This function works similarly to `readUpdateV2`.\n *\n * @param {Array} updates\n * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder]\n * @param {typeof UpdateEncoderV1 | typeof UpdateEncoderV2} [YEncoder]\n * @return {Uint8Array}\n */\nconst mergeUpdatesV2 = (updates, YDecoder = UpdateDecoderV2, YEncoder = UpdateEncoderV2) => {\n if (updates.length === 1) {\n return updates[0]\n }\n const updateDecoders = updates.map(update => new YDecoder(decoding.createDecoder(update)));\n let lazyStructDecoders = updateDecoders.map(decoder => new LazyStructReader(decoder, true));\n\n /**\n * @todo we don't need offset because we always slice before\n * @type {null | { struct: Item | GC | Skip, offset: number }}\n */\n let currWrite = null;\n\n const updateEncoder = new YEncoder();\n // write structs lazily\n const lazyStructEncoder = new LazyStructWriter(updateEncoder);\n\n // Note: We need to ensure that all lazyStructDecoders are fully consumed\n // Note: Should merge document updates whenever possible - even from different updates\n // Note: Should handle that some operations cannot be applied yet ()\n\n while (true) {\n // Write higher clients first ⇒ sort by clientID & clock and remove decoders without content\n lazyStructDecoders = lazyStructDecoders.filter(dec => dec.curr !== null);\n lazyStructDecoders.sort(\n /** @type {function(any,any):number} */ (dec1, dec2) => {\n if (dec1.curr.id.client === dec2.curr.id.client) {\n const clockDiff = dec1.curr.id.clock - dec2.curr.id.clock;\n if (clockDiff === 0) {\n // @todo remove references to skip since the structDecoders must filter Skips.\n return dec1.curr.constructor === dec2.curr.constructor\n ? 0\n : dec1.curr.constructor === Skip ? 1 : -1 // we are filtering skips anyway.\n } else {\n return clockDiff\n }\n } else {\n return dec2.curr.id.client - dec1.curr.id.client\n }\n }\n );\n if (lazyStructDecoders.length === 0) {\n break\n }\n const currDecoder = lazyStructDecoders[0];\n // write from currDecoder until the next operation is from another client or if filler-struct\n // then we need to reorder the decoders and find the next operation to write\n const firstClient = /** @type {Item | GC} */ (currDecoder.curr).id.client;\n\n if (currWrite !== null) {\n let curr = /** @type {Item | GC | null} */ (currDecoder.curr);\n let iterated = false;\n\n // iterate until we find something that we haven't written already\n // remember: first the high client-ids are written\n while (curr !== null && curr.id.clock + curr.length <= currWrite.struct.id.clock + currWrite.struct.length && curr.id.client >= currWrite.struct.id.client) {\n curr = currDecoder.next();\n iterated = true;\n }\n if (\n curr === null || // current decoder is empty\n curr.id.client !== firstClient || // check whether there is another decoder that has has updates from `firstClient`\n (iterated && curr.id.clock > currWrite.struct.id.clock + currWrite.struct.length) // the above while loop was used and we are potentially missing updates\n ) {\n continue\n }\n\n if (firstClient !== currWrite.struct.id.client) {\n writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset);\n currWrite = { struct: curr, offset: 0 };\n currDecoder.next();\n } else {\n if (currWrite.struct.id.clock + currWrite.struct.length < curr.id.clock) {\n // @todo write currStruct & set currStruct = Skip(clock = currStruct.id.clock + currStruct.length, length = curr.id.clock - self.clock)\n if (currWrite.struct.constructor === Skip) {\n // extend existing skip\n currWrite.struct.length = curr.id.clock + curr.length - currWrite.struct.id.clock;\n } else {\n writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset);\n const diff = curr.id.clock - currWrite.struct.id.clock - currWrite.struct.length;\n /**\n * @type {Skip}\n */\n const struct = new Skip(createID(firstClient, currWrite.struct.id.clock + currWrite.struct.length), diff);\n currWrite = { struct, offset: 0 };\n }\n } else { // if (currWrite.struct.id.clock + currWrite.struct.length >= curr.id.clock) {\n const diff = currWrite.struct.id.clock + currWrite.struct.length - curr.id.clock;\n if (diff > 0) {\n if (currWrite.struct.constructor === Skip) {\n // prefer to slice Skip because the other struct might contain more information\n currWrite.struct.length -= diff;\n } else {\n curr = sliceStruct(curr, diff);\n }\n }\n if (!currWrite.struct.mergeWith(/** @type {any} */ (curr))) {\n writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset);\n currWrite = { struct: curr, offset: 0 };\n currDecoder.next();\n }\n }\n }\n } else {\n currWrite = { struct: /** @type {Item | GC} */ (currDecoder.curr), offset: 0 };\n currDecoder.next();\n }\n for (\n let next = currDecoder.curr;\n next !== null && next.id.client === firstClient && next.id.clock === currWrite.struct.id.clock + currWrite.struct.length && next.constructor !== Skip;\n next = currDecoder.next()\n ) {\n writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset);\n currWrite = { struct: next, offset: 0 };\n }\n }\n if (currWrite !== null) {\n writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset);\n currWrite = null;\n }\n finishLazyStructWriting(lazyStructEncoder);\n\n const dss = updateDecoders.map(decoder => readDeleteSet(decoder));\n const ds = mergeDeleteSets(dss);\n writeDeleteSet(updateEncoder, ds);\n return updateEncoder.toUint8Array()\n};\n\n/**\n * @param {Uint8Array} update\n * @param {Uint8Array} sv\n * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder]\n * @param {typeof UpdateEncoderV1 | typeof UpdateEncoderV2} [YEncoder]\n */\nconst diffUpdateV2 = (update, sv, YDecoder = UpdateDecoderV2, YEncoder = UpdateEncoderV2) => {\n const state = decodeStateVector(sv);\n const encoder = new YEncoder();\n const lazyStructWriter = new LazyStructWriter(encoder);\n const decoder = new YDecoder(decoding.createDecoder(update));\n const reader = new LazyStructReader(decoder, false);\n while (reader.curr) {\n const curr = reader.curr;\n const currClient = curr.id.client;\n const svClock = state.get(currClient) || 0;\n if (reader.curr.constructor === Skip) {\n // the first written struct shouldn't be a skip\n reader.next();\n continue\n }\n if (curr.id.clock + curr.length > svClock) {\n writeStructToLazyStructWriter(lazyStructWriter, curr, math.max(svClock - curr.id.clock, 0));\n reader.next();\n while (reader.curr && reader.curr.id.client === currClient) {\n writeStructToLazyStructWriter(lazyStructWriter, reader.curr, 0);\n reader.next();\n }\n } else {\n // read until something new comes up\n while (reader.curr && reader.curr.id.client === currClient && reader.curr.id.clock + reader.curr.length <= svClock) {\n reader.next();\n }\n }\n }\n finishLazyStructWriting(lazyStructWriter);\n // write ds\n const ds = readDeleteSet(decoder);\n writeDeleteSet(encoder, ds);\n return encoder.toUint8Array()\n};\n\n/**\n * @param {Uint8Array} update\n * @param {Uint8Array} sv\n */\nconst diffUpdate = (update, sv) => diffUpdateV2(update, sv, UpdateDecoderV1, UpdateEncoderV1);\n\n/**\n * @param {LazyStructWriter} lazyWriter\n */\nconst flushLazyStructWriter = lazyWriter => {\n if (lazyWriter.written > 0) {\n lazyWriter.clientStructs.push({ written: lazyWriter.written, restEncoder: encoding.toUint8Array(lazyWriter.encoder.restEncoder) });\n lazyWriter.encoder.restEncoder = encoding.createEncoder();\n lazyWriter.written = 0;\n }\n};\n\n/**\n * @param {LazyStructWriter} lazyWriter\n * @param {Item | GC} struct\n * @param {number} offset\n */\nconst writeStructToLazyStructWriter = (lazyWriter, struct, offset) => {\n // flush curr if we start another client\n if (lazyWriter.written > 0 && lazyWriter.currClient !== struct.id.client) {\n flushLazyStructWriter(lazyWriter);\n }\n if (lazyWriter.written === 0) {\n lazyWriter.currClient = struct.id.client;\n // write next client\n lazyWriter.encoder.writeClient(struct.id.client);\n // write startClock\n encoding.writeVarUint(lazyWriter.encoder.restEncoder, struct.id.clock + offset);\n }\n struct.write(lazyWriter.encoder, offset);\n lazyWriter.written++;\n};\n/**\n * Call this function when we collected all parts and want to\n * put all the parts together. After calling this method,\n * you can continue using the UpdateEncoder.\n *\n * @param {LazyStructWriter} lazyWriter\n */\nconst finishLazyStructWriting = (lazyWriter) => {\n flushLazyStructWriter(lazyWriter);\n\n // this is a fresh encoder because we called flushCurr\n const restEncoder = lazyWriter.encoder.restEncoder;\n\n /**\n * Now we put all the fragments together.\n * This works similarly to `writeClientsStructs`\n */\n\n // write # states that were updated - i.e. the clients\n encoding.writeVarUint(restEncoder, lazyWriter.clientStructs.length);\n\n for (let i = 0; i < lazyWriter.clientStructs.length; i++) {\n const partStructs = lazyWriter.clientStructs[i];\n /**\n * Works similarly to `writeStructs`\n */\n // write # encoded structs\n encoding.writeVarUint(restEncoder, partStructs.written);\n // write the rest of the fragment\n encoding.writeUint8Array(restEncoder, partStructs.restEncoder);\n }\n};\n\n/**\n * @param {Uint8Array} update\n * @param {function(Item|GC|Skip):Item|GC|Skip} blockTransformer\n * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} YDecoder\n * @param {typeof UpdateEncoderV2 | typeof UpdateEncoderV1 } YEncoder\n */\nconst convertUpdateFormat = (update, blockTransformer, YDecoder, YEncoder) => {\n const updateDecoder = new YDecoder(decoding.createDecoder(update));\n const lazyDecoder = new LazyStructReader(updateDecoder, false);\n const updateEncoder = new YEncoder();\n const lazyWriter = new LazyStructWriter(updateEncoder);\n for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) {\n writeStructToLazyStructWriter(lazyWriter, blockTransformer(curr), 0);\n }\n finishLazyStructWriting(lazyWriter);\n const ds = readDeleteSet(updateDecoder);\n writeDeleteSet(updateEncoder, ds);\n return updateEncoder.toUint8Array()\n};\n\n/**\n * @typedef {Object} ObfuscatorOptions\n * @property {boolean} [ObfuscatorOptions.formatting=true]\n * @property {boolean} [ObfuscatorOptions.subdocs=true]\n * @property {boolean} [ObfuscatorOptions.yxml=true] Whether to obfuscate nodeName / hookName\n */\n\n/**\n * @param {ObfuscatorOptions} obfuscator\n */\nconst createObfuscator = ({ formatting = true, subdocs = true, yxml = true } = {}) => {\n let i = 0;\n const mapKeyCache = map.create();\n const nodeNameCache = map.create();\n const formattingKeyCache = map.create();\n const formattingValueCache = map.create();\n formattingValueCache.set(null, null); // end of a formatting range should always be the end of a formatting range\n /**\n * @param {Item|GC|Skip} block\n * @return {Item|GC|Skip}\n */\n return block => {\n switch (block.constructor) {\n case GC:\n case Skip:\n return block\n case Item: {\n const item = /** @type {Item} */ (block);\n const content = item.content;\n switch (content.constructor) {\n case ContentDeleted:\n break\n case ContentType: {\n if (yxml) {\n const type = /** @type {ContentType} */ (content).type;\n if (type instanceof YXmlElement) {\n type.nodeName = map.setIfUndefined(nodeNameCache, type.nodeName, () => 'node-' + i);\n }\n if (type instanceof YXmlHook) {\n type.hookName = map.setIfUndefined(nodeNameCache, type.hookName, () => 'hook-' + i);\n }\n }\n break\n }\n case ContentAny: {\n const c = /** @type {ContentAny} */ (content);\n c.arr = c.arr.map(() => i);\n break\n }\n case ContentBinary: {\n const c = /** @type {ContentBinary} */ (content);\n c.content = new Uint8Array([i]);\n break\n }\n case ContentDoc: {\n const c = /** @type {ContentDoc} */ (content);\n if (subdocs) {\n c.opts = {};\n c.doc.guid = i + '';\n }\n break\n }\n case ContentEmbed: {\n const c = /** @type {ContentEmbed} */ (content);\n c.embed = {};\n break\n }\n case ContentFormat: {\n const c = /** @type {ContentFormat} */ (content);\n if (formatting) {\n c.key = map.setIfUndefined(formattingKeyCache, c.key, () => i + '');\n c.value = map.setIfUndefined(formattingValueCache, c.value, () => ({ i }));\n }\n break\n }\n case ContentJSON: {\n const c = /** @type {ContentJSON} */ (content);\n c.arr = c.arr.map(() => i);\n break\n }\n case ContentString: {\n const c = /** @type {ContentString} */ (content);\n c.str = string.repeat((i % 10) + '', c.str.length);\n break\n }\n default:\n // unknown content type\n error.unexpectedCase();\n }\n if (item.parentSub) {\n item.parentSub = map.setIfUndefined(mapKeyCache, item.parentSub, () => i + '');\n }\n i++;\n return block\n }\n default:\n // unknown block-type\n error.unexpectedCase();\n }\n }\n};\n\n/**\n * This function obfuscates the content of a Yjs update. This is useful to share\n * buggy Yjs documents while significantly limiting the possibility that a\n * developer can on the user. Note that it might still be possible to deduce\n * some information by analyzing the \"structure\" of the document or by analyzing\n * the typing behavior using the CRDT-related metadata that is still kept fully\n * intact.\n *\n * @param {Uint8Array} update\n * @param {ObfuscatorOptions} [opts]\n */\nconst obfuscateUpdate = (update, opts) => convertUpdateFormat(update, createObfuscator(opts), UpdateDecoderV1, UpdateEncoderV1);\n\n/**\n * @param {Uint8Array} update\n * @param {ObfuscatorOptions} [opts]\n */\nconst obfuscateUpdateV2 = (update, opts) => convertUpdateFormat(update, createObfuscator(opts), UpdateDecoderV2, UpdateEncoderV2);\n\n/**\n * @param {Uint8Array} update\n */\nconst convertUpdateFormatV1ToV2 = update => convertUpdateFormat(update, f.id, UpdateDecoderV1, UpdateEncoderV2);\n\n/**\n * @param {Uint8Array} update\n */\nconst convertUpdateFormatV2ToV1 = update => convertUpdateFormat(update, f.id, UpdateDecoderV2, UpdateEncoderV1);\n\nconst errorComputeChanges = 'You must not compute changes after the event-handler fired.';\n\n/**\n * @template {AbstractType} T\n * YEvent describes the changes on a YType.\n */\nclass YEvent {\n /**\n * @param {T} target The changed type.\n * @param {Transaction} transaction\n */\n constructor (target, transaction) {\n /**\n * The type on which this event was created on.\n * @type {T}\n */\n this.target = target;\n /**\n * The current target on which the observe callback is called.\n * @type {AbstractType}\n */\n this.currentTarget = target;\n /**\n * The transaction that triggered this event.\n * @type {Transaction}\n */\n this.transaction = transaction;\n /**\n * @type {Object|null}\n */\n this._changes = null;\n /**\n * @type {null | Map}\n */\n this._keys = null;\n /**\n * @type {null | Array<{ insert?: string | Array | object | AbstractType, retain?: number, delete?: number, attributes?: Object }>}\n */\n this._delta = null;\n /**\n * @type {Array|null}\n */\n this._path = null;\n }\n\n /**\n * Computes the path from `y` to the changed type.\n *\n * @todo v14 should standardize on path: Array<{parent, index}> because that is easier to work with.\n *\n * The following property holds:\n * @example\n * let type = y\n * event.path.forEach(dir => {\n * type = type.get(dir)\n * })\n * type === event.target // => true\n */\n get path () {\n return this._path || (this._path = getPathTo(this.currentTarget, this.target))\n }\n\n /**\n * Check if a struct is deleted by this event.\n *\n * In contrast to change.deleted, this method also returns true if the struct was added and then deleted.\n *\n * @param {AbstractStruct} struct\n * @return {boolean}\n */\n deletes (struct) {\n return isDeleted(this.transaction.deleteSet, struct.id)\n }\n\n /**\n * @type {Map}\n */\n get keys () {\n if (this._keys === null) {\n if (this.transaction.doc._transactionCleanups.length === 0) {\n throw error.create(errorComputeChanges)\n }\n const keys = new Map();\n const target = this.target;\n const changed = /** @type Set */ (this.transaction.changed.get(target));\n changed.forEach(key => {\n if (key !== null) {\n const item = /** @type {Item} */ (target._map.get(key));\n /**\n * @type {'delete' | 'add' | 'update'}\n */\n let action;\n let oldValue;\n if (this.adds(item)) {\n let prev = item.left;\n while (prev !== null && this.adds(prev)) {\n prev = prev.left;\n }\n if (this.deletes(item)) {\n if (prev !== null && this.deletes(prev)) {\n action = 'delete';\n oldValue = array.last(prev.content.getContent());\n } else {\n return\n }\n } else {\n if (prev !== null && this.deletes(prev)) {\n action = 'update';\n oldValue = array.last(prev.content.getContent());\n } else {\n action = 'add';\n oldValue = undefined;\n }\n }\n } else {\n if (this.deletes(item)) {\n action = 'delete';\n oldValue = array.last(/** @type {Item} */ item.content.getContent());\n } else {\n return // nop\n }\n }\n keys.set(key, { action, oldValue });\n }\n });\n this._keys = keys;\n }\n return this._keys\n }\n\n /**\n * This is a computed property. Note that this can only be safely computed during the\n * event call. Computing this property after other changes happened might result in\n * unexpected behavior (incorrect computation of deltas). A safe way to collect changes\n * is to store the `changes` or the `delta` object. Avoid storing the `transaction` object.\n *\n * @type {Array<{insert?: string | Array | object | AbstractType, retain?: number, delete?: number, attributes?: Object}>}\n */\n get delta () {\n return this.changes.delta\n }\n\n /**\n * Check if a struct is added by this event.\n *\n * In contrast to change.deleted, this method also returns true if the struct was added and then deleted.\n *\n * @param {AbstractStruct} struct\n * @return {boolean}\n */\n adds (struct) {\n return struct.id.clock >= (this.transaction.beforeState.get(struct.id.client) || 0)\n }\n\n /**\n * This is a computed property. Note that this can only be safely computed during the\n * event call. Computing this property after other changes happened might result in\n * unexpected behavior (incorrect computation of deltas). A safe way to collect changes\n * is to store the `changes` or the `delta` object. Avoid storing the `transaction` object.\n *\n * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string, delete?:number, retain?:number}>}}\n */\n get changes () {\n let changes = this._changes;\n if (changes === null) {\n if (this.transaction.doc._transactionCleanups.length === 0) {\n throw error.create(errorComputeChanges)\n }\n const target = this.target;\n const added = set.create();\n const deleted = set.create();\n /**\n * @type {Array<{insert:Array}|{delete:number}|{retain:number}>}\n */\n const delta = [];\n changes = {\n added,\n deleted,\n delta,\n keys: this.keys\n };\n const changed = /** @type Set */ (this.transaction.changed.get(target));\n if (changed.has(null)) {\n /**\n * @type {any}\n */\n let lastOp = null;\n const packOp = () => {\n if (lastOp) {\n delta.push(lastOp);\n }\n };\n for (let item = target._start; item !== null; item = item.right) {\n if (item.deleted) {\n if (this.deletes(item) && !this.adds(item)) {\n if (lastOp === null || lastOp.delete === undefined) {\n packOp();\n lastOp = { delete: 0 };\n }\n lastOp.delete += item.length;\n deleted.add(item);\n } // else nop\n } else {\n if (this.adds(item)) {\n if (lastOp === null || lastOp.insert === undefined) {\n packOp();\n lastOp = { insert: [] };\n }\n lastOp.insert = lastOp.insert.concat(item.content.getContent());\n added.add(item);\n } else {\n if (lastOp === null || lastOp.retain === undefined) {\n packOp();\n lastOp = { retain: 0 };\n }\n lastOp.retain += item.length;\n }\n }\n }\n if (lastOp !== null && lastOp.retain === undefined) {\n packOp();\n }\n }\n this._changes = changes;\n }\n return /** @type {any} */ (changes)\n }\n}\n\n/**\n * Compute the path from this type to the specified target.\n *\n * @example\n * // `child` should be accessible via `type.get(path[0]).get(path[1])..`\n * const path = type.getPathTo(child)\n * // assuming `type instanceof YArray`\n * console.log(path) // might look like => [2, 'key1']\n * child === type.get(path[0]).get(path[1])\n *\n * @param {AbstractType} parent\n * @param {AbstractType} child target\n * @return {Array} Path to the target\n *\n * @private\n * @function\n */\nconst getPathTo = (parent, child) => {\n const path = [];\n while (child._item !== null && child !== parent) {\n if (child._item.parentSub !== null) {\n // parent is map-ish\n path.unshift(child._item.parentSub);\n } else {\n // parent is array-ish\n let i = 0;\n let c = /** @type {AbstractType} */ (child._item.parent)._start;\n while (c !== child._item && c !== null) {\n if (!c.deleted) {\n i++;\n }\n c = c.right;\n }\n path.unshift(i);\n }\n child = /** @type {AbstractType} */ (child._item.parent);\n }\n return path\n};\n\nconst maxSearchMarker = 80;\n\n/**\n * A unique timestamp that identifies each marker.\n *\n * Time is relative,.. this is more like an ever-increasing clock.\n *\n * @type {number}\n */\nlet globalSearchMarkerTimestamp = 0;\n\nclass ArraySearchMarker {\n /**\n * @param {Item} p\n * @param {number} index\n */\n constructor (p, index) {\n p.marker = true;\n this.p = p;\n this.index = index;\n this.timestamp = globalSearchMarkerTimestamp++;\n }\n}\n\n/**\n * @param {ArraySearchMarker} marker\n */\nconst refreshMarkerTimestamp = marker => { marker.timestamp = globalSearchMarkerTimestamp++; };\n\n/**\n * This is rather complex so this function is the only thing that should overwrite a marker\n *\n * @param {ArraySearchMarker} marker\n * @param {Item} p\n * @param {number} index\n */\nconst overwriteMarker = (marker, p, index) => {\n marker.p.marker = false;\n marker.p = p;\n p.marker = true;\n marker.index = index;\n marker.timestamp = globalSearchMarkerTimestamp++;\n};\n\n/**\n * @param {Array} searchMarker\n * @param {Item} p\n * @param {number} index\n */\nconst markPosition = (searchMarker, p, index) => {\n if (searchMarker.length >= maxSearchMarker) {\n // override oldest marker (we don't want to create more objects)\n const marker = searchMarker.reduce((a, b) => a.timestamp < b.timestamp ? a : b);\n overwriteMarker(marker, p, index);\n return marker\n } else {\n // create new marker\n const pm = new ArraySearchMarker(p, index);\n searchMarker.push(pm);\n return pm\n }\n};\n\n/**\n * Search marker help us to find positions in the associative array faster.\n *\n * They speed up the process of finding a position without much bookkeeping.\n *\n * A maximum of `maxSearchMarker` objects are created.\n *\n * This function always returns a refreshed marker (updated timestamp)\n *\n * @param {AbstractType} yarray\n * @param {number} index\n */\nconst findMarker = (yarray, index) => {\n if (yarray._start === null || index === 0 || yarray._searchMarker === null) {\n return null\n }\n const marker = yarray._searchMarker.length === 0 ? null : yarray._searchMarker.reduce((a, b) => math.abs(index - a.index) < math.abs(index - b.index) ? a : b);\n let p = yarray._start;\n let pindex = 0;\n if (marker !== null) {\n p = marker.p;\n pindex = marker.index;\n refreshMarkerTimestamp(marker); // we used it, we might need to use it again\n }\n // iterate to right if possible\n while (p.right !== null && pindex < index) {\n if (!p.deleted && p.countable) {\n if (index < pindex + p.length) {\n break\n }\n pindex += p.length;\n }\n p = p.right;\n }\n // iterate to left if necessary (might be that pindex > index)\n while (p.left !== null && pindex > index) {\n p = p.left;\n if (!p.deleted && p.countable) {\n pindex -= p.length;\n }\n }\n // we want to make sure that p can't be merged with left, because that would screw up everything\n // in that cas just return what we have (it is most likely the best marker anyway)\n // iterate to left until p can't be merged with left\n while (p.left !== null && p.left.id.client === p.id.client && p.left.id.clock + p.left.length === p.id.clock) {\n p = p.left;\n if (!p.deleted && p.countable) {\n pindex -= p.length;\n }\n }\n\n // @todo remove!\n // assure position\n // {\n // let start = yarray._start\n // let pos = 0\n // while (start !== p) {\n // if (!start.deleted && start.countable) {\n // pos += start.length\n // }\n // start = /** @type {Item} */ (start.right)\n // }\n // if (pos !== pindex) {\n // debugger\n // throw new Error('Gotcha position fail!')\n // }\n // }\n // if (marker) {\n // if (window.lengthes == null) {\n // window.lengthes = []\n // window.getLengthes = () => window.lengthes.sort((a, b) => a - b)\n // }\n // window.lengthes.push(marker.index - pindex)\n // console.log('distance', marker.index - pindex, 'len', p && p.parent.length)\n // }\n if (marker !== null && math.abs(marker.index - pindex) < /** @type {YText|YArray} */ (p.parent).length / maxSearchMarker) {\n // adjust existing marker\n overwriteMarker(marker, p, pindex);\n return marker\n } else {\n // create new marker\n return markPosition(yarray._searchMarker, p, pindex)\n }\n};\n\n/**\n * Update markers when a change happened.\n *\n * This should be called before doing a deletion!\n *\n * @param {Array} searchMarker\n * @param {number} index\n * @param {number} len If insertion, len is positive. If deletion, len is negative.\n */\nconst updateMarkerChanges = (searchMarker, index, len) => {\n for (let i = searchMarker.length - 1; i >= 0; i--) {\n const m = searchMarker[i];\n if (len > 0) {\n /**\n * @type {Item|null}\n */\n let p = m.p;\n p.marker = false;\n // Ideally we just want to do a simple position comparison, but this will only work if\n // search markers don't point to deleted items for formats.\n // Iterate marker to prev undeleted countable position so we know what to do when updating a position\n while (p && (p.deleted || !p.countable)) {\n p = p.left;\n if (p && !p.deleted && p.countable) {\n // adjust position. the loop should break now\n m.index -= p.length;\n }\n }\n if (p === null || p.marker === true) {\n // remove search marker if updated position is null or if position is already marked\n searchMarker.splice(i, 1);\n continue\n }\n m.p = p;\n p.marker = true;\n }\n if (index < m.index || (len > 0 && index === m.index)) { // a simple index <= m.index check would actually suffice\n m.index = math.max(index, m.index + len);\n }\n }\n};\n\n/**\n * Accumulate all (list) children of a type and return them as an Array.\n *\n * @param {AbstractType} t\n * @return {Array}\n */\nconst getTypeChildren = t => {\n let s = t._start;\n const arr = [];\n while (s) {\n arr.push(s);\n s = s.right;\n }\n return arr\n};\n\n/**\n * Call event listeners with an event. This will also add an event to all\n * parents (for `.observeDeep` handlers).\n *\n * @template EventType\n * @param {AbstractType} type\n * @param {Transaction} transaction\n * @param {EventType} event\n */\nconst callTypeObservers = (type, transaction, event) => {\n const changedType = type;\n const changedParentTypes = transaction.changedParentTypes;\n while (true) {\n // @ts-ignore\n map.setIfUndefined(changedParentTypes, type, () => []).push(event);\n if (type._item === null) {\n break\n }\n type = /** @type {AbstractType} */ (type._item.parent);\n }\n callEventHandlerListeners(changedType._eH, event, transaction);\n};\n\n/**\n * @template EventType\n * Abstract Yjs Type class\n */\nclass AbstractType {\n constructor () {\n /**\n * @type {Item|null}\n */\n this._item = null;\n /**\n * @type {Map}\n */\n this._map = new Map();\n /**\n * @type {Item|null}\n */\n this._start = null;\n /**\n * @type {Doc|null}\n */\n this.doc = null;\n this._length = 0;\n /**\n * Event handlers\n * @type {EventHandler}\n */\n this._eH = createEventHandler();\n /**\n * Deep event handlers\n * @type {EventHandler>,Transaction>}\n */\n this._dEH = createEventHandler();\n /**\n * @type {null | Array}\n */\n this._searchMarker = null;\n }\n\n /**\n * @return {AbstractType|null}\n */\n get parent () {\n return this._item ? /** @type {AbstractType} */ (this._item.parent) : null\n }\n\n /**\n * Integrate this type into the Yjs instance.\n *\n * * Save this struct in the os\n * * This type is sent to other client\n * * Observer functions are fired\n *\n * @param {Doc} y The Yjs instance\n * @param {Item|null} item\n */\n _integrate (y, item) {\n this.doc = y;\n this._item = item;\n }\n\n /**\n * @return {AbstractType}\n */\n _copy () {\n throw error.methodUnimplemented()\n }\n\n /**\n * @return {AbstractType}\n */\n clone () {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} _encoder\n */\n _write (_encoder) { }\n\n /**\n * The first non-deleted item\n */\n get _first () {\n let n = this._start;\n while (n !== null && n.deleted) {\n n = n.right;\n }\n return n\n }\n\n /**\n * Creates YEvent and calls all type observers.\n * Must be implemented by each type.\n *\n * @param {Transaction} transaction\n * @param {Set} _parentSubs Keys changed on this type. `null` if list was modified.\n */\n _callObserver (transaction, _parentSubs) {\n if (!transaction.local && this._searchMarker) {\n this._searchMarker.length = 0;\n }\n }\n\n /**\n * Observe all events that are created on this type.\n *\n * @param {function(EventType, Transaction):void} f Observer function\n */\n observe (f) {\n addEventHandlerListener(this._eH, f);\n }\n\n /**\n * Observe all events that are created by this type and its children.\n *\n * @param {function(Array>,Transaction):void} f Observer function\n */\n observeDeep (f) {\n addEventHandlerListener(this._dEH, f);\n }\n\n /**\n * Unregister an observer function.\n *\n * @param {function(EventType,Transaction):void} f Observer function\n */\n unobserve (f) {\n removeEventHandlerListener(this._eH, f);\n }\n\n /**\n * Unregister an observer function.\n *\n * @param {function(Array>,Transaction):void} f Observer function\n */\n unobserveDeep (f) {\n removeEventHandlerListener(this._dEH, f);\n }\n\n /**\n * @abstract\n * @return {any}\n */\n toJSON () {}\n}\n\n/**\n * @param {AbstractType} type\n * @param {number} start\n * @param {number} end\n * @return {Array}\n *\n * @private\n * @function\n */\nconst typeListSlice = (type, start, end) => {\n if (start < 0) {\n start = type._length + start;\n }\n if (end < 0) {\n end = type._length + end;\n }\n let len = end - start;\n const cs = [];\n let n = type._start;\n while (n !== null && len > 0) {\n if (n.countable && !n.deleted) {\n const c = n.content.getContent();\n if (c.length <= start) {\n start -= c.length;\n } else {\n for (let i = start; i < c.length && len > 0; i++) {\n cs.push(c[i]);\n len--;\n }\n start = 0;\n }\n }\n n = n.right;\n }\n return cs\n};\n\n/**\n * @param {AbstractType} type\n * @return {Array}\n *\n * @private\n * @function\n */\nconst typeListToArray = type => {\n const cs = [];\n let n = type._start;\n while (n !== null) {\n if (n.countable && !n.deleted) {\n const c = n.content.getContent();\n for (let i = 0; i < c.length; i++) {\n cs.push(c[i]);\n }\n }\n n = n.right;\n }\n return cs\n};\n\n/**\n * @param {AbstractType} type\n * @param {Snapshot} snapshot\n * @return {Array}\n *\n * @private\n * @function\n */\nconst typeListToArraySnapshot = (type, snapshot) => {\n const cs = [];\n let n = type._start;\n while (n !== null) {\n if (n.countable && isVisible(n, snapshot)) {\n const c = n.content.getContent();\n for (let i = 0; i < c.length; i++) {\n cs.push(c[i]);\n }\n }\n n = n.right;\n }\n return cs\n};\n\n/**\n * Executes a provided function on once on overy element of this YArray.\n *\n * @param {AbstractType} type\n * @param {function(any,number,any):void} f A function to execute on every element of this YArray.\n *\n * @private\n * @function\n */\nconst typeListForEach = (type, f) => {\n let index = 0;\n let n = type._start;\n while (n !== null) {\n if (n.countable && !n.deleted) {\n const c = n.content.getContent();\n for (let i = 0; i < c.length; i++) {\n f(c[i], index++, type);\n }\n }\n n = n.right;\n }\n};\n\n/**\n * @template C,R\n * @param {AbstractType} type\n * @param {function(C,number,AbstractType):R} f\n * @return {Array}\n *\n * @private\n * @function\n */\nconst typeListMap = (type, f) => {\n /**\n * @type {Array}\n */\n const result = [];\n typeListForEach(type, (c, i) => {\n result.push(f(c, i, type));\n });\n return result\n};\n\n/**\n * @param {AbstractType} type\n * @return {IterableIterator}\n *\n * @private\n * @function\n */\nconst typeListCreateIterator = type => {\n let n = type._start;\n /**\n * @type {Array|null}\n */\n let currentContent = null;\n let currentContentIndex = 0;\n return {\n [Symbol.iterator] () {\n return this\n },\n next: () => {\n // find some content\n if (currentContent === null) {\n while (n !== null && n.deleted) {\n n = n.right;\n }\n // check if we reached the end, no need to check currentContent, because it does not exist\n if (n === null) {\n return {\n done: true,\n value: undefined\n }\n }\n // we found n, so we can set currentContent\n currentContent = n.content.getContent();\n currentContentIndex = 0;\n n = n.right; // we used the content of n, now iterate to next\n }\n const value = currentContent[currentContentIndex++];\n // check if we need to empty currentContent\n if (currentContent.length <= currentContentIndex) {\n currentContent = null;\n }\n return {\n done: false,\n value\n }\n }\n }\n};\n\n/**\n * @param {AbstractType} type\n * @param {number} index\n * @return {any}\n *\n * @private\n * @function\n */\nconst typeListGet = (type, index) => {\n const marker = findMarker(type, index);\n let n = type._start;\n if (marker !== null) {\n n = marker.p;\n index -= marker.index;\n }\n for (; n !== null; n = n.right) {\n if (!n.deleted && n.countable) {\n if (index < n.length) {\n return n.content.getContent()[index]\n }\n index -= n.length;\n }\n }\n};\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {Item?} referenceItem\n * @param {Array|Array|boolean|number|null|string|Uint8Array>} content\n *\n * @private\n * @function\n */\nconst typeListInsertGenericsAfter = (transaction, parent, referenceItem, content) => {\n let left = referenceItem;\n const doc = transaction.doc;\n const ownClientId = doc.clientID;\n const store = doc.store;\n const right = referenceItem === null ? parent._start : referenceItem.right;\n /**\n * @type {Array|number|null>}\n */\n let jsonContent = [];\n const packJsonContent = () => {\n if (jsonContent.length > 0) {\n left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentAny(jsonContent));\n left.integrate(transaction, 0);\n jsonContent = [];\n }\n };\n content.forEach(c => {\n if (c === null) {\n jsonContent.push(c);\n } else {\n switch (c.constructor) {\n case Number:\n case Object:\n case Boolean:\n case Array:\n case String:\n jsonContent.push(c);\n break\n default:\n packJsonContent();\n switch (c.constructor) {\n case Uint8Array:\n case ArrayBuffer:\n left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentBinary(new Uint8Array(/** @type {Uint8Array} */ (c))));\n left.integrate(transaction, 0);\n break\n case Doc:\n left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentDoc(/** @type {Doc} */ (c)));\n left.integrate(transaction, 0);\n break\n default:\n if (c instanceof AbstractType) {\n left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentType(c));\n left.integrate(transaction, 0);\n } else {\n throw new Error('Unexpected content type in insert operation')\n }\n }\n }\n }\n });\n packJsonContent();\n};\n\nconst lengthExceeded = error.create('Length exceeded!');\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {number} index\n * @param {Array|Array|number|null|string|Uint8Array>} content\n *\n * @private\n * @function\n */\nconst typeListInsertGenerics = (transaction, parent, index, content) => {\n if (index > parent._length) {\n throw lengthExceeded\n }\n if (index === 0) {\n if (parent._searchMarker) {\n updateMarkerChanges(parent._searchMarker, index, content.length);\n }\n return typeListInsertGenericsAfter(transaction, parent, null, content)\n }\n const startIndex = index;\n const marker = findMarker(parent, index);\n let n = parent._start;\n if (marker !== null) {\n n = marker.p;\n index -= marker.index;\n // we need to iterate one to the left so that the algorithm works\n if (index === 0) {\n // @todo refactor this as it actually doesn't consider formats\n n = n.prev; // important! get the left undeleted item so that we can actually decrease index\n index += (n && n.countable && !n.deleted) ? n.length : 0;\n }\n }\n for (; n !== null; n = n.right) {\n if (!n.deleted && n.countable) {\n if (index <= n.length) {\n if (index < n.length) {\n // insert in-between\n getItemCleanStart(transaction, createID(n.id.client, n.id.clock + index));\n }\n break\n }\n index -= n.length;\n }\n }\n if (parent._searchMarker) {\n updateMarkerChanges(parent._searchMarker, startIndex, content.length);\n }\n return typeListInsertGenericsAfter(transaction, parent, n, content)\n};\n\n/**\n * Pushing content is special as we generally want to push after the last item. So we don't have to update\n * the serach marker.\n *\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {Array|Array|number|null|string|Uint8Array>} content\n *\n * @private\n * @function\n */\nconst typeListPushGenerics = (transaction, parent, content) => {\n // Use the marker with the highest index and iterate to the right.\n const marker = (parent._searchMarker || []).reduce((maxMarker, currMarker) => currMarker.index > maxMarker.index ? currMarker : maxMarker, { index: 0, p: parent._start });\n let n = marker.p;\n if (n) {\n while (n.right) {\n n = n.right;\n }\n }\n return typeListInsertGenericsAfter(transaction, parent, n, content)\n};\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {number} index\n * @param {number} length\n *\n * @private\n * @function\n */\nconst typeListDelete = (transaction, parent, index, length) => {\n if (length === 0) { return }\n const startIndex = index;\n const startLength = length;\n const marker = findMarker(parent, index);\n let n = parent._start;\n if (marker !== null) {\n n = marker.p;\n index -= marker.index;\n }\n // compute the first item to be deleted\n for (; n !== null && index > 0; n = n.right) {\n if (!n.deleted && n.countable) {\n if (index < n.length) {\n getItemCleanStart(transaction, createID(n.id.client, n.id.clock + index));\n }\n index -= n.length;\n }\n }\n // delete all items until done\n while (length > 0 && n !== null) {\n if (!n.deleted) {\n if (length < n.length) {\n getItemCleanStart(transaction, createID(n.id.client, n.id.clock + length));\n }\n n.delete(transaction);\n length -= n.length;\n }\n n = n.right;\n }\n if (length > 0) {\n throw lengthExceeded\n }\n if (parent._searchMarker) {\n updateMarkerChanges(parent._searchMarker, startIndex, -startLength + length /* in case we remove the above exception */);\n }\n};\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {string} key\n *\n * @private\n * @function\n */\nconst typeMapDelete = (transaction, parent, key) => {\n const c = parent._map.get(key);\n if (c !== undefined) {\n c.delete(transaction);\n }\n};\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {string} key\n * @param {Object|number|null|Array|string|Uint8Array|AbstractType} value\n *\n * @private\n * @function\n */\nconst typeMapSet = (transaction, parent, key, value) => {\n const left = parent._map.get(key) || null;\n const doc = transaction.doc;\n const ownClientId = doc.clientID;\n let content;\n if (value == null) {\n content = new ContentAny([value]);\n } else {\n switch (value.constructor) {\n case Number:\n case Object:\n case Boolean:\n case Array:\n case String:\n content = new ContentAny([value]);\n break\n case Uint8Array:\n content = new ContentBinary(/** @type {Uint8Array} */ (value));\n break\n case Doc:\n content = new ContentDoc(/** @type {Doc} */ (value));\n break\n default:\n if (value instanceof AbstractType) {\n content = new ContentType(value);\n } else {\n throw new Error('Unexpected content type')\n }\n }\n }\n new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, null, null, parent, key, content).integrate(transaction, 0);\n};\n\n/**\n * @param {AbstractType} parent\n * @param {string} key\n * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined}\n *\n * @private\n * @function\n */\nconst typeMapGet = (parent, key) => {\n const val = parent._map.get(key);\n return val !== undefined && !val.deleted ? val.content.getContent()[val.length - 1] : undefined\n};\n\n/**\n * @param {AbstractType} parent\n * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined>}\n *\n * @private\n * @function\n */\nconst typeMapGetAll = (parent) => {\n /**\n * @type {Object}\n */\n const res = {};\n parent._map.forEach((value, key) => {\n if (!value.deleted) {\n res[key] = value.content.getContent()[value.length - 1];\n }\n });\n return res\n};\n\n/**\n * @param {AbstractType} parent\n * @param {string} key\n * @return {boolean}\n *\n * @private\n * @function\n */\nconst typeMapHas = (parent, key) => {\n const val = parent._map.get(key);\n return val !== undefined && !val.deleted\n};\n\n/**\n * @param {AbstractType} parent\n * @param {string} key\n * @param {Snapshot} snapshot\n * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined}\n *\n * @private\n * @function\n */\nconst typeMapGetSnapshot = (parent, key, snapshot) => {\n let v = parent._map.get(key) || null;\n while (v !== null && (!snapshot.sv.has(v.id.client) || v.id.clock >= (snapshot.sv.get(v.id.client) || 0))) {\n v = v.left;\n }\n return v !== null && isVisible(v, snapshot) ? v.content.getContent()[v.length - 1] : undefined\n};\n\n/**\n * @param {Map} map\n * @return {IterableIterator>}\n *\n * @private\n * @function\n */\nconst createMapIterator = map => iterator.iteratorFilter(map.entries(), /** @param {any} entry */ entry => !entry[1].deleted);\n\n/**\n * @module YArray\n */\n\n/**\n * Event that describes the changes on a YArray\n * @template T\n * @extends YEvent>\n */\nclass YArrayEvent extends YEvent {\n /**\n * @param {YArray} yarray The changed type\n * @param {Transaction} transaction The transaction object\n */\n constructor (yarray, transaction) {\n super(yarray, transaction);\n this._transaction = transaction;\n }\n}\n\n/**\n * A shared Array implementation.\n * @template T\n * @extends AbstractType>\n * @implements {Iterable}\n */\nclass YArray extends AbstractType {\n constructor () {\n super();\n /**\n * @type {Array?}\n * @private\n */\n this._prelimContent = [];\n /**\n * @type {Array}\n */\n this._searchMarker = [];\n }\n\n /**\n * Construct a new YArray containing the specified items.\n * @template {Object|Array|number|null|string|Uint8Array} T\n * @param {Array} items\n * @return {YArray}\n */\n static from (items) {\n /**\n * @type {YArray}\n */\n const a = new YArray();\n a.push(items);\n return a\n }\n\n /**\n * Integrate this type into the Yjs instance.\n *\n * * Save this struct in the os\n * * This type is sent to other client\n * * Observer functions are fired\n *\n * @param {Doc} y The Yjs instance\n * @param {Item} item\n */\n _integrate (y, item) {\n super._integrate(y, item);\n this.insert(0, /** @type {Array} */ (this._prelimContent));\n this._prelimContent = null;\n }\n\n /**\n * @return {YArray}\n */\n _copy () {\n return new YArray()\n }\n\n /**\n * @return {YArray}\n */\n clone () {\n /**\n * @type {YArray}\n */\n const arr = new YArray();\n arr.insert(0, this.toArray().map(el =>\n el instanceof AbstractType ? /** @type {typeof el} */ (el.clone()) : el\n ));\n return arr\n }\n\n get length () {\n return this._prelimContent === null ? this._length : this._prelimContent.length\n }\n\n /**\n * Creates YArrayEvent and calls observers.\n *\n * @param {Transaction} transaction\n * @param {Set} parentSubs Keys changed on this type. `null` if list was modified.\n */\n _callObserver (transaction, parentSubs) {\n super._callObserver(transaction, parentSubs);\n callTypeObservers(this, transaction, new YArrayEvent(this, transaction));\n }\n\n /**\n * Inserts new content at an index.\n *\n * Important: This function expects an array of content. Not just a content\n * object. The reason for this \"weirdness\" is that inserting several elements\n * is very efficient when it is done as a single operation.\n *\n * @example\n * // Insert character 'a' at position 0\n * yarray.insert(0, ['a'])\n * // Insert numbers 1, 2 at position 1\n * yarray.insert(1, [1, 2])\n *\n * @param {number} index The index to insert content at.\n * @param {Array} content The array of content\n */\n insert (index, content) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeListInsertGenerics(transaction, this, index, /** @type {any} */ (content));\n });\n } else {\n /** @type {Array} */ (this._prelimContent).splice(index, 0, ...content);\n }\n }\n\n /**\n * Appends content to this YArray.\n *\n * @param {Array} content Array of content to append.\n *\n * @todo Use the following implementation in all types.\n */\n push (content) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeListPushGenerics(transaction, this, /** @type {any} */ (content));\n });\n } else {\n /** @type {Array} */ (this._prelimContent).push(...content);\n }\n }\n\n /**\n * Preppends content to this YArray.\n *\n * @param {Array} content Array of content to preppend.\n */\n unshift (content) {\n this.insert(0, content);\n }\n\n /**\n * Deletes elements starting from an index.\n *\n * @param {number} index Index at which to start deleting elements\n * @param {number} length The number of elements to remove. Defaults to 1.\n */\n delete (index, length = 1) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeListDelete(transaction, this, index, length);\n });\n } else {\n /** @type {Array} */ (this._prelimContent).splice(index, length);\n }\n }\n\n /**\n * Returns the i-th element from a YArray.\n *\n * @param {number} index The index of the element to return from the YArray\n * @return {T}\n */\n get (index) {\n return typeListGet(this, index)\n }\n\n /**\n * Transforms this YArray to a JavaScript Array.\n *\n * @return {Array}\n */\n toArray () {\n return typeListToArray(this)\n }\n\n /**\n * Transforms this YArray to a JavaScript Array.\n *\n * @param {number} [start]\n * @param {number} [end]\n * @return {Array}\n */\n slice (start = 0, end = this.length) {\n return typeListSlice(this, start, end)\n }\n\n /**\n * Transforms this Shared Type to a JSON object.\n *\n * @return {Array}\n */\n toJSON () {\n return this.map(c => c instanceof AbstractType ? c.toJSON() : c)\n }\n\n /**\n * Returns an Array with the result of calling a provided function on every\n * element of this YArray.\n *\n * @template M\n * @param {function(T,number,YArray):M} f Function that produces an element of the new Array\n * @return {Array} A new array with each element being the result of the\n * callback function\n */\n map (f) {\n return typeListMap(this, /** @type {any} */ (f))\n }\n\n /**\n * Executes a provided function once on overy element of this YArray.\n *\n * @param {function(T,number,YArray):void} f A function to execute on every element of this YArray.\n */\n forEach (f) {\n typeListForEach(this, f);\n }\n\n /**\n * @return {IterableIterator}\n */\n [Symbol.iterator] () {\n return typeListCreateIterator(this)\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n */\n _write (encoder) {\n encoder.writeTypeRef(YArrayRefID);\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder\n *\n * @private\n * @function\n */\nconst readYArray = _decoder => new YArray();\n\n/**\n * @template T\n * @extends YEvent>\n * Event that describes the changes on a YMap.\n */\nclass YMapEvent extends YEvent {\n /**\n * @param {YMap} ymap The YArray that changed.\n * @param {Transaction} transaction\n * @param {Set} subs The keys that changed.\n */\n constructor (ymap, transaction, subs) {\n super(ymap, transaction);\n this.keysChanged = subs;\n }\n}\n\n/**\n * @template MapType\n * A shared Map implementation.\n *\n * @extends AbstractType>\n * @implements {Iterable}\n */\nclass YMap extends AbstractType {\n /**\n *\n * @param {Iterable=} entries - an optional iterable to initialize the YMap\n */\n constructor (entries) {\n super();\n /**\n * @type {Map?}\n * @private\n */\n this._prelimContent = null;\n\n if (entries === undefined) {\n this._prelimContent = new Map();\n } else {\n this._prelimContent = new Map(entries);\n }\n }\n\n /**\n * Integrate this type into the Yjs instance.\n *\n * * Save this struct in the os\n * * This type is sent to other client\n * * Observer functions are fired\n *\n * @param {Doc} y The Yjs instance\n * @param {Item} item\n */\n _integrate (y, item) {\n super._integrate(y, item)\n ;/** @type {Map} */ (this._prelimContent).forEach((value, key) => {\n this.set(key, value);\n });\n this._prelimContent = null;\n }\n\n /**\n * @return {YMap}\n */\n _copy () {\n return new YMap()\n }\n\n /**\n * @return {YMap}\n */\n clone () {\n /**\n * @type {YMap}\n */\n const map = new YMap();\n this.forEach((value, key) => {\n map.set(key, value instanceof AbstractType ? /** @type {typeof value} */ (value.clone()) : value);\n });\n return map\n }\n\n /**\n * Creates YMapEvent and calls observers.\n *\n * @param {Transaction} transaction\n * @param {Set} parentSubs Keys changed on this type. `null` if list was modified.\n */\n _callObserver (transaction, parentSubs) {\n callTypeObservers(this, transaction, new YMapEvent(this, transaction, parentSubs));\n }\n\n /**\n * Transforms this Shared Type to a JSON object.\n *\n * @return {Object}\n */\n toJSON () {\n /**\n * @type {Object}\n */\n const map = {};\n this._map.forEach((item, key) => {\n if (!item.deleted) {\n const v = item.content.getContent()[item.length - 1];\n map[key] = v instanceof AbstractType ? v.toJSON() : v;\n }\n });\n return map\n }\n\n /**\n * Returns the size of the YMap (count of key/value pairs)\n *\n * @return {number}\n */\n get size () {\n return [...createMapIterator(this._map)].length\n }\n\n /**\n * Returns the keys for each element in the YMap Type.\n *\n * @return {IterableIterator}\n */\n keys () {\n return iterator.iteratorMap(createMapIterator(this._map), /** @param {any} v */ v => v[0])\n }\n\n /**\n * Returns the values for each element in the YMap Type.\n *\n * @return {IterableIterator}\n */\n values () {\n return iterator.iteratorMap(createMapIterator(this._map), /** @param {any} v */ v => v[1].content.getContent()[v[1].length - 1])\n }\n\n /**\n * Returns an Iterator of [key, value] pairs\n *\n * @return {IterableIterator}\n */\n entries () {\n return iterator.iteratorMap(createMapIterator(this._map), /** @param {any} v */ v => [v[0], v[1].content.getContent()[v[1].length - 1]])\n }\n\n /**\n * Executes a provided function on once on every key-value pair.\n *\n * @param {function(MapType,string,YMap):void} f A function to execute on every element of this YArray.\n */\n forEach (f) {\n this._map.forEach((item, key) => {\n if (!item.deleted) {\n f(item.content.getContent()[item.length - 1], key, this);\n }\n });\n }\n\n /**\n * Returns an Iterator of [key, value] pairs\n *\n * @return {IterableIterator}\n */\n [Symbol.iterator] () {\n return this.entries()\n }\n\n /**\n * Remove a specified element from this YMap.\n *\n * @param {string} key The key of the element to remove.\n */\n delete (key) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeMapDelete(transaction, this, key);\n });\n } else {\n /** @type {Map} */ (this._prelimContent).delete(key);\n }\n }\n\n /**\n * Adds or updates an element with a specified key and value.\n * @template {MapType} VAL\n *\n * @param {string} key The key of the element to add to this YMap\n * @param {VAL} value The value of the element to add\n * @return {VAL}\n */\n set (key, value) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeMapSet(transaction, this, key, /** @type {any} */ (value));\n });\n } else {\n /** @type {Map} */ (this._prelimContent).set(key, value);\n }\n return value\n }\n\n /**\n * Returns a specified element from this YMap.\n *\n * @param {string} key\n * @return {MapType|undefined}\n */\n get (key) {\n return /** @type {any} */ (typeMapGet(this, key))\n }\n\n /**\n * Returns a boolean indicating whether the specified key exists or not.\n *\n * @param {string} key The key to test.\n * @return {boolean}\n */\n has (key) {\n return typeMapHas(this, key)\n }\n\n /**\n * Removes all elements from this YMap.\n */\n clear () {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n this.forEach(function (_value, key, map) {\n typeMapDelete(transaction, map, key);\n });\n });\n } else {\n /** @type {Map} */ (this._prelimContent).clear();\n }\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n */\n _write (encoder) {\n encoder.writeTypeRef(YMapRefID);\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder\n *\n * @private\n * @function\n */\nconst readYMap = _decoder => new YMap();\n\n/**\n * @param {any} a\n * @param {any} b\n * @return {boolean}\n */\nconst equalAttrs = (a, b) => a === b || (typeof a === 'object' && typeof b === 'object' && a && b && object.equalFlat(a, b));\n\nclass ItemTextListPosition {\n /**\n * @param {Item|null} left\n * @param {Item|null} right\n * @param {number} index\n * @param {Map} currentAttributes\n */\n constructor (left, right, index, currentAttributes) {\n this.left = left;\n this.right = right;\n this.index = index;\n this.currentAttributes = currentAttributes;\n }\n\n /**\n * Only call this if you know that this.right is defined\n */\n forward () {\n if (this.right === null) {\n error.unexpectedCase();\n }\n switch (this.right.content.constructor) {\n case ContentFormat:\n if (!this.right.deleted) {\n updateCurrentAttributes(this.currentAttributes, /** @type {ContentFormat} */ (this.right.content));\n }\n break\n default:\n if (!this.right.deleted) {\n this.index += this.right.length;\n }\n break\n }\n this.left = this.right;\n this.right = this.right.right;\n }\n}\n\n/**\n * @param {Transaction} transaction\n * @param {ItemTextListPosition} pos\n * @param {number} count steps to move forward\n * @return {ItemTextListPosition}\n *\n * @private\n * @function\n */\nconst findNextPosition = (transaction, pos, count) => {\n while (pos.right !== null && count > 0) {\n switch (pos.right.content.constructor) {\n case ContentFormat:\n if (!pos.right.deleted) {\n updateCurrentAttributes(pos.currentAttributes, /** @type {ContentFormat} */ (pos.right.content));\n }\n break\n default:\n if (!pos.right.deleted) {\n if (count < pos.right.length) {\n // split right\n getItemCleanStart(transaction, createID(pos.right.id.client, pos.right.id.clock + count));\n }\n pos.index += pos.right.length;\n count -= pos.right.length;\n }\n break\n }\n pos.left = pos.right;\n pos.right = pos.right.right;\n // pos.forward() - we don't forward because that would halve the performance because we already do the checks above\n }\n return pos\n};\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {number} index\n * @return {ItemTextListPosition}\n *\n * @private\n * @function\n */\nconst findPosition = (transaction, parent, index) => {\n const currentAttributes = new Map();\n const marker = findMarker(parent, index);\n if (marker) {\n const pos = new ItemTextListPosition(marker.p.left, marker.p, marker.index, currentAttributes);\n return findNextPosition(transaction, pos, index - marker.index)\n } else {\n const pos = new ItemTextListPosition(null, parent._start, 0, currentAttributes);\n return findNextPosition(transaction, pos, index)\n }\n};\n\n/**\n * Negate applied formats\n *\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {ItemTextListPosition} currPos\n * @param {Map} negatedAttributes\n *\n * @private\n * @function\n */\nconst insertNegatedAttributes = (transaction, parent, currPos, negatedAttributes) => {\n // check if we really need to remove attributes\n while (\n currPos.right !== null && (\n currPos.right.deleted === true || (\n currPos.right.content.constructor === ContentFormat &&\n equalAttrs(negatedAttributes.get(/** @type {ContentFormat} */ (currPos.right.content).key), /** @type {ContentFormat} */ (currPos.right.content).value)\n )\n )\n ) {\n if (!currPos.right.deleted) {\n negatedAttributes.delete(/** @type {ContentFormat} */ (currPos.right.content).key);\n }\n currPos.forward();\n }\n const doc = transaction.doc;\n const ownClientId = doc.clientID;\n negatedAttributes.forEach((val, key) => {\n const left = currPos.left;\n const right = currPos.right;\n const nextFormat = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentFormat(key, val));\n nextFormat.integrate(transaction, 0);\n currPos.right = nextFormat;\n currPos.forward();\n });\n};\n\n/**\n * @param {Map} currentAttributes\n * @param {ContentFormat} format\n *\n * @private\n * @function\n */\nconst updateCurrentAttributes = (currentAttributes, format) => {\n const { key, value } = format;\n if (value === null) {\n currentAttributes.delete(key);\n } else {\n currentAttributes.set(key, value);\n }\n};\n\n/**\n * @param {ItemTextListPosition} currPos\n * @param {Object} attributes\n *\n * @private\n * @function\n */\nconst minimizeAttributeChanges = (currPos, attributes) => {\n // go right while attributes[right.key] === right.value (or right is deleted)\n while (true) {\n if (currPos.right === null) {\n break\n } else if (currPos.right.deleted || (currPos.right.content.constructor === ContentFormat && equalAttrs(attributes[(/** @type {ContentFormat} */ (currPos.right.content)).key] || null, /** @type {ContentFormat} */ (currPos.right.content).value))) ; else {\n break\n }\n currPos.forward();\n }\n};\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {ItemTextListPosition} currPos\n * @param {Object} attributes\n * @return {Map}\n *\n * @private\n * @function\n **/\nconst insertAttributes = (transaction, parent, currPos, attributes) => {\n const doc = transaction.doc;\n const ownClientId = doc.clientID;\n const negatedAttributes = new Map();\n // insert format-start items\n for (const key in attributes) {\n const val = attributes[key];\n const currentVal = currPos.currentAttributes.get(key) || null;\n if (!equalAttrs(currentVal, val)) {\n // save negated attribute (set null if currentVal undefined)\n negatedAttributes.set(key, currentVal);\n const { left, right } = currPos;\n currPos.right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentFormat(key, val));\n currPos.right.integrate(transaction, 0);\n currPos.forward();\n }\n }\n return negatedAttributes\n};\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {ItemTextListPosition} currPos\n * @param {string|object|AbstractType} text\n * @param {Object} attributes\n *\n * @private\n * @function\n **/\nconst insertText = (transaction, parent, currPos, text, attributes) => {\n currPos.currentAttributes.forEach((_val, key) => {\n if (attributes[key] === undefined) {\n attributes[key] = null;\n }\n });\n const doc = transaction.doc;\n const ownClientId = doc.clientID;\n minimizeAttributeChanges(currPos, attributes);\n const negatedAttributes = insertAttributes(transaction, parent, currPos, attributes);\n // insert content\n const content = text.constructor === String ? new ContentString(/** @type {string} */ (text)) : (text instanceof AbstractType ? new ContentType(text) : new ContentEmbed(text));\n let { left, right, index } = currPos;\n if (parent._searchMarker) {\n updateMarkerChanges(parent._searchMarker, currPos.index, content.getLength());\n }\n right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, content);\n right.integrate(transaction, 0);\n currPos.right = right;\n currPos.index = index;\n currPos.forward();\n insertNegatedAttributes(transaction, parent, currPos, negatedAttributes);\n};\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {ItemTextListPosition} currPos\n * @param {number} length\n * @param {Object} attributes\n *\n * @private\n * @function\n */\nconst formatText = (transaction, parent, currPos, length, attributes) => {\n const doc = transaction.doc;\n const ownClientId = doc.clientID;\n minimizeAttributeChanges(currPos, attributes);\n const negatedAttributes = insertAttributes(transaction, parent, currPos, attributes);\n // iterate until first non-format or null is found\n // delete all formats with attributes[format.key] != null\n // also check the attributes after the first non-format as we do not want to insert redundant negated attributes there\n // eslint-disable-next-line no-labels\n iterationLoop: while (\n currPos.right !== null &&\n (length > 0 ||\n (\n negatedAttributes.size > 0 &&\n (currPos.right.deleted || currPos.right.content.constructor === ContentFormat)\n )\n )\n ) {\n if (!currPos.right.deleted) {\n switch (currPos.right.content.constructor) {\n case ContentFormat: {\n const { key, value } = /** @type {ContentFormat} */ (currPos.right.content);\n const attr = attributes[key];\n if (attr !== undefined) {\n if (equalAttrs(attr, value)) {\n negatedAttributes.delete(key);\n } else {\n if (length === 0) {\n // no need to further extend negatedAttributes\n // eslint-disable-next-line no-labels\n break iterationLoop\n }\n negatedAttributes.set(key, value);\n }\n currPos.right.delete(transaction);\n } else {\n currPos.currentAttributes.set(key, value);\n }\n break\n }\n default:\n if (length < currPos.right.length) {\n getItemCleanStart(transaction, createID(currPos.right.id.client, currPos.right.id.clock + length));\n }\n length -= currPos.right.length;\n break\n }\n }\n currPos.forward();\n }\n // Quill just assumes that the editor starts with a newline and that it always\n // ends with a newline. We only insert that newline when a new newline is\n // inserted - i.e when length is bigger than type.length\n if (length > 0) {\n let newlines = '';\n for (; length > 0; length--) {\n newlines += '\\n';\n }\n currPos.right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), currPos.left, currPos.left && currPos.left.lastId, currPos.right, currPos.right && currPos.right.id, parent, null, new ContentString(newlines));\n currPos.right.integrate(transaction, 0);\n currPos.forward();\n }\n insertNegatedAttributes(transaction, parent, currPos, negatedAttributes);\n};\n\n/**\n * Call this function after string content has been deleted in order to\n * clean up formatting Items.\n *\n * @param {Transaction} transaction\n * @param {Item} start\n * @param {Item|null} curr exclusive end, automatically iterates to the next Content Item\n * @param {Map} startAttributes\n * @param {Map} currAttributes\n * @return {number} The amount of formatting Items deleted.\n *\n * @function\n */\nconst cleanupFormattingGap = (transaction, start, curr, startAttributes, currAttributes) => {\n /**\n * @type {Item|null}\n */\n let end = start;\n /**\n * @type {Map}\n */\n const endFormats = map.create();\n while (end && (!end.countable || end.deleted)) {\n if (!end.deleted && end.content.constructor === ContentFormat) {\n const cf = /** @type {ContentFormat} */ (end.content);\n endFormats.set(cf.key, cf);\n }\n end = end.right;\n }\n let cleanups = 0;\n let reachedCurr = false;\n while (start !== end) {\n if (curr === start) {\n reachedCurr = true;\n }\n if (!start.deleted) {\n const content = start.content;\n switch (content.constructor) {\n case ContentFormat: {\n const { key, value } = /** @type {ContentFormat} */ (content);\n const startAttrValue = startAttributes.get(key) || null;\n if (endFormats.get(key) !== content || startAttrValue === value) {\n // Either this format is overwritten or it is not necessary because the attribute already existed.\n start.delete(transaction);\n cleanups++;\n if (!reachedCurr && (currAttributes.get(key) || null) === value && startAttrValue !== value) {\n if (startAttrValue === null) {\n currAttributes.delete(key);\n } else {\n currAttributes.set(key, startAttrValue);\n }\n }\n }\n if (!reachedCurr && !start.deleted) {\n updateCurrentAttributes(currAttributes, /** @type {ContentFormat} */ (content));\n }\n break\n }\n }\n }\n start = /** @type {Item} */ (start.right);\n }\n return cleanups\n};\n\n/**\n * @param {Transaction} transaction\n * @param {Item | null} item\n */\nconst cleanupContextlessFormattingGap = (transaction, item) => {\n // iterate until item.right is null or content\n while (item && item.right && (item.right.deleted || !item.right.countable)) {\n item = item.right;\n }\n const attrs = new Set();\n // iterate back until a content item is found\n while (item && (item.deleted || !item.countable)) {\n if (!item.deleted && item.content.constructor === ContentFormat) {\n const key = /** @type {ContentFormat} */ (item.content).key;\n if (attrs.has(key)) {\n item.delete(transaction);\n } else {\n attrs.add(key);\n }\n }\n item = item.left;\n }\n};\n\n/**\n * This function is experimental and subject to change / be removed.\n *\n * Ideally, we don't need this function at all. Formatting attributes should be cleaned up\n * automatically after each change. This function iterates twice over the complete YText type\n * and removes unnecessary formatting attributes. This is also helpful for testing.\n *\n * This function won't be exported anymore as soon as there is confidence that the YText type works as intended.\n *\n * @param {YText} type\n * @return {number} How many formatting attributes have been cleaned up.\n */\nconst cleanupYTextFormatting = type => {\n let res = 0;\n transact(/** @type {Doc} */ (type.doc), transaction => {\n let start = /** @type {Item} */ (type._start);\n let end = type._start;\n let startAttributes = map.create();\n const currentAttributes = map.copy(startAttributes);\n while (end) {\n if (end.deleted === false) {\n switch (end.content.constructor) {\n case ContentFormat:\n updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (end.content));\n break\n default:\n res += cleanupFormattingGap(transaction, start, end, startAttributes, currentAttributes);\n startAttributes = map.copy(currentAttributes);\n start = end;\n break\n }\n }\n end = end.right;\n }\n });\n return res\n};\n\n/**\n * This will be called by the transction once the event handlers are called to potentially cleanup\n * formatting attributes.\n *\n * @param {Transaction} transaction\n */\nconst cleanupYTextAfterTransaction = transaction => {\n /**\n * @type {Set}\n */\n const needFullCleanup = new Set();\n // check if another formatting item was inserted\n const doc = transaction.doc;\n for (const [client, afterClock] of transaction.afterState.entries()) {\n const clock = transaction.beforeState.get(client) || 0;\n if (afterClock === clock) {\n continue\n }\n iterateStructs(transaction, /** @type {Array} */ (doc.store.clients.get(client)), clock, afterClock, item => {\n if (\n !item.deleted && /** @type {Item} */ (item).content.constructor === ContentFormat && item.constructor !== GC\n ) {\n needFullCleanup.add(/** @type {any} */ (item).parent);\n }\n });\n }\n // cleanup in a new transaction\n transact(doc, (t) => {\n iterateDeletedStructs(transaction, transaction.deleteSet, item => {\n if (item instanceof GC || !(/** @type {YText} */ (item.parent)._hasFormatting) || needFullCleanup.has(/** @type {YText} */ (item.parent))) {\n return\n }\n const parent = /** @type {YText} */ (item.parent);\n if (item.content.constructor === ContentFormat) {\n needFullCleanup.add(parent);\n } else {\n // If no formatting attribute was inserted or deleted, we can make due with contextless\n // formatting cleanups.\n // Contextless: it is not necessary to compute currentAttributes for the affected position.\n cleanupContextlessFormattingGap(t, item);\n }\n });\n // If a formatting item was inserted, we simply clean the whole type.\n // We need to compute currentAttributes for the current position anyway.\n for (const yText of needFullCleanup) {\n cleanupYTextFormatting(yText);\n }\n });\n};\n\n/**\n * @param {Transaction} transaction\n * @param {ItemTextListPosition} currPos\n * @param {number} length\n * @return {ItemTextListPosition}\n *\n * @private\n * @function\n */\nconst deleteText = (transaction, currPos, length) => {\n const startLength = length;\n const startAttrs = map.copy(currPos.currentAttributes);\n const start = currPos.right;\n while (length > 0 && currPos.right !== null) {\n if (currPos.right.deleted === false) {\n switch (currPos.right.content.constructor) {\n case ContentType:\n case ContentEmbed:\n case ContentString:\n if (length < currPos.right.length) {\n getItemCleanStart(transaction, createID(currPos.right.id.client, currPos.right.id.clock + length));\n }\n length -= currPos.right.length;\n currPos.right.delete(transaction);\n break\n }\n }\n currPos.forward();\n }\n if (start) {\n cleanupFormattingGap(transaction, start, currPos.right, startAttrs, currPos.currentAttributes);\n }\n const parent = /** @type {AbstractType} */ (/** @type {Item} */ (currPos.left || currPos.right).parent);\n if (parent._searchMarker) {\n updateMarkerChanges(parent._searchMarker, currPos.index, -startLength + length);\n }\n return currPos\n};\n\n/**\n * The Quill Delta format represents changes on a text document with\n * formatting information. For mor information visit {@link https://quilljs.com/docs/delta/|Quill Delta}\n *\n * @example\n * {\n * ops: [\n * { insert: 'Gandalf', attributes: { bold: true } },\n * { insert: ' the ' },\n * { insert: 'Grey', attributes: { color: '#cccccc' } }\n * ]\n * }\n *\n */\n\n/**\n * Attributes that can be assigned to a selection of text.\n *\n * @example\n * {\n * bold: true,\n * font-size: '40px'\n * }\n *\n * @typedef {Object} TextAttributes\n */\n\n/**\n * @extends YEvent\n * Event that describes the changes on a YText type.\n */\nclass YTextEvent extends YEvent {\n /**\n * @param {YText} ytext\n * @param {Transaction} transaction\n * @param {Set} subs The keys that changed\n */\n constructor (ytext, transaction, subs) {\n super(ytext, transaction);\n /**\n * Whether the children changed.\n * @type {Boolean}\n * @private\n */\n this.childListChanged = false;\n /**\n * Set of all changed attributes.\n * @type {Set}\n */\n this.keysChanged = new Set();\n subs.forEach((sub) => {\n if (sub === null) {\n this.childListChanged = true;\n } else {\n this.keysChanged.add(sub);\n }\n });\n }\n\n /**\n * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string, delete?:number, retain?:number}>}}\n */\n get changes () {\n if (this._changes === null) {\n /**\n * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string|AbstractType|object, delete?:number, retain?:number}>}}\n */\n const changes = {\n keys: this.keys,\n delta: this.delta,\n added: new Set(),\n deleted: new Set()\n };\n this._changes = changes;\n }\n return /** @type {any} */ (this._changes)\n }\n\n /**\n * Compute the changes in the delta format.\n * A {@link https://quilljs.com/docs/delta/|Quill Delta}) that represents the changes on the document.\n *\n * @type {Array<{insert?:string|object|AbstractType, delete?:number, retain?:number, attributes?: Object}>}\n *\n * @public\n */\n get delta () {\n if (this._delta === null) {\n const y = /** @type {Doc} */ (this.target.doc);\n /**\n * @type {Array<{insert?:string|object|AbstractType, delete?:number, retain?:number, attributes?: Object}>}\n */\n const delta = [];\n transact(y, transaction => {\n const currentAttributes = new Map(); // saves all current attributes for insert\n const oldAttributes = new Map();\n let item = this.target._start;\n /**\n * @type {string?}\n */\n let action = null;\n /**\n * @type {Object}\n */\n const attributes = {}; // counts added or removed new attributes for retain\n /**\n * @type {string|object}\n */\n let insert = '';\n let retain = 0;\n let deleteLen = 0;\n const addOp = () => {\n if (action !== null) {\n /**\n * @type {any}\n */\n let op = null;\n switch (action) {\n case 'delete':\n if (deleteLen > 0) {\n op = { delete: deleteLen };\n }\n deleteLen = 0;\n break\n case 'insert':\n if (typeof insert === 'object' || insert.length > 0) {\n op = { insert };\n if (currentAttributes.size > 0) {\n op.attributes = {};\n currentAttributes.forEach((value, key) => {\n if (value !== null) {\n op.attributes[key] = value;\n }\n });\n }\n }\n insert = '';\n break\n case 'retain':\n if (retain > 0) {\n op = { retain };\n if (!object.isEmpty(attributes)) {\n op.attributes = object.assign({}, attributes);\n }\n }\n retain = 0;\n break\n }\n if (op) delta.push(op);\n action = null;\n }\n };\n while (item !== null) {\n switch (item.content.constructor) {\n case ContentType:\n case ContentEmbed:\n if (this.adds(item)) {\n if (!this.deletes(item)) {\n addOp();\n action = 'insert';\n insert = item.content.getContent()[0];\n addOp();\n }\n } else if (this.deletes(item)) {\n if (action !== 'delete') {\n addOp();\n action = 'delete';\n }\n deleteLen += 1;\n } else if (!item.deleted) {\n if (action !== 'retain') {\n addOp();\n action = 'retain';\n }\n retain += 1;\n }\n break\n case ContentString:\n if (this.adds(item)) {\n if (!this.deletes(item)) {\n if (action !== 'insert') {\n addOp();\n action = 'insert';\n }\n insert += /** @type {ContentString} */ (item.content).str;\n }\n } else if (this.deletes(item)) {\n if (action !== 'delete') {\n addOp();\n action = 'delete';\n }\n deleteLen += item.length;\n } else if (!item.deleted) {\n if (action !== 'retain') {\n addOp();\n action = 'retain';\n }\n retain += item.length;\n }\n break\n case ContentFormat: {\n const { key, value } = /** @type {ContentFormat} */ (item.content);\n if (this.adds(item)) {\n if (!this.deletes(item)) {\n const curVal = currentAttributes.get(key) || null;\n if (!equalAttrs(curVal, value)) {\n if (action === 'retain') {\n addOp();\n }\n if (equalAttrs(value, (oldAttributes.get(key) || null))) {\n delete attributes[key];\n } else {\n attributes[key] = value;\n }\n } else if (value !== null) {\n item.delete(transaction);\n }\n }\n } else if (this.deletes(item)) {\n oldAttributes.set(key, value);\n const curVal = currentAttributes.get(key) || null;\n if (!equalAttrs(curVal, value)) {\n if (action === 'retain') {\n addOp();\n }\n attributes[key] = curVal;\n }\n } else if (!item.deleted) {\n oldAttributes.set(key, value);\n const attr = attributes[key];\n if (attr !== undefined) {\n if (!equalAttrs(attr, value)) {\n if (action === 'retain') {\n addOp();\n }\n if (value === null) {\n delete attributes[key];\n } else {\n attributes[key] = value;\n }\n } else if (attr !== null) { // this will be cleaned up automatically by the contextless cleanup function\n item.delete(transaction);\n }\n }\n }\n if (!item.deleted) {\n if (action === 'insert') {\n addOp();\n }\n updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (item.content));\n }\n break\n }\n }\n item = item.right;\n }\n addOp();\n while (delta.length > 0) {\n const lastOp = delta[delta.length - 1];\n if (lastOp.retain !== undefined && lastOp.attributes === undefined) {\n // retain delta's if they don't assign attributes\n delta.pop();\n } else {\n break\n }\n }\n });\n this._delta = delta;\n }\n return /** @type {any} */ (this._delta)\n }\n}\n\n/**\n * Type that represents text with formatting information.\n *\n * This type replaces y-richtext as this implementation is able to handle\n * block formats (format information on a paragraph), embeds (complex elements\n * like pictures and videos), and text formats (**bold**, *italic*).\n *\n * @extends AbstractType\n */\nclass YText extends AbstractType {\n /**\n * @param {String} [string] The initial value of the YText.\n */\n constructor (string) {\n super();\n /**\n * Array of pending operations on this type\n * @type {Array?}\n */\n this._pending = string !== undefined ? [() => this.insert(0, string)] : [];\n /**\n * @type {Array|null}\n */\n this._searchMarker = [];\n /**\n * Whether this YText contains formatting attributes.\n * This flag is updated when a formatting item is integrated (see ContentFormat.integrate)\n */\n this._hasFormatting = false;\n }\n\n /**\n * Number of characters of this text type.\n *\n * @type {number}\n */\n get length () {\n return this._length\n }\n\n /**\n * @param {Doc} y\n * @param {Item} item\n */\n _integrate (y, item) {\n super._integrate(y, item);\n try {\n /** @type {Array} */ (this._pending).forEach(f => f());\n } catch (e) {\n console.error(e);\n }\n this._pending = null;\n }\n\n _copy () {\n return new YText()\n }\n\n /**\n * @return {YText}\n */\n clone () {\n const text = new YText();\n text.applyDelta(this.toDelta());\n return text\n }\n\n /**\n * Creates YTextEvent and calls observers.\n *\n * @param {Transaction} transaction\n * @param {Set} parentSubs Keys changed on this type. `null` if list was modified.\n */\n _callObserver (transaction, parentSubs) {\n super._callObserver(transaction, parentSubs);\n const event = new YTextEvent(this, transaction, parentSubs);\n callTypeObservers(this, transaction, event);\n // If a remote change happened, we try to cleanup potential formatting duplicates.\n if (!transaction.local && this._hasFormatting) {\n transaction._needFormattingCleanup = true;\n }\n }\n\n /**\n * Returns the unformatted string representation of this YText type.\n *\n * @public\n */\n toString () {\n let str = '';\n /**\n * @type {Item|null}\n */\n let n = this._start;\n while (n !== null) {\n if (!n.deleted && n.countable && n.content.constructor === ContentString) {\n str += /** @type {ContentString} */ (n.content).str;\n }\n n = n.right;\n }\n return str\n }\n\n /**\n * Returns the unformatted string representation of this YText type.\n *\n * @return {string}\n * @public\n */\n toJSON () {\n return this.toString()\n }\n\n /**\n * Apply a {@link Delta} on this shared YText type.\n *\n * @param {any} delta The changes to apply on this element.\n * @param {object} opts\n * @param {boolean} [opts.sanitize] Sanitize input delta. Removes ending newlines if set to true.\n *\n *\n * @public\n */\n applyDelta (delta, { sanitize = true } = {}) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n const currPos = new ItemTextListPosition(null, this._start, 0, new Map());\n for (let i = 0; i < delta.length; i++) {\n const op = delta[i];\n if (op.insert !== undefined) {\n // Quill assumes that the content starts with an empty paragraph.\n // Yjs/Y.Text assumes that it starts empty. We always hide that\n // there is a newline at the end of the content.\n // If we omit this step, clients will see a different number of\n // paragraphs, but nothing bad will happen.\n const ins = (!sanitize && typeof op.insert === 'string' && i === delta.length - 1 && currPos.right === null && op.insert.slice(-1) === '\\n') ? op.insert.slice(0, -1) : op.insert;\n if (typeof ins !== 'string' || ins.length > 0) {\n insertText(transaction, this, currPos, ins, op.attributes || {});\n }\n } else if (op.retain !== undefined) {\n formatText(transaction, this, currPos, op.retain, op.attributes || {});\n } else if (op.delete !== undefined) {\n deleteText(transaction, currPos, op.delete);\n }\n }\n });\n } else {\n /** @type {Array} */ (this._pending).push(() => this.applyDelta(delta));\n }\n }\n\n /**\n * Returns the Delta representation of this YText type.\n *\n * @param {Snapshot} [snapshot]\n * @param {Snapshot} [prevSnapshot]\n * @param {function('removed' | 'added', ID):any} [computeYChange]\n * @return {any} The Delta representation of this type.\n *\n * @public\n */\n toDelta (snapshot, prevSnapshot, computeYChange) {\n /**\n * @type{Array}\n */\n const ops = [];\n const currentAttributes = new Map();\n const doc = /** @type {Doc} */ (this.doc);\n let str = '';\n let n = this._start;\n function packStr () {\n if (str.length > 0) {\n // pack str with attributes to ops\n /**\n * @type {Object}\n */\n const attributes = {};\n let addAttributes = false;\n currentAttributes.forEach((value, key) => {\n addAttributes = true;\n attributes[key] = value;\n });\n /**\n * @type {Object}\n */\n const op = { insert: str };\n if (addAttributes) {\n op.attributes = attributes;\n }\n ops.push(op);\n str = '';\n }\n }\n const computeDelta = () => {\n while (n !== null) {\n if (isVisible(n, snapshot) || (prevSnapshot !== undefined && isVisible(n, prevSnapshot))) {\n switch (n.content.constructor) {\n case ContentString: {\n const cur = currentAttributes.get('ychange');\n if (snapshot !== undefined && !isVisible(n, snapshot)) {\n if (cur === undefined || cur.user !== n.id.client || cur.type !== 'removed') {\n packStr();\n currentAttributes.set('ychange', computeYChange ? computeYChange('removed', n.id) : { type: 'removed' });\n }\n } else if (prevSnapshot !== undefined && !isVisible(n, prevSnapshot)) {\n if (cur === undefined || cur.user !== n.id.client || cur.type !== 'added') {\n packStr();\n currentAttributes.set('ychange', computeYChange ? computeYChange('added', n.id) : { type: 'added' });\n }\n } else if (cur !== undefined) {\n packStr();\n currentAttributes.delete('ychange');\n }\n str += /** @type {ContentString} */ (n.content).str;\n break\n }\n case ContentType:\n case ContentEmbed: {\n packStr();\n /**\n * @type {Object}\n */\n const op = {\n insert: n.content.getContent()[0]\n };\n if (currentAttributes.size > 0) {\n const attrs = /** @type {Object} */ ({});\n op.attributes = attrs;\n currentAttributes.forEach((value, key) => {\n attrs[key] = value;\n });\n }\n ops.push(op);\n break\n }\n case ContentFormat:\n if (isVisible(n, snapshot)) {\n packStr();\n updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (n.content));\n }\n break\n }\n }\n n = n.right;\n }\n packStr();\n };\n if (snapshot || prevSnapshot) {\n // snapshots are merged again after the transaction, so we need to keep the\n // transaction alive until we are done\n transact(doc, transaction => {\n if (snapshot) {\n splitSnapshotAffectedStructs(transaction, snapshot);\n }\n if (prevSnapshot) {\n splitSnapshotAffectedStructs(transaction, prevSnapshot);\n }\n computeDelta();\n }, 'cleanup');\n } else {\n computeDelta();\n }\n return ops\n }\n\n /**\n * Insert text at a given index.\n *\n * @param {number} index The index at which to start inserting.\n * @param {String} text The text to insert at the specified position.\n * @param {TextAttributes} [attributes] Optionally define some formatting\n * information to apply on the inserted\n * Text.\n * @public\n */\n insert (index, text, attributes) {\n if (text.length <= 0) {\n return\n }\n const y = this.doc;\n if (y !== null) {\n transact(y, transaction => {\n const pos = findPosition(transaction, this, index);\n if (!attributes) {\n attributes = {};\n // @ts-ignore\n pos.currentAttributes.forEach((v, k) => { attributes[k] = v; });\n }\n insertText(transaction, this, pos, text, attributes);\n });\n } else {\n /** @type {Array} */ (this._pending).push(() => this.insert(index, text, attributes));\n }\n }\n\n /**\n * Inserts an embed at a index.\n *\n * @param {number} index The index to insert the embed at.\n * @param {Object | AbstractType} embed The Object that represents the embed.\n * @param {TextAttributes} attributes Attribute information to apply on the\n * embed\n *\n * @public\n */\n insertEmbed (index, embed, attributes = {}) {\n const y = this.doc;\n if (y !== null) {\n transact(y, transaction => {\n const pos = findPosition(transaction, this, index);\n insertText(transaction, this, pos, embed, attributes);\n });\n } else {\n /** @type {Array} */ (this._pending).push(() => this.insertEmbed(index, embed, attributes));\n }\n }\n\n /**\n * Deletes text starting from an index.\n *\n * @param {number} index Index at which to start deleting.\n * @param {number} length The number of characters to remove. Defaults to 1.\n *\n * @public\n */\n delete (index, length) {\n if (length === 0) {\n return\n }\n const y = this.doc;\n if (y !== null) {\n transact(y, transaction => {\n deleteText(transaction, findPosition(transaction, this, index), length);\n });\n } else {\n /** @type {Array} */ (this._pending).push(() => this.delete(index, length));\n }\n }\n\n /**\n * Assigns properties to a range of text.\n *\n * @param {number} index The position where to start formatting.\n * @param {number} length The amount of characters to assign properties to.\n * @param {TextAttributes} attributes Attribute information to apply on the\n * text.\n *\n * @public\n */\n format (index, length, attributes) {\n if (length === 0) {\n return\n }\n const y = this.doc;\n if (y !== null) {\n transact(y, transaction => {\n const pos = findPosition(transaction, this, index);\n if (pos.right === null) {\n return\n }\n formatText(transaction, this, pos, length, attributes);\n });\n } else {\n /** @type {Array} */ (this._pending).push(() => this.format(index, length, attributes));\n }\n }\n\n /**\n * Removes an attribute.\n *\n * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.\n *\n * @param {String} attributeName The attribute name that is to be removed.\n *\n * @public\n */\n removeAttribute (attributeName) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeMapDelete(transaction, this, attributeName);\n });\n } else {\n /** @type {Array} */ (this._pending).push(() => this.removeAttribute(attributeName));\n }\n }\n\n /**\n * Sets or updates an attribute.\n *\n * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.\n *\n * @param {String} attributeName The attribute name that is to be set.\n * @param {any} attributeValue The attribute value that is to be set.\n *\n * @public\n */\n setAttribute (attributeName, attributeValue) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeMapSet(transaction, this, attributeName, attributeValue);\n });\n } else {\n /** @type {Array} */ (this._pending).push(() => this.setAttribute(attributeName, attributeValue));\n }\n }\n\n /**\n * Returns an attribute value that belongs to the attribute name.\n *\n * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.\n *\n * @param {String} attributeName The attribute name that identifies the\n * queried value.\n * @return {any} The queried attribute value.\n *\n * @public\n */\n getAttribute (attributeName) {\n return /** @type {any} */ (typeMapGet(this, attributeName))\n }\n\n /**\n * Returns all attribute name/value pairs in a JSON Object.\n *\n * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.\n *\n * @return {Object} A JSON Object that describes the attributes.\n *\n * @public\n */\n getAttributes () {\n return typeMapGetAll(this)\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n */\n _write (encoder) {\n encoder.writeTypeRef(YTextRefID);\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder\n * @return {YText}\n *\n * @private\n * @function\n */\nconst readYText = _decoder => new YText();\n\n/**\n * @module YXml\n */\n\n/**\n * Define the elements to which a set of CSS queries apply.\n * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors|CSS_Selectors}\n *\n * @example\n * query = '.classSelector'\n * query = 'nodeSelector'\n * query = '#idSelector'\n *\n * @typedef {string} CSS_Selector\n */\n\n/**\n * Dom filter function.\n *\n * @callback domFilter\n * @param {string} nodeName The nodeName of the element\n * @param {Map} attributes The map of attributes.\n * @return {boolean} Whether to include the Dom node in the YXmlElement.\n */\n\n/**\n * Represents a subset of the nodes of a YXmlElement / YXmlFragment and a\n * position within them.\n *\n * Can be created with {@link YXmlFragment#createTreeWalker}\n *\n * @public\n * @implements {Iterable}\n */\nclass YXmlTreeWalker {\n /**\n * @param {YXmlFragment | YXmlElement} root\n * @param {function(AbstractType):boolean} [f]\n */\n constructor (root, f = () => true) {\n this._filter = f;\n this._root = root;\n /**\n * @type {Item}\n */\n this._currentNode = /** @type {Item} */ (root._start);\n this._firstCall = true;\n }\n\n [Symbol.iterator] () {\n return this\n }\n\n /**\n * Get the next node.\n *\n * @return {IteratorResult} The next node.\n *\n * @public\n */\n next () {\n /**\n * @type {Item|null}\n */\n let n = this._currentNode;\n let type = n && n.content && /** @type {any} */ (n.content).type;\n if (n !== null && (!this._firstCall || n.deleted || !this._filter(type))) { // if first call, we check if we can use the first item\n do {\n type = /** @type {any} */ (n.content).type;\n if (!n.deleted && (type.constructor === YXmlElement || type.constructor === YXmlFragment) && type._start !== null) {\n // walk down in the tree\n n = type._start;\n } else {\n // walk right or up in the tree\n while (n !== null) {\n if (n.right !== null) {\n n = n.right;\n break\n } else if (n.parent === this._root) {\n n = null;\n } else {\n n = /** @type {AbstractType} */ (n.parent)._item;\n }\n }\n }\n } while (n !== null && (n.deleted || !this._filter(/** @type {ContentType} */ (n.content).type)))\n }\n this._firstCall = false;\n if (n === null) {\n // @ts-ignore\n return { value: undefined, done: true }\n }\n this._currentNode = n;\n return { value: /** @type {any} */ (n.content).type, done: false }\n }\n}\n\n/**\n * Represents a list of {@link YXmlElement}.and {@link YXmlText} types.\n * A YxmlFragment is similar to a {@link YXmlElement}, but it does not have a\n * nodeName and it does not have attributes. Though it can be bound to a DOM\n * element - in this case the attributes and the nodeName are not shared.\n *\n * @public\n * @extends AbstractType\n */\nclass YXmlFragment extends AbstractType {\n constructor () {\n super();\n /**\n * @type {Array|null}\n */\n this._prelimContent = [];\n }\n\n /**\n * @type {YXmlElement|YXmlText|null}\n */\n get firstChild () {\n const first = this._first;\n return first ? first.content.getContent()[0] : null\n }\n\n /**\n * Integrate this type into the Yjs instance.\n *\n * * Save this struct in the os\n * * This type is sent to other client\n * * Observer functions are fired\n *\n * @param {Doc} y The Yjs instance\n * @param {Item} item\n */\n _integrate (y, item) {\n super._integrate(y, item);\n this.insert(0, /** @type {Array} */ (this._prelimContent));\n this._prelimContent = null;\n }\n\n _copy () {\n return new YXmlFragment()\n }\n\n /**\n * @return {YXmlFragment}\n */\n clone () {\n const el = new YXmlFragment();\n // @ts-ignore\n el.insert(0, this.toArray().map(item => item instanceof AbstractType ? item.clone() : item));\n return el\n }\n\n get length () {\n return this._prelimContent === null ? this._length : this._prelimContent.length\n }\n\n /**\n * Create a subtree of childNodes.\n *\n * @example\n * const walker = elem.createTreeWalker(dom => dom.nodeName === 'div')\n * for (let node in walker) {\n * // `node` is a div node\n * nop(node)\n * }\n *\n * @param {function(AbstractType):boolean} filter Function that is called on each child element and\n * returns a Boolean indicating whether the child\n * is to be included in the subtree.\n * @return {YXmlTreeWalker} A subtree and a position within it.\n *\n * @public\n */\n createTreeWalker (filter) {\n return new YXmlTreeWalker(this, filter)\n }\n\n /**\n * Returns the first YXmlElement that matches the query.\n * Similar to DOM's {@link querySelector}.\n *\n * Query support:\n * - tagname\n * TODO:\n * - id\n * - attribute\n *\n * @param {CSS_Selector} query The query on the children.\n * @return {YXmlElement|YXmlText|YXmlHook|null} The first element that matches the query or null.\n *\n * @public\n */\n querySelector (query) {\n query = query.toUpperCase();\n // @ts-ignore\n const iterator = new YXmlTreeWalker(this, element => element.nodeName && element.nodeName.toUpperCase() === query);\n const next = iterator.next();\n if (next.done) {\n return null\n } else {\n return next.value\n }\n }\n\n /**\n * Returns all YXmlElements that match the query.\n * Similar to Dom's {@link querySelectorAll}.\n *\n * @todo Does not yet support all queries. Currently only query by tagName.\n *\n * @param {CSS_Selector} query The query on the children\n * @return {Array} The elements that match this query.\n *\n * @public\n */\n querySelectorAll (query) {\n query = query.toUpperCase();\n // @ts-ignore\n return array.from(new YXmlTreeWalker(this, element => element.nodeName && element.nodeName.toUpperCase() === query))\n }\n\n /**\n * Creates YXmlEvent and calls observers.\n *\n * @param {Transaction} transaction\n * @param {Set} parentSubs Keys changed on this type. `null` if list was modified.\n */\n _callObserver (transaction, parentSubs) {\n callTypeObservers(this, transaction, new YXmlEvent(this, parentSubs, transaction));\n }\n\n /**\n * Get the string representation of all the children of this YXmlFragment.\n *\n * @return {string} The string representation of all children.\n */\n toString () {\n return typeListMap(this, xml => xml.toString()).join('')\n }\n\n /**\n * @return {string}\n */\n toJSON () {\n return this.toString()\n }\n\n /**\n * Creates a Dom Element that mirrors this YXmlElement.\n *\n * @param {Document} [_document=document] The document object (you must define\n * this when calling this method in\n * nodejs)\n * @param {Object} [hooks={}] Optional property to customize how hooks\n * are presented in the DOM\n * @param {any} [binding] You should not set this property. This is\n * used if DomBinding wants to create a\n * association to the created DOM type.\n * @return {Node} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element}\n *\n * @public\n */\n toDOM (_document = document, hooks = {}, binding) {\n const fragment = _document.createDocumentFragment();\n if (binding !== undefined) {\n binding._createAssociation(fragment, this);\n }\n typeListForEach(this, xmlType => {\n fragment.insertBefore(xmlType.toDOM(_document, hooks, binding), null);\n });\n return fragment\n }\n\n /**\n * Inserts new content at an index.\n *\n * @example\n * // Insert character 'a' at position 0\n * xml.insert(0, [new Y.XmlText('text')])\n *\n * @param {number} index The index to insert content at\n * @param {Array} content The array of content\n */\n insert (index, content) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeListInsertGenerics(transaction, this, index, content);\n });\n } else {\n // @ts-ignore _prelimContent is defined because this is not yet integrated\n this._prelimContent.splice(index, 0, ...content);\n }\n }\n\n /**\n * Inserts new content at an index.\n *\n * @example\n * // Insert character 'a' at position 0\n * xml.insert(0, [new Y.XmlText('text')])\n *\n * @param {null|Item|YXmlElement|YXmlText} ref The index to insert content at\n * @param {Array} content The array of content\n */\n insertAfter (ref, content) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n const refItem = (ref && ref instanceof AbstractType) ? ref._item : ref;\n typeListInsertGenericsAfter(transaction, this, refItem, content);\n });\n } else {\n const pc = /** @type {Array} */ (this._prelimContent);\n const index = ref === null ? 0 : pc.findIndex(el => el === ref) + 1;\n if (index === 0 && ref !== null) {\n throw error.create('Reference item not found')\n }\n pc.splice(index, 0, ...content);\n }\n }\n\n /**\n * Deletes elements starting from an index.\n *\n * @param {number} index Index at which to start deleting elements\n * @param {number} [length=1] The number of elements to remove. Defaults to 1.\n */\n delete (index, length = 1) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeListDelete(transaction, this, index, length);\n });\n } else {\n // @ts-ignore _prelimContent is defined because this is not yet integrated\n this._prelimContent.splice(index, length);\n }\n }\n\n /**\n * Transforms this YArray to a JavaScript Array.\n *\n * @return {Array}\n */\n toArray () {\n return typeListToArray(this)\n }\n\n /**\n * Appends content to this YArray.\n *\n * @param {Array} content Array of content to append.\n */\n push (content) {\n this.insert(this.length, content);\n }\n\n /**\n * Preppends content to this YArray.\n *\n * @param {Array} content Array of content to preppend.\n */\n unshift (content) {\n this.insert(0, content);\n }\n\n /**\n * Returns the i-th element from a YArray.\n *\n * @param {number} index The index of the element to return from the YArray\n * @return {YXmlElement|YXmlText}\n */\n get (index) {\n return typeListGet(this, index)\n }\n\n /**\n * Transforms this YArray to a JavaScript Array.\n *\n * @param {number} [start]\n * @param {number} [end]\n * @return {Array}\n */\n slice (start = 0, end = this.length) {\n return typeListSlice(this, start, end)\n }\n\n /**\n * Executes a provided function on once on overy child element.\n *\n * @param {function(YXmlElement|YXmlText,number, typeof self):void} f A function to execute on every element of this YArray.\n */\n forEach (f) {\n typeListForEach(this, f);\n }\n\n /**\n * Transform the properties of this type to binary and write it to an\n * BinaryEncoder.\n *\n * This is called when this Item is sent to a remote peer.\n *\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.\n */\n _write (encoder) {\n encoder.writeTypeRef(YXmlFragmentRefID);\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder\n * @return {YXmlFragment}\n *\n * @private\n * @function\n */\nconst readYXmlFragment = _decoder => new YXmlFragment();\n\n/**\n * @typedef {Object|number|null|Array|string|Uint8Array|AbstractType} ValueTypes\n */\n\n/**\n * An YXmlElement imitates the behavior of a\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element}.\n *\n * * An YXmlElement has attributes (key value pairs)\n * * An YXmlElement has childElements that must inherit from YXmlElement\n *\n * @template {{ [key: string]: ValueTypes }} [KV={ [key: string]: string }]\n */\nclass YXmlElement extends YXmlFragment {\n constructor (nodeName = 'UNDEFINED') {\n super();\n this.nodeName = nodeName;\n /**\n * @type {Map|null}\n */\n this._prelimAttrs = new Map();\n }\n\n /**\n * @type {YXmlElement|YXmlText|null}\n */\n get nextSibling () {\n const n = this._item ? this._item.next : null;\n return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null\n }\n\n /**\n * @type {YXmlElement|YXmlText|null}\n */\n get prevSibling () {\n const n = this._item ? this._item.prev : null;\n return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null\n }\n\n /**\n * Integrate this type into the Yjs instance.\n *\n * * Save this struct in the os\n * * This type is sent to other client\n * * Observer functions are fired\n *\n * @param {Doc} y The Yjs instance\n * @param {Item} item\n */\n _integrate (y, item) {\n super._integrate(y, item)\n ;(/** @type {Map} */ (this._prelimAttrs)).forEach((value, key) => {\n this.setAttribute(key, value);\n });\n this._prelimAttrs = null;\n }\n\n /**\n * Creates an Item with the same effect as this Item (without position effect)\n *\n * @return {YXmlElement}\n */\n _copy () {\n return new YXmlElement(this.nodeName)\n }\n\n /**\n * @return {YXmlElement}\n */\n clone () {\n /**\n * @type {YXmlElement}\n */\n const el = new YXmlElement(this.nodeName);\n const attrs = this.getAttributes();\n object.forEach(attrs, (value, key) => {\n if (typeof value === 'string') {\n el.setAttribute(key, value);\n }\n });\n // @ts-ignore\n el.insert(0, this.toArray().map(item => item instanceof AbstractType ? item.clone() : item));\n return el\n }\n\n /**\n * Returns the XML serialization of this YXmlElement.\n * The attributes are ordered by attribute-name, so you can easily use this\n * method to compare YXmlElements\n *\n * @return {string} The string representation of this type.\n *\n * @public\n */\n toString () {\n const attrs = this.getAttributes();\n const stringBuilder = [];\n const keys = [];\n for (const key in attrs) {\n keys.push(key);\n }\n keys.sort();\n const keysLen = keys.length;\n for (let i = 0; i < keysLen; i++) {\n const key = keys[i];\n stringBuilder.push(key + '=\"' + attrs[key] + '\"');\n }\n const nodeName = this.nodeName.toLocaleLowerCase();\n const attrsString = stringBuilder.length > 0 ? ' ' + stringBuilder.join(' ') : '';\n return `<${nodeName}${attrsString}>${super.toString()}`\n }\n\n /**\n * Removes an attribute from this YXmlElement.\n *\n * @param {string} attributeName The attribute name that is to be removed.\n *\n * @public\n */\n removeAttribute (attributeName) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeMapDelete(transaction, this, attributeName);\n });\n } else {\n /** @type {Map} */ (this._prelimAttrs).delete(attributeName);\n }\n }\n\n /**\n * Sets or updates an attribute.\n *\n * @template {keyof KV & string} KEY\n *\n * @param {KEY} attributeName The attribute name that is to be set.\n * @param {KV[KEY]} attributeValue The attribute value that is to be set.\n *\n * @public\n */\n setAttribute (attributeName, attributeValue) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeMapSet(transaction, this, attributeName, attributeValue);\n });\n } else {\n /** @type {Map} */ (this._prelimAttrs).set(attributeName, attributeValue);\n }\n }\n\n /**\n * Returns an attribute value that belongs to the attribute name.\n *\n * @template {keyof KV & string} KEY\n *\n * @param {KEY} attributeName The attribute name that identifies the\n * queried value.\n * @return {KV[KEY]|undefined} The queried attribute value.\n *\n * @public\n */\n getAttribute (attributeName) {\n return /** @type {any} */ (typeMapGet(this, attributeName))\n }\n\n /**\n * Returns whether an attribute exists\n *\n * @param {string} attributeName The attribute name to check for existence.\n * @return {boolean} whether the attribute exists.\n *\n * @public\n */\n hasAttribute (attributeName) {\n return /** @type {any} */ (typeMapHas(this, attributeName))\n }\n\n /**\n * Returns all attribute name/value pairs in a JSON Object.\n *\n * @return {{ [Key in Extract]?: KV[Key]}} A JSON Object that describes the attributes.\n *\n * @public\n */\n getAttributes () {\n return /** @type {any} */ (typeMapGetAll(this))\n }\n\n /**\n * Creates a Dom Element that mirrors this YXmlElement.\n *\n * @param {Document} [_document=document] The document object (you must define\n * this when calling this method in\n * nodejs)\n * @param {Object} [hooks={}] Optional property to customize how hooks\n * are presented in the DOM\n * @param {any} [binding] You should not set this property. This is\n * used if DomBinding wants to create a\n * association to the created DOM type.\n * @return {Node} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element}\n *\n * @public\n */\n toDOM (_document = document, hooks = {}, binding) {\n const dom = _document.createElement(this.nodeName);\n const attrs = this.getAttributes();\n for (const key in attrs) {\n const value = attrs[key];\n if (typeof value === 'string') {\n dom.setAttribute(key, value);\n }\n }\n typeListForEach(this, yxml => {\n dom.appendChild(yxml.toDOM(_document, hooks, binding));\n });\n if (binding !== undefined) {\n binding._createAssociation(dom, this);\n }\n return dom\n }\n\n /**\n * Transform the properties of this type to binary and write it to an\n * BinaryEncoder.\n *\n * This is called when this Item is sent to a remote peer.\n *\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.\n */\n _write (encoder) {\n encoder.writeTypeRef(YXmlElementRefID);\n encoder.writeKey(this.nodeName);\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {YXmlElement}\n *\n * @function\n */\nconst readYXmlElement = decoder => new YXmlElement(decoder.readKey());\n\n/**\n * @extends YEvent\n * An Event that describes changes on a YXml Element or Yxml Fragment\n */\nclass YXmlEvent extends YEvent {\n /**\n * @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created.\n * @param {Set} subs The set of changed attributes. `null` is included if the\n * child list changed.\n * @param {Transaction} transaction The transaction instance with wich the\n * change was created.\n */\n constructor (target, subs, transaction) {\n super(target, transaction);\n /**\n * Whether the children changed.\n * @type {Boolean}\n * @private\n */\n this.childListChanged = false;\n /**\n * Set of all changed attributes.\n * @type {Set}\n */\n this.attributesChanged = new Set();\n subs.forEach((sub) => {\n if (sub === null) {\n this.childListChanged = true;\n } else {\n this.attributesChanged.add(sub);\n }\n });\n }\n}\n\n/**\n * You can manage binding to a custom type with YXmlHook.\n *\n * @extends {YMap}\n */\nclass YXmlHook extends YMap {\n /**\n * @param {string} hookName nodeName of the Dom Node.\n */\n constructor (hookName) {\n super();\n /**\n * @type {string}\n */\n this.hookName = hookName;\n }\n\n /**\n * Creates an Item with the same effect as this Item (without position effect)\n */\n _copy () {\n return new YXmlHook(this.hookName)\n }\n\n /**\n * @return {YXmlHook}\n */\n clone () {\n const el = new YXmlHook(this.hookName);\n this.forEach((value, key) => {\n el.set(key, value);\n });\n return el\n }\n\n /**\n * Creates a Dom Element that mirrors this YXmlElement.\n *\n * @param {Document} [_document=document] The document object (you must define\n * this when calling this method in\n * nodejs)\n * @param {Object.} [hooks] Optional property to customize how hooks\n * are presented in the DOM\n * @param {any} [binding] You should not set this property. This is\n * used if DomBinding wants to create a\n * association to the created DOM type\n * @return {Element} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element}\n *\n * @public\n */\n toDOM (_document = document, hooks = {}, binding) {\n const hook = hooks[this.hookName];\n let dom;\n if (hook !== undefined) {\n dom = hook.createDom(this);\n } else {\n dom = document.createElement(this.hookName);\n }\n dom.setAttribute('data-yjs-hook', this.hookName);\n if (binding !== undefined) {\n binding._createAssociation(dom, this);\n }\n return dom\n }\n\n /**\n * Transform the properties of this type to binary and write it to an\n * BinaryEncoder.\n *\n * This is called when this Item is sent to a remote peer.\n *\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.\n */\n _write (encoder) {\n encoder.writeTypeRef(YXmlHookRefID);\n encoder.writeKey(this.hookName);\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {YXmlHook}\n *\n * @private\n * @function\n */\nconst readYXmlHook = decoder =>\n new YXmlHook(decoder.readKey());\n\n/**\n * Represents text in a Dom Element. In the future this type will also handle\n * simple formatting information like bold and italic.\n */\nclass YXmlText extends YText {\n /**\n * @type {YXmlElement|YXmlText|null}\n */\n get nextSibling () {\n const n = this._item ? this._item.next : null;\n return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null\n }\n\n /**\n * @type {YXmlElement|YXmlText|null}\n */\n get prevSibling () {\n const n = this._item ? this._item.prev : null;\n return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null\n }\n\n _copy () {\n return new YXmlText()\n }\n\n /**\n * @return {YXmlText}\n */\n clone () {\n const text = new YXmlText();\n text.applyDelta(this.toDelta());\n return text\n }\n\n /**\n * Creates a Dom Element that mirrors this YXmlText.\n *\n * @param {Document} [_document=document] The document object (you must define\n * this when calling this method in\n * nodejs)\n * @param {Object} [hooks] Optional property to customize how hooks\n * are presented in the DOM\n * @param {any} [binding] You should not set this property. This is\n * used if DomBinding wants to create a\n * association to the created DOM type.\n * @return {Text} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element}\n *\n * @public\n */\n toDOM (_document = document, hooks, binding) {\n const dom = _document.createTextNode(this.toString());\n if (binding !== undefined) {\n binding._createAssociation(dom, this);\n }\n return dom\n }\n\n toString () {\n // @ts-ignore\n return this.toDelta().map(delta => {\n const nestedNodes = [];\n for (const nodeName in delta.attributes) {\n const attrs = [];\n for (const key in delta.attributes[nodeName]) {\n attrs.push({ key, value: delta.attributes[nodeName][key] });\n }\n // sort attributes to get a unique order\n attrs.sort((a, b) => a.key < b.key ? -1 : 1);\n nestedNodes.push({ nodeName, attrs });\n }\n // sort node order to get a unique order\n nestedNodes.sort((a, b) => a.nodeName < b.nodeName ? -1 : 1);\n // now convert to dom string\n let str = '';\n for (let i = 0; i < nestedNodes.length; i++) {\n const node = nestedNodes[i];\n str += `<${node.nodeName}`;\n for (let j = 0; j < node.attrs.length; j++) {\n const attr = node.attrs[j];\n str += ` ${attr.key}=\"${attr.value}\"`;\n }\n str += '>';\n }\n str += delta.insert;\n for (let i = nestedNodes.length - 1; i >= 0; i--) {\n str += ``;\n }\n return str\n }).join('')\n }\n\n /**\n * @return {string}\n */\n toJSON () {\n return this.toString()\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n */\n _write (encoder) {\n encoder.writeTypeRef(YXmlTextRefID);\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {YXmlText}\n *\n * @private\n * @function\n */\nconst readYXmlText = decoder => new YXmlText();\n\nclass AbstractStruct {\n /**\n * @param {ID} id\n * @param {number} length\n */\n constructor (id, length) {\n this.id = id;\n this.length = length;\n }\n\n /**\n * @type {boolean}\n */\n get deleted () {\n throw error.methodUnimplemented()\n }\n\n /**\n * Merge this struct with the item to the right.\n * This method is already assuming that `this.id.clock + this.length === this.id.clock`.\n * Also this method does *not* remove right from StructStore!\n * @param {AbstractStruct} right\n * @return {boolean} wether this merged with right\n */\n mergeWith (right) {\n return false\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.\n * @param {number} offset\n * @param {number} encodingRef\n */\n write (encoder, offset, encodingRef) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {Transaction} transaction\n * @param {number} offset\n */\n integrate (transaction, offset) {\n throw error.methodUnimplemented()\n }\n}\n\nconst structGCRefNumber = 0;\n\n/**\n * @private\n */\nclass GC extends AbstractStruct {\n get deleted () {\n return true\n }\n\n delete () {}\n\n /**\n * @param {GC} right\n * @return {boolean}\n */\n mergeWith (right) {\n if (this.constructor !== right.constructor) {\n return false\n }\n this.length += right.length;\n return true\n }\n\n /**\n * @param {Transaction} transaction\n * @param {number} offset\n */\n integrate (transaction, offset) {\n if (offset > 0) {\n this.id.clock += offset;\n this.length -= offset;\n }\n addStruct(transaction.doc.store, this);\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeInfo(structGCRefNumber);\n encoder.writeLen(this.length - offset);\n }\n\n /**\n * @param {Transaction} transaction\n * @param {StructStore} store\n * @return {null | number}\n */\n getMissing (transaction, store) {\n return null\n }\n}\n\nclass ContentBinary {\n /**\n * @param {Uint8Array} content\n */\n constructor (content) {\n this.content = content;\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return 1\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return [this.content]\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentBinary}\n */\n copy () {\n return new ContentBinary(this.content)\n }\n\n /**\n * @param {number} offset\n * @return {ContentBinary}\n */\n splice (offset) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {ContentBinary} right\n * @return {boolean}\n */\n mergeWith (right) {\n return false\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {}\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeBuf(this.content);\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 3\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2 } decoder\n * @return {ContentBinary}\n */\nconst readContentBinary = decoder => new ContentBinary(decoder.readBuf());\n\nclass ContentDeleted {\n /**\n * @param {number} len\n */\n constructor (len) {\n this.len = len;\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return this.len\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return []\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return false\n }\n\n /**\n * @return {ContentDeleted}\n */\n copy () {\n return new ContentDeleted(this.len)\n }\n\n /**\n * @param {number} offset\n * @return {ContentDeleted}\n */\n splice (offset) {\n const right = new ContentDeleted(this.len - offset);\n this.len = offset;\n return right\n }\n\n /**\n * @param {ContentDeleted} right\n * @return {boolean}\n */\n mergeWith (right) {\n this.len += right.len;\n return true\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {\n addToDeleteSet(transaction.deleteSet, item.id.client, item.id.clock, this.len);\n item.markDeleted();\n }\n\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeLen(this.len - offset);\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 1\n }\n}\n\n/**\n * @private\n *\n * @param {UpdateDecoderV1 | UpdateDecoderV2 } decoder\n * @return {ContentDeleted}\n */\nconst readContentDeleted = decoder => new ContentDeleted(decoder.readLen());\n\n/**\n * @param {string} guid\n * @param {Object} opts\n */\nconst createDocFromOpts = (guid, opts) => new Doc({ guid, ...opts, shouldLoad: opts.shouldLoad || opts.autoLoad || false });\n\n/**\n * @private\n */\nclass ContentDoc {\n /**\n * @param {Doc} doc\n */\n constructor (doc) {\n if (doc._item) {\n console.error('This document was already integrated as a sub-document. You should create a second instance instead with the same guid.');\n }\n /**\n * @type {Doc}\n */\n this.doc = doc;\n /**\n * @type {any}\n */\n const opts = {};\n this.opts = opts;\n if (!doc.gc) {\n opts.gc = false;\n }\n if (doc.autoLoad) {\n opts.autoLoad = true;\n }\n if (doc.meta !== null) {\n opts.meta = doc.meta;\n }\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return 1\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return [this.doc]\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentDoc}\n */\n copy () {\n return new ContentDoc(createDocFromOpts(this.doc.guid, this.opts))\n }\n\n /**\n * @param {number} offset\n * @return {ContentDoc}\n */\n splice (offset) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {ContentDoc} right\n * @return {boolean}\n */\n mergeWith (right) {\n return false\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {\n // this needs to be reflected in doc.destroy as well\n this.doc._item = item;\n transaction.subdocsAdded.add(this.doc);\n if (this.doc.shouldLoad) {\n transaction.subdocsLoaded.add(this.doc);\n }\n }\n\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {\n if (transaction.subdocsAdded.has(this.doc)) {\n transaction.subdocsAdded.delete(this.doc);\n } else {\n transaction.subdocsRemoved.add(this.doc);\n }\n }\n\n /**\n * @param {StructStore} store\n */\n gc (store) { }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeString(this.doc.guid);\n encoder.writeAny(this.opts);\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 9\n }\n}\n\n/**\n * @private\n *\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentDoc}\n */\nconst readContentDoc = decoder => new ContentDoc(createDocFromOpts(decoder.readString(), decoder.readAny()));\n\n/**\n * @private\n */\nclass ContentEmbed {\n /**\n * @param {Object} embed\n */\n constructor (embed) {\n this.embed = embed;\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return 1\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return [this.embed]\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentEmbed}\n */\n copy () {\n return new ContentEmbed(this.embed)\n }\n\n /**\n * @param {number} offset\n * @return {ContentEmbed}\n */\n splice (offset) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {ContentEmbed} right\n * @return {boolean}\n */\n mergeWith (right) {\n return false\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {}\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeJSON(this.embed);\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 5\n }\n}\n\n/**\n * @private\n *\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentEmbed}\n */\nconst readContentEmbed = decoder => new ContentEmbed(decoder.readJSON());\n\n/**\n * @private\n */\nclass ContentFormat {\n /**\n * @param {string} key\n * @param {Object} value\n */\n constructor (key, value) {\n this.key = key;\n this.value = value;\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return 1\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return []\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return false\n }\n\n /**\n * @return {ContentFormat}\n */\n copy () {\n return new ContentFormat(this.key, this.value)\n }\n\n /**\n * @param {number} _offset\n * @return {ContentFormat}\n */\n splice (_offset) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {ContentFormat} _right\n * @return {boolean}\n */\n mergeWith (_right) {\n return false\n }\n\n /**\n * @param {Transaction} _transaction\n * @param {Item} item\n */\n integrate (_transaction, item) {\n // @todo searchmarker are currently unsupported for rich text documents\n const p = /** @type {YText} */ (item.parent);\n p._searchMarker = null;\n p._hasFormatting = true;\n }\n\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeKey(this.key);\n encoder.writeJSON(this.value);\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 6\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentFormat}\n */\nconst readContentFormat = decoder => new ContentFormat(decoder.readKey(), decoder.readJSON());\n\n/**\n * @private\n */\nclass ContentJSON {\n /**\n * @param {Array} arr\n */\n constructor (arr) {\n /**\n * @type {Array}\n */\n this.arr = arr;\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return this.arr.length\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return this.arr\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentJSON}\n */\n copy () {\n return new ContentJSON(this.arr)\n }\n\n /**\n * @param {number} offset\n * @return {ContentJSON}\n */\n splice (offset) {\n const right = new ContentJSON(this.arr.slice(offset));\n this.arr = this.arr.slice(0, offset);\n return right\n }\n\n /**\n * @param {ContentJSON} right\n * @return {boolean}\n */\n mergeWith (right) {\n this.arr = this.arr.concat(right.arr);\n return true\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {}\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n const len = this.arr.length;\n encoder.writeLen(len - offset);\n for (let i = offset; i < len; i++) {\n const c = this.arr[i];\n encoder.writeString(c === undefined ? 'undefined' : JSON.stringify(c));\n }\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 2\n }\n}\n\n/**\n * @private\n *\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentJSON}\n */\nconst readContentJSON = decoder => {\n const len = decoder.readLen();\n const cs = [];\n for (let i = 0; i < len; i++) {\n const c = decoder.readString();\n if (c === 'undefined') {\n cs.push(undefined);\n } else {\n cs.push(JSON.parse(c));\n }\n }\n return new ContentJSON(cs)\n};\n\nclass ContentAny {\n /**\n * @param {Array} arr\n */\n constructor (arr) {\n /**\n * @type {Array}\n */\n this.arr = arr;\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return this.arr.length\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return this.arr\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentAny}\n */\n copy () {\n return new ContentAny(this.arr)\n }\n\n /**\n * @param {number} offset\n * @return {ContentAny}\n */\n splice (offset) {\n const right = new ContentAny(this.arr.slice(offset));\n this.arr = this.arr.slice(0, offset);\n return right\n }\n\n /**\n * @param {ContentAny} right\n * @return {boolean}\n */\n mergeWith (right) {\n this.arr = this.arr.concat(right.arr);\n return true\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {}\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n const len = this.arr.length;\n encoder.writeLen(len - offset);\n for (let i = offset; i < len; i++) {\n const c = this.arr[i];\n encoder.writeAny(c);\n }\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 8\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentAny}\n */\nconst readContentAny = decoder => {\n const len = decoder.readLen();\n const cs = [];\n for (let i = 0; i < len; i++) {\n cs.push(decoder.readAny());\n }\n return new ContentAny(cs)\n};\n\n/**\n * @private\n */\nclass ContentString {\n /**\n * @param {string} str\n */\n constructor (str) {\n /**\n * @type {string}\n */\n this.str = str;\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return this.str.length\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return this.str.split('')\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentString}\n */\n copy () {\n return new ContentString(this.str)\n }\n\n /**\n * @param {number} offset\n * @return {ContentString}\n */\n splice (offset) {\n const right = new ContentString(this.str.slice(offset));\n this.str = this.str.slice(0, offset);\n\n // Prevent encoding invalid documents because of splitting of surrogate pairs: https://github.com/yjs/yjs/issues/248\n const firstCharCode = this.str.charCodeAt(offset - 1);\n if (firstCharCode >= 0xD800 && firstCharCode <= 0xDBFF) {\n // Last character of the left split is the start of a surrogate utf16/ucs2 pair.\n // We don't support splitting of surrogate pairs because this may lead to invalid documents.\n // Replace the invalid character with a unicode replacement character (� / U+FFFD)\n this.str = this.str.slice(0, offset - 1) + '�';\n // replace right as well\n right.str = '�' + right.str.slice(1);\n }\n return right\n }\n\n /**\n * @param {ContentString} right\n * @return {boolean}\n */\n mergeWith (right) {\n this.str += right.str;\n return true\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {}\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeString(offset === 0 ? this.str : this.str.slice(offset));\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 4\n }\n}\n\n/**\n * @private\n *\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentString}\n */\nconst readContentString = decoder => new ContentString(decoder.readString());\n\n/**\n * @type {Array>}\n * @private\n */\nconst typeRefs = [\n readYArray,\n readYMap,\n readYText,\n readYXmlElement,\n readYXmlFragment,\n readYXmlHook,\n readYXmlText\n];\n\nconst YArrayRefID = 0;\nconst YMapRefID = 1;\nconst YTextRefID = 2;\nconst YXmlElementRefID = 3;\nconst YXmlFragmentRefID = 4;\nconst YXmlHookRefID = 5;\nconst YXmlTextRefID = 6;\n\n/**\n * @private\n */\nclass ContentType {\n /**\n * @param {AbstractType} type\n */\n constructor (type) {\n /**\n * @type {AbstractType}\n */\n this.type = type;\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return 1\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return [this.type]\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentType}\n */\n copy () {\n return new ContentType(this.type._copy())\n }\n\n /**\n * @param {number} offset\n * @return {ContentType}\n */\n splice (offset) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {ContentType} right\n * @return {boolean}\n */\n mergeWith (right) {\n return false\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {\n this.type._integrate(transaction.doc, item);\n }\n\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {\n let item = this.type._start;\n while (item !== null) {\n if (!item.deleted) {\n item.delete(transaction);\n } else if (item.id.clock < (transaction.beforeState.get(item.id.client) || 0)) {\n // This will be gc'd later and we want to merge it if possible\n // We try to merge all deleted items after each transaction,\n // but we have no knowledge about that this needs to be merged\n // since it is not in transaction.ds. Hence we add it to transaction._mergeStructs\n transaction._mergeStructs.push(item);\n }\n item = item.right;\n }\n this.type._map.forEach(item => {\n if (!item.deleted) {\n item.delete(transaction);\n } else if (item.id.clock < (transaction.beforeState.get(item.id.client) || 0)) {\n // same as above\n transaction._mergeStructs.push(item);\n }\n });\n transaction.changed.delete(this.type);\n }\n\n /**\n * @param {StructStore} store\n */\n gc (store) {\n let item = this.type._start;\n while (item !== null) {\n item.gc(store, true);\n item = item.right;\n }\n this.type._start = null;\n this.type._map.forEach(/** @param {Item | null} item */ (item) => {\n while (item !== null) {\n item.gc(store, true);\n item = item.left;\n }\n });\n this.type._map = new Map();\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n this.type._write(encoder);\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 7\n }\n}\n\n/**\n * @private\n *\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentType}\n */\nconst readContentType = decoder => new ContentType(typeRefs[decoder.readTypeRef()](decoder));\n\n/**\n * @todo This should return several items\n *\n * @param {StructStore} store\n * @param {ID} id\n * @return {{item:Item, diff:number}}\n */\nconst followRedone = (store, id) => {\n /**\n * @type {ID|null}\n */\n let nextID = id;\n let diff = 0;\n let item;\n do {\n if (diff > 0) {\n nextID = createID(nextID.client, nextID.clock + diff);\n }\n item = getItem(store, nextID);\n diff = nextID.clock - item.id.clock;\n nextID = item.redone;\n } while (nextID !== null && item instanceof Item)\n return {\n item, diff\n }\n};\n\n/**\n * Make sure that neither item nor any of its parents is ever deleted.\n *\n * This property does not persist when storing it into a database or when\n * sending it to other peers\n *\n * @param {Item|null} item\n * @param {boolean} keep\n */\nconst keepItem = (item, keep) => {\n while (item !== null && item.keep !== keep) {\n item.keep = keep;\n item = /** @type {AbstractType} */ (item.parent)._item;\n }\n};\n\n/**\n * Split leftItem into two items\n * @param {Transaction} transaction\n * @param {Item} leftItem\n * @param {number} diff\n * @return {Item}\n *\n * @function\n * @private\n */\nconst splitItem = (transaction, leftItem, diff) => {\n // create rightItem\n const { client, clock } = leftItem.id;\n const rightItem = new Item(\n createID(client, clock + diff),\n leftItem,\n createID(client, clock + diff - 1),\n leftItem.right,\n leftItem.rightOrigin,\n leftItem.parent,\n leftItem.parentSub,\n leftItem.content.splice(diff)\n );\n if (leftItem.deleted) {\n rightItem.markDeleted();\n }\n if (leftItem.keep) {\n rightItem.keep = true;\n }\n if (leftItem.redone !== null) {\n rightItem.redone = createID(leftItem.redone.client, leftItem.redone.clock + diff);\n }\n // update left (do not set leftItem.rightOrigin as it will lead to problems when syncing)\n leftItem.right = rightItem;\n // update right\n if (rightItem.right !== null) {\n rightItem.right.left = rightItem;\n }\n // right is more specific.\n transaction._mergeStructs.push(rightItem);\n // update parent._map\n if (rightItem.parentSub !== null && rightItem.right === null) {\n /** @type {AbstractType} */ (rightItem.parent)._map.set(rightItem.parentSub, rightItem);\n }\n leftItem.length = diff;\n return rightItem\n};\n\n/**\n * @param {Array} stack\n * @param {ID} id\n */\nconst isDeletedByUndoStack = (stack, id) => array.some(stack, /** @param {StackItem} s */ s => isDeleted(s.deletions, id));\n\n/**\n * Redoes the effect of this operation.\n *\n * @param {Transaction} transaction The Yjs instance.\n * @param {Item} item\n * @param {Set} redoitems\n * @param {DeleteSet} itemsToDelete\n * @param {boolean} ignoreRemoteMapChanges\n * @param {import('../utils/UndoManager.js').UndoManager} um\n *\n * @return {Item|null}\n *\n * @private\n */\nconst redoItem = (transaction, item, redoitems, itemsToDelete, ignoreRemoteMapChanges, um) => {\n const doc = transaction.doc;\n const store = doc.store;\n const ownClientID = doc.clientID;\n const redone = item.redone;\n if (redone !== null) {\n return getItemCleanStart(transaction, redone)\n }\n let parentItem = /** @type {AbstractType} */ (item.parent)._item;\n /**\n * @type {Item|null}\n */\n let left = null;\n /**\n * @type {Item|null}\n */\n let right;\n // make sure that parent is redone\n if (parentItem !== null && parentItem.deleted === true) {\n // try to undo parent if it will be undone anyway\n if (parentItem.redone === null && (!redoitems.has(parentItem) || redoItem(transaction, parentItem, redoitems, itemsToDelete, ignoreRemoteMapChanges, um) === null)) {\n return null\n }\n while (parentItem.redone !== null) {\n parentItem = getItemCleanStart(transaction, parentItem.redone);\n }\n }\n const parentType = parentItem === null ? /** @type {AbstractType} */ (item.parent) : /** @type {ContentType} */ (parentItem.content).type;\n\n if (item.parentSub === null) {\n // Is an array item. Insert at the old position\n left = item.left;\n right = item;\n // find next cloned_redo items\n while (left !== null) {\n /**\n * @type {Item|null}\n */\n let leftTrace = left;\n // trace redone until parent matches\n while (leftTrace !== null && /** @type {AbstractType} */ (leftTrace.parent)._item !== parentItem) {\n leftTrace = leftTrace.redone === null ? null : getItemCleanStart(transaction, leftTrace.redone);\n }\n if (leftTrace !== null && /** @type {AbstractType} */ (leftTrace.parent)._item === parentItem) {\n left = leftTrace;\n break\n }\n left = left.left;\n }\n while (right !== null) {\n /**\n * @type {Item|null}\n */\n let rightTrace = right;\n // trace redone until parent matches\n while (rightTrace !== null && /** @type {AbstractType} */ (rightTrace.parent)._item !== parentItem) {\n rightTrace = rightTrace.redone === null ? null : getItemCleanStart(transaction, rightTrace.redone);\n }\n if (rightTrace !== null && /** @type {AbstractType} */ (rightTrace.parent)._item === parentItem) {\n right = rightTrace;\n break\n }\n right = right.right;\n }\n } else {\n right = null;\n if (item.right && !ignoreRemoteMapChanges) {\n left = item;\n // Iterate right while right is in itemsToDelete\n // If it is intended to delete right while item is redone, we can expect that item should replace right.\n while (left !== null && left.right !== null && (left.right.redone || isDeleted(itemsToDelete, left.right.id) || isDeletedByUndoStack(um.undoStack, left.right.id) || isDeletedByUndoStack(um.redoStack, left.right.id))) {\n left = left.right;\n // follow redone\n while (left.redone) left = getItemCleanStart(transaction, left.redone);\n }\n if (left && left.right !== null) {\n // It is not possible to redo this item because it conflicts with a\n // change from another client\n return null\n }\n } else {\n left = parentType._map.get(item.parentSub) || null;\n }\n }\n const nextClock = getState(store, ownClientID);\n const nextId = createID(ownClientID, nextClock);\n const redoneItem = new Item(\n nextId,\n left, left && left.lastId,\n right, right && right.id,\n parentType,\n item.parentSub,\n item.content.copy()\n );\n item.redone = nextId;\n keepItem(redoneItem, true);\n redoneItem.integrate(transaction, 0);\n return redoneItem\n};\n\n/**\n * Abstract class that represents any content.\n */\nclass Item extends AbstractStruct {\n /**\n * @param {ID} id\n * @param {Item | null} left\n * @param {ID | null} origin\n * @param {Item | null} right\n * @param {ID | null} rightOrigin\n * @param {AbstractType|ID|null} parent Is a type if integrated, is null if it is possible to copy parent from left or right, is ID before integration to search for it.\n * @param {string | null} parentSub\n * @param {AbstractContent} content\n */\n constructor (id, left, origin, right, rightOrigin, parent, parentSub, content) {\n super(id, content.getLength());\n /**\n * The item that was originally to the left of this item.\n * @type {ID | null}\n */\n this.origin = origin;\n /**\n * The item that is currently to the left of this item.\n * @type {Item | null}\n */\n this.left = left;\n /**\n * The item that is currently to the right of this item.\n * @type {Item | null}\n */\n this.right = right;\n /**\n * The item that was originally to the right of this item.\n * @type {ID | null}\n */\n this.rightOrigin = rightOrigin;\n /**\n * @type {AbstractType|ID|null}\n */\n this.parent = parent;\n /**\n * If the parent refers to this item with some kind of key (e.g. YMap, the\n * key is specified here. The key is then used to refer to the list in which\n * to insert this item. If `parentSub = null` type._start is the list in\n * which to insert to. Otherwise it is `parent._map`.\n * @type {String | null}\n */\n this.parentSub = parentSub;\n /**\n * If this type's effect is redone this type refers to the type that undid\n * this operation.\n * @type {ID | null}\n */\n this.redone = null;\n /**\n * @type {AbstractContent}\n */\n this.content = content;\n /**\n * bit1: keep\n * bit2: countable\n * bit3: deleted\n * bit4: mark - mark node as fast-search-marker\n * @type {number} byte\n */\n this.info = this.content.isCountable() ? binary.BIT2 : 0;\n }\n\n /**\n * This is used to mark the item as an indexed fast-search marker\n *\n * @type {boolean}\n */\n set marker (isMarked) {\n if (((this.info & binary.BIT4) > 0) !== isMarked) {\n this.info ^= binary.BIT4;\n }\n }\n\n get marker () {\n return (this.info & binary.BIT4) > 0\n }\n\n /**\n * If true, do not garbage collect this Item.\n */\n get keep () {\n return (this.info & binary.BIT1) > 0\n }\n\n set keep (doKeep) {\n if (this.keep !== doKeep) {\n this.info ^= binary.BIT1;\n }\n }\n\n get countable () {\n return (this.info & binary.BIT2) > 0\n }\n\n /**\n * Whether this item was deleted or not.\n * @type {Boolean}\n */\n get deleted () {\n return (this.info & binary.BIT3) > 0\n }\n\n set deleted (doDelete) {\n if (this.deleted !== doDelete) {\n this.info ^= binary.BIT3;\n }\n }\n\n markDeleted () {\n this.info |= binary.BIT3;\n }\n\n /**\n * Return the creator clientID of the missing op or define missing items and return null.\n *\n * @param {Transaction} transaction\n * @param {StructStore} store\n * @return {null | number}\n */\n getMissing (transaction, store) {\n if (this.origin && this.origin.client !== this.id.client && this.origin.clock >= getState(store, this.origin.client)) {\n return this.origin.client\n }\n if (this.rightOrigin && this.rightOrigin.client !== this.id.client && this.rightOrigin.clock >= getState(store, this.rightOrigin.client)) {\n return this.rightOrigin.client\n }\n if (this.parent && this.parent.constructor === ID && this.id.client !== this.parent.client && this.parent.clock >= getState(store, this.parent.client)) {\n return this.parent.client\n }\n\n // We have all missing ids, now find the items\n\n if (this.origin) {\n this.left = getItemCleanEnd(transaction, store, this.origin);\n this.origin = this.left.lastId;\n }\n if (this.rightOrigin) {\n this.right = getItemCleanStart(transaction, this.rightOrigin);\n this.rightOrigin = this.right.id;\n }\n if ((this.left && this.left.constructor === GC) || (this.right && this.right.constructor === GC)) {\n this.parent = null;\n }\n // only set parent if this shouldn't be garbage collected\n if (!this.parent) {\n if (this.left && this.left.constructor === Item) {\n this.parent = this.left.parent;\n this.parentSub = this.left.parentSub;\n }\n if (this.right && this.right.constructor === Item) {\n this.parent = this.right.parent;\n this.parentSub = this.right.parentSub;\n }\n } else if (this.parent.constructor === ID) {\n const parentItem = getItem(store, this.parent);\n if (parentItem.constructor === GC) {\n this.parent = null;\n } else {\n this.parent = /** @type {ContentType} */ (parentItem.content).type;\n }\n }\n return null\n }\n\n /**\n * @param {Transaction} transaction\n * @param {number} offset\n */\n integrate (transaction, offset) {\n if (offset > 0) {\n this.id.clock += offset;\n this.left = getItemCleanEnd(transaction, transaction.doc.store, createID(this.id.client, this.id.clock - 1));\n this.origin = this.left.lastId;\n this.content = this.content.splice(offset);\n this.length -= offset;\n }\n\n if (this.parent) {\n if ((!this.left && (!this.right || this.right.left !== null)) || (this.left && this.left.right !== this.right)) {\n /**\n * @type {Item|null}\n */\n let left = this.left;\n\n /**\n * @type {Item|null}\n */\n let o;\n // set o to the first conflicting item\n if (left !== null) {\n o = left.right;\n } else if (this.parentSub !== null) {\n o = /** @type {AbstractType} */ (this.parent)._map.get(this.parentSub) || null;\n while (o !== null && o.left !== null) {\n o = o.left;\n }\n } else {\n o = /** @type {AbstractType} */ (this.parent)._start;\n }\n // TODO: use something like DeleteSet here (a tree implementation would be best)\n // @todo use global set definitions\n /**\n * @type {Set}\n */\n const conflictingItems = new Set();\n /**\n * @type {Set}\n */\n const itemsBeforeOrigin = new Set();\n // Let c in conflictingItems, b in itemsBeforeOrigin\n // ***{origin}bbbb{this}{c,b}{c,b}{o}***\n // Note that conflictingItems is a subset of itemsBeforeOrigin\n while (o !== null && o !== this.right) {\n itemsBeforeOrigin.add(o);\n conflictingItems.add(o);\n if (compareIDs(this.origin, o.origin)) {\n // case 1\n if (o.id.client < this.id.client) {\n left = o;\n conflictingItems.clear();\n } else if (compareIDs(this.rightOrigin, o.rightOrigin)) {\n // this and o are conflicting and point to the same integration points. The id decides which item comes first.\n // Since this is to the left of o, we can break here\n break\n } // else, o might be integrated before an item that this conflicts with. If so, we will find it in the next iterations\n } else if (o.origin !== null && itemsBeforeOrigin.has(getItem(transaction.doc.store, o.origin))) { // use getItem instead of getItemCleanEnd because we don't want / need to split items.\n // case 2\n if (!conflictingItems.has(getItem(transaction.doc.store, o.origin))) {\n left = o;\n conflictingItems.clear();\n }\n } else {\n break\n }\n o = o.right;\n }\n this.left = left;\n }\n // reconnect left/right + update parent map/start if necessary\n if (this.left !== null) {\n const right = this.left.right;\n this.right = right;\n this.left.right = this;\n } else {\n let r;\n if (this.parentSub !== null) {\n r = /** @type {AbstractType} */ (this.parent)._map.get(this.parentSub) || null;\n while (r !== null && r.left !== null) {\n r = r.left;\n }\n } else {\n r = /** @type {AbstractType} */ (this.parent)._start\n ;/** @type {AbstractType} */ (this.parent)._start = this;\n }\n this.right = r;\n }\n if (this.right !== null) {\n this.right.left = this;\n } else if (this.parentSub !== null) {\n // set as current parent value if right === null and this is parentSub\n /** @type {AbstractType} */ (this.parent)._map.set(this.parentSub, this);\n if (this.left !== null) {\n // this is the current attribute value of parent. delete right\n this.left.delete(transaction);\n }\n }\n // adjust length of parent\n if (this.parentSub === null && this.countable && !this.deleted) {\n /** @type {AbstractType} */ (this.parent)._length += this.length;\n }\n addStruct(transaction.doc.store, this);\n this.content.integrate(transaction, this);\n // add parent to transaction.changed\n addChangedTypeToTransaction(transaction, /** @type {AbstractType} */ (this.parent), this.parentSub);\n if ((/** @type {AbstractType} */ (this.parent)._item !== null && /** @type {AbstractType} */ (this.parent)._item.deleted) || (this.parentSub !== null && this.right !== null)) {\n // delete if parent is deleted or if this is not the current attribute value of parent\n this.delete(transaction);\n }\n } else {\n // parent is not defined. Integrate GC struct instead\n new GC(this.id, this.length).integrate(transaction, 0);\n }\n }\n\n /**\n * Returns the next non-deleted item\n */\n get next () {\n let n = this.right;\n while (n !== null && n.deleted) {\n n = n.right;\n }\n return n\n }\n\n /**\n * Returns the previous non-deleted item\n */\n get prev () {\n let n = this.left;\n while (n !== null && n.deleted) {\n n = n.left;\n }\n return n\n }\n\n /**\n * Computes the last content address of this Item.\n */\n get lastId () {\n // allocating ids is pretty costly because of the amount of ids created, so we try to reuse whenever possible\n return this.length === 1 ? this.id : createID(this.id.client, this.id.clock + this.length - 1)\n }\n\n /**\n * Try to merge two items\n *\n * @param {Item} right\n * @return {boolean}\n */\n mergeWith (right) {\n if (\n this.constructor === right.constructor &&\n compareIDs(right.origin, this.lastId) &&\n this.right === right &&\n compareIDs(this.rightOrigin, right.rightOrigin) &&\n this.id.client === right.id.client &&\n this.id.clock + this.length === right.id.clock &&\n this.deleted === right.deleted &&\n this.redone === null &&\n right.redone === null &&\n this.content.constructor === right.content.constructor &&\n this.content.mergeWith(right.content)\n ) {\n const searchMarker = /** @type {AbstractType} */ (this.parent)._searchMarker;\n if (searchMarker) {\n searchMarker.forEach(marker => {\n if (marker.p === right) {\n // right is going to be \"forgotten\" so we need to update the marker\n marker.p = this;\n // adjust marker index\n if (!this.deleted && this.countable) {\n marker.index -= this.length;\n }\n }\n });\n }\n if (right.keep) {\n this.keep = true;\n }\n this.right = right.right;\n if (this.right !== null) {\n this.right.left = this;\n }\n this.length += right.length;\n return true\n }\n return false\n }\n\n /**\n * Mark this Item as deleted.\n *\n * @param {Transaction} transaction\n */\n delete (transaction) {\n if (!this.deleted) {\n const parent = /** @type {AbstractType} */ (this.parent);\n // adjust the length of parent\n if (this.countable && this.parentSub === null) {\n parent._length -= this.length;\n }\n this.markDeleted();\n addToDeleteSet(transaction.deleteSet, this.id.client, this.id.clock, this.length);\n addChangedTypeToTransaction(transaction, parent, this.parentSub);\n this.content.delete(transaction);\n }\n }\n\n /**\n * @param {StructStore} store\n * @param {boolean} parentGCd\n */\n gc (store, parentGCd) {\n if (!this.deleted) {\n throw error.unexpectedCase()\n }\n this.content.gc(store);\n if (parentGCd) {\n replaceStruct(store, this, new GC(this.id, this.length));\n } else {\n this.content = new ContentDeleted(this.length);\n }\n }\n\n /**\n * Transform the properties of this type to binary and write it to an\n * BinaryEncoder.\n *\n * This is called when this Item is sent to a remote peer.\n *\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.\n * @param {number} offset\n */\n write (encoder, offset) {\n const origin = offset > 0 ? createID(this.id.client, this.id.clock + offset - 1) : this.origin;\n const rightOrigin = this.rightOrigin;\n const parentSub = this.parentSub;\n const info = (this.content.getRef() & binary.BITS5) |\n (origin === null ? 0 : binary.BIT8) | // origin is defined\n (rightOrigin === null ? 0 : binary.BIT7) | // right origin is defined\n (parentSub === null ? 0 : binary.BIT6); // parentSub is non-null\n encoder.writeInfo(info);\n if (origin !== null) {\n encoder.writeLeftID(origin);\n }\n if (rightOrigin !== null) {\n encoder.writeRightID(rightOrigin);\n }\n if (origin === null && rightOrigin === null) {\n const parent = /** @type {AbstractType} */ (this.parent);\n if (parent._item !== undefined) {\n const parentItem = parent._item;\n if (parentItem === null) {\n // parent type on y._map\n // find the correct key\n const ykey = findRootTypeKey(parent);\n encoder.writeParentInfo(true); // write parentYKey\n encoder.writeString(ykey);\n } else {\n encoder.writeParentInfo(false); // write parent id\n encoder.writeLeftID(parentItem.id);\n }\n } else if (parent.constructor === String) { // this edge case was added by differential updates\n encoder.writeParentInfo(true); // write parentYKey\n encoder.writeString(parent);\n } else if (parent.constructor === ID) {\n encoder.writeParentInfo(false); // write parent id\n encoder.writeLeftID(parent);\n } else {\n error.unexpectedCase();\n }\n if (parentSub !== null) {\n encoder.writeString(parentSub);\n }\n }\n this.content.write(encoder, offset);\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @param {number} info\n */\nconst readItemContent = (decoder, info) => contentRefs[info & binary.BITS5](decoder);\n\n/**\n * A lookup map for reading Item content.\n *\n * @type {Array}\n */\nconst contentRefs = [\n () => { error.unexpectedCase(); }, // GC is not ItemContent\n readContentDeleted, // 1\n readContentJSON, // 2\n readContentBinary, // 3\n readContentString, // 4\n readContentEmbed, // 5\n readContentFormat, // 6\n readContentType, // 7\n readContentAny, // 8\n readContentDoc, // 9\n () => { error.unexpectedCase(); } // 10 - Skip is not ItemContent\n];\n\nconst structSkipRefNumber = 10;\n\n/**\n * @private\n */\nclass Skip extends AbstractStruct {\n get deleted () {\n return true\n }\n\n delete () {}\n\n /**\n * @param {Skip} right\n * @return {boolean}\n */\n mergeWith (right) {\n if (this.constructor !== right.constructor) {\n return false\n }\n this.length += right.length;\n return true\n }\n\n /**\n * @param {Transaction} transaction\n * @param {number} offset\n */\n integrate (transaction, offset) {\n // skip structs cannot be integrated\n error.unexpectedCase();\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeInfo(structSkipRefNumber);\n // write as VarUint because Skips can't make use of predictable length-encoding\n encoding.writeVarUint(encoder.restEncoder, this.length - offset);\n }\n\n /**\n * @param {Transaction} transaction\n * @param {StructStore} store\n * @return {null | number}\n */\n getMissing (transaction, store) {\n return null\n }\n}\n\n/** eslint-env browser */\n\nconst glo = /** @type {any} */ (typeof globalThis !== 'undefined'\n ? globalThis\n : typeof window !== 'undefined'\n ? window\n // @ts-ignore\n : typeof global !== 'undefined' ? global : {});\n\nconst importIdentifier = '__ $YJS$ __';\n\nif (glo[importIdentifier] === true) {\n /**\n * Dear reader of this message. Please take this seriously.\n *\n * If you see this message, make sure that you only import one version of Yjs. In many cases,\n * your package manager installs two versions of Yjs that are used by different packages within your project.\n * Another reason for this message is that some parts of your project use the commonjs version of Yjs\n * and others use the EcmaScript version of Yjs.\n *\n * This often leads to issues that are hard to debug. We often need to perform constructor checks,\n * e.g. `struct instanceof GC`. If you imported different versions of Yjs, it is impossible for us to\n * do the constructor checks anymore - which might break the CRDT algorithm.\n *\n * https://github.com/yjs/yjs/issues/438\n */\n console.error('Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438');\n}\nglo[importIdentifier] = true;\n\nexport { AbsolutePosition, AbstractConnector, AbstractStruct, AbstractType, YArray as Array, ContentAny, ContentBinary, ContentDeleted, ContentEmbed, ContentFormat, ContentJSON, ContentString, ContentType, Doc, GC, ID, Item, YMap as Map, PermanentUserData, RelativePosition, Snapshot, YText as Text, Transaction, UndoManager, UpdateEncoderV1, YXmlElement as XmlElement, YXmlFragment as XmlFragment, YXmlHook as XmlHook, YXmlText as XmlText, YArrayEvent, YEvent, YMapEvent, YTextEvent, YXmlEvent, applyUpdate, applyUpdateV2, cleanupYTextFormatting, compareIDs, compareRelativePositions, convertUpdateFormatV1ToV2, convertUpdateFormatV2ToV1, createAbsolutePositionFromRelativePosition, createDeleteSet, createDeleteSetFromStructStore, createDocFromSnapshot, createID, createRelativePositionFromJSON, createRelativePositionFromTypeIndex, createSnapshot, decodeRelativePosition, decodeSnapshot, decodeSnapshotV2, decodeStateVector, decodeUpdate, decodeUpdateV2, diffUpdate, diffUpdateV2, emptySnapshot, encodeRelativePosition, encodeSnapshot, encodeSnapshotV2, encodeStateAsUpdate, encodeStateAsUpdateV2, encodeStateVector, encodeStateVectorFromUpdate, encodeStateVectorFromUpdateV2, equalDeleteSets, equalSnapshots, findIndexSS, findRootTypeKey, getItem, getState, getTypeChildren, isDeleted, isParentOf, iterateDeletedStructs, logType, logUpdate, logUpdateV2, mergeUpdates, mergeUpdatesV2, obfuscateUpdate, obfuscateUpdateV2, parseUpdateMeta, parseUpdateMetaV2, readUpdate, readUpdateV2, relativePositionToJSON, snapshot, snapshotContainsUpdate, transact, tryGc, typeListToArraySnapshot, typeMapGetSnapshot };\n//# sourceMappingURL=yjs.mjs.map\n","/**\n * @module awareness-protocol\n */\n\nimport * as encoding from 'lib0/encoding'\nimport * as decoding from 'lib0/decoding'\nimport * as time from 'lib0/time'\nimport * as math from 'lib0/math'\nimport { Observable } from 'lib0/observable'\nimport * as f from 'lib0/function'\nimport * as Y from 'yjs' // eslint-disable-line\n\nexport const outdatedTimeout = 30000\n\n/**\n * @typedef {Object} MetaClientState\n * @property {number} MetaClientState.clock\n * @property {number} MetaClientState.lastUpdated unix timestamp\n */\n\n/**\n * The Awareness class implements a simple shared state protocol that can be used for non-persistent data like awareness information\n * (cursor, username, status, ..). Each client can update its own local state and listen to state changes of\n * remote clients. Every client may set a state of a remote peer to `null` to mark the client as offline.\n *\n * Each client is identified by a unique client id (something we borrow from `doc.clientID`). A client can override\n * its own state by propagating a message with an increasing timestamp (`clock`). If such a message is received, it is\n * applied if the known state of that client is older than the new state (`clock < newClock`). If a client thinks that\n * a remote client is offline, it may propagate a message with\n * `{ clock: currentClientClock, state: null, client: remoteClient }`. If such a\n * message is received, and the known clock of that client equals the received clock, it will override the state with `null`.\n *\n * Before a client disconnects, it should propagate a `null` state with an updated clock.\n *\n * Awareness states must be updated every 30 seconds. Otherwise the Awareness instance will delete the client state.\n *\n * @extends {Observable}\n */\nexport class Awareness extends Observable {\n /**\n * @param {Y.Doc} doc\n */\n constructor (doc) {\n super()\n this.doc = doc\n /**\n * @type {number}\n */\n this.clientID = doc.clientID\n /**\n * Maps from client id to client state\n * @type {Map>}\n */\n this.states = new Map()\n /**\n * @type {Map}\n */\n this.meta = new Map()\n this._checkInterval = /** @type {any} */ (setInterval(() => {\n const now = time.getUnixTime()\n if (this.getLocalState() !== null && (outdatedTimeout / 2 <= now - /** @type {{lastUpdated:number}} */ (this.meta.get(this.clientID)).lastUpdated)) {\n // renew local clock\n this.setLocalState(this.getLocalState())\n }\n /**\n * @type {Array}\n */\n const remove = []\n this.meta.forEach((meta, clientid) => {\n if (clientid !== this.clientID && outdatedTimeout <= now - meta.lastUpdated && this.states.has(clientid)) {\n remove.push(clientid)\n }\n })\n if (remove.length > 0) {\n removeAwarenessStates(this, remove, 'timeout')\n }\n }, math.floor(outdatedTimeout / 10)))\n doc.on('destroy', () => {\n this.destroy()\n })\n this.setLocalState({})\n }\n\n destroy () {\n this.emit('destroy', [this])\n this.setLocalState(null)\n super.destroy()\n clearInterval(this._checkInterval)\n }\n\n /**\n * @return {Object|null}\n */\n getLocalState () {\n return this.states.get(this.clientID) || null\n }\n\n /**\n * @param {Object|null} state\n */\n setLocalState (state) {\n const clientID = this.clientID\n const currLocalMeta = this.meta.get(clientID)\n const clock = currLocalMeta === undefined ? 0 : currLocalMeta.clock + 1\n const prevState = this.states.get(clientID)\n if (state === null) {\n this.states.delete(clientID)\n } else {\n this.states.set(clientID, state)\n }\n this.meta.set(clientID, {\n clock,\n lastUpdated: time.getUnixTime()\n })\n const added = []\n const updated = []\n const filteredUpdated = []\n const removed = []\n if (state === null) {\n removed.push(clientID)\n } else if (prevState == null) {\n if (state != null) {\n added.push(clientID)\n }\n } else {\n updated.push(clientID)\n if (!f.equalityDeep(prevState, state)) {\n filteredUpdated.push(clientID)\n }\n }\n if (added.length > 0 || filteredUpdated.length > 0 || removed.length > 0) {\n this.emit('change', [{ added, updated: filteredUpdated, removed }, 'local'])\n }\n this.emit('update', [{ added, updated, removed }, 'local'])\n }\n\n /**\n * @param {string} field\n * @param {any} value\n */\n setLocalStateField (field, value) {\n const state = this.getLocalState()\n if (state !== null) {\n this.setLocalState({\n ...state,\n [field]: value\n })\n }\n }\n\n /**\n * @return {Map>}\n */\n getStates () {\n return this.states\n }\n}\n\n/**\n * Mark (remote) clients as inactive and remove them from the list of active peers.\n * This change will be propagated to remote clients.\n *\n * @param {Awareness} awareness\n * @param {Array} clients\n * @param {any} origin\n */\nexport const removeAwarenessStates = (awareness, clients, origin) => {\n const removed = []\n for (let i = 0; i < clients.length; i++) {\n const clientID = clients[i]\n if (awareness.states.has(clientID)) {\n awareness.states.delete(clientID)\n if (clientID === awareness.clientID) {\n const curMeta = /** @type {MetaClientState} */ (awareness.meta.get(clientID))\n awareness.meta.set(clientID, {\n clock: curMeta.clock + 1,\n lastUpdated: time.getUnixTime()\n })\n }\n removed.push(clientID)\n }\n }\n if (removed.length > 0) {\n awareness.emit('change', [{ added: [], updated: [], removed }, origin])\n awareness.emit('update', [{ added: [], updated: [], removed }, origin])\n }\n}\n\n/**\n * @param {Awareness} awareness\n * @param {Array} clients\n * @return {Uint8Array}\n */\nexport const encodeAwarenessUpdate = (awareness, clients, states = awareness.states) => {\n const len = clients.length\n const encoder = encoding.createEncoder()\n encoding.writeVarUint(encoder, len)\n for (let i = 0; i < len; i++) {\n const clientID = clients[i]\n const state = states.get(clientID) || null\n const clock = /** @type {MetaClientState} */ (awareness.meta.get(clientID)).clock\n encoding.writeVarUint(encoder, clientID)\n encoding.writeVarUint(encoder, clock)\n encoding.writeVarString(encoder, JSON.stringify(state))\n }\n return encoding.toUint8Array(encoder)\n}\n\n/**\n * Modify the content of an awareness update before re-encoding it to an awareness update.\n *\n * This might be useful when you have a central server that wants to ensure that clients\n * cant hijack somebody elses identity.\n *\n * @param {Uint8Array} update\n * @param {function(any):any} modify\n * @return {Uint8Array}\n */\nexport const modifyAwarenessUpdate = (update, modify) => {\n const decoder = decoding.createDecoder(update)\n const encoder = encoding.createEncoder()\n const len = decoding.readVarUint(decoder)\n encoding.writeVarUint(encoder, len)\n for (let i = 0; i < len; i++) {\n const clientID = decoding.readVarUint(decoder)\n const clock = decoding.readVarUint(decoder)\n const state = JSON.parse(decoding.readVarString(decoder))\n const modifiedState = modify(state)\n encoding.writeVarUint(encoder, clientID)\n encoding.writeVarUint(encoder, clock)\n encoding.writeVarString(encoder, JSON.stringify(modifiedState))\n }\n return encoding.toUint8Array(encoder)\n}\n\n/**\n * @param {Awareness} awareness\n * @param {Uint8Array} update\n * @param {any} origin This will be added to the emitted change event\n */\nexport const applyAwarenessUpdate = (awareness, update, origin) => {\n const decoder = decoding.createDecoder(update)\n const timestamp = time.getUnixTime()\n const added = []\n const updated = []\n const filteredUpdated = []\n const removed = []\n const len = decoding.readVarUint(decoder)\n for (let i = 0; i < len; i++) {\n const clientID = decoding.readVarUint(decoder)\n let clock = decoding.readVarUint(decoder)\n const state = JSON.parse(decoding.readVarString(decoder))\n const clientMeta = awareness.meta.get(clientID)\n const prevState = awareness.states.get(clientID)\n const currClock = clientMeta === undefined ? 0 : clientMeta.clock\n if (currClock < clock || (currClock === clock && state === null && awareness.states.has(clientID))) {\n if (state === null) {\n // never let a remote client remove this local state\n if (clientID === awareness.clientID && awareness.getLocalState() != null) {\n // remote client removed the local state. Do not remote state. Broadcast a message indicating\n // that this client still exists by increasing the clock\n clock++\n } else {\n awareness.states.delete(clientID)\n }\n } else {\n awareness.states.set(clientID, state)\n }\n awareness.meta.set(clientID, {\n clock,\n lastUpdated: timestamp\n })\n if (clientMeta === undefined && state !== null) {\n added.push(clientID)\n } else if (clientMeta !== undefined && state === null) {\n removed.push(clientID)\n } else if (state !== null) {\n if (!f.equalityDeep(state, prevState)) {\n filteredUpdated.push(clientID)\n }\n updated.push(clientID)\n }\n }\n }\n if (added.length > 0 || filteredUpdated.length > 0 || removed.length > 0) {\n awareness.emit('change', [{\n added, updated: filteredUpdated, removed\n }, origin])\n }\n if (added.length > 0 || updated.length > 0 || removed.length > 0) {\n awareness.emit('update', [{\n added, updated, removed\n }, origin])\n }\n}\n","\nimport * as Y from 'yjs'\nimport * as t from 'lib0/testing'\nimport * as awareness from './awareness'\n\n/**\n * @param {t.TestCase} tc\n */\nexport const testAwareness = tc => {\n const doc1 = new Y.Doc()\n doc1.clientID = 0\n const doc2 = new Y.Doc()\n doc2.clientID = 1\n const aw1 = new awareness.Awareness(doc1)\n const aw2 = new awareness.Awareness(doc2)\n aw1.on('update', /** @param {any} p */ ({ added, updated, removed }) => {\n const enc = awareness.encodeAwarenessUpdate(aw1, added.concat(updated).concat(removed))\n awareness.applyAwarenessUpdate(aw2, enc, 'custom')\n })\n let lastChangeLocal = /** @type {any} */ (null)\n aw1.on('change', /** @param {any} change */ change => {\n lastChangeLocal = change\n })\n let lastChange = /** @type {any} */ (null)\n aw2.on('change', /** @param {any} change */ change => {\n lastChange = change\n })\n aw1.setLocalState({ x: 3 })\n t.compare(aw2.getStates().get(0), { x: 3 })\n t.assert(/** @type {any} */ (aw2.meta.get(0)).clock === 1)\n t.compare(lastChange.added, [0])\n // When creating an Awareness instance, the the local client is already marked as available, so it is not updated.\n t.compare(lastChangeLocal, { added: [], updated: [0], removed: [] })\n\n // update state\n lastChange = null\n lastChangeLocal = null\n aw1.setLocalState({ x: 4 })\n t.compare(aw2.getStates().get(0), { x: 4 })\n t.compare(lastChangeLocal, { added: [], updated: [0], removed: [] })\n t.compare(lastChangeLocal, lastChange)\n\n lastChange = null\n lastChangeLocal = null\n aw1.setLocalState({ x: 4 })\n t.assert(lastChange === null)\n t.assert(/** @type {any} */ (aw2.meta.get(0)).clock === 3)\n t.compare(lastChangeLocal, lastChange)\n aw1.setLocalState(null)\n t.assert(lastChange.removed.length === 1)\n t.compare(aw1.getStates().get(0), undefined)\n t.compare(lastChangeLocal, lastChange)\n}\n","import { runTests } from 'lib0/testing'\nimport * as log from 'lib0/logging'\nimport * as awareness from './awareness.test.js'\n\nimport { isBrowser, isNode } from 'lib0/environment'\n\n/* istanbul ignore if */\nif (isBrowser) {\n log.createVConsole(document.body)\n}\n\nrunTests({\n awareness\n}).then(success => {\n /* istanbul ignore next */\n if (isNode) {\n process.exit(success ? 0 : 1)\n }\n})\n"],"names":["create","map","forEach","length","object.length","object.hasProperty","map.create","string.fromCamelCase","conditions.undefinedToNull","storage.varStorage","f.isOneOf","pair.forEach","map.map","math.log10","math.round","math.exp10","metric.prefix","math.floor","symbol.create","common.BOLD","pair.create","common.UNBOLD","common.BLUE","common.GREEN","common.GREY","common.RED","common.PURPLE","common.ORANGE","common.UNCOLOR","dom.mapToStyleString","env.supportsColor","common.computeNoColorLoggingArgs","env.isBrowser","set.create","dom.element","dom.text","json.stringify","eventloop.enqueue","dom.append","dom.addEventListener","binary.BITS32","buffer.createUint8ArrayViewFromArrayBuffer","math.max","binary.BITS7","binary.BIT8","math.isNegativeZero","binary.BITS6","binary.BIT7","string.utf8TextEncoder","string.encodeUtf8","math.min","number.isInteger","math.abs","binary.BITS31","array.isArray","error.create","number.MAX_SAFE_INTEGER","string.utf8TextDecoder","math.ceil","math.add","env.hasConf","env.hasParam","env.getParam","random.uint32","prng.create","log.GREY","log.PURPLE","log.BLUE","log.groupCollapsed","log.group","performance.now","performance.mark","promise.isPromise","log.printError","performance.measure","log.groupEnd","time.humanizeDuration","array.last","statistics.median","statistics.average","log.print","log.BOLD","log.UNBOLD","log.RED","log.UNCOLOR","log.GREEN","object.forEach","object.map","log.printImgBase64","map.setIfUndefined","array.from","encoding.writeVarUint","random.uuidv4","promise.create","encoding.createEncoder","encoding.toUint8Array","encoding.writeUint8","encoding.writeVarString","encoding.writeAny","encoding.writeVarUint8Array","error.unexpectedCase","encoding.IntDiffOptRleEncoder","encoding.UintOptRleEncoder","encoding.RleEncoder","encoding.StringEncoder","encoding.writeUint8Array","f.callAll","map.any","logging.print","logging.ORANGE","logging.BOLD","logging.UNBOLD","logging.RED","error.methodUnimplemented","iterator.iteratorFilter","iterator.iteratorMap","object.equalFlat","map.copy","object.isEmpty","object.assign","binary.BIT2","binary.BIT4","binary.BIT1","binary.BIT3","binary.BITS5","binary.BIT6","time.getUnixTime","f.equalityDeep","decoding.createDecoder","decoding.readVarUint","decoding.readVarString","Y.Doc","awareness.Awareness","awareness.encodeAwarenessUpdate","awareness.applyAwarenessUpdate","t.compare","t.assert","log.createVConsole"],"mappings":";;;EAAA;EACA;EACA;EACA;EACA;AACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACO,MAAMA,QAAM,GAAG,MAAM,IAAI,GAAG,GAAE;AACrC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACO,MAAM,IAAI,GAAG,CAAC,IAAI;EACzB,EAAE,MAAM,CAAC,GAAGA,QAAM,GAAE;EACpB,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAC,EAAE,EAAC;EACtC,EAAE,OAAO,CAAC;EAC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C,MAAM,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,GAAE;EACpC,MAAM,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAKA,MAAa,GAAG,CAAC,CAAC,CAAC;EAClE,KAAK;EACL,GAAG;EACH,CAAC;AACD;EACA;EACA;EACA;EACA;EACA;AACA;EACA;EACA;AACA;EACA;AACA;EACA;EACA;EACA;AACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AACA;EACA;EACA;EACA;EACA;EACA;AACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EC9GA;EACA;EACA;EACA;EACA;AACA;AAGA;EACO,MAAM,gBAAgB,GAAG,MAAM,CAAC,iBAAgB;AAMvD;EACA;EACO,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,KAAK,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAIvB,KAAU,CAAC,GAAG,CAAC,KAAK,GAAG;;ECjBxH;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AACA;AAOA;EACA;EACA;EACA;EACO,MAAM,OAAO,CAAC;EACrB,EAAE,WAAW,CAAC,GAAG;EACjB,IAAI,IAAI,CAAC,IAAI,GAAG,EAAC;EACjB,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,UAAU,CAAC,GAAG,EAAC;EACnC;EACA;EACA;EACA,IAAI,IAAI,CAAC,IAAI,GAAG,GAAE;EAClB,GAAG;EACH,CAAC;AACD;EACA;EACA;EACA;EACA;EACO,MAAM,aAAa,GAAG,MAAM,IAAI,OAAO,GAAE;AAUhD;EACA;EACA;EACA;EACA;EACA;EACA;EAC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,30,31,32,33,34,35,36]} \ No newline at end of file diff --git a/yjs-poll/node_modules/y-protocols/package.json b/yjs-poll/node_modules/y-protocols/package.json deleted file mode 100644 index 47f2fd6..0000000 --- a/yjs-poll/node_modules/y-protocols/package.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "name": "y-protocols", - "version": "1.0.7", - "description": "Yjs encoding protocols", - "type": "module", - "funding": { - "type": "GitHub Sponsors ❤", - "url": "https://github.com/sponsors/dmonad" - }, - "files": [ - "dist/*", - "auth.*", - "sync.*", - "awareness.*" - ], - "scripts": { - "clean": "rm -rf dist *.d.ts */*.d.ts *.d.ts.map */*.d.ts.map", - "dist": "rm -rf dist && rollup -c", - "test": "npm run lint && npm run dist && node dist/test.cjs", - "lint": "standard && tsc", - "types": "tsc --outDir .", - "debug": "rollup -c && concurrently 'rollup -wc' 'http-server -o test.html'", - "preversion": "npm run dist && npm run test && npm run types", - "postpublish": "npm run clean" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/yjs/y-protocols.git" - }, - "keywords": [ - "Yjs" - ], - "author": "Kevin Jahns ", - "license": "MIT", - "standard": { - "ignore": [ - "/dist", - "/node_modules" - ] - }, - "bugs": { - "url": "https://github.com/yjs/y-protocols/issues" - }, - "homepage": "https://github.com/yjs/y-protocols#readme", - "exports": { - "./package.json": "./package.json", - "./sync.js": "./sync.js", - "./dist/sync.cjs": "./dist/sync.cjs", - "./sync": { - "types": "./sync.d.ts", - "module": "./sync.js", - "import": "./sync.js", - "require": "./dist/sync.cjs" - }, - "./awareness.js": "./awareness.js", - "./dist/awareness.cjs": "./dist/awareness.cjs", - "./awareness": { - "types": "./awareness.d.ts", - "module": "./awareness.js", - "import": "./awareness.js", - "require": "./dist/awareness.cjs" - }, - "./auth.js": "./auth.js", - "./dist/auth.cjs": "./dist/auth.cjs", - "./auth": { - "types": "./auth.d.ts", - "module": "./auth.js", - "import": "./auth.js", - "require": "./dist/auth.cjs" - } - }, - "dependencies": { - "lib0": "^0.2.85" - }, - "devDependencies": { - "@rollup/plugin-commonjs": "^25.0.4", - "@rollup/plugin-node-resolve": "^15.2.1", - "@types/node": "^20.6.2", - "concurrently": "^5.3.0", - "rollup": "^3.29.2", - "standard": "^12.0.1", - "typescript": "^5.2.2", - "yjs": "^13.5.6" - }, - "peerDependencies": { - "yjs": "^13.0.0" - }, - "engines": { - "npm": ">=8.0.0", - "node": ">=16.0.0" - } -} diff --git a/yjs-poll/node_modules/y-protocols/sync.d.ts b/yjs-poll/node_modules/y-protocols/sync.d.ts deleted file mode 100644 index cdf2353..0000000 --- a/yjs-poll/node_modules/y-protocols/sync.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @typedef {Map} StateMap - */ -/** - * Core Yjs defines two message types: - * • YjsSyncStep1: Includes the State Set of the sending client. When received, the client should reply with YjsSyncStep2. - * • YjsSyncStep2: Includes all missing structs and the complete delete set. When received, the client is assured that it - * received all information from the remote client. - * - * In a peer-to-peer network, you may want to introduce a SyncDone message type. Both parties should initiate the connection - * with SyncStep1. When a client received SyncStep2, it should reply with SyncDone. When the local client received both - * SyncStep2 and SyncDone, it is assured that it is synced to the remote client. - * - * In a client-server model, you want to handle this differently: The client should initiate the connection with SyncStep1. - * When the server receives SyncStep1, it should reply with SyncStep2 immediately followed by SyncStep1. The client replies - * with SyncStep2 when it receives SyncStep1. Optionally the server may send a SyncDone after it received SyncStep2, so the - * client knows that the sync is finished. There are two reasons for this more elaborated sync model: 1. This protocol can - * easily be implemented on top of http and websockets. 2. The server should only reply to requests, and not initiate them. - * Therefore it is necessary that the client initiates the sync. - * - * Construction of a message: - * [messageType : varUint, message definition..] - * - * Note: A message does not include information about the room name. This must to be handled by the upper layer protocol! - * - * stringify[messageType] stringifies a message definition (messageType is already read from the bufffer) - */ -export const messageYjsSyncStep1: 0; -export const messageYjsSyncStep2: 1; -export const messageYjsUpdate: 2; -export function writeSyncStep1(encoder: encoding.Encoder, doc: Y.Doc): void; -export function writeSyncStep2(encoder: encoding.Encoder, doc: Y.Doc, encodedStateVector?: Uint8Array | undefined): void; -export function readSyncStep1(decoder: decoding.Decoder, encoder: encoding.Encoder, doc: Y.Doc): void; -export function readSyncStep2(decoder: decoding.Decoder, doc: Y.Doc, transactionOrigin: any, errorHandler?: ((error: Error) => any) | undefined): void; -export function writeUpdate(encoder: encoding.Encoder, update: Uint8Array): void; -export function readUpdate(decoder: decoding.Decoder, doc: Y.Doc, transactionOrigin: any, errorHandler?: ((error: Error) => any) | undefined): void; -export function readSyncMessage(decoder: decoding.Decoder, encoder: encoding.Encoder, doc: Y.Doc, transactionOrigin: any, errorHandler?: ((error: Error) => any) | undefined): 0 | 2 | 1; -export type StateMap = Map; -import * as encoding from 'lib0/encoding'; -import * as Y from 'yjs'; -import * as decoding from 'lib0/decoding'; -//# sourceMappingURL=sync.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/y-protocols/sync.d.ts.map b/yjs-poll/node_modules/y-protocols/sync.d.ts.map deleted file mode 100644 index adbd2d6..0000000 --- a/yjs-poll/node_modules/y-protocols/sync.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["sync.js"],"names":[],"mappings":"AAQA;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,oCAAoC;AACpC,oCAAoC;AACpC,iCAAiC;AAQ1B,wCAHI,SAAS,OAAO,OAChB,EAAE,GAAG,QAMf;AAOM,wCAJI,SAAS,OAAO,OAChB,EAAE,GAAG,qDAMf;AASM,uCAJI,SAAS,OAAO,WAChB,SAAS,OAAO,OAChB,EAAE,GAAG,QAGmD;AAU5D,uCALI,SAAS,OAAO,OAChB,EAAE,GAAG,qBACL,GAAG,0BACI,KAAK,KAAG,GAAG,qBAU5B;AAMM,qCAHI,SAAS,OAAO,UAChB,UAAU,QAKpB;AAjBM,oCALI,SAAS,OAAO,OAChB,EAAE,GAAG,qBACL,GAAG,0BACI,KAAK,KAAG,GAAG,qBAU5B;AA4BM,yCANI,SAAS,OAAO,WAChB,SAAS,OAAO,OAChB,EAAE,GAAG,qBACL,GAAG,0BACI,KAAK,KAAG,GAAG,0BAkB5B;uBA5HY,IAAI,MAAM,EAAE,MAAM,CAAC;0BALN,eAAe;mBAEtB,KAAK;0BADE,eAAe"} \ No newline at end of file diff --git a/yjs-poll/node_modules/y-protocols/sync.js b/yjs-poll/node_modules/y-protocols/sync.js deleted file mode 100644 index 0a58ef1..0000000 --- a/yjs-poll/node_modules/y-protocols/sync.js +++ /dev/null @@ -1,134 +0,0 @@ -/** - * @module sync-protocol - */ - -import * as encoding from 'lib0/encoding' -import * as decoding from 'lib0/decoding' -import * as Y from 'yjs' - -/** - * @typedef {Map} StateMap - */ - -/** - * Core Yjs defines two message types: - * • YjsSyncStep1: Includes the State Set of the sending client. When received, the client should reply with YjsSyncStep2. - * • YjsSyncStep2: Includes all missing structs and the complete delete set. When received, the client is assured that it - * received all information from the remote client. - * - * In a peer-to-peer network, you may want to introduce a SyncDone message type. Both parties should initiate the connection - * with SyncStep1. When a client received SyncStep2, it should reply with SyncDone. When the local client received both - * SyncStep2 and SyncDone, it is assured that it is synced to the remote client. - * - * In a client-server model, you want to handle this differently: The client should initiate the connection with SyncStep1. - * When the server receives SyncStep1, it should reply with SyncStep2 immediately followed by SyncStep1. The client replies - * with SyncStep2 when it receives SyncStep1. Optionally the server may send a SyncDone after it received SyncStep2, so the - * client knows that the sync is finished. There are two reasons for this more elaborated sync model: 1. This protocol can - * easily be implemented on top of http and websockets. 2. The server should only reply to requests, and not initiate them. - * Therefore it is necessary that the client initiates the sync. - * - * Construction of a message: - * [messageType : varUint, message definition..] - * - * Note: A message does not include information about the room name. This must to be handled by the upper layer protocol! - * - * stringify[messageType] stringifies a message definition (messageType is already read from the bufffer) - */ - -export const messageYjsSyncStep1 = 0 -export const messageYjsSyncStep2 = 1 -export const messageYjsUpdate = 2 - -/** - * Create a sync step 1 message based on the state of the current shared document. - * - * @param {encoding.Encoder} encoder - * @param {Y.Doc} doc - */ -export const writeSyncStep1 = (encoder, doc) => { - encoding.writeVarUint(encoder, messageYjsSyncStep1) - const sv = Y.encodeStateVector(doc) - encoding.writeVarUint8Array(encoder, sv) -} - -/** - * @param {encoding.Encoder} encoder - * @param {Y.Doc} doc - * @param {Uint8Array} [encodedStateVector] - */ -export const writeSyncStep2 = (encoder, doc, encodedStateVector) => { - encoding.writeVarUint(encoder, messageYjsSyncStep2) - encoding.writeVarUint8Array(encoder, Y.encodeStateAsUpdate(doc, encodedStateVector)) -} - -/** - * Read SyncStep1 message and reply with SyncStep2. - * - * @param {decoding.Decoder} decoder The reply to the received message - * @param {encoding.Encoder} encoder The received message - * @param {Y.Doc} doc - */ -export const readSyncStep1 = (decoder, encoder, doc) => - writeSyncStep2(encoder, doc, decoding.readVarUint8Array(decoder)) - -/** - * Read and apply Structs and then DeleteStore to a y instance. - * - * @param {decoding.Decoder} decoder - * @param {Y.Doc} doc - * @param {any} transactionOrigin - * @param {(error:Error)=>any} [errorHandler] - */ -export const readSyncStep2 = (decoder, doc, transactionOrigin, errorHandler) => { - try { - Y.applyUpdate(doc, decoding.readVarUint8Array(decoder), transactionOrigin) - } catch (error) { - if (errorHandler != null) errorHandler(/** @type {Error} */ (error)) - // This catches errors that are thrown by event handlers - console.error('Caught error while handling a Yjs update', error) - } -} - -/** - * @param {encoding.Encoder} encoder - * @param {Uint8Array} update - */ -export const writeUpdate = (encoder, update) => { - encoding.writeVarUint(encoder, messageYjsUpdate) - encoding.writeVarUint8Array(encoder, update) -} - -/** - * Read and apply Structs and then DeleteStore to a y instance. - * - * @param {decoding.Decoder} decoder - * @param {Y.Doc} doc - * @param {any} transactionOrigin - * @param {(error:Error)=>any} [errorHandler] - */ -export const readUpdate = readSyncStep2 - -/** - * @param {decoding.Decoder} decoder A message received from another client - * @param {encoding.Encoder} encoder The reply message. Does not need to be sent if empty. - * @param {Y.Doc} doc - * @param {any} transactionOrigin - * @param {(error:Error)=>any} [errorHandler] Optional error handler that catches errors when reading Yjs messages. - */ -export const readSyncMessage = (decoder, encoder, doc, transactionOrigin, errorHandler) => { - const messageType = decoding.readVarUint(decoder) - switch (messageType) { - case messageYjsSyncStep1: - readSyncStep1(decoder, encoder, doc) - break - case messageYjsSyncStep2: - readSyncStep2(decoder, doc, transactionOrigin, errorHandler) - break - case messageYjsUpdate: - readUpdate(decoder, doc, transactionOrigin, errorHandler) - break - default: - throw new Error('Unknown message type') - } - return messageType -} diff --git a/yjs-poll/node_modules/y-websocket/LICENSE b/yjs-poll/node_modules/y-websocket/LICENSE deleted file mode 100644 index 5979ed4..0000000 --- a/yjs-poll/node_modules/y-websocket/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2025 Kevin Jahns . - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/yjs-poll/node_modules/y-websocket/README.md b/yjs-poll/node_modules/y-websocket/README.md deleted file mode 100644 index 13fde42..0000000 --- a/yjs-poll/node_modules/y-websocket/README.md +++ /dev/null @@ -1,142 +0,0 @@ -# y-websocket :tophat: -> WebSocket Provider for Yjs - -The Websocket Provider implements a classical client server model. Clients -connect to a single endpoint over Websocket. The server distributes awareness -information and document updates among clients. - -This repository contains a simple in-memory backend that can persist to -databases, but it can't be scaled easily. The -[y-redis](https://github.com/yjs/y-redis/) repository contains an alternative -backend that is scalable, provides auth*, and can persist to different backends. - -The Websocket Provider is a solid choice if you want a central source that -handles authentication and authorization. Websockets also send header -information and cookies, so you can use existing authentication mechanisms with -this server. - -* Supports cross-tab communication. When you open the same document in the same -browser, changes on the document are exchanged via cross-tab communication -([Broadcast -Channel](https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API) -and -[localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) -as fallback). -* Supports exchange of awareness information (e.g. cursors). - -## Quick Start - -### Install dependencies - -```sh -npm i y-websocket -``` - -### Start a y-websocket server - -There are multiple y-websocket compatible backends for `y-websocket`: - -* [@y/websocket-server](https://github.com/yjs/y-websocket-server/) -* hocuspocus -- y-sweet -- y-redis -- ypy-websocket -- pycrdt-websocket -- [yrs-warp](https://github.com/y-crdt/yrs-warp) -- ... - -The fastest way to get started is to run the [@y/websocket-server](https://github.com/yjs/y-websocket-server/) -backend. This package was previously included in y-websocket and now lives in a -forkable repository. - -Install and start y-websocket-server: - -```sh -npm install @y/y-websocket-server -HOST=localhost PORT=1234 npx y-websocket -``` - -### Client Code: - -```js -import * as Y from 'yjs' -import { WebsocketProvider } from 'y-websocket' - -const doc = new Y.Doc() -const wsProvider = new WebsocketProvider('ws://localhost:1234', 'my-roomname', doc) - -wsProvider.on('status', event => { - console.log(event.status) // logs "connected" or "disconnected" -}) -``` - -#### Client Code in Node.js - -The WebSocket provider requires a [`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) object to create connection to a server. You can polyfill WebSocket support in Node.js using the [`ws` package](https://www.npmjs.com/package/ws). - -```js -const wsProvider = new WebsocketProvider('ws://localhost:1234', 'my-roomname', doc, { WebSocketPolyfill: require('ws') }) -``` - -## API - -```js -import { WebsocketProvider } from 'y-websocket' -``` - -
- wsProvider = new WebsocketProvider(serverUrl: string, room: string, ydoc: Y.Doc [, wsOpts: WsOpts]) -
Create a new websocket-provider instance. As long as this provider, or the connected ydoc, is not destroyed, the changes will be synced to other clients via the connected server. Optionally, you may specify a configuration object. The following default values of wsOpts can be overwritten.
-
- -```js -wsOpts = { - // Set this to `false` if you want to connect manually using wsProvider.connect() - connect: true, - // Specify a query-string / url parameters that will be url-encoded and attached to the `serverUrl` - // I.e. params = { auth: "bearer" } will be transformed to "?auth=bearer" - params: {}, // Object - // You may polyill the Websocket object (https://developer.mozilla.org/en-US/docs/Web/API/WebSocket). - // E.g. In nodejs, you could specify WebsocketPolyfill = require('ws') - WebsocketPolyfill: Websocket, - // Specify an existing Awareness instance - see https://github.com/yjs/y-protocols - awareness: new awarenessProtocol.Awareness(ydoc), - // Specify the maximum amount to wait between reconnects (we use exponential backoff). - maxBackoffTime: 2500 -} -``` - -
- wsProvider.wsconnected: boolean -
True if this instance is currently connected to the server.
- wsProvider.wsconnecting: boolean -
True if this instance is currently connecting to the server.
- wsProvider.shouldConnect: boolean -
If false, the client will not try to reconnect.
- wsProvider.bcconnected: boolean -
True if this instance is currently communicating to other browser-windows via BroadcastChannel.
- wsProvider.synced: boolean -
True if this instance is currently connected and synced with the server.
- wsProvider.params : boolean -
The specified url parameters. This can be safely updated, the new values - will be used when a new connction is established. If this contains an - auth token, it should be updated regularly.
- wsProvider.disconnect() -
Disconnect from the server and don't try to reconnect.
- wsProvider.connect() -
Establish a websocket connection to the websocket-server. Call this if you recently disconnected or if you set wsOpts.connect = false.
- wsProvider.destroy() -
Destroy this wsProvider instance. Disconnects from the server and removes all event handlers.
- wsProvider.on('sync', function(isSynced: boolean)) -
Add an event listener for the sync event that is fired when the client received content from the server.
- wsProvider.on('status', function({ status: 'disconnected' | 'connecting' | 'connected' })) -
Receive updates about the current connection status.
- wsProvider.on('connection-close', function(WSClosedEvent)) -
Fires when the underlying websocket connection is closed. It forwards the websocket event to this event handler.
- wsProvider.on('connection-error', function(WSErrorEvent)) -
Fires when the underlying websocket connection closes with an error. It forwards the websocket event to this event handler.
-
- -## License - -[The MIT License](./LICENSE) © Kevin Jahns diff --git a/yjs-poll/node_modules/y-websocket/dist/src/y-websocket.d.ts b/yjs-poll/node_modules/y-websocket/dist/src/y-websocket.d.ts deleted file mode 100644 index 85e0e2e..0000000 --- a/yjs-poll/node_modules/y-websocket/dist/src/y-websocket.d.ts +++ /dev/null @@ -1,139 +0,0 @@ -export const messageSync: 0; -export const messageQueryAwareness: 3; -export const messageAwareness: 1; -export const messageAuth: 2; -/** - * Websocket Provider for Yjs. Creates a websocket connection to sync the shared document. - * The document name is attached to the provided url. I.e. the following example - * creates a websocket connection to http://localhost:1234/my-document-name - * - * @example - * import * as Y from 'yjs' - * import { WebsocketProvider } from 'y-websocket' - * const doc = new Y.Doc() - * const provider = new WebsocketProvider('http://localhost:1234', 'my-document-name', doc) - * - * @extends {ObservableV2<{ 'connection-close': (event: CloseEvent | null, provider: WebsocketProvider) => any, 'status': (event: { status: 'connected' | 'disconnected' | 'connecting' }) => any, 'connection-error': (event: Event, provider: WebsocketProvider) => any, 'sync': (state: boolean) => any }>} - */ -export class WebsocketProvider extends ObservableV2<{ - 'connection-close': (event: CloseEvent | null, provider: WebsocketProvider) => any; - status: (event: { - status: 'connected' | 'disconnected' | 'connecting'; - }) => any; - 'connection-error': (event: Event, provider: WebsocketProvider) => any; - sync: (state: boolean) => any; -}> { - /** - * @param {string} serverUrl - * @param {string} roomname - * @param {Y.Doc} doc - * @param {object} opts - * @param {boolean} [opts.connect] - * @param {awarenessProtocol.Awareness} [opts.awareness] - * @param {Object} [opts.params] specify url parameters - * @param {Array} [opts.protocols] specify websocket protocols - * @param {typeof WebSocket} [opts.WebSocketPolyfill] Optionall provide a WebSocket polyfill - * @param {number} [opts.resyncInterval] Request server state every `resyncInterval` milliseconds - * @param {number} [opts.maxBackoffTime] Maximum amount of time to wait before trying to reconnect (we try to reconnect using exponential backoff) - * @param {boolean} [opts.disableBc] Disable cross-tab BroadcastChannel communication - */ - constructor(serverUrl: string, roomname: string, doc: Y.Doc, { connect, awareness, params, protocols, WebSocketPolyfill, resyncInterval, maxBackoffTime, disableBc }?: { - connect?: boolean | undefined; - awareness?: awarenessProtocol.Awareness | undefined; - params?: { - [x: string]: string; - } | undefined; - protocols?: string[] | undefined; - WebSocketPolyfill?: { - new (url: string | URL, protocols?: string | string[] | undefined): WebSocket; - prototype: WebSocket; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; - } | undefined; - resyncInterval?: number | undefined; - maxBackoffTime?: number | undefined; - disableBc?: boolean | undefined; - }); - serverUrl: string; - bcChannel: string; - maxBackoffTime: number; - /** - * The specified url parameters. This can be safely updated. The changed parameters will be used - * when a new connection is established. - * @type {Object} - */ - params: { - [x: string]: string; - }; - protocols: string[]; - roomname: string; - doc: Y.Doc; - _WS: { - new (url: string | URL, protocols?: string | string[] | undefined): WebSocket; - prototype: WebSocket; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; - }; - awareness: awarenessProtocol.Awareness; - wsconnected: boolean; - wsconnecting: boolean; - bcconnected: boolean; - disableBc: boolean; - wsUnsuccessfulReconnects: number; - messageHandlers: ((arg0: encoding.Encoder, arg1: decoding.Decoder, arg2: WebsocketProvider, arg3: boolean, arg4: number) => void)[]; - /** - * @type {boolean} - */ - _synced: boolean; - /** - * @type {WebSocket?} - */ - ws: WebSocket | null; - wsLastMessageReceived: number; - /** - * Whether to connect to other peers or not - * @type {boolean} - */ - shouldConnect: boolean; - /** - * @type {number} - */ - _resyncInterval: number; - /** - * @param {ArrayBuffer} data - * @param {any} origin - */ - _bcSubscriber: (data: ArrayBuffer, origin: any) => void; - /** - * Listens to Yjs updates and sends them to remote peers (ws and broadcastchannel) - * @param {Uint8Array} update - * @param {any} origin - */ - _updateHandler: (update: Uint8Array, origin: any) => void; - /** - * @param {any} changed - * @param {any} _origin - */ - _awarenessUpdateHandler: ({ added, updated, removed }: any, _origin: any) => void; - _exitHandler: () => void; - _checkInterval: any; - get url(): string; - set synced(arg: boolean); - /** - * @type {boolean} - */ - get synced(): boolean; - connectBc(): void; - disconnectBc(): void; - disconnect(): void; - connect(): void; -} -import { ObservableV2 } from "lib0/observable"; -import * as Y from "yjs"; -import * as awarenessProtocol from "y-protocols/awareness"; -import * as encoding from "lib0/encoding"; -import * as decoding from "lib0/decoding"; diff --git a/yjs-poll/node_modules/y-websocket/dist/y-websocket.cjs b/yjs-poll/node_modules/y-websocket/dist/y-websocket.cjs deleted file mode 100644 index 8eeeff7..0000000 --- a/yjs-poll/node_modules/y-websocket/dist/y-websocket.cjs +++ /dev/null @@ -1,550 +0,0 @@ -'use strict'; - -require('yjs'); -var bc = require('lib0/broadcastchannel'); -var time = require('lib0/time'); -var encoding = require('lib0/encoding'); -var decoding = require('lib0/decoding'); -var syncProtocol = require('y-protocols/sync'); -var authProtocol = require('y-protocols/auth'); -var awarenessProtocol = require('y-protocols/awareness'); -var observable = require('lib0/observable'); -var math = require('lib0/math'); -var url = require('lib0/url'); -var env = require('lib0/environment'); - -function _interopNamespaceDefault(e) { - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n.default = e; - return Object.freeze(n); -} - -var bc__namespace = /*#__PURE__*/_interopNamespaceDefault(bc); -var time__namespace = /*#__PURE__*/_interopNamespaceDefault(time); -var encoding__namespace = /*#__PURE__*/_interopNamespaceDefault(encoding); -var decoding__namespace = /*#__PURE__*/_interopNamespaceDefault(decoding); -var syncProtocol__namespace = /*#__PURE__*/_interopNamespaceDefault(syncProtocol); -var authProtocol__namespace = /*#__PURE__*/_interopNamespaceDefault(authProtocol); -var awarenessProtocol__namespace = /*#__PURE__*/_interopNamespaceDefault(awarenessProtocol); -var math__namespace = /*#__PURE__*/_interopNamespaceDefault(math); -var url__namespace = /*#__PURE__*/_interopNamespaceDefault(url); -var env__namespace = /*#__PURE__*/_interopNamespaceDefault(env); - -/** - * @module provider/websocket - */ - - -const messageSync = 0; -const messageQueryAwareness = 3; -const messageAwareness = 1; -const messageAuth = 2; - -/** - * encoder, decoder, provider, emitSynced, messageType - * @type {Array} - */ -const messageHandlers = []; - -messageHandlers[messageSync] = ( - encoder, - decoder, - provider, - emitSynced, - _messageType -) => { - encoding__namespace.writeVarUint(encoder, messageSync); - const syncMessageType = syncProtocol__namespace.readSyncMessage( - decoder, - encoder, - provider.doc, - provider - ); - if ( - emitSynced && syncMessageType === syncProtocol__namespace.messageYjsSyncStep2 && - !provider.synced - ) { - provider.synced = true; - } -}; - -messageHandlers[messageQueryAwareness] = ( - encoder, - _decoder, - provider, - _emitSynced, - _messageType -) => { - encoding__namespace.writeVarUint(encoder, messageAwareness); - encoding__namespace.writeVarUint8Array( - encoder, - awarenessProtocol__namespace.encodeAwarenessUpdate( - provider.awareness, - Array.from(provider.awareness.getStates().keys()) - ) - ); -}; - -messageHandlers[messageAwareness] = ( - _encoder, - decoder, - provider, - _emitSynced, - _messageType -) => { - awarenessProtocol__namespace.applyAwarenessUpdate( - provider.awareness, - decoding__namespace.readVarUint8Array(decoder), - provider - ); -}; - -messageHandlers[messageAuth] = ( - _encoder, - decoder, - provider, - _emitSynced, - _messageType -) => { - authProtocol__namespace.readAuthMessage( - decoder, - provider.doc, - (_ydoc, reason) => permissionDeniedHandler(provider, reason) - ); -}; - -// @todo - this should depend on awareness.outdatedTime -const messageReconnectTimeout = 30000; - -/** - * @param {WebsocketProvider} provider - * @param {string} reason - */ -const permissionDeniedHandler = (provider, reason) => - console.warn(`Permission denied to access ${provider.url}.\n${reason}`); - -/** - * @param {WebsocketProvider} provider - * @param {Uint8Array} buf - * @param {boolean} emitSynced - * @return {encoding.Encoder} - */ -const readMessage = (provider, buf, emitSynced) => { - const decoder = decoding__namespace.createDecoder(buf); - const encoder = encoding__namespace.createEncoder(); - const messageType = decoding__namespace.readVarUint(decoder); - const messageHandler = provider.messageHandlers[messageType]; - if (/** @type {any} */ (messageHandler)) { - messageHandler(encoder, decoder, provider, emitSynced, messageType); - } else { - console.error('Unable to compute message'); - } - return encoder -}; - -/** - * Outsource this function so that a new websocket connection is created immediately. - * I suspect that the `ws.onclose` event is not always fired if there are network issues. - * - * @param {WebsocketProvider} provider - * @param {WebSocket} ws - * @param {CloseEvent | null} event - */ -const closeWebsocketConnection = (provider, ws, event) => { - if (ws === provider.ws) { - provider.emit('connection-close', [event, provider]); - provider.ws = null; - ws.close(); - provider.wsconnecting = false; - if (provider.wsconnected) { - provider.wsconnected = false; - provider.synced = false; - // update awareness (all users except local left) - awarenessProtocol__namespace.removeAwarenessStates( - provider.awareness, - Array.from(provider.awareness.getStates().keys()).filter((client) => - client !== provider.doc.clientID - ), - provider - ); - provider.emit('status', [{ - status: 'disconnected' - }]); - } else { - provider.wsUnsuccessfulReconnects++; - } - // Start with no reconnect timeout and increase timeout by - // using exponential backoff starting with 100ms - setTimeout( - setupWS, - math__namespace.min( - math__namespace.pow(2, provider.wsUnsuccessfulReconnects) * 100, - provider.maxBackoffTime - ), - provider - ); - } -}; - -/** - * @param {WebsocketProvider} provider - */ -const setupWS = (provider) => { - if (provider.shouldConnect && provider.ws === null) { - const websocket = new provider._WS(provider.url, provider.protocols); - websocket.binaryType = 'arraybuffer'; - provider.ws = websocket; - provider.wsconnecting = true; - provider.wsconnected = false; - provider.synced = false; - - websocket.onmessage = (event) => { - provider.wsLastMessageReceived = time__namespace.getUnixTime(); - const encoder = readMessage(provider, new Uint8Array(event.data), true); - if (encoding__namespace.length(encoder) > 1) { - websocket.send(encoding__namespace.toUint8Array(encoder)); - } - }; - websocket.onerror = (event) => { - provider.emit('connection-error', [event, provider]); - }; - websocket.onclose = (event) => { - closeWebsocketConnection(provider, websocket, event); - }; - websocket.onopen = () => { - provider.wsLastMessageReceived = time__namespace.getUnixTime(); - provider.wsconnecting = false; - provider.wsconnected = true; - provider.wsUnsuccessfulReconnects = 0; - provider.emit('status', [{ - status: 'connected' - }]); - // always send sync step 1 when connected - const encoder = encoding__namespace.createEncoder(); - encoding__namespace.writeVarUint(encoder, messageSync); - syncProtocol__namespace.writeSyncStep1(encoder, provider.doc); - websocket.send(encoding__namespace.toUint8Array(encoder)); - // broadcast local awareness state - if (provider.awareness.getLocalState() !== null) { - const encoderAwarenessState = encoding__namespace.createEncoder(); - encoding__namespace.writeVarUint(encoderAwarenessState, messageAwareness); - encoding__namespace.writeVarUint8Array( - encoderAwarenessState, - awarenessProtocol__namespace.encodeAwarenessUpdate(provider.awareness, [ - provider.doc.clientID - ]) - ); - websocket.send(encoding__namespace.toUint8Array(encoderAwarenessState)); - } - }; - provider.emit('status', [{ - status: 'connecting' - }]); - } -}; - -/** - * @param {WebsocketProvider} provider - * @param {ArrayBuffer} buf - */ -const broadcastMessage = (provider, buf) => { - const ws = provider.ws; - if (provider.wsconnected && ws && ws.readyState === ws.OPEN) { - ws.send(buf); - } - if (provider.bcconnected) { - bc__namespace.publish(provider.bcChannel, buf, provider); - } -}; - -/** - * Websocket Provider for Yjs. Creates a websocket connection to sync the shared document. - * The document name is attached to the provided url. I.e. the following example - * creates a websocket connection to http://localhost:1234/my-document-name - * - * @example - * import * as Y from 'yjs' - * import { WebsocketProvider } from 'y-websocket' - * const doc = new Y.Doc() - * const provider = new WebsocketProvider('http://localhost:1234', 'my-document-name', doc) - * - * @extends {ObservableV2<{ 'connection-close': (event: CloseEvent | null, provider: WebsocketProvider) => any, 'status': (event: { status: 'connected' | 'disconnected' | 'connecting' }) => any, 'connection-error': (event: Event, provider: WebsocketProvider) => any, 'sync': (state: boolean) => any }>} - */ -class WebsocketProvider extends observable.ObservableV2 { - /** - * @param {string} serverUrl - * @param {string} roomname - * @param {Y.Doc} doc - * @param {object} opts - * @param {boolean} [opts.connect] - * @param {awarenessProtocol.Awareness} [opts.awareness] - * @param {Object} [opts.params] specify url parameters - * @param {Array} [opts.protocols] specify websocket protocols - * @param {typeof WebSocket} [opts.WebSocketPolyfill] Optionall provide a WebSocket polyfill - * @param {number} [opts.resyncInterval] Request server state every `resyncInterval` milliseconds - * @param {number} [opts.maxBackoffTime] Maximum amount of time to wait before trying to reconnect (we try to reconnect using exponential backoff) - * @param {boolean} [opts.disableBc] Disable cross-tab BroadcastChannel communication - */ - constructor (serverUrl, roomname, doc, { - connect = true, - awareness = new awarenessProtocol__namespace.Awareness(doc), - params = {}, - protocols = [], - WebSocketPolyfill = WebSocket, - resyncInterval = -1, - maxBackoffTime = 2500, - disableBc = false - } = {}) { - super(); - // ensure that serverUrl does not end with / - while (serverUrl[serverUrl.length - 1] === '/') { - serverUrl = serverUrl.slice(0, serverUrl.length - 1); - } - this.serverUrl = serverUrl; - this.bcChannel = serverUrl + '/' + roomname; - this.maxBackoffTime = maxBackoffTime; - /** - * The specified url parameters. This can be safely updated. The changed parameters will be used - * when a new connection is established. - * @type {Object} - */ - this.params = params; - this.protocols = protocols; - this.roomname = roomname; - this.doc = doc; - this._WS = WebSocketPolyfill; - this.awareness = awareness; - this.wsconnected = false; - this.wsconnecting = false; - this.bcconnected = false; - this.disableBc = disableBc; - this.wsUnsuccessfulReconnects = 0; - this.messageHandlers = messageHandlers.slice(); - /** - * @type {boolean} - */ - this._synced = false; - /** - * @type {WebSocket?} - */ - this.ws = null; - this.wsLastMessageReceived = 0; - /** - * Whether to connect to other peers or not - * @type {boolean} - */ - this.shouldConnect = connect; - - /** - * @type {number} - */ - this._resyncInterval = 0; - if (resyncInterval > 0) { - this._resyncInterval = /** @type {any} */ (setInterval(() => { - if (this.ws && this.ws.readyState === WebSocket.OPEN) { - // resend sync step 1 - const encoder = encoding__namespace.createEncoder(); - encoding__namespace.writeVarUint(encoder, messageSync); - syncProtocol__namespace.writeSyncStep1(encoder, doc); - this.ws.send(encoding__namespace.toUint8Array(encoder)); - } - }, resyncInterval)); - } - - /** - * @param {ArrayBuffer} data - * @param {any} origin - */ - this._bcSubscriber = (data, origin) => { - if (origin !== this) { - const encoder = readMessage(this, new Uint8Array(data), false); - if (encoding__namespace.length(encoder) > 1) { - bc__namespace.publish(this.bcChannel, encoding__namespace.toUint8Array(encoder), this); - } - } - }; - /** - * Listens to Yjs updates and sends them to remote peers (ws and broadcastchannel) - * @param {Uint8Array} update - * @param {any} origin - */ - this._updateHandler = (update, origin) => { - if (origin !== this) { - const encoder = encoding__namespace.createEncoder(); - encoding__namespace.writeVarUint(encoder, messageSync); - syncProtocol__namespace.writeUpdate(encoder, update); - broadcastMessage(this, encoding__namespace.toUint8Array(encoder)); - } - }; - this.doc.on('update', this._updateHandler); - /** - * @param {any} changed - * @param {any} _origin - */ - this._awarenessUpdateHandler = ({ added, updated, removed }, _origin) => { - const changedClients = added.concat(updated).concat(removed); - const encoder = encoding__namespace.createEncoder(); - encoding__namespace.writeVarUint(encoder, messageAwareness); - encoding__namespace.writeVarUint8Array( - encoder, - awarenessProtocol__namespace.encodeAwarenessUpdate(awareness, changedClients) - ); - broadcastMessage(this, encoding__namespace.toUint8Array(encoder)); - }; - this._exitHandler = () => { - awarenessProtocol__namespace.removeAwarenessStates( - this.awareness, - [doc.clientID], - 'app closed' - ); - }; - if (env__namespace.isNode && typeof process !== 'undefined') { - process.on('exit', this._exitHandler); - } - awareness.on('update', this._awarenessUpdateHandler); - this._checkInterval = /** @type {any} */ (setInterval(() => { - if ( - this.wsconnected && - messageReconnectTimeout < - time__namespace.getUnixTime() - this.wsLastMessageReceived - ) { - // no message received in a long time - not even your own awareness - // updates (which are updated every 15 seconds) - closeWebsocketConnection(this, /** @type {WebSocket} */ (this.ws), null); - } - }, messageReconnectTimeout / 10)); - if (connect) { - this.connect(); - } - } - - get url () { - const encodedParams = url__namespace.encodeQueryParams(this.params); - return this.serverUrl + '/' + this.roomname + - (encodedParams.length === 0 ? '' : '?' + encodedParams) - } - - /** - * @type {boolean} - */ - get synced () { - return this._synced - } - - set synced (state) { - if (this._synced !== state) { - this._synced = state; - // @ts-ignore - this.emit('synced', [state]); - this.emit('sync', [state]); - } - } - - destroy () { - if (this._resyncInterval !== 0) { - clearInterval(this._resyncInterval); - } - clearInterval(this._checkInterval); - this.disconnect(); - if (env__namespace.isNode && typeof process !== 'undefined') { - process.off('exit', this._exitHandler); - } - this.awareness.off('update', this._awarenessUpdateHandler); - this.doc.off('update', this._updateHandler); - super.destroy(); - } - - connectBc () { - if (this.disableBc) { - return - } - if (!this.bcconnected) { - bc__namespace.subscribe(this.bcChannel, this._bcSubscriber); - this.bcconnected = true; - } - // send sync step1 to bc - // write sync step 1 - const encoderSync = encoding__namespace.createEncoder(); - encoding__namespace.writeVarUint(encoderSync, messageSync); - syncProtocol__namespace.writeSyncStep1(encoderSync, this.doc); - bc__namespace.publish(this.bcChannel, encoding__namespace.toUint8Array(encoderSync), this); - // broadcast local state - const encoderState = encoding__namespace.createEncoder(); - encoding__namespace.writeVarUint(encoderState, messageSync); - syncProtocol__namespace.writeSyncStep2(encoderState, this.doc); - bc__namespace.publish(this.bcChannel, encoding__namespace.toUint8Array(encoderState), this); - // write queryAwareness - const encoderAwarenessQuery = encoding__namespace.createEncoder(); - encoding__namespace.writeVarUint(encoderAwarenessQuery, messageQueryAwareness); - bc__namespace.publish( - this.bcChannel, - encoding__namespace.toUint8Array(encoderAwarenessQuery), - this - ); - // broadcast local awareness state - const encoderAwarenessState = encoding__namespace.createEncoder(); - encoding__namespace.writeVarUint(encoderAwarenessState, messageAwareness); - encoding__namespace.writeVarUint8Array( - encoderAwarenessState, - awarenessProtocol__namespace.encodeAwarenessUpdate(this.awareness, [ - this.doc.clientID - ]) - ); - bc__namespace.publish( - this.bcChannel, - encoding__namespace.toUint8Array(encoderAwarenessState), - this - ); - } - - disconnectBc () { - // broadcast message with local awareness state set to null (indicating disconnect) - const encoder = encoding__namespace.createEncoder(); - encoding__namespace.writeVarUint(encoder, messageAwareness); - encoding__namespace.writeVarUint8Array( - encoder, - awarenessProtocol__namespace.encodeAwarenessUpdate(this.awareness, [ - this.doc.clientID - ], new Map()) - ); - broadcastMessage(this, encoding__namespace.toUint8Array(encoder)); - if (this.bcconnected) { - bc__namespace.unsubscribe(this.bcChannel, this._bcSubscriber); - this.bcconnected = false; - } - } - - disconnect () { - this.shouldConnect = false; - this.disconnectBc(); - if (this.ws !== null) { - closeWebsocketConnection(this, this.ws, null); - } - } - - connect () { - this.shouldConnect = true; - if (!this.wsconnected && this.ws === null) { - setupWS(this); - this.connectBc(); - } - } -} - -exports.WebsocketProvider = WebsocketProvider; -exports.messageAuth = messageAuth; -exports.messageAwareness = messageAwareness; -exports.messageQueryAwareness = messageQueryAwareness; -exports.messageSync = messageSync; -//# sourceMappingURL=y-websocket.cjs.map diff --git a/yjs-poll/node_modules/y-websocket/dist/y-websocket.cjs.map b/yjs-poll/node_modules/y-websocket/dist/y-websocket.cjs.map deleted file mode 100644 index bac6416..0000000 --- a/yjs-poll/node_modules/y-websocket/dist/y-websocket.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"y-websocket.cjs","sources":["../src/y-websocket.js"],"sourcesContent":["/**\n * @module provider/websocket\n */\n\n/* eslint-env browser */\n\nimport * as Y from 'yjs' // eslint-disable-line\nimport * as bc from 'lib0/broadcastchannel'\nimport * as time from 'lib0/time'\nimport * as encoding from 'lib0/encoding'\nimport * as decoding from 'lib0/decoding'\nimport * as syncProtocol from 'y-protocols/sync'\nimport * as authProtocol from 'y-protocols/auth'\nimport * as awarenessProtocol from 'y-protocols/awareness'\nimport { ObservableV2 } from 'lib0/observable'\nimport * as math from 'lib0/math'\nimport * as url from 'lib0/url'\nimport * as env from 'lib0/environment'\n\nexport const messageSync = 0\nexport const messageQueryAwareness = 3\nexport const messageAwareness = 1\nexport const messageAuth = 2\n\n/**\n * encoder, decoder, provider, emitSynced, messageType\n * @type {Array}\n */\nconst messageHandlers = []\n\nmessageHandlers[messageSync] = (\n encoder,\n decoder,\n provider,\n emitSynced,\n _messageType\n) => {\n encoding.writeVarUint(encoder, messageSync)\n const syncMessageType = syncProtocol.readSyncMessage(\n decoder,\n encoder,\n provider.doc,\n provider\n )\n if (\n emitSynced && syncMessageType === syncProtocol.messageYjsSyncStep2 &&\n !provider.synced\n ) {\n provider.synced = true\n }\n}\n\nmessageHandlers[messageQueryAwareness] = (\n encoder,\n _decoder,\n provider,\n _emitSynced,\n _messageType\n) => {\n encoding.writeVarUint(encoder, messageAwareness)\n encoding.writeVarUint8Array(\n encoder,\n awarenessProtocol.encodeAwarenessUpdate(\n provider.awareness,\n Array.from(provider.awareness.getStates().keys())\n )\n )\n}\n\nmessageHandlers[messageAwareness] = (\n _encoder,\n decoder,\n provider,\n _emitSynced,\n _messageType\n) => {\n awarenessProtocol.applyAwarenessUpdate(\n provider.awareness,\n decoding.readVarUint8Array(decoder),\n provider\n )\n}\n\nmessageHandlers[messageAuth] = (\n _encoder,\n decoder,\n provider,\n _emitSynced,\n _messageType\n) => {\n authProtocol.readAuthMessage(\n decoder,\n provider.doc,\n (_ydoc, reason) => permissionDeniedHandler(provider, reason)\n )\n}\n\n// @todo - this should depend on awareness.outdatedTime\nconst messageReconnectTimeout = 30000\n\n/**\n * @param {WebsocketProvider} provider\n * @param {string} reason\n */\nconst permissionDeniedHandler = (provider, reason) =>\n console.warn(`Permission denied to access ${provider.url}.\\n${reason}`)\n\n/**\n * @param {WebsocketProvider} provider\n * @param {Uint8Array} buf\n * @param {boolean} emitSynced\n * @return {encoding.Encoder}\n */\nconst readMessage = (provider, buf, emitSynced) => {\n const decoder = decoding.createDecoder(buf)\n const encoder = encoding.createEncoder()\n const messageType = decoding.readVarUint(decoder)\n const messageHandler = provider.messageHandlers[messageType]\n if (/** @type {any} */ (messageHandler)) {\n messageHandler(encoder, decoder, provider, emitSynced, messageType)\n } else {\n console.error('Unable to compute message')\n }\n return encoder\n}\n\n/**\n * Outsource this function so that a new websocket connection is created immediately.\n * I suspect that the `ws.onclose` event is not always fired if there are network issues.\n *\n * @param {WebsocketProvider} provider\n * @param {WebSocket} ws\n * @param {CloseEvent | null} event\n */\nconst closeWebsocketConnection = (provider, ws, event) => {\n if (ws === provider.ws) {\n provider.emit('connection-close', [event, provider])\n provider.ws = null\n ws.close()\n provider.wsconnecting = false\n if (provider.wsconnected) {\n provider.wsconnected = false\n provider.synced = false\n // update awareness (all users except local left)\n awarenessProtocol.removeAwarenessStates(\n provider.awareness,\n Array.from(provider.awareness.getStates().keys()).filter((client) =>\n client !== provider.doc.clientID\n ),\n provider\n )\n provider.emit('status', [{\n status: 'disconnected'\n }])\n } else {\n provider.wsUnsuccessfulReconnects++\n }\n // Start with no reconnect timeout and increase timeout by\n // using exponential backoff starting with 100ms\n setTimeout(\n setupWS,\n math.min(\n math.pow(2, provider.wsUnsuccessfulReconnects) * 100,\n provider.maxBackoffTime\n ),\n provider\n )\n }\n}\n\n/**\n * @param {WebsocketProvider} provider\n */\nconst setupWS = (provider) => {\n if (provider.shouldConnect && provider.ws === null) {\n const websocket = new provider._WS(provider.url, provider.protocols)\n websocket.binaryType = 'arraybuffer'\n provider.ws = websocket\n provider.wsconnecting = true\n provider.wsconnected = false\n provider.synced = false\n\n websocket.onmessage = (event) => {\n provider.wsLastMessageReceived = time.getUnixTime()\n const encoder = readMessage(provider, new Uint8Array(event.data), true)\n if (encoding.length(encoder) > 1) {\n websocket.send(encoding.toUint8Array(encoder))\n }\n }\n websocket.onerror = (event) => {\n provider.emit('connection-error', [event, provider])\n }\n websocket.onclose = (event) => {\n closeWebsocketConnection(provider, websocket, event)\n }\n websocket.onopen = () => {\n provider.wsLastMessageReceived = time.getUnixTime()\n provider.wsconnecting = false\n provider.wsconnected = true\n provider.wsUnsuccessfulReconnects = 0\n provider.emit('status', [{\n status: 'connected'\n }])\n // always send sync step 1 when connected\n const encoder = encoding.createEncoder()\n encoding.writeVarUint(encoder, messageSync)\n syncProtocol.writeSyncStep1(encoder, provider.doc)\n websocket.send(encoding.toUint8Array(encoder))\n // broadcast local awareness state\n if (provider.awareness.getLocalState() !== null) {\n const encoderAwarenessState = encoding.createEncoder()\n encoding.writeVarUint(encoderAwarenessState, messageAwareness)\n encoding.writeVarUint8Array(\n encoderAwarenessState,\n awarenessProtocol.encodeAwarenessUpdate(provider.awareness, [\n provider.doc.clientID\n ])\n )\n websocket.send(encoding.toUint8Array(encoderAwarenessState))\n }\n }\n provider.emit('status', [{\n status: 'connecting'\n }])\n }\n}\n\n/**\n * @param {WebsocketProvider} provider\n * @param {ArrayBuffer} buf\n */\nconst broadcastMessage = (provider, buf) => {\n const ws = provider.ws\n if (provider.wsconnected && ws && ws.readyState === ws.OPEN) {\n ws.send(buf)\n }\n if (provider.bcconnected) {\n bc.publish(provider.bcChannel, buf, provider)\n }\n}\n\n/**\n * Websocket Provider for Yjs. Creates a websocket connection to sync the shared document.\n * The document name is attached to the provided url. I.e. the following example\n * creates a websocket connection to http://localhost:1234/my-document-name\n *\n * @example\n * import * as Y from 'yjs'\n * import { WebsocketProvider } from 'y-websocket'\n * const doc = new Y.Doc()\n * const provider = new WebsocketProvider('http://localhost:1234', 'my-document-name', doc)\n *\n * @extends {ObservableV2<{ 'connection-close': (event: CloseEvent | null, provider: WebsocketProvider) => any, 'status': (event: { status: 'connected' | 'disconnected' | 'connecting' }) => any, 'connection-error': (event: Event, provider: WebsocketProvider) => any, 'sync': (state: boolean) => any }>}\n */\nexport class WebsocketProvider extends ObservableV2 {\n /**\n * @param {string} serverUrl\n * @param {string} roomname\n * @param {Y.Doc} doc\n * @param {object} opts\n * @param {boolean} [opts.connect]\n * @param {awarenessProtocol.Awareness} [opts.awareness]\n * @param {Object} [opts.params] specify url parameters\n * @param {Array} [opts.protocols] specify websocket protocols\n * @param {typeof WebSocket} [opts.WebSocketPolyfill] Optionall provide a WebSocket polyfill\n * @param {number} [opts.resyncInterval] Request server state every `resyncInterval` milliseconds\n * @param {number} [opts.maxBackoffTime] Maximum amount of time to wait before trying to reconnect (we try to reconnect using exponential backoff)\n * @param {boolean} [opts.disableBc] Disable cross-tab BroadcastChannel communication\n */\n constructor (serverUrl, roomname, doc, {\n connect = true,\n awareness = new awarenessProtocol.Awareness(doc),\n params = {},\n protocols = [],\n WebSocketPolyfill = WebSocket,\n resyncInterval = -1,\n maxBackoffTime = 2500,\n disableBc = false\n } = {}) {\n super()\n // ensure that serverUrl does not end with /\n while (serverUrl[serverUrl.length - 1] === '/') {\n serverUrl = serverUrl.slice(0, serverUrl.length - 1)\n }\n this.serverUrl = serverUrl\n this.bcChannel = serverUrl + '/' + roomname\n this.maxBackoffTime = maxBackoffTime\n /**\n * The specified url parameters. This can be safely updated. The changed parameters will be used\n * when a new connection is established.\n * @type {Object}\n */\n this.params = params\n this.protocols = protocols\n this.roomname = roomname\n this.doc = doc\n this._WS = WebSocketPolyfill\n this.awareness = awareness\n this.wsconnected = false\n this.wsconnecting = false\n this.bcconnected = false\n this.disableBc = disableBc\n this.wsUnsuccessfulReconnects = 0\n this.messageHandlers = messageHandlers.slice()\n /**\n * @type {boolean}\n */\n this._synced = false\n /**\n * @type {WebSocket?}\n */\n this.ws = null\n this.wsLastMessageReceived = 0\n /**\n * Whether to connect to other peers or not\n * @type {boolean}\n */\n this.shouldConnect = connect\n\n /**\n * @type {number}\n */\n this._resyncInterval = 0\n if (resyncInterval > 0) {\n this._resyncInterval = /** @type {any} */ (setInterval(() => {\n if (this.ws && this.ws.readyState === WebSocket.OPEN) {\n // resend sync step 1\n const encoder = encoding.createEncoder()\n encoding.writeVarUint(encoder, messageSync)\n syncProtocol.writeSyncStep1(encoder, doc)\n this.ws.send(encoding.toUint8Array(encoder))\n }\n }, resyncInterval))\n }\n\n /**\n * @param {ArrayBuffer} data\n * @param {any} origin\n */\n this._bcSubscriber = (data, origin) => {\n if (origin !== this) {\n const encoder = readMessage(this, new Uint8Array(data), false)\n if (encoding.length(encoder) > 1) {\n bc.publish(this.bcChannel, encoding.toUint8Array(encoder), this)\n }\n }\n }\n /**\n * Listens to Yjs updates and sends them to remote peers (ws and broadcastchannel)\n * @param {Uint8Array} update\n * @param {any} origin\n */\n this._updateHandler = (update, origin) => {\n if (origin !== this) {\n const encoder = encoding.createEncoder()\n encoding.writeVarUint(encoder, messageSync)\n syncProtocol.writeUpdate(encoder, update)\n broadcastMessage(this, encoding.toUint8Array(encoder))\n }\n }\n this.doc.on('update', this._updateHandler)\n /**\n * @param {any} changed\n * @param {any} _origin\n */\n this._awarenessUpdateHandler = ({ added, updated, removed }, _origin) => {\n const changedClients = added.concat(updated).concat(removed)\n const encoder = encoding.createEncoder()\n encoding.writeVarUint(encoder, messageAwareness)\n encoding.writeVarUint8Array(\n encoder,\n awarenessProtocol.encodeAwarenessUpdate(awareness, changedClients)\n )\n broadcastMessage(this, encoding.toUint8Array(encoder))\n }\n this._exitHandler = () => {\n awarenessProtocol.removeAwarenessStates(\n this.awareness,\n [doc.clientID],\n 'app closed'\n )\n }\n if (env.isNode && typeof process !== 'undefined') {\n process.on('exit', this._exitHandler)\n }\n awareness.on('update', this._awarenessUpdateHandler)\n this._checkInterval = /** @type {any} */ (setInterval(() => {\n if (\n this.wsconnected &&\n messageReconnectTimeout <\n time.getUnixTime() - this.wsLastMessageReceived\n ) {\n // no message received in a long time - not even your own awareness\n // updates (which are updated every 15 seconds)\n closeWebsocketConnection(this, /** @type {WebSocket} */ (this.ws), null)\n }\n }, messageReconnectTimeout / 10))\n if (connect) {\n this.connect()\n }\n }\n\n get url () {\n const encodedParams = url.encodeQueryParams(this.params)\n return this.serverUrl + '/' + this.roomname +\n (encodedParams.length === 0 ? '' : '?' + encodedParams)\n }\n\n /**\n * @type {boolean}\n */\n get synced () {\n return this._synced\n }\n\n set synced (state) {\n if (this._synced !== state) {\n this._synced = state\n // @ts-ignore\n this.emit('synced', [state])\n this.emit('sync', [state])\n }\n }\n\n destroy () {\n if (this._resyncInterval !== 0) {\n clearInterval(this._resyncInterval)\n }\n clearInterval(this._checkInterval)\n this.disconnect()\n if (env.isNode && typeof process !== 'undefined') {\n process.off('exit', this._exitHandler)\n }\n this.awareness.off('update', this._awarenessUpdateHandler)\n this.doc.off('update', this._updateHandler)\n super.destroy()\n }\n\n connectBc () {\n if (this.disableBc) {\n return\n }\n if (!this.bcconnected) {\n bc.subscribe(this.bcChannel, this._bcSubscriber)\n this.bcconnected = true\n }\n // send sync step1 to bc\n // write sync step 1\n const encoderSync = encoding.createEncoder()\n encoding.writeVarUint(encoderSync, messageSync)\n syncProtocol.writeSyncStep1(encoderSync, this.doc)\n bc.publish(this.bcChannel, encoding.toUint8Array(encoderSync), this)\n // broadcast local state\n const encoderState = encoding.createEncoder()\n encoding.writeVarUint(encoderState, messageSync)\n syncProtocol.writeSyncStep2(encoderState, this.doc)\n bc.publish(this.bcChannel, encoding.toUint8Array(encoderState), this)\n // write queryAwareness\n const encoderAwarenessQuery = encoding.createEncoder()\n encoding.writeVarUint(encoderAwarenessQuery, messageQueryAwareness)\n bc.publish(\n this.bcChannel,\n encoding.toUint8Array(encoderAwarenessQuery),\n this\n )\n // broadcast local awareness state\n const encoderAwarenessState = encoding.createEncoder()\n encoding.writeVarUint(encoderAwarenessState, messageAwareness)\n encoding.writeVarUint8Array(\n encoderAwarenessState,\n awarenessProtocol.encodeAwarenessUpdate(this.awareness, [\n this.doc.clientID\n ])\n )\n bc.publish(\n this.bcChannel,\n encoding.toUint8Array(encoderAwarenessState),\n this\n )\n }\n\n disconnectBc () {\n // broadcast message with local awareness state set to null (indicating disconnect)\n const encoder = encoding.createEncoder()\n encoding.writeVarUint(encoder, messageAwareness)\n encoding.writeVarUint8Array(\n encoder,\n awarenessProtocol.encodeAwarenessUpdate(this.awareness, [\n this.doc.clientID\n ], new Map())\n )\n broadcastMessage(this, encoding.toUint8Array(encoder))\n if (this.bcconnected) {\n bc.unsubscribe(this.bcChannel, this._bcSubscriber)\n this.bcconnected = false\n }\n }\n\n disconnect () {\n this.shouldConnect = false\n this.disconnectBc()\n if (this.ws !== null) {\n closeWebsocketConnection(this, this.ws, null)\n }\n }\n\n connect () {\n this.shouldConnect = true\n if (!this.wsconnected && this.ws === null) {\n setupWS(this)\n this.connectBc()\n }\n }\n}\n"],"names":["encoding","syncProtocol","awarenessProtocol","decoding","authProtocol","math","time","bc","ObservableV2","env","url"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AAeA;AACY,MAAC,WAAW,GAAG,EAAC;AAChB,MAAC,qBAAqB,GAAG,EAAC;AAC1B,MAAC,gBAAgB,GAAG,EAAC;AACrB,MAAC,WAAW,GAAG,EAAC;AAC5B;AACA;AACA;AACA;AACA;AACA,MAAM,eAAe,GAAG,GAAE;AAC1B;AACA,eAAe,CAAC,WAAW,CAAC,GAAG;AAC/B,EAAE,OAAO;AACT,EAAE,OAAO;AACT,EAAE,QAAQ;AACV,EAAE,UAAU;AACZ,EAAE,YAAY;AACd,KAAK;AACL,EAAEA,mBAAQ,CAAC,YAAY,CAAC,OAAO,EAAE,WAAW,EAAC;AAC7C,EAAE,MAAM,eAAe,GAAGC,uBAAY,CAAC,eAAe;AACtD,IAAI,OAAO;AACX,IAAI,OAAO;AACX,IAAI,QAAQ,CAAC,GAAG;AAChB,IAAI,QAAQ;AACZ,IAAG;AACH,EAAE;AACF,IAAI,UAAU,IAAI,eAAe,KAAKA,uBAAY,CAAC,mBAAmB;AACtE,IAAI,CAAC,QAAQ,CAAC,MAAM;AACpB,IAAI;AACJ,IAAI,QAAQ,CAAC,MAAM,GAAG,KAAI;AAC1B,GAAG;AACH,EAAC;AACD;AACA,eAAe,CAAC,qBAAqB,CAAC,GAAG;AACzC,EAAE,OAAO;AACT,EAAE,QAAQ;AACV,EAAE,QAAQ;AACV,EAAE,WAAW;AACb,EAAE,YAAY;AACd,KAAK;AACL,EAAED,mBAAQ,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,EAAC;AAClD,EAAEA,mBAAQ,CAAC,kBAAkB;AAC7B,IAAI,OAAO;AACX,IAAIE,4BAAiB,CAAC,qBAAqB;AAC3C,MAAM,QAAQ,CA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-websocket/package.json b/yjs-poll/node_modules/y-websocket/package.json deleted file mode 100644 index 65cc867..0000000 --- a/yjs-poll/node_modules/y-websocket/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "y-websocket", - "version": "3.0.0", - "description": "Websockets provider for Yjs", - "main": "./dist/y-websocket.cjs", - "module": "./src/y-websocket.js", - "types": "./dist/src/y-websocket.d.ts", - "type": "module", - "sideEffects": false, - "funding": { - "type": "GitHub Sponsors ❤", - "url": "https://github.com/sponsors/dmonad" - }, - "scripts": { - "dist": "rm -rf dist && rollup -c && tsc", - "lint": "standard && tsc", - "test": "npm run lint", - "preversion": "npm run lint && npm run dist && test -e dist/src/y-websocket.d.ts && test -e dist/y-websocket.cjs" - }, - "files": [ - "dist/*", - "src/*" - ], - "exports": { - "./package.json": "./package.json", - ".": { - "module": "./src/y-websocket.js", - "import": "./src/y-websocket.js", - "require": "./dist/y-websocket.cjs", - "types": "./dist/src/y-websocket.d.ts", - "default": "./src/y-websocket.js" - } - }, - "repository": { - "type": "git", - "url": "git+https://github.com/yjs/y-websocket.git" - }, - "keywords": [ - "Yjs" - ], - "author": "Kevin Jahns ", - "license": "MIT", - "bugs": { - "url": "https://github.com/yjs/y-websocket/issues" - }, - "homepage": "https://github.com/yjs/y-websocket#readme", - "standard": { - "ignore": [ - "/dist", - "/node_modules" - ] - }, - "dependencies": { - "lib0": "^0.2.102", - "y-protocols": "^1.0.5" - }, - "devDependencies": { - "@types/node": "^22.14.0", - "rollup": "^3.19.1", - "standard": "^12.0.1", - "typescript": "^4.9.5", - "yjs": "^13.5.0" - }, - "peerDependencies": { - "yjs": "^13.5.6" - }, - "engines": { - "npm": ">=8.0.0", - "node": ">=16.0.0" - } -} diff --git a/yjs-poll/node_modules/y-websocket/src/y-websocket.js b/yjs-poll/node_modules/y-websocket/src/y-websocket.js deleted file mode 100644 index c0fc343..0000000 --- a/yjs-poll/node_modules/y-websocket/src/y-websocket.js +++ /dev/null @@ -1,514 +0,0 @@ -/** - * @module provider/websocket - */ - -/* eslint-env browser */ - -import * as Y from 'yjs' // eslint-disable-line -import * as bc from 'lib0/broadcastchannel' -import * as time from 'lib0/time' -import * as encoding from 'lib0/encoding' -import * as decoding from 'lib0/decoding' -import * as syncProtocol from 'y-protocols/sync' -import * as authProtocol from 'y-protocols/auth' -import * as awarenessProtocol from 'y-protocols/awareness' -import { ObservableV2 } from 'lib0/observable' -import * as math from 'lib0/math' -import * as url from 'lib0/url' -import * as env from 'lib0/environment' - -export const messageSync = 0 -export const messageQueryAwareness = 3 -export const messageAwareness = 1 -export const messageAuth = 2 - -/** - * encoder, decoder, provider, emitSynced, messageType - * @type {Array} - */ -const messageHandlers = [] - -messageHandlers[messageSync] = ( - encoder, - decoder, - provider, - emitSynced, - _messageType -) => { - encoding.writeVarUint(encoder, messageSync) - const syncMessageType = syncProtocol.readSyncMessage( - decoder, - encoder, - provider.doc, - provider - ) - if ( - emitSynced && syncMessageType === syncProtocol.messageYjsSyncStep2 && - !provider.synced - ) { - provider.synced = true - } -} - -messageHandlers[messageQueryAwareness] = ( - encoder, - _decoder, - provider, - _emitSynced, - _messageType -) => { - encoding.writeVarUint(encoder, messageAwareness) - encoding.writeVarUint8Array( - encoder, - awarenessProtocol.encodeAwarenessUpdate( - provider.awareness, - Array.from(provider.awareness.getStates().keys()) - ) - ) -} - -messageHandlers[messageAwareness] = ( - _encoder, - decoder, - provider, - _emitSynced, - _messageType -) => { - awarenessProtocol.applyAwarenessUpdate( - provider.awareness, - decoding.readVarUint8Array(decoder), - provider - ) -} - -messageHandlers[messageAuth] = ( - _encoder, - decoder, - provider, - _emitSynced, - _messageType -) => { - authProtocol.readAuthMessage( - decoder, - provider.doc, - (_ydoc, reason) => permissionDeniedHandler(provider, reason) - ) -} - -// @todo - this should depend on awareness.outdatedTime -const messageReconnectTimeout = 30000 - -/** - * @param {WebsocketProvider} provider - * @param {string} reason - */ -const permissionDeniedHandler = (provider, reason) => - console.warn(`Permission denied to access ${provider.url}.\n${reason}`) - -/** - * @param {WebsocketProvider} provider - * @param {Uint8Array} buf - * @param {boolean} emitSynced - * @return {encoding.Encoder} - */ -const readMessage = (provider, buf, emitSynced) => { - const decoder = decoding.createDecoder(buf) - const encoder = encoding.createEncoder() - const messageType = decoding.readVarUint(decoder) - const messageHandler = provider.messageHandlers[messageType] - if (/** @type {any} */ (messageHandler)) { - messageHandler(encoder, decoder, provider, emitSynced, messageType) - } else { - console.error('Unable to compute message') - } - return encoder -} - -/** - * Outsource this function so that a new websocket connection is created immediately. - * I suspect that the `ws.onclose` event is not always fired if there are network issues. - * - * @param {WebsocketProvider} provider - * @param {WebSocket} ws - * @param {CloseEvent | null} event - */ -const closeWebsocketConnection = (provider, ws, event) => { - if (ws === provider.ws) { - provider.emit('connection-close', [event, provider]) - provider.ws = null - ws.close() - provider.wsconnecting = false - if (provider.wsconnected) { - provider.wsconnected = false - provider.synced = false - // update awareness (all users except local left) - awarenessProtocol.removeAwarenessStates( - provider.awareness, - Array.from(provider.awareness.getStates().keys()).filter((client) => - client !== provider.doc.clientID - ), - provider - ) - provider.emit('status', [{ - status: 'disconnected' - }]) - } else { - provider.wsUnsuccessfulReconnects++ - } - // Start with no reconnect timeout and increase timeout by - // using exponential backoff starting with 100ms - setTimeout( - setupWS, - math.min( - math.pow(2, provider.wsUnsuccessfulReconnects) * 100, - provider.maxBackoffTime - ), - provider - ) - } -} - -/** - * @param {WebsocketProvider} provider - */ -const setupWS = (provider) => { - if (provider.shouldConnect && provider.ws === null) { - const websocket = new provider._WS(provider.url, provider.protocols) - websocket.binaryType = 'arraybuffer' - provider.ws = websocket - provider.wsconnecting = true - provider.wsconnected = false - provider.synced = false - - websocket.onmessage = (event) => { - provider.wsLastMessageReceived = time.getUnixTime() - const encoder = readMessage(provider, new Uint8Array(event.data), true) - if (encoding.length(encoder) > 1) { - websocket.send(encoding.toUint8Array(encoder)) - } - } - websocket.onerror = (event) => { - provider.emit('connection-error', [event, provider]) - } - websocket.onclose = (event) => { - closeWebsocketConnection(provider, websocket, event) - } - websocket.onopen = () => { - provider.wsLastMessageReceived = time.getUnixTime() - provider.wsconnecting = false - provider.wsconnected = true - provider.wsUnsuccessfulReconnects = 0 - provider.emit('status', [{ - status: 'connected' - }]) - // always send sync step 1 when connected - const encoder = encoding.createEncoder() - encoding.writeVarUint(encoder, messageSync) - syncProtocol.writeSyncStep1(encoder, provider.doc) - websocket.send(encoding.toUint8Array(encoder)) - // broadcast local awareness state - if (provider.awareness.getLocalState() !== null) { - const encoderAwarenessState = encoding.createEncoder() - encoding.writeVarUint(encoderAwarenessState, messageAwareness) - encoding.writeVarUint8Array( - encoderAwarenessState, - awarenessProtocol.encodeAwarenessUpdate(provider.awareness, [ - provider.doc.clientID - ]) - ) - websocket.send(encoding.toUint8Array(encoderAwarenessState)) - } - } - provider.emit('status', [{ - status: 'connecting' - }]) - } -} - -/** - * @param {WebsocketProvider} provider - * @param {ArrayBuffer} buf - */ -const broadcastMessage = (provider, buf) => { - const ws = provider.ws - if (provider.wsconnected && ws && ws.readyState === ws.OPEN) { - ws.send(buf) - } - if (provider.bcconnected) { - bc.publish(provider.bcChannel, buf, provider) - } -} - -/** - * Websocket Provider for Yjs. Creates a websocket connection to sync the shared document. - * The document name is attached to the provided url. I.e. the following example - * creates a websocket connection to http://localhost:1234/my-document-name - * - * @example - * import * as Y from 'yjs' - * import { WebsocketProvider } from 'y-websocket' - * const doc = new Y.Doc() - * const provider = new WebsocketProvider('http://localhost:1234', 'my-document-name', doc) - * - * @extends {ObservableV2<{ 'connection-close': (event: CloseEvent | null, provider: WebsocketProvider) => any, 'status': (event: { status: 'connected' | 'disconnected' | 'connecting' }) => any, 'connection-error': (event: Event, provider: WebsocketProvider) => any, 'sync': (state: boolean) => any }>} - */ -export class WebsocketProvider extends ObservableV2 { - /** - * @param {string} serverUrl - * @param {string} roomname - * @param {Y.Doc} doc - * @param {object} opts - * @param {boolean} [opts.connect] - * @param {awarenessProtocol.Awareness} [opts.awareness] - * @param {Object} [opts.params] specify url parameters - * @param {Array} [opts.protocols] specify websocket protocols - * @param {typeof WebSocket} [opts.WebSocketPolyfill] Optionall provide a WebSocket polyfill - * @param {number} [opts.resyncInterval] Request server state every `resyncInterval` milliseconds - * @param {number} [opts.maxBackoffTime] Maximum amount of time to wait before trying to reconnect (we try to reconnect using exponential backoff) - * @param {boolean} [opts.disableBc] Disable cross-tab BroadcastChannel communication - */ - constructor (serverUrl, roomname, doc, { - connect = true, - awareness = new awarenessProtocol.Awareness(doc), - params = {}, - protocols = [], - WebSocketPolyfill = WebSocket, - resyncInterval = -1, - maxBackoffTime = 2500, - disableBc = false - } = {}) { - super() - // ensure that serverUrl does not end with / - while (serverUrl[serverUrl.length - 1] === '/') { - serverUrl = serverUrl.slice(0, serverUrl.length - 1) - } - this.serverUrl = serverUrl - this.bcChannel = serverUrl + '/' + roomname - this.maxBackoffTime = maxBackoffTime - /** - * The specified url parameters. This can be safely updated. The changed parameters will be used - * when a new connection is established. - * @type {Object} - */ - this.params = params - this.protocols = protocols - this.roomname = roomname - this.doc = doc - this._WS = WebSocketPolyfill - this.awareness = awareness - this.wsconnected = false - this.wsconnecting = false - this.bcconnected = false - this.disableBc = disableBc - this.wsUnsuccessfulReconnects = 0 - this.messageHandlers = messageHandlers.slice() - /** - * @type {boolean} - */ - this._synced = false - /** - * @type {WebSocket?} - */ - this.ws = null - this.wsLastMessageReceived = 0 - /** - * Whether to connect to other peers or not - * @type {boolean} - */ - this.shouldConnect = connect - - /** - * @type {number} - */ - this._resyncInterval = 0 - if (resyncInterval > 0) { - this._resyncInterval = /** @type {any} */ (setInterval(() => { - if (this.ws && this.ws.readyState === WebSocket.OPEN) { - // resend sync step 1 - const encoder = encoding.createEncoder() - encoding.writeVarUint(encoder, messageSync) - syncProtocol.writeSyncStep1(encoder, doc) - this.ws.send(encoding.toUint8Array(encoder)) - } - }, resyncInterval)) - } - - /** - * @param {ArrayBuffer} data - * @param {any} origin - */ - this._bcSubscriber = (data, origin) => { - if (origin !== this) { - const encoder = readMessage(this, new Uint8Array(data), false) - if (encoding.length(encoder) > 1) { - bc.publish(this.bcChannel, encoding.toUint8Array(encoder), this) - } - } - } - /** - * Listens to Yjs updates and sends them to remote peers (ws and broadcastchannel) - * @param {Uint8Array} update - * @param {any} origin - */ - this._updateHandler = (update, origin) => { - if (origin !== this) { - const encoder = encoding.createEncoder() - encoding.writeVarUint(encoder, messageSync) - syncProtocol.writeUpdate(encoder, update) - broadcastMessage(this, encoding.toUint8Array(encoder)) - } - } - this.doc.on('update', this._updateHandler) - /** - * @param {any} changed - * @param {any} _origin - */ - this._awarenessUpdateHandler = ({ added, updated, removed }, _origin) => { - const changedClients = added.concat(updated).concat(removed) - const encoder = encoding.createEncoder() - encoding.writeVarUint(encoder, messageAwareness) - encoding.writeVarUint8Array( - encoder, - awarenessProtocol.encodeAwarenessUpdate(awareness, changedClients) - ) - broadcastMessage(this, encoding.toUint8Array(encoder)) - } - this._exitHandler = () => { - awarenessProtocol.removeAwarenessStates( - this.awareness, - [doc.clientID], - 'app closed' - ) - } - if (env.isNode && typeof process !== 'undefined') { - process.on('exit', this._exitHandler) - } - awareness.on('update', this._awarenessUpdateHandler) - this._checkInterval = /** @type {any} */ (setInterval(() => { - if ( - this.wsconnected && - messageReconnectTimeout < - time.getUnixTime() - this.wsLastMessageReceived - ) { - // no message received in a long time - not even your own awareness - // updates (which are updated every 15 seconds) - closeWebsocketConnection(this, /** @type {WebSocket} */ (this.ws), null) - } - }, messageReconnectTimeout / 10)) - if (connect) { - this.connect() - } - } - - get url () { - const encodedParams = url.encodeQueryParams(this.params) - return this.serverUrl + '/' + this.roomname + - (encodedParams.length === 0 ? '' : '?' + encodedParams) - } - - /** - * @type {boolean} - */ - get synced () { - return this._synced - } - - set synced (state) { - if (this._synced !== state) { - this._synced = state - // @ts-ignore - this.emit('synced', [state]) - this.emit('sync', [state]) - } - } - - destroy () { - if (this._resyncInterval !== 0) { - clearInterval(this._resyncInterval) - } - clearInterval(this._checkInterval) - this.disconnect() - if (env.isNode && typeof process !== 'undefined') { - process.off('exit', this._exitHandler) - } - this.awareness.off('update', this._awarenessUpdateHandler) - this.doc.off('update', this._updateHandler) - super.destroy() - } - - connectBc () { - if (this.disableBc) { - return - } - if (!this.bcconnected) { - bc.subscribe(this.bcChannel, this._bcSubscriber) - this.bcconnected = true - } - // send sync step1 to bc - // write sync step 1 - const encoderSync = encoding.createEncoder() - encoding.writeVarUint(encoderSync, messageSync) - syncProtocol.writeSyncStep1(encoderSync, this.doc) - bc.publish(this.bcChannel, encoding.toUint8Array(encoderSync), this) - // broadcast local state - const encoderState = encoding.createEncoder() - encoding.writeVarUint(encoderState, messageSync) - syncProtocol.writeSyncStep2(encoderState, this.doc) - bc.publish(this.bcChannel, encoding.toUint8Array(encoderState), this) - // write queryAwareness - const encoderAwarenessQuery = encoding.createEncoder() - encoding.writeVarUint(encoderAwarenessQuery, messageQueryAwareness) - bc.publish( - this.bcChannel, - encoding.toUint8Array(encoderAwarenessQuery), - this - ) - // broadcast local awareness state - const encoderAwarenessState = encoding.createEncoder() - encoding.writeVarUint(encoderAwarenessState, messageAwareness) - encoding.writeVarUint8Array( - encoderAwarenessState, - awarenessProtocol.encodeAwarenessUpdate(this.awareness, [ - this.doc.clientID - ]) - ) - bc.publish( - this.bcChannel, - encoding.toUint8Array(encoderAwarenessState), - this - ) - } - - disconnectBc () { - // broadcast message with local awareness state set to null (indicating disconnect) - const encoder = encoding.createEncoder() - encoding.writeVarUint(encoder, messageAwareness) - encoding.writeVarUint8Array( - encoder, - awarenessProtocol.encodeAwarenessUpdate(this.awareness, [ - this.doc.clientID - ], new Map()) - ) - broadcastMessage(this, encoding.toUint8Array(encoder)) - if (this.bcconnected) { - bc.unsubscribe(this.bcChannel, this._bcSubscriber) - this.bcconnected = false - } - } - - disconnect () { - this.shouldConnect = false - this.disconnectBc() - if (this.ws !== null) { - closeWebsocketConnection(this, this.ws, null) - } - } - - connect () { - this.shouldConnect = true - if (!this.wsconnected && this.ws === null) { - setupWS(this) - this.connectBc() - } - } -} diff --git a/yjs-poll/node_modules/yjs/LICENSE b/yjs-poll/node_modules/yjs/LICENSE deleted file mode 100644 index f55e8b4..0000000 --- a/yjs-poll/node_modules/yjs/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2023 - - Kevin Jahns . - - Chair of Computer Science 5 (Databases & Information Systems), RWTH Aachen University, Germany - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/yjs-poll/node_modules/yjs/README.md b/yjs-poll/node_modules/yjs/README.md deleted file mode 100644 index da364b6..0000000 --- a/yjs-poll/node_modules/yjs/README.md +++ /dev/null @@ -1,1394 +0,0 @@ - -# ![Yjs](https://yjs.dev/images/logo/yjs-120x120.png) - -> A CRDT framework with a powerful abstraction of shared data - -Yjs is a [CRDT implementation](#yjs-crdt-algorithm) that exposes its internal -data structure as *shared types*. Shared types are common data types like `Map` -or `Array` with superpowers: changes are automatically distributed to other -peers and merged without merge conflicts. - -Yjs is **network agnostic** (p2p!), supports many existing **rich text -editors**, **offline editing**, **version snapshots**, **undo/redo** and -**shared cursors**. It scales well with an unlimited number of users and is well -suited for even large documents. - -* Demos: [https://github.com/yjs/yjs-demos](https://github.com/yjs/yjs-demos) -* Discuss: [https://discuss.yjs.dev](https://discuss.yjs.dev) -* Chat: [Gitter](https://gitter.im/Yjs/community) | [Discord](https://discord.gg/T3nqMT6qbM) -* Benchmark Yjs vs. Automerge: - [https://github.com/dmonad/crdt-benchmarks](https://github.com/dmonad/crdt-benchmarks) -* Podcast [**"Yjs Deep Dive into real time collaborative editing solutions":**](https://www.tag1consulting.com/blog/deep-dive-real-time-collaborative-editing-solutions-tagteamtalk-001-0) -* Podcast [**"Google Docs-style editing in Gutenberg with the YJS framework":**](https://publishpress.com/blog/yjs/) - -:construction_worker_woman: If you are looking for professional support, please -consider supporting this project via a "support contract" on -[GitHub Sponsors](https://github.com/sponsors/dmonad). I will attend your issues -quicker and we can discuss questions and problems in regular video conferences. -Otherwise you can find help on our community [discussion board](https://discuss.yjs.dev). - -## Sponsorship - -Please contribute to the project financially - especially if your company relies -on Yjs. [![Become a Sponsor](https://img.shields.io/static/v1?label=Become%20a%20Sponsor&message=%E2%9D%A4&logo=GitHub&style=flat&color=d42f2d)](https://github.com/sponsors/dmonad) - -## Professional Support - -* [Support Contract with the Maintainer](https://github.com/sponsors/dmonad) - -By contributing financially to the open-source Yjs project, you can receive -professional support directly from the author. This includes the opportunity for -weekly video calls to discuss your specific challenges. -* [Synergy Codes](https://synergycodes.com/yjs-services/) - Specializing in -consulting and developing real-time collaborative editing solutions for visual -apps, Synergy Codes focuses on interactive diagrams, complex graphs, charts, and -various data visualization types. Their expertise empowers developers to build -engaging and interactive visual experiences leveraging the power of Yjs. See -their work in action at [Visual Collaboration -Showcase](https://yjs-diagram.synergy.codes/). - -## Who is using Yjs - -* [AFFiNE](https://affine.pro/) A local-first, privacy-first, open source - knowledge base. :star2: -* [Huly](https://huly.io/) - Open Source All-in-One Project Management Platform :star2: -* [Cargo](https://cargo.site/) Site builder for designers and artists :star2: -* [Gitbook](https://gitbook.com) Knowledge management for technical teams :star2: -* [Evernote](https://evernote.com) Note-taking app :star2: -* [Lessonspace](https://thelessonspace.com) Enterprise platform for virtual - classrooms and online training :star2: -* [Ellipsus](ellipsus.com) - Collaborative writing app for storytelling etc. - Supports versioning, change attribution, and "blame". A solution for the whole - publishing process (also selling) :star: -* [Dynaboard](https://dynaboard.com/) Build web apps collaboratively. :star: -* [Relm](https://www.relm.us/) A collaborative gameworld for teamwork and - community. :star: -* [Room.sh](https://room.sh/) A meeting application with integrated - collaborative drawing, editing, and coding tools. :star: -* [Nimbus Note](https://nimbusweb.me/note.php) A note-taking app designed by - Nimbus Web. :star: -* [Pluxbox RadioManager](https://getradiomanager.com/) A web-based app to - collaboratively organize radio broadcasts. :star: -* [modyfi](https://www.modyfi.com) - Modyfi is the design platform built for - multidisciplinary designers. Design, generate, animate, and more — without - switching between apps. :star: -* [Sana](https://sanalabs.com/) A learning platform with collaborative text - editing powered by Yjs. -* [Serenity Notes](https://www.serenity.re/en/notes) End-to-end encrypted - collaborative notes app. -* [PRSM](https://prsm.uk/) Collaborative mind-mapping and system visualisation. - *[(source)](https://github.com/micrology/prsm)* -* [Alldone](https://alldone.app/) A next-gen project management and - collaboration platform. -* [Living Spec](https://livingspec.com/) A modern way for product teams to collaborate. -* [Slidebeamer](https://slidebeamer.com/) Presentation app. -* [BlockSurvey](https://blocksurvey.io) End-to-end encryption for your forms/surveys. -* [Skiff](https://skiff.org/) Private, decentralized workspace. -* [JupyterLab](https://jupyter.org/) Collaborative computational Notebooks -* [JupyterCad](https://jupytercad.readthedocs.io/en/latest/) Extension to - JupyterLab that enables collaborative editing of 3d FreeCAD Models. -* [JupyterGIS](https://github.com/geojupyter/jupytergis) Collaborative GIS - (Geographic Information System) editor in Jupyter -* [Hyperquery](https://hyperquery.ai/) A collaborative data workspace for - sharing analyses, documentation, spreadsheets, and dashboards. -* [Nosgestesclimat](https://nosgestesclimat.fr/groupe) The french carbon - footprint calculator has a group P2P mode based on yjs -* [oorja.io](https://oorja.io) Online meeting spaces extensible with - collaborative apps, end-to-end encrypted. -* [LegendKeeper](https://legendkeeper.com) Collaborative campaign planner and - worldbuilding app for tabletop RPGs. -* [IllumiDesk](https://illumidesk.com/) Build courses and content with A.I. -* [btw](https://www.btw.so) Open-source Medium alternative -* [AWS SageMaker](https://aws.amazon.com/sagemaker/) Tools for building Machine - Learning Models -* [linear](https://linear.app) Streamline issues, projects, and product roadmaps. -* [Arkiter](https://www.arkiter.com/) - Live interview software -* [Appflowy](https://www.appflowy.io/) - They use Yrs -* [Multi.app](https://multi.app) - Multiplayer app sharing: Point, draw and edit - in shared apps as if they're on your computer. They are using Yrs. -* [AppMaster](https://appmaster.io) A No-Code platform for creating - production-ready applications with source code generation. -* [Synthesia](https://www.synthesia.io) - Collaborative Video Editor -* [thinkdeli](https://thinkdeli.com) - A fast and simple notes app powered by AI -* [ourboard](https://github.com/raimohanska/ourboard) - A collaborative whiteboard - application -* [Ellie.ai](https://ellie.ai) - Data Product Design and Collaboration -* [GoPeer](https://gopeer.org/) - Collaborative tutoring -* [screen.garden](https://screen.garden) - Collaborative backend for PKM apps. -* [NextCloud](https://nextcloud.com/) - Content Collaboration Platform -* [keystatic](https://github.com/Thinkmill/keystatic) - git-based CMS -* [QDAcity](https://qdacity.com) - Collaborative qualitative data analysis platform -* [Kanbert](https://kanbert.com) - Project management software -* [Eclipse Theia](https://github.com/eclipse-theia/theia) - A cloud & desktop - IDE that runs in the browser. -* [ScienHub](https://scienhub.com) - Collaborative LaTeX editor in the browser. -* [Open Collaboration Tools](https://www.open-collab.tools/) - Collaborative -editing for your IDE or custom editor -* [Typst](https://typst.app/) - Compose, edit, and automate technical documents -* [Kedyou](https://kedyou.com/) - Digital workspaces for tutoring -* [Lightpage](https://lightpage.com/) - Personal living notebook -* [reearth-flow](https://github.com/reearth/reearth-flow) - - Collaboratively calculate and convert various data - -## Table of Contents - -* [Overview](#overview) - * [Bindings](#bindings) - * [Providers](#providers) - * [Tooling](#tooling) - * [Ports](#ports) -* [Getting Started](#getting-started) -* [API](#api) - * [Shared Types](#shared-types) - * [Y.Doc](#ydoc) - * [Document Updates](#document-updates) - * [Relative Positions](#relative-positions) - * [Y.UndoManager](#yundomanager) -* [Yjs CRDT Algorithm](#yjs-crdt-algorithm) -* [License and Author](#license-and-author) - -## Overview - -This repository contains a collection of shared types that can be observed for -changes and manipulated concurrently. Network functionality and two-way-bindings -are implemented in separate modules. - -### Bindings - -| Name | Cursors | Binding | Demo | -|---|:-:|---|---| -| [ProseMirror](https://prosemirror.net/)                                                   | ✔ | [y-prosemirror](https://github.com/yjs/y-prosemirror) | [demo](https://demos.yjs.dev/prosemirror/prosemirror.html) | -| [Quill](https://quilljs.com/) | ✔ | [y-quill](https://github.com/yjs/y-quill) | [demo](https://demos.yjs.dev/quill/quill.html) | -| [CodeMirror](https://codemirror.net/) | ✔ | [y-codemirror](https://github.com/yjs/y-codemirror) | [demo](https://demos.yjs.dev/codemirror/codemirror.html) | -| [Monaco](https://microsoft.github.io/monaco-editor/) | ✔ | [y-monaco](https://github.com/yjs/y-monaco) | [demo](https://demos.yjs.dev/monaco/monaco.html) | -| [Ace](https://ace.c9.io/) | ✔ | [y-ace](https://github.com/bajrangCoder/y-ace) | | -| [Slate](https://github.com/ianstormtaylor/slate) | ✔ | [slate-yjs](https://github.com/bitphinix/slate-yjs) | [demo](https://bitphinix.github.io/slate-yjs-example) | -| [BlockSuite](https://github.com/toeverything/blocksuite) | ✔ | (native) | [demo](https://blocksuite-toeverything.vercel.app/?init) | -| [Lexical](https://lexical.dev/) | ✔ | (native) | [demo](https://lexical.dev/docs/collaboration/react#see-it-in-action) | -| [BlockNote](https://www.blocknotejs.org/docs/collaboration/real-time-collaboration) | ✔ | [y-prosemirror](https://github.com/yjs/y-prosemirror) | [demo](https://www.blocknotejs.org/docs/collaboration/real-time-collaboration) | -| [Tiptap](https://tiptap.dev/) | ✔ | [y-prosemirror](https://github.com/yjs/y-prosemirror) | [demo](https://template.tiptap.dev/preview/templates/simple) | -| [Milkdown](https://github.com/Milkdown/milkdown) | ✔ | [y-prosemirror](https://github.com/yjs/y-prosemirror) | [demo](https://milkdown.dev/playground) | -| [Superdoc](https://superdoc.dev/) | ✔ | (native) | [demo](https://superdoc.dev/) | -| [valtio](https://github.com/pmndrs/valtio) | | [valtio-yjs](https://github.com/dai-shi/valtio-yjs) | [demo](https://codesandbox.io/s/valtio-yjs-demo-ox3iy) | -| [immer](https://github.com/immerjs/immer) | | [immer-yjs](https://github.com/sep2/immer-yjs) | [demo](https://codesandbox.io/s/immer-yjs-demo-6e0znb) | -| React | | [react-yjs](https://github.com/nikgraf/react-yjs) | [demo](https://react-yjs-example.vercel.app/) | -| React / Vue / Svelte / MobX | | [SyncedStore](https://syncedstore.org) | [demo](https://syncedstore.org/docs/react) | -| [mobx-keystone](https://mobx-keystone.js.org/) | | [mobx-keystone-yjs](https://github.com/xaviergonz/mobx-keystone/tree/master/packages/mobx-keystone-yjs) | [demo](https://mobx-keystone.js.org/examples/yjs-binding) | -| [PSPDFKit](https://www.nutrient.io/) | | [yjs-pspdfkit](https://github.com/hoangqwe159/yjs-pspdfkit) | [demo](https://github.com/hoangqwe159/yjs-pspdfkit) | -| [Rows n'Columns](https://www.rowsncolumns.app/) | ✔ | [@rowsncolumns/y-spreadsheet](https://docs.rowsncolumns.app/collaboration/yjs-collaboration) | | - -### Utilities - -Tools that extend the core functionality of Yjs. - -
- -### Providers - -Setting up the communication between clients, managing awareness information, -and storing shared data for offline usage is quite a hassle. **Providers** -manage all that for you and are the perfect starting point for your -collaborative app. - -> This list of providers is incomplete. Please open PRs to add your providers to -> this list! - -#### Connection Providers - -
-
y-websocket
-
-A module that contains a simple websocket backend and a websocket client that -connects to that backend. y-redis, -y-sweet, ypy-websocket, yrs-warp and -Hocuspocus (see below) are alternative -backends to y-websocket. -
-
y-webrtc
-
-Propagates document updates peer-to-peer using WebRTC. The peers exchange -signaling data over signaling servers. Publicly available signaling servers -are available. Communication over the signaling servers can be encrypted by -providing a shared secret, keeping the connection information and the shared -document private. -
-
@liveblocks/yjs 🌟
-
-Liveblocks Yjs provides a fully -hosted WebSocket infrastructure and persisted data store for Yjs -documents. No configuration or maintenance is required. It also features -Yjs webhook events, REST API to read and update Yjs documents, and a -browser DevTools extension. -
-
y-sweet
-
-A standalone yjs server with persistence to S3 or filesystem. They offer a -cloud service as well. -
-
Hocuspocus
-
-A standalone extensible yjs server with sqlite persistence, webhooks, auth and more. -
-
@superviz/yjs
-
- SuperViz Yjs Provider comes with a secure, scalable real-time infrastructure - for Yjs documents, fully compatible with a set of real-time - collaboration components offered by SuperViz. This solution ensures - synchronization, offline editing, and real-time updates, enabling - multiple users to collaborate effectively within shared workspaces. -
-
PartyKit
-
-Cloud service for building multiplayer apps. -
- -
@pluv/crdt-yjs
-
-Use pluv.io as a -full-featured backend for Yjs. pluv.io can either be be used on its -fully-managed WebSocket infrastructure, or self-hosted on Cloudflare Workers -and Node.js runtimes. Offers a typesafe API with authentication, webhooks, -rooms, and more. -
y-libp2p
-
-Uses libp2p to propagate updates via -GossipSub. -Also includes a peer-sync mechanism to catch up on missed updates. -
-
y-dat
-
-[WIP] Write document updates efficiently to the dat network using -multifeed. Each client has -an append-only log of CRDT local updates (hypercore). Multifeed manages and sync -hypercores and y-dat listens to changes and applies them to the Yjs document. -
-
Matrix-CRDT
-
-Use Matrix as an off-the-shelf backend for -Yjs by using the MatrixProvider. -Use Matrix as transport and storage of Yjs updates, so you can focus building -your client app and Matrix can provide powerful features like Authentication, -Authorization, Federation, hosting (self-hosting or SaaS) and even End-to-End -Encryption (E2EE). -
-
yrb-actioncable
-
-An ActionCable companion for Yjs clients. There is a fitting -redis extension as well. -
-
ypy-websocket
-
-Websocket backend, written in Python. -
-
Tinybase
-
-The reactive data store for local-first apps. They support multiple CRDTs and - different network technologies. -
-
y-webxdc
-
-Provider for sharing data in webxdc chat apps. -
-
secsync
-
-An architecture to relay end-to-end encrypted CRDTs over a central service. -
-
y-electric
-
- Sync Yjs over ElectricSQL. -
-
yjs-cf-ws-provider
-
- Cloudflare provider for Yjs based on durable objects. -
-
nostr-crdt
-
- Sync Yjs over nostr. -
-
- -#### Persistence Providers - -
-
y-indexeddb
-
-Efficiently persists document updates to the browsers indexeddb database. -The document is immediately available and only diffs need to be synced through the -network provider. -
-
y-mongodb-provider
-
-Adds persistent storage to a server with MongoDB. Can be used with the -y-websocket provider. -
-
y-fire
-
-A database and connection provider for Yjs based on Firestore. -
-
y-op-sqlite
-
- Persist YJS updates in your React Native app using - op-sqlite - , the fastest SQLite library for React Native. -
-
y-postgresql
-
- Provides persistent storage for a web server using PostgreSQL and - is easily compatible with y-websocket. -
-
k_yrs_go
-
- Golang database server for YJS CRDT using Postgres + Redis -
-
y-op-sqlite
-
- Yjs persistence provider for op-sqlite -
- -
- -### Tooling - -* [y-sweet debugger](https://y-sweet.cloud/advanced/debugger) -* [liveblocks devtools](https://liveblocks.io/devtools) -* [Yjs inspector](https://inspector.yjs.dev) - -### Ports - -There are several Yjs-compatible ports to other programming languages. - -* [y-octo](https://github.com/toeverything/y-octo) - Rust implementation by -[AFFiNE](https://affine.pro) -* [y-crdt](https://github.com/y-crdt/y-crdt) - Rust implementation with multiple -language bindings to other languages - * [yrs](https://github.com/y-crdt/y-crdt/tree/main/yrs) - Rust interface - * [ypy](https://github.com/y-crdt/ypy) - Python binding - * [yrb](https://github.com/y-crdt/yrb) - Ruby binding - * [yswift](https://github.com/y-crdt/yswift) - Swift binding - * [yffi](https://github.com/y-crdt/y-crdt/tree/main/yffi) - C-FFI - * [ywasm](https://github.com/y-crdt/y-crdt/tree/main/ywasm) - WASM binding - * [y_ex](https://github.com/satoren/y_ex) - Elixir bindings -* [ycs](https://github.com/yjs/ycs) - .Net compatible C# implementation. - -## Getting Started - -Install Yjs and a provider with your favorite package manager: - -```sh -npm i yjs y-websocket -``` - -Start the y-websocket server: - -```sh -PORT=1234 node ./node_modules/y-websocket/bin/server.cjs -``` - -### Example: Observe types - -```js -import * as Y from 'yjs'; - -const doc = new Y.Doc(); -const yarray = doc.getArray('my-array') -yarray.observe(event => { - console.log('yarray was modified') -}) -// every time a local or remote client modifies yarray, the observer is called -yarray.insert(0, ['val']) // => "yarray was modified" -``` - -### Example: Nest types - -Remember, shared types are just plain old data types. The only limitation is -that a shared type must exist only once in the shared document. - -```js -const ymap = doc.getMap('map') -const foodArray = new Y.Array() -foodArray.insert(0, ['apple', 'banana']) -ymap.set('food', foodArray) -ymap.get('food') === foodArray // => true -ymap.set('fruit', foodArray) // => Error! foodArray is already defined -``` - -Now you understand how types are defined on a shared document. Next you can jump -to the [demo repository](https://github.com/yjs/yjs-demos) or continue reading -the API docs. - -### Example: Using and combining providers - -Any of the Yjs providers can be combined with each other. So you can sync data -over different network technologies. - -In most cases you want to use a network provider (like y-websocket or y-webrtc) -in combination with a persistence provider (y-indexeddb in the browser). -Persistence allows you to load the document faster and to persist data that is -created while offline. - -For the sake of this demo we combine two different network providers with a -persistence provider. - -```js -import * as Y from 'yjs' -import { WebrtcProvider } from 'y-webrtc' -import { WebsocketProvider } from 'y-websocket' -import { IndexeddbPersistence } from 'y-indexeddb' - -const ydoc = new Y.Doc() - -// this allows you to instantly get the (cached) documents data -const indexeddbProvider = new IndexeddbPersistence('count-demo', ydoc) -indexeddbProvider.whenSynced.then(() => { - console.log('loaded data from indexed db') -}) - -// Sync clients with the y-webrtc provider. -const webrtcProvider = new WebrtcProvider('count-demo', ydoc) - -// Sync clients with the y-websocket provider -const websocketProvider = new WebsocketProvider( - 'wss://demos.yjs.dev', 'count-demo', ydoc -) - -// array of numbers which produce a sum -const yarray = ydoc.getArray('count') - -// observe changes of the sum -yarray.observe(event => { - // print updates when the data changes - console.log('new sum: ' + yarray.toArray().reduce((a,b) => a + b)) -}) - -// add 1 to the sum -yarray.push([1]) // => "new sum: 1" -``` - -## API - -```js -import * as Y from 'yjs' -``` - -### Shared Types - -
- Y.Array -
-

-A shareable Array-like type that supports efficient insert/delete of elements -at any position. Internally it uses a linked list of Arrays that is split when -necessary. -

-
const yarray = new Y.Array()
-
- -Y.Array.from(Array<object|boolean|Array|string|number|null|Uint8Array|Y.Type>): -Y.Array - -
An alternative factory function to create a Y.Array based on existing content.
- parent:Y.AbstractType|null -
- insert(index:number, content:Array<object|boolean|Array|string|number|null|Uint8Array|Y.Type>) -
-Insert content at index. Note that content is an array of elements. -I.e. array.insert(0, [1]) splices the list and inserts 1 at -position 0. -
- push(Array<Object|boolean|Array|string|number|null|Uint8Array|Y.Type>) -
- unshift(Array<Object|boolean|Array|string|number|null|Uint8Array|Y.Type>) -
- delete(index:number, length:number) -
- get(index:number) -
- slice(start:number, end:number):Array<Object|boolean|Array|string|number|null|Uint8Array|Y.Type> -
Retrieve a range of content
- length:number -
- - -forEach(function(value:object|boolean|Array|string|number|null|Uint8Array|Y.Type, - index:number, array: Y.Array)) - - -
- map(function(T, number, YArray):M):Array<M> -
- clone(): Y.Array -
-Clone all values into a fresh Y.Array instance. The returned type can be -included into the Yjs document. -
- toArray():Array<object|boolean|Array|string|number|null|Uint8Array|Y.Type> -
Copies the content of this YArray to a new Array.
- toJSON():Array<Object|boolean|Array|string|number|null> -
-Copies the content of this YArray to a new Array. It transforms all child types -to JSON using their toJSON method. -
- [Symbol.Iterator] -
- Returns an YArray Iterator that contains the values for each index in the array. -
for (let value of yarray) { .. }
-
- observe(function(YArrayEvent, Transaction):void) -
-Adds an event listener to this type that will be called synchronously every time -this type is modified. In the case this type is modified in the event listener, -the event listener will be called again after the current event listener returns. -
- unobserve(function(YArrayEvent, Transaction):void) -
- Removes an observe event listener from this type. -
- observeDeep(function(Array<YEvent>, Transaction):void) -
-Adds an event listener to this type that will be called synchronously every time -this type or any of its children is modified. In the case this type is modified -in the event listener, the event listener will be called again after the current -event listener returns. The event listener receives all Events created by itself -or any of its children. -
- unobserveDeep(function(Array<YEvent>, Transaction):void) -
- Removes an observeDeep event listener from this type. -
-
-
-
- Y.Map -
-

- A shareable Map type. -

-
const ymap = new Y.Map()
-
- parent:Y.AbstractType|null -
- size: number -
Total number of key/value pairs.
- get(key:string):object|boolean|string|number|null|Uint8Array|Y.Type -
- set(key:string, value:object|boolean|string|number|null|Uint8Array|Y.Type) -
- delete(key:string) -
- has(key:string):boolean -
- clear() -
Removes all elements from this YMap.
- clone():Y.Map -
Clone this type into a fresh Yjs type.
- toJSON():Object<string, Object|boolean|Array|string|number|null|Uint8Array> -
-Copies the [key,value] pairs of this YMap to a new Object.It -transforms all child types to JSON using their toJSON method. -
- forEach(function(value:object|boolean|Array|string|number|null|Uint8Array|Y.Type, - key:string, map: Y.Map)) -
- Execute the provided function once for every key-value pair. -
- [Symbol.Iterator] -
- Returns an Iterator of [key, value] pairs. -
for (let [key, value] of ymap) { .. }
-
- entries() -
- Returns an Iterator of [key, value] pairs. -
- values() -
- Returns an Iterator of all values. -
- keys() -
- Returns an Iterator of all keys. -
- observe(function(YMapEvent, Transaction):void) -
-Adds an event listener to this type that will be called synchronously every time -this type is modified. In the case this type is modified in the event listener, -the event listener will be called again after the current event listener returns. -
- unobserve(function(YMapEvent, Transaction):void) -
- Removes an observe event listener from this type. -
- observeDeep(function(Array<YEvent>, Transaction):void) -
-Adds an event listener to this type that will be called synchronously every time -this type or any of its children is modified. In the case this type is modified -in the event listener, the event listener will be called again after the current -event listener returns. The event listener receives all Events created by itself -or any of its children. -
- unobserveDeep(function(Array<YEvent>, Transaction):void) -
- Removes an observeDeep event listener from this type. -
-
-
- -
- Y.Text -
-

-A shareable type that is optimized for shared editing on text. It allows to -assign properties to ranges in the text. This makes it possible to implement -rich-text bindings to this type. -

-

-This type can also be transformed to the -delta format. Similarly the -YTextEvents compute changes as deltas. -

-
const ytext = new Y.Text()
-
- parent:Y.AbstractType|null -
- insert(index:number, content:string, [formattingAttributes:Object<string,string>]) -
- Insert a string at index and assign formatting attributes to it. -
ytext.insert(0, 'bold text', { bold: true })
-
- delete(index:number, length:number) -
- format(index:number, length:number, formattingAttributes:Object<string,string>) -
Assign formatting attributes to a range in the text
- applyDelta(delta: Delta, opts:Object<string,any>) -
- See Quill Delta - Can set options for preventing remove ending newLines, default is true. -
ytext.applyDelta(delta, { sanitize: false })
-
- length:number -
- toString():string -
Transforms this type, without formatting options, into a string.
- toJSON():string -
See toString
- toDelta():Delta -
-Transforms this type to a Quill Delta -
- observe(function(YTextEvent, Transaction):void) -
-Adds an event listener to this type that will be called synchronously every time -this type is modified. In the case this type is modified in the event listener, -the event listener will be called again after the current event listener returns. -
- unobserve(function(YTextEvent, Transaction):void) -
- Removes an observe event listener from this type. -
- observeDeep(function(Array<YEvent>, Transaction):void) -
-Adds an event listener to this type that will be called synchronously every time -this type or any of its children is modified. In the case this type is modified -in the event listener, the event listener will be called again after the current -event listener returns. The event listener receives all Events created by itself -or any of its children. -
- unobserveDeep(function(Array<YEvent>, Transaction):void) -
- Removes an observeDeep event listener from this type. -
-
-
- -
- Y.XmlFragment -
-

- A container that holds an Array of Y.XmlElements. -

-
const yxml = new Y.XmlFragment()
-
- parent:Y.AbstractType|null -
- firstChild:Y.XmlElement|Y.XmlText|null -
- insert(index:number, content:Array<Y.XmlElement|Y.XmlText>) -
- delete(index:number, length:number) -
- get(index:number) -
- slice(start:number, end:number):Array<Y.XmlElement|Y.XmlText> -
Retrieve a range of content
- length:number -
- clone():Y.XmlFragment -
Clone this type into a fresh Yjs type.
- toArray():Array<Y.XmlElement|Y.XmlText> -
Copies the children to a new Array.
- toDOM():DocumentFragment -
Transforms this type and all children to new DOM elements.
- toString():string -
Get the XML serialization of all descendants.
- toJSON():string -
See toString.
- createTreeWalker(filter: function(AbstractType<any>):boolean):Iterable -
Create an Iterable that walks through the children.
- observe(function(YXmlEvent, Transaction):void) -
-Adds an event listener to this type that will be called synchronously every time -this type is modified. In the case this type is modified in the event listener, -the event listener will be called again after the current event listener returns. -
- unobserve(function(YXmlEvent, Transaction):void) -
- Removes an observe event listener from this type. -
- observeDeep(function(Array<YEvent>, Transaction):void) -
-Adds an event listener to this type that will be called synchronously every time -this type or any of its children is modified. In the case this type is modified -in the event listener, the event listener will be called again after the current -event listener returns. The event listener receives all Events created by itself -or any of its children. -
- unobserveDeep(function(Array<YEvent>, Transaction):void) -
- Removes an observeDeep event listener from this type. -
-
-
- -
- Y.XmlElement -
-

-A shareable type that represents an XML Element. It has a nodeName, -attributes, and a list of children. But it makes no effort to validate its -content and be actually XML compliant. -

-
const yxml = new Y.XmlElement()
-
- parent:Y.AbstractType|null -
- firstChild:Y.XmlElement|Y.XmlText|null -
- nextSibling:Y.XmlElement|Y.XmlText|null -
- prevSibling:Y.XmlElement|Y.XmlText|null -
- insert(index:number, content:Array<Y.XmlElement|Y.XmlText>) -
- delete(index:number, length:number) -
- get(index:number) -
- length:number -
- setAttribute(attributeName:string, attributeValue:string) -
- removeAttribute(attributeName:string) -
- getAttribute(attributeName:string):string -
- getAttributes():Object<string,string> -
- get(i:number):Y.XmlElement|Y.XmlText -
Retrieve the i-th element.
- slice(start:number, end:number):Array<Y.XmlElement|Y.XmlText> -
Retrieve a range of content
- clone():Y.XmlElement -
Clone this type into a fresh Yjs type.
- toArray():Array<Y.XmlElement|Y.XmlText> -
Copies the children to a new Array.
- toDOM():Element -
Transforms this type and all children to a new DOM element.
- toString():string -
Get the XML serialization of all descendants.
- toJSON():string -
See toString.
- observe(function(YXmlEvent, Transaction):void) -
-Adds an event listener to this type that will be called synchronously every -time this type is modified. In the case this type is modified in the event -listener, the event listener will be called again after the current event -listener returns. -
- unobserve(function(YXmlEvent, Transaction):void) -
- Removes an observe event listener from this type. -
- observeDeep(function(Array<YEvent>, Transaction):void) -
-Adds an event listener to this type that will be called synchronously every time -this type or any of its children is modified. In the case this type is modified -in the event listener, the event listener will be called again after the current -event listener returns. The event listener receives all Events created by itself -or any of its children. -
- unobserveDeep(function(Array<YEvent>, Transaction):void) -
- Removes an observeDeep event listener from this type. -
-
-
- -### Y.Doc - -```js -const doc = new Y.Doc() -``` - -
- clientID -
A unique id that identifies this client. (readonly)
- gc -
-Whether garbage collection is enabled on this doc instance. Set `doc.gc = false` -in order to disable gc and be able to restore old content. See https://github.com/yjs/yjs#yjs-crdt-algorithm -for more information about gc in Yjs. -
- transact(function(Transaction):void [, origin:any]) -
-Every change on the shared document happens in a transaction. Observer calls and -the update event are called after each transaction. You should -bundle changes into a single transaction to reduce the amount of event -calls. I.e. doc.transact(() => { yarray.insert(..); ymap.set(..) }) -triggers a single change event.
You can specify an optional origin -parameter that is stored on transaction.origin and -on('update', (update, origin) => ..). -
- toJSON():any -
-Deprecated: It is recommended to call toJSON directly on the shared types. -Converts the entire document into a js object, recursively traversing each yjs -type. Doesn't log types that have not been defined (using -ydoc.getType(..)). -
- get(string, Y.[TypeClass]):[Type] -
Define a shared type.
- getArray(string):Y.Array -
Define a shared Y.Array type. Is equivalent to y.get(string, Y.Array).
- getMap(string):Y.Map -
Define a shared Y.Map type. Is equivalent to y.get(string, Y.Map).
- getText(string):Y.Text -
Define a shared Y.Text type. Is equivalent to y.get(string, Y.Text).
- getXmlElement(string, string):Y.XmlElement -
Define a shared Y.XmlElement type. Is equivalent to y.get(string, Y.XmlElement).
- getXmlFragment(string):Y.XmlFragment -
Define a shared Y.XmlFragment type. Is equivalent to y.get(string, Y.XmlFragment).
- on(string, function) -
Register an event listener on the shared type
- off(string, function) -
Unregister an event listener from the shared type
-
- -#### Y.Doc Events - -
- on('update', function(updateMessage:Uint8Array, origin:any, Y.Doc):void) -
-Listen to document updates. Document updates must be transmitted to all other -peers. You can apply document updates in any order and multiple times. Use `updateV2` -to receive V2 events. -
- on('beforeTransaction', function(Y.Transaction, Y.Doc):void) -
Emitted before each transaction.
- on('afterTransaction', function(Y.Transaction, Y.Doc):void) -
Emitted after each transaction.
- on('beforeAllTransactions', function(Y.Doc):void) -
-Transactions can be nested (e.g. when an event within a transaction calls another -transaction). Emitted before the first transaction. -
- on('afterAllTransactions', function(Y.Doc, Array<Y.Transaction>):void) -
Emitted after the last transaction is cleaned up.
-
- -### Document Updates - -Changes on the shared document are encoded into *document updates*. Document -updates are *commutative* and *idempotent*. This means that they can be applied -in any order and multiple times. - -#### Example: Listen to update events and apply them on remote client - -```js -const doc1 = new Y.Doc() -const doc2 = new Y.Doc() - -doc1.on('update', update => { - Y.applyUpdate(doc2, update) -}) - -doc2.on('update', update => { - Y.applyUpdate(doc1, update) -}) - -// All changes are also applied to the other document -doc1.getArray('myarray').insert(0, ['Hello doc2, you got this?']) -doc2.getArray('myarray').get(0) // => 'Hello doc2, you got this?' -``` - -Yjs internally maintains a [state vector](#state-vector) that denotes the next -expected clock from each client. In a different interpretation it holds the -number of structs created by each client. When two clients sync, you can either -exchange the complete document structure or only the differences by sending the -state vector to compute the differences. - -#### Example: Sync two clients by exchanging the complete document structure - -```js -const state1 = Y.encodeStateAsUpdate(ydoc1) -const state2 = Y.encodeStateAsUpdate(ydoc2) -Y.applyUpdate(ydoc1, state2) -Y.applyUpdate(ydoc2, state1) -``` - -#### Example: Sync two clients by computing the differences - -This example shows how to sync two clients with the minimal amount of exchanged -data by computing only the differences using the state vector of the remote -client. Syncing clients using the state vector requires another roundtrip, but -can save a lot of bandwidth. - -```js -const stateVector1 = Y.encodeStateVector(ydoc1) -const stateVector2 = Y.encodeStateVector(ydoc2) -const diff1 = Y.encodeStateAsUpdate(ydoc1, stateVector2) -const diff2 = Y.encodeStateAsUpdate(ydoc2, stateVector1) -Y.applyUpdate(ydoc1, diff2) -Y.applyUpdate(ydoc2, diff1) -``` - -#### Example: Syncing clients without loading the Y.Doc - -It is possible to sync clients and compute delta updates without loading the Yjs -document to memory. Yjs exposes an API to compute the differences directly on the -binary document updates. - -```js -// encode the current state as a binary buffer -let currentState1 = Y.encodeStateAsUpdate(ydoc1) -let currentState2 = Y.encodeStateAsUpdate(ydoc2) -// now we can continue syncing clients using state vectors without using the Y.Doc -ydoc1.destroy() -ydoc2.destroy() - -const stateVector1 = Y.encodeStateVectorFromUpdate(currentState1) -const stateVector2 = Y.encodeStateVectorFromUpdate(currentState2) -const diff1 = Y.diffUpdate(currentState1, stateVector2) -const diff2 = Y.diffUpdate(currentState2, stateVector1) - -// sync clients -currentState1 = Y.mergeUpdates([currentState1, diff2]) -currentState2 = Y.mergeUpdates([currentState2, diff1]) -``` - -#### Obfuscating Updates - -If one of your users runs into a weird bug (e.g. the rich-text editor throws -error messages), then you don't have to request the full document from your -user. Instead, they can obfuscate the document (i.e. replace the content with -meaningless generated content) before sending it to you. Note that someone might -still deduce the type of content by looking at the general structure of the -document. But this is much better than requesting the original document. - -Obfuscated updates contain all the CRDT-related data that is required for -merging. So it is safe to merge obfuscated updates. - -```javascript -const ydoc = new Y.Doc() -// perform some changes.. -ydoc.getText().insert(0, 'hello world') -const update = Y.encodeStateAsUpdate(ydoc) -// the below update contains scrambled data -const obfuscatedUpdate = Y.obfuscateUpdate(update) -const ydoc2 = new Y.Doc() -Y.applyUpdate(ydoc2, obfuscatedUpdate) -ydoc2.getText().toString() // => "00000000000" -``` - -#### Using V2 update format - -Yjs implements two update formats. By default you are using the V1 update format. -You can opt-in into the V2 update format which provides much better compression. -It is not yet used by all providers. However, you can already use it if -you are building your own provider. All below functions are available with the -suffix "V2". E.g. `Y.applyUpdate` ⇒ `Y.applyUpdateV2`. Also when listening to updates -you need to specifically need listen for V2 events e.g. `yDoc.on('updateV2', …)`. -We also support conversion functions between both formats: -`Y.convertUpdateFormatV1ToV2` & `Y.convertUpdateFormatV2ToV1`. - -#### Update API - -
- Y.applyUpdate(Y.Doc, update:Uint8Array, [transactionOrigin:any]) -
-Apply a document update on the shared document. Optionally you can specify -transactionOrigin that will be stored on -transaction.origin -and ydoc.on('update', (update, origin) => ..). -
- Y.encodeStateAsUpdate(Y.Doc, [encodedTargetStateVector:Uint8Array]):Uint8Array -
-Encode the document state as a single update message that can be applied on the -remote document. Optionally specify the target state vector to only write the -differences to the update message. -
- Y.encodeStateVector(Y.Doc):Uint8Array -
Computes the state vector and encodes it into an Uint8Array.
- Y.mergeUpdates(Array<Uint8Array>) -
-Merge several document updates into a single document update while removing -duplicate information. The merged document update is always smaller than -the separate updates because of the compressed encoding. -
- Y.encodeStateVectorFromUpdate(Uint8Array): Uint8Array -
-Computes the state vector from a document update and encodes it into an Uint8Array. -
- Y.diffUpdate(update: Uint8Array, stateVector: Uint8Array): Uint8Array -
-Encode the missing differences to another update message. This function works -similarly to Y.encodeStateAsUpdate(ydoc, stateVector) but works -on updates instead. -
- convertUpdateFormatV1ToV2 -
-Convert V1 update format to the V2 update format. -
- convertUpdateFormatV2ToV1 -
-Convert V2 update format to the V1 update format. -
-
- -### Relative Positions - -When working with collaborative documents, we often need to work with positions. -Positions may represent cursor locations, selection ranges, or even assign a -comment to a range of text. Normal index-positions (expressed as integers) are -not convenient to use because the index-range is invalidated as soon as a remote -change manipulates the document. Relative positions give you a powerful API to -express positions. - -A relative position is fixated to an element in the shared document and is not -affected by remote changes. I.e. given the document `"a|c"`, the relative -position is attached to `c`. When a remote user modifies the document by -inserting a character before the cursor, the cursor will stay attached to the -character `c`. `insert(1, 'x')("a|c") = "ax|c"`. When the relative position is -set to the end of the document, it will stay attached to the end of the -document. - -#### Example: Transform to RelativePosition and back - -```js -const relPos = Y.createRelativePositionFromTypeIndex(ytext, 2) -const pos = Y.createAbsolutePositionFromRelativePosition(relPos, doc) -pos.type === ytext // => true -pos.index === 2 // => true -``` - -#### Example: Send relative position to remote client (json) - -```js -const relPos = Y.createRelativePositionFromTypeIndex(ytext, 2) -const encodedRelPos = JSON.stringify(relPos) -// send encodedRelPos to remote client.. -const parsedRelPos = JSON.parse(encodedRelPos) -const pos = Y.createAbsolutePositionFromRelativePosition(parsedRelPos, remoteDoc) -pos.type === remoteytext // => true -pos.index === 2 // => true -``` - -#### Example: Send relative position to remote client (Uint8Array) - -```js -const relPos = Y.createRelativePositionFromTypeIndex(ytext, 2) -const encodedRelPos = Y.encodeRelativePosition(relPos) -// send encodedRelPos to remote client.. -const parsedRelPos = Y.decodeRelativePosition(encodedRelPos) -const pos = Y.createAbsolutePositionFromRelativePosition(parsedRelPos, remoteDoc) -pos.type === remoteytext // => true -pos.index === 2 // => true -``` - -
- -Y.createRelativePositionFromTypeIndex(type:Uint8Array|Y.Type, index: number -[, assoc=0]) - -
-Create a relative position fixated to the i-th element in any sequence-like -shared type (if assoc >= 0). By default, the position associates -with the character that comes after the specified index position. If -assoc < 0, then the relative position associates with the character -before the specified index position. -
- -Y.createAbsolutePositionFromRelativePosition(RelativePosition, Y.Doc): -{ type: Y.AbstractType, index: number, assoc: number } | null - -
-Create an absolute position from a relative position. If the relative position -cannot be referenced, or the type is deleted, then the result is null. -
- -Y.encodeRelativePosition(RelativePosition):Uint8Array - -
-Encode a relative position to an Uint8Array. Binary data is the preferred -encoding format for document updates. If you prefer JSON encoding, you can -simply JSON.stringify / JSON.parse the relative position instead. -
- Y.decodeRelativePosition(Uint8Array):RelativePosition -
Decode a binary-encoded relative position to a RelativePosition object.
-
- -### Y.UndoManager - -Yjs ships with an Undo/Redo manager for selective undo/redo of changes on a -Yjs type. The changes can be optionally scoped to transaction origins. - -```js -const ytext = doc.getText('text') -const undoManager = new Y.UndoManager(ytext) - -ytext.insert(0, 'abc') -undoManager.undo() -ytext.toString() // => '' -undoManager.redo() -ytext.toString() // => 'abc' -``` - -
- constructor(scope:Y.AbstractType|Array<Y.AbstractType> - [, {captureTimeout:number,trackedOrigins:Set<any>,deleteFilter:function(item):boolean}]) -
Accepts either single type as scope or an array of types.
- undo() -
- redo() -
- stopCapturing() -
- - -on('stack-item-added', { stackItem: { meta: Map<any,any> }, type: 'undo' -| 'redo' }) - - -
-Register an event that is called when a StackItem is added to the -undo- or the redo-stack. -
- - -on('stack-item-updated', { stackItem: { meta: Map<any,any> }, type: 'undo' -| 'redo' }) - - -
-Register an event that is called when an existing StackItem is updated. -This happens when two changes happen within a "captureInterval". -
- - -on('stack-item-popped', { stackItem: { meta: Map<any,any> }, type: 'undo' -| 'redo' }) - - -
-Register an event that is called when a StackItem is popped from -the undo- or the redo-stack. -
- - -on('stack-cleared', { undoStackCleared: boolean, redoStackCleared: boolean }) - - -
-Register an event that is called when the undo- and/or the redo-stack is cleared. -
-
- -#### Example: Stop Capturing - -UndoManager merges Undo-StackItems if they are created within time-gap -smaller than `options.captureTimeout`. Call `um.stopCapturing()` so that the next -StackItem won't be merged. - -```js -// without stopCapturing -ytext.insert(0, 'a') -ytext.insert(1, 'b') -undoManager.undo() -ytext.toString() // => '' (note that 'ab' was removed) -// with stopCapturing -ytext.insert(0, 'a') -undoManager.stopCapturing() -ytext.insert(0, 'b') -undoManager.undo() -ytext.toString() // => 'a' (note that only 'b' was removed) -``` - -#### Example: Specify tracked origins - -Every change on the shared document has an origin. If no origin was specified, -it defaults to `null`. By specifying `trackedOrigins` you can -selectively specify which changes should be tracked by `UndoManager`. The -UndoManager instance is always added to `trackedOrigins`. - -```js -class CustomBinding {} - -const ytext = doc.getText('text') -const undoManager = new Y.UndoManager(ytext, { - trackedOrigins: new Set([42, CustomBinding]) -}) - -ytext.insert(0, 'abc') -undoManager.undo() -ytext.toString() // => 'abc' (does not track because origin `null` and not part - // of `trackedTransactionOrigins`) -ytext.delete(0, 3) // revert change - -doc.transact(() => { - ytext.insert(0, 'abc') -}, 42) -undoManager.undo() -ytext.toString() // => '' (tracked because origin is an instance of `trackedTransactionorigins`) - -doc.transact(() => { - ytext.insert(0, 'abc') -}, 41) -undoManager.undo() -ytext.toString() // => 'abc' (not tracked because 41 is not an instance of - // `trackedTransactionorigins`) -ytext.delete(0, 3) // revert change - -doc.transact(() => { - ytext.insert(0, 'abc') -}, new CustomBinding()) -undoManager.undo() -ytext.toString() // => '' (tracked because origin is a `CustomBinding` and - // `CustomBinding` is in `trackedTransactionorigins`) -``` - -#### Example: Add additional information to the StackItems - -When undoing or redoing a previous action, it is often expected to restore -additional meta information like the cursor location or the view on the -document. You can assign meta-information to Undo-/Redo-StackItems. - -```js -const ytext = doc.getText('text') -const undoManager = new Y.UndoManager(ytext, { - trackedOrigins: new Set([42, CustomBinding]) -}) - -undoManager.on('stack-item-added', event => { - // save the current cursor location on the stack-item - event.stackItem.meta.set('cursor-location', getRelativeCursorLocation()) -}) - -undoManager.on('stack-item-popped', event => { - // restore the current cursor location on the stack-item - restoreCursorLocation(event.stackItem.meta.get('cursor-location')) -}) -``` - -## Yjs CRDT Algorithm - -*Conflict-free replicated data types* (CRDT) for collaborative editing are an -alternative approach to *operational transformation* (OT). A very simple -differentiation between the two approaches is that OT attempts to transform -index positions to ensure convergence (all clients end up with the same -content), while CRDTs use mathematical models that usually do not involve index -transformations, like linked lists. OT is currently the de-facto standard for -shared editing on text. OT approaches that support shared editing without a -central source of truth (a central server) require too much bookkeeping to be -viable in practice. CRDTs are better suited for distributed systems, provide -additional guarantees that the document can be synced with remote clients, and -do not require a central source of truth. - -Yjs implements a modified version of the algorithm described in [this -paper](https://www.researchgate.net/publication/310212186_Near_Real-Time_Peer-to-Peer_Shared_Editing_on_Extensible_Data_Types). -This [article](https://blog.kevinjahns.de/are-crdts-suitable-for-shared-editing/) -explains a simple optimization on the CRDT model and -gives more insight about the performance characteristics in Yjs. -More information about the specific implementation is available in -[INTERNALS.md](./INTERNALS.md) and in -[this walkthrough of the Yjs codebase](https://youtu.be/0l5XgnQ6rB4). - -CRDTs that are suitable for shared text editing suffer from the fact that they -only grow in size. There are CRDTs that do not grow in size, but they do not -have the characteristics that are beneficial for shared text editing (like -intention preservation). Yjs implements many improvements to the original -algorithm that diminish the trade-off that the document only grows in size. We -can't garbage collect deleted structs (tombstones) while ensuring a unique -order of the structs. But we can 1. merge preceding structs into a single -struct to reduce the amount of meta information, 2. we can delete content from -the struct if it is deleted, and 3. we can garbage collect tombstones if we -don't care about the order of the structs anymore (e.g. if the parent was -deleted). - -**Examples:** - -1. If a user inserts elements in sequence, the struct will be merged into a - single struct. E.g. `text.insert(0, 'a'), text.insert(1, 'b');` is - first represented as two structs (`[{id: {client, clock: 0}, content: 'a'}, - {id: {client, clock: 1}, content: 'b'}`) and then merged into a single - struct: `[{id: {client, clock: 0}, content: 'ab'}]`. -2. When a struct that contains content (e.g. `ItemString`) is deleted, the - struct will be replaced with an `ItemDeleted` that does not contain content - anymore. -3. When a type is deleted, all child elements are transformed to `GC` structs. A - `GC` struct only denotes the existence of a struct and that it is deleted. - `GC` structs can always be merged with other `GC` structs if the id's are - adjacent. - -Especially when working on structured content (e.g. shared editing on -ProseMirror), these improvements yield very good results when -[benchmarking](https://github.com/dmonad/crdt-benchmarks) random document edits. -In practice they show even better results, because users usually edit text in -sequence, resulting in structs that can easily be merged. The benchmarks show -that even in the worst case scenario that a user edits text from right to left, -Yjs achieves good performance even for huge documents. - -### State Vector - -Yjs has the ability to exchange only the differences when syncing two clients. -We use lamport timestamps to identify structs and to track in which order a -client created them. Each struct has an `struct.id = { client: number, clock: -number}` that uniquely identifies a struct. We define the next expected `clock` -by each client as the *state vector*. This data structure is similar to the -[version vectors](https://en.wikipedia.org/wiki/Version_vector) data structure. -But we use state vectors only to describe the state of the local document, so we -can compute the missing struct of the remote client. We do not use it to track -causality. - -## License and Author - -Yjs and all related projects are [**MIT licensed**](./LICENSE). - -Yjs is based on my research as a student at the [RWTH -i5](http://dbis.rwth-aachen.de/). Now I am working on Yjs in my spare time. - -Fund this project by donating on [GitHub Sponsors](https://github.com/sponsors/dmonad) -or hiring [me](https://github.com/dmonad) as a contractor for your collaborative -app. diff --git a/yjs-poll/node_modules/yjs/dist/src/index.d.ts b/yjs-poll/node_modules/yjs/dist/src/index.d.ts deleted file mode 100644 index 46fffb5..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { Doc, Transaction, YArray as Array, YMap as Map, YText as Text, YXmlText as XmlText, YXmlHook as XmlHook, YXmlElement as XmlElement, YXmlFragment as XmlFragment, YXmlEvent, YMapEvent, YArrayEvent, YTextEvent, YEvent, Item, AbstractStruct, GC, Skip, ContentBinary, ContentDeleted, ContentDoc, ContentEmbed, ContentFormat, ContentJSON, ContentAny, ContentString, ContentType, AbstractType, getTypeChildren, createRelativePositionFromTypeIndex, createRelativePositionFromJSON, createAbsolutePositionFromRelativePosition, compareRelativePositions, AbsolutePosition, RelativePosition, ID, createID, compareIDs, getState, Snapshot, createSnapshot, createDeleteSet, createDeleteSetFromStructStore, cleanupYTextFormatting, snapshot, emptySnapshot, findRootTypeKey, findIndexSS, getItem, getItemCleanStart, getItemCleanEnd, typeListToArraySnapshot, typeMapGetSnapshot, typeMapGetAllSnapshot, createDocFromSnapshot, iterateDeletedStructs, applyUpdate, applyUpdateV2, readUpdate, readUpdateV2, encodeStateAsUpdate, encodeStateAsUpdateV2, encodeStateVector, UndoManager, decodeSnapshot, encodeSnapshot, decodeSnapshotV2, encodeSnapshotV2, decodeStateVector, logUpdate, logUpdateV2, decodeUpdate, decodeUpdateV2, relativePositionToJSON, isDeleted, isParentOf, equalSnapshots, PermanentUserData, tryGc, transact, AbstractConnector, logType, mergeUpdates, mergeUpdatesV2, parseUpdateMeta, parseUpdateMetaV2, encodeStateVectorFromUpdate, encodeStateVectorFromUpdateV2, encodeRelativePosition, decodeRelativePosition, diffUpdate, diffUpdateV2, convertUpdateFormatV1ToV2, convertUpdateFormatV2ToV1, obfuscateUpdate, obfuscateUpdateV2, UpdateEncoderV1, UpdateEncoderV2, UpdateDecoderV1, UpdateDecoderV2, equalDeleteSets, mergeDeleteSets, snapshotContainsUpdate } from "./internals.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/index.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/index.d.ts.map deleted file mode 100644 index 4b136e2..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/internals.d.ts b/yjs-poll/node_modules/yjs/dist/src/internals.d.ts deleted file mode 100644 index f723106..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/internals.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -export * from "./utils/AbstractConnector.js"; -export * from "./utils/DeleteSet.js"; -export * from "./utils/Doc.js"; -export * from "./utils/UpdateDecoder.js"; -export * from "./utils/UpdateEncoder.js"; -export * from "./utils/encoding.js"; -export * from "./utils/EventHandler.js"; -export * from "./utils/ID.js"; -export * from "./utils/isParentOf.js"; -export * from "./utils/logging.js"; -export * from "./utils/PermanentUserData.js"; -export * from "./utils/RelativePosition.js"; -export * from "./utils/Snapshot.js"; -export * from "./utils/StructStore.js"; -export * from "./utils/Transaction.js"; -export * from "./utils/UndoManager.js"; -export * from "./utils/updates.js"; -export * from "./utils/YEvent.js"; -export * from "./types/AbstractType.js"; -export * from "./types/YArray.js"; -export * from "./types/YMap.js"; -export * from "./types/YText.js"; -export * from "./types/YXmlFragment.js"; -export * from "./types/YXmlElement.js"; -export * from "./types/YXmlEvent.js"; -export * from "./types/YXmlHook.js"; -export * from "./types/YXmlText.js"; -export * from "./structs/AbstractStruct.js"; -export * from "./structs/GC.js"; -export * from "./structs/ContentBinary.js"; -export * from "./structs/ContentDeleted.js"; -export * from "./structs/ContentDoc.js"; -export * from "./structs/ContentEmbed.js"; -export * from "./structs/ContentFormat.js"; -export * from "./structs/ContentJSON.js"; -export * from "./structs/ContentAny.js"; -export * from "./structs/ContentString.js"; -export * from "./structs/ContentType.js"; -export * from "./structs/Item.js"; -export * from "./structs/Skip.js"; -//# sourceMappingURL=internals.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/internals.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/internals.d.ts.map deleted file mode 100644 index 225e903..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/internals.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"internals.d.ts","sourceRoot":"","sources":["../../src/internals.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/AbstractStruct.d.ts b/yjs-poll/node_modules/yjs/dist/src/structs/AbstractStruct.d.ts deleted file mode 100644 index d046ef1..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/AbstractStruct.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -export class AbstractStruct { - /** - * @param {ID} id - * @param {number} length - */ - constructor(id: ID, length: number); - id: ID; - length: number; - /** - * @type {boolean} - */ - get deleted(): boolean; - /** - * Merge this struct with the item to the right. - * This method is already assuming that `this.id.clock + this.length === this.id.clock`. - * Also this method does *not* remove right from StructStore! - * @param {AbstractStruct} right - * @return {boolean} whether this merged with right - */ - mergeWith(right: AbstractStruct): boolean; - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - * @param {number} offset - * @param {number} encodingRef - */ - write(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number, encodingRef: number): void; - /** - * @param {Transaction} transaction - * @param {number} offset - */ - integrate(transaction: Transaction, offset: number): void; -} -import { ID } from "../utils/ID.js"; -import { UpdateEncoderV1 } from "../utils/UpdateEncoder.js"; -import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js"; -import { Transaction } from "../utils/Transaction.js"; -//# sourceMappingURL=AbstractStruct.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/AbstractStruct.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/structs/AbstractStruct.d.ts.map deleted file mode 100644 index bf963c2..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/AbstractStruct.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"AbstractStruct.d.ts","sourceRoot":"","sources":["../../../src/structs/AbstractStruct.js"],"names":[],"mappings":"AAMA;IACE;;;OAGG;IACH,gBAHW,EAAE,UACF,MAAM,EAKhB;IAFC,OAAY;IACZ,eAAoB;IAGtB;;OAEG;IACH,uBAEC;IAED;;;;;;OAMG;IACH,iBAHW,cAAc,GACb,OAAO,CAIlB;IAED;;;;OAIG;IACH,eAJW,eAAe,GAAG,eAAe,UACjC,MAAM,eACN,MAAM,QAIhB;IAED;;;OAGG;IACH,uBAHW,WAAW,UACX,MAAM,QAIhB;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/ContentAny.d.ts b/yjs-poll/node_modules/yjs/dist/src/structs/ContentAny.d.ts deleted file mode 100644 index 286b652..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/ContentAny.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -export class ContentAny { - /** - * @param {Array} arr - */ - constructor(arr: Array); - /** - * @type {Array} - */ - arr: Array; - /** - * @return {number} - */ - getLength(): number; - /** - * @return {Array} - */ - getContent(): Array; - /** - * @return {boolean} - */ - isCountable(): boolean; - /** - * @return {ContentAny} - */ - copy(): ContentAny; - /** - * @param {number} offset - * @return {ContentAny} - */ - splice(offset: number): ContentAny; - /** - * @param {ContentAny} right - * @return {boolean} - */ - mergeWith(right: ContentAny): boolean; - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate(transaction: Transaction, item: Item): void; - /** - * @param {Transaction} transaction - */ - delete(transaction: Transaction): void; - /** - * @param {StructStore} store - */ - gc(store: StructStore): void; - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number): void; - /** - * @return {number} - */ - getRef(): number; -} -export function readContentAny(decoder: UpdateDecoderV1 | UpdateDecoderV2): ContentAny; -import { Transaction } from "../utils/Transaction.js"; -import { Item } from "./Item.js"; -import { StructStore } from "../utils/StructStore.js"; -import { UpdateEncoderV1 } from "../utils/UpdateEncoder.js"; -import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js"; -import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js"; -import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js"; -//# sourceMappingURL=ContentAny.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/ContentAny.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/structs/ContentAny.d.ts.map deleted file mode 100644 index fb3973d..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/ContentAny.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ContentAny.d.ts","sourceRoot":"","sources":["../../../src/structs/ContentAny.js"],"names":[],"mappings":"AASA;IACE;;OAEG;IACH,iBAFW,MAAM,GAAG,CAAC,EAQpB;IALC;;OAEG;IACH,KAFU,MAAM,GAAG,CAAC,CAEN;IAIhB;;OAEG;IACH,aAFY,MAAM,CAIjB;IAED;;OAEG;IACH,cAFY,MAAM,GAAG,CAAC,CAIrB;IAED;;OAEG;IACH,eAFY,OAAO,CAIlB;IAED;;OAEG;IACH,QAFY,UAAU,CAIrB;IAED;;;OAGG;IACH,eAHW,MAAM,GACL,UAAU,CAMrB;IAED;;;OAGG;IACH,iBAHW,UAAU,GACT,OAAO,CAKlB;IAED;;;OAGG;IACH,uBAHW,WAAW,QACX,IAAI,QAEiB;IAChC;;OAEG;IACH,oBAFW,WAAW,QAEC;IACvB;;OAEG;IACH,UAFW,WAAW,QAET;IACb;;;OAGG;IACH,eAHW,eAAe,GAAG,eAAe,UACjC,MAAM,QAShB;IAED;;OAEG;IACH,UAFY,MAAM,CAIjB;CACF;AAMM,wCAHI,eAAe,GAAG,eAAe,GAChC,UAAU,CASrB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/ContentBinary.d.ts b/yjs-poll/node_modules/yjs/dist/src/structs/ContentBinary.d.ts deleted file mode 100644 index dabc5b4..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/ContentBinary.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -export class ContentBinary { - /** - * @param {Uint8Array} content - */ - constructor(content: Uint8Array); - content: Uint8Array; - /** - * @return {number} - */ - getLength(): number; - /** - * @return {Array} - */ - getContent(): Array; - /** - * @return {boolean} - */ - isCountable(): boolean; - /** - * @return {ContentBinary} - */ - copy(): ContentBinary; - /** - * @param {number} offset - * @return {ContentBinary} - */ - splice(offset: number): ContentBinary; - /** - * @param {ContentBinary} right - * @return {boolean} - */ - mergeWith(right: ContentBinary): boolean; - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate(transaction: Transaction, item: Item): void; - /** - * @param {Transaction} transaction - */ - delete(transaction: Transaction): void; - /** - * @param {StructStore} store - */ - gc(store: StructStore): void; - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number): void; - /** - * @return {number} - */ - getRef(): number; -} -export function readContentBinary(decoder: UpdateDecoderV1 | UpdateDecoderV2): ContentBinary; -import { Transaction } from "../utils/Transaction.js"; -import { Item } from "./Item.js"; -import { StructStore } from "../utils/StructStore.js"; -import { UpdateEncoderV1 } from "../utils/UpdateEncoder.js"; -import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js"; -import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js"; -import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js"; -//# sourceMappingURL=ContentBinary.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/ContentBinary.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/structs/ContentBinary.d.ts.map deleted file mode 100644 index f5b90f9..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/ContentBinary.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ContentBinary.d.ts","sourceRoot":"","sources":["../../../src/structs/ContentBinary.js"],"names":[],"mappings":"AAMA;IACE;;OAEG;IACH,qBAFW,UAAU,EAIpB;IADC,oBAAsB;IAGxB;;OAEG;IACH,aAFY,MAAM,CAIjB;IAED;;OAEG;IACH,cAFY,MAAM,GAAG,CAAC,CAIrB;IAED;;OAEG;IACH,eAFY,OAAO,CAIlB;IAED;;OAEG;IACH,QAFY,aAAa,CAIxB;IAED;;;OAGG;IACH,eAHW,MAAM,GACL,aAAa,CAIxB;IAED;;;OAGG;IACH,iBAHW,aAAa,GACZ,OAAO,CAIlB;IAED;;;OAGG;IACH,uBAHW,WAAW,QACX,IAAI,QAEiB;IAChC;;OAEG;IACH,oBAFW,WAAW,QAEC;IACvB;;OAEG;IACH,UAFW,WAAW,QAET;IACb;;;OAGG;IACH,eAHW,eAAe,GAAG,eAAe,UACjC,MAAM,QAIhB;IAED;;OAEG;IACH,UAFY,MAAM,CAIjB;CACF;AAMM,2CAHI,eAAe,GAAG,eAAe,GAChC,aAAa,CAEuD"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/ContentDeleted.d.ts b/yjs-poll/node_modules/yjs/dist/src/structs/ContentDeleted.d.ts deleted file mode 100644 index 08090fe..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/ContentDeleted.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -export class ContentDeleted { - /** - * @param {number} len - */ - constructor(len: number); - len: number; - /** - * @return {number} - */ - getLength(): number; - /** - * @return {Array} - */ - getContent(): Array; - /** - * @return {boolean} - */ - isCountable(): boolean; - /** - * @return {ContentDeleted} - */ - copy(): ContentDeleted; - /** - * @param {number} offset - * @return {ContentDeleted} - */ - splice(offset: number): ContentDeleted; - /** - * @param {ContentDeleted} right - * @return {boolean} - */ - mergeWith(right: ContentDeleted): boolean; - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate(transaction: Transaction, item: Item): void; - /** - * @param {Transaction} transaction - */ - delete(transaction: Transaction): void; - /** - * @param {StructStore} store - */ - gc(store: StructStore): void; - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number): void; - /** - * @return {number} - */ - getRef(): number; -} -export function readContentDeleted(decoder: UpdateDecoderV1 | UpdateDecoderV2): ContentDeleted; -import { Transaction } from "../utils/Transaction.js"; -import { Item } from "./Item.js"; -import { StructStore } from "../utils/StructStore.js"; -import { UpdateEncoderV1 } from "../utils/UpdateEncoder.js"; -import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js"; -import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js"; -import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js"; -//# sourceMappingURL=ContentDeleted.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/ContentDeleted.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/structs/ContentDeleted.d.ts.map deleted file mode 100644 index 57c546b..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/ContentDeleted.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ContentDeleted.d.ts","sourceRoot":"","sources":["../../../src/structs/ContentDeleted.js"],"names":[],"mappings":"AAKA;IACE;;OAEG;IACH,iBAFW,MAAM,EAIhB;IADC,YAAc;IAGhB;;OAEG;IACH,aAFY,MAAM,CAIjB;IAED;;OAEG;IACH,cAFY,MAAM,GAAG,CAAC,CAIrB;IAED;;OAEG;IACH,eAFY,OAAO,CAIlB;IAED;;OAEG;IACH,QAFY,cAAc,CAIzB;IAED;;;OAGG;IACH,eAHW,MAAM,GACL,cAAc,CAMzB;IAED;;;OAGG;IACH,iBAHW,cAAc,GACb,OAAO,CAKlB;IAED;;;OAGG;IACH,uBAHW,WAAW,QACX,IAAI,QAKd;IAED;;OAEG;IACH,oBAFW,WAAW,QAEC;IACvB;;OAEG;IACH,UAFW,WAAW,QAET;IACb;;;OAGG;IACH,eAHW,eAAe,GAAG,eAAe,UACjC,MAAM,QAIhB;IAED;;OAEG;IACH,UAFY,MAAM,CAIjB;CACF;AAQM,4CAHI,eAAe,GAAG,eAAe,GAChC,cAAc,CAEwD"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/ContentDoc.d.ts b/yjs-poll/node_modules/yjs/dist/src/structs/ContentDoc.d.ts deleted file mode 100644 index 6a796a3..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/ContentDoc.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -/** - * @private - */ -export class ContentDoc { - /** - * @param {Doc} doc - */ - constructor(doc: Doc); - /** - * @type {Doc} - */ - doc: Doc; - opts: any; - /** - * @return {number} - */ - getLength(): number; - /** - * @return {Array} - */ - getContent(): Array; - /** - * @return {boolean} - */ - isCountable(): boolean; - /** - * @return {ContentDoc} - */ - copy(): ContentDoc; - /** - * @param {number} offset - * @return {ContentDoc} - */ - splice(offset: number): ContentDoc; - /** - * @param {ContentDoc} right - * @return {boolean} - */ - mergeWith(right: ContentDoc): boolean; - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate(transaction: Transaction, item: Item): void; - /** - * @param {Transaction} transaction - */ - delete(transaction: Transaction): void; - /** - * @param {StructStore} store - */ - gc(store: StructStore): void; - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number): void; - /** - * @return {number} - */ - getRef(): number; -} -export function readContentDoc(decoder: UpdateDecoderV1 | UpdateDecoderV2): ContentDoc; -import { Doc } from "../utils/Doc.js"; -import { Transaction } from "../utils/Transaction.js"; -import { Item } from "./Item.js"; -import { StructStore } from "../utils/StructStore.js"; -import { UpdateEncoderV1 } from "../utils/UpdateEncoder.js"; -import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js"; -import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js"; -import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js"; -//# sourceMappingURL=ContentDoc.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/ContentDoc.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/structs/ContentDoc.d.ts.map deleted file mode 100644 index 5121443..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/ContentDoc.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ContentDoc.d.ts","sourceRoot":"","sources":["../../../src/structs/ContentDoc.js"],"names":[],"mappings":"AAYA;;GAEG;AACH;IACE;;OAEG;IACH,iBAFW,GAAG,EAwBb;IAlBC;;OAEG;IACH,KAFU,GAAG,CAEC;IAKd,UAAgB;IAYlB;;OAEG;IACH,aAFY,MAAM,CAIjB;IAED;;OAEG;IACH,cAFY,MAAM,GAAG,CAAC,CAIrB;IAED;;OAEG;IACH,eAFY,OAAO,CAIlB;IAED;;OAEG;IACH,QAFY,UAAU,CAIrB;IAED;;;OAGG;IACH,eAHW,MAAM,GACL,UAAU,CAIrB;IAED;;;OAGG;IACH,iBAHW,UAAU,GACT,OAAO,CAIlB;IAED;;;OAGG;IACH,uBAHW,WAAW,QACX,IAAI,QASd;IAED;;OAEG;IACH,oBAFW,WAAW,QAQrB;IAED;;OAEG;IACH,UAFW,WAAW,QAER;IAEd;;;OAGG;IACH,eAHW,eAAe,GAAG,eAAe,UACjC,MAAM,QAKhB;IAED;;OAEG;IACH,UAFY,MAAM,CAIjB;CACF;AAQM,wCAHI,eAAe,GAAG,eAAe,GAChC,UAAU,CAE6F"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/ContentEmbed.d.ts b/yjs-poll/node_modules/yjs/dist/src/structs/ContentEmbed.d.ts deleted file mode 100644 index f312dec..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/ContentEmbed.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @private - */ -export class ContentEmbed { - /** - * @param {Object} embed - */ - constructor(embed: Object); - embed: Object; - /** - * @return {number} - */ - getLength(): number; - /** - * @return {Array} - */ - getContent(): Array; - /** - * @return {boolean} - */ - isCountable(): boolean; - /** - * @return {ContentEmbed} - */ - copy(): ContentEmbed; - /** - * @param {number} offset - * @return {ContentEmbed} - */ - splice(offset: number): ContentEmbed; - /** - * @param {ContentEmbed} right - * @return {boolean} - */ - mergeWith(right: ContentEmbed): boolean; - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate(transaction: Transaction, item: Item): void; - /** - * @param {Transaction} transaction - */ - delete(transaction: Transaction): void; - /** - * @param {StructStore} store - */ - gc(store: StructStore): void; - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number): void; - /** - * @return {number} - */ - getRef(): number; -} -export function readContentEmbed(decoder: UpdateDecoderV1 | UpdateDecoderV2): ContentEmbed; -import { Transaction } from "../utils/Transaction.js"; -import { Item } from "./Item.js"; -import { StructStore } from "../utils/StructStore.js"; -import { UpdateEncoderV1 } from "../utils/UpdateEncoder.js"; -import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js"; -import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js"; -import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js"; -//# sourceMappingURL=ContentEmbed.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/ContentEmbed.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/structs/ContentEmbed.d.ts.map deleted file mode 100644 index bec78fa..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/ContentEmbed.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ContentEmbed.d.ts","sourceRoot":"","sources":["../../../src/structs/ContentEmbed.js"],"names":[],"mappings":"AAMA;;GAEG;AACH;IACE;;OAEG;IACH,mBAFW,MAAM,EAIhB;IADC,cAAkB;IAGpB;;OAEG;IACH,aAFY,MAAM,CAIjB;IAED;;OAEG;IACH,cAFY,MAAM,GAAG,CAAC,CAIrB;IAED;;OAEG;IACH,eAFY,OAAO,CAIlB;IAED;;OAEG;IACH,QAFY,YAAY,CAIvB;IAED;;;OAGG;IACH,eAHW,MAAM,GACL,YAAY,CAIvB;IAED;;;OAGG;IACH,iBAHW,YAAY,GACX,OAAO,CAIlB;IAED;;;OAGG;IACH,uBAHW,WAAW,QACX,IAAI,QAEiB;IAChC;;OAEG;IACH,oBAFW,WAAW,QAEC;IACvB;;OAEG;IACH,UAFW,WAAW,QAET;IACb;;;OAGG;IACH,eAHW,eAAe,GAAG,eAAe,UACjC,MAAM,QAIhB;IAED;;OAEG;IACH,UAFY,MAAM,CAIjB;CACF;AAQM,0CAHI,eAAe,GAAG,eAAe,GAChC,YAAY,CAEuD"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/ContentFormat.d.ts b/yjs-poll/node_modules/yjs/dist/src/structs/ContentFormat.d.ts deleted file mode 100644 index bf88f8b..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/ContentFormat.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -/** - * @private - */ -export class ContentFormat { - /** - * @param {string} key - * @param {Object} value - */ - constructor(key: string, value: Object); - key: string; - value: Object; - /** - * @return {number} - */ - getLength(): number; - /** - * @return {Array} - */ - getContent(): Array; - /** - * @return {boolean} - */ - isCountable(): boolean; - /** - * @return {ContentFormat} - */ - copy(): ContentFormat; - /** - * @param {number} _offset - * @return {ContentFormat} - */ - splice(_offset: number): ContentFormat; - /** - * @param {ContentFormat} _right - * @return {boolean} - */ - mergeWith(_right: ContentFormat): boolean; - /** - * @param {Transaction} _transaction - * @param {Item} item - */ - integrate(_transaction: Transaction, item: Item): void; - /** - * @param {Transaction} transaction - */ - delete(transaction: Transaction): void; - /** - * @param {StructStore} store - */ - gc(store: StructStore): void; - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number): void; - /** - * @return {number} - */ - getRef(): number; -} -export function readContentFormat(decoder: UpdateDecoderV1 | UpdateDecoderV2): ContentFormat; -import { Transaction } from "../utils/Transaction.js"; -import { Item } from "./Item.js"; -import { StructStore } from "../utils/StructStore.js"; -import { UpdateEncoderV1 } from "../utils/UpdateEncoder.js"; -import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js"; -import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js"; -import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js"; -//# sourceMappingURL=ContentFormat.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/ContentFormat.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/structs/ContentFormat.d.ts.map deleted file mode 100644 index 40b7abc..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/ContentFormat.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ContentFormat.d.ts","sourceRoot":"","sources":["../../../src/structs/ContentFormat.js"],"names":[],"mappings":"AAMA;;GAEG;AACH;IACE;;;OAGG;IACH,iBAHW,MAAM,SACN,MAAM,EAKhB;IAFC,YAAc;IACd,cAAkB;IAGpB;;OAEG;IACH,aAFY,MAAM,CAIjB;IAED;;OAEG;IACH,cAFY,MAAM,GAAG,CAAC,CAIrB;IAED;;OAEG;IACH,eAFY,OAAO,CAIlB;IAED;;OAEG;IACH,QAFY,aAAa,CAIxB;IAED;;;OAGG;IACH,gBAHW,MAAM,GACL,aAAa,CAIxB;IAED;;;OAGG;IACH,kBAHW,aAAa,GACZ,OAAO,CAIlB;IAED;;;OAGG;IACH,wBAHW,WAAW,QACX,IAAI,QAOd;IAED;;OAEG;IACH,oBAFW,WAAW,QAEC;IACvB;;OAEG;IACH,UAFW,WAAW,QAET;IACb;;;OAGG;IACH,eAHW,eAAe,GAAG,eAAe,UACjC,MAAM,QAKhB;IAED;;OAEG;IACH,UAFY,MAAM,CAIjB;CACF;AAMM,2CAHI,eAAe,GAAG,eAAe,GAChC,aAAa,CAE2E"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/ContentJSON.d.ts b/yjs-poll/node_modules/yjs/dist/src/structs/ContentJSON.d.ts deleted file mode 100644 index 88312ac..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/ContentJSON.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/** - * @private - */ -export class ContentJSON { - /** - * @param {Array} arr - */ - constructor(arr: Array); - /** - * @type {Array} - */ - arr: Array; - /** - * @return {number} - */ - getLength(): number; - /** - * @return {Array} - */ - getContent(): Array; - /** - * @return {boolean} - */ - isCountable(): boolean; - /** - * @return {ContentJSON} - */ - copy(): ContentJSON; - /** - * @param {number} offset - * @return {ContentJSON} - */ - splice(offset: number): ContentJSON; - /** - * @param {ContentJSON} right - * @return {boolean} - */ - mergeWith(right: ContentJSON): boolean; - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate(transaction: Transaction, item: Item): void; - /** - * @param {Transaction} transaction - */ - delete(transaction: Transaction): void; - /** - * @param {StructStore} store - */ - gc(store: StructStore): void; - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number): void; - /** - * @return {number} - */ - getRef(): number; -} -export function readContentJSON(decoder: UpdateDecoderV1 | UpdateDecoderV2): ContentJSON; -import { Transaction } from "../utils/Transaction.js"; -import { Item } from "./Item.js"; -import { StructStore } from "../utils/StructStore.js"; -import { UpdateEncoderV1 } from "../utils/UpdateEncoder.js"; -import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js"; -import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js"; -import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js"; -//# sourceMappingURL=ContentJSON.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/ContentJSON.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/structs/ContentJSON.d.ts.map deleted file mode 100644 index 2a8d7f8..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/ContentJSON.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ContentJSON.d.ts","sourceRoot":"","sources":["../../../src/structs/ContentJSON.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IACE;;OAEG;IACH,iBAFW,MAAM,GAAG,CAAC,EAOpB;IAJC;;OAEG;IACH,KAFU,MAAM,GAAG,CAAC,CAEN;IAGhB;;OAEG;IACH,aAFY,MAAM,CAIjB;IAED;;OAEG;IACH,cAFY,MAAM,GAAG,CAAC,CAIrB;IAED;;OAEG;IACH,eAFY,OAAO,CAIlB;IAED;;OAEG;IACH,QAFY,WAAW,CAItB;IAED;;;OAGG;IACH,eAHW,MAAM,GACL,WAAW,CAMtB;IAED;;;OAGG;IACH,iBAHW,WAAW,GACV,OAAO,CAKlB;IAED;;;OAGG;IACH,uBAHW,WAAW,QACX,IAAI,QAEiB;IAChC;;OAEG;IACH,oBAFW,WAAW,QAEC;IACvB;;OAEG;IACH,UAFW,WAAW,QAET;IACb;;;OAGG;IACH,eAHW,eAAe,GAAG,eAAe,UACjC,MAAM,QAShB;IAED;;OAEG;IACH,UAFY,MAAM,CAIjB;CACF;AAQM,yCAHI,eAAe,GAAG,eAAe,GAChC,WAAW,CActB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/ContentString.d.ts b/yjs-poll/node_modules/yjs/dist/src/structs/ContentString.d.ts deleted file mode 100644 index 0f3257a..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/ContentString.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/** - * @private - */ -export class ContentString { - /** - * @param {string} str - */ - constructor(str: string); - /** - * @type {string} - */ - str: string; - /** - * @return {number} - */ - getLength(): number; - /** - * @return {Array} - */ - getContent(): Array; - /** - * @return {boolean} - */ - isCountable(): boolean; - /** - * @return {ContentString} - */ - copy(): ContentString; - /** - * @param {number} offset - * @return {ContentString} - */ - splice(offset: number): ContentString; - /** - * @param {ContentString} right - * @return {boolean} - */ - mergeWith(right: ContentString): boolean; - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate(transaction: Transaction, item: Item): void; - /** - * @param {Transaction} transaction - */ - delete(transaction: Transaction): void; - /** - * @param {StructStore} store - */ - gc(store: StructStore): void; - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number): void; - /** - * @return {number} - */ - getRef(): number; -} -export function readContentString(decoder: UpdateDecoderV1 | UpdateDecoderV2): ContentString; -import { Transaction } from "../utils/Transaction.js"; -import { Item } from "./Item.js"; -import { StructStore } from "../utils/StructStore.js"; -import { UpdateEncoderV1 } from "../utils/UpdateEncoder.js"; -import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js"; -import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js"; -import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js"; -//# sourceMappingURL=ContentString.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/ContentString.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/structs/ContentString.d.ts.map deleted file mode 100644 index dd3ecbd..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/ContentString.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ContentString.d.ts","sourceRoot":"","sources":["../../../src/structs/ContentString.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IACE;;OAEG;IACH,iBAFW,MAAM,EAOhB;IAJC;;OAEG;IACH,KAFU,MAAM,CAEF;IAGhB;;OAEG;IACH,aAFY,MAAM,CAIjB;IAED;;OAEG;IACH,cAFY,MAAM,GAAG,CAAC,CAIrB;IAED;;OAEG;IACH,eAFY,OAAO,CAIlB;IAED;;OAEG;IACH,QAFY,aAAa,CAIxB;IAED;;;OAGG;IACH,eAHW,MAAM,GACL,aAAa,CAiBxB;IAED;;;OAGG;IACH,iBAHW,aAAa,GACZ,OAAO,CAKlB;IAED;;;OAGG;IACH,uBAHW,WAAW,QACX,IAAI,QAEiB;IAChC;;OAEG;IACH,oBAFW,WAAW,QAEC;IACvB;;OAEG;IACH,UAFW,WAAW,QAET;IACb;;;OAGG;IACH,eAHW,eAAe,GAAG,eAAe,UACjC,MAAM,QAIhB;IAED;;OAEG;IACH,UAFY,MAAM,CAIjB;CACF;AAQM,2CAHI,eAAe,GAAG,eAAe,GAChC,aAAa,CAE0D"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/ContentType.d.ts b/yjs-poll/node_modules/yjs/dist/src/structs/ContentType.d.ts deleted file mode 100644 index 8c7f7cc..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/ContentType.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -/** - * @type {Array>} - * @private - */ -export const typeRefs: Array<(arg0: UpdateDecoderV1 | UpdateDecoderV2) => AbstractType>; -export const YArrayRefID: 0; -export const YMapRefID: 1; -export const YTextRefID: 2; -export const YXmlElementRefID: 3; -export const YXmlFragmentRefID: 4; -export const YXmlHookRefID: 5; -export const YXmlTextRefID: 6; -/** - * @private - */ -export class ContentType { - /** - * @param {AbstractType} type - */ - constructor(type: AbstractType); - /** - * @type {AbstractType} - */ - type: AbstractType; - /** - * @return {number} - */ - getLength(): number; - /** - * @return {Array} - */ - getContent(): Array; - /** - * @return {boolean} - */ - isCountable(): boolean; - /** - * @return {ContentType} - */ - copy(): ContentType; - /** - * @param {number} offset - * @return {ContentType} - */ - splice(offset: number): ContentType; - /** - * @param {ContentType} right - * @return {boolean} - */ - mergeWith(right: ContentType): boolean; - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate(transaction: Transaction, item: Item): void; - /** - * @param {Transaction} transaction - */ - delete(transaction: Transaction): void; - /** - * @param {StructStore} store - */ - gc(store: StructStore): void; - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number): void; - /** - * @return {number} - */ - getRef(): number; -} -export function readContentType(decoder: UpdateDecoderV1 | UpdateDecoderV2): ContentType; -import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js"; -import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js"; -import { AbstractType } from "../types/AbstractType.js"; -import { Transaction } from "../utils/Transaction.js"; -import { Item } from "./Item.js"; -import { StructStore } from "../utils/StructStore.js"; -import { UpdateEncoderV1 } from "../utils/UpdateEncoder.js"; -import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js"; -//# sourceMappingURL=ContentType.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/ContentType.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/structs/ContentType.d.ts.map deleted file mode 100644 index 70a0100..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/ContentType.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ContentType.d.ts","sourceRoot":"","sources":["../../../src/structs/ContentType.js"],"names":[],"mappings":"AAaA;;;GAGG;AACH,uBAHU,aAAe,eAAe,GAAG,eAAe,KAAE,aAAa,GAAG,CAAC,CAAC,CAW7E;AAED,4BAA4B;AAC5B,0BAA0B;AAC1B,2BAA2B;AAC3B,iCAAiC;AACjC,kCAAkC;AAClC,8BAA8B;AAC9B,8BAA8B;AAE9B;;GAEG;AACH;IACE;;OAEG;IACH,kBAFW,aAAa,GAAG,CAAC,EAO3B;IAJC;;OAEG;IACH,MAFU,aAAa,GAAG,CAAC,CAEX;IAGlB;;OAEG;IACH,aAFY,MAAM,CAIjB;IAED;;OAEG;IACH,cAFY,MAAM,GAAG,CAAC,CAIrB;IAED;;OAEG;IACH,eAFY,OAAO,CAIlB;IAED;;OAEG;IACH,QAFY,WAAW,CAItB;IAED;;;OAGG;IACH,eAHW,MAAM,GACL,WAAW,CAItB;IAED;;;OAGG;IACH,iBAHW,WAAW,GACV,OAAO,CAIlB;IAED;;;OAGG;IACH,uBAHW,WAAW,QACX,IAAI,QAId;IAED;;OAEG;IACH,oBAFW,WAAW,QAyBrB;IAED;;OAEG;IACH,UAFW,WAAW,QAgBrB;IAED;;;OAGG;IACH,eAHW,eAAe,GAAG,eAAe,UACjC,MAAM,QAIhB;IAED;;OAEG;IACH,UAFY,MAAM,CAIjB;CACF;AAQM,yCAHI,eAAe,GAAG,eAAe,GAChC,WAAW,CAE4E"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/GC.d.ts b/yjs-poll/node_modules/yjs/dist/src/structs/GC.d.ts deleted file mode 100644 index 566e4ae..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/GC.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -export const structGCRefNumber: 0; -/** - * @private - */ -export class GC extends AbstractStruct { - delete(): void; - /** - * @param {GC} right - * @return {boolean} - */ - mergeWith(right: GC): boolean; - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number): void; - /** - * @param {Transaction} transaction - * @param {StructStore} store - * @return {null | number} - */ - getMissing(transaction: Transaction, store: StructStore): null | number; -} -import { AbstractStruct } from "./AbstractStruct.js"; -import { UpdateEncoderV1 } from "../utils/UpdateEncoder.js"; -import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js"; -import { Transaction } from "../utils/Transaction.js"; -import { StructStore } from "../utils/StructStore.js"; -//# sourceMappingURL=GC.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/GC.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/structs/GC.d.ts.map deleted file mode 100644 index 99a5cc5..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/GC.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"GC.d.ts","sourceRoot":"","sources":["../../../src/structs/GC.js"],"names":[],"mappings":"AAMA,kCAAkC;AAElC;;GAEG;AACH;IAKE,eAAY;IAEZ;;;OAGG;IACH,iBAHW,EAAE,GACD,OAAO,CAQlB;IAcD;;;OAGG;IACH,eAHW,eAAe,GAAG,eAAe,UACjC,MAAM,QAKhB;IAED;;;;OAIG;IACH,wBAJW,WAAW,SACX,WAAW,GACV,IAAI,GAAG,MAAM,CAIxB;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/Item.d.ts b/yjs-poll/node_modules/yjs/dist/src/structs/Item.d.ts deleted file mode 100644 index e13d3d9..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/Item.d.ts +++ /dev/null @@ -1,218 +0,0 @@ -export function followRedone(store: StructStore, id: ID): { - item: Item; - diff: number; -}; -export function keepItem(item: Item | null, keep: boolean): void; -export function splitItem(transaction: Transaction, leftItem: Item, diff: number): Item; -export function redoItem(transaction: Transaction, item: Item, redoitems: Set, itemsToDelete: DeleteSet, ignoreRemoteMapChanges: boolean, um: import('../utils/UndoManager.js').UndoManager): Item | null; -/** - * Abstract class that represents any content. - */ -export class Item extends AbstractStruct { - /** - * @param {ID} id - * @param {Item | null} left - * @param {ID | null} origin - * @param {Item | null} right - * @param {ID | null} rightOrigin - * @param {AbstractType|ID|null} parent Is a type if integrated, is null if it is possible to copy parent from left or right, is ID before integration to search for it. - * @param {string | null} parentSub - * @param {AbstractContent} content - */ - constructor(id: ID, left: Item | null, origin: ID | null, right: Item | null, rightOrigin: ID | null, parent: AbstractType | ID | null, parentSub: string | null, content: AbstractContent); - /** - * The item that was originally to the left of this item. - * @type {ID | null} - */ - origin: ID | null; - /** - * The item that is currently to the left of this item. - * @type {Item | null} - */ - left: Item | null; - /** - * The item that is currently to the right of this item. - * @type {Item | null} - */ - right: Item | null; - /** - * The item that was originally to the right of this item. - * @type {ID | null} - */ - rightOrigin: ID | null; - /** - * @type {AbstractType|ID|null} - */ - parent: AbstractType | ID | null; - /** - * If the parent refers to this item with some kind of key (e.g. YMap, the - * key is specified here. The key is then used to refer to the list in which - * to insert this item. If `parentSub = null` type._start is the list in - * which to insert to. Otherwise it is `parent._map`. - * @type {String | null} - */ - parentSub: string | null; - /** - * If this type's effect is redone this type refers to the type that undid - * this operation. - * @type {ID | null} - */ - redone: ID | null; - /** - * @type {AbstractContent} - */ - content: AbstractContent; - /** - * bit1: keep - * bit2: countable - * bit3: deleted - * bit4: mark - mark node as fast-search-marker - * @type {number} byte - */ - info: number; - /** - * This is used to mark the item as an indexed fast-search marker - * - * @type {boolean} - */ - set marker(arg: boolean); - get marker(): boolean; - set keep(arg: boolean); - /** - * If true, do not garbage collect this Item. - */ - get keep(): boolean; - get countable(): boolean; - set deleted(arg: boolean); - /** - * Whether this item was deleted or not. - * @type {Boolean} - */ - get deleted(): boolean; - markDeleted(): void; - /** - * Return the creator clientID of the missing op or define missing items and return null. - * - * @param {Transaction} transaction - * @param {StructStore} store - * @return {null | number} - */ - getMissing(transaction: Transaction, store: StructStore): null | number; - /** - * Returns the next non-deleted item - */ - get next(): Item | null; - /** - * Returns the previous non-deleted item - */ - get prev(): Item | null; - /** - * Computes the last content address of this Item. - */ - get lastId(): ID; - /** - * Try to merge two items - * - * @param {Item} right - * @return {boolean} - */ - mergeWith(right: Item): boolean; - /** - * Mark this Item as deleted. - * - * @param {Transaction} transaction - */ - delete(transaction: Transaction): void; - /** - * @param {StructStore} store - * @param {boolean} parentGCd - */ - gc(store: StructStore, parentGCd: boolean): void; - /** - * Transform the properties of this type to binary and write it to an - * BinaryEncoder. - * - * This is called when this Item is sent to a remote peer. - * - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - * @param {number} offset - */ - write(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number): void; -} -export function readItemContent(decoder: UpdateDecoderV1 | UpdateDecoderV2, info: number): AbstractContent; -/** - * A lookup map for reading Item content. - * - * @type {Array} - */ -export const contentRefs: Array<(arg0: UpdateDecoderV1 | UpdateDecoderV2) => AbstractContent>; -/** - * Do not implement this class! - */ -export class AbstractContent { - /** - * @return {number} - */ - getLength(): number; - /** - * @return {Array} - */ - getContent(): Array; - /** - * Should return false if this Item is some kind of meta information - * (e.g. format information). - * - * * Whether this Item should be addressable via `yarray.get(i)` - * * Whether this Item should be counted when computing yarray.length - * - * @return {boolean} - */ - isCountable(): boolean; - /** - * @return {AbstractContent} - */ - copy(): AbstractContent; - /** - * @param {number} _offset - * @return {AbstractContent} - */ - splice(_offset: number): AbstractContent; - /** - * @param {AbstractContent} _right - * @return {boolean} - */ - mergeWith(_right: AbstractContent): boolean; - /** - * @param {Transaction} _transaction - * @param {Item} _item - */ - integrate(_transaction: Transaction, _item: Item): void; - /** - * @param {Transaction} _transaction - */ - delete(_transaction: Transaction): void; - /** - * @param {StructStore} _store - */ - gc(_store: StructStore): void; - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} _encoder - * @param {number} _offset - */ - write(_encoder: UpdateEncoderV1 | UpdateEncoderV2, _offset: number): void; - /** - * @return {number} - */ - getRef(): number; -} -import { StructStore } from "../utils/StructStore.js"; -import { ID } from "../utils/ID.js"; -import { Transaction } from "../utils/Transaction.js"; -import { DeleteSet } from "../utils/DeleteSet.js"; -import { AbstractStruct } from "./AbstractStruct.js"; -import { AbstractType } from "../types/AbstractType.js"; -import { UpdateEncoderV1 } from "../utils/UpdateEncoder.js"; -import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js"; -import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js"; -import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js"; -//# sourceMappingURL=Item.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/Item.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/structs/Item.d.ts.map deleted file mode 100644 index fca90b0..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/Item.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../src/structs/Item.js"],"names":[],"mappings":"AAsCO,oCAJI,WAAW,MACX,EAAE;UACK,IAAI;UAAO,MAAM;EAoBlC;AAWM,+BAHI,IAAI,GAAC,IAAI,QACT,OAAO,QAOjB;AAYM,uCARI,WAAW,YACX,IAAI,QACJ,MAAM,GACL,IAAI,CAyCf;AAsBM,sCAXI,WAAW,QACX,IAAI,aACJ,IAAI,IAAI,CAAC,iBACT,SAAS,0BACT,OAAO,MACP,OAAO,yBAAyB,EAAE,WAAW,GAE5C,IAAI,GAAC,IAAI,CAsGpB;AAED;;GAE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;AAE3F;;;;GAIG;AACH,0BAFU,aAAe,eAAe,GAAG,eAAe,KAAE,eAAe,CAAC,CAc3E;AAED;;GAEG;AACH;IACE;;OAEG;IACH,aAFY,MAAM,CAIjB;IAED;;OAEG;IACH,cAFY,MAAM,GAAG,CAAC,CAIrB;IAED;;;;;;;;OAQG;IACH,eAFY,OAAO,CAIlB;IAED;;OAEG;IACH,QAFY,eAAe,CAI1B;IAED;;;OAGG;IACH,gBAHW,MAAM,GACL,eAAe,CAI1B;IAED;;;OAGG;IACH,kBAHW,eAAe,GACd,OAAO,CAIlB;IAED;;;OAGG;IACH,wBAHW,WAAW,SACX,IAAI,QAId;IAED;;OAEG;IACH,qBAFW,WAAW,QAIrB;IAED;;OAEG;IACH,WAFW,WAAW,QAIrB;IAED;;;OAGG;IACH,gBAHW,eAAe,GAAG,eAAe,WACjC,MAAM,QAIhB;IAED;;OAEG;IACH,UAFY,MAAM,CAIjB;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/Skip.d.ts b/yjs-poll/node_modules/yjs/dist/src/structs/Skip.d.ts deleted file mode 100644 index 2a95c48..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/Skip.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -export const structSkipRefNumber: 10; -/** - * @private - */ -export class Skip extends AbstractStruct { - delete(): void; - /** - * @param {Skip} right - * @return {boolean} - */ - mergeWith(right: Skip): boolean; - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number): void; - /** - * @param {Transaction} transaction - * @param {StructStore} store - * @return {null | number} - */ - getMissing(transaction: Transaction, store: StructStore): null | number; -} -import { AbstractStruct } from "./AbstractStruct.js"; -import { UpdateEncoderV1 } from "../utils/UpdateEncoder.js"; -import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js"; -import { Transaction } from "../utils/Transaction.js"; -import { StructStore } from "../utils/StructStore.js"; -//# sourceMappingURL=Skip.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/structs/Skip.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/structs/Skip.d.ts.map deleted file mode 100644 index ab88553..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/structs/Skip.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Skip.d.ts","sourceRoot":"","sources":["../../../src/structs/Skip.js"],"names":[],"mappings":"AAOA,qCAAqC;AAErC;;GAEG;AACH;IAKE,eAAY;IAEZ;;;OAGG;IACH,iBAHW,IAAI,GACH,OAAO,CAQlB;IAWD;;;OAGG;IACH,eAHW,eAAe,GAAG,eAAe,UACjC,MAAM,QAMhB;IAED;;;;OAIG;IACH,wBAJW,WAAW,SACX,WAAW,GACV,IAAI,GAAG,MAAM,CAIxB;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/types/AbstractType.d.ts b/yjs-poll/node_modules/yjs/dist/src/types/AbstractType.d.ts deleted file mode 100644 index 334b3a2..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/types/AbstractType.d.ts +++ /dev/null @@ -1,173 +0,0 @@ -export function warnPrematureAccess(): void; -export class ArraySearchMarker { - /** - * @param {Item} p - * @param {number} index - */ - constructor(p: Item, index: number); - p: Item; - index: number; - timestamp: number; -} -export function findMarker(yarray: AbstractType, index: number): ArraySearchMarker | null; -export function updateMarkerChanges(searchMarker: Array, index: number, len: number): void; -export function getTypeChildren(t: AbstractType): Array; -export function callTypeObservers(type: AbstractType, transaction: Transaction, event: EventType): void; -/** - * @template EventType - * Abstract Yjs Type class - */ -export class AbstractType { - /** - * @type {Item|null} - */ - _item: Item | null; - /** - * @type {Map} - */ - _map: Map; - /** - * @type {Item|null} - */ - _start: Item | null; - /** - * @type {Doc|null} - */ - doc: Doc | null; - _length: number; - /** - * Event handlers - * @type {EventHandler} - */ - _eH: EventHandler; - /** - * Deep event handlers - * @type {EventHandler>,Transaction>} - */ - _dEH: EventHandler>, Transaction>; - /** - * @type {null | Array} - */ - _searchMarker: null | Array; - /** - * @return {AbstractType|null} - */ - get parent(): AbstractType | null; - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item|null} item - */ - _integrate(y: Doc, item: Item | null): void; - /** - * @return {AbstractType} - */ - _copy(): AbstractType; - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {AbstractType} - */ - clone(): AbstractType; - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} _encoder - */ - _write(_encoder: UpdateEncoderV1 | UpdateEncoderV2): void; - /** - * The first non-deleted item - */ - get _first(): Item | null; - /** - * Creates YEvent and calls all type observers. - * Must be implemented by each type. - * - * @param {Transaction} transaction - * @param {Set} _parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver(transaction: Transaction, _parentSubs: Set): void; - /** - * Observe all events that are created on this type. - * - * @param {function(EventType, Transaction):void} f Observer function - */ - observe(f: (arg0: EventType, arg1: Transaction) => void): void; - /** - * Observe all events that are created by this type and its children. - * - * @param {function(Array>,Transaction):void} f Observer function - */ - observeDeep(f: (arg0: Array>, arg1: Transaction) => void): void; - /** - * Unregister an observer function. - * - * @param {function(EventType,Transaction):void} f Observer function - */ - unobserve(f: (arg0: EventType, arg1: Transaction) => void): void; - /** - * Unregister an observer function. - * - * @param {function(Array>,Transaction):void} f Observer function - */ - unobserveDeep(f: (arg0: Array>, arg1: Transaction) => void): void; - /** - * @abstract - * @return {any} - */ - toJSON(): any; -} -export function typeListSlice(type: AbstractType, start: number, end: number): Array; -export function typeListToArray(type: AbstractType): Array; -export function typeListToArraySnapshot(type: AbstractType, snapshot: Snapshot): Array; -export function typeListForEach(type: AbstractType, f: (arg0: any, arg1: number, arg2: any) => void): void; -export function typeListMap(type: AbstractType, f: (arg0: C, arg1: number, arg2: AbstractType) => R): R[]; -export function typeListCreateIterator(type: AbstractType): IterableIterator; -export function typeListForEachSnapshot(type: AbstractType, f: (arg0: any, arg1: number, arg2: AbstractType) => void, snapshot: Snapshot): void; -export function typeListGet(type: AbstractType, index: number): any; -export function typeListInsertGenericsAfter(transaction: Transaction, parent: AbstractType, referenceItem: Item | null, content: Array<{ - [x: string]: any; -} | Array | boolean | number | null | string | Uint8Array>): void; -export function typeListInsertGenerics(transaction: Transaction, parent: AbstractType, index: number, content: Array<{ - [x: string]: any; -} | Array | number | null | string | Uint8Array>): void; -export function typeListPushGenerics(transaction: Transaction, parent: AbstractType, content: Array<{ - [x: string]: any; -} | Array | number | null | string | Uint8Array>): void; -export function typeListDelete(transaction: Transaction, parent: AbstractType, index: number, length: number): void; -export function typeMapDelete(transaction: Transaction, parent: AbstractType, key: string): void; -export function typeMapSet(transaction: Transaction, parent: AbstractType, key: string, value: Object | number | null | Array | string | Uint8Array | AbstractType): void; -export function typeMapGet(parent: AbstractType, key: string): { - [x: string]: any; -} | number | null | Array | string | Uint8Array | AbstractType | undefined; -export function typeMapGetAll(parent: AbstractType): { - [x: string]: { - [x: string]: any; - } | number | null | Array | string | Uint8Array | AbstractType | undefined; -}; -export function typeMapHas(parent: AbstractType, key: string): boolean; -export function typeMapGetSnapshot(parent: AbstractType, key: string, snapshot: Snapshot): { - [x: string]: any; -} | number | null | Array | string | Uint8Array | AbstractType | undefined; -export function typeMapGetAllSnapshot(parent: AbstractType, snapshot: Snapshot): { - [x: string]: { - [x: string]: any; - } | number | null | Array | string | Uint8Array | AbstractType | undefined; -}; -export function createMapIterator(type: AbstractType & { - _map: Map; -}): IterableIterator>; -import { Item } from "../structs/Item.js"; -import { Transaction } from "../utils/Transaction.js"; -import { Doc } from "../utils/Doc.js"; -import { EventHandler } from "../utils/EventHandler.js"; -import { YEvent } from "../utils/YEvent.js"; -import { UpdateEncoderV1 } from "../utils/UpdateEncoder.js"; -import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js"; -import { Snapshot } from "../utils/Snapshot.js"; -//# sourceMappingURL=AbstractType.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/types/AbstractType.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/types/AbstractType.d.ts.map deleted file mode 100644 index dc5cdc8..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/types/AbstractType.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"AbstractType.d.ts","sourceRoot":"","sources":["../../../src/types/AbstractType.js"],"names":[],"mappings":"AAwBO,4CAAiH;AAaxH;IACE;;;OAGG;IACH,eAHW,IAAI,SACJ,MAAM,EAOhB;IAHC,QAAU;IACV,cAAkB;IAClB,kBAA8C;CAEjD;AAqDM,mCAHI,aAAa,GAAG,CAAC,SACjB,MAAM,4BAyEhB;AAWM,kDAJI,MAAM,iBAAiB,CAAC,SACxB,MAAM,OACN,MAAM,QAiChB;AAQM,mCAHI,aAAa,GAAG,CAAC,GAChB,MAAM,IAAI,CAAC,CAWtB;AAWM,yFAHI,WAAW,0BAerB;AAED;;;GAGG;AACH;IAEI;;OAEG;IACH,OAFU,IAAI,GAAC,IAAI,CAEF;IACjB;;OAEG;IACH,MAFU,IAAI,MAAM,EAAC,IAAI,CAAC,CAEL;IACrB;;OAEG;IACH,QAFU,IAAI,GAAC,IAAI,CAED;IAClB;;OAEG;IACH,KAFU,GAAG,GAAC,IAAI,CAEH;IACf,gBAAgB;IAChB;;;OAGG;IACH,KAFU,aAAa,SAAS,EAAC,WAAW,CAAC,CAEd;IAC/B;;;OAGG;IACH,MAFU,aAAa,MAAM,OAAO,GAAG,CAAC,CAAC,EAAC,WAAW,CAAC,CAEtB;IAChC;;OAEG;IACH,eAFU,IAAI,GAAG,MAAM,iBAAiB,CAAC,CAEhB;IAG3B;;OAEG;IACH,uCAEC;IAED;;;;;;;;;OASG;IACH,cAHW,GAAG,QACH,IAAI,GAAC,IAAI,QAKnB;IAED;;OAEG;IACH,SAFY,aAAa,SAAS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Aa,GAAG,CAAC,OACjB,MAAM,YACN,QAAQ,GACP;QAAO,MAAM,GAAC,GAAG;IAAE,MAAM,GAAC,IAAI,GAAC,MAAM,GAAG,CAAC,GAAC,MAAM,GAAC,UAAU,GAAC,aAAa,GAAG,CAAC,GAAC,SAAS,CAWlG;AAUM,8CAPI,aAAa,GAAG,CAAC,YACjB,QAAQ;QACA,MAAM,GAAC;YAAO,MAAM,GAAC,GAAG;QAAE,MAAM,GAAC,IAAI,GAAC,MAAM,GAAG,CAAC,GAAC,MAAM,GAAC,UAAU,GAAC,aAAa,GAAG,CAAC,GAAC,SAAS;EAuBhH;AASM,wCANI,aAAa,GAAG,CAAC,GAAG;IAAE,IAAI,EAAE,IAAI,MAAM,EAAE,IAAI,CAAC,CAAA;CAAE,GAC9C,iBAAiB,MAAM,GAAG,CAAC,CAAC,CAQvC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/types/YArray.d.ts b/yjs-poll/node_modules/yjs/dist/src/types/YArray.d.ts deleted file mode 100644 index 2ba25ee..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/types/YArray.d.ts +++ /dev/null @@ -1,154 +0,0 @@ -/** - * Event that describes the changes on a YArray - * @template T - * @extends YEvent> - */ -export class YArrayEvent extends YEvent> { - constructor(target: YArray, transaction: Transaction); -} -/** - * A shared Array implementation. - * @template T - * @extends AbstractType> - * @implements {Iterable} - */ -export class YArray extends AbstractType> implements Iterable { - /** - * Construct a new YArray containing the specified items. - * @template {Object|Array|number|null|string|Uint8Array} T - * @param {Array} items - * @return {YArray} - */ - static from(items: T_1[]): YArray; - /** - * @type {Array?} - * @private - */ - private _prelimContent; - /** - * @type {Array} - */ - _searchMarker: Array; - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item} item - */ - _integrate(y: Doc, item: Item): void; - /** - * @return {YArray} - */ - _copy(): YArray; - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YArray} - */ - clone(): YArray; - get length(): number; - /** - * Inserts new content at an index. - * - * Important: This function expects an array of content. Not just a content - * object. The reason for this "weirdness" is that inserting several elements - * is very efficient when it is done as a single operation. - * - * @example - * // Insert character 'a' at position 0 - * yarray.insert(0, ['a']) - * // Insert numbers 1, 2 at position 1 - * yarray.insert(1, [1, 2]) - * - * @param {number} index The index to insert content at. - * @param {Array} content The array of content - */ - insert(index: number, content: Array): void; - /** - * Appends content to this YArray. - * - * @param {Array} content Array of content to append. - * - * @todo Use the following implementation in all types. - */ - push(content: Array): void; - /** - * Prepends content to this YArray. - * - * @param {Array} content Array of content to prepend. - */ - unshift(content: Array): void; - /** - * Deletes elements starting from an index. - * - * @param {number} index Index at which to start deleting elements - * @param {number} length The number of elements to remove. Defaults to 1. - */ - delete(index: number, length?: number): void; - /** - * Returns the i-th element from a YArray. - * - * @param {number} index The index of the element to return from the YArray - * @return {T} - */ - get(index: number): T; - /** - * Transforms this YArray to a JavaScript Array. - * - * @return {Array} - */ - toArray(): Array; - /** - * Returns a portion of this YArray into a JavaScript Array selected - * from start to end (end not included). - * - * @param {number} [start] - * @param {number} [end] - * @return {Array} - */ - slice(start?: number | undefined, end?: number | undefined): Array; - /** - * Transforms this Shared Type to a JSON object. - * - * @return {Array} - */ - toJSON(): Array; - /** - * Returns an Array with the result of calling a provided function on every - * element of this YArray. - * - * @template M - * @param {function(T,number,YArray):M} f Function that produces an element of the new Array - * @return {Array} A new array with each element being the result of the - * callback function - */ - map(f: (arg0: T, arg1: number, arg2: YArray) => M): M[]; - /** - * Executes a provided function once on every element of this YArray. - * - * @param {function(T,number,YArray):void} f A function to execute on every element of this YArray. - */ - forEach(f: (arg0: T, arg1: number, arg2: YArray) => void): void; - /** - * @return {IterableIterator} - */ - [Symbol.iterator](): IterableIterator; -} -export function readYArray(_decoder: UpdateDecoderV1 | UpdateDecoderV2): YArray; -import { YEvent } from "../utils/YEvent.js"; -import { Transaction } from "../utils/Transaction.js"; -import { AbstractType } from "./AbstractType.js"; -import { ArraySearchMarker } from "./AbstractType.js"; -import { Doc } from "../utils/Doc.js"; -import { Item } from "../structs/Item.js"; -import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js"; -import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js"; -//# sourceMappingURL=YArray.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/types/YArray.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/types/YArray.d.ts.map deleted file mode 100644 index 242c476..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/types/YArray.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"YArray.d.ts","sourceRoot":"","sources":["../../../src/types/YArray.js"],"names":[],"mappings":"AAuBA;;;;GAIG;AACH;IATkI,yDAgDjI;CAvCyC;AAE1C;;;;;GAKG;AACH,gFAFyB,CAAC;IAgBxB;;;;;OAKG;IACH;;yCAOC;IAxBC;;;OAGG;IACH,uBAAwB;IACxB;;OAEG;IACH,eAFU,MAAM,iBAAiB,CAAC,CAEX;IAkBzB;;;;;;;;;OASG;IACH,cAHW,GAAG,QACH,IAAI,QAMd;IAED;;OAEG;IACH,SAFY,OAAO,CAAC,CAAC,CAIpB;IAED;;;;;;OAMG;IACH,SAFY,OAAO,CAAC,CAAC,CAWpB;IAED,qBAGC;IAaD;;;;;;;;;;;;;;;OAeG;IACH,cAHW,MAAM,WACN,MAAM,CAAC,CAAC,QAUlB;IAED;;;;;;OAMG;IACH,cAJW,MAAM,CAAC,CAAC,QAYlB;IAED;;;;OAIG;IACH,iBAFW,MAAM,CAAC,CAAC,QAIlB;IAED;;;;;OAKG;IACH,cAHW,MAAM,WACN,MAAM,QAUhB;IAED;;;;;OAKG;IACH,WAHW,MAAM,GACL,CAAC,CAIZ;IAED;;;;OAIG;IACH,WAFY,MAAM,CAAC,CAAC,CAInB;IAED;;;;;;;OAOG;IACH,6DAFY,MAAM,CAAC,CAAC,CAInB;IAED;;;;OAIG;IACH,UAFY,MAAM,GAAG,CAAC,CAIrB;IAED;;;;;;;;OAQG;IACH,iBAJoB,CAAC,QAAC,MAAM,QAAC,OAAO,CAAC,CAAC,aAMrC;IAED;;;;OAIG;IACH,kBAFoB,CAAC,QAAC,MAAM,QAAC,OAAO,CAAC,CAAC,KAAE,IAAI,QAI3C;IAED;;OAEG;IACH,qBAFY,iBAAiB,CAAC,CAAC,CAI9B;CAQF;AAQM,qCALI,eAAe,GAAG,eAAe,eAKM"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/types/YMap.d.ts b/yjs-poll/node_modules/yjs/dist/src/types/YMap.d.ts deleted file mode 100644 index 5ae4c01..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/types/YMap.d.ts +++ /dev/null @@ -1,142 +0,0 @@ -/** - * @template T - * @extends YEvent> - * Event that describes the changes on a YMap. - */ -export class YMapEvent extends YEvent> { - /** - * @param {YMap} ymap The YArray that changed. - * @param {Transaction} transaction - * @param {Set} subs The keys that changed. - */ - constructor(ymap: YMap, transaction: Transaction, subs: Set); - keysChanged: Set; -} -/** - * @template MapType - * A shared Map implementation. - * - * @extends AbstractType> - * @implements {Iterable<[string, MapType]>} - */ -export class YMap extends AbstractType> implements Iterable<[string, MapType]> { - /** - * - * @param {Iterable=} entries - an optional iterable to initialize the YMap - */ - constructor(entries?: Iterable | undefined); - /** - * @type {Map?} - * @private - */ - private _prelimContent; - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item} item - */ - _integrate(y: Doc, item: Item): void; - /** - * @return {YMap} - */ - _copy(): YMap; - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YMap} - */ - clone(): YMap; - /** - * Transforms this Shared Type to a JSON object. - * - * @return {Object} - */ - toJSON(): { - [x: string]: any; - }; - /** - * Returns the size of the YMap (count of key/value pairs) - * - * @return {number} - */ - get size(): number; - /** - * Returns the keys for each element in the YMap Type. - * - * @return {IterableIterator} - */ - keys(): IterableIterator; - /** - * Returns the values for each element in the YMap Type. - * - * @return {IterableIterator} - */ - values(): IterableIterator; - /** - * Returns an Iterator of [key, value] pairs - * - * @return {IterableIterator<[string, MapType]>} - */ - entries(): IterableIterator<[string, MapType]>; - /** - * Executes a provided function on once on every key-value pair. - * - * @param {function(MapType,string,YMap):void} f A function to execute on every element of this YArray. - */ - forEach(f: (arg0: MapType, arg1: string, arg2: YMap) => void): void; - /** - * Remove a specified element from this YMap. - * - * @param {string} key The key of the element to remove. - */ - delete(key: string): void; - /** - * Adds or updates an element with a specified key and value. - * @template {MapType} VAL - * - * @param {string} key The key of the element to add to this YMap - * @param {VAL} value The value of the element to add - * @return {VAL} - */ - set(key: string, value: VAL): VAL; - /** - * Returns a specified element from this YMap. - * - * @param {string} key - * @return {MapType|undefined} - */ - get(key: string): MapType | undefined; - /** - * Returns a boolean indicating whether the specified key exists or not. - * - * @param {string} key The key to test. - * @return {boolean} - */ - has(key: string): boolean; - /** - * Removes all elements from this YMap. - */ - clear(): void; - /** - * Returns an Iterator of [key, value] pairs - * - * @return {IterableIterator<[string, MapType]>} - */ - [Symbol.iterator](): IterableIterator<[string, MapType]>; -} -export function readYMap(_decoder: UpdateDecoderV1 | UpdateDecoderV2): YMap; -import { YEvent } from "../utils/YEvent.js"; -import { Transaction } from "../utils/Transaction.js"; -import { AbstractType } from "./AbstractType.js"; -import { Doc } from "../utils/Doc.js"; -import { Item } from "../structs/Item.js"; -import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js"; -import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js"; -//# sourceMappingURL=YMap.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/types/YMap.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/types/YMap.d.ts.map deleted file mode 100644 index 9b36ad3..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/types/YMap.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"YMap.d.ts","sourceRoot":"","sources":["../../../src/types/YMap.js"],"names":[],"mappings":"AAqBA;;;;GAIG;AACH;IACE;;;;OAIG;IACH,kBAJW,KAAK,CAAC,CAAC,eACP,WAAW,QACX,IAAI,GAAG,CAAC,EAKlB;IADC,sBAAuB;CAE1B;AAED;;;;;;GAMG;AACH,wFAFyB,CAAC,MAAM,EAAE,OAAO,CAAC;IAGxC;;;OAGG;IACH,sBAFW,SAAS,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,cAe1C;IAXC;;;OAGG;IACH,uBAA0B;IAS5B;;;;;;;;;OASG;IACH,cAHW,GAAG,QACH,IAAI,QAQd;IAED;;OAEG;IACH,SAFY,KAAK,OAAO,CAAC,CAIxB;IAED;;;;;;OAMG;IACH,SAFY,KAAK,OAAO,CAAC,CAWxB;IAYD;;;;OAIG;IACH;YAFmB,MAAM,GAAC,GAAG;MAe5B;IAED;;;;OAIG;IACH,mBAEC;IAED;;;;OAIG;IACH,QAFY,iBAAiB,MAAM,CAAC,CAInC;IAED;;;;OAIG;IACH,UAFY,iBAAiB,OAAO,CAAC,CAIpC;IAED;;;;OAIG;IACH,WAFY,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAI9C;IAED;;;;OAIG;IACH,kBAFoB,OAAO,QAAC,MAAM,QAAC,KAAK,OAAO,CAAC,KAAE,IAAI,QASrD;IAWD;;;;OAIG;IACH,YAFW,MAAM,QAUhB;IAED;;;;;;;OAOG;IACH,8BAJW,MAAM,mBAahB;IAED;;;;;OAKG;IACH,SAHW,MAAM,GACL,OAAO,GAAC,SAAS,CAI5B;IAED;;;;;OAKG;IACH,SAHW,MAAM,GACL,OAAO,CAIlB;IAED;;OAEG;IACH,cAUC;IA5ED;;;;OAIG;IACH,qBAFY,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAI9C;CA6EF;AAQM,mCALI,eAAe,GAAG,eAAe,aAKE"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/types/YText.d.ts b/yjs-poll/node_modules/yjs/dist/src/types/YText.d.ts deleted file mode 100644 index c28d4bb..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/types/YText.d.ts +++ /dev/null @@ -1,261 +0,0 @@ -export class ItemTextListPosition { - /** - * @param {Item|null} left - * @param {Item|null} right - * @param {number} index - * @param {Map} currentAttributes - */ - constructor(left: Item | null, right: Item | null, index: number, currentAttributes: Map); - left: Item | null; - right: Item | null; - index: number; - currentAttributes: Map; - /** - * Only call this if you know that this.right is defined - */ - forward(): void; -} -export function cleanupYTextFormatting(type: YText): number; -export function cleanupYTextAfterTransaction(transaction: Transaction): void; -/** - * The Quill Delta format represents changes on a text document with - * formatting information. For more information visit {@link https://quilljs.com/docs/delta/|Quill Delta} - * - * @example - * { - * ops: [ - * { insert: 'Gandalf', attributes: { bold: true } }, - * { insert: ' the ' }, - * { insert: 'Grey', attributes: { color: '#cccccc' } } - * ] - * } - * - */ -/** - * Attributes that can be assigned to a selection of text. - * - * @example - * { - * bold: true, - * font-size: '40px' - * } - * - * @typedef {Object} TextAttributes - */ -/** - * @extends YEvent - * Event that describes the changes on a YText type. - */ -export class YTextEvent extends YEvent { - /** - * @param {YText} ytext - * @param {Transaction} transaction - * @param {Set} subs The keys that changed - */ - constructor(ytext: YText, transaction: Transaction, subs: Set); - /** - * Whether the children changed. - * @type {Boolean} - * @private - */ - private childListChanged; - /** - * Set of all changed attributes. - * @type {Set} - */ - keysChanged: Set; - /** - * Compute the changes in the delta format. - * A {@link https://quilljs.com/docs/delta/|Quill Delta}) that represents the changes on the document. - * - * @type {Array<{insert?:string|object|AbstractType, delete?:number, retain?:number, attributes?: Object}>} - * - * @public - */ - public get delta(): { - insert?: string | object | AbstractType | undefined; - delete?: number | undefined; - retain?: number | undefined; - attributes?: { - [x: string]: any; - } | undefined; - }[]; -} -/** - * Type that represents text with formatting information. - * - * This type replaces y-richtext as this implementation is able to handle - * block formats (format information on a paragraph), embeds (complex elements - * like pictures and videos), and text formats (**bold**, *italic*). - * - * @extends AbstractType - */ -export class YText extends AbstractType { - /** - * @param {String} [string] The initial value of the YText. - */ - constructor(string?: string | undefined); - /** - * Array of pending operations on this type - * @type {Array?} - */ - _pending: (() => void)[] | null; - /** - * Whether this YText contains formatting attributes. - * This flag is updated when a formatting item is integrated (see ContentFormat.integrate) - */ - _hasFormatting: boolean; - /** - * Number of characters of this text type. - * - * @type {number} - */ - get length(): number; - /** - * @param {Doc} y - * @param {Item} item - */ - _integrate(y: Doc, item: Item): void; - _copy(): YText; - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YText} - */ - clone(): YText; - /** - * Returns the unformatted string representation of this YText type. - * - * @return {string} - * @public - */ - public toJSON(): string; - /** - * Apply a {@link Delta} on this shared YText type. - * - * @param {Array} delta The changes to apply on this element. - * @param {object} opts - * @param {boolean} [opts.sanitize] Sanitize input delta. Removes ending newlines if set to true. - * - * - * @public - */ - public applyDelta(delta: Array, { sanitize }?: { - sanitize?: boolean | undefined; - }): void; - /** - * Returns the Delta representation of this YText type. - * - * @param {Snapshot} [snapshot] - * @param {Snapshot} [prevSnapshot] - * @param {function('removed' | 'added', ID):any} [computeYChange] - * @return {any} The Delta representation of this type. - * - * @public - */ - public toDelta(snapshot?: Snapshot | undefined, prevSnapshot?: Snapshot | undefined, computeYChange?: ((arg0: 'removed' | 'added', arg1: ID) => any) | undefined): any; - /** - * Insert text at a given index. - * - * @param {number} index The index at which to start inserting. - * @param {String} text The text to insert at the specified position. - * @param {TextAttributes} [attributes] Optionally define some formatting - * information to apply on the inserted - * Text. - * @public - */ - public insert(index: number, text: string, attributes?: Object | undefined): void; - /** - * Inserts an embed at a index. - * - * @param {number} index The index to insert the embed at. - * @param {Object | AbstractType} embed The Object that represents the embed. - * @param {TextAttributes} [attributes] Attribute information to apply on the - * embed - * - * @public - */ - public insertEmbed(index: number, embed: Object | AbstractType, attributes?: Object | undefined): void; - /** - * Deletes text starting from an index. - * - * @param {number} index Index at which to start deleting. - * @param {number} length The number of characters to remove. Defaults to 1. - * - * @public - */ - public delete(index: number, length: number): void; - /** - * Assigns properties to a range of text. - * - * @param {number} index The position where to start formatting. - * @param {number} length The amount of characters to assign properties to. - * @param {TextAttributes} attributes Attribute information to apply on the - * text. - * - * @public - */ - public format(index: number, length: number, attributes: TextAttributes): void; - /** - * Removes an attribute. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @param {String} attributeName The attribute name that is to be removed. - * - * @public - */ - public removeAttribute(attributeName: string): void; - /** - * Sets or updates an attribute. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @param {String} attributeName The attribute name that is to be set. - * @param {any} attributeValue The attribute value that is to be set. - * - * @public - */ - public setAttribute(attributeName: string, attributeValue: any): void; - /** - * Returns an attribute value that belongs to the attribute name. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @param {String} attributeName The attribute name that identifies the - * queried value. - * @return {any} The queried attribute value. - * - * @public - */ - public getAttribute(attributeName: string): any; - /** - * Returns all attribute name/value pairs in a JSON Object. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @return {Object} A JSON Object that describes the attributes. - * - * @public - */ - public getAttributes(): { - [x: string]: any; - }; -} -export function readYText(_decoder: UpdateDecoderV1 | UpdateDecoderV2): YText; -/** - * Attributes that can be assigned to a selection of text. - */ -export type TextAttributes = Object; -import { Item } from "../structs/Item.js"; -import { Transaction } from "../utils/Transaction.js"; -import { YEvent } from "../utils/YEvent.js"; -import { AbstractType } from "./AbstractType.js"; -import { Doc } from "../utils/Doc.js"; -import { Snapshot } from "../utils/Snapshot.js"; -import { ID } from "../utils/ID.js"; -import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js"; -import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js"; -//# sourceMappingURL=YText.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/types/YText.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/types/YText.d.ts.map deleted file mode 100644 index 8e60961..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/types/YText.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"YText.d.ts","sourceRoot":"","sources":["../../../src/types/YText.js"],"names":[],"mappings":"AA2CA;IACE;;;;;OAKG;IACH,kBALW,IAAI,GAAC,IAAI,SACT,IAAI,GAAC,IAAI,SACT,MAAM,qBACN,IAAI,MAAM,EAAC,GAAG,CAAC,EAOzB;IAJC,kBAAgB;IAChB,mBAAkB;IAClB,cAAkB;IAClB,oCAA0C;IAG5C;;OAEG;IACH,gBAkBC;CACF;AAsXM,6CAHI,KAAK,GACJ,MAAM,CA0BjB;AAQM,0DAFI,WAAW,QA4CrB;AAyCD;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;IAUI;AAEJ;;;GAGG;AACH;IACE;;;;OAIG;IACH,mBAJW,KAAK,eACL,WAAW,QACX,IAAI,GAAG,CAAC,EAsBlB;IAlBC;;;;OAIG;IACH,yBAA6B;IAC7B;;;OAGG;IACH,aAFU,IAAI,MAAM,CAAC,CAEO;IA6B9B;;;;;;;OAOG;IACH;;;;;;;QAwLC;CACF;AAED;;;;;;;;GAQG;AACH;IACE;;OAEG;IACH,yCAgBC;IAdC;;;OAGG;IACH,iBAF2B,IAAI,WAE2C;IAK1E;;;OAGG;IACH,wBAA2B;IAG7B;;;;OAIG;IACH,qBAGC;IAED;;;OAGG;IACH,cAHW,GAAG,QACH,IAAI,QAUd;IAED,eAEC;IAED;;;;;;OAMG;IACH,SAFY,KAAK,CAMhB;IAuCD;;;;;OAKG;IACH,iBAHY,MAAM,CAKjB;IAED;;;;;;;;;OASG;IACH,yBAPW,MAAM,GAAG,CAAC;QAEK,QAAQ;aA+BjC;IAED;;;;;;;;;OASG;IACH,8GALoB,SAAS,GAAG,OAAO,QAAE,EAAE,KAAE,GAAG,gBACpC,GAAG,CA2Gd;IAED;;;;;;;;;OASG;IACH,qBAPW,MAAM,uDAyBhB;IAED;;;;;;;;;OASG;IACH,0BAPW,MAAM,SACN,MAAM,GAAG,aAAa,GAAG,CAAC,yCAgBpC;IAED;;;;;;;OAOG;IACH,qBALW,MAAM,UACN,MAAM,QAgBhB;IAED;;;;;;;;;OASG;IACH,qBAPW,MAAM,UACN,MAAM,cACN,cAAc,QAqBxB;IAED;;;;;;;;OAQG;IACH,oDAQC;IAED;;;;;;;;;OASG;IACH,2DAJW,GAAG,QAYb;IAED;;;;;;;;;;OAUG;IACH,4CAJY,GAAG,CAMd;IAED;;;;;;;;OAQG;IACH;YAJmB,MAAM,GAAE,GAAG;MAM7B;CAQF;AASM,oCANI,eAAe,GAAG,eAAe,GAChC,KAAK,CAK+B;;;;6BAjsBlC,MAAM"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/types/YXmlElement.d.ts b/yjs-poll/node_modules/yjs/dist/src/types/YXmlElement.d.ts deleted file mode 100644 index aaa45a1..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/types/YXmlElement.d.ts +++ /dev/null @@ -1,108 +0,0 @@ -/** - * @typedef {Object|number|null|Array|string|Uint8Array|AbstractType} ValueTypes - */ -/** - * An YXmlElement imitates the behavior of a - * https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element - * - * * An YXmlElement has attributes (key value pairs) - * * An YXmlElement has childElements that must inherit from YXmlElement - * - * @template {{ [key: string]: ValueTypes }} [KV={ [key: string]: string }] - */ -export class YXmlElement extends YXmlFragment { - constructor(nodeName?: string); - nodeName: string; - /** - * @type {Map|null} - */ - _prelimAttrs: Map | null; - /** - * @type {YXmlElement|YXmlText|null} - */ - get nextSibling(): YXmlElement<{ - [key: string]: string; - }> | YXmlText | null; - /** - * @type {YXmlElement|YXmlText|null} - */ - get prevSibling(): YXmlElement<{ - [key: string]: string; - }> | YXmlText | null; - /** - * Creates an Item with the same effect as this Item (without position effect) - * - * @return {YXmlElement} - */ - _copy(): YXmlElement; - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YXmlElement} - */ - clone(): YXmlElement; - /** - * Removes an attribute from this YXmlElement. - * - * @param {string} attributeName The attribute name that is to be removed. - * - * @public - */ - public removeAttribute(attributeName: string): void; - /** - * Sets or updates an attribute. - * - * @template {keyof KV & string} KEY - * - * @param {KEY} attributeName The attribute name that is to be set. - * @param {KV[KEY]} attributeValue The attribute value that is to be set. - * - * @public - */ - public setAttribute(attributeName: KEY, attributeValue: KV[KEY]): void; - /** - * Returns an attribute value that belongs to the attribute name. - * - * @template {keyof KV & string} KEY - * - * @param {KEY} attributeName The attribute name that identifies the - * queried value. - * @return {KV[KEY]|undefined} The queried attribute value. - * - * @public - */ - public getAttribute(attributeName: KEY_1): KV[KEY_1] | undefined; - /** - * Returns whether an attribute exists - * - * @param {string} attributeName The attribute name to check for existence. - * @return {boolean} whether the attribute exists. - * - * @public - */ - public hasAttribute(attributeName: string): boolean; - /** - * Returns all attribute name/value pairs in a JSON Object. - * - * @param {Snapshot} [snapshot] - * @return {{ [Key in Extract]?: KV[Key]}} A JSON Object that describes the attributes. - * - * @public - */ - public getAttributes(snapshot?: Snapshot | undefined): { [Key in Extract]?: KV[Key] | undefined; }; -} -export function readYXmlElement(decoder: UpdateDecoderV1 | UpdateDecoderV2): YXmlElement; -export type ValueTypes = Object | number | null | Array | string | Uint8Array | AbstractType; -import { YXmlFragment } from "./YXmlFragment.js"; -import { YXmlText } from "./YXmlText.js"; -import { Snapshot } from "../utils/Snapshot.js"; -import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js"; -import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js"; -import { AbstractType } from "./AbstractType.js"; -//# sourceMappingURL=YXmlElement.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/types/YXmlElement.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/types/YXmlElement.d.ts.map deleted file mode 100644 index bced3fa..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/types/YXmlElement.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"YXmlElement.d.ts","sourceRoot":"","sources":["../../../src/types/YXmlElement.js"],"names":[],"mappings":"AAgBA;;GAEG;AAEH;;;;;;;;GAQG;AACH;;;;;IACE,+BAOC;IALC,iBAAwB;IACxB;;OAEG;IACH,cAFU,IAAI,MAAM,EAAE,GAAG,CAAC,GAAC,IAAI,CAEF;IAG/B;;OAEG;IACH;;yBAGC;IAED;;OAEG;IACH;;yBAGC;IAoBD;;;;OAIG;IACH,SAFY,WAAW,CAItB;IAED;;;;;;OAMG;IACH,SAFY,YAAY,EAAE,CAAC,CAc1B;IA6BD;;;;;;OAMG;IACH,sCAJW,MAAM,QAYhB;IAED;;;;;;;;;OASG;IACH,sGAQC;IAED;;;;;;;;;;OAUG;IACH,kGAEC;IAED;;;;;;;OAOG;IACH,mCALW,MAAM,GACL,OAAO,CAMlB;IAED;;;;;;;OAOG;IACH,qHAEC;CA+CF;AAQM,yCALI,eAAe,GAAG,eAAe,GAChC,WAAW,CAIqD;yBAlP/D,MAAM,GAAC,MAAM,GAAC,IAAI,GAAC,MAAM,GAAG,CAAC,GAAC,MAAM,GAAC,UAAU,GAAC,aAAa,GAAG,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/types/YXmlEvent.d.ts b/yjs-poll/node_modules/yjs/dist/src/types/YXmlEvent.d.ts deleted file mode 100644 index 85e49b4..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/types/YXmlEvent.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @extends YEvent - * An Event that describes changes on a YXml Element or Yxml Fragment - */ -export class YXmlEvent extends YEvent | YXmlFragment | YXmlText> { - /** - * @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created. - * @param {Set} subs The set of changed attributes. `null` is included if the - * child list changed. - * @param {Transaction} transaction The transaction instance with which the - * change was created. - */ - constructor(target: YXmlElement | YXmlText | YXmlFragment, subs: Set, transaction: Transaction); - /** - * Whether the children changed. - * @type {Boolean} - * @private - */ - private childListChanged; - /** - * Set of all changed attributes. - * @type {Set} - */ - attributesChanged: Set; -} -import { YXmlElement } from "./YXmlElement.js"; -import { YXmlFragment } from "./YXmlFragment.js"; -import { YXmlText } from "./YXmlText.js"; -import { YEvent } from "../utils/YEvent.js"; -import { Transaction } from "../utils/Transaction.js"; -//# sourceMappingURL=YXmlEvent.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/types/YXmlEvent.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/types/YXmlEvent.d.ts.map deleted file mode 100644 index 98e6c70..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/types/YXmlEvent.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"YXmlEvent.d.ts","sourceRoot":"","sources":["../../../src/types/YXmlEvent.js"],"names":[],"mappings":"AAKA;;;GAGG;AACH;;;IACE;;;;;;OAMG;IACH,oBANW,WAAW,GAAC,QAAQ,GAAC,YAAY,QACjC,IAAI,MAAM,GAAC,IAAI,CAAC,eAEhB,WAAW,EAuBrB;IAlBC;;;;OAIG;IACH,yBAA6B;IAC7B;;;OAGG;IACH,mBAFU,IAAI,MAAM,CAAC,CAEa;CASrC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/types/YXmlFragment.d.ts b/yjs-poll/node_modules/yjs/dist/src/types/YXmlFragment.d.ts deleted file mode 100644 index 41354dc..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/types/YXmlFragment.d.ts +++ /dev/null @@ -1,253 +0,0 @@ -/** - * Define the elements to which a set of CSS queries apply. - * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors|CSS_Selectors} - * - * @example - * query = '.classSelector' - * query = 'nodeSelector' - * query = '#idSelector' - * - * @typedef {string} CSS_Selector - */ -/** - * Dom filter function. - * - * @callback domFilter - * @param {string} nodeName The nodeName of the element - * @param {Map} attributes The map of attributes. - * @return {boolean} Whether to include the Dom node in the YXmlElement. - */ -/** - * Represents a subset of the nodes of a YXmlElement / YXmlFragment and a - * position within them. - * - * Can be created with {@link YXmlFragment#createTreeWalker} - * - * @public - * @implements {Iterable} - */ -export class YXmlTreeWalker implements Iterable { - /** - * @param {YXmlFragment | YXmlElement} root - * @param {function(AbstractType):boolean} [f] - */ - constructor(root: YXmlFragment | YXmlElement, f?: ((arg0: AbstractType) => boolean) | undefined); - _filter: (arg0: AbstractType) => boolean; - _root: YXmlElement<{ - [key: string]: string; - }> | YXmlFragment; - /** - * @type {Item} - */ - _currentNode: Item; - _firstCall: boolean; - /** - * Get the next node. - * - * @return {IteratorResult} The next node. - * - * @public - */ - public next(): IteratorResult; - [Symbol.iterator](): YXmlTreeWalker; -} -/** - * Represents a list of {@link YXmlElement}.and {@link YXmlText} types. - * A YxmlFragment is similar to a {@link YXmlElement}, but it does not have a - * nodeName and it does not have attributes. Though it can be bound to a DOM - * element - in this case the attributes and the nodeName are not shared. - * - * @public - * @extends AbstractType - */ -export class YXmlFragment extends AbstractType { - constructor(); - /** - * @type {Array|null} - */ - _prelimContent: Array | null; - /** - * @type {YXmlElement|YXmlText|null} - */ - get firstChild(): YXmlElement<{ - [key: string]: string; - }> | YXmlText | null; - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item} item - */ - _integrate(y: Doc, item: Item): void; - _copy(): YXmlFragment; - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YXmlFragment} - */ - clone(): YXmlFragment; - get length(): number; - /** - * Create a subtree of childNodes. - * - * @example - * const walker = elem.createTreeWalker(dom => dom.nodeName === 'div') - * for (let node in walker) { - * // `node` is a div node - * nop(node) - * } - * - * @param {function(AbstractType):boolean} filter Function that is called on each child element and - * returns a Boolean indicating whether the child - * is to be included in the subtree. - * @return {YXmlTreeWalker} A subtree and a position within it. - * - * @public - */ - public createTreeWalker(filter: (arg0: AbstractType) => boolean): YXmlTreeWalker; - /** - * Returns the first YXmlElement that matches the query. - * Similar to DOM's {@link querySelector}. - * - * Query support: - * - tagname - * TODO: - * - id - * - attribute - * - * @param {CSS_Selector} query The query on the children. - * @return {YXmlElement|YXmlText|YXmlHook|null} The first element that matches the query or null. - * - * @public - */ - public querySelector(query: CSS_Selector): YXmlElement | YXmlText | YXmlHook | null; - /** - * Returns all YXmlElements that match the query. - * Similar to Dom's {@link querySelectorAll}. - * - * @todo Does not yet support all queries. Currently only query by tagName. - * - * @param {CSS_Selector} query The query on the children - * @return {Array} The elements that match this query. - * - * @public - */ - public querySelectorAll(query: CSS_Selector): Array; - /** - * @return {string} - */ - toJSON(): string; - /** - * Creates a Dom Element that mirrors this YXmlElement. - * - * @param {Document} [_document=document] The document object (you must define - * this when calling this method in - * nodejs) - * @param {Object} [hooks={}] Optional property to customize how hooks - * are presented in the DOM - * @param {any} [binding] You should not set this property. This is - * used if DomBinding wants to create a - * association to the created DOM type. - * @return {Node} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element} - * - * @public - */ - public toDOM(_document?: Document | undefined, hooks?: { - [x: string]: any; - } | undefined, binding?: any): Node; - /** - * Inserts new content at an index. - * - * @example - * // Insert character 'a' at position 0 - * xml.insert(0, [new Y.XmlText('text')]) - * - * @param {number} index The index to insert content at - * @param {Array} content The array of content - */ - insert(index: number, content: Array): void; - /** - * Inserts new content at an index. - * - * @example - * // Insert character 'a' at position 0 - * xml.insert(0, [new Y.XmlText('text')]) - * - * @param {null|Item|YXmlElement|YXmlText} ref The index to insert content at - * @param {Array} content The array of content - */ - insertAfter(ref: null | Item | YXmlElement | YXmlText, content: Array): void; - /** - * Deletes elements starting from an index. - * - * @param {number} index Index at which to start deleting elements - * @param {number} [length=1] The number of elements to remove. Defaults to 1. - */ - delete(index: number, length?: number | undefined): void; - /** - * Transforms this YArray to a JavaScript Array. - * - * @return {Array} - */ - toArray(): Array; - /** - * Appends content to this YArray. - * - * @param {Array} content Array of content to append. - */ - push(content: Array): void; - /** - * Prepends content to this YArray. - * - * @param {Array} content Array of content to prepend. - */ - unshift(content: Array): void; - /** - * Returns the i-th element from a YArray. - * - * @param {number} index The index of the element to return from the YArray - * @return {YXmlElement|YXmlText} - */ - get(index: number): YXmlElement | YXmlText; - /** - * Returns a portion of this YXmlFragment into a JavaScript Array selected - * from start to end (end not included). - * - * @param {number} [start] - * @param {number} [end] - * @return {Array} - */ - slice(start?: number | undefined, end?: number | undefined): Array; - /** - * Executes a provided function on once on every child element. - * - * @param {function(YXmlElement|YXmlText,number, typeof self):void} f A function to execute on every element of this YArray. - */ - forEach(f: (arg0: YXmlElement | YXmlText, arg1: number, arg2: typeof self) => void): void; -} -export function readYXmlFragment(_decoder: UpdateDecoderV1 | UpdateDecoderV2): YXmlFragment; -/** - * Define the elements to which a set of CSS queries apply. - * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors|CSS_Selectors} - */ -export type CSS_Selector = string; -/** - * Dom filter function. - */ -export type domFilter = (nodeName: string, attributes: Map) => boolean; -import { YXmlElement } from "./YXmlElement.js"; -import { YXmlText } from "./YXmlText.js"; -import { YXmlHook } from "./YXmlHook.js"; -import { AbstractType } from "./AbstractType.js"; -import { Item } from "../structs/Item.js"; -import { YXmlEvent } from "./YXmlEvent.js"; -import { Doc } from "../utils/Doc.js"; -import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js"; -import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js"; -//# sourceMappingURL=YXmlFragment.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/types/YXmlFragment.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/types/YXmlFragment.d.ts.map deleted file mode 100644 index 972f56a..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/types/YXmlFragment.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"YXmlFragment.d.ts","sourceRoot":"","sources":["../../../src/types/YXmlFragment.js"],"names":[],"mappings":"AA0BA;;;;;;;;;;GAUG;AAEH;;;;;;;GAOG;AAEH;;;;;;;;GAQG;AACH,gDAFyB,WAAW,GAAC,QAAQ,GAAC,WAAW,GAAC,QAAQ;IAGhE;;;OAGG;IACH,kBAHW,YAAY,GAAG,WAAW,cACjB,aAAa,GAAG,CAAC,KAAE,OAAO,eAW7C;IARC,gBAHkB,aAAa,GAAG,CAAC,KAAE,OAAO,CAG5B;IAChB;;sBAAiB;IACjB;;OAEG;IACH,cAFU,IAAI,CAEuC;IACrD,oBAAsB;IAQxB;;;;;;OAMG;IACH,eAJY,eAAe,WAAW,GAAC,QAAQ,GAAC,QAAQ,CAAC,CA0CxD;IAjDD,oCAEC;CAgDF;AAED;;;;;;;;GAQG;AACH;IACE,cAMC;IAJC;;OAEG;IACH,gBAFU,MAAM,GAAG,CAAC,GAAC,IAAI,CAED;IAG1B;;OAEG;IACH;;yBAGC;IAED;;;;;;;;;OASG;IACH,cAHW,GAAG,QACH,IAAI,QAMd;IAED,sBAEC;IAED;;;;;;OAMG;IACH,SAFY,YAAY,CAOvB;IAED,qBAGC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,uCAPoB,aAAa,GAAG,CAAC,KAAE,OAAO,GAGlC,cAAc,CAMzB;IAED;;;;;;;;;;;;;;OAcG;IACH,4BALW,YAAY,GACX,WAAW,GAAC,QAAQ,GAAC,QAAQ,GAAC,IAAI,CAc7C;IAED;;;;;;;;;;OAUG;IACH,+BALW,YAAY,GACX,MAAM,WAAW,GAAC,QAAQ,GAAC,QAAQ,GAAC,IAAI,CAAC,CAQpD;IAqBD;;OAEG;IACH,UAFY,MAAM,CAIjB;IAED;;;;;;;;;;;;;;OAcG;IACH;;6BAPW,GAAG,GAGF,IAAI,CAaf;IAED;;;;;;;;;OASG;IACH,cAHW,MAAM,WACN,MAAM,WAAW,GAAC,QAAQ,CAAC,QAWrC;IAED;;;;;;;;;OASG;IACH,iBAHW,IAAI,GAAC,IAAI,GAAC,WAAW,GAAC,QAAQ,WAC9B,MAAM,WAAW,GAAC,QAAQ,CAAC,QAgBrC;IAED;;;;;OAKG;IACH,cAHW,MAAM,qCAYhB;IAED;;;;OAIG;IACH,WAFY,MAAM,WAAW,GAAC,QAAQ,GAAC,QAAQ,CAAC,CAI/C;IAED;;;;OAIG;IACH,cAFW,MAAM,WAAW,GAAC,QAAQ,CAAC,QAIrC;IAED;;;;OAIG;IACH,iBAFW,MAAM,WAAW,GAAC,QAAQ,CAAC,QAIrC;IAED;;;;;OAKG;IACH,WAHW,MAAM,GACL,WAAW,GAAC,QAAQ,CAI/B;IAED;;;;;;;OAOG;IACH,6DAFY,MAAM,WAAW,GAAC,QAAQ,CAAC,CAItC;IAED;;;;OAIG;IACH,kBAFoB,WAAW,GAAC,QAAQ,QAAC,MAAM,QAAE,WAAW,KAAE,IAAI,QAIjE;CAaF;AASM,2CANI,eAAe,GAAG,eAAe,GAChC,YAAY,CAKsC;;;;;2BA7ZjD,MAAM;;;;mCAOR,MAAM,gCAEL,OAAO"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/types/YXmlHook.d.ts b/yjs-poll/node_modules/yjs/dist/src/types/YXmlHook.d.ts deleted file mode 100644 index d169b94..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/types/YXmlHook.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * You can manage binding to a custom type with YXmlHook. - * - * @extends {YMap} - */ -export class YXmlHook extends YMap { - /** - * @param {string} hookName nodeName of the Dom Node. - */ - constructor(hookName: string); - /** - * @type {string} - */ - hookName: string; - /** - * Creates an Item with the same effect as this Item (without position effect) - */ - _copy(): YXmlHook; - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YXmlHook} - */ - clone(): YXmlHook; - /** - * Creates a Dom Element that mirrors this YXmlElement. - * - * @param {Document} [_document=document] The document object (you must define - * this when calling this method in - * nodejs) - * @param {Object.} [hooks] Optional property to customize how hooks - * are presented in the DOM - * @param {any} [binding] You should not set this property. This is - * used if DomBinding wants to create a - * association to the created DOM type - * @return {Element} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element} - * - * @public - */ - public toDOM(_document?: Document | undefined, hooks?: { - [x: string]: any; - } | undefined, binding?: any): Element; -} -export function readYXmlHook(decoder: UpdateDecoderV1 | UpdateDecoderV2): YXmlHook; -import { YMap } from "./YMap.js"; -import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js"; -import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js"; -//# sourceMappingURL=YXmlHook.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/types/YXmlHook.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/types/YXmlHook.d.ts.map deleted file mode 100644 index eb09298..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/types/YXmlHook.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"YXmlHook.d.ts","sourceRoot":"","sources":["../../../src/types/YXmlHook.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH;IACE;;OAEG;IACH,sBAFW,MAAM,EAQhB;IAJC;;OAEG;IACH,UAFU,MAAM,CAEQ;IAG1B;;OAEG;IACH,kBAEC;IAED;;;;;;OAMG;IACH,SAFY,QAAQ,CAQnB;IAED;;;;;;;;;;;;;;OAcG;IACH;;6BAPW,GAAG,GAGF,OAAO,CAiBlB;CAcF;AASM,sCANI,eAAe,GAAG,eAAe,GAChC,QAAQ,CAMa"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/types/YXmlText.d.ts b/yjs-poll/node_modules/yjs/dist/src/types/YXmlText.d.ts deleted file mode 100644 index 5bf6755..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/types/YXmlText.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Represents text in a Dom Element. In the future this type will also handle - * simple formatting information like bold and italic. - */ -export class YXmlText extends YText { - /** - * @type {YXmlElement|YXmlText|null} - */ - get nextSibling(): YXmlElement<{ - [key: string]: string; - }> | YXmlText | null; - /** - * @type {YXmlElement|YXmlText|null} - */ - get prevSibling(): YXmlElement<{ - [key: string]: string; - }> | YXmlText | null; - _copy(): YXmlText; - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YXmlText} - */ - clone(): YXmlText; - /** - * Creates a Dom Element that mirrors this YXmlText. - * - * @param {Document} [_document=document] The document object (you must define - * this when calling this method in - * nodejs) - * @param {Object} [hooks] Optional property to customize how hooks - * are presented in the DOM - * @param {any} [binding] You should not set this property. This is - * used if DomBinding wants to create a - * association to the created DOM type. - * @return {Text} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element} - * - * @public - */ - public toDOM(_document?: Document | undefined, hooks?: { - [x: string]: any; - } | undefined, binding?: any): Text; - toString(): any; -} -export function readYXmlText(decoder: UpdateDecoderV1 | UpdateDecoderV2): YXmlText; -import { YText } from "./YText.js"; -import { YXmlElement } from "./YXmlElement.js"; -import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js"; -import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js"; -//# sourceMappingURL=YXmlText.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/types/YXmlText.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/types/YXmlText.d.ts.map deleted file mode 100644 index 2b1e08b..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/types/YXmlText.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"YXmlText.d.ts","sourceRoot":"","sources":["../../../src/types/YXmlText.js"],"names":[],"mappings":"AAMA;;;GAGG;AACH;IACE;;OAEG;IACH;;yBAGC;IAED;;OAEG;IACH;;yBAGC;IAED,kBAEC;IAED;;;;;;OAMG;IACH,SAFY,QAAQ,CAMnB;IAED;;;;;;;;;;;;;;OAcG;IACH;;6BAPW,GAAG,GAGF,IAAI,CAUf;IAED,gBAgCC;CAeF;AASM,sCANI,eAAe,GAAG,eAAe,GAChC,QAAQ,CAKiC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/AbstractConnector.d.ts b/yjs-poll/node_modules/yjs/dist/src/utils/AbstractConnector.d.ts deleted file mode 100644 index c05877c..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/AbstractConnector.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This is an abstract interface that all Connectors should implement to keep them interchangeable. - * - * @note This interface is experimental and it is not advised to actually inherit this class. - * It just serves as typing information. - * - * @extends {ObservableV2} - */ -export class AbstractConnector extends ObservableV2 { - /** - * @param {Doc} ydoc - * @param {any} awareness - */ - constructor(ydoc: Doc, awareness: any); - doc: Doc; - awareness: any; -} -import { ObservableV2 } from "lib0/observable"; -import { Doc } from "./Doc.js"; -//# sourceMappingURL=AbstractConnector.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/AbstractConnector.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/utils/AbstractConnector.d.ts.map deleted file mode 100644 index 634ba44..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/AbstractConnector.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"AbstractConnector.d.ts","sourceRoot":"","sources":["../../../src/utils/AbstractConnector.js"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH;IACE;;;OAGG;IACH,kBAHW,GAAG,aACH,GAAG,EAMb;IAFC,SAAe;IACf,eAA0B;CAE7B"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/DeleteSet.d.ts b/yjs-poll/node_modules/yjs/dist/src/utils/DeleteSet.d.ts deleted file mode 100644 index cdb2011..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/DeleteSet.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -export class DeleteItem { - /** - * @param {number} clock - * @param {number} len - */ - constructor(clock: number, len: number); - /** - * @type {number} - */ - clock: number; - /** - * @type {number} - */ - len: number; -} -/** - * We no longer maintain a DeleteStore. DeleteSet is a temporary object that is created when needed. - * - When created in a transaction, it must only be accessed after sorting, and merging - * - This DeleteSet is send to other clients - * - We do not create a DeleteSet when we send a sync message. The DeleteSet message is created directly from StructStore - * - We read a DeleteSet as part of a sync/update message. In this case the DeleteSet is already sorted and merged. - */ -export class DeleteSet { - /** - * @type {Map>} - */ - clients: Map>; -} -export function iterateDeletedStructs(transaction: Transaction, ds: DeleteSet, f: (arg0: GC | Item) => void): void; -export function findIndexDS(dis: Array, clock: number): number | null; -export function isDeleted(ds: DeleteSet, id: ID): boolean; -export function sortAndMergeDeleteSet(ds: DeleteSet): void; -export function mergeDeleteSets(dss: Array): DeleteSet; -export function addToDeleteSet(ds: DeleteSet, client: number, clock: number, length: number): void; -export function createDeleteSet(): DeleteSet; -export function createDeleteSetFromStructStore(ss: StructStore): DeleteSet; -export function writeDeleteSet(encoder: DSEncoderV1 | DSEncoderV2, ds: DeleteSet): void; -export function readDeleteSet(decoder: DSDecoderV1 | DSDecoderV2): DeleteSet; -export function readAndApplyDeleteSet(decoder: DSDecoderV1 | DSDecoderV2, transaction: Transaction, store: StructStore): Uint8Array | null; -export function equalDeleteSets(ds1: DeleteSet, ds2: DeleteSet): boolean; -import { Transaction } from "./Transaction.js"; -import { GC } from "../structs/GC.js"; -import { Item } from "../structs/Item.js"; -import { ID } from "./ID.js"; -import { StructStore } from "./StructStore.js"; -import { DSEncoderV1 } from "./UpdateEncoder.js"; -import { DSEncoderV2 } from "./UpdateEncoder.js"; -import { DSDecoderV1 } from "./UpdateDecoder.js"; -import { DSDecoderV2 } from "./UpdateDecoder.js"; -//# sourceMappingURL=DeleteSet.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/DeleteSet.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/utils/DeleteSet.d.ts.map deleted file mode 100644 index 336f5d6..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/DeleteSet.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"DeleteSet.d.ts","sourceRoot":"","sources":["../../../src/utils/DeleteSet.js"],"names":[],"mappings":"AAeA;IACE;;;OAGG;IACH,mBAHW,MAAM,OACN,MAAM,EAWhB;IARC;;OAEG;IACH,OAFU,MAAM,CAEE;IAClB;;OAEG;IACH,KAFU,MAAM,CAEF;CAEjB;AAED;;;;;;GAMG;AACH;IAEI;;OAEG;IACH,SAFU,IAAI,MAAM,EAAC,MAAM,UAAU,CAAC,CAAC,CAEf;CAE3B;AAWM,mDANI,WAAW,MACX,SAAS,YACA,EAAE,GAAC,IAAI,KAAE,IAAI,QAc7B;AAUG,iCAPI,MAAM,UAAU,CAAC,SACjB,MAAM,GACL,MAAM,GAAC,IAAI,CAsBtB;AAUM,8BAPI,SAAS,MACT,EAAE,GACD,OAAO,CAQlB;AAQM,0CALI,SAAS,QA2BnB;AAMM,qCAHI,MAAM,SAAS,CAAC,GACf,SAAS,CAsBpB;AAWM,mCARI,SAAS,UACT,MAAM,SACN,MAAM,UACN,MAAM,QAOhB;AAEM,6CAA6C;AAS7C,mDANI,WAAW,GACV,SAAS,CA8BpB;AASM,wCANI,WAAW,GAAG,WAAW,MACzB,SAAS,QAsBnB;AASM,uCANI,WAAW,GAAG,WAAW,GACxB,SAAS,CAoBpB;AAeM,+CARI,WAAW,GAAG,WAAW,eACzB,WAAW,SACX,WAAW,GACV,UAAU,GAAC,IAAI,CA2D1B;AAMM,qCAHI,SAAS,OACT,SAAS,WAgBnB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/Doc.d.ts b/yjs-poll/node_modules/yjs/dist/src/utils/Doc.d.ts deleted file mode 100644 index d63573a..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/Doc.d.ts +++ /dev/null @@ -1,250 +0,0 @@ -export const generateNewClientId: typeof random.uint32; -/** - * @typedef {Object} DocOpts - * @property {boolean} [DocOpts.gc=true] Disable garbage collection (default: gc=true) - * @property {function(Item):boolean} [DocOpts.gcFilter] Will be called before an Item is garbage collected. Return false to keep the Item. - * @property {string} [DocOpts.guid] Define a globally unique identifier for this document - * @property {string | null} [DocOpts.collectionid] Associate this document with a collection. This only plays a role if your provider has a concept of collection. - * @property {any} [DocOpts.meta] Any kind of meta information you want to associate with this document. If this is a subdocument, remote peers will store the meta information as well. - * @property {boolean} [DocOpts.autoLoad] If a subdocument, automatically load document. If this is a subdocument, remote peers will load the document as well automatically. - * @property {boolean} [DocOpts.shouldLoad] Whether the document should be synced by the provider now. This is toggled to true when you call ydoc.load() - */ -/** - * @typedef {Object} DocEvents - * @property {function(Doc):void} DocEvents.destroy - * @property {function(Doc):void} DocEvents.load - * @property {function(boolean, Doc):void} DocEvents.sync - * @property {function(Uint8Array, any, Doc, Transaction):void} DocEvents.update - * @property {function(Uint8Array, any, Doc, Transaction):void} DocEvents.updateV2 - * @property {function(Doc):void} DocEvents.beforeAllTransactions - * @property {function(Transaction, Doc):void} DocEvents.beforeTransaction - * @property {function(Transaction, Doc):void} DocEvents.beforeObserverCalls - * @property {function(Transaction, Doc):void} DocEvents.afterTransaction - * @property {function(Transaction, Doc):void} DocEvents.afterTransactionCleanup - * @property {function(Doc, Array):void} DocEvents.afterAllTransactions - * @property {function({ loaded: Set, added: Set, removed: Set }, Doc, Transaction):void} DocEvents.subdocs - */ -/** - * A Yjs instance handles the state of shared data. - * @extends ObservableV2 - */ -export class Doc extends ObservableV2 { - /** - * @param {DocOpts} opts configuration - */ - constructor({ guid, collectionid, gc, gcFilter, meta, autoLoad, shouldLoad }?: DocOpts); - gc: boolean; - gcFilter: (arg0: Item) => boolean; - clientID: number; - guid: string; - collectionid: string | null; - /** - * @type {Map>>} - */ - share: Map>>; - store: StructStore; - /** - * @type {Transaction | null} - */ - _transaction: Transaction | null; - /** - * @type {Array} - */ - _transactionCleanups: Array; - /** - * @type {Set} - */ - subdocs: Set; - /** - * If this document is a subdocument - a document integrated into another document - then _item is defined. - * @type {Item?} - */ - _item: Item | null; - shouldLoad: boolean; - autoLoad: boolean; - meta: any; - /** - * This is set to true when the persistence provider loaded the document from the database or when the `sync` event fires. - * Note that not all providers implement this feature. Provider authors are encouraged to fire the `load` event when the doc content is loaded from the database. - * - * @type {boolean} - */ - isLoaded: boolean; - /** - * This is set to true when the connection provider has successfully synced with a backend. - * Note that when using peer-to-peer providers this event may not provide very useful. - * Also note that not all providers implement this feature. Provider authors are encouraged to fire - * the `sync` event when the doc has been synced (with `true` as a parameter) or if connection is - * lost (with false as a parameter). - */ - isSynced: boolean; - isDestroyed: boolean; - /** - * Promise that resolves once the document has been loaded from a persistence provider. - */ - whenLoaded: Promise; - whenSynced: Promise; - /** - * Notify the parent document that you request to load data into this subdocument (if it is a subdocument). - * - * `load()` might be used in the future to request any provider to load the most current data. - * - * It is safe to call `load()` multiple times. - */ - load(): void; - getSubdocs(): Set; - getSubdocGuids(): Set; - /** - * Changes that happen inside of a transaction are bundled. This means that - * the observer fires _after_ the transaction is finished and that all changes - * that happened inside of the transaction are sent as one message to the - * other peers. - * - * @template T - * @param {function(Transaction):T} f The function that should be executed as a transaction - * @param {any} [origin] Origin of who started the transaction. Will be stored on transaction.origin - * @return T - * - * @public - */ - public transact(f: (arg0: Transaction) => T, origin?: any): T; - /** - * Define a shared data type. - * - * Multiple calls of `ydoc.get(name, TypeConstructor)` yield the same result - * and do not overwrite each other. I.e. - * `ydoc.get(name, Y.Array) === ydoc.get(name, Y.Array)` - * - * After this method is called, the type is also available on `ydoc.share.get(name)`. - * - * *Best Practices:* - * Define all types right after the Y.Doc instance is created and store them in a separate object. - * Also use the typed methods `getText(name)`, `getArray(name)`, .. - * - * @template {typeof AbstractType} Type - * @example - * const ydoc = new Y.Doc(..) - * const appState = { - * document: ydoc.getText('document') - * comments: ydoc.getArray('comments') - * } - * - * @param {string} name - * @param {Type} TypeConstructor The constructor of the type definition. E.g. Y.Text, Y.Array, Y.Map, ... - * @return {InstanceType} The created type. Constructed with TypeConstructor - * - * @public - */ - public get; - }>(name: string, TypeConstructor?: Type): InstanceType; - /** - * @template T - * @param {string} [name] - * @return {YArray} - * - * @public - */ - public getArray(name?: string | undefined): YArray; - /** - * @param {string} [name] - * @return {YText} - * - * @public - */ - public getText(name?: string | undefined): YText; - /** - * @template T - * @param {string} [name] - * @return {YMap} - * - * @public - */ - public getMap(name?: string | undefined): YMap; - /** - * @param {string} [name] - * @return {YXmlElement} - * - * @public - */ - public getXmlElement(name?: string | undefined): YXmlElement; - /** - * @param {string} [name] - * @return {YXmlFragment} - * - * @public - */ - public getXmlFragment(name?: string | undefined): YXmlFragment; - /** - * Converts the entire document into a js object, recursively traversing each yjs type - * Doesn't log types that have not been defined (using ydoc.getType(..)). - * - * @deprecated Do not use this method and rather call toJSON directly on the shared types. - * - * @return {Object} - */ - toJSON(): { - [x: string]: any; - }; -} -export type DocOpts = { - /** - * Disable garbage collection (default: gc=true) - */ - gc?: boolean | undefined; - /** - * Will be called before an Item is garbage collected. Return false to keep the Item. - */ - gcFilter?: ((arg0: Item) => boolean) | undefined; - /** - * Define a globally unique identifier for this document - */ - guid?: string | undefined; - /** - * Associate this document with a collection. This only plays a role if your provider has a concept of collection. - */ - collectionid?: string | null | undefined; - /** - * Any kind of meta information you want to associate with this document. If this is a subdocument, remote peers will store the meta information as well. - */ - meta?: any; - /** - * If a subdocument, automatically load document. If this is a subdocument, remote peers will load the document as well automatically. - */ - autoLoad?: boolean | undefined; - /** - * Whether the document should be synced by the provider now. This is toggled to true when you call ydoc.load() - */ - shouldLoad?: boolean | undefined; -}; -export type DocEvents = { - destroy: (arg0: Doc) => void; - load: (arg0: Doc) => void; - sync: (arg0: boolean, arg1: Doc) => void; - update: (arg0: Uint8Array, arg1: any, arg2: Doc, arg3: Transaction) => void; - updateV2: (arg0: Uint8Array, arg1: any, arg2: Doc, arg3: Transaction) => void; - beforeAllTransactions: (arg0: Doc) => void; - beforeTransaction: (arg0: Transaction, arg1: Doc) => void; - beforeObserverCalls: (arg0: Transaction, arg1: Doc) => void; - afterTransaction: (arg0: Transaction, arg1: Doc) => void; - afterTransactionCleanup: (arg0: Transaction, arg1: Doc) => void; - afterAllTransactions: (arg0: Doc, arg1: Array) => void; - subdocs: (arg0: { - loaded: Set; - added: Set; - removed: Set; - }, arg1: Doc, arg2: Transaction) => void; -}; -import * as random from "lib0/random"; -import { ObservableV2 } from "lib0/observable"; -import { Item } from "../structs/Item.js"; -import { AbstractType } from "../types/AbstractType.js"; -import { YEvent } from "./YEvent.js"; -import { StructStore } from "./StructStore.js"; -import { Transaction } from "./Transaction.js"; -import { YArray } from "../types/YArray.js"; -import { YText } from "../types/YText.js"; -import { YMap } from "../types/YMap.js"; -import { YXmlElement } from "../types/YXmlElement.js"; -import { YXmlFragment } from "../types/YXmlFragment.js"; -//# sourceMappingURL=Doc.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/Doc.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/utils/Doc.d.ts.map deleted file mode 100644 index b1d1140..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/Doc.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Doc.d.ts","sourceRoot":"","sources":["../../../src/utils/Doc.js"],"names":[],"mappings":"AAsBA,uDAAgD;AAEhD;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;;GAcG;AAEH;;;GAGG;AACH;IACE;;OAEG;IACH,+EAFW,OAAO,EAsFjB;IAlFC,YAAY;IACZ,iBAnCmB,IAAI,KAAE,OAAO,CAmCR;IACxB,iBAAqC;IACrC,a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G,KAAE,IAAI;gCACtB,WAAW,QAAE,GAAG,KAAE,IAAI;6BACtB,WAAW,QAAE,GAAG,KAAE,IAAI;oCACtB,WAAW,QAAE,GAAG,KAAE,IAAI;iCACtB,GAAG,QAAE,MAAM,WAAW,CAAC,KAAE,IAAI;oBAC7B;QAAE,MAAM,EAAE,IAAI,GAAG,CAAC,CAAC;QAAC,KAAK,EAAE,IAAI,GAAG,CAAC,CAAC;QAAC,OAAO,EAAE,IAAI,GAAG,CAAC,CAAA;KAAE,QAAE,GAAG,QAAE,WAAW,KAAE,IAAI"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/EventHandler.d.ts b/yjs-poll/node_modules/yjs/dist/src/utils/EventHandler.d.ts deleted file mode 100644 index fc143e7..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/EventHandler.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * General event handler implementation. - * - * @template ARG0, ARG1 - * - * @private - */ -export class EventHandler { - /** - * @type {Array} - */ - l: ((arg0: ARG0, arg1: ARG1) => void)[]; -} -export function createEventHandler(): EventHandler; -export function addEventHandlerListener(eventHandler: EventHandler, f: (arg0: ARG0, arg1: ARG1) => void): number; -export function removeEventHandlerListener(eventHandler: EventHandler, f: (arg0: ARG0, arg1: ARG1) => void): void; -export function removeAllEventHandlerListeners(eventHandler: EventHandler): void; -export function callEventHandlerListeners(eventHandler: EventHandler, arg0: ARG0, arg1: ARG1): void; -//# sourceMappingURL=EventHandler.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/EventHandler.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/utils/EventHandler.d.ts.map deleted file mode 100644 index 5ab363d..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/EventHandler.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"EventHandler.d.ts","sourceRoot":"","sources":["../../../src/utils/EventHandler.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH;IAEI;;OAEG;IACH,WAFyB,IAAI,QAAE,IAAI,KAAE,IAAI,IAE9B;CAEd;AASM,2EAAmD;AAanD,2HALwB,IAAI,UAMX;AAajB,8HANwB,IAAI,QAalC;AAUM,yGAEN;AAcM,4HACkC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/ID.d.ts b/yjs-poll/node_modules/yjs/dist/src/utils/ID.d.ts deleted file mode 100644 index 586a971..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/ID.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -export class ID { - /** - * @param {number} client client id - * @param {number} clock unique per client id, continuous number - */ - constructor(client: number, clock: number); - /** - * Client id - * @type {number} - */ - client: number; - /** - * unique per client id, continuous number - * @type {number} - */ - clock: number; -} -export function compareIDs(a: ID | null, b: ID | null): boolean; -export function createID(client: number, clock: number): ID; -export function writeID(encoder: encoding.Encoder, id: ID): void; -export function readID(decoder: decoding.Decoder): ID; -export function findRootTypeKey(type: AbstractType): string; -import * as encoding from "lib0/encoding"; -import * as decoding from "lib0/decoding"; -import { AbstractType } from "../types/AbstractType.js"; -//# sourceMappingURL=ID.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/ID.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/utils/ID.d.ts.map deleted file mode 100644 index 63c9d28..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/ID.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ID.d.ts","sourceRoot":"","sources":["../../../src/utils/ID.js"],"names":[],"mappings":"AAMA;IACE;;;OAGG;IACH,oBAHW,MAAM,SACN,MAAM,EAahB;IAVC;;;OAGG;IACH,QAFU,MAAM,CAEI;IACpB;;;OAGG;IACH,OAFU,MAAM,CAEE;CAErB;AASM,8BANI,EAAE,GAAG,IAAI,KACT,EAAE,GAAG,IAAI,GACR,OAAO,CAIsG;AASlH,iCANI,MAAM,SACN,MAAM,MAK+C;AASzD,iCANI,SAAS,OAAO,MAChB,EAAE,QAQZ;AAaM,gCANI,SAAS,OAAO,GACf,EAAE,CAM0D;AAajE,sCANI,aAAa,GAAG,CAAC,GAChB,MAAM,CAajB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/PermanentUserData.d.ts b/yjs-poll/node_modules/yjs/dist/src/utils/PermanentUserData.d.ts deleted file mode 100644 index c6cb50a..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/PermanentUserData.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -export class PermanentUserData { - /** - * @param {Doc} doc - * @param {YMap} [storeType] - */ - constructor(doc: Doc, storeType?: YMap | undefined); - yusers: YMap; - doc: Doc; - /** - * Maps from clientid to userDescription - * - * @type {Map} - */ - clients: Map; - dss: Map; - /** - * @param {Doc} doc - * @param {number} clientid - * @param {string} userDescription - * @param {Object} conf - * @param {function(Transaction, DeleteSet):boolean} [conf.filter] - */ - setUserMapping(doc: Doc, clientid: number, userDescription: string, { filter }?: { - filter?: ((arg0: Transaction, arg1: DeleteSet) => boolean) | undefined; - }): void; - /** - * @param {number} clientid - * @return {any} - */ - getUserByClientId(clientid: number): any; - /** - * @param {ID} id - * @return {string | null} - */ - getUserByDeletedId(id: ID): string | null; -} -import { YMap } from "../types/YMap.js"; -import { Doc } from "./Doc.js"; -import { DeleteSet } from "./DeleteSet.js"; -import { Transaction } from "./Transaction.js"; -import { ID } from "./ID.js"; -//# sourceMappingURL=PermanentUserData.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/PermanentUserData.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/utils/PermanentUserData.d.ts.map deleted file mode 100644 index 11606d7..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/PermanentUserData.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"PermanentUserData.d.ts","sourceRoot":"","sources":["../../../src/utils/PermanentUserData.js"],"names":[],"mappings":"AAaA;IACE;;;OAGG;IACH,iBAHW,GAAG,qCAmDb;IA3CC,kBAAuB;IACvB,SAAc;IACd;;;;OAIG;IACH,SAFU,IAAI,MAAM,EAAC,MAAM,CAAC,CAEJ;IACxB,4BAAc;IAqChB;;;;;;OAMG;IACH,oBANW,GAAG,YACH,MAAM,mBACN,MAAM;QAE0C,MAAM,WAA7C,WAAW,QAAE,SAAS,KAAE,OAAO;aA6ClD;IAED;;;OAGG;IACH,4BAHW,MAAM,GACL,GAAG,CAId;IAED;;;OAGG;IACH,uBAHW,EAAE,GACD,MAAM,GAAG,IAAI,CASxB;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/RelativePosition.d.ts b/yjs-poll/node_modules/yjs/dist/src/utils/RelativePosition.d.ts deleted file mode 100644 index 5727922..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/RelativePosition.d.ts +++ /dev/null @@ -1,91 +0,0 @@ -/** - * A relative position is based on the Yjs model and is not affected by document changes. - * E.g. If you place a relative position before a certain character, it will always point to this character. - * If you place a relative position at the end of a type, it will always point to the end of the type. - * - * A numeric position is often unsuited for user selections, because it does not change when content is inserted - * before or after. - * - * ```Insert(0, 'x')('a|bc') = 'xa|bc'``` Where | is the relative position. - * - * One of the properties must be defined. - * - * @example - * // Current cursor position is at position 10 - * const relativePosition = createRelativePositionFromIndex(yText, 10) - * // modify yText - * yText.insert(0, 'abc') - * yText.delete(3, 10) - * // Compute the cursor position - * const absolutePosition = createAbsolutePositionFromRelativePosition(y, relativePosition) - * absolutePosition.type === yText // => true - * console.log('cursor location is ' + absolutePosition.index) // => cursor location is 3 - * - */ -export class RelativePosition { - /** - * @param {ID|null} type - * @param {string|null} tname - * @param {ID|null} item - * @param {number} assoc - */ - constructor(type: ID | null, tname: string | null, item: ID | null, assoc?: number); - /** - * @type {ID|null} - */ - type: ID | null; - /** - * @type {string|null} - */ - tname: string | null; - /** - * @type {ID | null} - */ - item: ID | null; - /** - * A relative position is associated to a specific character. By default - * assoc >= 0, the relative position is associated to the character - * after the meant position. - * I.e. position 1 in 'ab' is associated to character 'b'. - * - * If assoc < 0, then the relative position is associated to the character - * before the meant position. - * - * @type {number} - */ - assoc: number; -} -export function relativePositionToJSON(rpos: RelativePosition): any; -export function createRelativePositionFromJSON(json: any): RelativePosition; -export class AbsolutePosition { - /** - * @param {AbstractType} type - * @param {number} index - * @param {number} [assoc] - */ - constructor(type: AbstractType, index: number, assoc?: number | undefined); - /** - * @type {AbstractType} - */ - type: AbstractType; - /** - * @type {number} - */ - index: number; - assoc: number; -} -export function createAbsolutePosition(type: AbstractType, index: number, assoc?: number | undefined): AbsolutePosition; -export function createRelativePosition(type: AbstractType, item: ID | null, assoc?: number | undefined): RelativePosition; -export function createRelativePositionFromTypeIndex(type: AbstractType, index: number, assoc?: number | undefined): RelativePosition; -export function writeRelativePosition(encoder: encoding.Encoder, rpos: RelativePosition): encoding.Encoder; -export function encodeRelativePosition(rpos: RelativePosition): Uint8Array; -export function readRelativePosition(decoder: decoding.Decoder): RelativePosition; -export function decodeRelativePosition(uint8Array: Uint8Array): RelativePosition; -export function createAbsolutePositionFromRelativePosition(rpos: RelativePosition, doc: Doc, followUndoneDeletions?: boolean): AbsolutePosition | null; -export function compareRelativePositions(a: RelativePosition | null, b: RelativePosition | null): boolean; -import { ID } from "./ID.js"; -import { AbstractType } from "../types/AbstractType.js"; -import * as encoding from "lib0/encoding"; -import * as decoding from "lib0/decoding"; -import { Doc } from "./Doc.js"; -//# sourceMappingURL=RelativePosition.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/RelativePosition.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/utils/RelativePosition.d.ts.map deleted file mode 100644 index 024fbe5..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/RelativePosition.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"RelativePosition.d.ts","sourceRoot":"","sources":["../../../src/utils/RelativePosition.js"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IACE;;;;;OAKG;IACH,kBALW,EAAE,GAAC,IAAI,SACP,MAAM,GAAC,IAAI,QACX,EAAE,GAAC,IAAI,UACP,MAAM,EA2BhB;IAxBC;;OAEG;IACH,MAFU,EAAE,GAAC,IAAI,CAED;IAChB;;OAEG;IACH,OAFU,MAAM,GAAC,IAAI,CAEH;IAClB;;OAEG;IACH,MAFU,EAAE,GAAG,IAAI,CAEH;IAChB;;;;;;;;;;OAUG;IACH,OAFU,MAAM,CAEE;CAErB;AAMM,6CAHI,gBAAgB,GACf,GAAG,CAiBd;AAQM,qDALI,GAAG,GACF,gBAAgB,CAIuP;AAEnR;IACE;;;;OAIG;IACH,kBAJW,aAAa,GAAG,CAAC,SACjB,MAAM,8BAahB;IATC;;OAEG;IACH,MAFU,aAAa,GAAG,CAAC,CAEX;IAChB;;OAEG;IACH,OAFU,MAAM,CAEE;IAClB,cAAkB;CAErB;AASM,6CANI,aAAa,GAAG,CAAC,SACjB,MAAM,gDAKyF;AASnG,6CANI,aAAa,GAAG,CAAC,QACjB,EAAE,GAAC,IAAI,gDAcjB;AAYM,0DAPI,aAAa,GAAG,CAAC,SACjB,MAAM,+BAEL,gBAAgB,CA4B3B;AAQM,+CALI,SAAS,OAAO,QAChB,gBAAgB,oBAsB1B;AAMM,6CAHI,gBAAgB,GACf,UAAU,CAMrB;AAQM,8CALI,SAAS,OAAO,GACf,gBAAgB,CAwB3B;AAMM,mDAHI,UAAU,GACT,gBAAgB,CAEgF;AAgCrG,iEAPI,gBAAgB,OAChB,GAAG,0BACH,OAAO,GACN,gBAAgB,GAAC,IAAI,CAyDhC;AASM,4CANI,gBAAgB,GAAC,IAAI,KACrB,gBAAgB,GAAC,IAAI,GACpB,OAAO,CAMlB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/Snapshot.d.ts b/yjs-poll/node_modules/yjs/dist/src/utils/Snapshot.d.ts deleted file mode 100644 index a20de50..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/Snapshot.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -export class Snapshot { - /** - * @param {DeleteSet} ds - * @param {Map} sv state map - */ - constructor(ds: DeleteSet, sv: Map); - /** - * @type {DeleteSet} - */ - ds: DeleteSet; - /** - * State Map - * @type {Map} - */ - sv: Map; -} -export function equalSnapshots(snap1: Snapshot, snap2: Snapshot): boolean; -export function encodeSnapshotV2(snapshot: Snapshot, encoder?: DSEncoderV1 | DSEncoderV2 | undefined): Uint8Array; -export function encodeSnapshot(snapshot: Snapshot): Uint8Array; -export function decodeSnapshotV2(buf: Uint8Array, decoder?: DSDecoderV1 | DSDecoderV2 | undefined): Snapshot; -export function decodeSnapshot(buf: Uint8Array): Snapshot; -export function createSnapshot(ds: DeleteSet, sm: Map): Snapshot; -export const emptySnapshot: Snapshot; -export function snapshot(doc: Doc): Snapshot; -export function isVisible(item: Item, snapshot: Snapshot | undefined): boolean; -export function splitSnapshotAffectedStructs(transaction: Transaction, snapshot: Snapshot): void; -export function createDocFromSnapshot(originDoc: Doc, snapshot: Snapshot, newDoc?: Doc | undefined): Doc; -export function snapshotContainsUpdateV2(snapshot: Snapshot, update: Uint8Array, YDecoder?: typeof UpdateDecoderV1 | typeof UpdateDecoderV2 | undefined): boolean; -export function snapshotContainsUpdate(snapshot: Snapshot, update: Uint8Array): boolean; -import { DeleteSet } from "./DeleteSet.js"; -import { DSEncoderV1 } from "./UpdateEncoder.js"; -import { DSEncoderV2 } from "./UpdateEncoder.js"; -import { DSDecoderV1 } from "./UpdateDecoder.js"; -import { DSDecoderV2 } from "./UpdateDecoder.js"; -import { Doc } from "./Doc.js"; -import { Item } from "../structs/Item.js"; -import { Transaction } from "./Transaction.js"; -import { UpdateDecoderV1 } from "./UpdateDecoder.js"; -import { UpdateDecoderV2 } from "./UpdateDecoder.js"; -//# sourceMappingURL=Snapshot.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/Snapshot.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/utils/Snapshot.d.ts.map deleted file mode 100644 index 411f295..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/Snapshot.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Snapshot.d.ts","sourceRoot":"","sources":["../../../src/utils/Snapshot.js"],"names":[],"mappings":"AA2BA;IACE;;;OAGG;IACH,gBAHW,SAAS,MACT,IAAI,MAAM,EAAC,MAAM,CAAC,EAY5B;IATC;;OAEG;IACH,IAFU,SAAS,CAEP;IACZ;;;OAGG;IACH,IAFU,IAAI,MAAM,EAAC,MAAM,CAAC,CAEhB;CAEf;AAOM,sCAJI,QAAQ,SACR,QAAQ,GACP,OAAO,CA6BlB;AAOM,2CAJI,QAAQ,oDAEP,UAAU,CAMrB;AAMM,yCAHI,QAAQ,GACP,UAAU,CAEiE;AAOhF,sCAJI,UAAU,oDAET,QAAQ,CAInB;AAMM,oCAHI,UAAU,GACT,QAAQ,CAEoF;AAOjG,mCAJI,SAAS,MACT,IAAI,MAAM,EAAC,MAAM,CAAC,GACjB,QAAQ,CAE0C;AAE9D,qCAAyE;AAMlE,8BAHI,GAAG,GACF,QAAQ,CAE+F;AAS5G,gCANI,IAAI,YACJ,QAAQ,GAAC,SAAS,WAOoG;AAM1H,0DAHI,WAAW,YACX,QAAQ,QAelB;AAgBM,iDALI,GAAG,YACH,QAAQ,6BAEP,GAAG,CA0Cd;AAOM,mDAJI,QAAQ,UACR,UAAU,mFAepB;AAMM,iDAHI,QAAQ,UACR,UAAU,WAEkG"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/StructStore.d.ts b/yjs-poll/node_modules/yjs/dist/src/utils/StructStore.d.ts deleted file mode 100644 index 174cf9a..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/StructStore.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -export class StructStore { - /** - * @type {Map>} - */ - clients: Map>; - /** - * @type {null | { missing: Map, update: Uint8Array }} - */ - pendingStructs: { - missing: Map; - update: Uint8Array; - } | null; - /** - * @type {null | Uint8Array} - */ - pendingDs: null | Uint8Array; -} -export function getStateVector(store: StructStore): Map; -export function getState(store: StructStore, client: number): number; -export function integrityCheck(store: StructStore): void; -export function addStruct(store: StructStore, struct: GC | Item): void; -export function findIndexSS(structs: Array, clock: number): number; -export function find(store: StructStore, id: ID): GC | Item; -export function getItem(arg0: StructStore, arg1: ID): Item; -export function findIndexCleanStart(transaction: Transaction, structs: Array, clock: number): number; -export function getItemCleanStart(transaction: Transaction, id: ID): Item; -export function getItemCleanEnd(transaction: Transaction, store: StructStore, id: ID): Item; -export function replaceStruct(store: StructStore, struct: GC | Item, newStruct: GC | Item): void; -export function iterateStructs(transaction: Transaction, structs: Array, clockStart: number, len: number, f: (arg0: GC | Item) => void): void; -import { GC } from "../structs/GC.js"; -import { Item } from "../structs/Item.js"; -import { ID } from "./ID.js"; -import { Transaction } from "./Transaction.js"; -//# sourceMappingURL=StructStore.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/StructStore.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/utils/StructStore.d.ts.map deleted file mode 100644 index d334dc8..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/StructStore.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"StructStore.d.ts","sourceRoot":"","sources":["../../../src/utils/StructStore.js"],"names":[],"mappings":"AASA;IAEI;;OAEG;IACH,SAFU,IAAI,MAAM,EAAC,MAAM,EAAE,GAAC,IAAI,CAAC,CAAC,CAEZ;IACxB;;OAEG;IACH;iBAF4B,IAAI,MAAM,EAAE,MAAM,CAAC;gBAAU,UAAU;aAEzC;IAC1B;;OAEG;IACH,WAFU,IAAI,GAAG,UAAU,CAEN;CAExB;AAYM,sCANI,WAAW,GACV,IAAI,MAAM,EAAC,MAAM,CAAC,CAY7B;AAUM,gCAPI,WAAW,UACX,MAAM,GACL,MAAM,CAYjB;AAQM,sCALI,WAAW,QAerB;AASM,iCANI,WAAW,UACX,EAAE,GAAC,IAAI,QAiBjB;AAWM,qCAPI,MAAM,IAAI,GAAC,EAAE,CAAC,SACd,MAAM,GACL,MAAM,CAiCjB;AAYM,4BAPI,WAAW,MACX,EAAE,GACD,EAAE,GAAC,IAAI,CAYlB;AAOiC,8BAAS,WAAW,QAAC,EAAE,GAAE,IAAI,CAAA;AAOxD,iDAJI,WAAW,WACX,MAAM,IAAI,GAAC,EAAE,CAAC,SACd,MAAM,UAUhB;AAYM,+CAPI,WAAW,MACX,EAAE,GACD,IAAI,CAQf;AAaM,6CARI,WAAW,SACX,WAAW,MACX,EAAE,GACD,IAAI,CAiBf;AAWM,qCAPI,WAAW,UACX,EAAE,GAAC,IAAI,aACP,EAAE,GAAC,IAAI,QAQjB;AAaM,4CARI,WAAW,WACX,MAAM,IAAI,GAAC,EAAE,CAAC,cACd,MAAM,OACN,MAAM,YACG,EAAE,GAAC,IAAI,KAAE,IAAI,QAkBhC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/Transaction.d.ts b/yjs-poll/node_modules/yjs/dist/src/utils/Transaction.d.ts deleted file mode 100644 index 0e3fa78..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/Transaction.d.ts +++ /dev/null @@ -1,115 +0,0 @@ -/** - * A transaction is created for every change on the Yjs model. It is possible - * to bundle changes on the Yjs model in a single transaction to - * minimize the number on messages sent and the number of observer calls. - * If possible the user of this library should bundle as many changes as - * possible. Here is an example to illustrate the advantages of bundling: - * - * @example - * const ydoc = new Y.Doc() - * const map = ydoc.getMap('map') - * // Log content when change is triggered - * map.observe(() => { - * console.log('change triggered') - * }) - * // Each change on the map type triggers a log message: - * map.set('a', 0) // => "change triggered" - * map.set('b', 0) // => "change triggered" - * // When put in a transaction, it will trigger the log after the transaction: - * ydoc.transact(() => { - * map.set('a', 1) - * map.set('b', 1) - * }) // => "change triggered" - * - * @public - */ -export class Transaction { - /** - * @param {Doc} doc - * @param {any} origin - * @param {boolean} local - */ - constructor(doc: Doc, origin: any, local: boolean); - /** - * The Yjs instance. - * @type {Doc} - */ - doc: Doc; - /** - * Describes the set of deleted items by ids - * @type {DeleteSet} - */ - deleteSet: DeleteSet; - /** - * Holds the state before the transaction started. - * @type {Map} - */ - beforeState: Map; - /** - * Holds the state after the transaction. - * @type {Map} - */ - afterState: Map; - /** - * All types that were directly modified (property added or child - * inserted/deleted). New types are not included in this Set. - * Maps from type to parentSubs (`item.parentSub = null` for YArray) - * @type {Map>,Set>} - */ - changed: Map>, Set>; - /** - * Stores the events for the types that observe also child elements. - * It is mainly used by `observeDeep`. - * @type {Map>,Array>>} - */ - changedParentTypes: Map>, Array>>; - /** - * @type {Array} - */ - _mergeStructs: Array; - /** - * @type {any} - */ - origin: any; - /** - * Stores meta information on the transaction - * @type {Map} - */ - meta: Map; - /** - * Whether this change originates from this doc. - * @type {boolean} - */ - local: boolean; - /** - * @type {Set} - */ - subdocsAdded: Set; - /** - * @type {Set} - */ - subdocsRemoved: Set; - /** - * @type {Set} - */ - subdocsLoaded: Set; - /** - * @type {boolean} - */ - _needFormattingCleanup: boolean; -} -export function writeUpdateMessageFromTransaction(encoder: UpdateEncoderV1 | UpdateEncoderV2, transaction: Transaction): boolean; -export function nextID(transaction: Transaction): import("./ID.js").ID; -export function addChangedTypeToTransaction(transaction: Transaction, type: AbstractType>, parentSub: string | null): void; -export function tryGc(ds: DeleteSet, store: StructStore, gcFilter: (arg0: Item) => boolean): void; -export function transact(doc: Doc, f: (arg0: Transaction) => T, origin?: any, local?: boolean): T; -import { Doc } from "./Doc.js"; -import { DeleteSet } from "./DeleteSet.js"; -import { AbstractType } from "../types/AbstractType.js"; -import { YEvent } from "./YEvent.js"; -import { AbstractStruct } from "../structs/AbstractStruct.js"; -import { UpdateEncoderV1 } from "./UpdateEncoder.js"; -import { UpdateEncoderV2 } from "./UpdateEncoder.js"; -import { StructStore } from "./StructStore.js"; -import { Item } from "../structs/Item.js"; -//# sourceMappingURL=Transaction.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/Transaction.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/utils/Transaction.d.ts.map deleted file mode 100644 index 846fed9..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/Transaction.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Transaction.d.ts","sourceRoot":"","sources":["../../../src/utils/Transaction.js"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH;IACE;;;;OAIG;IACH,iBAJW,GAAG,UACH,GAAG,SACH,OAAO,EAsEjB;IAnEC;;;OAGG;IACH,KAFU,GAAG,CAEC;IACd;;;OAGG;IACH,WAFU,SAAS,CAEa;IAChC;;;OAGG;IACH,aAFU,mBAAkB,CAEgB;IAC5C;;;OAGG;IACH,YAFU,mBAAkB,CAED;IAC3B;;;;;OAKG;IACH,SAFU,IAAI,aAAa,OAAO,GAAG,CAAC,CAAC,EAAC,IAAI,SAAO,IAAI,CAAC,CAAC,CAEjC;IACxB;;;;OAIG;IACH,oBAFU,IAAI,aAAa,OAAO,GAAG,CAAC,CAAC,EAAC,MAAM,OAAO,GAAG,CAAC,CAAC,CAAC,CAExB;IACnC;;OAEG;IACH,eAFU,MAAM,cAAc,CAAC,CAER;IACvB;;OAEG;IACH,QAFU,GAAG,CAEO;IACpB;;;OAGG;IACH,MAFU,IAAI,GAAG,EAAC,GAAG,CAAC,CAED;IACrB;;;OAGG;IACH,OAFU,OAAO,CAEC;IAClB;;OAEG;IACH,cAFU,IAAI,GAAG,CAAC,CAEW;IAC7B;;OAEG;IACH,gBAFU,IAAI,GAAG,CAAC,CAEa;IAC/B;;OAEG;IACH,eAFU,IAAI,GAAG,CAAC,CAEY;IAC9B;;OAEG;IACH,wBAFU,OAAO,CAEkB;CAEtC;AAOM,2DAJI,eAAe,GAAG,eAAe,eACjC,WAAW,GACV,OAAO,CAUlB;AAQM,oCALI,WAAW,wBAQrB;AAUM,yDAJI,WAAW,QACX,aAAa,OAAO,GAAG,CAAC,CAAC,aACzB,MAAM,GAAC,IAAI,QAOrB;AAuFM,0BAJI,SAAS,SACT,WAAW,mBACF,IAAI,KAAE,OAAO,QAKhC;AA8JM,iCAPI,GAAG,YACM,WAAW,iBACpB,GAAG,sBAyCb"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/UndoManager.d.ts b/yjs-poll/node_modules/yjs/dist/src/utils/UndoManager.d.ts deleted file mode 100644 index 97fd01c..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/UndoManager.d.ts +++ /dev/null @@ -1,189 +0,0 @@ -export class StackItem { - /** - * @param {DeleteSet} deletions - * @param {DeleteSet} insertions - */ - constructor(deletions: DeleteSet, insertions: DeleteSet); - insertions: DeleteSet; - deletions: DeleteSet; - /** - * Use this to save and restore metadata like selection range - */ - meta: Map; -} -/** - * @typedef {Object} UndoManagerOptions - * @property {number} [UndoManagerOptions.captureTimeout=500] - * @property {function(Transaction):boolean} [UndoManagerOptions.captureTransaction] Do not capture changes of a Transaction if result false. - * @property {function(Item):boolean} [UndoManagerOptions.deleteFilter=()=>true] Sometimes - * it is necessary to filter what an Undo/Redo operation can delete. If this - * filter returns false, the type/item won't be deleted even it is in the - * undo/redo scope. - * @property {Set} [UndoManagerOptions.trackedOrigins=new Set([null])] - * @property {boolean} [ignoreRemoteMapChanges] Experimental. By default, the UndoManager will never overwrite remote changes. Enable this property to enable overwriting remote changes on key-value changes (Y.Map, properties on Y.Xml, etc..). - * @property {Doc} [doc] The document that this UndoManager operates on. Only needed if typeScope is empty. - */ -/** - * @typedef {Object} StackItemEvent - * @property {StackItem} StackItemEvent.stackItem - * @property {any} StackItemEvent.origin - * @property {'undo'|'redo'} StackItemEvent.type - * @property {Map>,Array>>} StackItemEvent.changedParentTypes - */ -/** - * Fires 'stack-item-added' event when a stack item was added to either the undo- or - * the redo-stack. You may store additional stack information via the - * metadata property on `event.stackItem.meta` (it is a `Map` of metadata properties). - * Fires 'stack-item-popped' event when a stack item was popped from either the - * undo- or the redo-stack. You may restore the saved stack information from `event.stackItem.meta`. - * - * @extends {ObservableV2<{'stack-item-added':function(StackItemEvent, UndoManager):void, 'stack-item-popped': function(StackItemEvent, UndoManager):void, 'stack-cleared': function({ undoStackCleared: boolean, redoStackCleared: boolean }):void, 'stack-item-updated': function(StackItemEvent, UndoManager):void }>} - */ -export class UndoManager extends ObservableV2<{ - 'stack-item-added': (arg0: StackItemEvent, arg1: UndoManager) => void; - 'stack-item-popped': (arg0: StackItemEvent, arg1: UndoManager) => void; - 'stack-cleared': (arg0: { - undoStackCleared: boolean; - redoStackCleared: boolean; - }) => void; - 'stack-item-updated': (arg0: StackItemEvent, arg1: UndoManager) => void; -}> { - /** - * @param {Doc|AbstractType|Array>} typeScope Limits the scope of the UndoManager. If this is set to a ydoc instance, all changes on that ydoc will be undone. If set to a specific type, only changes on that type or its children will be undone. Also accepts an array of types. - * @param {UndoManagerOptions} options - */ - constructor(typeScope: Doc | AbstractType | Array>, { captureTimeout, captureTransaction, deleteFilter, trackedOrigins, ignoreRemoteMapChanges, doc }?: UndoManagerOptions); - /** - * @type {Array | Doc>} - */ - scope: Array | Doc>; - doc: Doc; - deleteFilter: (arg0: Item) => boolean; - trackedOrigins: Set; - captureTransaction: (arg0: Transaction) => boolean; - /** - * @type {Array} - */ - undoStack: Array; - /** - * @type {Array} - */ - redoStack: Array; - /** - * Whether the client is currently undoing (calling UndoManager.undo) - * - * @type {boolean} - */ - undoing: boolean; - redoing: boolean; - /** - * The currently popped stack item if UndoManager.undoing or UndoManager.redoing - * - * @type {StackItem|null} - */ - currStackItem: StackItem | null; - lastChange: number; - ignoreRemoteMapChanges: boolean; - captureTimeout: number; - /** - * @param {Transaction} transaction - */ - afterTransactionHandler: (transaction: Transaction) => void; - /** - * Extend the scope. - * - * @param {Array | Doc> | AbstractType | Doc} ytypes - */ - addToScope(ytypes: Array | Doc> | AbstractType | Doc): void; - /** - * @param {any} origin - */ - addTrackedOrigin(origin: any): void; - /** - * @param {any} origin - */ - removeTrackedOrigin(origin: any): void; - clear(clearUndoStack?: boolean, clearRedoStack?: boolean): void; - /** - * UndoManager merges Undo-StackItem if they are created within time-gap - * smaller than `options.captureTimeout`. Call `um.stopCapturing()` so that the next - * StackItem won't be merged. - * - * - * @example - * // without stopCapturing - * ytext.insert(0, 'a') - * ytext.insert(1, 'b') - * um.undo() - * ytext.toString() // => '' (note that 'ab' was removed) - * // with stopCapturing - * ytext.insert(0, 'a') - * um.stopCapturing() - * ytext.insert(0, 'b') - * um.undo() - * ytext.toString() // => 'a' (note that only 'b' was removed) - * - */ - stopCapturing(): void; - /** - * Undo last changes on type. - * - * @return {StackItem?} Returns StackItem if a change was applied - */ - undo(): StackItem | null; - /** - * Redo last undo operation. - * - * @return {StackItem?} Returns StackItem if a change was applied - */ - redo(): StackItem | null; - /** - * Are undo steps available? - * - * @return {boolean} `true` if undo is possible - */ - canUndo(): boolean; - /** - * Are redo steps available? - * - * @return {boolean} `true` if redo is possible - */ - canRedo(): boolean; -} -export type UndoManagerOptions = { - captureTimeout?: number | undefined; - /** - * Do not capture changes of a Transaction if result false. - */ - captureTransaction?: ((arg0: Transaction) => boolean) | undefined; - /** - * Sometimes - * it is necessary to filter what an Undo/Redo operation can delete. If this - * filter returns false, the type/item won't be deleted even it is in the - * undo/redo scope. - */ - deleteFilter?: ((arg0: Item) => boolean) | undefined; - trackedOrigins?: Set | undefined; - /** - * Experimental. By default, the UndoManager will never overwrite remote changes. Enable this property to enable overwriting remote changes on key-value changes (Y.Map, properties on Y.Xml, etc..). - */ - ignoreRemoteMapChanges?: boolean | undefined; - /** - * The document that this UndoManager operates on. Only needed if typeScope is empty. - */ - doc?: Doc | undefined; -}; -export type StackItemEvent = { - stackItem: StackItem; - origin: any; - type: 'undo' | 'redo'; - changedParentTypes: Map>, Array>>; -}; -import { DeleteSet } from "./DeleteSet.js"; -import { ObservableV2 } from "lib0/observable"; -import { AbstractType } from "../types/AbstractType.js"; -import { Doc } from "./Doc.js"; -import { Item } from "../structs/Item.js"; -import { Transaction } from "./Transaction.js"; -import { YEvent } from "./YEvent.js"; -//# sourceMappingURL=UndoManager.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/UndoManager.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/utils/UndoManager.d.ts.map deleted file mode 100644 index 96b4637..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/UndoManager.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"UndoManager.d.ts","sourceRoot":"","sources":["../../../src/utils/UndoManager.js"],"names":[],"mappings":"AAoBA;IACE;;;OAGG;IACH,uBAHW,SAAS,cACT,SAAS,EASnB;IANC,sBAA4B;IAC5B,qBAA0B;IAC1B;;OAEG;IACH,oBAAqB;CAExB;AAgGD;;;;;;;;;;;GAWG;AAEH;;;;;;GAMG;AAEH;;;;;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,KAAE,OAAO;;;;;;;2BACpB,IAAI,KAAE,OAAO;;;;;;;;;;;;eAWtB,SAAS;YACT,GAAG;UACH,MAAM,GAAC,MAAM;wBACb,IAAI,aAAa,OAAO,GAAG,CAAC,CAAC,EAAC,MAAM,OAAO,GAAG,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/UpdateDecoder.d.ts b/yjs-poll/node_modules/yjs/dist/src/utils/UpdateDecoder.d.ts deleted file mode 100644 index 17a9c67..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/UpdateDecoder.d.ts +++ /dev/null @@ -1,167 +0,0 @@ -export class DSDecoderV1 { - /** - * @param {decoding.Decoder} decoder - */ - constructor(decoder: decoding.Decoder); - restDecoder: decoding.Decoder; - resetDsCurVal(): void; - /** - * @return {number} - */ - readDsClock(): number; - /** - * @return {number} - */ - readDsLen(): number; -} -export class UpdateDecoderV1 extends DSDecoderV1 { - /** - * @return {ID} - */ - readLeftID(): ID; - /** - * @return {ID} - */ - readRightID(): ID; - /** - * Read the next client id. - * Use this in favor of readID whenever possible to reduce the number of objects created. - */ - readClient(): number; - /** - * @return {number} info An unsigned 8-bit integer - */ - readInfo(): number; - /** - * @return {string} - */ - readString(): string; - /** - * @return {boolean} isKey - */ - readParentInfo(): boolean; - /** - * @return {number} info An unsigned 8-bit integer - */ - readTypeRef(): number; - /** - * Write len of a struct - well suited for Opt RLE encoder. - * - * @return {number} len - */ - readLen(): number; - /** - * @return {any} - */ - readAny(): any; - /** - * @return {Uint8Array} - */ - readBuf(): Uint8Array; - /** - * Legacy implementation uses JSON parse. We use any-decoding in v2. - * - * @return {any} - */ - readJSON(): any; - /** - * @return {string} - */ - readKey(): string; -} -export class DSDecoderV2 { - /** - * @param {decoding.Decoder} decoder - */ - constructor(decoder: decoding.Decoder); - /** - * @private - */ - private dsCurrVal; - restDecoder: decoding.Decoder; - resetDsCurVal(): void; - /** - * @return {number} - */ - readDsClock(): number; - /** - * @return {number} - */ - readDsLen(): number; -} -export class UpdateDecoderV2 extends DSDecoderV2 { - /** - * List of cached keys. If the keys[id] does not exist, we read a new key - * from stringEncoder and push it to keys. - * - * @type {Array} - */ - keys: Array; - keyClockDecoder: decoding.IntDiffOptRleDecoder; - clientDecoder: decoding.UintOptRleDecoder; - leftClockDecoder: decoding.IntDiffOptRleDecoder; - rightClockDecoder: decoding.IntDiffOptRleDecoder; - infoDecoder: decoding.RleDecoder; - stringDecoder: decoding.StringDecoder; - parentInfoDecoder: decoding.RleDecoder; - typeRefDecoder: decoding.UintOptRleDecoder; - lenDecoder: decoding.UintOptRleDecoder; - /** - * @return {ID} - */ - readLeftID(): ID; - /** - * @return {ID} - */ - readRightID(): ID; - /** - * Read the next client id. - * Use this in favor of readID whenever possible to reduce the number of objects created. - */ - readClient(): number; - /** - * @return {number} info An unsigned 8-bit integer - */ - readInfo(): number; - /** - * @return {string} - */ - readString(): string; - /** - * @return {boolean} - */ - readParentInfo(): boolean; - /** - * @return {number} An unsigned 8-bit integer - */ - readTypeRef(): number; - /** - * Write len of a struct - well suited for Opt RLE encoder. - * - * @return {number} - */ - readLen(): number; - /** - * @return {any} - */ - readAny(): any; - /** - * @return {Uint8Array} - */ - readBuf(): Uint8Array; - /** - * This is mainly here for legacy purposes. - * - * Initial we incoded objects using JSON. Now we use the much faster lib0/any-encoder. This method mainly exists for legacy purposes for the v1 encoder. - * - * @return {any} - */ - readJSON(): any; - /** - * @return {string} - */ - readKey(): string; -} -import * as decoding from "lib0/decoding"; -import { ID } from "./ID.js"; -//# sourceMappingURL=UpdateDecoder.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/UpdateDecoder.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/utils/UpdateDecoder.d.ts.map deleted file mode 100644 index d6bbd91..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/UpdateDecoder.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"UpdateDecoder.d.ts","sourceRoot":"","sources":["../../../src/utils/UpdateDecoder.js"],"names":[],"mappings":"AAMA;IACE;;OAEG;IACH,qBAFW,SAAS,OAAO,EAI1B;IADC,8BAA0B;IAG5B,sBAEC;IAED;;OAEG;IACH,eAFY,MAAM,CAIjB;IAED;;OAEG;IACH,aAFY,MAAM,CAIjB;CACF;AAED;IACE;;OAEG;IACH,cAFY,EAAE,CAIb;IAED;;OAEG;IACH,eAFY,EAAE,CAIb;IAED;;;OAGG;IACH,qBAEC;IAED;;OAEG;IACH,YAFY,MAAM,CAIjB;IAED;;OAEG;IACH,cAFY,MAAM,CAIjB;IAED;;OAEG;IACH,kBAFY,OAAO,CAIlB;IAED;;OAEG;IACH,eAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,WAFY,MAAM,CAIjB;IAED;;OAEG;IACH,WAFY,GAAG,CAId;IAED;;OAEG;IACH,WAFY,UAAU,CAIrB;IAED;;;;OAIG;IACH,YAFY,GAAG,CAId;IAED;;OAEG;IACH,WAFY,MAAM,CAIjB;CACF;AAED;IACE;;OAEG;IACH,qBAFW,SAAS,OAAO,EAQ1B;IALC;;OAEG;IACH,kBAAkB;IAClB,8BAA0B;IAG5B,sBAEC;IAED;;OAEG;IACH,eAFY,MAAM,CAKjB;IAED;;OAEG;IACH,aAFY,MAAM,CAMjB;CACF;AAED;IAMI;;;;;OAKG;IACH,MAFU,MAAM,MAAM,CAAC,CAET;IAEd,+CAA6F;IAC7F,0CAAwF;IACxF,gDAA8F;IAC9F,iDAA+F;IAC/F,yCAAmG;IACnG,sCAAoF;IACpF,+CAAyG;IACzG,2CAAyF;IACzF,uCAAqF;IAGvF;;OAEG;IACH,cAFY,EAAE,CAIb;IAED;;OAEG;IACH,eAFY,EAAE,CAIb;IAED;;;OAGG;IACH,qBAEC;IAED;;OAEG;IACH,YAFY,MAAM,CAIjB;IAED;;OAEG;IACH,cAFY,MAAM,CAIjB;IAED;;OAEG;IACH,kBAFY,OAAO,CAIlB;IAED;;OAEG;IACH,eAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,WAFY,MAAM,CAIjB;IAED;;OAEG;IACH,WAFY,GAAG,CAId;IAED;;OAEG;IACH,WAFY,UAAU,CAIrB;IAED;;;;;;OAMG;IACH,YAFY,GAAG,CAId;IAED;;OAEG;IACH,WAFY,MAAM,CAWjB;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/UpdateEncoder.d.ts b/yjs-poll/node_modules/yjs/dist/src/utils/UpdateEncoder.d.ts deleted file mode 100644 index 2928b07..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/UpdateEncoder.d.ts +++ /dev/null @@ -1,164 +0,0 @@ -export class DSEncoderV1 { - restEncoder: encoding.Encoder; - toUint8Array(): Uint8Array; - resetDsCurVal(): void; - /** - * @param {number} clock - */ - writeDsClock(clock: number): void; - /** - * @param {number} len - */ - writeDsLen(len: number): void; -} -export class UpdateEncoderV1 extends DSEncoderV1 { - /** - * @param {ID} id - */ - writeLeftID(id: ID): void; - /** - * @param {ID} id - */ - writeRightID(id: ID): void; - /** - * Use writeClient and writeClock instead of writeID if possible. - * @param {number} client - */ - writeClient(client: number): void; - /** - * @param {number} info An unsigned 8-bit integer - */ - writeInfo(info: number): void; - /** - * @param {string} s - */ - writeString(s: string): void; - /** - * @param {boolean} isYKey - */ - writeParentInfo(isYKey: boolean): void; - /** - * @param {number} info An unsigned 8-bit integer - */ - writeTypeRef(info: number): void; - /** - * Write len of a struct - well suited for Opt RLE encoder. - * - * @param {number} len - */ - writeLen(len: number): void; - /** - * @param {any} any - */ - writeAny(any: any): void; - /** - * @param {Uint8Array} buf - */ - writeBuf(buf: Uint8Array): void; - /** - * @param {any} embed - */ - writeJSON(embed: any): void; - /** - * @param {string} key - */ - writeKey(key: string): void; -} -export class DSEncoderV2 { - restEncoder: encoding.Encoder; - dsCurrVal: number; - toUint8Array(): Uint8Array; - resetDsCurVal(): void; - /** - * @param {number} clock - */ - writeDsClock(clock: number): void; - /** - * @param {number} len - */ - writeDsLen(len: number): void; -} -export class UpdateEncoderV2 extends DSEncoderV2 { - /** - * @type {Map} - */ - keyMap: Map; - /** - * Refers to the next unique key-identifier to me used. - * See writeKey method for more information. - * - * @type {number} - */ - keyClock: number; - keyClockEncoder: encoding.IntDiffOptRleEncoder; - clientEncoder: encoding.UintOptRleEncoder; - leftClockEncoder: encoding.IntDiffOptRleEncoder; - rightClockEncoder: encoding.IntDiffOptRleEncoder; - infoEncoder: encoding.RleEncoder; - stringEncoder: encoding.StringEncoder; - parentInfoEncoder: encoding.RleEncoder; - typeRefEncoder: encoding.UintOptRleEncoder; - lenEncoder: encoding.UintOptRleEncoder; - /** - * @param {ID} id - */ - writeLeftID(id: ID): void; - /** - * @param {ID} id - */ - writeRightID(id: ID): void; - /** - * @param {number} client - */ - writeClient(client: number): void; - /** - * @param {number} info An unsigned 8-bit integer - */ - writeInfo(info: number): void; - /** - * @param {string} s - */ - writeString(s: string): void; - /** - * @param {boolean} isYKey - */ - writeParentInfo(isYKey: boolean): void; - /** - * @param {number} info An unsigned 8-bit integer - */ - writeTypeRef(info: number): void; - /** - * Write len of a struct - well suited for Opt RLE encoder. - * - * @param {number} len - */ - writeLen(len: number): void; - /** - * @param {any} any - */ - writeAny(any: any): void; - /** - * @param {Uint8Array} buf - */ - writeBuf(buf: Uint8Array): void; - /** - * This is mainly here for legacy purposes. - * - * Initial we incoded objects using JSON. Now we use the much faster lib0/any-encoder. This method mainly exists for legacy purposes for the v1 encoder. - * - * @param {any} embed - */ - writeJSON(embed: any): void; - /** - * Property keys are often reused. For example, in y-prosemirror the key `bold` might - * occur very often. For a 3d application, the key `position` might occur very often. - * - * We cache these keys in a Map and refer to them via a unique number. - * - * @param {string} key - */ - writeKey(key: string): void; -} -import * as encoding from "lib0/encoding"; -import { ID } from "./ID.js"; -//# sourceMappingURL=UpdateEncoder.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/UpdateEncoder.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/utils/UpdateEncoder.d.ts.map deleted file mode 100644 index b2f127f..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/UpdateEncoder.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"UpdateEncoder.d.ts","sourceRoot":"","sources":["../../../src/utils/UpdateEncoder.js"],"names":[],"mappings":"AAOA;IAEI,8BAA2C;IAG7C,2BAEC;IAED,sBAEC;IAED;;OAEG;IACH,oBAFW,MAAM,QAIhB;IAED;;OAEG;IACH,gBAFW,MAAM,QAIhB;CACF;AAED;IACE;;OAEG;IACH,gBAFW,EAAE,QAKZ;IAED;;OAEG;IACH,iBAFW,EAAE,QAKZ;IAED;;;OAGG;IACH,oBAFW,MAAM,QAIhB;IAED;;OAEG;IACH,gBAFW,MAAM,QAIhB;IAED;;OAEG;IACH,eAFW,MAAM,QAIhB;IAED;;OAEG;IACH,wBAFW,OAAO,QAIjB;IAED;;OAEG;IACH,mBAFW,MAAM,QAIhB;IAED;;;;OAIG;IACH,cAFW,MAAM,QAIhB;IAED;;OAEG;IACH,cAFW,GAAG,QAIb;IAED;;OAEG;IACH,cAFW,UAAU,QAIpB;IAED;;OAEG;IACH,iBAFW,GAAG,QAIb;IAED;;OAEG;IACH,cAFW,MAAM,QAIhB;CACF;AAED;IAEI,8BAA2C;IAC3C,kBAAkB;IAGpB,2BAEC;IAED,sBAEC;IAED;;OAEG;IACH,oBAFW,MAAM,QAMhB;IAED;;OAEG;IACH,gBAFW,MAAM,QAQhB;CACF;AAED;IAGI;;OAEG;IACH,QAFU,IAAI,MAAM,EAAC,MAAM,CAAC,CAEL;IACvB;;;;;OAKG;IACH,UAFU,MAAM,CAEC;IACjB,+CAA0D;IAC1D,0CAAqD;IACrD,gDAA2D;IAC3D,iDAA4D;IAC5D,yCAA+D;IAC/D,sCAAiD;IACjD,+CAAqE;IACrE,2CAAsD;IACtD,uCAAkD;IAoBpD;;OAEG;IACH,gBAFW,EAAE,QAKZ;IAED;;OAEG;IACH,iBAFW,EAAE,QAKZ;IAED;;OAEG;IACH,oBAFW,MAAM,QAIhB;IAED;;OAEG;IACH,gBAFW,MAAM,QAIhB;IAED;;OAEG;IACH,eAFW,MAAM,QAIhB;IAED;;OAEG;IACH,wBAFW,OAAO,QAIjB;IAED;;OAEG;IACH,mBAFW,MAAM,QAIhB;IAED;;;;OAIG;IACH,cAFW,MAAM,QAIhB;IAED;;OAEG;IACH,cAFW,GAAG,QAIb;IAED;;OAEG;IACH,cAFW,UAAU,QAIpB;IAED;;;;;;OAMG;IACH,iBAFW,GAAG,QAIb;IAED;;;;;;;OAOG;IACH,cAFW,MAAM,QAwBhB;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/YEvent.d.ts b/yjs-poll/node_modules/yjs/dist/src/utils/YEvent.d.ts deleted file mode 100644 index 1446d2d..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/YEvent.d.ts +++ /dev/null @@ -1,133 +0,0 @@ -/** - * @template {AbstractType} T - * YEvent describes the changes on a YType. - */ -export class YEvent> { - /** - * @param {T} target The changed type. - * @param {Transaction} transaction - */ - constructor(target: T, transaction: Transaction); - /** - * The type on which this event was created on. - * @type {T} - */ - target: T; - /** - * The current target on which the observe callback is called. - * @type {AbstractType} - */ - currentTarget: AbstractType; - /** - * The transaction that triggered this event. - * @type {Transaction} - */ - transaction: Transaction; - /** - * @type {Object|null} - */ - _changes: Object | null; - /** - * @type {null | Map} - */ - _keys: Map | null; - /** - * @type {null | Array<{ insert?: string | Array | object | AbstractType, retain?: number, delete?: number, attributes?: Object }>} - */ - _delta: { - insert?: string | object | any[] | AbstractType | undefined; - retain?: number | undefined; - delete?: number | undefined; - attributes?: { - [x: string]: any; - } | undefined; - }[] | null; - /** - * @type {Array|null} - */ - _path: Array | null; - /** - * Computes the path from `y` to the changed type. - * - * @todo v14 should standardize on path: Array<{parent, index}> because that is easier to work with. - * - * The following property holds: - * @example - * let type = y - * event.path.forEach(dir => { - * type = type.get(dir) - * }) - * type === event.target // => true - */ - get path(): (string | number)[]; - /** - * Check if a struct is deleted by this event. - * - * In contrast to change.deleted, this method also returns true if the struct was added and then deleted. - * - * @param {AbstractStruct} struct - * @return {boolean} - */ - deletes(struct: AbstractStruct): boolean; - /** - * @type {Map} - */ - get keys(): Map; - /** - * This is a computed property. Note that this can only be safely computed during the - * event call. Computing this property after other changes happened might result in - * unexpected behavior (incorrect computation of deltas). A safe way to collect changes - * is to store the `changes` or the `delta` object. Avoid storing the `transaction` object. - * - * @type {Array<{insert?: string | Array | object | AbstractType, retain?: number, delete?: number, attributes?: Object}>} - */ - get delta(): { - insert?: string | object | any[] | AbstractType | undefined; - retain?: number | undefined; - delete?: number | undefined; - attributes?: { - [x: string]: any; - } | undefined; - }[]; - /** - * Check if a struct is added by this event. - * - * In contrast to change.deleted, this method also returns true if the struct was added and then deleted. - * - * @param {AbstractStruct} struct - * @return {boolean} - */ - adds(struct: AbstractStruct): boolean; - /** - * This is a computed property. Note that this can only be safely computed during the - * event call. Computing this property after other changes happened might result in - * unexpected behavior (incorrect computation of deltas). A safe way to collect changes - * is to store the `changes` or the `delta` object. Avoid storing the `transaction` object. - * - * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string, delete?:number, retain?:number}>}} - */ - get changes(): { - added: Set; - deleted: Set; - keys: Map; - delta: Array<{ - insert?: Array | string; - delete?: number; - retain?: number; - }>; - }; -} -import { AbstractType } from "../types/AbstractType.js"; -import { Transaction } from "./Transaction.js"; -import { AbstractStruct } from "../structs/AbstractStruct.js"; -import { Item } from "../structs/Item.js"; -//# sourceMappingURL=YEvent.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/YEvent.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/utils/YEvent.d.ts.map deleted file mode 100644 index 75d90ed..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/YEvent.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"YEvent.d.ts","sourceRoot":"","sources":["../../../src/utils/YEvent.js"],"names":[],"mappings":"AAWA;;;GAGG;AACH;IACE;;;OAGG;IACH,oBAHW,CAAC,eACD,WAAW,EAkCrB;IA/BC;;;OAGG;IACH,QAFU,CAAC,CAES;IACpB;;;OAGG;IACH,eAFU,aAAa,GAAG,CAAC,CAEA;IAC3B;;;OAGG;IACH,aAFU,WAAW,CAES;IAC9B;;OAEG;IACH,UAFU,MAAM,GAAC,IAAI,CAED;IACpB;;OAEG;IACH;gBAFuC,KAAK,GAAG,QAAQ,GAAG,QAAQ;kBAAY,GAAG;cAEhE;IACjB;;OAEG;IACH;;;;;;;eAAkB;IAClB;;OAEG;IACH,OAFU,MAAM,MAAM,GAAC,MAAM,CAAC,GAAC,IAAI,CAElB;IAGnB;;;;;;;;;;;;OAYG;IACH,gCAEC;IAED;;;;;;;OAOG;IACH,gBAHW,cAAc,GACb,OAAO,CAIlB;IAED;;OAEG;IACH;gBAFgC,KAAK,GAAG,QAAQ,GAAG,QAAQ;kBAAY,GAAG;OAqDzE;IAED;;;;;;;OAOG;IACH;;;;;;;QAEC;IAED;;;;;;;OAOG;IACH,aAHW,cAAc,GACb,OAAO,CAIlB;IAED;;;;;;;OAOG;IACH;eAFiB,IAAI,IAAI,CAAC;iBAAS,IAAI,IAAI,CAAC;cAAM,IAAI,MAAM,EAAC;YAAC,MAAM,EAAC,KAAK,GAAC,QAAQ,GAAC,QAAQ,CAAC;YAAA,QAAQ,EAAC,GAAG,CAAA;SAAC,CAAC;eAAO,MAAM;YAAC,MAAM,CAAC,EAAC,MAAM,GAAG,CAAC,GAAC,MAAM,CAAC;YAAC,MAAM,CAAC,EAAC,MAAM,CAAC;YAAC,MAAM,CAAC,EAAC,MAAM,CAAA;SAAC,CAAC;MAkEnL;CACF"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/encoding.d.ts b/yjs-poll/node_modules/yjs/dist/src/utils/encoding.d.ts deleted file mode 100644 index 0e59e1e..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/encoding.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -export function writeClientsStructs(encoder: UpdateEncoderV1 | UpdateEncoderV2, store: StructStore, _sm: Map): void; -export function readClientsStructRefs(decoder: UpdateDecoderV1 | UpdateDecoderV2, doc: Doc): Map; -}>; -export function writeStructsFromTransaction(encoder: UpdateEncoderV1 | UpdateEncoderV2, transaction: Transaction): void; -export function readUpdateV2(decoder: decoding.Decoder, ydoc: Doc, transactionOrigin?: any, structDecoder?: UpdateDecoderV1 | UpdateDecoderV2 | undefined): void; -export function readUpdate(decoder: decoding.Decoder, ydoc: Doc, transactionOrigin?: any): void; -export function applyUpdateV2(ydoc: Doc, update: Uint8Array, transactionOrigin?: any, YDecoder?: typeof UpdateDecoderV1 | typeof UpdateDecoderV2 | undefined): void; -export function applyUpdate(ydoc: Doc, update: Uint8Array, transactionOrigin?: any): void; -export function writeStateAsUpdate(encoder: UpdateEncoderV1 | UpdateEncoderV2, doc: Doc, targetStateVector?: Map | undefined): void; -export function encodeStateAsUpdateV2(doc: Doc, encodedTargetStateVector?: Uint8Array | undefined, encoder?: UpdateEncoderV2 | UpdateEncoderV1 | undefined): Uint8Array; -export function encodeStateAsUpdate(doc: Doc, encodedTargetStateVector?: Uint8Array | undefined): Uint8Array; -export function readStateVector(decoder: DSDecoderV1 | DSDecoderV2): Map; -export function decodeStateVector(decodedState: Uint8Array): Map; -export function writeStateVector(encoder: DSEncoderV1 | DSEncoderV2, sv: Map): DSEncoderV1 | DSEncoderV2; -export function writeDocumentStateVector(encoder: DSEncoderV1 | DSEncoderV2, doc: Doc): DSEncoderV1 | DSEncoderV2; -export function encodeStateVectorV2(doc: Doc | Map, encoder?: DSEncoderV1 | DSEncoderV2 | undefined): Uint8Array; -export function encodeStateVector(doc: Doc | Map): Uint8Array; -import { UpdateEncoderV1 } from "./UpdateEncoder.js"; -import { UpdateEncoderV2 } from "./UpdateEncoder.js"; -import { StructStore } from "./StructStore.js"; -import { UpdateDecoderV1 } from "./UpdateDecoder.js"; -import { UpdateDecoderV2 } from "./UpdateDecoder.js"; -import { Doc } from "./Doc.js"; -import { Item } from "../structs/Item.js"; -import { GC } from "../structs/GC.js"; -import { Transaction } from "./Transaction.js"; -import * as decoding from "lib0/decoding"; -import { DSDecoderV1 } from "./UpdateDecoder.js"; -import { DSDecoderV2 } from "./UpdateDecoder.js"; -import { DSEncoderV1 } from "./UpdateEncoder.js"; -import { DSEncoderV2 } from "./UpdateEncoder.js"; -//# sourceMappingURL=encoding.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/encoding.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/utils/encoding.d.ts.map deleted file mode 100644 index 54631dd..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/encoding.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../../../src/utils/encoding.js"],"names":[],"mappings":"AAgFO,6CAPI,eAAe,GAAG,eAAe,SACjC,WAAW,OACX,IAAI,MAAM,EAAC,MAAM,CAAC,QA0B5B;AAUM,+CAPI,eAAe,GAAG,eAAe,OACjC,GAAG,GACF,IAAI,MAAM,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,IAAI,GAAG,EAAE,CAAC,CAAA;CAAE,CAAC,CA2F7D;AA0KM,qDANI,eAAe,GAAG,eAAe,eACjC,WAAW,QAK2H;AAc1I,sCAPI,SAAS,OAAO,QAChB,GAAG,sBACH,GAAG,uEAwEgB;AAavB,oCANI,SAAS,OAAO,QAChB,GAAG,sBACH,GAAG,QAI8H;AAcrI,oCAPI,GAAG,UACH,UAAU,sBACV,GAAG,gFAQb;AAaM,kCANI,GAAG,UACH,UAAU,sBACV,GAAG,QAIiH;AAYxH,4CANI,eAAe,GAAG,eAAe,OACjC,GAAG,6DAQb;AAeM,2CAPI,GAAG,+GAGF,UAAU,CAuBrB;AAcM,yCANI,GAAG,sDAEF,UAAU,CAI2H;AAU1I,yCALI,WAAW,GAAG,WAAW,GACxB,IAAI,MAAM,EAAC,MAAM,CAAC,CAa7B;AAoBM,gDALI,UAAU,GACT,IAAI,MAAM,EAAC,MAAM,CAAC,CAIyF;AAOhH,0CAJI,WAAW,GAAG,WAAW,MACzB,IAAI,MAAM,EAAC,MAAM,CAAC,6BAU5B;AAQM,kDALI,WAAW,GAAG,WAAW,OACzB,GAAG,6BAIgG;AAWvG,yCANI,GAAG,GAAC,IAAI,MAAM,EAAC,MAAM,CAAC,oDAErB,UAAU,CAWrB;AAUM,uCALI,GAAG,GAAC,IAAI,MAAM,EAAC,MAAM,CAAC,GACrB,UAAU,CAI6D"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/isParentOf.d.ts b/yjs-poll/node_modules/yjs/dist/src/utils/isParentOf.d.ts deleted file mode 100644 index 1b30910..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/isParentOf.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function isParentOf(parent: AbstractType, child: Item | null): boolean; -import { AbstractType } from "../types/AbstractType.js"; -import { Item } from "../structs/Item.js"; -//# sourceMappingURL=isParentOf.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/isParentOf.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/utils/isParentOf.d.ts.map deleted file mode 100644 index 2e8a44a..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/isParentOf.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"isParentOf.d.ts","sourceRoot":"","sources":["../../../src/utils/isParentOf.js"],"names":[],"mappings":"AAYO,mCAPI,aAAa,GAAG,CAAC,SACjB,IAAI,GAAC,IAAI,WAcnB"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/logging.d.ts b/yjs-poll/node_modules/yjs/dist/src/utils/logging.d.ts deleted file mode 100644 index 3f8efcc..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/logging.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function logType(type: AbstractType): void; -import { AbstractType } from "../types/AbstractType.js"; -//# sourceMappingURL=logging.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/logging.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/utils/logging.d.ts.map deleted file mode 100644 index c0fcd65..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/logging.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../../src/utils/logging.js"],"names":[],"mappings":"AAWO,8BAFI,aAAa,GAAG,CAAC,QAW3B"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/updates.d.ts b/yjs-poll/node_modules/yjs/dist/src/utils/updates.d.ts deleted file mode 100644 index a3b0f4b..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/updates.d.ts +++ /dev/null @@ -1,89 +0,0 @@ -export class LazyStructReader { - /** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @param {boolean} filterSkips - */ - constructor(decoder: UpdateDecoderV1 | UpdateDecoderV2, filterSkips: boolean); - gen: Generator; - /** - * @type {null | Item | Skip | GC} - */ - curr: null | Item | Skip | GC; - done: boolean; - filterSkips: boolean; - /** - * @return {Item | GC | Skip |null} - */ - next(): Item | GC | Skip | null; -} -export function logUpdate(update: Uint8Array): void; -export function logUpdateV2(update: Uint8Array, YDecoder?: typeof UpdateDecoderV1 | typeof UpdateDecoderV2 | undefined): void; -export function decodeUpdate(update: Uint8Array): { - structs: (GC | Item | Skip)[]; - ds: import("./DeleteSet.js").DeleteSet; -}; -export function decodeUpdateV2(update: Uint8Array, YDecoder?: typeof UpdateDecoderV1 | typeof UpdateDecoderV2 | undefined): { - structs: (GC | Item | Skip)[]; - ds: import("./DeleteSet.js").DeleteSet; -}; -export class LazyStructWriter { - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - */ - constructor(encoder: UpdateEncoderV1 | UpdateEncoderV2); - currClient: number; - startClock: number; - written: number; - encoder: UpdateEncoderV2 | UpdateEncoderV1; - /** - * We want to write operations lazily, but also we need to know beforehand how many operations we want to write for each client. - * - * This kind of meta-information (#clients, #structs-per-client-written) is written to the restEncoder. - * - * We fragment the restEncoder and store a slice of it per-client until we know how many clients there are. - * When we flush (toUint8Array) we write the restEncoder using the fragments and the meta-information. - * - * @type {Array<{ written: number, restEncoder: Uint8Array }>} - */ - clientStructs: { - written: number; - restEncoder: Uint8Array; - }[]; -} -export function mergeUpdates(updates: Array): Uint8Array; -export function encodeStateVectorFromUpdateV2(update: Uint8Array, YEncoder?: typeof DSEncoderV1 | typeof DSEncoderV2, YDecoder?: typeof UpdateDecoderV1 | typeof UpdateDecoderV2): Uint8Array; -export function encodeStateVectorFromUpdate(update: Uint8Array): Uint8Array; -export function parseUpdateMetaV2(update: Uint8Array, YDecoder?: typeof UpdateDecoderV1 | typeof UpdateDecoderV2): { - from: Map; - to: Map; -}; -export function parseUpdateMeta(update: Uint8Array): { - from: Map; - to: Map; -}; -export function mergeUpdatesV2(updates: Array, YDecoder?: typeof UpdateDecoderV1 | typeof UpdateDecoderV2 | undefined, YEncoder?: typeof UpdateEncoderV2 | typeof UpdateEncoderV1 | undefined): Uint8Array; -export function diffUpdateV2(update: Uint8Array, sv: Uint8Array, YDecoder?: typeof UpdateDecoderV1 | typeof UpdateDecoderV2 | undefined, YEncoder?: typeof UpdateEncoderV2 | typeof UpdateEncoderV1 | undefined): Uint8Array; -export function diffUpdate(update: Uint8Array, sv: Uint8Array): Uint8Array; -export function convertUpdateFormat(update: Uint8Array, blockTransformer: (arg0: Item | GC | Skip) => Item | GC | Skip, YDecoder: typeof UpdateDecoderV2 | typeof UpdateDecoderV1, YEncoder: typeof UpdateEncoderV2 | typeof UpdateEncoderV1): Uint8Array; -export function obfuscateUpdate(update: Uint8Array, opts?: ObfuscatorOptions | undefined): Uint8Array; -export function obfuscateUpdateV2(update: Uint8Array, opts?: ObfuscatorOptions | undefined): Uint8Array; -export function convertUpdateFormatV1ToV2(update: Uint8Array): Uint8Array; -export function convertUpdateFormatV2ToV1(update: Uint8Array): Uint8Array; -export type ObfuscatorOptions = { - formatting?: boolean | undefined; - subdocs?: boolean | undefined; - /** - * Whether to obfuscate nodeName / hookName - */ - yxml?: boolean | undefined; -}; -import { GC } from "../structs/GC.js"; -import { Item } from "../structs/Item.js"; -import { Skip } from "../structs/Skip.js"; -import { UpdateDecoderV1 } from "./UpdateDecoder.js"; -import { UpdateDecoderV2 } from "./UpdateDecoder.js"; -import { UpdateEncoderV2 } from "./UpdateEncoder.js"; -import { UpdateEncoderV1 } from "./UpdateEncoder.js"; -import { DSEncoderV1 } from "./UpdateEncoder.js"; -import { DSEncoderV2 } from "./UpdateEncoder.js"; -//# sourceMappingURL=updates.d.ts.map \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/src/utils/updates.d.ts.map b/yjs-poll/node_modules/yjs/dist/src/utils/updates.d.ts.map deleted file mode 100644 index 8727496..0000000 --- a/yjs-poll/node_modules/yjs/dist/src/utils/updates.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"updates.d.ts","sourceRoot":"","sources":["../../../src/utils/updates.js"],"names":[],"mappings":"AAmFA;IACE;;;OAGG;IACH,qBAHW,eAAe,GAAG,eAAe,eACjC,OAAO,EAWjB;IARC,gDAA6C;IAC7C;;OAEG;IACH,MAFU,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,EAAE,CAEjB;IAChB,cAAiB;IACjB,qBAA8B;IAIhC;;OAEG;IACH,QAFY,IAAI,GAAG,EAAE,GAAG,IAAI,GAAE,IAAI,CAQjC;CACF;AAMM,kCAHI,UAAU,QAGkD;AAOhE,oCAJI,UAAU,gFAcpB;AAMM,qCAHI,UAAU;;;EAG0D;AAOxE,uCAJI,UAAU;;;EAepB;AAED;IACE;;OAEG;IACH,qBAFW,eAAe,GAAG,eAAe,EAkB3C;IAfC,mBAAmB;IACnB,mBAAmB;IACnB,gBAAgB;IAChB,2CAAsB;IACtB;;;;;;;;;OASG;IACH;iBAF2B,MAAM;qBAAe,UAAU;QAEnC;CAE1B;AAMM,sCAHI,MAAM,UAAU,CAAC,GAChB,UAAU,CAE0E;AAQzF,sDALI,UAAU,aACV,kBAAkB,GAAG,kBAAkB,aACvC,sBAAsB,GAAG,sBAAsB,GAC9C,UAAU,CAgDrB;AAMM,oDAHI,UAAU,GACT,UAAU,CAEkG;AAOjH,0CAJI,UAAU,aACV,sBAAsB,GAAG,sBAAsB;UACtC,IAAI,MAAM,EAAC,MAAM,CAAC;QAAM,IAAI,MAAM,EAAC,MAAM,CAAC;EAkC7D;AAMM,wCAHI,UAAU,GACT;IAAE,IAAI,EAAE,IAAI,MAAM,EAAC,MAAM,CAAC,CAAC;IAAC,EAAE,EAAE,IAAI,MAAM,EAAC,MAAM,CAAC,CAAA;CAAE,CAEmB;AA0C5E,wCALI,MAAM,UAAU,CAAC,mJAGhB,UAAU,CAgIrB;AAQM,qCALI,UAAU,MACV,UAAU,8JAsCpB;AAMM,mCAHI,UAAU,MACV,UAAU,cAE+E;AAwE7F,4CALI,UAAU,2BACD,IAAI,GAAC,EAAE,GAAC,IAAI,KAAE,IAAI,GAAC,EAAE,GAAC,IAAI,YACnC,sBAAsB,GAAG,sBAAsB,YAC/C,sBAAsB,GAAG,sBAAsB,cAczD;AAmHM,wCAHI,UAAU,oDAGiH;AAM/H,0CAHI,UAAU,oDAGmH;AAKjI,kDAFI,UAAU,cAEiG;AAK/G,kDAFI,UAAU,cAEiG"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/testHelper.mjs b/yjs-poll/node_modules/yjs/dist/testHelper.mjs deleted file mode 100644 index 8c03931..0000000 --- a/yjs-poll/node_modules/yjs/dist/testHelper.mjs +++ /dev/null @@ -1,457 +0,0 @@ -import * as t from 'lib0/testing'; -import * as prng from 'lib0/prng'; -import * as encoding from 'lib0/encoding'; -import * as decoding from 'lib0/decoding'; -import * as syncProtocol from 'y-protocols/sync'; -import * as object from 'lib0/object'; -import * as map from 'lib0/map'; -import * as Y from 'yjs'; -export * from 'yjs'; - -if (typeof window !== 'undefined') { - // @ts-ignore - window.Y = Y; // eslint-disable-line -} - -/** - * @param {TestYInstance} y // publish message created by `y` to all other online clients - * @param {Uint8Array} m - */ -const broadcastMessage = (y, m) => { - if (y.tc.onlineConns.has(y)) { - y.tc.onlineConns.forEach(remoteYInstance => { - if (remoteYInstance !== y) { - remoteYInstance._receive(m, y); - } - }); - } -}; - -let useV2 = false; - -const encV1 = { - encodeStateAsUpdate: Y.encodeStateAsUpdate, - mergeUpdates: Y.mergeUpdates, - applyUpdate: Y.applyUpdate, - logUpdate: Y.logUpdate, - updateEventName: /** @type {'update'} */ ('update'), - diffUpdate: Y.diffUpdate -}; - -const encV2 = { - encodeStateAsUpdate: Y.encodeStateAsUpdateV2, - mergeUpdates: Y.mergeUpdatesV2, - applyUpdate: Y.applyUpdateV2, - logUpdate: Y.logUpdateV2, - updateEventName: /** @type {'updateV2'} */ ('updateV2'), - diffUpdate: Y.diffUpdateV2 -}; - -let enc = encV1; - -const useV1Encoding = () => { - useV2 = false; - enc = encV1; -}; - -const useV2Encoding = () => { - console.error('sync protocol doesnt support v2 protocol yet, fallback to v1 encoding'); // @Todo - useV2 = false; - enc = encV1; -}; - -class TestYInstance extends Y.Doc { - /** - * @param {TestConnector} testConnector - * @param {number} clientID - */ - constructor (testConnector, clientID) { - super(); - this.userID = clientID; // overwriting clientID - /** - * @type {TestConnector} - */ - this.tc = testConnector; - /** - * @type {Map>} - */ - this.receiving = new Map(); - testConnector.allConns.add(this); - /** - * The list of received updates. - * We are going to merge them later using Y.mergeUpdates and check if the resulting document is correct. - * @type {Array} - */ - this.updates = []; - // set up observe on local model - this.on(enc.updateEventName, /** @param {Uint8Array} update @param {any} origin */ (update, origin) => { - if (origin !== testConnector) { - const encoder = encoding.createEncoder(); - syncProtocol.writeUpdate(encoder, update); - broadcastMessage(this, encoding.toUint8Array(encoder)); - } - this.updates.push(update); - }); - this.connect(); - } - - /** - * Disconnect from TestConnector. - */ - disconnect () { - this.receiving = new Map(); - this.tc.onlineConns.delete(this); - } - - /** - * Append yourself to the list of known Y instances in testconnector. - * Also initiate sync with all clients. - */ - connect () { - if (!this.tc.onlineConns.has(this)) { - this.tc.onlineConns.add(this); - const encoder = encoding.createEncoder(); - syncProtocol.writeSyncStep1(encoder, this); - // publish SyncStep1 - broadcastMessage(this, encoding.toUint8Array(encoder)); - this.tc.onlineConns.forEach(remoteYInstance => { - if (remoteYInstance !== this) { - // remote instance sends instance to this instance - const encoder = encoding.createEncoder(); - syncProtocol.writeSyncStep1(encoder, remoteYInstance); - this._receive(encoding.toUint8Array(encoder), remoteYInstance); - } - }); - } - } - - /** - * Receive a message from another client. This message is only appended to the list of receiving messages. - * TestConnector decides when this client actually reads this message. - * - * @param {Uint8Array} message - * @param {TestYInstance} remoteClient - */ - _receive (message, remoteClient) { - map.setIfUndefined(this.receiving, remoteClient, () => /** @type {Array} */ ([])).push(message); - } -} - -/** - * Keeps track of TestYInstances. - * - * The TestYInstances add/remove themselves from the list of connections maiained in this object. - * I think it makes sense. Deal with it. - */ -class TestConnector { - /** - * @param {prng.PRNG} gen - */ - constructor (gen) { - /** - * @type {Set} - */ - this.allConns = new Set(); - /** - * @type {Set} - */ - this.onlineConns = new Set(); - /** - * @type {prng.PRNG} - */ - this.prng = gen; - } - - /** - * Create a new Y instance and add it to the list of connections - * @param {number} clientID - */ - createY (clientID) { - return new TestYInstance(this, clientID) - } - - /** - * Choose random connection and flush a random message from a random sender. - * - * If this function was unable to flush a message, because there are no more messages to flush, it returns false. true otherwise. - * @return {boolean} - */ - flushRandomMessage () { - const gen = this.prng; - const conns = Array.from(this.onlineConns).filter(conn => conn.receiving.size > 0); - if (conns.length > 0) { - const receiver = prng.oneOf(gen, conns); - const [sender, messages] = prng.oneOf(gen, Array.from(receiver.receiving)); - const m = messages.shift(); - if (messages.length === 0) { - receiver.receiving.delete(sender); - } - if (m === undefined) { - return this.flushRandomMessage() - } - const encoder = encoding.createEncoder(); - // console.log('receive (' + sender.userID + '->' + receiver.userID + '):\n', syncProtocol.stringifySyncMessage(decoding.createDecoder(m), receiver)) - // do not publish data created when this function is executed (could be ss2 or update message) - syncProtocol.readSyncMessage(decoding.createDecoder(m), encoder, receiver, receiver.tc); - if (encoding.length(encoder) > 0) { - // send reply message - sender._receive(encoding.toUint8Array(encoder), receiver); - } - return true - } - return false - } - - /** - * @return {boolean} True iff this function actually flushed something - */ - flushAllMessages () { - let didSomething = false; - while (this.flushRandomMessage()) { - didSomething = true; - } - return didSomething - } - - reconnectAll () { - this.allConns.forEach(conn => conn.connect()); - } - - disconnectAll () { - this.allConns.forEach(conn => conn.disconnect()); - } - - syncAll () { - this.reconnectAll(); - this.flushAllMessages(); - } - - /** - * @return {boolean} Whether it was possible to disconnect a random connection. - */ - disconnectRandom () { - if (this.onlineConns.size === 0) { - return false - } - prng.oneOf(this.prng, Array.from(this.onlineConns)).disconnect(); - return true - } - - /** - * @return {boolean} Whether it was possible to reconnect a random connection. - */ - reconnectRandom () { - /** - * @type {Array} - */ - const reconnectable = []; - this.allConns.forEach(conn => { - if (!this.onlineConns.has(conn)) { - reconnectable.push(conn); - } - }); - if (reconnectable.length === 0) { - return false - } - prng.oneOf(this.prng, reconnectable).connect(); - return true - } -} - -/** - * @template T - * @param {t.TestCase} tc - * @param {{users?:number}} conf - * @param {InitTestObjectCallback} [initTestObject] - * @return {{testObjects:Array,testConnector:TestConnector,users:Array,array0:Y.Array,array1:Y.Array,array2:Y.Array,map0:Y.Map,map1:Y.Map,map2:Y.Map,map3:Y.Map,text0:Y.Text,text1:Y.Text,text2:Y.Text,xml0:Y.XmlElement,xml1:Y.XmlElement,xml2:Y.XmlElement}} - */ -const init = (tc, { users = 5 } = {}, initTestObject) => { - /** - * @type {Object} - */ - const result = { - users: [] - }; - const gen = tc.prng; - // choose an encoding approach at random - if (prng.bool(gen)) { - useV2Encoding(); - } else { - useV1Encoding(); - } - - const testConnector = new TestConnector(gen); - result.testConnector = testConnector; - for (let i = 0; i < users; i++) { - const y = testConnector.createY(i); - y.clientID = i; - result.users.push(y); - result['array' + i] = y.getArray('array'); - result['map' + i] = y.getMap('map'); - result['xml' + i] = y.get('xml', Y.XmlElement); - result['text' + i] = y.getText('text'); - } - testConnector.syncAll(); - result.testObjects = result.users.map(initTestObject || (() => null)); - useV1Encoding(); - return /** @type {any} */ (result) -}; - -/** - * 1. reconnect and flush all - * 2. user 0 gc - * 3. get type content - * 4. disconnect & reconnect all (so gc is propagated) - * 5. compare os, ds, ss - * - * @param {Array} users - */ -const compare = users => { - users.forEach(u => u.connect()); - while (users[0].tc.flushAllMessages()) {} // eslint-disable-line - // For each document, merge all received document updates with Y.mergeUpdates and create a new document which will be added to the list of "users" - // This ensures that mergeUpdates works correctly - const mergedDocs = users.map(user => { - const ydoc = new Y.Doc(); - enc.applyUpdate(ydoc, enc.mergeUpdates(user.updates)); - return ydoc - }); - users.push(.../** @type {any} */(mergedDocs)); - const userArrayValues = users.map(u => u.getArray('array').toJSON()); - const userMapValues = users.map(u => u.getMap('map').toJSON()); - const userXmlValues = users.map(u => u.get('xml', Y.XmlElement).toString()); - const userTextValues = users.map(u => u.getText('text').toDelta()); - for (const u of users) { - t.assert(u.store.pendingDs === null); - t.assert(u.store.pendingStructs === null); - } - // Test Array iterator - t.compare(users[0].getArray('array').toArray(), Array.from(users[0].getArray('array'))); - // Test Map iterator - const ymapkeys = Array.from(users[0].getMap('map').keys()); - t.assert(ymapkeys.length === Object.keys(userMapValues[0]).length); - ymapkeys.forEach(key => t.assert(object.hasProperty(userMapValues[0], key))); - /** - * @type {Object} - */ - const mapRes = {}; - for (const [k, v] of users[0].getMap('map')) { - mapRes[k] = v instanceof Y.AbstractType ? v.toJSON() : v; - } - t.compare(userMapValues[0], mapRes); - // Compare all users - for (let i = 0; i < users.length - 1; i++) { - t.compare(userArrayValues[i].length, users[i].getArray('array').length); - t.compare(userArrayValues[i], userArrayValues[i + 1]); - t.compare(userMapValues[i], userMapValues[i + 1]); - t.compare(userXmlValues[i], userXmlValues[i + 1]); - t.compare(userTextValues[i].map(/** @param {any} a */ a => typeof a.insert === 'string' ? a.insert : ' ').join('').length, users[i].getText('text').length); - t.compare(userTextValues[i], userTextValues[i + 1], '', (_constructor, a, b) => { - if (a instanceof Y.AbstractType) { - t.compare(a.toJSON(), b.toJSON()); - } else if (a !== b) { - t.fail('Deltas dont match'); - } - return true - }); - t.compare(Y.encodeStateVector(users[i]), Y.encodeStateVector(users[i + 1])); - Y.equalDeleteSets(Y.createDeleteSetFromStructStore(users[i].store), Y.createDeleteSetFromStructStore(users[i + 1].store)); - compareStructStores(users[i].store, users[i + 1].store); - t.compare(Y.encodeSnapshot(Y.snapshot(users[i])), Y.encodeSnapshot(Y.snapshot(users[i + 1]))); - } - users.map(u => u.destroy()); -}; - -/** - * @param {Y.Item?} a - * @param {Y.Item?} b - * @return {boolean} - */ -const compareItemIDs = (a, b) => a === b || (a !== null && b != null && Y.compareIDs(a.id, b.id)); - -/** - * @param {import('../src/internals.js').StructStore} ss1 - * @param {import('../src/internals.js').StructStore} ss2 - */ -const compareStructStores = (ss1, ss2) => { - t.assert(ss1.clients.size === ss2.clients.size); - for (const [client, structs1] of ss1.clients) { - const structs2 = /** @type {Array} */ (ss2.clients.get(client)); - t.assert(structs2 !== undefined && structs1.length === structs2.length); - for (let i = 0; i < structs1.length; i++) { - const s1 = structs1[i]; - const s2 = structs2[i]; - // checks for abstract struct - if ( - s1.constructor !== s2.constructor || - !Y.compareIDs(s1.id, s2.id) || - s1.deleted !== s2.deleted || - // @ts-ignore - s1.length !== s2.length - ) { - t.fail('Structs dont match'); - } - if (s1 instanceof Y.Item) { - if ( - !(s2 instanceof Y.Item) || - !((s1.left === null && s2.left === null) || (s1.left !== null && s2.left !== null && Y.compareIDs(s1.left.lastId, s2.left.lastId))) || - !compareItemIDs(s1.right, s2.right) || - !Y.compareIDs(s1.origin, s2.origin) || - !Y.compareIDs(s1.rightOrigin, s2.rightOrigin) || - s1.parentSub !== s2.parentSub - ) { - return t.fail('Items dont match') - } - // make sure that items are connected correctly - t.assert(s1.left === null || s1.left.right === s1); - t.assert(s1.right === null || s1.right.left === s1); - t.assert(s2.left === null || s2.left.right === s2); - t.assert(s2.right === null || s2.right.left === s2); - } - } - } -}; - -/** - * @template T - * @callback InitTestObjectCallback - * @param {TestYInstance} y - * @return {T} - */ - -/** - * @template T - * @param {t.TestCase} tc - * @param {Array} mods - * @param {number} iterations - * @param {InitTestObjectCallback} [initTestObject] - */ -const applyRandomTests = (tc, mods, iterations, initTestObject) => { - const gen = tc.prng; - const result = init(tc, { users: 5 }, initTestObject); - const { testConnector, users } = result; - for (let i = 0; i < iterations; i++) { - if (prng.int32(gen, 0, 100) <= 2) { - // 2% chance to disconnect/reconnect a random user - if (prng.bool(gen)) { - testConnector.disconnectRandom(); - } else { - testConnector.reconnectRandom(); - } - } else if (prng.int32(gen, 0, 100) <= 1) { - // 1% chance to flush all - testConnector.flushAllMessages(); - } else if (prng.int32(gen, 0, 100) <= 50) { - // 50% chance to flush a random message - testConnector.flushRandomMessage(); - } - const user = prng.int32(gen, 0, users.length - 1); - const test = prng.oneOf(gen, mods); - test(users[user], gen, result.testObjects[user]); - } - compare(users); - return result -}; - -export { TestConnector, TestYInstance, applyRandomTests, compare, compareItemIDs, compareStructStores, enc, encV1, encV2, init, useV2 }; -//# sourceMappingURL=testHelper.mjs.map diff --git a/yjs-poll/node_modules/yjs/dist/yjs.cjs b/yjs-poll/node_modules/yjs/dist/yjs.cjs deleted file mode 100644 index 53e0a8c..0000000 --- a/yjs-poll/node_modules/yjs/dist/yjs.cjs +++ /dev/null @@ -1,10434 +0,0 @@ -'use strict'; - -var observable = require('lib0/observable'); -var array = require('lib0/array'); -var math = require('lib0/math'); -var map = require('lib0/map'); -var encoding = require('lib0/encoding'); -var decoding = require('lib0/decoding'); -var random = require('lib0/random'); -var promise = require('lib0/promise'); -var buffer = require('lib0/buffer'); -var error = require('lib0/error'); -var binary = require('lib0/binary'); -var f = require('lib0/function'); -var set = require('lib0/set'); -var logging = require('lib0/logging'); -var time = require('lib0/time'); -var string = require('lib0/string'); -var iterator = require('lib0/iterator'); -var object = require('lib0/object'); -var env = require('lib0/environment'); - -function _interopNamespaceDefault(e) { - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n.default = e; - return Object.freeze(n); -} - -var array__namespace = /*#__PURE__*/_interopNamespaceDefault(array); -var math__namespace = /*#__PURE__*/_interopNamespaceDefault(math); -var map__namespace = /*#__PURE__*/_interopNamespaceDefault(map); -var encoding__namespace = /*#__PURE__*/_interopNamespaceDefault(encoding); -var decoding__namespace = /*#__PURE__*/_interopNamespaceDefault(decoding); -var random__namespace = /*#__PURE__*/_interopNamespaceDefault(random); -var promise__namespace = /*#__PURE__*/_interopNamespaceDefault(promise); -var buffer__namespace = /*#__PURE__*/_interopNamespaceDefault(buffer); -var error__namespace = /*#__PURE__*/_interopNamespaceDefault(error); -var binary__namespace = /*#__PURE__*/_interopNamespaceDefault(binary); -var f__namespace = /*#__PURE__*/_interopNamespaceDefault(f); -var set__namespace = /*#__PURE__*/_interopNamespaceDefault(set); -var logging__namespace = /*#__PURE__*/_interopNamespaceDefault(logging); -var time__namespace = /*#__PURE__*/_interopNamespaceDefault(time); -var string__namespace = /*#__PURE__*/_interopNamespaceDefault(string); -var iterator__namespace = /*#__PURE__*/_interopNamespaceDefault(iterator); -var object__namespace = /*#__PURE__*/_interopNamespaceDefault(object); -var env__namespace = /*#__PURE__*/_interopNamespaceDefault(env); - -/** - * This is an abstract interface that all Connectors should implement to keep them interchangeable. - * - * @note This interface is experimental and it is not advised to actually inherit this class. - * It just serves as typing information. - * - * @extends {ObservableV2} - */ -class AbstractConnector extends observable.ObservableV2 { - /** - * @param {Doc} ydoc - * @param {any} awareness - */ - constructor (ydoc, awareness) { - super(); - this.doc = ydoc; - this.awareness = awareness; - } -} - -class DeleteItem { - /** - * @param {number} clock - * @param {number} len - */ - constructor (clock, len) { - /** - * @type {number} - */ - this.clock = clock; - /** - * @type {number} - */ - this.len = len; - } -} - -/** - * We no longer maintain a DeleteStore. DeleteSet is a temporary object that is created when needed. - * - When created in a transaction, it must only be accessed after sorting, and merging - * - This DeleteSet is send to other clients - * - We do not create a DeleteSet when we send a sync message. The DeleteSet message is created directly from StructStore - * - We read a DeleteSet as part of a sync/update message. In this case the DeleteSet is already sorted and merged. - */ -class DeleteSet { - constructor () { - /** - * @type {Map>} - */ - this.clients = new Map(); - } -} - -/** - * Iterate over all structs that the DeleteSet gc's. - * - * @param {Transaction} transaction - * @param {DeleteSet} ds - * @param {function(GC|Item):void} f - * - * @function - */ -const iterateDeletedStructs = (transaction, ds, f) => - ds.clients.forEach((deletes, clientid) => { - const structs = /** @type {Array} */ (transaction.doc.store.clients.get(clientid)); - if (structs != null) { - const lastStruct = structs[structs.length - 1]; - const clockState = lastStruct.id.clock + lastStruct.length; - for (let i = 0, del = deletes[i]; i < deletes.length && del.clock < clockState; del = deletes[++i]) { - iterateStructs(transaction, structs, del.clock, del.len, f); - } - } - }); - -/** - * @param {Array} dis - * @param {number} clock - * @return {number|null} - * - * @private - * @function - */ -const findIndexDS = (dis, clock) => { - let left = 0; - let right = dis.length - 1; - while (left <= right) { - const midindex = math__namespace.floor((left + right) / 2); - const mid = dis[midindex]; - const midclock = mid.clock; - if (midclock <= clock) { - if (clock < midclock + mid.len) { - return midindex - } - left = midindex + 1; - } else { - right = midindex - 1; - } - } - return null -}; - -/** - * @param {DeleteSet} ds - * @param {ID} id - * @return {boolean} - * - * @private - * @function - */ -const isDeleted = (ds, id) => { - const dis = ds.clients.get(id.client); - return dis !== undefined && findIndexDS(dis, id.clock) !== null -}; - -/** - * @param {DeleteSet} ds - * - * @private - * @function - */ -const sortAndMergeDeleteSet = ds => { - ds.clients.forEach(dels => { - dels.sort((a, b) => a.clock - b.clock); - // merge items without filtering or splicing the array - // i is the current pointer - // j refers to the current insert position for the pointed item - // try to merge dels[i] into dels[j-1] or set dels[j]=dels[i] - let i, j; - for (i = 1, j = 1; i < dels.length; i++) { - const left = dels[j - 1]; - const right = dels[i]; - if (left.clock + left.len >= right.clock) { - left.len = math__namespace.max(left.len, right.clock + right.len - left.clock); - } else { - if (j < i) { - dels[j] = right; - } - j++; - } - } - dels.length = j; - }); -}; - -/** - * @param {Array} dss - * @return {DeleteSet} A fresh DeleteSet - */ -const mergeDeleteSets = dss => { - const merged = new DeleteSet(); - for (let dssI = 0; dssI < dss.length; dssI++) { - dss[dssI].clients.forEach((delsLeft, client) => { - if (!merged.clients.has(client)) { - // Write all missing keys from current ds and all following. - // If merged already contains `client` current ds has already been added. - /** - * @type {Array} - */ - const dels = delsLeft.slice(); - for (let i = dssI + 1; i < dss.length; i++) { - array__namespace.appendTo(dels, dss[i].clients.get(client) || []); - } - merged.clients.set(client, dels); - } - }); - } - sortAndMergeDeleteSet(merged); - return merged -}; - -/** - * @param {DeleteSet} ds - * @param {number} client - * @param {number} clock - * @param {number} length - * - * @private - * @function - */ -const addToDeleteSet = (ds, client, clock, length) => { - map__namespace.setIfUndefined(ds.clients, client, () => /** @type {Array} */ ([])).push(new DeleteItem(clock, length)); -}; - -const createDeleteSet = () => new DeleteSet(); - -/** - * @param {StructStore} ss - * @return {DeleteSet} Merged and sorted DeleteSet - * - * @private - * @function - */ -const createDeleteSetFromStructStore = ss => { - const ds = createDeleteSet(); - ss.clients.forEach((structs, client) => { - /** - * @type {Array} - */ - const dsitems = []; - for (let i = 0; i < structs.length; i++) { - const struct = structs[i]; - if (struct.deleted) { - const clock = struct.id.clock; - let len = struct.length; - if (i + 1 < structs.length) { - for (let next = structs[i + 1]; i + 1 < structs.length && next.deleted; next = structs[++i + 1]) { - len += next.length; - } - } - dsitems.push(new DeleteItem(clock, len)); - } - } - if (dsitems.length > 0) { - ds.clients.set(client, dsitems); - } - }); - return ds -}; - -/** - * @param {DSEncoderV1 | DSEncoderV2} encoder - * @param {DeleteSet} ds - * - * @private - * @function - */ -const writeDeleteSet = (encoder, ds) => { - encoding__namespace.writeVarUint(encoder.restEncoder, ds.clients.size); - - // Ensure that the delete set is written in a deterministic order - array__namespace.from(ds.clients.entries()) - .sort((a, b) => b[0] - a[0]) - .forEach(([client, dsitems]) => { - encoder.resetDsCurVal(); - encoding__namespace.writeVarUint(encoder.restEncoder, client); - const len = dsitems.length; - encoding__namespace.writeVarUint(encoder.restEncoder, len); - for (let i = 0; i < len; i++) { - const item = dsitems[i]; - encoder.writeDsClock(item.clock); - encoder.writeDsLen(item.len); - } - }); -}; - -/** - * @param {DSDecoderV1 | DSDecoderV2} decoder - * @return {DeleteSet} - * - * @private - * @function - */ -const readDeleteSet = decoder => { - const ds = new DeleteSet(); - const numClients = decoding__namespace.readVarUint(decoder.restDecoder); - for (let i = 0; i < numClients; i++) { - decoder.resetDsCurVal(); - const client = decoding__namespace.readVarUint(decoder.restDecoder); - const numberOfDeletes = decoding__namespace.readVarUint(decoder.restDecoder); - if (numberOfDeletes > 0) { - const dsField = map__namespace.setIfUndefined(ds.clients, client, () => /** @type {Array} */ ([])); - for (let i = 0; i < numberOfDeletes; i++) { - dsField.push(new DeleteItem(decoder.readDsClock(), decoder.readDsLen())); - } - } - } - return ds -}; - -/** - * @todo YDecoder also contains references to String and other Decoders. Would make sense to exchange YDecoder.toUint8Array for YDecoder.DsToUint8Array().. - */ - -/** - * @param {DSDecoderV1 | DSDecoderV2} decoder - * @param {Transaction} transaction - * @param {StructStore} store - * @return {Uint8Array|null} Returns a v2 update containing all deletes that couldn't be applied yet; or null if all deletes were applied successfully. - * - * @private - * @function - */ -const readAndApplyDeleteSet = (decoder, transaction, store) => { - const unappliedDS = new DeleteSet(); - const numClients = decoding__namespace.readVarUint(decoder.restDecoder); - for (let i = 0; i < numClients; i++) { - decoder.resetDsCurVal(); - const client = decoding__namespace.readVarUint(decoder.restDecoder); - const numberOfDeletes = decoding__namespace.readVarUint(decoder.restDecoder); - const structs = store.clients.get(client) || []; - const state = getState(store, client); - for (let i = 0; i < numberOfDeletes; i++) { - const clock = decoder.readDsClock(); - const clockEnd = clock + decoder.readDsLen(); - if (clock < state) { - if (state < clockEnd) { - addToDeleteSet(unappliedDS, client, state, clockEnd - state); - } - let index = findIndexSS(structs, clock); - /** - * We can ignore the case of GC and Delete structs, because we are going to skip them - * @type {Item} - */ - // @ts-ignore - let struct = structs[index]; - // split the first item if necessary - if (!struct.deleted && struct.id.clock < clock) { - structs.splice(index + 1, 0, splitItem(transaction, struct, clock - struct.id.clock)); - index++; // increase we now want to use the next struct - } - while (index < structs.length) { - // @ts-ignore - struct = structs[index++]; - if (struct.id.clock < clockEnd) { - if (!struct.deleted) { - if (clockEnd < struct.id.clock + struct.length) { - structs.splice(index, 0, splitItem(transaction, struct, clockEnd - struct.id.clock)); - } - struct.delete(transaction); - } - } else { - break - } - } - } else { - addToDeleteSet(unappliedDS, client, clock, clockEnd - clock); - } - } - } - if (unappliedDS.clients.size > 0) { - const ds = new UpdateEncoderV2(); - encoding__namespace.writeVarUint(ds.restEncoder, 0); // encode 0 structs - writeDeleteSet(ds, unappliedDS); - return ds.toUint8Array() - } - return null -}; - -/** - * @param {DeleteSet} ds1 - * @param {DeleteSet} ds2 - */ -const equalDeleteSets = (ds1, ds2) => { - if (ds1.clients.size !== ds2.clients.size) return false - for (const [client, deleteItems1] of ds1.clients.entries()) { - const deleteItems2 = /** @type {Array} */ (ds2.clients.get(client)); - if (deleteItems2 === undefined || deleteItems1.length !== deleteItems2.length) return false - for (let i = 0; i < deleteItems1.length; i++) { - const di1 = deleteItems1[i]; - const di2 = deleteItems2[i]; - if (di1.clock !== di2.clock || di1.len !== di2.len) { - return false - } - } - } - return true -}; - -/** - * @module Y - */ - - -const generateNewClientId = random__namespace.uint32; - -/** - * @typedef {Object} DocOpts - * @property {boolean} [DocOpts.gc=true] Disable garbage collection (default: gc=true) - * @property {function(Item):boolean} [DocOpts.gcFilter] Will be called before an Item is garbage collected. Return false to keep the Item. - * @property {string} [DocOpts.guid] Define a globally unique identifier for this document - * @property {string | null} [DocOpts.collectionid] Associate this document with a collection. This only plays a role if your provider has a concept of collection. - * @property {any} [DocOpts.meta] Any kind of meta information you want to associate with this document. If this is a subdocument, remote peers will store the meta information as well. - * @property {boolean} [DocOpts.autoLoad] If a subdocument, automatically load document. If this is a subdocument, remote peers will load the document as well automatically. - * @property {boolean} [DocOpts.shouldLoad] Whether the document should be synced by the provider now. This is toggled to true when you call ydoc.load() - */ - -/** - * @typedef {Object} DocEvents - * @property {function(Doc):void} DocEvents.destroy - * @property {function(Doc):void} DocEvents.load - * @property {function(boolean, Doc):void} DocEvents.sync - * @property {function(Uint8Array, any, Doc, Transaction):void} DocEvents.update - * @property {function(Uint8Array, any, Doc, Transaction):void} DocEvents.updateV2 - * @property {function(Doc):void} DocEvents.beforeAllTransactions - * @property {function(Transaction, Doc):void} DocEvents.beforeTransaction - * @property {function(Transaction, Doc):void} DocEvents.beforeObserverCalls - * @property {function(Transaction, Doc):void} DocEvents.afterTransaction - * @property {function(Transaction, Doc):void} DocEvents.afterTransactionCleanup - * @property {function(Doc, Array):void} DocEvents.afterAllTransactions - * @property {function({ loaded: Set, added: Set, removed: Set }, Doc, Transaction):void} DocEvents.subdocs - */ - -/** - * A Yjs instance handles the state of shared data. - * @extends ObservableV2 - */ -class Doc extends observable.ObservableV2 { - /** - * @param {DocOpts} opts configuration - */ - constructor ({ guid = random__namespace.uuidv4(), collectionid = null, gc = true, gcFilter = () => true, meta = null, autoLoad = false, shouldLoad = true } = {}) { - super(); - this.gc = gc; - this.gcFilter = gcFilter; - this.clientID = generateNewClientId(); - this.guid = guid; - this.collectionid = collectionid; - /** - * @type {Map>>} - */ - this.share = new Map(); - this.store = new StructStore(); - /** - * @type {Transaction | null} - */ - this._transaction = null; - /** - * @type {Array} - */ - this._transactionCleanups = []; - /** - * @type {Set} - */ - this.subdocs = new Set(); - /** - * If this document is a subdocument - a document integrated into another document - then _item is defined. - * @type {Item?} - */ - this._item = null; - this.shouldLoad = shouldLoad; - this.autoLoad = autoLoad; - this.meta = meta; - /** - * This is set to true when the persistence provider loaded the document from the database or when the `sync` event fires. - * Note that not all providers implement this feature. Provider authors are encouraged to fire the `load` event when the doc content is loaded from the database. - * - * @type {boolean} - */ - this.isLoaded = false; - /** - * This is set to true when the connection provider has successfully synced with a backend. - * Note that when using peer-to-peer providers this event may not provide very useful. - * Also note that not all providers implement this feature. Provider authors are encouraged to fire - * the `sync` event when the doc has been synced (with `true` as a parameter) or if connection is - * lost (with false as a parameter). - */ - this.isSynced = false; - this.isDestroyed = false; - /** - * Promise that resolves once the document has been loaded from a persistence provider. - */ - this.whenLoaded = promise__namespace.create(resolve => { - this.on('load', () => { - this.isLoaded = true; - resolve(this); - }); - }); - const provideSyncedPromise = () => promise__namespace.create(resolve => { - /** - * @param {boolean} isSynced - */ - const eventHandler = (isSynced) => { - if (isSynced === undefined || isSynced === true) { - this.off('sync', eventHandler); - resolve(); - } - }; - this.on('sync', eventHandler); - }); - this.on('sync', isSynced => { - if (isSynced === false && this.isSynced) { - this.whenSynced = provideSyncedPromise(); - } - this.isSynced = isSynced === undefined || isSynced === true; - if (this.isSynced && !this.isLoaded) { - this.emit('load', [this]); - } - }); - /** - * Promise that resolves once the document has been synced with a backend. - * This promise is recreated when the connection is lost. - * Note the documentation about the `isSynced` property. - */ - this.whenSynced = provideSyncedPromise(); - } - - /** - * Notify the parent document that you request to load data into this subdocument (if it is a subdocument). - * - * `load()` might be used in the future to request any provider to load the most current data. - * - * It is safe to call `load()` multiple times. - */ - load () { - const item = this._item; - if (item !== null && !this.shouldLoad) { - transact(/** @type {any} */ (item.parent).doc, transaction => { - transaction.subdocsLoaded.add(this); - }, null, true); - } - this.shouldLoad = true; - } - - getSubdocs () { - return this.subdocs - } - - getSubdocGuids () { - return new Set(array__namespace.from(this.subdocs).map(doc => doc.guid)) - } - - /** - * Changes that happen inside of a transaction are bundled. This means that - * the observer fires _after_ the transaction is finished and that all changes - * that happened inside of the transaction are sent as one message to the - * other peers. - * - * @template T - * @param {function(Transaction):T} f The function that should be executed as a transaction - * @param {any} [origin] Origin of who started the transaction. Will be stored on transaction.origin - * @return T - * - * @public - */ - transact (f, origin = null) { - return transact(this, f, origin) - } - - /** - * Define a shared data type. - * - * Multiple calls of `ydoc.get(name, TypeConstructor)` yield the same result - * and do not overwrite each other. I.e. - * `ydoc.get(name, Y.Array) === ydoc.get(name, Y.Array)` - * - * After this method is called, the type is also available on `ydoc.share.get(name)`. - * - * *Best Practices:* - * Define all types right after the Y.Doc instance is created and store them in a separate object. - * Also use the typed methods `getText(name)`, `getArray(name)`, .. - * - * @template {typeof AbstractType} Type - * @example - * const ydoc = new Y.Doc(..) - * const appState = { - * document: ydoc.getText('document') - * comments: ydoc.getArray('comments') - * } - * - * @param {string} name - * @param {Type} TypeConstructor The constructor of the type definition. E.g. Y.Text, Y.Array, Y.Map, ... - * @return {InstanceType} The created type. Constructed with TypeConstructor - * - * @public - */ - get (name, TypeConstructor = /** @type {any} */ (AbstractType)) { - const type = map__namespace.setIfUndefined(this.share, name, () => { - // @ts-ignore - const t = new TypeConstructor(); - t._integrate(this, null); - return t - }); - const Constr = type.constructor; - if (TypeConstructor !== AbstractType && Constr !== TypeConstructor) { - if (Constr === AbstractType) { - // @ts-ignore - const t = new TypeConstructor(); - t._map = type._map; - type._map.forEach(/** @param {Item?} n */ n => { - for (; n !== null; n = n.left) { - // @ts-ignore - n.parent = t; - } - }); - t._start = type._start; - for (let n = t._start; n !== null; n = n.right) { - n.parent = t; - } - t._length = type._length; - this.share.set(name, t); - t._integrate(this, null); - return /** @type {InstanceType} */ (t) - } else { - throw new Error(`Type with the name ${name} has already been defined with a different constructor`) - } - } - return /** @type {InstanceType} */ (type) - } - - /** - * @template T - * @param {string} [name] - * @return {YArray} - * - * @public - */ - getArray (name = '') { - return /** @type {YArray} */ (this.get(name, YArray)) - } - - /** - * @param {string} [name] - * @return {YText} - * - * @public - */ - getText (name = '') { - return this.get(name, YText) - } - - /** - * @template T - * @param {string} [name] - * @return {YMap} - * - * @public - */ - getMap (name = '') { - return /** @type {YMap} */ (this.get(name, YMap)) - } - - /** - * @param {string} [name] - * @return {YXmlElement} - * - * @public - */ - getXmlElement (name = '') { - return /** @type {YXmlElement<{[key:string]:string}>} */ (this.get(name, YXmlElement)) - } - - /** - * @param {string} [name] - * @return {YXmlFragment} - * - * @public - */ - getXmlFragment (name = '') { - return this.get(name, YXmlFragment) - } - - /** - * Converts the entire document into a js object, recursively traversing each yjs type - * Doesn't log types that have not been defined (using ydoc.getType(..)). - * - * @deprecated Do not use this method and rather call toJSON directly on the shared types. - * - * @return {Object} - */ - toJSON () { - /** - * @type {Object} - */ - const doc = {}; - - this.share.forEach((value, key) => { - doc[key] = value.toJSON(); - }); - - return doc - } - - /** - * Emit `destroy` event and unregister all event handlers. - */ - destroy () { - this.isDestroyed = true; - array__namespace.from(this.subdocs).forEach(subdoc => subdoc.destroy()); - const item = this._item; - if (item !== null) { - this._item = null; - const content = /** @type {ContentDoc} */ (item.content); - content.doc = new Doc({ guid: this.guid, ...content.opts, shouldLoad: false }); - content.doc._item = item; - transact(/** @type {any} */ (item).parent.doc, transaction => { - const doc = content.doc; - if (!item.deleted) { - transaction.subdocsAdded.add(doc); - } - transaction.subdocsRemoved.add(this); - }, null, true); - } - // @ts-ignore - this.emit('destroyed', [true]); // DEPRECATED! - this.emit('destroy', [this]); - super.destroy(); - } -} - -class DSDecoderV1 { - /** - * @param {decoding.Decoder} decoder - */ - constructor (decoder) { - this.restDecoder = decoder; - } - - resetDsCurVal () { - // nop - } - - /** - * @return {number} - */ - readDsClock () { - return decoding__namespace.readVarUint(this.restDecoder) - } - - /** - * @return {number} - */ - readDsLen () { - return decoding__namespace.readVarUint(this.restDecoder) - } -} - -class UpdateDecoderV1 extends DSDecoderV1 { - /** - * @return {ID} - */ - readLeftID () { - return createID(decoding__namespace.readVarUint(this.restDecoder), decoding__namespace.readVarUint(this.restDecoder)) - } - - /** - * @return {ID} - */ - readRightID () { - return createID(decoding__namespace.readVarUint(this.restDecoder), decoding__namespace.readVarUint(this.restDecoder)) - } - - /** - * Read the next client id. - * Use this in favor of readID whenever possible to reduce the number of objects created. - */ - readClient () { - return decoding__namespace.readVarUint(this.restDecoder) - } - - /** - * @return {number} info An unsigned 8-bit integer - */ - readInfo () { - return decoding__namespace.readUint8(this.restDecoder) - } - - /** - * @return {string} - */ - readString () { - return decoding__namespace.readVarString(this.restDecoder) - } - - /** - * @return {boolean} isKey - */ - readParentInfo () { - return decoding__namespace.readVarUint(this.restDecoder) === 1 - } - - /** - * @return {number} info An unsigned 8-bit integer - */ - readTypeRef () { - return decoding__namespace.readVarUint(this.restDecoder) - } - - /** - * Write len of a struct - well suited for Opt RLE encoder. - * - * @return {number} len - */ - readLen () { - return decoding__namespace.readVarUint(this.restDecoder) - } - - /** - * @return {any} - */ - readAny () { - return decoding__namespace.readAny(this.restDecoder) - } - - /** - * @return {Uint8Array} - */ - readBuf () { - return buffer__namespace.copyUint8Array(decoding__namespace.readVarUint8Array(this.restDecoder)) - } - - /** - * Legacy implementation uses JSON parse. We use any-decoding in v2. - * - * @return {any} - */ - readJSON () { - return JSON.parse(decoding__namespace.readVarString(this.restDecoder)) - } - - /** - * @return {string} - */ - readKey () { - return decoding__namespace.readVarString(this.restDecoder) - } -} - -class DSDecoderV2 { - /** - * @param {decoding.Decoder} decoder - */ - constructor (decoder) { - /** - * @private - */ - this.dsCurrVal = 0; - this.restDecoder = decoder; - } - - resetDsCurVal () { - this.dsCurrVal = 0; - } - - /** - * @return {number} - */ - readDsClock () { - this.dsCurrVal += decoding__namespace.readVarUint(this.restDecoder); - return this.dsCurrVal - } - - /** - * @return {number} - */ - readDsLen () { - const diff = decoding__namespace.readVarUint(this.restDecoder) + 1; - this.dsCurrVal += diff; - return diff - } -} - -class UpdateDecoderV2 extends DSDecoderV2 { - /** - * @param {decoding.Decoder} decoder - */ - constructor (decoder) { - super(decoder); - /** - * List of cached keys. If the keys[id] does not exist, we read a new key - * from stringEncoder and push it to keys. - * - * @type {Array} - */ - this.keys = []; - decoding__namespace.readVarUint(decoder); // read feature flag - currently unused - this.keyClockDecoder = new decoding__namespace.IntDiffOptRleDecoder(decoding__namespace.readVarUint8Array(decoder)); - this.clientDecoder = new decoding__namespace.UintOptRleDecoder(decoding__namespace.readVarUint8Array(decoder)); - this.leftClockDecoder = new decoding__namespace.IntDiffOptRleDecoder(decoding__namespace.readVarUint8Array(decoder)); - this.rightClockDecoder = new decoding__namespace.IntDiffOptRleDecoder(decoding__namespace.readVarUint8Array(decoder)); - this.infoDecoder = new decoding__namespace.RleDecoder(decoding__namespace.readVarUint8Array(decoder), decoding__namespace.readUint8); - this.stringDecoder = new decoding__namespace.StringDecoder(decoding__namespace.readVarUint8Array(decoder)); - this.parentInfoDecoder = new decoding__namespace.RleDecoder(decoding__namespace.readVarUint8Array(decoder), decoding__namespace.readUint8); - this.typeRefDecoder = new decoding__namespace.UintOptRleDecoder(decoding__namespace.readVarUint8Array(decoder)); - this.lenDecoder = new decoding__namespace.UintOptRleDecoder(decoding__namespace.readVarUint8Array(decoder)); - } - - /** - * @return {ID} - */ - readLeftID () { - return new ID(this.clientDecoder.read(), this.leftClockDecoder.read()) - } - - /** - * @return {ID} - */ - readRightID () { - return new ID(this.clientDecoder.read(), this.rightClockDecoder.read()) - } - - /** - * Read the next client id. - * Use this in favor of readID whenever possible to reduce the number of objects created. - */ - readClient () { - return this.clientDecoder.read() - } - - /** - * @return {number} info An unsigned 8-bit integer - */ - readInfo () { - return /** @type {number} */ (this.infoDecoder.read()) - } - - /** - * @return {string} - */ - readString () { - return this.stringDecoder.read() - } - - /** - * @return {boolean} - */ - readParentInfo () { - return this.parentInfoDecoder.read() === 1 - } - - /** - * @return {number} An unsigned 8-bit integer - */ - readTypeRef () { - return this.typeRefDecoder.read() - } - - /** - * Write len of a struct - well suited for Opt RLE encoder. - * - * @return {number} - */ - readLen () { - return this.lenDecoder.read() - } - - /** - * @return {any} - */ - readAny () { - return decoding__namespace.readAny(this.restDecoder) - } - - /** - * @return {Uint8Array} - */ - readBuf () { - return decoding__namespace.readVarUint8Array(this.restDecoder) - } - - /** - * This is mainly here for legacy purposes. - * - * Initial we incoded objects using JSON. Now we use the much faster lib0/any-encoder. This method mainly exists for legacy purposes for the v1 encoder. - * - * @return {any} - */ - readJSON () { - return decoding__namespace.readAny(this.restDecoder) - } - - /** - * @return {string} - */ - readKey () { - const keyClock = this.keyClockDecoder.read(); - if (keyClock < this.keys.length) { - return this.keys[keyClock] - } else { - const key = this.stringDecoder.read(); - this.keys.push(key); - return key - } - } -} - -class DSEncoderV1 { - constructor () { - this.restEncoder = encoding__namespace.createEncoder(); - } - - toUint8Array () { - return encoding__namespace.toUint8Array(this.restEncoder) - } - - resetDsCurVal () { - // nop - } - - /** - * @param {number} clock - */ - writeDsClock (clock) { - encoding__namespace.writeVarUint(this.restEncoder, clock); - } - - /** - * @param {number} len - */ - writeDsLen (len) { - encoding__namespace.writeVarUint(this.restEncoder, len); - } -} - -class UpdateEncoderV1 extends DSEncoderV1 { - /** - * @param {ID} id - */ - writeLeftID (id) { - encoding__namespace.writeVarUint(this.restEncoder, id.client); - encoding__namespace.writeVarUint(this.restEncoder, id.clock); - } - - /** - * @param {ID} id - */ - writeRightID (id) { - encoding__namespace.writeVarUint(this.restEncoder, id.client); - encoding__namespace.writeVarUint(this.restEncoder, id.clock); - } - - /** - * Use writeClient and writeClock instead of writeID if possible. - * @param {number} client - */ - writeClient (client) { - encoding__namespace.writeVarUint(this.restEncoder, client); - } - - /** - * @param {number} info An unsigned 8-bit integer - */ - writeInfo (info) { - encoding__namespace.writeUint8(this.restEncoder, info); - } - - /** - * @param {string} s - */ - writeString (s) { - encoding__namespace.writeVarString(this.restEncoder, s); - } - - /** - * @param {boolean} isYKey - */ - writeParentInfo (isYKey) { - encoding__namespace.writeVarUint(this.restEncoder, isYKey ? 1 : 0); - } - - /** - * @param {number} info An unsigned 8-bit integer - */ - writeTypeRef (info) { - encoding__namespace.writeVarUint(this.restEncoder, info); - } - - /** - * Write len of a struct - well suited for Opt RLE encoder. - * - * @param {number} len - */ - writeLen (len) { - encoding__namespace.writeVarUint(this.restEncoder, len); - } - - /** - * @param {any} any - */ - writeAny (any) { - encoding__namespace.writeAny(this.restEncoder, any); - } - - /** - * @param {Uint8Array} buf - */ - writeBuf (buf) { - encoding__namespace.writeVarUint8Array(this.restEncoder, buf); - } - - /** - * @param {any} embed - */ - writeJSON (embed) { - encoding__namespace.writeVarString(this.restEncoder, JSON.stringify(embed)); - } - - /** - * @param {string} key - */ - writeKey (key) { - encoding__namespace.writeVarString(this.restEncoder, key); - } -} - -class DSEncoderV2 { - constructor () { - this.restEncoder = encoding__namespace.createEncoder(); // encodes all the rest / non-optimized - this.dsCurrVal = 0; - } - - toUint8Array () { - return encoding__namespace.toUint8Array(this.restEncoder) - } - - resetDsCurVal () { - this.dsCurrVal = 0; - } - - /** - * @param {number} clock - */ - writeDsClock (clock) { - const diff = clock - this.dsCurrVal; - this.dsCurrVal = clock; - encoding__namespace.writeVarUint(this.restEncoder, diff); - } - - /** - * @param {number} len - */ - writeDsLen (len) { - if (len === 0) { - error__namespace.unexpectedCase(); - } - encoding__namespace.writeVarUint(this.restEncoder, len - 1); - this.dsCurrVal += len; - } -} - -class UpdateEncoderV2 extends DSEncoderV2 { - constructor () { - super(); - /** - * @type {Map} - */ - this.keyMap = new Map(); - /** - * Refers to the next unique key-identifier to me used. - * See writeKey method for more information. - * - * @type {number} - */ - this.keyClock = 0; - this.keyClockEncoder = new encoding__namespace.IntDiffOptRleEncoder(); - this.clientEncoder = new encoding__namespace.UintOptRleEncoder(); - this.leftClockEncoder = new encoding__namespace.IntDiffOptRleEncoder(); - this.rightClockEncoder = new encoding__namespace.IntDiffOptRleEncoder(); - this.infoEncoder = new encoding__namespace.RleEncoder(encoding__namespace.writeUint8); - this.stringEncoder = new encoding__namespace.StringEncoder(); - this.parentInfoEncoder = new encoding__namespace.RleEncoder(encoding__namespace.writeUint8); - this.typeRefEncoder = new encoding__namespace.UintOptRleEncoder(); - this.lenEncoder = new encoding__namespace.UintOptRleEncoder(); - } - - toUint8Array () { - const encoder = encoding__namespace.createEncoder(); - encoding__namespace.writeVarUint(encoder, 0); // this is a feature flag that we might use in the future - encoding__namespace.writeVarUint8Array(encoder, this.keyClockEncoder.toUint8Array()); - encoding__namespace.writeVarUint8Array(encoder, this.clientEncoder.toUint8Array()); - encoding__namespace.writeVarUint8Array(encoder, this.leftClockEncoder.toUint8Array()); - encoding__namespace.writeVarUint8Array(encoder, this.rightClockEncoder.toUint8Array()); - encoding__namespace.writeVarUint8Array(encoder, encoding__namespace.toUint8Array(this.infoEncoder)); - encoding__namespace.writeVarUint8Array(encoder, this.stringEncoder.toUint8Array()); - encoding__namespace.writeVarUint8Array(encoder, encoding__namespace.toUint8Array(this.parentInfoEncoder)); - encoding__namespace.writeVarUint8Array(encoder, this.typeRefEncoder.toUint8Array()); - encoding__namespace.writeVarUint8Array(encoder, this.lenEncoder.toUint8Array()); - // @note The rest encoder is appended! (note the missing var) - encoding__namespace.writeUint8Array(encoder, encoding__namespace.toUint8Array(this.restEncoder)); - return encoding__namespace.toUint8Array(encoder) - } - - /** - * @param {ID} id - */ - writeLeftID (id) { - this.clientEncoder.write(id.client); - this.leftClockEncoder.write(id.clock); - } - - /** - * @param {ID} id - */ - writeRightID (id) { - this.clientEncoder.write(id.client); - this.rightClockEncoder.write(id.clock); - } - - /** - * @param {number} client - */ - writeClient (client) { - this.clientEncoder.write(client); - } - - /** - * @param {number} info An unsigned 8-bit integer - */ - writeInfo (info) { - this.infoEncoder.write(info); - } - - /** - * @param {string} s - */ - writeString (s) { - this.stringEncoder.write(s); - } - - /** - * @param {boolean} isYKey - */ - writeParentInfo (isYKey) { - this.parentInfoEncoder.write(isYKey ? 1 : 0); - } - - /** - * @param {number} info An unsigned 8-bit integer - */ - writeTypeRef (info) { - this.typeRefEncoder.write(info); - } - - /** - * Write len of a struct - well suited for Opt RLE encoder. - * - * @param {number} len - */ - writeLen (len) { - this.lenEncoder.write(len); - } - - /** - * @param {any} any - */ - writeAny (any) { - encoding__namespace.writeAny(this.restEncoder, any); - } - - /** - * @param {Uint8Array} buf - */ - writeBuf (buf) { - encoding__namespace.writeVarUint8Array(this.restEncoder, buf); - } - - /** - * This is mainly here for legacy purposes. - * - * Initial we incoded objects using JSON. Now we use the much faster lib0/any-encoder. This method mainly exists for legacy purposes for the v1 encoder. - * - * @param {any} embed - */ - writeJSON (embed) { - encoding__namespace.writeAny(this.restEncoder, embed); - } - - /** - * Property keys are often reused. For example, in y-prosemirror the key `bold` might - * occur very often. For a 3d application, the key `position` might occur very often. - * - * We cache these keys in a Map and refer to them via a unique number. - * - * @param {string} key - */ - writeKey (key) { - const clock = this.keyMap.get(key); - if (clock === undefined) { - /** - * @todo uncomment to introduce this feature finally - * - * Background. The ContentFormat object was always encoded using writeKey, but the decoder used to use readString. - * Furthermore, I forgot to set the keyclock. So everything was working fine. - * - * However, this feature here is basically useless as it is not being used (it actually only consumes extra memory). - * - * I don't know yet how to reintroduce this feature.. - * - * Older clients won't be able to read updates when we reintroduce this feature. So this should probably be done using a flag. - * - */ - // this.keyMap.set(key, this.keyClock) - this.keyClockEncoder.write(this.keyClock++); - this.stringEncoder.write(key); - } else { - this.keyClockEncoder.write(clock); - } - } -} - -/** - * @module encoding - */ -/* - * We use the first five bits in the info flag for determining the type of the struct. - * - * 0: GC - * 1: Item with Deleted content - * 2: Item with JSON content - * 3: Item with Binary content - * 4: Item with String content - * 5: Item with Embed content (for richtext content) - * 6: Item with Format content (a formatting marker for richtext content) - * 7: Item with Type - */ - - -/** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {Array} structs All structs by `client` - * @param {number} client - * @param {number} clock write structs starting with `ID(client,clock)` - * - * @function - */ -const writeStructs = (encoder, structs, client, clock) => { - // write first id - clock = math__namespace.max(clock, structs[0].id.clock); // make sure the first id exists - const startNewStructs = findIndexSS(structs, clock); - // write # encoded structs - encoding__namespace.writeVarUint(encoder.restEncoder, structs.length - startNewStructs); - encoder.writeClient(client); - encoding__namespace.writeVarUint(encoder.restEncoder, clock); - const firstStruct = structs[startNewStructs]; - // write first struct with an offset - firstStruct.write(encoder, clock - firstStruct.id.clock); - for (let i = startNewStructs + 1; i < structs.length; i++) { - structs[i].write(encoder, 0); - } -}; - -/** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {StructStore} store - * @param {Map} _sm - * - * @private - * @function - */ -const writeClientsStructs = (encoder, store, _sm) => { - // we filter all valid _sm entries into sm - const sm = new Map(); - _sm.forEach((clock, client) => { - // only write if new structs are available - if (getState(store, client) > clock) { - sm.set(client, clock); - } - }); - getStateVector(store).forEach((_clock, client) => { - if (!_sm.has(client)) { - sm.set(client, 0); - } - }); - // write # states that were updated - encoding__namespace.writeVarUint(encoder.restEncoder, sm.size); - // Write items with higher client ids first - // This heavily improves the conflict algorithm. - array__namespace.from(sm.entries()).sort((a, b) => b[0] - a[0]).forEach(([client, clock]) => { - writeStructs(encoder, /** @type {Array} */ (store.clients.get(client)), client, clock); - }); -}; - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder The decoder object to read data from. - * @param {Doc} doc - * @return {Map }>} - * - * @private - * @function - */ -const readClientsStructRefs = (decoder, doc) => { - /** - * @type {Map }>} - */ - const clientRefs = map__namespace.create(); - const numOfStateUpdates = decoding__namespace.readVarUint(decoder.restDecoder); - for (let i = 0; i < numOfStateUpdates; i++) { - const numberOfStructs = decoding__namespace.readVarUint(decoder.restDecoder); - /** - * @type {Array} - */ - const refs = new Array(numberOfStructs); - const client = decoder.readClient(); - let clock = decoding__namespace.readVarUint(decoder.restDecoder); - // const start = performance.now() - clientRefs.set(client, { i: 0, refs }); - for (let i = 0; i < numberOfStructs; i++) { - const info = decoder.readInfo(); - switch (binary__namespace.BITS5 & info) { - case 0: { // GC - const len = decoder.readLen(); - refs[i] = new GC(createID(client, clock), len); - clock += len; - break - } - case 10: { // Skip Struct (nothing to apply) - // @todo we could reduce the amount of checks by adding Skip struct to clientRefs so we know that something is missing. - const len = decoding__namespace.readVarUint(decoder.restDecoder); - refs[i] = new Skip(createID(client, clock), len); - clock += len; - break - } - default: { // Item with content - /** - * The optimized implementation doesn't use any variables because inlining variables is faster. - * Below a non-optimized version is shown that implements the basic algorithm with - * a few comments - */ - const cantCopyParentInfo = (info & (binary__namespace.BIT7 | binary__namespace.BIT8)) === 0; - // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y` - // and we read the next string as parentYKey. - // It indicates how we store/retrieve parent from `y.share` - // @type {string|null} - const struct = new Item( - createID(client, clock), - null, // left - (info & binary__namespace.BIT8) === binary__namespace.BIT8 ? decoder.readLeftID() : null, // origin - null, // right - (info & binary__namespace.BIT7) === binary__namespace.BIT7 ? decoder.readRightID() : null, // right origin - cantCopyParentInfo ? (decoder.readParentInfo() ? doc.get(decoder.readString()) : decoder.readLeftID()) : null, // parent - cantCopyParentInfo && (info & binary__namespace.BIT6) === binary__namespace.BIT6 ? decoder.readString() : null, // parentSub - readItemContent(decoder, info) // item content - ); - /* A non-optimized implementation of the above algorithm: - - // The item that was originally to the left of this item. - const origin = (info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null - // The item that was originally to the right of this item. - const rightOrigin = (info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null - const cantCopyParentInfo = (info & (binary.BIT7 | binary.BIT8)) === 0 - const hasParentYKey = cantCopyParentInfo ? decoder.readParentInfo() : false - // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y` - // and we read the next string as parentYKey. - // It indicates how we store/retrieve parent from `y.share` - // @type {string|null} - const parentYKey = cantCopyParentInfo && hasParentYKey ? decoder.readString() : null - - const struct = new Item( - createID(client, clock), - null, // left - origin, // origin - null, // right - rightOrigin, // right origin - cantCopyParentInfo && !hasParentYKey ? decoder.readLeftID() : (parentYKey !== null ? doc.get(parentYKey) : null), // parent - cantCopyParentInfo && (info & binary.BIT6) === binary.BIT6 ? decoder.readString() : null, // parentSub - readItemContent(decoder, info) // item content - ) - */ - refs[i] = struct; - clock += struct.length; - } - } - } - // console.log('time to read: ', performance.now() - start) // @todo remove - } - return clientRefs -}; - -/** - * Resume computing structs generated by struct readers. - * - * While there is something to do, we integrate structs in this order - * 1. top element on stack, if stack is not empty - * 2. next element from current struct reader (if empty, use next struct reader) - * - * If struct causally depends on another struct (ref.missing), we put next reader of - * `ref.id.client` on top of stack. - * - * At some point we find a struct that has no causal dependencies, - * then we start emptying the stack. - * - * It is not possible to have circles: i.e. struct1 (from client1) depends on struct2 (from client2) - * depends on struct3 (from client1). Therefore the max stack size is equal to `structReaders.length`. - * - * This method is implemented in a way so that we can resume computation if this update - * causally depends on another update. - * - * @param {Transaction} transaction - * @param {StructStore} store - * @param {Map} clientsStructRefs - * @return { null | { update: Uint8Array, missing: Map } } - * - * @private - * @function - */ -const integrateStructs = (transaction, store, clientsStructRefs) => { - /** - * @type {Array} - */ - const stack = []; - // sort them so that we take the higher id first, in case of conflicts the lower id will probably not conflict with the id from the higher user. - let clientsStructRefsIds = array__namespace.from(clientsStructRefs.keys()).sort((a, b) => a - b); - if (clientsStructRefsIds.length === 0) { - return null - } - const getNextStructTarget = () => { - if (clientsStructRefsIds.length === 0) { - return null - } - let nextStructsTarget = /** @type {{i:number,refs:Array}} */ (clientsStructRefs.get(clientsStructRefsIds[clientsStructRefsIds.length - 1])); - while (nextStructsTarget.refs.length === nextStructsTarget.i) { - clientsStructRefsIds.pop(); - if (clientsStructRefsIds.length > 0) { - nextStructsTarget = /** @type {{i:number,refs:Array}} */ (clientsStructRefs.get(clientsStructRefsIds[clientsStructRefsIds.length - 1])); - } else { - return null - } - } - return nextStructsTarget - }; - let curStructsTarget = getNextStructTarget(); - if (curStructsTarget === null) { - return null - } - - /** - * @type {StructStore} - */ - const restStructs = new StructStore(); - const missingSV = new Map(); - /** - * @param {number} client - * @param {number} clock - */ - const updateMissingSv = (client, clock) => { - const mclock = missingSV.get(client); - if (mclock == null || mclock > clock) { - missingSV.set(client, clock); - } - }; - /** - * @type {GC|Item} - */ - let stackHead = /** @type {any} */ (curStructsTarget).refs[/** @type {any} */ (curStructsTarget).i++]; - // caching the state because it is used very often - const state = new Map(); - - const addStackToRestSS = () => { - for (const item of stack) { - const client = item.id.client; - const inapplicableItems = clientsStructRefs.get(client); - if (inapplicableItems) { - // decrement because we weren't able to apply previous operation - inapplicableItems.i--; - restStructs.clients.set(client, inapplicableItems.refs.slice(inapplicableItems.i)); - clientsStructRefs.delete(client); - inapplicableItems.i = 0; - inapplicableItems.refs = []; - } else { - // item was the last item on clientsStructRefs and the field was already cleared. Add item to restStructs and continue - restStructs.clients.set(client, [item]); - } - // remove client from clientsStructRefsIds to prevent users from applying the same update again - clientsStructRefsIds = clientsStructRefsIds.filter(c => c !== client); - } - stack.length = 0; - }; - - // iterate over all struct readers until we are done - while (true) { - if (stackHead.constructor !== Skip) { - const localClock = map__namespace.setIfUndefined(state, stackHead.id.client, () => getState(store, stackHead.id.client)); - const offset = localClock - stackHead.id.clock; - if (offset < 0) { - // update from the same client is missing - stack.push(stackHead); - updateMissingSv(stackHead.id.client, stackHead.id.clock - 1); - // hid a dead wall, add all items from stack to restSS - addStackToRestSS(); - } else { - const missing = stackHead.getMissing(transaction, store); - if (missing !== null) { - stack.push(stackHead); - // get the struct reader that has the missing struct - /** - * @type {{ refs: Array, i: number }} - */ - const structRefs = clientsStructRefs.get(/** @type {number} */ (missing)) || { refs: [], i: 0 }; - if (structRefs.refs.length === structRefs.i) { - // This update message causally depends on another update message that doesn't exist yet - updateMissingSv(/** @type {number} */ (missing), getState(store, missing)); - addStackToRestSS(); - } else { - stackHead = structRefs.refs[structRefs.i++]; - continue - } - } else if (offset === 0 || offset < stackHead.length) { - // all fine, apply the stackhead - stackHead.integrate(transaction, offset); - state.set(stackHead.id.client, stackHead.id.clock + stackHead.length); - } - } - } - // iterate to next stackHead - if (stack.length > 0) { - stackHead = /** @type {GC|Item} */ (stack.pop()); - } else if (curStructsTarget !== null && curStructsTarget.i < curStructsTarget.refs.length) { - stackHead = /** @type {GC|Item} */ (curStructsTarget.refs[curStructsTarget.i++]); - } else { - curStructsTarget = getNextStructTarget(); - if (curStructsTarget === null) { - // we are done! - break - } else { - stackHead = /** @type {GC|Item} */ (curStructsTarget.refs[curStructsTarget.i++]); - } - } - } - if (restStructs.clients.size > 0) { - const encoder = new UpdateEncoderV2(); - writeClientsStructs(encoder, restStructs, new Map()); - // write empty deleteset - // writeDeleteSet(encoder, new DeleteSet()) - encoding__namespace.writeVarUint(encoder.restEncoder, 0); // => no need for an extra function call, just write 0 deletes - return { missing: missingSV, update: encoder.toUint8Array() } - } - return null -}; - -/** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {Transaction} transaction - * - * @private - * @function - */ -const writeStructsFromTransaction = (encoder, transaction) => writeClientsStructs(encoder, transaction.doc.store, transaction.beforeState); - -/** - * Read and apply a document update. - * - * This function has the same effect as `applyUpdate` but accepts a decoder. - * - * @param {decoding.Decoder} decoder - * @param {Doc} ydoc - * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))` - * @param {UpdateDecoderV1 | UpdateDecoderV2} [structDecoder] - * - * @function - */ -const readUpdateV2 = (decoder, ydoc, transactionOrigin, structDecoder = new UpdateDecoderV2(decoder)) => - transact(ydoc, transaction => { - // force that transaction.local is set to non-local - transaction.local = false; - let retry = false; - const doc = transaction.doc; - const store = doc.store; - // let start = performance.now() - const ss = readClientsStructRefs(structDecoder, doc); - // console.log('time to read structs: ', performance.now() - start) // @todo remove - // start = performance.now() - // console.log('time to merge: ', performance.now() - start) // @todo remove - // start = performance.now() - const restStructs = integrateStructs(transaction, store, ss); - const pending = store.pendingStructs; - if (pending) { - // check if we can apply something - for (const [client, clock] of pending.missing) { - if (clock < getState(store, client)) { - retry = true; - break - } - } - if (restStructs) { - // merge restStructs into store.pending - for (const [client, clock] of restStructs.missing) { - const mclock = pending.missing.get(client); - if (mclock == null || mclock > clock) { - pending.missing.set(client, clock); - } - } - pending.update = mergeUpdatesV2([pending.update, restStructs.update]); - } - } else { - store.pendingStructs = restStructs; - } - // console.log('time to integrate: ', performance.now() - start) // @todo remove - // start = performance.now() - const dsRest = readAndApplyDeleteSet(structDecoder, transaction, store); - if (store.pendingDs) { - // @todo we could make a lower-bound state-vector check as we do above - const pendingDSUpdate = new UpdateDecoderV2(decoding__namespace.createDecoder(store.pendingDs)); - decoding__namespace.readVarUint(pendingDSUpdate.restDecoder); // read 0 structs, because we only encode deletes in pendingdsupdate - const dsRest2 = readAndApplyDeleteSet(pendingDSUpdate, transaction, store); - if (dsRest && dsRest2) { - // case 1: ds1 != null && ds2 != null - store.pendingDs = mergeUpdatesV2([dsRest, dsRest2]); - } else { - // case 2: ds1 != null - // case 3: ds2 != null - // case 4: ds1 == null && ds2 == null - store.pendingDs = dsRest || dsRest2; - } - } else { - // Either dsRest == null && pendingDs == null OR dsRest != null - store.pendingDs = dsRest; - } - // console.log('time to cleanup: ', performance.now() - start) // @todo remove - // start = performance.now() - - // console.log('time to resume delete readers: ', performance.now() - start) // @todo remove - // start = performance.now() - if (retry) { - const update = /** @type {{update: Uint8Array}} */ (store.pendingStructs).update; - store.pendingStructs = null; - applyUpdateV2(transaction.doc, update); - } - }, transactionOrigin, false); - -/** - * Read and apply a document update. - * - * This function has the same effect as `applyUpdate` but accepts a decoder. - * - * @param {decoding.Decoder} decoder - * @param {Doc} ydoc - * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))` - * - * @function - */ -const readUpdate = (decoder, ydoc, transactionOrigin) => readUpdateV2(decoder, ydoc, transactionOrigin, new UpdateDecoderV1(decoder)); - -/** - * Apply a document update created by, for example, `y.on('update', update => ..)` or `update = encodeStateAsUpdate()`. - * - * This function has the same effect as `readUpdate` but accepts an Uint8Array instead of a Decoder. - * - * @param {Doc} ydoc - * @param {Uint8Array} update - * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))` - * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder] - * - * @function - */ -const applyUpdateV2 = (ydoc, update, transactionOrigin, YDecoder = UpdateDecoderV2) => { - const decoder = decoding__namespace.createDecoder(update); - readUpdateV2(decoder, ydoc, transactionOrigin, new YDecoder(decoder)); -}; - -/** - * Apply a document update created by, for example, `y.on('update', update => ..)` or `update = encodeStateAsUpdate()`. - * - * This function has the same effect as `readUpdate` but accepts an Uint8Array instead of a Decoder. - * - * @param {Doc} ydoc - * @param {Uint8Array} update - * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))` - * - * @function - */ -const applyUpdate = (ydoc, update, transactionOrigin) => applyUpdateV2(ydoc, update, transactionOrigin, UpdateDecoderV1); - -/** - * Write all the document as a single update message. If you specify the state of the remote client (`targetStateVector`) it will - * only write the operations that are missing. - * - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {Doc} doc - * @param {Map} [targetStateVector] The state of the target that receives the update. Leave empty to write all known structs - * - * @function - */ -const writeStateAsUpdate = (encoder, doc, targetStateVector = new Map()) => { - writeClientsStructs(encoder, doc.store, targetStateVector); - writeDeleteSet(encoder, createDeleteSetFromStructStore(doc.store)); -}; - -/** - * Write all the document as a single update message that can be applied on the remote document. If you specify the state of the remote client (`targetState`) it will - * only write the operations that are missing. - * - * Use `writeStateAsUpdate` instead if you are working with lib0/encoding.js#Encoder - * - * @param {Doc} doc - * @param {Uint8Array} [encodedTargetStateVector] The state of the target that receives the update. Leave empty to write all known structs - * @param {UpdateEncoderV1 | UpdateEncoderV2} [encoder] - * @return {Uint8Array} - * - * @function - */ -const encodeStateAsUpdateV2 = (doc, encodedTargetStateVector = new Uint8Array([0]), encoder = new UpdateEncoderV2()) => { - const targetStateVector = decodeStateVector(encodedTargetStateVector); - writeStateAsUpdate(encoder, doc, targetStateVector); - const updates = [encoder.toUint8Array()]; - // also add the pending updates (if there are any) - if (doc.store.pendingDs) { - updates.push(doc.store.pendingDs); - } - if (doc.store.pendingStructs) { - updates.push(diffUpdateV2(doc.store.pendingStructs.update, encodedTargetStateVector)); - } - if (updates.length > 1) { - if (encoder.constructor === UpdateEncoderV1) { - return mergeUpdates(updates.map((update, i) => i === 0 ? update : convertUpdateFormatV2ToV1(update))) - } else if (encoder.constructor === UpdateEncoderV2) { - return mergeUpdatesV2(updates) - } - } - return updates[0] -}; - -/** - * Write all the document as a single update message that can be applied on the remote document. If you specify the state of the remote client (`targetState`) it will - * only write the operations that are missing. - * - * Use `writeStateAsUpdate` instead if you are working with lib0/encoding.js#Encoder - * - * @param {Doc} doc - * @param {Uint8Array} [encodedTargetStateVector] The state of the target that receives the update. Leave empty to write all known structs - * @return {Uint8Array} - * - * @function - */ -const encodeStateAsUpdate = (doc, encodedTargetStateVector) => encodeStateAsUpdateV2(doc, encodedTargetStateVector, new UpdateEncoderV1()); - -/** - * Read state vector from Decoder and return as Map - * - * @param {DSDecoderV1 | DSDecoderV2} decoder - * @return {Map} Maps `client` to the number next expected `clock` from that client. - * - * @function - */ -const readStateVector = decoder => { - const ss = new Map(); - const ssLength = decoding__namespace.readVarUint(decoder.restDecoder); - for (let i = 0; i < ssLength; i++) { - const client = decoding__namespace.readVarUint(decoder.restDecoder); - const clock = decoding__namespace.readVarUint(decoder.restDecoder); - ss.set(client, clock); - } - return ss -}; - -/** - * Read decodedState and return State as Map. - * - * @param {Uint8Array} decodedState - * @return {Map} Maps `client` to the number next expected `clock` from that client. - * - * @function - */ -// export const decodeStateVectorV2 = decodedState => readStateVector(new DSDecoderV2(decoding.createDecoder(decodedState))) - -/** - * Read decodedState and return State as Map. - * - * @param {Uint8Array} decodedState - * @return {Map} Maps `client` to the number next expected `clock` from that client. - * - * @function - */ -const decodeStateVector = decodedState => readStateVector(new DSDecoderV1(decoding__namespace.createDecoder(decodedState))); - -/** - * @param {DSEncoderV1 | DSEncoderV2} encoder - * @param {Map} sv - * @function - */ -const writeStateVector = (encoder, sv) => { - encoding__namespace.writeVarUint(encoder.restEncoder, sv.size); - array__namespace.from(sv.entries()).sort((a, b) => b[0] - a[0]).forEach(([client, clock]) => { - encoding__namespace.writeVarUint(encoder.restEncoder, client); // @todo use a special client decoder that is based on mapping - encoding__namespace.writeVarUint(encoder.restEncoder, clock); - }); - return encoder -}; - -/** - * @param {DSEncoderV1 | DSEncoderV2} encoder - * @param {Doc} doc - * - * @function - */ -const writeDocumentStateVector = (encoder, doc) => writeStateVector(encoder, getStateVector(doc.store)); - -/** - * Encode State as Uint8Array. - * - * @param {Doc|Map} doc - * @param {DSEncoderV1 | DSEncoderV2} [encoder] - * @return {Uint8Array} - * - * @function - */ -const encodeStateVectorV2 = (doc, encoder = new DSEncoderV2()) => { - if (doc instanceof Map) { - writeStateVector(encoder, doc); - } else { - writeDocumentStateVector(encoder, doc); - } - return encoder.toUint8Array() -}; - -/** - * Encode State as Uint8Array. - * - * @param {Doc|Map} doc - * @return {Uint8Array} - * - * @function - */ -const encodeStateVector = doc => encodeStateVectorV2(doc, new DSEncoderV1()); - -/** - * General event handler implementation. - * - * @template ARG0, ARG1 - * - * @private - */ -class EventHandler { - constructor () { - /** - * @type {Array} - */ - this.l = []; - } -} - -/** - * @template ARG0,ARG1 - * @returns {EventHandler} - * - * @private - * @function - */ -const createEventHandler = () => new EventHandler(); - -/** - * Adds an event listener that is called when - * {@link EventHandler#callEventListeners} is called. - * - * @template ARG0,ARG1 - * @param {EventHandler} eventHandler - * @param {function(ARG0,ARG1):void} f The event handler. - * - * @private - * @function - */ -const addEventHandlerListener = (eventHandler, f) => - eventHandler.l.push(f); - -/** - * Removes an event listener. - * - * @template ARG0,ARG1 - * @param {EventHandler} eventHandler - * @param {function(ARG0,ARG1):void} f The event handler that was added with - * {@link EventHandler#addEventListener} - * - * @private - * @function - */ -const removeEventHandlerListener = (eventHandler, f) => { - const l = eventHandler.l; - const len = l.length; - eventHandler.l = l.filter(g => f !== g); - if (len === eventHandler.l.length) { - console.error('[yjs] Tried to remove event handler that doesn\'t exist.'); - } -}; - -/** - * Call all event listeners that were added via - * {@link EventHandler#addEventListener}. - * - * @template ARG0,ARG1 - * @param {EventHandler} eventHandler - * @param {ARG0} arg0 - * @param {ARG1} arg1 - * - * @private - * @function - */ -const callEventHandlerListeners = (eventHandler, arg0, arg1) => - f__namespace.callAll(eventHandler.l, [arg0, arg1]); - -class ID { - /** - * @param {number} client client id - * @param {number} clock unique per client id, continuous number - */ - constructor (client, clock) { - /** - * Client id - * @type {number} - */ - this.client = client; - /** - * unique per client id, continuous number - * @type {number} - */ - this.clock = clock; - } -} - -/** - * @param {ID | null} a - * @param {ID | null} b - * @return {boolean} - * - * @function - */ -const compareIDs = (a, b) => a === b || (a !== null && b !== null && a.client === b.client && a.clock === b.clock); - -/** - * @param {number} client - * @param {number} clock - * - * @private - * @function - */ -const createID = (client, clock) => new ID(client, clock); - -/** - * @param {encoding.Encoder} encoder - * @param {ID} id - * - * @private - * @function - */ -const writeID = (encoder, id) => { - encoding__namespace.writeVarUint(encoder, id.client); - encoding__namespace.writeVarUint(encoder, id.clock); -}; - -/** - * Read ID. - * * If first varUint read is 0xFFFFFF a RootID is returned. - * * Otherwise an ID is returned - * - * @param {decoding.Decoder} decoder - * @return {ID} - * - * @private - * @function - */ -const readID = decoder => - createID(decoding__namespace.readVarUint(decoder), decoding__namespace.readVarUint(decoder)); - -/** - * The top types are mapped from y.share.get(keyname) => type. - * `type` does not store any information about the `keyname`. - * This function finds the correct `keyname` for `type` and throws otherwise. - * - * @param {AbstractType} type - * @return {string} - * - * @private - * @function - */ -const findRootTypeKey = type => { - // @ts-ignore _y must be defined, otherwise unexpected case - for (const [key, value] of type.doc.share.entries()) { - if (value === type) { - return key - } - } - throw error__namespace.unexpectedCase() -}; - -/** - * Check if `parent` is a parent of `child`. - * - * @param {AbstractType} parent - * @param {Item|null} child - * @return {Boolean} Whether `parent` is a parent of `child`. - * - * @private - * @function - */ -const isParentOf = (parent, child) => { - while (child !== null) { - if (child.parent === parent) { - return true - } - child = /** @type {AbstractType} */ (child.parent)._item; - } - return false -}; - -/** - * Convenient helper to log type information. - * - * Do not use in productive systems as the output can be immense! - * - * @param {AbstractType} type - */ -const logType = type => { - const res = []; - let n = type._start; - while (n) { - res.push(n); - n = n.right; - } - console.log('Children: ', res); - console.log('Children content: ', res.filter(m => !m.deleted).map(m => m.content)); -}; - -class PermanentUserData { - /** - * @param {Doc} doc - * @param {YMap} [storeType] - */ - constructor (doc, storeType = doc.getMap('users')) { - /** - * @type {Map} - */ - const dss = new Map(); - this.yusers = storeType; - this.doc = doc; - /** - * Maps from clientid to userDescription - * - * @type {Map} - */ - this.clients = new Map(); - this.dss = dss; - /** - * @param {YMap} user - * @param {string} userDescription - */ - const initUser = (user, userDescription) => { - /** - * @type {YArray} - */ - const ds = user.get('ds'); - const ids = user.get('ids'); - const addClientId = /** @param {number} clientid */ clientid => this.clients.set(clientid, userDescription); - ds.observe(/** @param {YArrayEvent} event */ event => { - event.changes.added.forEach(item => { - item.content.getContent().forEach(encodedDs => { - if (encodedDs instanceof Uint8Array) { - this.dss.set(userDescription, mergeDeleteSets([this.dss.get(userDescription) || createDeleteSet(), readDeleteSet(new DSDecoderV1(decoding__namespace.createDecoder(encodedDs)))])); - } - }); - }); - }); - this.dss.set(userDescription, mergeDeleteSets(ds.map(encodedDs => readDeleteSet(new DSDecoderV1(decoding__namespace.createDecoder(encodedDs)))))); - ids.observe(/** @param {YArrayEvent} event */ event => - event.changes.added.forEach(item => item.content.getContent().forEach(addClientId)) - ); - ids.forEach(addClientId); - }; - // observe users - storeType.observe(event => { - event.keysChanged.forEach(userDescription => - initUser(storeType.get(userDescription), userDescription) - ); - }); - // add initial data - storeType.forEach(initUser); - } - - /** - * @param {Doc} doc - * @param {number} clientid - * @param {string} userDescription - * @param {Object} conf - * @param {function(Transaction, DeleteSet):boolean} [conf.filter] - */ - setUserMapping (doc, clientid, userDescription, { filter = () => true } = {}) { - const users = this.yusers; - let user = users.get(userDescription); - if (!user) { - user = new YMap(); - user.set('ids', new YArray()); - user.set('ds', new YArray()); - users.set(userDescription, user); - } - user.get('ids').push([clientid]); - users.observe(_event => { - setTimeout(() => { - const userOverwrite = users.get(userDescription); - if (userOverwrite !== user) { - // user was overwritten, port all data over to the next user object - // @todo Experiment with Y.Sets here - user = userOverwrite; - // @todo iterate over old type - this.clients.forEach((_userDescription, clientid) => { - if (userDescription === _userDescription) { - user.get('ids').push([clientid]); - } - }); - const encoder = new DSEncoderV1(); - const ds = this.dss.get(userDescription); - if (ds) { - writeDeleteSet(encoder, ds); - user.get('ds').push([encoder.toUint8Array()]); - } - } - }, 0); - }); - doc.on('afterTransaction', /** @param {Transaction} transaction */ transaction => { - setTimeout(() => { - const yds = user.get('ds'); - const ds = transaction.deleteSet; - if (transaction.local && ds.clients.size > 0 && filter(transaction, ds)) { - const encoder = new DSEncoderV1(); - writeDeleteSet(encoder, ds); - yds.push([encoder.toUint8Array()]); - } - }); - }); - } - - /** - * @param {number} clientid - * @return {any} - */ - getUserByClientId (clientid) { - return this.clients.get(clientid) || null - } - - /** - * @param {ID} id - * @return {string | null} - */ - getUserByDeletedId (id) { - for (const [userDescription, ds] of this.dss.entries()) { - if (isDeleted(ds, id)) { - return userDescription - } - } - return null - } -} - -/** - * A relative position is based on the Yjs model and is not affected by document changes. - * E.g. If you place a relative position before a certain character, it will always point to this character. - * If you place a relative position at the end of a type, it will always point to the end of the type. - * - * A numeric position is often unsuited for user selections, because it does not change when content is inserted - * before or after. - * - * ```Insert(0, 'x')('a|bc') = 'xa|bc'``` Where | is the relative position. - * - * One of the properties must be defined. - * - * @example - * // Current cursor position is at position 10 - * const relativePosition = createRelativePositionFromIndex(yText, 10) - * // modify yText - * yText.insert(0, 'abc') - * yText.delete(3, 10) - * // Compute the cursor position - * const absolutePosition = createAbsolutePositionFromRelativePosition(y, relativePosition) - * absolutePosition.type === yText // => true - * console.log('cursor location is ' + absolutePosition.index) // => cursor location is 3 - * - */ -class RelativePosition { - /** - * @param {ID|null} type - * @param {string|null} tname - * @param {ID|null} item - * @param {number} assoc - */ - constructor (type, tname, item, assoc = 0) { - /** - * @type {ID|null} - */ - this.type = type; - /** - * @type {string|null} - */ - this.tname = tname; - /** - * @type {ID | null} - */ - this.item = item; - /** - * A relative position is associated to a specific character. By default - * assoc >= 0, the relative position is associated to the character - * after the meant position. - * I.e. position 1 in 'ab' is associated to character 'b'. - * - * If assoc < 0, then the relative position is associated to the character - * before the meant position. - * - * @type {number} - */ - this.assoc = assoc; - } -} - -/** - * @param {RelativePosition} rpos - * @return {any} - */ -const relativePositionToJSON = rpos => { - const json = {}; - if (rpos.type) { - json.type = rpos.type; - } - if (rpos.tname) { - json.tname = rpos.tname; - } - if (rpos.item) { - json.item = rpos.item; - } - if (rpos.assoc != null) { - json.assoc = rpos.assoc; - } - return json -}; - -/** - * @param {any} json - * @return {RelativePosition} - * - * @function - */ -const createRelativePositionFromJSON = json => new RelativePosition(json.type == null ? null : createID(json.type.client, json.type.clock), json.tname ?? null, json.item == null ? null : createID(json.item.client, json.item.clock), json.assoc == null ? 0 : json.assoc); - -class AbsolutePosition { - /** - * @param {AbstractType} type - * @param {number} index - * @param {number} [assoc] - */ - constructor (type, index, assoc = 0) { - /** - * @type {AbstractType} - */ - this.type = type; - /** - * @type {number} - */ - this.index = index; - this.assoc = assoc; - } -} - -/** - * @param {AbstractType} type - * @param {number} index - * @param {number} [assoc] - * - * @function - */ -const createAbsolutePosition = (type, index, assoc = 0) => new AbsolutePosition(type, index, assoc); - -/** - * @param {AbstractType} type - * @param {ID|null} item - * @param {number} [assoc] - * - * @function - */ -const createRelativePosition = (type, item, assoc) => { - let typeid = null; - let tname = null; - if (type._item === null) { - tname = findRootTypeKey(type); - } else { - typeid = createID(type._item.id.client, type._item.id.clock); - } - return new RelativePosition(typeid, tname, item, assoc) -}; - -/** - * Create a relativePosition based on a absolute position. - * - * @param {AbstractType} type The base type (e.g. YText or YArray). - * @param {number} index The absolute position. - * @param {number} [assoc] - * @return {RelativePosition} - * - * @function - */ -const createRelativePositionFromTypeIndex = (type, index, assoc = 0) => { - let t = type._start; - if (assoc < 0) { - // associated to the left character or the beginning of a type, increment index if possible. - if (index === 0) { - return createRelativePosition(type, null, assoc) - } - index--; - } - while (t !== null) { - if (!t.deleted && t.countable) { - if (t.length > index) { - // case 1: found position somewhere in the linked list - return createRelativePosition(type, createID(t.id.client, t.id.clock + index), assoc) - } - index -= t.length; - } - if (t.right === null && assoc < 0) { - // left-associated position, return last available id - return createRelativePosition(type, t.lastId, assoc) - } - t = t.right; - } - return createRelativePosition(type, null, assoc) -}; - -/** - * @param {encoding.Encoder} encoder - * @param {RelativePosition} rpos - * - * @function - */ -const writeRelativePosition = (encoder, rpos) => { - const { type, tname, item, assoc } = rpos; - if (item !== null) { - encoding__namespace.writeVarUint(encoder, 0); - writeID(encoder, item); - } else if (tname !== null) { - // case 2: found position at the end of the list and type is stored in y.share - encoding__namespace.writeUint8(encoder, 1); - encoding__namespace.writeVarString(encoder, tname); - } else if (type !== null) { - // case 3: found position at the end of the list and type is attached to an item - encoding__namespace.writeUint8(encoder, 2); - writeID(encoder, type); - } else { - throw error__namespace.unexpectedCase() - } - encoding__namespace.writeVarInt(encoder, assoc); - return encoder -}; - -/** - * @param {RelativePosition} rpos - * @return {Uint8Array} - */ -const encodeRelativePosition = rpos => { - const encoder = encoding__namespace.createEncoder(); - writeRelativePosition(encoder, rpos); - return encoding__namespace.toUint8Array(encoder) -}; - -/** - * @param {decoding.Decoder} decoder - * @return {RelativePosition} - * - * @function - */ -const readRelativePosition = decoder => { - let type = null; - let tname = null; - let itemID = null; - switch (decoding__namespace.readVarUint(decoder)) { - case 0: - // case 1: found position somewhere in the linked list - itemID = readID(decoder); - break - case 1: - // case 2: found position at the end of the list and type is stored in y.share - tname = decoding__namespace.readVarString(decoder); - break - case 2: { - // case 3: found position at the end of the list and type is attached to an item - type = readID(decoder); - } - } - const assoc = decoding__namespace.hasContent(decoder) ? decoding__namespace.readVarInt(decoder) : 0; - return new RelativePosition(type, tname, itemID, assoc) -}; - -/** - * @param {Uint8Array} uint8Array - * @return {RelativePosition} - */ -const decodeRelativePosition = uint8Array => readRelativePosition(decoding__namespace.createDecoder(uint8Array)); - -/** - * @param {StructStore} store - * @param {ID} id - */ -const getItemWithOffset = (store, id) => { - const item = getItem(store, id); - const diff = id.clock - item.id.clock; - return { - item, diff - } -}; - -/** - * Transform a relative position to an absolute position. - * - * If you want to share the relative position with other users, you should set - * `followUndoneDeletions` to false to get consistent results across all clients. - * - * When calculating the absolute position, we try to follow the "undone deletions". This yields - * better results for the user who performed undo. However, only the user who performed the undo - * will get the better results, the other users don't know which operations recreated a deleted - * range of content. There is more information in this ticket: https://github.com/yjs/yjs/issues/638 - * - * @param {RelativePosition} rpos - * @param {Doc} doc - * @param {boolean} followUndoneDeletions - whether to follow undone deletions - see https://github.com/yjs/yjs/issues/638 - * @return {AbsolutePosition|null} - * - * @function - */ -const createAbsolutePositionFromRelativePosition = (rpos, doc, followUndoneDeletions = true) => { - const store = doc.store; - const rightID = rpos.item; - const typeID = rpos.type; - const tname = rpos.tname; - const assoc = rpos.assoc; - let type = null; - let index = 0; - if (rightID !== null) { - if (getState(store, rightID.client) <= rightID.clock) { - return null - } - const res = followUndoneDeletions ? followRedone(store, rightID) : getItemWithOffset(store, rightID); - const right = res.item; - if (!(right instanceof Item)) { - return null - } - type = /** @type {AbstractType} */ (right.parent); - if (type._item === null || !type._item.deleted) { - index = (right.deleted || !right.countable) ? 0 : (res.diff + (assoc >= 0 ? 0 : 1)); // adjust position based on left association if necessary - let n = right.left; - while (n !== null) { - if (!n.deleted && n.countable) { - index += n.length; - } - n = n.left; - } - } - } else { - if (tname !== null) { - type = doc.get(tname); - } else if (typeID !== null) { - if (getState(store, typeID.client) <= typeID.clock) { - // type does not exist yet - return null - } - const { item } = followUndoneDeletions ? followRedone(store, typeID) : { item: getItem(store, typeID) }; - if (item instanceof Item && item.content instanceof ContentType) { - type = item.content.type; - } else { - // struct is garbage collected - return null - } - } else { - throw error__namespace.unexpectedCase() - } - if (assoc >= 0) { - index = type._length; - } else { - index = 0; - } - } - return createAbsolutePosition(type, index, rpos.assoc) -}; - -/** - * @param {RelativePosition|null} a - * @param {RelativePosition|null} b - * @return {boolean} - * - * @function - */ -const compareRelativePositions = (a, b) => a === b || ( - a !== null && b !== null && a.tname === b.tname && compareIDs(a.item, b.item) && compareIDs(a.type, b.type) && a.assoc === b.assoc -); - -class Snapshot { - /** - * @param {DeleteSet} ds - * @param {Map} sv state map - */ - constructor (ds, sv) { - /** - * @type {DeleteSet} - */ - this.ds = ds; - /** - * State Map - * @type {Map} - */ - this.sv = sv; - } -} - -/** - * @param {Snapshot} snap1 - * @param {Snapshot} snap2 - * @return {boolean} - */ -const equalSnapshots = (snap1, snap2) => { - const ds1 = snap1.ds.clients; - const ds2 = snap2.ds.clients; - const sv1 = snap1.sv; - const sv2 = snap2.sv; - if (sv1.size !== sv2.size || ds1.size !== ds2.size) { - return false - } - for (const [key, value] of sv1.entries()) { - if (sv2.get(key) !== value) { - return false - } - } - for (const [client, dsitems1] of ds1.entries()) { - const dsitems2 = ds2.get(client) || []; - if (dsitems1.length !== dsitems2.length) { - return false - } - for (let i = 0; i < dsitems1.length; i++) { - const dsitem1 = dsitems1[i]; - const dsitem2 = dsitems2[i]; - if (dsitem1.clock !== dsitem2.clock || dsitem1.len !== dsitem2.len) { - return false - } - } - } - return true -}; - -/** - * @param {Snapshot} snapshot - * @param {DSEncoderV1 | DSEncoderV2} [encoder] - * @return {Uint8Array} - */ -const encodeSnapshotV2 = (snapshot, encoder = new DSEncoderV2()) => { - writeDeleteSet(encoder, snapshot.ds); - writeStateVector(encoder, snapshot.sv); - return encoder.toUint8Array() -}; - -/** - * @param {Snapshot} snapshot - * @return {Uint8Array} - */ -const encodeSnapshot = snapshot => encodeSnapshotV2(snapshot, new DSEncoderV1()); - -/** - * @param {Uint8Array} buf - * @param {DSDecoderV1 | DSDecoderV2} [decoder] - * @return {Snapshot} - */ -const decodeSnapshotV2 = (buf, decoder = new DSDecoderV2(decoding__namespace.createDecoder(buf))) => { - return new Snapshot(readDeleteSet(decoder), readStateVector(decoder)) -}; - -/** - * @param {Uint8Array} buf - * @return {Snapshot} - */ -const decodeSnapshot = buf => decodeSnapshotV2(buf, new DSDecoderV1(decoding__namespace.createDecoder(buf))); - -/** - * @param {DeleteSet} ds - * @param {Map} sm - * @return {Snapshot} - */ -const createSnapshot = (ds, sm) => new Snapshot(ds, sm); - -const emptySnapshot = createSnapshot(createDeleteSet(), new Map()); - -/** - * @param {Doc} doc - * @return {Snapshot} - */ -const snapshot = doc => createSnapshot(createDeleteSetFromStructStore(doc.store), getStateVector(doc.store)); - -/** - * @param {Item} item - * @param {Snapshot|undefined} snapshot - * - * @protected - * @function - */ -const isVisible = (item, snapshot) => snapshot === undefined - ? !item.deleted - : snapshot.sv.has(item.id.client) && (snapshot.sv.get(item.id.client) || 0) > item.id.clock && !isDeleted(snapshot.ds, item.id); - -/** - * @param {Transaction} transaction - * @param {Snapshot} snapshot - */ -const splitSnapshotAffectedStructs = (transaction, snapshot) => { - const meta = map__namespace.setIfUndefined(transaction.meta, splitSnapshotAffectedStructs, set__namespace.create); - const store = transaction.doc.store; - // check if we already split for this snapshot - if (!meta.has(snapshot)) { - snapshot.sv.forEach((clock, client) => { - if (clock < getState(store, client)) { - getItemCleanStart(transaction, createID(client, clock)); - } - }); - iterateDeletedStructs(transaction, snapshot.ds, _item => {}); - meta.add(snapshot); - } -}; - -/** - * @example - * const ydoc = new Y.Doc({ gc: false }) - * ydoc.getText().insert(0, 'world!') - * const snapshot = Y.snapshot(ydoc) - * ydoc.getText().insert(0, 'hello ') - * const restored = Y.createDocFromSnapshot(ydoc, snapshot) - * assert(restored.getText().toString() === 'world!') - * - * @param {Doc} originDoc - * @param {Snapshot} snapshot - * @param {Doc} [newDoc] Optionally, you may define the Yjs document that receives the data from originDoc - * @return {Doc} - */ -const createDocFromSnapshot = (originDoc, snapshot, newDoc = new Doc()) => { - if (originDoc.gc) { - // we should not try to restore a GC-ed document, because some of the restored items might have their content deleted - throw new Error('Garbage-collection must be disabled in `originDoc`!') - } - const { sv, ds } = snapshot; - - const encoder = new UpdateEncoderV2(); - originDoc.transact(transaction => { - let size = 0; - sv.forEach(clock => { - if (clock > 0) { - size++; - } - }); - encoding__namespace.writeVarUint(encoder.restEncoder, size); - // splitting the structs before writing them to the encoder - for (const [client, clock] of sv) { - if (clock === 0) { - continue - } - if (clock < getState(originDoc.store, client)) { - getItemCleanStart(transaction, createID(client, clock)); - } - const structs = originDoc.store.clients.get(client) || []; - const lastStructIndex = findIndexSS(structs, clock - 1); - // write # encoded structs - encoding__namespace.writeVarUint(encoder.restEncoder, lastStructIndex + 1); - encoder.writeClient(client); - // first clock written is 0 - encoding__namespace.writeVarUint(encoder.restEncoder, 0); - for (let i = 0; i <= lastStructIndex; i++) { - structs[i].write(encoder, 0); - } - } - writeDeleteSet(encoder, ds); - }); - - applyUpdateV2(newDoc, encoder.toUint8Array(), 'snapshot'); - return newDoc -}; - -/** - * @param {Snapshot} snapshot - * @param {Uint8Array} update - * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder] - */ -const snapshotContainsUpdateV2 = (snapshot, update, YDecoder = UpdateDecoderV2) => { - const updateDecoder = new YDecoder(decoding__namespace.createDecoder(update)); - const lazyDecoder = new LazyStructReader(updateDecoder, false); - for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) { - if ((snapshot.sv.get(curr.id.client) || 0) < curr.id.clock + curr.length) { - return false - } - } - const mergedDS = mergeDeleteSets([snapshot.ds, readDeleteSet(updateDecoder)]); - return equalDeleteSets(snapshot.ds, mergedDS) -}; - -/** - * @param {Snapshot} snapshot - * @param {Uint8Array} update - */ -const snapshotContainsUpdate = (snapshot, update) => snapshotContainsUpdateV2(snapshot, update, UpdateDecoderV1); - -class StructStore { - constructor () { - /** - * @type {Map>} - */ - this.clients = new Map(); - /** - * @type {null | { missing: Map, update: Uint8Array }} - */ - this.pendingStructs = null; - /** - * @type {null | Uint8Array} - */ - this.pendingDs = null; - } -} - -/** - * Return the states as a Map. - * Note that clock refers to the next expected clock id. - * - * @param {StructStore} store - * @return {Map} - * - * @public - * @function - */ -const getStateVector = store => { - const sm = new Map(); - store.clients.forEach((structs, client) => { - const struct = structs[structs.length - 1]; - sm.set(client, struct.id.clock + struct.length); - }); - return sm -}; - -/** - * @param {StructStore} store - * @param {number} client - * @return {number} - * - * @public - * @function - */ -const getState = (store, client) => { - const structs = store.clients.get(client); - if (structs === undefined) { - return 0 - } - const lastStruct = structs[structs.length - 1]; - return lastStruct.id.clock + lastStruct.length -}; - -/** - * @param {StructStore} store - * @param {GC|Item} struct - * - * @private - * @function - */ -const addStruct = (store, struct) => { - let structs = store.clients.get(struct.id.client); - if (structs === undefined) { - structs = []; - store.clients.set(struct.id.client, structs); - } else { - const lastStruct = structs[structs.length - 1]; - if (lastStruct.id.clock + lastStruct.length !== struct.id.clock) { - throw error__namespace.unexpectedCase() - } - } - structs.push(struct); -}; - -/** - * Perform a binary search on a sorted array - * @param {Array} structs - * @param {number} clock - * @return {number} - * - * @private - * @function - */ -const findIndexSS = (structs, clock) => { - let left = 0; - let right = structs.length - 1; - let mid = structs[right]; - let midclock = mid.id.clock; - if (midclock === clock) { - return right - } - // @todo does it even make sense to pivot the search? - // If a good split misses, it might actually increase the time to find the correct item. - // Currently, the only advantage is that search with pivoting might find the item on the first try. - let midindex = math__namespace.floor((clock / (midclock + mid.length - 1)) * right); // pivoting the search - while (left <= right) { - mid = structs[midindex]; - midclock = mid.id.clock; - if (midclock <= clock) { - if (clock < midclock + mid.length) { - return midindex - } - left = midindex + 1; - } else { - right = midindex - 1; - } - midindex = math__namespace.floor((left + right) / 2); - } - // Always check state before looking for a struct in StructStore - // Therefore the case of not finding a struct is unexpected - throw error__namespace.unexpectedCase() -}; - -/** - * Expects that id is actually in store. This function throws or is an infinite loop otherwise. - * - * @param {StructStore} store - * @param {ID} id - * @return {GC|Item} - * - * @private - * @function - */ -const find = (store, id) => { - /** - * @type {Array} - */ - // @ts-ignore - const structs = store.clients.get(id.client); - return structs[findIndexSS(structs, id.clock)] -}; - -/** - * Expects that id is actually in store. This function throws or is an infinite loop otherwise. - * @private - * @function - */ -const getItem = /** @type {function(StructStore,ID):Item} */ (find); - -/** - * @param {Transaction} transaction - * @param {Array} structs - * @param {number} clock - */ -const findIndexCleanStart = (transaction, structs, clock) => { - const index = findIndexSS(structs, clock); - const struct = structs[index]; - if (struct.id.clock < clock && struct instanceof Item) { - structs.splice(index + 1, 0, splitItem(transaction, struct, clock - struct.id.clock)); - return index + 1 - } - return index -}; - -/** - * Expects that id is actually in store. This function throws or is an infinite loop otherwise. - * - * @param {Transaction} transaction - * @param {ID} id - * @return {Item} - * - * @private - * @function - */ -const getItemCleanStart = (transaction, id) => { - const structs = /** @type {Array} */ (transaction.doc.store.clients.get(id.client)); - return structs[findIndexCleanStart(transaction, structs, id.clock)] -}; - -/** - * Expects that id is actually in store. This function throws or is an infinite loop otherwise. - * - * @param {Transaction} transaction - * @param {StructStore} store - * @param {ID} id - * @return {Item} - * - * @private - * @function - */ -const getItemCleanEnd = (transaction, store, id) => { - /** - * @type {Array} - */ - // @ts-ignore - const structs = store.clients.get(id.client); - const index = findIndexSS(structs, id.clock); - const struct = structs[index]; - if (id.clock !== struct.id.clock + struct.length - 1 && struct.constructor !== GC) { - structs.splice(index + 1, 0, splitItem(transaction, struct, id.clock - struct.id.clock + 1)); - } - return struct -}; - -/** - * Replace `item` with `newitem` in store - * @param {StructStore} store - * @param {GC|Item} struct - * @param {GC|Item} newStruct - * - * @private - * @function - */ -const replaceStruct = (store, struct, newStruct) => { - const structs = /** @type {Array} */ (store.clients.get(struct.id.client)); - structs[findIndexSS(structs, struct.id.clock)] = newStruct; -}; - -/** - * Iterate over a range of structs - * - * @param {Transaction} transaction - * @param {Array} structs - * @param {number} clockStart Inclusive start - * @param {number} len - * @param {function(GC|Item):void} f - * - * @function - */ -const iterateStructs = (transaction, structs, clockStart, len, f) => { - if (len === 0) { - return - } - const clockEnd = clockStart + len; - let index = findIndexCleanStart(transaction, structs, clockStart); - let struct; - do { - struct = structs[index++]; - if (clockEnd < struct.id.clock + struct.length) { - findIndexCleanStart(transaction, structs, clockEnd); - } - f(struct); - } while (index < structs.length && structs[index].id.clock < clockEnd) -}; - -/** - * A transaction is created for every change on the Yjs model. It is possible - * to bundle changes on the Yjs model in a single transaction to - * minimize the number on messages sent and the number of observer calls. - * If possible the user of this library should bundle as many changes as - * possible. Here is an example to illustrate the advantages of bundling: - * - * @example - * const ydoc = new Y.Doc() - * const map = ydoc.getMap('map') - * // Log content when change is triggered - * map.observe(() => { - * console.log('change triggered') - * }) - * // Each change on the map type triggers a log message: - * map.set('a', 0) // => "change triggered" - * map.set('b', 0) // => "change triggered" - * // When put in a transaction, it will trigger the log after the transaction: - * ydoc.transact(() => { - * map.set('a', 1) - * map.set('b', 1) - * }) // => "change triggered" - * - * @public - */ -class Transaction { - /** - * @param {Doc} doc - * @param {any} origin - * @param {boolean} local - */ - constructor (doc, origin, local) { - /** - * The Yjs instance. - * @type {Doc} - */ - this.doc = doc; - /** - * Describes the set of deleted items by ids - * @type {DeleteSet} - */ - this.deleteSet = new DeleteSet(); - /** - * Holds the state before the transaction started. - * @type {Map} - */ - this.beforeState = getStateVector(doc.store); - /** - * Holds the state after the transaction. - * @type {Map} - */ - this.afterState = new Map(); - /** - * All types that were directly modified (property added or child - * inserted/deleted). New types are not included in this Set. - * Maps from type to parentSubs (`item.parentSub = null` for YArray) - * @type {Map>,Set>} - */ - this.changed = new Map(); - /** - * Stores the events for the types that observe also child elements. - * It is mainly used by `observeDeep`. - * @type {Map>,Array>>} - */ - this.changedParentTypes = new Map(); - /** - * @type {Array} - */ - this._mergeStructs = []; - /** - * @type {any} - */ - this.origin = origin; - /** - * Stores meta information on the transaction - * @type {Map} - */ - this.meta = new Map(); - /** - * Whether this change originates from this doc. - * @type {boolean} - */ - this.local = local; - /** - * @type {Set} - */ - this.subdocsAdded = new Set(); - /** - * @type {Set} - */ - this.subdocsRemoved = new Set(); - /** - * @type {Set} - */ - this.subdocsLoaded = new Set(); - /** - * @type {boolean} - */ - this._needFormattingCleanup = false; - } -} - -/** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {Transaction} transaction - * @return {boolean} Whether data was written. - */ -const writeUpdateMessageFromTransaction = (encoder, transaction) => { - if (transaction.deleteSet.clients.size === 0 && !map__namespace.any(transaction.afterState, (clock, client) => transaction.beforeState.get(client) !== clock)) { - return false - } - sortAndMergeDeleteSet(transaction.deleteSet); - writeStructsFromTransaction(encoder, transaction); - writeDeleteSet(encoder, transaction.deleteSet); - return true -}; - -/** - * If `type.parent` was added in current transaction, `type` technically - * did not change, it was just added and we should not fire events for `type`. - * - * @param {Transaction} transaction - * @param {AbstractType>} type - * @param {string|null} parentSub - */ -const addChangedTypeToTransaction = (transaction, type, parentSub) => { - const item = type._item; - if (item === null || (item.id.clock < (transaction.beforeState.get(item.id.client) || 0) && !item.deleted)) { - map__namespace.setIfUndefined(transaction.changed, type, set__namespace.create).add(parentSub); - } -}; - -/** - * @param {Array} structs - * @param {number} pos - * @return {number} # of merged structs - */ -const tryToMergeWithLefts = (structs, pos) => { - let right = structs[pos]; - let left = structs[pos - 1]; - let i = pos; - for (; i > 0; right = left, left = structs[--i - 1]) { - if (left.deleted === right.deleted && left.constructor === right.constructor) { - if (left.mergeWith(right)) { - if (right instanceof Item && right.parentSub !== null && /** @type {AbstractType} */ (right.parent)._map.get(right.parentSub) === right) { - /** @type {AbstractType} */ (right.parent)._map.set(right.parentSub, /** @type {Item} */ (left)); - } - continue - } - } - break - } - const merged = pos - i; - if (merged) { - // remove all merged structs from the array - structs.splice(pos + 1 - merged, merged); - } - return merged -}; - -/** - * @param {DeleteSet} ds - * @param {StructStore} store - * @param {function(Item):boolean} gcFilter - */ -const tryGcDeleteSet = (ds, store, gcFilter) => { - for (const [client, deleteItems] of ds.clients.entries()) { - const structs = /** @type {Array} */ (store.clients.get(client)); - for (let di = deleteItems.length - 1; di >= 0; di--) { - const deleteItem = deleteItems[di]; - const endDeleteItemClock = deleteItem.clock + deleteItem.len; - for ( - let si = findIndexSS(structs, deleteItem.clock), struct = structs[si]; - si < structs.length && struct.id.clock < endDeleteItemClock; - struct = structs[++si] - ) { - const struct = structs[si]; - if (deleteItem.clock + deleteItem.len <= struct.id.clock) { - break - } - if (struct instanceof Item && struct.deleted && !struct.keep && gcFilter(struct)) { - struct.gc(store, false); - } - } - } - } -}; - -/** - * @param {DeleteSet} ds - * @param {StructStore} store - */ -const tryMergeDeleteSet = (ds, store) => { - // try to merge deleted / gc'd items - // merge from right to left for better efficiency and so we don't miss any merge targets - ds.clients.forEach((deleteItems, client) => { - const structs = /** @type {Array} */ (store.clients.get(client)); - for (let di = deleteItems.length - 1; di >= 0; di--) { - const deleteItem = deleteItems[di]; - // start with merging the item next to the last deleted item - const mostRightIndexToCheck = math__namespace.min(structs.length - 1, 1 + findIndexSS(structs, deleteItem.clock + deleteItem.len - 1)); - for ( - let si = mostRightIndexToCheck, struct = structs[si]; - si > 0 && struct.id.clock >= deleteItem.clock; - struct = structs[si] - ) { - si -= 1 + tryToMergeWithLefts(structs, si); - } - } - }); -}; - -/** - * @param {DeleteSet} ds - * @param {StructStore} store - * @param {function(Item):boolean} gcFilter - */ -const tryGc = (ds, store, gcFilter) => { - tryGcDeleteSet(ds, store, gcFilter); - tryMergeDeleteSet(ds, store); -}; - -/** - * @param {Array} transactionCleanups - * @param {number} i - */ -const cleanupTransactions = (transactionCleanups, i) => { - if (i < transactionCleanups.length) { - const transaction = transactionCleanups[i]; - const doc = transaction.doc; - const store = doc.store; - const ds = transaction.deleteSet; - const mergeStructs = transaction._mergeStructs; - try { - sortAndMergeDeleteSet(ds); - transaction.afterState = getStateVector(transaction.doc.store); - doc.emit('beforeObserverCalls', [transaction, doc]); - /** - * An array of event callbacks. - * - * Each callback is called even if the other ones throw errors. - * - * @type {Array} - */ - const fs = []; - // observe events on changed types - transaction.changed.forEach((subs, itemtype) => - fs.push(() => { - if (itemtype._item === null || !itemtype._item.deleted) { - itemtype._callObserver(transaction, subs); - } - }) - ); - fs.push(() => { - // deep observe events - transaction.changedParentTypes.forEach((events, type) => { - // We need to think about the possibility that the user transforms the - // Y.Doc in the event. - if (type._dEH.l.length > 0 && (type._item === null || !type._item.deleted)) { - events = events - .filter(event => - event.target._item === null || !event.target._item.deleted - ); - events - .forEach(event => { - event.currentTarget = type; - // path is relative to the current target - event._path = null; - }); - // sort events by path length so that top-level events are fired first. - events - .sort((event1, event2) => event1.path.length - event2.path.length); - fs.push(() => { - // We don't need to check for events.length - // because we know it has at least one element - callEventHandlerListeners(type._dEH, events, transaction); - }); - } - }); - fs.push(() => doc.emit('afterTransaction', [transaction, doc])); - fs.push(() => { - if (transaction._needFormattingCleanup) { - cleanupYTextAfterTransaction(transaction); - } - }); - }); - f.callAll(fs, []); - } finally { - // Replace deleted items with ItemDeleted / GC. - // This is where content is actually remove from the Yjs Doc. - if (doc.gc) { - tryGcDeleteSet(ds, store, doc.gcFilter); - } - tryMergeDeleteSet(ds, store); - - // on all affected store.clients props, try to merge - transaction.afterState.forEach((clock, client) => { - const beforeClock = transaction.beforeState.get(client) || 0; - if (beforeClock !== clock) { - const structs = /** @type {Array} */ (store.clients.get(client)); - // we iterate from right to left so we can safely remove entries - const firstChangePos = math__namespace.max(findIndexSS(structs, beforeClock), 1); - for (let i = structs.length - 1; i >= firstChangePos;) { - i -= 1 + tryToMergeWithLefts(structs, i); - } - } - }); - // try to merge mergeStructs - // @todo: it makes more sense to transform mergeStructs to a DS, sort it, and merge from right to left - // but at the moment DS does not handle duplicates - for (let i = mergeStructs.length - 1; i >= 0; i--) { - const { client, clock } = mergeStructs[i].id; - const structs = /** @type {Array} */ (store.clients.get(client)); - const replacedStructPos = findIndexSS(structs, clock); - if (replacedStructPos + 1 < structs.length) { - if (tryToMergeWithLefts(structs, replacedStructPos + 1) > 1) { - continue // no need to perform next check, both are already merged - } - } - if (replacedStructPos > 0) { - tryToMergeWithLefts(structs, replacedStructPos); - } - } - if (!transaction.local && transaction.afterState.get(doc.clientID) !== transaction.beforeState.get(doc.clientID)) { - logging__namespace.print(logging__namespace.ORANGE, logging__namespace.BOLD, '[yjs] ', logging__namespace.UNBOLD, logging__namespace.RED, 'Changed the client-id because another client seems to be using it.'); - doc.clientID = generateNewClientId(); - } - // @todo Merge all the transactions into one and provide send the data as a single update message - doc.emit('afterTransactionCleanup', [transaction, doc]); - if (doc._observers.has('update')) { - const encoder = new UpdateEncoderV1(); - const hasContent = writeUpdateMessageFromTransaction(encoder, transaction); - if (hasContent) { - doc.emit('update', [encoder.toUint8Array(), transaction.origin, doc, transaction]); - } - } - if (doc._observers.has('updateV2')) { - const encoder = new UpdateEncoderV2(); - const hasContent = writeUpdateMessageFromTransaction(encoder, transaction); - if (hasContent) { - doc.emit('updateV2', [encoder.toUint8Array(), transaction.origin, doc, transaction]); - } - } - const { subdocsAdded, subdocsLoaded, subdocsRemoved } = transaction; - if (subdocsAdded.size > 0 || subdocsRemoved.size > 0 || subdocsLoaded.size > 0) { - subdocsAdded.forEach(subdoc => { - subdoc.clientID = doc.clientID; - if (subdoc.collectionid == null) { - subdoc.collectionid = doc.collectionid; - } - doc.subdocs.add(subdoc); - }); - subdocsRemoved.forEach(subdoc => doc.subdocs.delete(subdoc)); - doc.emit('subdocs', [{ loaded: subdocsLoaded, added: subdocsAdded, removed: subdocsRemoved }, doc, transaction]); - subdocsRemoved.forEach(subdoc => subdoc.destroy()); - } - - if (transactionCleanups.length <= i + 1) { - doc._transactionCleanups = []; - doc.emit('afterAllTransactions', [doc, transactionCleanups]); - } else { - cleanupTransactions(transactionCleanups, i + 1); - } - } - } -}; - -/** - * Implements the functionality of `y.transact(()=>{..})` - * - * @template T - * @param {Doc} doc - * @param {function(Transaction):T} f - * @param {any} [origin=true] - * @return {T} - * - * @function - */ -const transact = (doc, f, origin = null, local = true) => { - const transactionCleanups = doc._transactionCleanups; - let initialCall = false; - /** - * @type {any} - */ - let result = null; - if (doc._transaction === null) { - initialCall = true; - doc._transaction = new Transaction(doc, origin, local); - transactionCleanups.push(doc._transaction); - if (transactionCleanups.length === 1) { - doc.emit('beforeAllTransactions', [doc]); - } - doc.emit('beforeTransaction', [doc._transaction, doc]); - } - try { - result = f(doc._transaction); - } finally { - if (initialCall) { - const finishCleanup = doc._transaction === transactionCleanups[0]; - doc._transaction = null; - if (finishCleanup) { - // The first transaction ended, now process observer calls. - // Observer call may create new transactions for which we need to call the observers and do cleanup. - // We don't want to nest these calls, so we execute these calls one after - // another. - // Also we need to ensure that all cleanups are called, even if the - // observes throw errors. - // This file is full of hacky try {} finally {} blocks to ensure that an - // event can throw errors and also that the cleanup is called. - cleanupTransactions(transactionCleanups, 0); - } - } - } - return result -}; - -class StackItem { - /** - * @param {DeleteSet} deletions - * @param {DeleteSet} insertions - */ - constructor (deletions, insertions) { - this.insertions = insertions; - this.deletions = deletions; - /** - * Use this to save and restore metadata like selection range - */ - this.meta = new Map(); - } -} -/** - * @param {Transaction} tr - * @param {UndoManager} um - * @param {StackItem} stackItem - */ -const clearUndoManagerStackItem = (tr, um, stackItem) => { - iterateDeletedStructs(tr, stackItem.deletions, item => { - if (item instanceof Item && um.scope.some(type => type === tr.doc || isParentOf(/** @type {AbstractType} */ (type), item))) { - keepItem(item, false); - } - }); -}; - -/** - * @param {UndoManager} undoManager - * @param {Array} stack - * @param {'undo'|'redo'} eventType - * @return {StackItem?} - */ -const popStackItem = (undoManager, stack, eventType) => { - /** - * Keep a reference to the transaction so we can fire the event with the changedParentTypes - * @type {any} - */ - let _tr = null; - const doc = undoManager.doc; - const scope = undoManager.scope; - transact(doc, transaction => { - while (stack.length > 0 && undoManager.currStackItem === null) { - const store = doc.store; - const stackItem = /** @type {StackItem} */ (stack.pop()); - /** - * @type {Set} - */ - const itemsToRedo = new Set(); - /** - * @type {Array} - */ - const itemsToDelete = []; - let performedChange = false; - iterateDeletedStructs(transaction, stackItem.insertions, struct => { - if (struct instanceof Item) { - if (struct.redone !== null) { - let { item, diff } = followRedone(store, struct.id); - if (diff > 0) { - item = getItemCleanStart(transaction, createID(item.id.client, item.id.clock + diff)); - } - struct = item; - } - if (!struct.deleted && scope.some(type => type === transaction.doc || isParentOf(/** @type {AbstractType} */ (type), /** @type {Item} */ (struct)))) { - itemsToDelete.push(struct); - } - } - }); - iterateDeletedStructs(transaction, stackItem.deletions, struct => { - if ( - struct instanceof Item && - scope.some(type => type === transaction.doc || isParentOf(/** @type {AbstractType} */ (type), struct)) && - // Never redo structs in stackItem.insertions because they were created and deleted in the same capture interval. - !isDeleted(stackItem.insertions, struct.id) - ) { - itemsToRedo.add(struct); - } - }); - itemsToRedo.forEach(struct => { - performedChange = redoItem(transaction, struct, itemsToRedo, stackItem.insertions, undoManager.ignoreRemoteMapChanges, undoManager) !== null || performedChange; - }); - // We want to delete in reverse order so that children are deleted before - // parents, so we have more information available when items are filtered. - for (let i = itemsToDelete.length - 1; i >= 0; i--) { - const item = itemsToDelete[i]; - if (undoManager.deleteFilter(item)) { - item.delete(transaction); - performedChange = true; - } - } - undoManager.currStackItem = performedChange ? stackItem : null; - } - transaction.changed.forEach((subProps, type) => { - // destroy search marker if necessary - if (subProps.has(null) && type._searchMarker) { - type._searchMarker.length = 0; - } - }); - _tr = transaction; - }, undoManager); - const res = undoManager.currStackItem; - if (res != null) { - const changedParentTypes = _tr.changedParentTypes; - undoManager.emit('stack-item-popped', [{ stackItem: res, type: eventType, changedParentTypes, origin: undoManager }, undoManager]); - undoManager.currStackItem = null; - } - return res -}; - -/** - * @typedef {Object} UndoManagerOptions - * @property {number} [UndoManagerOptions.captureTimeout=500] - * @property {function(Transaction):boolean} [UndoManagerOptions.captureTransaction] Do not capture changes of a Transaction if result false. - * @property {function(Item):boolean} [UndoManagerOptions.deleteFilter=()=>true] Sometimes - * it is necessary to filter what an Undo/Redo operation can delete. If this - * filter returns false, the type/item won't be deleted even it is in the - * undo/redo scope. - * @property {Set} [UndoManagerOptions.trackedOrigins=new Set([null])] - * @property {boolean} [ignoreRemoteMapChanges] Experimental. By default, the UndoManager will never overwrite remote changes. Enable this property to enable overwriting remote changes on key-value changes (Y.Map, properties on Y.Xml, etc..). - * @property {Doc} [doc] The document that this UndoManager operates on. Only needed if typeScope is empty. - */ - -/** - * @typedef {Object} StackItemEvent - * @property {StackItem} StackItemEvent.stackItem - * @property {any} StackItemEvent.origin - * @property {'undo'|'redo'} StackItemEvent.type - * @property {Map>,Array>>} StackItemEvent.changedParentTypes - */ - -/** - * Fires 'stack-item-added' event when a stack item was added to either the undo- or - * the redo-stack. You may store additional stack information via the - * metadata property on `event.stackItem.meta` (it is a `Map` of metadata properties). - * Fires 'stack-item-popped' event when a stack item was popped from either the - * undo- or the redo-stack. You may restore the saved stack information from `event.stackItem.meta`. - * - * @extends {ObservableV2<{'stack-item-added':function(StackItemEvent, UndoManager):void, 'stack-item-popped': function(StackItemEvent, UndoManager):void, 'stack-cleared': function({ undoStackCleared: boolean, redoStackCleared: boolean }):void, 'stack-item-updated': function(StackItemEvent, UndoManager):void }>} - */ -class UndoManager extends observable.ObservableV2 { - /** - * @param {Doc|AbstractType|Array>} typeScope Limits the scope of the UndoManager. If this is set to a ydoc instance, all changes on that ydoc will be undone. If set to a specific type, only changes on that type or its children will be undone. Also accepts an array of types. - * @param {UndoManagerOptions} options - */ - constructor (typeScope, { - captureTimeout = 500, - captureTransaction = _tr => true, - deleteFilter = () => true, - trackedOrigins = new Set([null]), - ignoreRemoteMapChanges = false, - doc = /** @type {Doc} */ (array__namespace.isArray(typeScope) ? typeScope[0].doc : typeScope instanceof Doc ? typeScope : typeScope.doc) - } = {}) { - super(); - /** - * @type {Array | Doc>} - */ - this.scope = []; - this.doc = doc; - this.addToScope(typeScope); - this.deleteFilter = deleteFilter; - trackedOrigins.add(this); - this.trackedOrigins = trackedOrigins; - this.captureTransaction = captureTransaction; - /** - * @type {Array} - */ - this.undoStack = []; - /** - * @type {Array} - */ - this.redoStack = []; - /** - * Whether the client is currently undoing (calling UndoManager.undo) - * - * @type {boolean} - */ - this.undoing = false; - this.redoing = false; - /** - * The currently popped stack item if UndoManager.undoing or UndoManager.redoing - * - * @type {StackItem|null} - */ - this.currStackItem = null; - this.lastChange = 0; - this.ignoreRemoteMapChanges = ignoreRemoteMapChanges; - this.captureTimeout = captureTimeout; - /** - * @param {Transaction} transaction - */ - this.afterTransactionHandler = transaction => { - // Only track certain transactions - if ( - !this.captureTransaction(transaction) || - !this.scope.some(type => transaction.changedParentTypes.has(/** @type {AbstractType} */ (type)) || type === this.doc) || - (!this.trackedOrigins.has(transaction.origin) && (!transaction.origin || !this.trackedOrigins.has(transaction.origin.constructor))) - ) { - return - } - const undoing = this.undoing; - const redoing = this.redoing; - const stack = undoing ? this.redoStack : this.undoStack; - if (undoing) { - this.stopCapturing(); // next undo should not be appended to last stack item - } else if (!redoing) { - // neither undoing nor redoing: delete redoStack - this.clear(false, true); - } - const insertions = new DeleteSet(); - transaction.afterState.forEach((endClock, client) => { - const startClock = transaction.beforeState.get(client) || 0; - const len = endClock - startClock; - if (len > 0) { - addToDeleteSet(insertions, client, startClock, len); - } - }); - const now = time__namespace.getUnixTime(); - let didAdd = false; - if (this.lastChange > 0 && now - this.lastChange < this.captureTimeout && stack.length > 0 && !undoing && !redoing) { - // append change to last stack op - const lastOp = stack[stack.length - 1]; - lastOp.deletions = mergeDeleteSets([lastOp.deletions, transaction.deleteSet]); - lastOp.insertions = mergeDeleteSets([lastOp.insertions, insertions]); - } else { - // create a new stack op - stack.push(new StackItem(transaction.deleteSet, insertions)); - didAdd = true; - } - if (!undoing && !redoing) { - this.lastChange = now; - } - // make sure that deleted structs are not gc'd - iterateDeletedStructs(transaction, transaction.deleteSet, /** @param {Item|GC} item */ item => { - if (item instanceof Item && this.scope.some(type => type === transaction.doc || isParentOf(/** @type {AbstractType} */ (type), item))) { - keepItem(item, true); - } - }); - /** - * @type {[StackItemEvent, UndoManager]} - */ - const changeEvent = [{ stackItem: stack[stack.length - 1], origin: transaction.origin, type: undoing ? 'redo' : 'undo', changedParentTypes: transaction.changedParentTypes }, this]; - if (didAdd) { - this.emit('stack-item-added', changeEvent); - } else { - this.emit('stack-item-updated', changeEvent); - } - }; - this.doc.on('afterTransaction', this.afterTransactionHandler); - this.doc.on('destroy', () => { - this.destroy(); - }); - } - - /** - * Extend the scope. - * - * @param {Array | Doc> | AbstractType | Doc} ytypes - */ - addToScope (ytypes) { - const tmpSet = new Set(this.scope); - ytypes = array__namespace.isArray(ytypes) ? ytypes : [ytypes]; - ytypes.forEach(ytype => { - if (!tmpSet.has(ytype)) { - tmpSet.add(ytype); - if (ytype instanceof AbstractType ? ytype.doc !== this.doc : ytype !== this.doc) logging__namespace.warn('[yjs#509] Not same Y.Doc'); // use MultiDocUndoManager instead. also see https://github.com/yjs/yjs/issues/509 - this.scope.push(ytype); - } - }); - } - - /** - * @param {any} origin - */ - addTrackedOrigin (origin) { - this.trackedOrigins.add(origin); - } - - /** - * @param {any} origin - */ - removeTrackedOrigin (origin) { - this.trackedOrigins.delete(origin); - } - - clear (clearUndoStack = true, clearRedoStack = true) { - if ((clearUndoStack && this.canUndo()) || (clearRedoStack && this.canRedo())) { - this.doc.transact(tr => { - if (clearUndoStack) { - this.undoStack.forEach(item => clearUndoManagerStackItem(tr, this, item)); - this.undoStack = []; - } - if (clearRedoStack) { - this.redoStack.forEach(item => clearUndoManagerStackItem(tr, this, item)); - this.redoStack = []; - } - this.emit('stack-cleared', [{ undoStackCleared: clearUndoStack, redoStackCleared: clearRedoStack }]); - }); - } - } - - /** - * UndoManager merges Undo-StackItem if they are created within time-gap - * smaller than `options.captureTimeout`. Call `um.stopCapturing()` so that the next - * StackItem won't be merged. - * - * - * @example - * // without stopCapturing - * ytext.insert(0, 'a') - * ytext.insert(1, 'b') - * um.undo() - * ytext.toString() // => '' (note that 'ab' was removed) - * // with stopCapturing - * ytext.insert(0, 'a') - * um.stopCapturing() - * ytext.insert(0, 'b') - * um.undo() - * ytext.toString() // => 'a' (note that only 'b' was removed) - * - */ - stopCapturing () { - this.lastChange = 0; - } - - /** - * Undo last changes on type. - * - * @return {StackItem?} Returns StackItem if a change was applied - */ - undo () { - this.undoing = true; - let res; - try { - res = popStackItem(this, this.undoStack, 'undo'); - } finally { - this.undoing = false; - } - return res - } - - /** - * Redo last undo operation. - * - * @return {StackItem?} Returns StackItem if a change was applied - */ - redo () { - this.redoing = true; - let res; - try { - res = popStackItem(this, this.redoStack, 'redo'); - } finally { - this.redoing = false; - } - return res - } - - /** - * Are undo steps available? - * - * @return {boolean} `true` if undo is possible - */ - canUndo () { - return this.undoStack.length > 0 - } - - /** - * Are redo steps available? - * - * @return {boolean} `true` if redo is possible - */ - canRedo () { - return this.redoStack.length > 0 - } - - destroy () { - this.trackedOrigins.delete(this); - this.doc.off('afterTransaction', this.afterTransactionHandler); - super.destroy(); - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - */ -function * lazyStructReaderGenerator (decoder) { - const numOfStateUpdates = decoding__namespace.readVarUint(decoder.restDecoder); - for (let i = 0; i < numOfStateUpdates; i++) { - const numberOfStructs = decoding__namespace.readVarUint(decoder.restDecoder); - const client = decoder.readClient(); - let clock = decoding__namespace.readVarUint(decoder.restDecoder); - for (let i = 0; i < numberOfStructs; i++) { - const info = decoder.readInfo(); - // @todo use switch instead of ifs - if (info === 10) { - const len = decoding__namespace.readVarUint(decoder.restDecoder); - yield new Skip(createID(client, clock), len); - clock += len; - } else if ((binary__namespace.BITS5 & info) !== 0) { - const cantCopyParentInfo = (info & (binary__namespace.BIT7 | binary__namespace.BIT8)) === 0; - // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y` - // and we read the next string as parentYKey. - // It indicates how we store/retrieve parent from `y.share` - // @type {string|null} - const struct = new Item( - createID(client, clock), - null, // left - (info & binary__namespace.BIT8) === binary__namespace.BIT8 ? decoder.readLeftID() : null, // origin - null, // right - (info & binary__namespace.BIT7) === binary__namespace.BIT7 ? decoder.readRightID() : null, // right origin - // @ts-ignore Force writing a string here. - cantCopyParentInfo ? (decoder.readParentInfo() ? decoder.readString() : decoder.readLeftID()) : null, // parent - cantCopyParentInfo && (info & binary__namespace.BIT6) === binary__namespace.BIT6 ? decoder.readString() : null, // parentSub - readItemContent(decoder, info) // item content - ); - yield struct; - clock += struct.length; - } else { - const len = decoder.readLen(); - yield new GC(createID(client, clock), len); - clock += len; - } - } - } -} - -class LazyStructReader { - /** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @param {boolean} filterSkips - */ - constructor (decoder, filterSkips) { - this.gen = lazyStructReaderGenerator(decoder); - /** - * @type {null | Item | Skip | GC} - */ - this.curr = null; - this.done = false; - this.filterSkips = filterSkips; - this.next(); - } - - /** - * @return {Item | GC | Skip |null} - */ - next () { - // ignore "Skip" structs - do { - this.curr = this.gen.next().value || null; - } while (this.filterSkips && this.curr !== null && this.curr.constructor === Skip) - return this.curr - } -} - -/** - * @param {Uint8Array} update - * - */ -const logUpdate = update => logUpdateV2(update, UpdateDecoderV1); - -/** - * @param {Uint8Array} update - * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder] - * - */ -const logUpdateV2 = (update, YDecoder = UpdateDecoderV2) => { - const structs = []; - const updateDecoder = new YDecoder(decoding__namespace.createDecoder(update)); - const lazyDecoder = new LazyStructReader(updateDecoder, false); - for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) { - structs.push(curr); - } - logging__namespace.print('Structs: ', structs); - const ds = readDeleteSet(updateDecoder); - logging__namespace.print('DeleteSet: ', ds); -}; - -/** - * @param {Uint8Array} update - * - */ -const decodeUpdate = (update) => decodeUpdateV2(update, UpdateDecoderV1); - -/** - * @param {Uint8Array} update - * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder] - * - */ -const decodeUpdateV2 = (update, YDecoder = UpdateDecoderV2) => { - const structs = []; - const updateDecoder = new YDecoder(decoding__namespace.createDecoder(update)); - const lazyDecoder = new LazyStructReader(updateDecoder, false); - for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) { - structs.push(curr); - } - return { - structs, - ds: readDeleteSet(updateDecoder) - } -}; - -class LazyStructWriter { - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - */ - constructor (encoder) { - this.currClient = 0; - this.startClock = 0; - this.written = 0; - this.encoder = encoder; - /** - * We want to write operations lazily, but also we need to know beforehand how many operations we want to write for each client. - * - * This kind of meta-information (#clients, #structs-per-client-written) is written to the restEncoder. - * - * We fragment the restEncoder and store a slice of it per-client until we know how many clients there are. - * When we flush (toUint8Array) we write the restEncoder using the fragments and the meta-information. - * - * @type {Array<{ written: number, restEncoder: Uint8Array }>} - */ - this.clientStructs = []; - } -} - -/** - * @param {Array} updates - * @return {Uint8Array} - */ -const mergeUpdates = updates => mergeUpdatesV2(updates, UpdateDecoderV1, UpdateEncoderV1); - -/** - * @param {Uint8Array} update - * @param {typeof DSEncoderV1 | typeof DSEncoderV2} YEncoder - * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} YDecoder - * @return {Uint8Array} - */ -const encodeStateVectorFromUpdateV2 = (update, YEncoder = DSEncoderV2, YDecoder = UpdateDecoderV2) => { - const encoder = new YEncoder(); - const updateDecoder = new LazyStructReader(new YDecoder(decoding__namespace.createDecoder(update)), false); - let curr = updateDecoder.curr; - if (curr !== null) { - let size = 0; - let currClient = curr.id.client; - let stopCounting = curr.id.clock !== 0; // must start at 0 - let currClock = stopCounting ? 0 : curr.id.clock + curr.length; - for (; curr !== null; curr = updateDecoder.next()) { - if (currClient !== curr.id.client) { - if (currClock !== 0) { - size++; - // We found a new client - // write what we have to the encoder - encoding__namespace.writeVarUint(encoder.restEncoder, currClient); - encoding__namespace.writeVarUint(encoder.restEncoder, currClock); - } - currClient = curr.id.client; - currClock = 0; - stopCounting = curr.id.clock !== 0; - } - // we ignore skips - if (curr.constructor === Skip) { - stopCounting = true; - } - if (!stopCounting) { - currClock = curr.id.clock + curr.length; - } - } - // write what we have - if (currClock !== 0) { - size++; - encoding__namespace.writeVarUint(encoder.restEncoder, currClient); - encoding__namespace.writeVarUint(encoder.restEncoder, currClock); - } - // prepend the size of the state vector - const enc = encoding__namespace.createEncoder(); - encoding__namespace.writeVarUint(enc, size); - encoding__namespace.writeBinaryEncoder(enc, encoder.restEncoder); - encoder.restEncoder = enc; - return encoder.toUint8Array() - } else { - encoding__namespace.writeVarUint(encoder.restEncoder, 0); - return encoder.toUint8Array() - } -}; - -/** - * @param {Uint8Array} update - * @return {Uint8Array} - */ -const encodeStateVectorFromUpdate = update => encodeStateVectorFromUpdateV2(update, DSEncoderV1, UpdateDecoderV1); - -/** - * @param {Uint8Array} update - * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} YDecoder - * @return {{ from: Map, to: Map }} - */ -const parseUpdateMetaV2 = (update, YDecoder = UpdateDecoderV2) => { - /** - * @type {Map} - */ - const from = new Map(); - /** - * @type {Map} - */ - const to = new Map(); - const updateDecoder = new LazyStructReader(new YDecoder(decoding__namespace.createDecoder(update)), false); - let curr = updateDecoder.curr; - if (curr !== null) { - let currClient = curr.id.client; - let currClock = curr.id.clock; - // write the beginning to `from` - from.set(currClient, currClock); - for (; curr !== null; curr = updateDecoder.next()) { - if (currClient !== curr.id.client) { - // We found a new client - // write the end to `to` - to.set(currClient, currClock); - // write the beginning to `from` - from.set(curr.id.client, curr.id.clock); - // update currClient - currClient = curr.id.client; - } - currClock = curr.id.clock + curr.length; - } - // write the end to `to` - to.set(currClient, currClock); - } - return { from, to } -}; - -/** - * @param {Uint8Array} update - * @return {{ from: Map, to: Map }} - */ -const parseUpdateMeta = update => parseUpdateMetaV2(update, UpdateDecoderV1); - -/** - * This method is intended to slice any kind of struct and retrieve the right part. - * It does not handle side-effects, so it should only be used by the lazy-encoder. - * - * @param {Item | GC | Skip} left - * @param {number} diff - * @return {Item | GC} - */ -const sliceStruct = (left, diff) => { - if (left.constructor === GC) { - const { client, clock } = left.id; - return new GC(createID(client, clock + diff), left.length - diff) - } else if (left.constructor === Skip) { - const { client, clock } = left.id; - return new Skip(createID(client, clock + diff), left.length - diff) - } else { - const leftItem = /** @type {Item} */ (left); - const { client, clock } = leftItem.id; - return new Item( - createID(client, clock + diff), - null, - createID(client, clock + diff - 1), - null, - leftItem.rightOrigin, - leftItem.parent, - leftItem.parentSub, - leftItem.content.splice(diff) - ) - } -}; - -/** - * - * This function works similarly to `readUpdateV2`. - * - * @param {Array} updates - * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder] - * @param {typeof UpdateEncoderV1 | typeof UpdateEncoderV2} [YEncoder] - * @return {Uint8Array} - */ -const mergeUpdatesV2 = (updates, YDecoder = UpdateDecoderV2, YEncoder = UpdateEncoderV2) => { - if (updates.length === 1) { - return updates[0] - } - const updateDecoders = updates.map(update => new YDecoder(decoding__namespace.createDecoder(update))); - let lazyStructDecoders = updateDecoders.map(decoder => new LazyStructReader(decoder, true)); - - /** - * @todo we don't need offset because we always slice before - * @type {null | { struct: Item | GC | Skip, offset: number }} - */ - let currWrite = null; - - const updateEncoder = new YEncoder(); - // write structs lazily - const lazyStructEncoder = new LazyStructWriter(updateEncoder); - - // Note: We need to ensure that all lazyStructDecoders are fully consumed - // Note: Should merge document updates whenever possible - even from different updates - // Note: Should handle that some operations cannot be applied yet () - - while (true) { - // Write higher clients first ⇒ sort by clientID & clock and remove decoders without content - lazyStructDecoders = lazyStructDecoders.filter(dec => dec.curr !== null); - lazyStructDecoders.sort( - /** @type {function(any,any):number} */ (dec1, dec2) => { - if (dec1.curr.id.client === dec2.curr.id.client) { - const clockDiff = dec1.curr.id.clock - dec2.curr.id.clock; - if (clockDiff === 0) { - // @todo remove references to skip since the structDecoders must filter Skips. - return dec1.curr.constructor === dec2.curr.constructor - ? 0 - : dec1.curr.constructor === Skip ? 1 : -1 // we are filtering skips anyway. - } else { - return clockDiff - } - } else { - return dec2.curr.id.client - dec1.curr.id.client - } - } - ); - if (lazyStructDecoders.length === 0) { - break - } - const currDecoder = lazyStructDecoders[0]; - // write from currDecoder until the next operation is from another client or if filler-struct - // then we need to reorder the decoders and find the next operation to write - const firstClient = /** @type {Item | GC} */ (currDecoder.curr).id.client; - - if (currWrite !== null) { - let curr = /** @type {Item | GC | null} */ (currDecoder.curr); - let iterated = false; - - // iterate until we find something that we haven't written already - // remember: first the high client-ids are written - while (curr !== null && curr.id.clock + curr.length <= currWrite.struct.id.clock + currWrite.struct.length && curr.id.client >= currWrite.struct.id.client) { - curr = currDecoder.next(); - iterated = true; - } - if ( - curr === null || // current decoder is empty - curr.id.client !== firstClient || // check whether there is another decoder that has has updates from `firstClient` - (iterated && curr.id.clock > currWrite.struct.id.clock + currWrite.struct.length) // the above while loop was used and we are potentially missing updates - ) { - continue - } - - if (firstClient !== currWrite.struct.id.client) { - writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset); - currWrite = { struct: curr, offset: 0 }; - currDecoder.next(); - } else { - if (currWrite.struct.id.clock + currWrite.struct.length < curr.id.clock) { - // @todo write currStruct & set currStruct = Skip(clock = currStruct.id.clock + currStruct.length, length = curr.id.clock - self.clock) - if (currWrite.struct.constructor === Skip) { - // extend existing skip - currWrite.struct.length = curr.id.clock + curr.length - currWrite.struct.id.clock; - } else { - writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset); - const diff = curr.id.clock - currWrite.struct.id.clock - currWrite.struct.length; - /** - * @type {Skip} - */ - const struct = new Skip(createID(firstClient, currWrite.struct.id.clock + currWrite.struct.length), diff); - currWrite = { struct, offset: 0 }; - } - } else { // if (currWrite.struct.id.clock + currWrite.struct.length >= curr.id.clock) { - const diff = currWrite.struct.id.clock + currWrite.struct.length - curr.id.clock; - if (diff > 0) { - if (currWrite.struct.constructor === Skip) { - // prefer to slice Skip because the other struct might contain more information - currWrite.struct.length -= diff; - } else { - curr = sliceStruct(curr, diff); - } - } - if (!currWrite.struct.mergeWith(/** @type {any} */ (curr))) { - writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset); - currWrite = { struct: curr, offset: 0 }; - currDecoder.next(); - } - } - } - } else { - currWrite = { struct: /** @type {Item | GC} */ (currDecoder.curr), offset: 0 }; - currDecoder.next(); - } - for ( - let next = currDecoder.curr; - next !== null && next.id.client === firstClient && next.id.clock === currWrite.struct.id.clock + currWrite.struct.length && next.constructor !== Skip; - next = currDecoder.next() - ) { - writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset); - currWrite = { struct: next, offset: 0 }; - } - } - if (currWrite !== null) { - writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset); - currWrite = null; - } - finishLazyStructWriting(lazyStructEncoder); - - const dss = updateDecoders.map(decoder => readDeleteSet(decoder)); - const ds = mergeDeleteSets(dss); - writeDeleteSet(updateEncoder, ds); - return updateEncoder.toUint8Array() -}; - -/** - * @param {Uint8Array} update - * @param {Uint8Array} sv - * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder] - * @param {typeof UpdateEncoderV1 | typeof UpdateEncoderV2} [YEncoder] - */ -const diffUpdateV2 = (update, sv, YDecoder = UpdateDecoderV2, YEncoder = UpdateEncoderV2) => { - const state = decodeStateVector(sv); - const encoder = new YEncoder(); - const lazyStructWriter = new LazyStructWriter(encoder); - const decoder = new YDecoder(decoding__namespace.createDecoder(update)); - const reader = new LazyStructReader(decoder, false); - while (reader.curr) { - const curr = reader.curr; - const currClient = curr.id.client; - const svClock = state.get(currClient) || 0; - if (reader.curr.constructor === Skip) { - // the first written struct shouldn't be a skip - reader.next(); - continue - } - if (curr.id.clock + curr.length > svClock) { - writeStructToLazyStructWriter(lazyStructWriter, curr, math__namespace.max(svClock - curr.id.clock, 0)); - reader.next(); - while (reader.curr && reader.curr.id.client === currClient) { - writeStructToLazyStructWriter(lazyStructWriter, reader.curr, 0); - reader.next(); - } - } else { - // read until something new comes up - while (reader.curr && reader.curr.id.client === currClient && reader.curr.id.clock + reader.curr.length <= svClock) { - reader.next(); - } - } - } - finishLazyStructWriting(lazyStructWriter); - // write ds - const ds = readDeleteSet(decoder); - writeDeleteSet(encoder, ds); - return encoder.toUint8Array() -}; - -/** - * @param {Uint8Array} update - * @param {Uint8Array} sv - */ -const diffUpdate = (update, sv) => diffUpdateV2(update, sv, UpdateDecoderV1, UpdateEncoderV1); - -/** - * @param {LazyStructWriter} lazyWriter - */ -const flushLazyStructWriter = lazyWriter => { - if (lazyWriter.written > 0) { - lazyWriter.clientStructs.push({ written: lazyWriter.written, restEncoder: encoding__namespace.toUint8Array(lazyWriter.encoder.restEncoder) }); - lazyWriter.encoder.restEncoder = encoding__namespace.createEncoder(); - lazyWriter.written = 0; - } -}; - -/** - * @param {LazyStructWriter} lazyWriter - * @param {Item | GC} struct - * @param {number} offset - */ -const writeStructToLazyStructWriter = (lazyWriter, struct, offset) => { - // flush curr if we start another client - if (lazyWriter.written > 0 && lazyWriter.currClient !== struct.id.client) { - flushLazyStructWriter(lazyWriter); - } - if (lazyWriter.written === 0) { - lazyWriter.currClient = struct.id.client; - // write next client - lazyWriter.encoder.writeClient(struct.id.client); - // write startClock - encoding__namespace.writeVarUint(lazyWriter.encoder.restEncoder, struct.id.clock + offset); - } - struct.write(lazyWriter.encoder, offset); - lazyWriter.written++; -}; -/** - * Call this function when we collected all parts and want to - * put all the parts together. After calling this method, - * you can continue using the UpdateEncoder. - * - * @param {LazyStructWriter} lazyWriter - */ -const finishLazyStructWriting = (lazyWriter) => { - flushLazyStructWriter(lazyWriter); - - // this is a fresh encoder because we called flushCurr - const restEncoder = lazyWriter.encoder.restEncoder; - - /** - * Now we put all the fragments together. - * This works similarly to `writeClientsStructs` - */ - - // write # states that were updated - i.e. the clients - encoding__namespace.writeVarUint(restEncoder, lazyWriter.clientStructs.length); - - for (let i = 0; i < lazyWriter.clientStructs.length; i++) { - const partStructs = lazyWriter.clientStructs[i]; - /** - * Works similarly to `writeStructs` - */ - // write # encoded structs - encoding__namespace.writeVarUint(restEncoder, partStructs.written); - // write the rest of the fragment - encoding__namespace.writeUint8Array(restEncoder, partStructs.restEncoder); - } -}; - -/** - * @param {Uint8Array} update - * @param {function(Item|GC|Skip):Item|GC|Skip} blockTransformer - * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} YDecoder - * @param {typeof UpdateEncoderV2 | typeof UpdateEncoderV1 } YEncoder - */ -const convertUpdateFormat = (update, blockTransformer, YDecoder, YEncoder) => { - const updateDecoder = new YDecoder(decoding__namespace.createDecoder(update)); - const lazyDecoder = new LazyStructReader(updateDecoder, false); - const updateEncoder = new YEncoder(); - const lazyWriter = new LazyStructWriter(updateEncoder); - for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) { - writeStructToLazyStructWriter(lazyWriter, blockTransformer(curr), 0); - } - finishLazyStructWriting(lazyWriter); - const ds = readDeleteSet(updateDecoder); - writeDeleteSet(updateEncoder, ds); - return updateEncoder.toUint8Array() -}; - -/** - * @typedef {Object} ObfuscatorOptions - * @property {boolean} [ObfuscatorOptions.formatting=true] - * @property {boolean} [ObfuscatorOptions.subdocs=true] - * @property {boolean} [ObfuscatorOptions.yxml=true] Whether to obfuscate nodeName / hookName - */ - -/** - * @param {ObfuscatorOptions} obfuscator - */ -const createObfuscator = ({ formatting = true, subdocs = true, yxml = true } = {}) => { - let i = 0; - const mapKeyCache = map__namespace.create(); - const nodeNameCache = map__namespace.create(); - const formattingKeyCache = map__namespace.create(); - const formattingValueCache = map__namespace.create(); - formattingValueCache.set(null, null); // end of a formatting range should always be the end of a formatting range - /** - * @param {Item|GC|Skip} block - * @return {Item|GC|Skip} - */ - return block => { - switch (block.constructor) { - case GC: - case Skip: - return block - case Item: { - const item = /** @type {Item} */ (block); - const content = item.content; - switch (content.constructor) { - case ContentDeleted: - break - case ContentType: { - if (yxml) { - const type = /** @type {ContentType} */ (content).type; - if (type instanceof YXmlElement) { - type.nodeName = map__namespace.setIfUndefined(nodeNameCache, type.nodeName, () => 'node-' + i); - } - if (type instanceof YXmlHook) { - type.hookName = map__namespace.setIfUndefined(nodeNameCache, type.hookName, () => 'hook-' + i); - } - } - break - } - case ContentAny: { - const c = /** @type {ContentAny} */ (content); - c.arr = c.arr.map(() => i); - break - } - case ContentBinary: { - const c = /** @type {ContentBinary} */ (content); - c.content = new Uint8Array([i]); - break - } - case ContentDoc: { - const c = /** @type {ContentDoc} */ (content); - if (subdocs) { - c.opts = {}; - c.doc.guid = i + ''; - } - break - } - case ContentEmbed: { - const c = /** @type {ContentEmbed} */ (content); - c.embed = {}; - break - } - case ContentFormat: { - const c = /** @type {ContentFormat} */ (content); - if (formatting) { - c.key = map__namespace.setIfUndefined(formattingKeyCache, c.key, () => i + ''); - c.value = map__namespace.setIfUndefined(formattingValueCache, c.value, () => ({ i })); - } - break - } - case ContentJSON: { - const c = /** @type {ContentJSON} */ (content); - c.arr = c.arr.map(() => i); - break - } - case ContentString: { - const c = /** @type {ContentString} */ (content); - c.str = string__namespace.repeat((i % 10) + '', c.str.length); - break - } - default: - // unknown content type - error__namespace.unexpectedCase(); - } - if (item.parentSub) { - item.parentSub = map__namespace.setIfUndefined(mapKeyCache, item.parentSub, () => i + ''); - } - i++; - return block - } - default: - // unknown block-type - error__namespace.unexpectedCase(); - } - } -}; - -/** - * This function obfuscates the content of a Yjs update. This is useful to share - * buggy Yjs documents while significantly limiting the possibility that a - * developer can on the user. Note that it might still be possible to deduce - * some information by analyzing the "structure" of the document or by analyzing - * the typing behavior using the CRDT-related metadata that is still kept fully - * intact. - * - * @param {Uint8Array} update - * @param {ObfuscatorOptions} [opts] - */ -const obfuscateUpdate = (update, opts) => convertUpdateFormat(update, createObfuscator(opts), UpdateDecoderV1, UpdateEncoderV1); - -/** - * @param {Uint8Array} update - * @param {ObfuscatorOptions} [opts] - */ -const obfuscateUpdateV2 = (update, opts) => convertUpdateFormat(update, createObfuscator(opts), UpdateDecoderV2, UpdateEncoderV2); - -/** - * @param {Uint8Array} update - */ -const convertUpdateFormatV1ToV2 = update => convertUpdateFormat(update, f__namespace.id, UpdateDecoderV1, UpdateEncoderV2); - -/** - * @param {Uint8Array} update - */ -const convertUpdateFormatV2ToV1 = update => convertUpdateFormat(update, f__namespace.id, UpdateDecoderV2, UpdateEncoderV1); - -const errorComputeChanges = 'You must not compute changes after the event-handler fired.'; - -/** - * @template {AbstractType} T - * YEvent describes the changes on a YType. - */ -class YEvent { - /** - * @param {T} target The changed type. - * @param {Transaction} transaction - */ - constructor (target, transaction) { - /** - * The type on which this event was created on. - * @type {T} - */ - this.target = target; - /** - * The current target on which the observe callback is called. - * @type {AbstractType} - */ - this.currentTarget = target; - /** - * The transaction that triggered this event. - * @type {Transaction} - */ - this.transaction = transaction; - /** - * @type {Object|null} - */ - this._changes = null; - /** - * @type {null | Map} - */ - this._keys = null; - /** - * @type {null | Array<{ insert?: string | Array | object | AbstractType, retain?: number, delete?: number, attributes?: Object }>} - */ - this._delta = null; - /** - * @type {Array|null} - */ - this._path = null; - } - - /** - * Computes the path from `y` to the changed type. - * - * @todo v14 should standardize on path: Array<{parent, index}> because that is easier to work with. - * - * The following property holds: - * @example - * let type = y - * event.path.forEach(dir => { - * type = type.get(dir) - * }) - * type === event.target // => true - */ - get path () { - return this._path || (this._path = getPathTo(this.currentTarget, this.target)) - } - - /** - * Check if a struct is deleted by this event. - * - * In contrast to change.deleted, this method also returns true if the struct was added and then deleted. - * - * @param {AbstractStruct} struct - * @return {boolean} - */ - deletes (struct) { - return isDeleted(this.transaction.deleteSet, struct.id) - } - - /** - * @type {Map} - */ - get keys () { - if (this._keys === null) { - if (this.transaction.doc._transactionCleanups.length === 0) { - throw error__namespace.create(errorComputeChanges) - } - const keys = new Map(); - const target = this.target; - const changed = /** @type Set */ (this.transaction.changed.get(target)); - changed.forEach(key => { - if (key !== null) { - const item = /** @type {Item} */ (target._map.get(key)); - /** - * @type {'delete' | 'add' | 'update'} - */ - let action; - let oldValue; - if (this.adds(item)) { - let prev = item.left; - while (prev !== null && this.adds(prev)) { - prev = prev.left; - } - if (this.deletes(item)) { - if (prev !== null && this.deletes(prev)) { - action = 'delete'; - oldValue = array__namespace.last(prev.content.getContent()); - } else { - return - } - } else { - if (prev !== null && this.deletes(prev)) { - action = 'update'; - oldValue = array__namespace.last(prev.content.getContent()); - } else { - action = 'add'; - oldValue = undefined; - } - } - } else { - if (this.deletes(item)) { - action = 'delete'; - oldValue = array__namespace.last(/** @type {Item} */ item.content.getContent()); - } else { - return // nop - } - } - keys.set(key, { action, oldValue }); - } - }); - this._keys = keys; - } - return this._keys - } - - /** - * This is a computed property. Note that this can only be safely computed during the - * event call. Computing this property after other changes happened might result in - * unexpected behavior (incorrect computation of deltas). A safe way to collect changes - * is to store the `changes` or the `delta` object. Avoid storing the `transaction` object. - * - * @type {Array<{insert?: string | Array | object | AbstractType, retain?: number, delete?: number, attributes?: Object}>} - */ - get delta () { - return this.changes.delta - } - - /** - * Check if a struct is added by this event. - * - * In contrast to change.deleted, this method also returns true if the struct was added and then deleted. - * - * @param {AbstractStruct} struct - * @return {boolean} - */ - adds (struct) { - return struct.id.clock >= (this.transaction.beforeState.get(struct.id.client) || 0) - } - - /** - * This is a computed property. Note that this can only be safely computed during the - * event call. Computing this property after other changes happened might result in - * unexpected behavior (incorrect computation of deltas). A safe way to collect changes - * is to store the `changes` or the `delta` object. Avoid storing the `transaction` object. - * - * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string, delete?:number, retain?:number}>}} - */ - get changes () { - let changes = this._changes; - if (changes === null) { - if (this.transaction.doc._transactionCleanups.length === 0) { - throw error__namespace.create(errorComputeChanges) - } - const target = this.target; - const added = set__namespace.create(); - const deleted = set__namespace.create(); - /** - * @type {Array<{insert:Array}|{delete:number}|{retain:number}>} - */ - const delta = []; - changes = { - added, - deleted, - delta, - keys: this.keys - }; - const changed = /** @type Set */ (this.transaction.changed.get(target)); - if (changed.has(null)) { - /** - * @type {any} - */ - let lastOp = null; - const packOp = () => { - if (lastOp) { - delta.push(lastOp); - } - }; - for (let item = target._start; item !== null; item = item.right) { - if (item.deleted) { - if (this.deletes(item) && !this.adds(item)) { - if (lastOp === null || lastOp.delete === undefined) { - packOp(); - lastOp = { delete: 0 }; - } - lastOp.delete += item.length; - deleted.add(item); - } // else nop - } else { - if (this.adds(item)) { - if (lastOp === null || lastOp.insert === undefined) { - packOp(); - lastOp = { insert: [] }; - } - lastOp.insert = lastOp.insert.concat(item.content.getContent()); - added.add(item); - } else { - if (lastOp === null || lastOp.retain === undefined) { - packOp(); - lastOp = { retain: 0 }; - } - lastOp.retain += item.length; - } - } - } - if (lastOp !== null && lastOp.retain === undefined) { - packOp(); - } - } - this._changes = changes; - } - return /** @type {any} */ (changes) - } -} - -/** - * Compute the path from this type to the specified target. - * - * @example - * // `child` should be accessible via `type.get(path[0]).get(path[1])..` - * const path = type.getPathTo(child) - * // assuming `type instanceof YArray` - * console.log(path) // might look like => [2, 'key1'] - * child === type.get(path[0]).get(path[1]) - * - * @param {AbstractType} parent - * @param {AbstractType} child target - * @return {Array} Path to the target - * - * @private - * @function - */ -const getPathTo = (parent, child) => { - const path = []; - while (child._item !== null && child !== parent) { - if (child._item.parentSub !== null) { - // parent is map-ish - path.unshift(child._item.parentSub); - } else { - // parent is array-ish - let i = 0; - let c = /** @type {AbstractType} */ (child._item.parent)._start; - while (c !== child._item && c !== null) { - if (!c.deleted && c.countable) { - i += c.length; - } - c = c.right; - } - path.unshift(i); - } - child = /** @type {AbstractType} */ (child._item.parent); - } - return path -}; - -/** - * https://docs.yjs.dev/getting-started/working-with-shared-types#caveats - */ -const warnPrematureAccess = () => { logging__namespace.warn('Invalid access: Add Yjs type to a document before reading data.'); }; - -const maxSearchMarker = 80; - -/** - * A unique timestamp that identifies each marker. - * - * Time is relative,.. this is more like an ever-increasing clock. - * - * @type {number} - */ -let globalSearchMarkerTimestamp = 0; - -class ArraySearchMarker { - /** - * @param {Item} p - * @param {number} index - */ - constructor (p, index) { - p.marker = true; - this.p = p; - this.index = index; - this.timestamp = globalSearchMarkerTimestamp++; - } -} - -/** - * @param {ArraySearchMarker} marker - */ -const refreshMarkerTimestamp = marker => { marker.timestamp = globalSearchMarkerTimestamp++; }; - -/** - * This is rather complex so this function is the only thing that should overwrite a marker - * - * @param {ArraySearchMarker} marker - * @param {Item} p - * @param {number} index - */ -const overwriteMarker = (marker, p, index) => { - marker.p.marker = false; - marker.p = p; - p.marker = true; - marker.index = index; - marker.timestamp = globalSearchMarkerTimestamp++; -}; - -/** - * @param {Array} searchMarker - * @param {Item} p - * @param {number} index - */ -const markPosition = (searchMarker, p, index) => { - if (searchMarker.length >= maxSearchMarker) { - // override oldest marker (we don't want to create more objects) - const marker = searchMarker.reduce((a, b) => a.timestamp < b.timestamp ? a : b); - overwriteMarker(marker, p, index); - return marker - } else { - // create new marker - const pm = new ArraySearchMarker(p, index); - searchMarker.push(pm); - return pm - } -}; - -/** - * Search marker help us to find positions in the associative array faster. - * - * They speed up the process of finding a position without much bookkeeping. - * - * A maximum of `maxSearchMarker` objects are created. - * - * This function always returns a refreshed marker (updated timestamp) - * - * @param {AbstractType} yarray - * @param {number} index - */ -const findMarker = (yarray, index) => { - if (yarray._start === null || index === 0 || yarray._searchMarker === null) { - return null - } - const marker = yarray._searchMarker.length === 0 ? null : yarray._searchMarker.reduce((a, b) => math__namespace.abs(index - a.index) < math__namespace.abs(index - b.index) ? a : b); - let p = yarray._start; - let pindex = 0; - if (marker !== null) { - p = marker.p; - pindex = marker.index; - refreshMarkerTimestamp(marker); // we used it, we might need to use it again - } - // iterate to right if possible - while (p.right !== null && pindex < index) { - if (!p.deleted && p.countable) { - if (index < pindex + p.length) { - break - } - pindex += p.length; - } - p = p.right; - } - // iterate to left if necessary (might be that pindex > index) - while (p.left !== null && pindex > index) { - p = p.left; - if (!p.deleted && p.countable) { - pindex -= p.length; - } - } - // we want to make sure that p can't be merged with left, because that would screw up everything - // in that cas just return what we have (it is most likely the best marker anyway) - // iterate to left until p can't be merged with left - while (p.left !== null && p.left.id.client === p.id.client && p.left.id.clock + p.left.length === p.id.clock) { - p = p.left; - if (!p.deleted && p.countable) { - pindex -= p.length; - } - } - - // @todo remove! - // assure position - // { - // let start = yarray._start - // let pos = 0 - // while (start !== p) { - // if (!start.deleted && start.countable) { - // pos += start.length - // } - // start = /** @type {Item} */ (start.right) - // } - // if (pos !== pindex) { - // debugger - // throw new Error('Gotcha position fail!') - // } - // } - // if (marker) { - // if (window.lengths == null) { - // window.lengths = [] - // window.getLengths = () => window.lengths.sort((a, b) => a - b) - // } - // window.lengths.push(marker.index - pindex) - // console.log('distance', marker.index - pindex, 'len', p && p.parent.length) - // } - if (marker !== null && math__namespace.abs(marker.index - pindex) < /** @type {YText|YArray} */ (p.parent).length / maxSearchMarker) { - // adjust existing marker - overwriteMarker(marker, p, pindex); - return marker - } else { - // create new marker - return markPosition(yarray._searchMarker, p, pindex) - } -}; - -/** - * Update markers when a change happened. - * - * This should be called before doing a deletion! - * - * @param {Array} searchMarker - * @param {number} index - * @param {number} len If insertion, len is positive. If deletion, len is negative. - */ -const updateMarkerChanges = (searchMarker, index, len) => { - for (let i = searchMarker.length - 1; i >= 0; i--) { - const m = searchMarker[i]; - if (len > 0) { - /** - * @type {Item|null} - */ - let p = m.p; - p.marker = false; - // Ideally we just want to do a simple position comparison, but this will only work if - // search markers don't point to deleted items for formats. - // Iterate marker to prev undeleted countable position so we know what to do when updating a position - while (p && (p.deleted || !p.countable)) { - p = p.left; - if (p && !p.deleted && p.countable) { - // adjust position. the loop should break now - m.index -= p.length; - } - } - if (p === null || p.marker === true) { - // remove search marker if updated position is null or if position is already marked - searchMarker.splice(i, 1); - continue - } - m.p = p; - p.marker = true; - } - if (index < m.index || (len > 0 && index === m.index)) { // a simple index <= m.index check would actually suffice - m.index = math__namespace.max(index, m.index + len); - } - } -}; - -/** - * Accumulate all (list) children of a type and return them as an Array. - * - * @param {AbstractType} t - * @return {Array} - */ -const getTypeChildren = t => { - t.doc ?? warnPrematureAccess(); - let s = t._start; - const arr = []; - while (s) { - arr.push(s); - s = s.right; - } - return arr -}; - -/** - * Call event listeners with an event. This will also add an event to all - * parents (for `.observeDeep` handlers). - * - * @template EventType - * @param {AbstractType} type - * @param {Transaction} transaction - * @param {EventType} event - */ -const callTypeObservers = (type, transaction, event) => { - const changedType = type; - const changedParentTypes = transaction.changedParentTypes; - while (true) { - // @ts-ignore - map__namespace.setIfUndefined(changedParentTypes, type, () => []).push(event); - if (type._item === null) { - break - } - type = /** @type {AbstractType} */ (type._item.parent); - } - callEventHandlerListeners(changedType._eH, event, transaction); -}; - -/** - * @template EventType - * Abstract Yjs Type class - */ -class AbstractType { - constructor () { - /** - * @type {Item|null} - */ - this._item = null; - /** - * @type {Map} - */ - this._map = new Map(); - /** - * @type {Item|null} - */ - this._start = null; - /** - * @type {Doc|null} - */ - this.doc = null; - this._length = 0; - /** - * Event handlers - * @type {EventHandler} - */ - this._eH = createEventHandler(); - /** - * Deep event handlers - * @type {EventHandler>,Transaction>} - */ - this._dEH = createEventHandler(); - /** - * @type {null | Array} - */ - this._searchMarker = null; - } - - /** - * @return {AbstractType|null} - */ - get parent () { - return this._item ? /** @type {AbstractType} */ (this._item.parent) : null - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item|null} item - */ - _integrate (y, item) { - this.doc = y; - this._item = item; - } - - /** - * @return {AbstractType} - */ - _copy () { - throw error__namespace.methodUnimplemented() - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {AbstractType} - */ - clone () { - throw error__namespace.methodUnimplemented() - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} _encoder - */ - _write (_encoder) { } - - /** - * The first non-deleted item - */ - get _first () { - let n = this._start; - while (n !== null && n.deleted) { - n = n.right; - } - return n - } - - /** - * Creates YEvent and calls all type observers. - * Must be implemented by each type. - * - * @param {Transaction} transaction - * @param {Set} _parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, _parentSubs) { - if (!transaction.local && this._searchMarker) { - this._searchMarker.length = 0; - } - } - - /** - * Observe all events that are created on this type. - * - * @param {function(EventType, Transaction):void} f Observer function - */ - observe (f) { - addEventHandlerListener(this._eH, f); - } - - /** - * Observe all events that are created by this type and its children. - * - * @param {function(Array>,Transaction):void} f Observer function - */ - observeDeep (f) { - addEventHandlerListener(this._dEH, f); - } - - /** - * Unregister an observer function. - * - * @param {function(EventType,Transaction):void} f Observer function - */ - unobserve (f) { - removeEventHandlerListener(this._eH, f); - } - - /** - * Unregister an observer function. - * - * @param {function(Array>,Transaction):void} f Observer function - */ - unobserveDeep (f) { - removeEventHandlerListener(this._dEH, f); - } - - /** - * @abstract - * @return {any} - */ - toJSON () {} -} - -/** - * @param {AbstractType} type - * @param {number} start - * @param {number} end - * @return {Array} - * - * @private - * @function - */ -const typeListSlice = (type, start, end) => { - type.doc ?? warnPrematureAccess(); - if (start < 0) { - start = type._length + start; - } - if (end < 0) { - end = type._length + end; - } - let len = end - start; - const cs = []; - let n = type._start; - while (n !== null && len > 0) { - if (n.countable && !n.deleted) { - const c = n.content.getContent(); - if (c.length <= start) { - start -= c.length; - } else { - for (let i = start; i < c.length && len > 0; i++) { - cs.push(c[i]); - len--; - } - start = 0; - } - } - n = n.right; - } - return cs -}; - -/** - * @param {AbstractType} type - * @return {Array} - * - * @private - * @function - */ -const typeListToArray = type => { - type.doc ?? warnPrematureAccess(); - const cs = []; - let n = type._start; - while (n !== null) { - if (n.countable && !n.deleted) { - const c = n.content.getContent(); - for (let i = 0; i < c.length; i++) { - cs.push(c[i]); - } - } - n = n.right; - } - return cs -}; - -/** - * @param {AbstractType} type - * @param {Snapshot} snapshot - * @return {Array} - * - * @private - * @function - */ -const typeListToArraySnapshot = (type, snapshot) => { - const cs = []; - let n = type._start; - while (n !== null) { - if (n.countable && isVisible(n, snapshot)) { - const c = n.content.getContent(); - for (let i = 0; i < c.length; i++) { - cs.push(c[i]); - } - } - n = n.right; - } - return cs -}; - -/** - * Executes a provided function on once on every element of this YArray. - * - * @param {AbstractType} type - * @param {function(any,number,any):void} f A function to execute on every element of this YArray. - * - * @private - * @function - */ -const typeListForEach = (type, f) => { - let index = 0; - let n = type._start; - type.doc ?? warnPrematureAccess(); - while (n !== null) { - if (n.countable && !n.deleted) { - const c = n.content.getContent(); - for (let i = 0; i < c.length; i++) { - f(c[i], index++, type); - } - } - n = n.right; - } -}; - -/** - * @template C,R - * @param {AbstractType} type - * @param {function(C,number,AbstractType):R} f - * @return {Array} - * - * @private - * @function - */ -const typeListMap = (type, f) => { - /** - * @type {Array} - */ - const result = []; - typeListForEach(type, (c, i) => { - result.push(f(c, i, type)); - }); - return result -}; - -/** - * @param {AbstractType} type - * @return {IterableIterator} - * - * @private - * @function - */ -const typeListCreateIterator = type => { - let n = type._start; - /** - * @type {Array|null} - */ - let currentContent = null; - let currentContentIndex = 0; - return { - [Symbol.iterator] () { - return this - }, - next: () => { - // find some content - if (currentContent === null) { - while (n !== null && n.deleted) { - n = n.right; - } - // check if we reached the end, no need to check currentContent, because it does not exist - if (n === null) { - return { - done: true, - value: undefined - } - } - // we found n, so we can set currentContent - currentContent = n.content.getContent(); - currentContentIndex = 0; - n = n.right; // we used the content of n, now iterate to next - } - const value = currentContent[currentContentIndex++]; - // check if we need to empty currentContent - if (currentContent.length <= currentContentIndex) { - currentContent = null; - } - return { - done: false, - value - } - } - } -}; - -/** - * @param {AbstractType} type - * @param {number} index - * @return {any} - * - * @private - * @function - */ -const typeListGet = (type, index) => { - type.doc ?? warnPrematureAccess(); - const marker = findMarker(type, index); - let n = type._start; - if (marker !== null) { - n = marker.p; - index -= marker.index; - } - for (; n !== null; n = n.right) { - if (!n.deleted && n.countable) { - if (index < n.length) { - return n.content.getContent()[index] - } - index -= n.length; - } - } -}; - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {Item?} referenceItem - * @param {Array|Array|boolean|number|null|string|Uint8Array>} content - * - * @private - * @function - */ -const typeListInsertGenericsAfter = (transaction, parent, referenceItem, content) => { - let left = referenceItem; - const doc = transaction.doc; - const ownClientId = doc.clientID; - const store = doc.store; - const right = referenceItem === null ? parent._start : referenceItem.right; - /** - * @type {Array|number|null>} - */ - let jsonContent = []; - const packJsonContent = () => { - if (jsonContent.length > 0) { - left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentAny(jsonContent)); - left.integrate(transaction, 0); - jsonContent = []; - } - }; - content.forEach(c => { - if (c === null) { - jsonContent.push(c); - } else { - switch (c.constructor) { - case Number: - case Object: - case Boolean: - case Array: - case String: - jsonContent.push(c); - break - default: - packJsonContent(); - switch (c.constructor) { - case Uint8Array: - case ArrayBuffer: - left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentBinary(new Uint8Array(/** @type {Uint8Array} */ (c)))); - left.integrate(transaction, 0); - break - case Doc: - left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentDoc(/** @type {Doc} */ (c))); - left.integrate(transaction, 0); - break - default: - if (c instanceof AbstractType) { - left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentType(c)); - left.integrate(transaction, 0); - } else { - throw new Error('Unexpected content type in insert operation') - } - } - } - } - }); - packJsonContent(); -}; - -const lengthExceeded = () => error__namespace.create('Length exceeded!'); - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {number} index - * @param {Array|Array|number|null|string|Uint8Array>} content - * - * @private - * @function - */ -const typeListInsertGenerics = (transaction, parent, index, content) => { - if (index > parent._length) { - throw lengthExceeded() - } - if (index === 0) { - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, index, content.length); - } - return typeListInsertGenericsAfter(transaction, parent, null, content) - } - const startIndex = index; - const marker = findMarker(parent, index); - let n = parent._start; - if (marker !== null) { - n = marker.p; - index -= marker.index; - // we need to iterate one to the left so that the algorithm works - if (index === 0) { - // @todo refactor this as it actually doesn't consider formats - n = n.prev; // important! get the left undeleted item so that we can actually decrease index - index += (n && n.countable && !n.deleted) ? n.length : 0; - } - } - for (; n !== null; n = n.right) { - if (!n.deleted && n.countable) { - if (index <= n.length) { - if (index < n.length) { - // insert in-between - getItemCleanStart(transaction, createID(n.id.client, n.id.clock + index)); - } - break - } - index -= n.length; - } - } - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, startIndex, content.length); - } - return typeListInsertGenericsAfter(transaction, parent, n, content) -}; - -/** - * Pushing content is special as we generally want to push after the last item. So we don't have to update - * the search marker. - * - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {Array|Array|number|null|string|Uint8Array>} content - * - * @private - * @function - */ -const typeListPushGenerics = (transaction, parent, content) => { - // Use the marker with the highest index and iterate to the right. - const marker = (parent._searchMarker || []).reduce((maxMarker, currMarker) => currMarker.index > maxMarker.index ? currMarker : maxMarker, { index: 0, p: parent._start }); - let n = marker.p; - if (n) { - while (n.right) { - n = n.right; - } - } - return typeListInsertGenericsAfter(transaction, parent, n, content) -}; - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {number} index - * @param {number} length - * - * @private - * @function - */ -const typeListDelete = (transaction, parent, index, length) => { - if (length === 0) { return } - const startIndex = index; - const startLength = length; - const marker = findMarker(parent, index); - let n = parent._start; - if (marker !== null) { - n = marker.p; - index -= marker.index; - } - // compute the first item to be deleted - for (; n !== null && index > 0; n = n.right) { - if (!n.deleted && n.countable) { - if (index < n.length) { - getItemCleanStart(transaction, createID(n.id.client, n.id.clock + index)); - } - index -= n.length; - } - } - // delete all items until done - while (length > 0 && n !== null) { - if (!n.deleted) { - if (length < n.length) { - getItemCleanStart(transaction, createID(n.id.client, n.id.clock + length)); - } - n.delete(transaction); - length -= n.length; - } - n = n.right; - } - if (length > 0) { - throw lengthExceeded() - } - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, startIndex, -startLength + length /* in case we remove the above exception */); - } -}; - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {string} key - * - * @private - * @function - */ -const typeMapDelete = (transaction, parent, key) => { - const c = parent._map.get(key); - if (c !== undefined) { - c.delete(transaction); - } -}; - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {string} key - * @param {Object|number|null|Array|string|Uint8Array|AbstractType} value - * - * @private - * @function - */ -const typeMapSet = (transaction, parent, key, value) => { - const left = parent._map.get(key) || null; - const doc = transaction.doc; - const ownClientId = doc.clientID; - let content; - if (value == null) { - content = new ContentAny([value]); - } else { - switch (value.constructor) { - case Number: - case Object: - case Boolean: - case Array: - case String: - case Date: - case BigInt: - content = new ContentAny([value]); - break - case Uint8Array: - content = new ContentBinary(/** @type {Uint8Array} */ (value)); - break - case Doc: - content = new ContentDoc(/** @type {Doc} */ (value)); - break - default: - if (value instanceof AbstractType) { - content = new ContentType(value); - } else { - throw new Error('Unexpected content type') - } - } - } - new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, null, null, parent, key, content).integrate(transaction, 0); -}; - -/** - * @param {AbstractType} parent - * @param {string} key - * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined} - * - * @private - * @function - */ -const typeMapGet = (parent, key) => { - parent.doc ?? warnPrematureAccess(); - const val = parent._map.get(key); - return val !== undefined && !val.deleted ? val.content.getContent()[val.length - 1] : undefined -}; - -/** - * @param {AbstractType} parent - * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined>} - * - * @private - * @function - */ -const typeMapGetAll = (parent) => { - /** - * @type {Object} - */ - const res = {}; - parent.doc ?? warnPrematureAccess(); - parent._map.forEach((value, key) => { - if (!value.deleted) { - res[key] = value.content.getContent()[value.length - 1]; - } - }); - return res -}; - -/** - * @param {AbstractType} parent - * @param {string} key - * @return {boolean} - * - * @private - * @function - */ -const typeMapHas = (parent, key) => { - parent.doc ?? warnPrematureAccess(); - const val = parent._map.get(key); - return val !== undefined && !val.deleted -}; - -/** - * @param {AbstractType} parent - * @param {string} key - * @param {Snapshot} snapshot - * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined} - * - * @private - * @function - */ -const typeMapGetSnapshot = (parent, key, snapshot) => { - let v = parent._map.get(key) || null; - while (v !== null && (!snapshot.sv.has(v.id.client) || v.id.clock >= (snapshot.sv.get(v.id.client) || 0))) { - v = v.left; - } - return v !== null && isVisible(v, snapshot) ? v.content.getContent()[v.length - 1] : undefined -}; - -/** - * @param {AbstractType} parent - * @param {Snapshot} snapshot - * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined>} - * - * @private - * @function - */ -const typeMapGetAllSnapshot = (parent, snapshot) => { - /** - * @type {Object} - */ - const res = {}; - parent._map.forEach((value, key) => { - /** - * @type {Item|null} - */ - let v = value; - while (v !== null && (!snapshot.sv.has(v.id.client) || v.id.clock >= (snapshot.sv.get(v.id.client) || 0))) { - v = v.left; - } - if (v !== null && isVisible(v, snapshot)) { - res[key] = v.content.getContent()[v.length - 1]; - } - }); - return res -}; - -/** - * @param {AbstractType & { _map: Map }} type - * @return {IterableIterator>} - * - * @private - * @function - */ -const createMapIterator = type => { - type.doc ?? warnPrematureAccess(); - return iterator__namespace.iteratorFilter(type._map.entries(), /** @param {any} entry */ entry => !entry[1].deleted) -}; - -/** - * @module YArray - */ - - -/** - * Event that describes the changes on a YArray - * @template T - * @extends YEvent> - */ -class YArrayEvent extends YEvent {} - -/** - * A shared Array implementation. - * @template T - * @extends AbstractType> - * @implements {Iterable} - */ -class YArray extends AbstractType { - constructor () { - super(); - /** - * @type {Array?} - * @private - */ - this._prelimContent = []; - /** - * @type {Array} - */ - this._searchMarker = []; - } - - /** - * Construct a new YArray containing the specified items. - * @template {Object|Array|number|null|string|Uint8Array} T - * @param {Array} items - * @return {YArray} - */ - static from (items) { - /** - * @type {YArray} - */ - const a = new YArray(); - a.push(items); - return a - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item); - this.insert(0, /** @type {Array} */ (this._prelimContent)); - this._prelimContent = null; - } - - /** - * @return {YArray} - */ - _copy () { - return new YArray() - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YArray} - */ - clone () { - /** - * @type {YArray} - */ - const arr = new YArray(); - arr.insert(0, this.toArray().map(el => - el instanceof AbstractType ? /** @type {typeof el} */ (el.clone()) : el - )); - return arr - } - - get length () { - this.doc ?? warnPrematureAccess(); - return this._length - } - - /** - * Creates YArrayEvent and calls observers. - * - * @param {Transaction} transaction - * @param {Set} parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, parentSubs) { - super._callObserver(transaction, parentSubs); - callTypeObservers(this, transaction, new YArrayEvent(this, transaction)); - } - - /** - * Inserts new content at an index. - * - * Important: This function expects an array of content. Not just a content - * object. The reason for this "weirdness" is that inserting several elements - * is very efficient when it is done as a single operation. - * - * @example - * // Insert character 'a' at position 0 - * yarray.insert(0, ['a']) - * // Insert numbers 1, 2 at position 1 - * yarray.insert(1, [1, 2]) - * - * @param {number} index The index to insert content at. - * @param {Array} content The array of content - */ - insert (index, content) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListInsertGenerics(transaction, this, index, /** @type {any} */ (content)); - }); - } else { - /** @type {Array} */ (this._prelimContent).splice(index, 0, ...content); - } - } - - /** - * Appends content to this YArray. - * - * @param {Array} content Array of content to append. - * - * @todo Use the following implementation in all types. - */ - push (content) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListPushGenerics(transaction, this, /** @type {any} */ (content)); - }); - } else { - /** @type {Array} */ (this._prelimContent).push(...content); - } - } - - /** - * Prepends content to this YArray. - * - * @param {Array} content Array of content to prepend. - */ - unshift (content) { - this.insert(0, content); - } - - /** - * Deletes elements starting from an index. - * - * @param {number} index Index at which to start deleting elements - * @param {number} length The number of elements to remove. Defaults to 1. - */ - delete (index, length = 1) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListDelete(transaction, this, index, length); - }); - } else { - /** @type {Array} */ (this._prelimContent).splice(index, length); - } - } - - /** - * Returns the i-th element from a YArray. - * - * @param {number} index The index of the element to return from the YArray - * @return {T} - */ - get (index) { - return typeListGet(this, index) - } - - /** - * Transforms this YArray to a JavaScript Array. - * - * @return {Array} - */ - toArray () { - return typeListToArray(this) - } - - /** - * Returns a portion of this YArray into a JavaScript Array selected - * from start to end (end not included). - * - * @param {number} [start] - * @param {number} [end] - * @return {Array} - */ - slice (start = 0, end = this.length) { - return typeListSlice(this, start, end) - } - - /** - * Transforms this Shared Type to a JSON object. - * - * @return {Array} - */ - toJSON () { - return this.map(c => c instanceof AbstractType ? c.toJSON() : c) - } - - /** - * Returns an Array with the result of calling a provided function on every - * element of this YArray. - * - * @template M - * @param {function(T,number,YArray):M} f Function that produces an element of the new Array - * @return {Array} A new array with each element being the result of the - * callback function - */ - map (f) { - return typeListMap(this, /** @type {any} */ (f)) - } - - /** - * Executes a provided function once on every element of this YArray. - * - * @param {function(T,number,YArray):void} f A function to execute on every element of this YArray. - */ - forEach (f) { - typeListForEach(this, f); - } - - /** - * @return {IterableIterator} - */ - [Symbol.iterator] () { - return typeListCreateIterator(this) - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - */ - _write (encoder) { - encoder.writeTypeRef(YArrayRefID); - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder - * - * @private - * @function - */ -const readYArray = _decoder => new YArray(); - -/** - * @module YMap - */ - - -/** - * @template T - * @extends YEvent> - * Event that describes the changes on a YMap. - */ -class YMapEvent extends YEvent { - /** - * @param {YMap} ymap The YArray that changed. - * @param {Transaction} transaction - * @param {Set} subs The keys that changed. - */ - constructor (ymap, transaction, subs) { - super(ymap, transaction); - this.keysChanged = subs; - } -} - -/** - * @template MapType - * A shared Map implementation. - * - * @extends AbstractType> - * @implements {Iterable<[string, MapType]>} - */ -class YMap extends AbstractType { - /** - * - * @param {Iterable=} entries - an optional iterable to initialize the YMap - */ - constructor (entries) { - super(); - /** - * @type {Map?} - * @private - */ - this._prelimContent = null; - - if (entries === undefined) { - this._prelimContent = new Map(); - } else { - this._prelimContent = new Map(entries); - } - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item) - ;/** @type {Map} */ (this._prelimContent).forEach((value, key) => { - this.set(key, value); - }); - this._prelimContent = null; - } - - /** - * @return {YMap} - */ - _copy () { - return new YMap() - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YMap} - */ - clone () { - /** - * @type {YMap} - */ - const map = new YMap(); - this.forEach((value, key) => { - map.set(key, value instanceof AbstractType ? /** @type {typeof value} */ (value.clone()) : value); - }); - return map - } - - /** - * Creates YMapEvent and calls observers. - * - * @param {Transaction} transaction - * @param {Set} parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, parentSubs) { - callTypeObservers(this, transaction, new YMapEvent(this, transaction, parentSubs)); - } - - /** - * Transforms this Shared Type to a JSON object. - * - * @return {Object} - */ - toJSON () { - this.doc ?? warnPrematureAccess(); - /** - * @type {Object} - */ - const map = {}; - this._map.forEach((item, key) => { - if (!item.deleted) { - const v = item.content.getContent()[item.length - 1]; - map[key] = v instanceof AbstractType ? v.toJSON() : v; - } - }); - return map - } - - /** - * Returns the size of the YMap (count of key/value pairs) - * - * @return {number} - */ - get size () { - return [...createMapIterator(this)].length - } - - /** - * Returns the keys for each element in the YMap Type. - * - * @return {IterableIterator} - */ - keys () { - return iterator__namespace.iteratorMap(createMapIterator(this), /** @param {any} v */ v => v[0]) - } - - /** - * Returns the values for each element in the YMap Type. - * - * @return {IterableIterator} - */ - values () { - return iterator__namespace.iteratorMap(createMapIterator(this), /** @param {any} v */ v => v[1].content.getContent()[v[1].length - 1]) - } - - /** - * Returns an Iterator of [key, value] pairs - * - * @return {IterableIterator<[string, MapType]>} - */ - entries () { - return iterator__namespace.iteratorMap(createMapIterator(this), /** @param {any} v */ v => /** @type {any} */ ([v[0], v[1].content.getContent()[v[1].length - 1]])) - } - - /** - * Executes a provided function on once on every key-value pair. - * - * @param {function(MapType,string,YMap):void} f A function to execute on every element of this YArray. - */ - forEach (f) { - this.doc ?? warnPrematureAccess(); - this._map.forEach((item, key) => { - if (!item.deleted) { - f(item.content.getContent()[item.length - 1], key, this); - } - }); - } - - /** - * Returns an Iterator of [key, value] pairs - * - * @return {IterableIterator<[string, MapType]>} - */ - [Symbol.iterator] () { - return this.entries() - } - - /** - * Remove a specified element from this YMap. - * - * @param {string} key The key of the element to remove. - */ - delete (key) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapDelete(transaction, this, key); - }); - } else { - /** @type {Map} */ (this._prelimContent).delete(key); - } - } - - /** - * Adds or updates an element with a specified key and value. - * @template {MapType} VAL - * - * @param {string} key The key of the element to add to this YMap - * @param {VAL} value The value of the element to add - * @return {VAL} - */ - set (key, value) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapSet(transaction, this, key, /** @type {any} */ (value)); - }); - } else { - /** @type {Map} */ (this._prelimContent).set(key, value); - } - return value - } - - /** - * Returns a specified element from this YMap. - * - * @param {string} key - * @return {MapType|undefined} - */ - get (key) { - return /** @type {any} */ (typeMapGet(this, key)) - } - - /** - * Returns a boolean indicating whether the specified key exists or not. - * - * @param {string} key The key to test. - * @return {boolean} - */ - has (key) { - return typeMapHas(this, key) - } - - /** - * Removes all elements from this YMap. - */ - clear () { - if (this.doc !== null) { - transact(this.doc, transaction => { - this.forEach(function (_value, key, map) { - typeMapDelete(transaction, map, key); - }); - }); - } else { - /** @type {Map} */ (this._prelimContent).clear(); - } - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - */ - _write (encoder) { - encoder.writeTypeRef(YMapRefID); - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder - * - * @private - * @function - */ -const readYMap = _decoder => new YMap(); - -/** - * @module YText - */ - - -/** - * @param {any} a - * @param {any} b - * @return {boolean} - */ -const equalAttrs = (a, b) => a === b || (typeof a === 'object' && typeof b === 'object' && a && b && object__namespace.equalFlat(a, b)); - -class ItemTextListPosition { - /** - * @param {Item|null} left - * @param {Item|null} right - * @param {number} index - * @param {Map} currentAttributes - */ - constructor (left, right, index, currentAttributes) { - this.left = left; - this.right = right; - this.index = index; - this.currentAttributes = currentAttributes; - } - - /** - * Only call this if you know that this.right is defined - */ - forward () { - if (this.right === null) { - error__namespace.unexpectedCase(); - } - switch (this.right.content.constructor) { - case ContentFormat: - if (!this.right.deleted) { - updateCurrentAttributes(this.currentAttributes, /** @type {ContentFormat} */ (this.right.content)); - } - break - default: - if (!this.right.deleted) { - this.index += this.right.length; - } - break - } - this.left = this.right; - this.right = this.right.right; - } -} - -/** - * @param {Transaction} transaction - * @param {ItemTextListPosition} pos - * @param {number} count steps to move forward - * @return {ItemTextListPosition} - * - * @private - * @function - */ -const findNextPosition = (transaction, pos, count) => { - while (pos.right !== null && count > 0) { - switch (pos.right.content.constructor) { - case ContentFormat: - if (!pos.right.deleted) { - updateCurrentAttributes(pos.currentAttributes, /** @type {ContentFormat} */ (pos.right.content)); - } - break - default: - if (!pos.right.deleted) { - if (count < pos.right.length) { - // split right - getItemCleanStart(transaction, createID(pos.right.id.client, pos.right.id.clock + count)); - } - pos.index += pos.right.length; - count -= pos.right.length; - } - break - } - pos.left = pos.right; - pos.right = pos.right.right; - // pos.forward() - we don't forward because that would halve the performance because we already do the checks above - } - return pos -}; - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {number} index - * @param {boolean} useSearchMarker - * @return {ItemTextListPosition} - * - * @private - * @function - */ -const findPosition = (transaction, parent, index, useSearchMarker) => { - const currentAttributes = new Map(); - const marker = useSearchMarker ? findMarker(parent, index) : null; - if (marker) { - const pos = new ItemTextListPosition(marker.p.left, marker.p, marker.index, currentAttributes); - return findNextPosition(transaction, pos, index - marker.index) - } else { - const pos = new ItemTextListPosition(null, parent._start, 0, currentAttributes); - return findNextPosition(transaction, pos, index) - } -}; - -/** - * Negate applied formats - * - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {ItemTextListPosition} currPos - * @param {Map} negatedAttributes - * - * @private - * @function - */ -const insertNegatedAttributes = (transaction, parent, currPos, negatedAttributes) => { - // check if we really need to remove attributes - while ( - currPos.right !== null && ( - currPos.right.deleted === true || ( - currPos.right.content.constructor === ContentFormat && - equalAttrs(negatedAttributes.get(/** @type {ContentFormat} */ (currPos.right.content).key), /** @type {ContentFormat} */ (currPos.right.content).value) - ) - ) - ) { - if (!currPos.right.deleted) { - negatedAttributes.delete(/** @type {ContentFormat} */ (currPos.right.content).key); - } - currPos.forward(); - } - const doc = transaction.doc; - const ownClientId = doc.clientID; - negatedAttributes.forEach((val, key) => { - const left = currPos.left; - const right = currPos.right; - const nextFormat = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentFormat(key, val)); - nextFormat.integrate(transaction, 0); - currPos.right = nextFormat; - currPos.forward(); - }); -}; - -/** - * @param {Map} currentAttributes - * @param {ContentFormat} format - * - * @private - * @function - */ -const updateCurrentAttributes = (currentAttributes, format) => { - const { key, value } = format; - if (value === null) { - currentAttributes.delete(key); - } else { - currentAttributes.set(key, value); - } -}; - -/** - * @param {ItemTextListPosition} currPos - * @param {Object} attributes - * - * @private - * @function - */ -const minimizeAttributeChanges = (currPos, attributes) => { - // go right while attributes[right.key] === right.value (or right is deleted) - while (true) { - if (currPos.right === null) { - break - } else if (currPos.right.deleted || (currPos.right.content.constructor === ContentFormat && equalAttrs(attributes[(/** @type {ContentFormat} */ (currPos.right.content)).key] ?? null, /** @type {ContentFormat} */ (currPos.right.content).value))) ; else { - break - } - currPos.forward(); - } -}; - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {ItemTextListPosition} currPos - * @param {Object} attributes - * @return {Map} - * - * @private - * @function - **/ -const insertAttributes = (transaction, parent, currPos, attributes) => { - const doc = transaction.doc; - const ownClientId = doc.clientID; - const negatedAttributes = new Map(); - // insert format-start items - for (const key in attributes) { - const val = attributes[key]; - const currentVal = currPos.currentAttributes.get(key) ?? null; - if (!equalAttrs(currentVal, val)) { - // save negated attribute (set null if currentVal undefined) - negatedAttributes.set(key, currentVal); - const { left, right } = currPos; - currPos.right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentFormat(key, val)); - currPos.right.integrate(transaction, 0); - currPos.forward(); - } - } - return negatedAttributes -}; - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {ItemTextListPosition} currPos - * @param {string|object|AbstractType} text - * @param {Object} attributes - * - * @private - * @function - **/ -const insertText = (transaction, parent, currPos, text, attributes) => { - currPos.currentAttributes.forEach((_val, key) => { - if (attributes[key] === undefined) { - attributes[key] = null; - } - }); - const doc = transaction.doc; - const ownClientId = doc.clientID; - minimizeAttributeChanges(currPos, attributes); - const negatedAttributes = insertAttributes(transaction, parent, currPos, attributes); - // insert content - const content = text.constructor === String ? new ContentString(/** @type {string} */ (text)) : (text instanceof AbstractType ? new ContentType(text) : new ContentEmbed(text)); - let { left, right, index } = currPos; - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, currPos.index, content.getLength()); - } - right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, content); - right.integrate(transaction, 0); - currPos.right = right; - currPos.index = index; - currPos.forward(); - insertNegatedAttributes(transaction, parent, currPos, negatedAttributes); -}; - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {ItemTextListPosition} currPos - * @param {number} length - * @param {Object} attributes - * - * @private - * @function - */ -const formatText = (transaction, parent, currPos, length, attributes) => { - const doc = transaction.doc; - const ownClientId = doc.clientID; - minimizeAttributeChanges(currPos, attributes); - const negatedAttributes = insertAttributes(transaction, parent, currPos, attributes); - // iterate until first non-format or null is found - // delete all formats with attributes[format.key] != null - // also check the attributes after the first non-format as we do not want to insert redundant negated attributes there - // eslint-disable-next-line no-labels - iterationLoop: while ( - currPos.right !== null && - (length > 0 || - ( - negatedAttributes.size > 0 && - (currPos.right.deleted || currPos.right.content.constructor === ContentFormat) - ) - ) - ) { - if (!currPos.right.deleted) { - switch (currPos.right.content.constructor) { - case ContentFormat: { - const { key, value } = /** @type {ContentFormat} */ (currPos.right.content); - const attr = attributes[key]; - if (attr !== undefined) { - if (equalAttrs(attr, value)) { - negatedAttributes.delete(key); - } else { - if (length === 0) { - // no need to further extend negatedAttributes - // eslint-disable-next-line no-labels - break iterationLoop - } - negatedAttributes.set(key, value); - } - currPos.right.delete(transaction); - } else { - currPos.currentAttributes.set(key, value); - } - break - } - default: - if (length < currPos.right.length) { - getItemCleanStart(transaction, createID(currPos.right.id.client, currPos.right.id.clock + length)); - } - length -= currPos.right.length; - break - } - } - currPos.forward(); - } - // Quill just assumes that the editor starts with a newline and that it always - // ends with a newline. We only insert that newline when a new newline is - // inserted - i.e when length is bigger than type.length - if (length > 0) { - let newlines = ''; - for (; length > 0; length--) { - newlines += '\n'; - } - currPos.right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), currPos.left, currPos.left && currPos.left.lastId, currPos.right, currPos.right && currPos.right.id, parent, null, new ContentString(newlines)); - currPos.right.integrate(transaction, 0); - currPos.forward(); - } - insertNegatedAttributes(transaction, parent, currPos, negatedAttributes); -}; - -/** - * Call this function after string content has been deleted in order to - * clean up formatting Items. - * - * @param {Transaction} transaction - * @param {Item} start - * @param {Item|null} curr exclusive end, automatically iterates to the next Content Item - * @param {Map} startAttributes - * @param {Map} currAttributes - * @return {number} The amount of formatting Items deleted. - * - * @function - */ -const cleanupFormattingGap = (transaction, start, curr, startAttributes, currAttributes) => { - /** - * @type {Item|null} - */ - let end = start; - /** - * @type {Map} - */ - const endFormats = map__namespace.create(); - while (end && (!end.countable || end.deleted)) { - if (!end.deleted && end.content.constructor === ContentFormat) { - const cf = /** @type {ContentFormat} */ (end.content); - endFormats.set(cf.key, cf); - } - end = end.right; - } - let cleanups = 0; - let reachedCurr = false; - while (start !== end) { - if (curr === start) { - reachedCurr = true; - } - if (!start.deleted) { - const content = start.content; - switch (content.constructor) { - case ContentFormat: { - const { key, value } = /** @type {ContentFormat} */ (content); - const startAttrValue = startAttributes.get(key) ?? null; - if (endFormats.get(key) !== content || startAttrValue === value) { - // Either this format is overwritten or it is not necessary because the attribute already existed. - start.delete(transaction); - cleanups++; - if (!reachedCurr && (currAttributes.get(key) ?? null) === value && startAttrValue !== value) { - if (startAttrValue === null) { - currAttributes.delete(key); - } else { - currAttributes.set(key, startAttrValue); - } - } - } - if (!reachedCurr && !start.deleted) { - updateCurrentAttributes(currAttributes, /** @type {ContentFormat} */ (content)); - } - break - } - } - } - start = /** @type {Item} */ (start.right); - } - return cleanups -}; - -/** - * @param {Transaction} transaction - * @param {Item | null} item - */ -const cleanupContextlessFormattingGap = (transaction, item) => { - // iterate until item.right is null or content - while (item && item.right && (item.right.deleted || !item.right.countable)) { - item = item.right; - } - const attrs = new Set(); - // iterate back until a content item is found - while (item && (item.deleted || !item.countable)) { - if (!item.deleted && item.content.constructor === ContentFormat) { - const key = /** @type {ContentFormat} */ (item.content).key; - if (attrs.has(key)) { - item.delete(transaction); - } else { - attrs.add(key); - } - } - item = item.left; - } -}; - -/** - * This function is experimental and subject to change / be removed. - * - * Ideally, we don't need this function at all. Formatting attributes should be cleaned up - * automatically after each change. This function iterates twice over the complete YText type - * and removes unnecessary formatting attributes. This is also helpful for testing. - * - * This function won't be exported anymore as soon as there is confidence that the YText type works as intended. - * - * @param {YText} type - * @return {number} How many formatting attributes have been cleaned up. - */ -const cleanupYTextFormatting = type => { - let res = 0; - transact(/** @type {Doc} */ (type.doc), transaction => { - let start = /** @type {Item} */ (type._start); - let end = type._start; - let startAttributes = map__namespace.create(); - const currentAttributes = map__namespace.copy(startAttributes); - while (end) { - if (end.deleted === false) { - switch (end.content.constructor) { - case ContentFormat: - updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (end.content)); - break - default: - res += cleanupFormattingGap(transaction, start, end, startAttributes, currentAttributes); - startAttributes = map__namespace.copy(currentAttributes); - start = end; - break - } - } - end = end.right; - } - }); - return res -}; - -/** - * This will be called by the transaction once the event handlers are called to potentially cleanup - * formatting attributes. - * - * @param {Transaction} transaction - */ -const cleanupYTextAfterTransaction = transaction => { - /** - * @type {Set} - */ - const needFullCleanup = new Set(); - // check if another formatting item was inserted - const doc = transaction.doc; - for (const [client, afterClock] of transaction.afterState.entries()) { - const clock = transaction.beforeState.get(client) || 0; - if (afterClock === clock) { - continue - } - iterateStructs(transaction, /** @type {Array} */ (doc.store.clients.get(client)), clock, afterClock, item => { - if ( - !item.deleted && /** @type {Item} */ (item).content.constructor === ContentFormat && item.constructor !== GC - ) { - needFullCleanup.add(/** @type {any} */ (item).parent); - } - }); - } - // cleanup in a new transaction - transact(doc, (t) => { - iterateDeletedStructs(transaction, transaction.deleteSet, item => { - if (item instanceof GC || !(/** @type {YText} */ (item.parent)._hasFormatting) || needFullCleanup.has(/** @type {YText} */ (item.parent))) { - return - } - const parent = /** @type {YText} */ (item.parent); - if (item.content.constructor === ContentFormat) { - needFullCleanup.add(parent); - } else { - // If no formatting attribute was inserted or deleted, we can make due with contextless - // formatting cleanups. - // Contextless: it is not necessary to compute currentAttributes for the affected position. - cleanupContextlessFormattingGap(t, item); - } - }); - // If a formatting item was inserted, we simply clean the whole type. - // We need to compute currentAttributes for the current position anyway. - for (const yText of needFullCleanup) { - cleanupYTextFormatting(yText); - } - }); -}; - -/** - * @param {Transaction} transaction - * @param {ItemTextListPosition} currPos - * @param {number} length - * @return {ItemTextListPosition} - * - * @private - * @function - */ -const deleteText = (transaction, currPos, length) => { - const startLength = length; - const startAttrs = map__namespace.copy(currPos.currentAttributes); - const start = currPos.right; - while (length > 0 && currPos.right !== null) { - if (currPos.right.deleted === false) { - switch (currPos.right.content.constructor) { - case ContentType: - case ContentEmbed: - case ContentString: - if (length < currPos.right.length) { - getItemCleanStart(transaction, createID(currPos.right.id.client, currPos.right.id.clock + length)); - } - length -= currPos.right.length; - currPos.right.delete(transaction); - break - } - } - currPos.forward(); - } - if (start) { - cleanupFormattingGap(transaction, start, currPos.right, startAttrs, currPos.currentAttributes); - } - const parent = /** @type {AbstractType} */ (/** @type {Item} */ (currPos.left || currPos.right).parent); - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, currPos.index, -startLength + length); - } - return currPos -}; - -/** - * The Quill Delta format represents changes on a text document with - * formatting information. For more information visit {@link https://quilljs.com/docs/delta/|Quill Delta} - * - * @example - * { - * ops: [ - * { insert: 'Gandalf', attributes: { bold: true } }, - * { insert: ' the ' }, - * { insert: 'Grey', attributes: { color: '#cccccc' } } - * ] - * } - * - */ - -/** - * Attributes that can be assigned to a selection of text. - * - * @example - * { - * bold: true, - * font-size: '40px' - * } - * - * @typedef {Object} TextAttributes - */ - -/** - * @extends YEvent - * Event that describes the changes on a YText type. - */ -class YTextEvent extends YEvent { - /** - * @param {YText} ytext - * @param {Transaction} transaction - * @param {Set} subs The keys that changed - */ - constructor (ytext, transaction, subs) { - super(ytext, transaction); - /** - * Whether the children changed. - * @type {Boolean} - * @private - */ - this.childListChanged = false; - /** - * Set of all changed attributes. - * @type {Set} - */ - this.keysChanged = new Set(); - subs.forEach((sub) => { - if (sub === null) { - this.childListChanged = true; - } else { - this.keysChanged.add(sub); - } - }); - } - - /** - * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string, delete?:number, retain?:number}>}} - */ - get changes () { - if (this._changes === null) { - /** - * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string|AbstractType|object, delete?:number, retain?:number}>}} - */ - const changes = { - keys: this.keys, - delta: this.delta, - added: new Set(), - deleted: new Set() - }; - this._changes = changes; - } - return /** @type {any} */ (this._changes) - } - - /** - * Compute the changes in the delta format. - * A {@link https://quilljs.com/docs/delta/|Quill Delta}) that represents the changes on the document. - * - * @type {Array<{insert?:string|object|AbstractType, delete?:number, retain?:number, attributes?: Object}>} - * - * @public - */ - get delta () { - if (this._delta === null) { - const y = /** @type {Doc} */ (this.target.doc); - /** - * @type {Array<{insert?:string|object|AbstractType, delete?:number, retain?:number, attributes?: Object}>} - */ - const delta = []; - transact(y, transaction => { - const currentAttributes = new Map(); // saves all current attributes for insert - const oldAttributes = new Map(); - let item = this.target._start; - /** - * @type {string?} - */ - let action = null; - /** - * @type {Object} - */ - const attributes = {}; // counts added or removed new attributes for retain - /** - * @type {string|object} - */ - let insert = ''; - let retain = 0; - let deleteLen = 0; - const addOp = () => { - if (action !== null) { - /** - * @type {any} - */ - let op = null; - switch (action) { - case 'delete': - if (deleteLen > 0) { - op = { delete: deleteLen }; - } - deleteLen = 0; - break - case 'insert': - if (typeof insert === 'object' || insert.length > 0) { - op = { insert }; - if (currentAttributes.size > 0) { - op.attributes = {}; - currentAttributes.forEach((value, key) => { - if (value !== null) { - op.attributes[key] = value; - } - }); - } - } - insert = ''; - break - case 'retain': - if (retain > 0) { - op = { retain }; - if (!object__namespace.isEmpty(attributes)) { - op.attributes = object__namespace.assign({}, attributes); - } - } - retain = 0; - break - } - if (op) delta.push(op); - action = null; - } - }; - while (item !== null) { - switch (item.content.constructor) { - case ContentType: - case ContentEmbed: - if (this.adds(item)) { - if (!this.deletes(item)) { - addOp(); - action = 'insert'; - insert = item.content.getContent()[0]; - addOp(); - } - } else if (this.deletes(item)) { - if (action !== 'delete') { - addOp(); - action = 'delete'; - } - deleteLen += 1; - } else if (!item.deleted) { - if (action !== 'retain') { - addOp(); - action = 'retain'; - } - retain += 1; - } - break - case ContentString: - if (this.adds(item)) { - if (!this.deletes(item)) { - if (action !== 'insert') { - addOp(); - action = 'insert'; - } - insert += /** @type {ContentString} */ (item.content).str; - } - } else if (this.deletes(item)) { - if (action !== 'delete') { - addOp(); - action = 'delete'; - } - deleteLen += item.length; - } else if (!item.deleted) { - if (action !== 'retain') { - addOp(); - action = 'retain'; - } - retain += item.length; - } - break - case ContentFormat: { - const { key, value } = /** @type {ContentFormat} */ (item.content); - if (this.adds(item)) { - if (!this.deletes(item)) { - const curVal = currentAttributes.get(key) ?? null; - if (!equalAttrs(curVal, value)) { - if (action === 'retain') { - addOp(); - } - if (equalAttrs(value, (oldAttributes.get(key) ?? null))) { - delete attributes[key]; - } else { - attributes[key] = value; - } - } else if (value !== null) { - item.delete(transaction); - } - } - } else if (this.deletes(item)) { - oldAttributes.set(key, value); - const curVal = currentAttributes.get(key) ?? null; - if (!equalAttrs(curVal, value)) { - if (action === 'retain') { - addOp(); - } - attributes[key] = curVal; - } - } else if (!item.deleted) { - oldAttributes.set(key, value); - const attr = attributes[key]; - if (attr !== undefined) { - if (!equalAttrs(attr, value)) { - if (action === 'retain') { - addOp(); - } - if (value === null) { - delete attributes[key]; - } else { - attributes[key] = value; - } - } else if (attr !== null) { // this will be cleaned up automatically by the contextless cleanup function - item.delete(transaction); - } - } - } - if (!item.deleted) { - if (action === 'insert') { - addOp(); - } - updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (item.content)); - } - break - } - } - item = item.right; - } - addOp(); - while (delta.length > 0) { - const lastOp = delta[delta.length - 1]; - if (lastOp.retain !== undefined && lastOp.attributes === undefined) { - // retain delta's if they don't assign attributes - delta.pop(); - } else { - break - } - } - }); - this._delta = delta; - } - return /** @type {any} */ (this._delta) - } -} - -/** - * Type that represents text with formatting information. - * - * This type replaces y-richtext as this implementation is able to handle - * block formats (format information on a paragraph), embeds (complex elements - * like pictures and videos), and text formats (**bold**, *italic*). - * - * @extends AbstractType - */ -class YText extends AbstractType { - /** - * @param {String} [string] The initial value of the YText. - */ - constructor (string) { - super(); - /** - * Array of pending operations on this type - * @type {Array?} - */ - this._pending = string !== undefined ? [() => this.insert(0, string)] : []; - /** - * @type {Array|null} - */ - this._searchMarker = []; - /** - * Whether this YText contains formatting attributes. - * This flag is updated when a formatting item is integrated (see ContentFormat.integrate) - */ - this._hasFormatting = false; - } - - /** - * Number of characters of this text type. - * - * @type {number} - */ - get length () { - this.doc ?? warnPrematureAccess(); - return this._length - } - - /** - * @param {Doc} y - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item); - try { - /** @type {Array} */ (this._pending).forEach(f => f()); - } catch (e) { - console.error(e); - } - this._pending = null; - } - - _copy () { - return new YText() - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YText} - */ - clone () { - const text = new YText(); - text.applyDelta(this.toDelta()); - return text - } - - /** - * Creates YTextEvent and calls observers. - * - * @param {Transaction} transaction - * @param {Set} parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, parentSubs) { - super._callObserver(transaction, parentSubs); - const event = new YTextEvent(this, transaction, parentSubs); - callTypeObservers(this, transaction, event); - // If a remote change happened, we try to cleanup potential formatting duplicates. - if (!transaction.local && this._hasFormatting) { - transaction._needFormattingCleanup = true; - } - } - - /** - * Returns the unformatted string representation of this YText type. - * - * @public - */ - toString () { - this.doc ?? warnPrematureAccess(); - let str = ''; - /** - * @type {Item|null} - */ - let n = this._start; - while (n !== null) { - if (!n.deleted && n.countable && n.content.constructor === ContentString) { - str += /** @type {ContentString} */ (n.content).str; - } - n = n.right; - } - return str - } - - /** - * Returns the unformatted string representation of this YText type. - * - * @return {string} - * @public - */ - toJSON () { - return this.toString() - } - - /** - * Apply a {@link Delta} on this shared YText type. - * - * @param {Array} delta The changes to apply on this element. - * @param {object} opts - * @param {boolean} [opts.sanitize] Sanitize input delta. Removes ending newlines if set to true. - * - * - * @public - */ - applyDelta (delta, { sanitize = true } = {}) { - if (this.doc !== null) { - transact(this.doc, transaction => { - const currPos = new ItemTextListPosition(null, this._start, 0, new Map()); - for (let i = 0; i < delta.length; i++) { - const op = delta[i]; - if (op.insert !== undefined) { - // Quill assumes that the content starts with an empty paragraph. - // Yjs/Y.Text assumes that it starts empty. We always hide that - // there is a newline at the end of the content. - // If we omit this step, clients will see a different number of - // paragraphs, but nothing bad will happen. - const ins = (!sanitize && typeof op.insert === 'string' && i === delta.length - 1 && currPos.right === null && op.insert.slice(-1) === '\n') ? op.insert.slice(0, -1) : op.insert; - if (typeof ins !== 'string' || ins.length > 0) { - insertText(transaction, this, currPos, ins, op.attributes || {}); - } - } else if (op.retain !== undefined) { - formatText(transaction, this, currPos, op.retain, op.attributes || {}); - } else if (op.delete !== undefined) { - deleteText(transaction, currPos, op.delete); - } - } - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.applyDelta(delta)); - } - } - - /** - * Returns the Delta representation of this YText type. - * - * @param {Snapshot} [snapshot] - * @param {Snapshot} [prevSnapshot] - * @param {function('removed' | 'added', ID):any} [computeYChange] - * @return {any} The Delta representation of this type. - * - * @public - */ - toDelta (snapshot, prevSnapshot, computeYChange) { - this.doc ?? warnPrematureAccess(); - /** - * @type{Array} - */ - const ops = []; - const currentAttributes = new Map(); - const doc = /** @type {Doc} */ (this.doc); - let str = ''; - let n = this._start; - function packStr () { - if (str.length > 0) { - // pack str with attributes to ops - /** - * @type {Object} - */ - const attributes = {}; - let addAttributes = false; - currentAttributes.forEach((value, key) => { - addAttributes = true; - attributes[key] = value; - }); - /** - * @type {Object} - */ - const op = { insert: str }; - if (addAttributes) { - op.attributes = attributes; - } - ops.push(op); - str = ''; - } - } - const computeDelta = () => { - while (n !== null) { - if (isVisible(n, snapshot) || (prevSnapshot !== undefined && isVisible(n, prevSnapshot))) { - switch (n.content.constructor) { - case ContentString: { - const cur = currentAttributes.get('ychange'); - if (snapshot !== undefined && !isVisible(n, snapshot)) { - if (cur === undefined || cur.user !== n.id.client || cur.type !== 'removed') { - packStr(); - currentAttributes.set('ychange', computeYChange ? computeYChange('removed', n.id) : { type: 'removed' }); - } - } else if (prevSnapshot !== undefined && !isVisible(n, prevSnapshot)) { - if (cur === undefined || cur.user !== n.id.client || cur.type !== 'added') { - packStr(); - currentAttributes.set('ychange', computeYChange ? computeYChange('added', n.id) : { type: 'added' }); - } - } else if (cur !== undefined) { - packStr(); - currentAttributes.delete('ychange'); - } - str += /** @type {ContentString} */ (n.content).str; - break - } - case ContentType: - case ContentEmbed: { - packStr(); - /** - * @type {Object} - */ - const op = { - insert: n.content.getContent()[0] - }; - if (currentAttributes.size > 0) { - const attrs = /** @type {Object} */ ({}); - op.attributes = attrs; - currentAttributes.forEach((value, key) => { - attrs[key] = value; - }); - } - ops.push(op); - break - } - case ContentFormat: - if (isVisible(n, snapshot)) { - packStr(); - updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (n.content)); - } - break - } - } - n = n.right; - } - packStr(); - }; - if (snapshot || prevSnapshot) { - // snapshots are merged again after the transaction, so we need to keep the - // transaction alive until we are done - transact(doc, transaction => { - if (snapshot) { - splitSnapshotAffectedStructs(transaction, snapshot); - } - if (prevSnapshot) { - splitSnapshotAffectedStructs(transaction, prevSnapshot); - } - computeDelta(); - }, 'cleanup'); - } else { - computeDelta(); - } - return ops - } - - /** - * Insert text at a given index. - * - * @param {number} index The index at which to start inserting. - * @param {String} text The text to insert at the specified position. - * @param {TextAttributes} [attributes] Optionally define some formatting - * information to apply on the inserted - * Text. - * @public - */ - insert (index, text, attributes) { - if (text.length <= 0) { - return - } - const y = this.doc; - if (y !== null) { - transact(y, transaction => { - const pos = findPosition(transaction, this, index, !attributes); - if (!attributes) { - attributes = {}; - // @ts-ignore - pos.currentAttributes.forEach((v, k) => { attributes[k] = v; }); - } - insertText(transaction, this, pos, text, attributes); - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.insert(index, text, attributes)); - } - } - - /** - * Inserts an embed at a index. - * - * @param {number} index The index to insert the embed at. - * @param {Object | AbstractType} embed The Object that represents the embed. - * @param {TextAttributes} [attributes] Attribute information to apply on the - * embed - * - * @public - */ - insertEmbed (index, embed, attributes) { - const y = this.doc; - if (y !== null) { - transact(y, transaction => { - const pos = findPosition(transaction, this, index, !attributes); - insertText(transaction, this, pos, embed, attributes || {}); - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.insertEmbed(index, embed, attributes || {})); - } - } - - /** - * Deletes text starting from an index. - * - * @param {number} index Index at which to start deleting. - * @param {number} length The number of characters to remove. Defaults to 1. - * - * @public - */ - delete (index, length) { - if (length === 0) { - return - } - const y = this.doc; - if (y !== null) { - transact(y, transaction => { - deleteText(transaction, findPosition(transaction, this, index, true), length); - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.delete(index, length)); - } - } - - /** - * Assigns properties to a range of text. - * - * @param {number} index The position where to start formatting. - * @param {number} length The amount of characters to assign properties to. - * @param {TextAttributes} attributes Attribute information to apply on the - * text. - * - * @public - */ - format (index, length, attributes) { - if (length === 0) { - return - } - const y = this.doc; - if (y !== null) { - transact(y, transaction => { - const pos = findPosition(transaction, this, index, false); - if (pos.right === null) { - return - } - formatText(transaction, this, pos, length, attributes); - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.format(index, length, attributes)); - } - } - - /** - * Removes an attribute. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @param {String} attributeName The attribute name that is to be removed. - * - * @public - */ - removeAttribute (attributeName) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapDelete(transaction, this, attributeName); - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.removeAttribute(attributeName)); - } - } - - /** - * Sets or updates an attribute. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @param {String} attributeName The attribute name that is to be set. - * @param {any} attributeValue The attribute value that is to be set. - * - * @public - */ - setAttribute (attributeName, attributeValue) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapSet(transaction, this, attributeName, attributeValue); - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.setAttribute(attributeName, attributeValue)); - } - } - - /** - * Returns an attribute value that belongs to the attribute name. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @param {String} attributeName The attribute name that identifies the - * queried value. - * @return {any} The queried attribute value. - * - * @public - */ - getAttribute (attributeName) { - return /** @type {any} */ (typeMapGet(this, attributeName)) - } - - /** - * Returns all attribute name/value pairs in a JSON Object. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @return {Object} A JSON Object that describes the attributes. - * - * @public - */ - getAttributes () { - return typeMapGetAll(this) - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - */ - _write (encoder) { - encoder.writeTypeRef(YTextRefID); - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder - * @return {YText} - * - * @private - * @function - */ -const readYText = _decoder => new YText(); - -/** - * @module YXml - */ - - -/** - * Define the elements to which a set of CSS queries apply. - * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors|CSS_Selectors} - * - * @example - * query = '.classSelector' - * query = 'nodeSelector' - * query = '#idSelector' - * - * @typedef {string} CSS_Selector - */ - -/** - * Dom filter function. - * - * @callback domFilter - * @param {string} nodeName The nodeName of the element - * @param {Map} attributes The map of attributes. - * @return {boolean} Whether to include the Dom node in the YXmlElement. - */ - -/** - * Represents a subset of the nodes of a YXmlElement / YXmlFragment and a - * position within them. - * - * Can be created with {@link YXmlFragment#createTreeWalker} - * - * @public - * @implements {Iterable} - */ -class YXmlTreeWalker { - /** - * @param {YXmlFragment | YXmlElement} root - * @param {function(AbstractType):boolean} [f] - */ - constructor (root, f = () => true) { - this._filter = f; - this._root = root; - /** - * @type {Item} - */ - this._currentNode = /** @type {Item} */ (root._start); - this._firstCall = true; - root.doc ?? warnPrematureAccess(); - } - - [Symbol.iterator] () { - return this - } - - /** - * Get the next node. - * - * @return {IteratorResult} The next node. - * - * @public - */ - next () { - /** - * @type {Item|null} - */ - let n = this._currentNode; - let type = n && n.content && /** @type {any} */ (n.content).type; - if (n !== null && (!this._firstCall || n.deleted || !this._filter(type))) { // if first call, we check if we can use the first item - do { - type = /** @type {any} */ (n.content).type; - if (!n.deleted && (type.constructor === YXmlElement || type.constructor === YXmlFragment) && type._start !== null) { - // walk down in the tree - n = type._start; - } else { - // walk right or up in the tree - while (n !== null) { - /** - * @type {Item | null} - */ - const nxt = n.next; - if (nxt !== null) { - n = nxt; - break - } else if (n.parent === this._root) { - n = null; - } else { - n = /** @type {AbstractType} */ (n.parent)._item; - } - } - } - } while (n !== null && (n.deleted || !this._filter(/** @type {ContentType} */ (n.content).type))) - } - this._firstCall = false; - if (n === null) { - // @ts-ignore - return { value: undefined, done: true } - } - this._currentNode = n; - return { value: /** @type {any} */ (n.content).type, done: false } - } -} - -/** - * Represents a list of {@link YXmlElement}.and {@link YXmlText} types. - * A YxmlFragment is similar to a {@link YXmlElement}, but it does not have a - * nodeName and it does not have attributes. Though it can be bound to a DOM - * element - in this case the attributes and the nodeName are not shared. - * - * @public - * @extends AbstractType - */ -class YXmlFragment extends AbstractType { - constructor () { - super(); - /** - * @type {Array|null} - */ - this._prelimContent = []; - } - - /** - * @type {YXmlElement|YXmlText|null} - */ - get firstChild () { - const first = this._first; - return first ? first.content.getContent()[0] : null - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item); - this.insert(0, /** @type {Array} */ (this._prelimContent)); - this._prelimContent = null; - } - - _copy () { - return new YXmlFragment() - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YXmlFragment} - */ - clone () { - const el = new YXmlFragment(); - // @ts-ignore - el.insert(0, this.toArray().map(item => item instanceof AbstractType ? item.clone() : item)); - return el - } - - get length () { - this.doc ?? warnPrematureAccess(); - return this._prelimContent === null ? this._length : this._prelimContent.length - } - - /** - * Create a subtree of childNodes. - * - * @example - * const walker = elem.createTreeWalker(dom => dom.nodeName === 'div') - * for (let node in walker) { - * // `node` is a div node - * nop(node) - * } - * - * @param {function(AbstractType):boolean} filter Function that is called on each child element and - * returns a Boolean indicating whether the child - * is to be included in the subtree. - * @return {YXmlTreeWalker} A subtree and a position within it. - * - * @public - */ - createTreeWalker (filter) { - return new YXmlTreeWalker(this, filter) - } - - /** - * Returns the first YXmlElement that matches the query. - * Similar to DOM's {@link querySelector}. - * - * Query support: - * - tagname - * TODO: - * - id - * - attribute - * - * @param {CSS_Selector} query The query on the children. - * @return {YXmlElement|YXmlText|YXmlHook|null} The first element that matches the query or null. - * - * @public - */ - querySelector (query) { - query = query.toUpperCase(); - // @ts-ignore - const iterator = new YXmlTreeWalker(this, element => element.nodeName && element.nodeName.toUpperCase() === query); - const next = iterator.next(); - if (next.done) { - return null - } else { - return next.value - } - } - - /** - * Returns all YXmlElements that match the query. - * Similar to Dom's {@link querySelectorAll}. - * - * @todo Does not yet support all queries. Currently only query by tagName. - * - * @param {CSS_Selector} query The query on the children - * @return {Array} The elements that match this query. - * - * @public - */ - querySelectorAll (query) { - query = query.toUpperCase(); - // @ts-ignore - return array__namespace.from(new YXmlTreeWalker(this, element => element.nodeName && element.nodeName.toUpperCase() === query)) - } - - /** - * Creates YXmlEvent and calls observers. - * - * @param {Transaction} transaction - * @param {Set} parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, parentSubs) { - callTypeObservers(this, transaction, new YXmlEvent(this, parentSubs, transaction)); - } - - /** - * Get the string representation of all the children of this YXmlFragment. - * - * @return {string} The string representation of all children. - */ - toString () { - return typeListMap(this, xml => xml.toString()).join('') - } - - /** - * @return {string} - */ - toJSON () { - return this.toString() - } - - /** - * Creates a Dom Element that mirrors this YXmlElement. - * - * @param {Document} [_document=document] The document object (you must define - * this when calling this method in - * nodejs) - * @param {Object} [hooks={}] Optional property to customize how hooks - * are presented in the DOM - * @param {any} [binding] You should not set this property. This is - * used if DomBinding wants to create a - * association to the created DOM type. - * @return {Node} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element} - * - * @public - */ - toDOM (_document = document, hooks = {}, binding) { - const fragment = _document.createDocumentFragment(); - if (binding !== undefined) { - binding._createAssociation(fragment, this); - } - typeListForEach(this, xmlType => { - fragment.insertBefore(xmlType.toDOM(_document, hooks, binding), null); - }); - return fragment - } - - /** - * Inserts new content at an index. - * - * @example - * // Insert character 'a' at position 0 - * xml.insert(0, [new Y.XmlText('text')]) - * - * @param {number} index The index to insert content at - * @param {Array} content The array of content - */ - insert (index, content) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListInsertGenerics(transaction, this, index, content); - }); - } else { - // @ts-ignore _prelimContent is defined because this is not yet integrated - this._prelimContent.splice(index, 0, ...content); - } - } - - /** - * Inserts new content at an index. - * - * @example - * // Insert character 'a' at position 0 - * xml.insert(0, [new Y.XmlText('text')]) - * - * @param {null|Item|YXmlElement|YXmlText} ref The index to insert content at - * @param {Array} content The array of content - */ - insertAfter (ref, content) { - if (this.doc !== null) { - transact(this.doc, transaction => { - const refItem = (ref && ref instanceof AbstractType) ? ref._item : ref; - typeListInsertGenericsAfter(transaction, this, refItem, content); - }); - } else { - const pc = /** @type {Array} */ (this._prelimContent); - const index = ref === null ? 0 : pc.findIndex(el => el === ref) + 1; - if (index === 0 && ref !== null) { - throw error__namespace.create('Reference item not found') - } - pc.splice(index, 0, ...content); - } - } - - /** - * Deletes elements starting from an index. - * - * @param {number} index Index at which to start deleting elements - * @param {number} [length=1] The number of elements to remove. Defaults to 1. - */ - delete (index, length = 1) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListDelete(transaction, this, index, length); - }); - } else { - // @ts-ignore _prelimContent is defined because this is not yet integrated - this._prelimContent.splice(index, length); - } - } - - /** - * Transforms this YArray to a JavaScript Array. - * - * @return {Array} - */ - toArray () { - return typeListToArray(this) - } - - /** - * Appends content to this YArray. - * - * @param {Array} content Array of content to append. - */ - push (content) { - this.insert(this.length, content); - } - - /** - * Prepends content to this YArray. - * - * @param {Array} content Array of content to prepend. - */ - unshift (content) { - this.insert(0, content); - } - - /** - * Returns the i-th element from a YArray. - * - * @param {number} index The index of the element to return from the YArray - * @return {YXmlElement|YXmlText} - */ - get (index) { - return typeListGet(this, index) - } - - /** - * Returns a portion of this YXmlFragment into a JavaScript Array selected - * from start to end (end not included). - * - * @param {number} [start] - * @param {number} [end] - * @return {Array} - */ - slice (start = 0, end = this.length) { - return typeListSlice(this, start, end) - } - - /** - * Executes a provided function on once on every child element. - * - * @param {function(YXmlElement|YXmlText,number, typeof self):void} f A function to execute on every element of this YArray. - */ - forEach (f) { - typeListForEach(this, f); - } - - /** - * Transform the properties of this type to binary and write it to an - * BinaryEncoder. - * - * This is called when this Item is sent to a remote peer. - * - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - */ - _write (encoder) { - encoder.writeTypeRef(YXmlFragmentRefID); - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder - * @return {YXmlFragment} - * - * @private - * @function - */ -const readYXmlFragment = _decoder => new YXmlFragment(); - -/** - * @typedef {Object|number|null|Array|string|Uint8Array|AbstractType} ValueTypes - */ - -/** - * An YXmlElement imitates the behavior of a - * https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element - * - * * An YXmlElement has attributes (key value pairs) - * * An YXmlElement has childElements that must inherit from YXmlElement - * - * @template {{ [key: string]: ValueTypes }} [KV={ [key: string]: string }] - */ -class YXmlElement extends YXmlFragment { - constructor (nodeName = 'UNDEFINED') { - super(); - this.nodeName = nodeName; - /** - * @type {Map|null} - */ - this._prelimAttrs = new Map(); - } - - /** - * @type {YXmlElement|YXmlText|null} - */ - get nextSibling () { - const n = this._item ? this._item.next : null; - return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null - } - - /** - * @type {YXmlElement|YXmlText|null} - */ - get prevSibling () { - const n = this._item ? this._item.prev : null; - return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item) - ;(/** @type {Map} */ (this._prelimAttrs)).forEach((value, key) => { - this.setAttribute(key, value); - }); - this._prelimAttrs = null; - } - - /** - * Creates an Item with the same effect as this Item (without position effect) - * - * @return {YXmlElement} - */ - _copy () { - return new YXmlElement(this.nodeName) - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YXmlElement} - */ - clone () { - /** - * @type {YXmlElement} - */ - const el = new YXmlElement(this.nodeName); - const attrs = this.getAttributes(); - object__namespace.forEach(attrs, (value, key) => { - el.setAttribute(key, /** @type {any} */ (value)); - }); - // @ts-ignore - el.insert(0, this.toArray().map(v => v instanceof AbstractType ? v.clone() : v)); - return el - } - - /** - * Returns the XML serialization of this YXmlElement. - * The attributes are ordered by attribute-name, so you can easily use this - * method to compare YXmlElements - * - * @return {string} The string representation of this type. - * - * @public - */ - toString () { - const attrs = this.getAttributes(); - const stringBuilder = []; - const keys = []; - for (const key in attrs) { - keys.push(key); - } - keys.sort(); - const keysLen = keys.length; - for (let i = 0; i < keysLen; i++) { - const key = keys[i]; - stringBuilder.push(key + '="' + attrs[key] + '"'); - } - const nodeName = this.nodeName.toLocaleLowerCase(); - const attrsString = stringBuilder.length > 0 ? ' ' + stringBuilder.join(' ') : ''; - return `<${nodeName}${attrsString}>${super.toString()}` - } - - /** - * Removes an attribute from this YXmlElement. - * - * @param {string} attributeName The attribute name that is to be removed. - * - * @public - */ - removeAttribute (attributeName) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapDelete(transaction, this, attributeName); - }); - } else { - /** @type {Map} */ (this._prelimAttrs).delete(attributeName); - } - } - - /** - * Sets or updates an attribute. - * - * @template {keyof KV & string} KEY - * - * @param {KEY} attributeName The attribute name that is to be set. - * @param {KV[KEY]} attributeValue The attribute value that is to be set. - * - * @public - */ - setAttribute (attributeName, attributeValue) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapSet(transaction, this, attributeName, attributeValue); - }); - } else { - /** @type {Map} */ (this._prelimAttrs).set(attributeName, attributeValue); - } - } - - /** - * Returns an attribute value that belongs to the attribute name. - * - * @template {keyof KV & string} KEY - * - * @param {KEY} attributeName The attribute name that identifies the - * queried value. - * @return {KV[KEY]|undefined} The queried attribute value. - * - * @public - */ - getAttribute (attributeName) { - return /** @type {any} */ (typeMapGet(this, attributeName)) - } - - /** - * Returns whether an attribute exists - * - * @param {string} attributeName The attribute name to check for existence. - * @return {boolean} whether the attribute exists. - * - * @public - */ - hasAttribute (attributeName) { - return /** @type {any} */ (typeMapHas(this, attributeName)) - } - - /** - * Returns all attribute name/value pairs in a JSON Object. - * - * @param {Snapshot} [snapshot] - * @return {{ [Key in Extract]?: KV[Key]}} A JSON Object that describes the attributes. - * - * @public - */ - getAttributes (snapshot) { - return /** @type {any} */ (snapshot ? typeMapGetAllSnapshot(this, snapshot) : typeMapGetAll(this)) - } - - /** - * Creates a Dom Element that mirrors this YXmlElement. - * - * @param {Document} [_document=document] The document object (you must define - * this when calling this method in - * nodejs) - * @param {Object} [hooks={}] Optional property to customize how hooks - * are presented in the DOM - * @param {any} [binding] You should not set this property. This is - * used if DomBinding wants to create a - * association to the created DOM type. - * @return {Node} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element} - * - * @public - */ - toDOM (_document = document, hooks = {}, binding) { - const dom = _document.createElement(this.nodeName); - const attrs = this.getAttributes(); - for (const key in attrs) { - const value = attrs[key]; - if (typeof value === 'string') { - dom.setAttribute(key, value); - } - } - typeListForEach(this, yxml => { - dom.appendChild(yxml.toDOM(_document, hooks, binding)); - }); - if (binding !== undefined) { - binding._createAssociation(dom, this); - } - return dom - } - - /** - * Transform the properties of this type to binary and write it to an - * BinaryEncoder. - * - * This is called when this Item is sent to a remote peer. - * - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - */ - _write (encoder) { - encoder.writeTypeRef(YXmlElementRefID); - encoder.writeKey(this.nodeName); - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {YXmlElement} - * - * @function - */ -const readYXmlElement = decoder => new YXmlElement(decoder.readKey()); - -/** - * @extends YEvent - * An Event that describes changes on a YXml Element or Yxml Fragment - */ -class YXmlEvent extends YEvent { - /** - * @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created. - * @param {Set} subs The set of changed attributes. `null` is included if the - * child list changed. - * @param {Transaction} transaction The transaction instance with which the - * change was created. - */ - constructor (target, subs, transaction) { - super(target, transaction); - /** - * Whether the children changed. - * @type {Boolean} - * @private - */ - this.childListChanged = false; - /** - * Set of all changed attributes. - * @type {Set} - */ - this.attributesChanged = new Set(); - subs.forEach((sub) => { - if (sub === null) { - this.childListChanged = true; - } else { - this.attributesChanged.add(sub); - } - }); - } -} - -/** - * You can manage binding to a custom type with YXmlHook. - * - * @extends {YMap} - */ -class YXmlHook extends YMap { - /** - * @param {string} hookName nodeName of the Dom Node. - */ - constructor (hookName) { - super(); - /** - * @type {string} - */ - this.hookName = hookName; - } - - /** - * Creates an Item with the same effect as this Item (without position effect) - */ - _copy () { - return new YXmlHook(this.hookName) - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YXmlHook} - */ - clone () { - const el = new YXmlHook(this.hookName); - this.forEach((value, key) => { - el.set(key, value); - }); - return el - } - - /** - * Creates a Dom Element that mirrors this YXmlElement. - * - * @param {Document} [_document=document] The document object (you must define - * this when calling this method in - * nodejs) - * @param {Object.} [hooks] Optional property to customize how hooks - * are presented in the DOM - * @param {any} [binding] You should not set this property. This is - * used if DomBinding wants to create a - * association to the created DOM type - * @return {Element} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element} - * - * @public - */ - toDOM (_document = document, hooks = {}, binding) { - const hook = hooks[this.hookName]; - let dom; - if (hook !== undefined) { - dom = hook.createDom(this); - } else { - dom = document.createElement(this.hookName); - } - dom.setAttribute('data-yjs-hook', this.hookName); - if (binding !== undefined) { - binding._createAssociation(dom, this); - } - return dom - } - - /** - * Transform the properties of this type to binary and write it to an - * BinaryEncoder. - * - * This is called when this Item is sent to a remote peer. - * - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - */ - _write (encoder) { - encoder.writeTypeRef(YXmlHookRefID); - encoder.writeKey(this.hookName); - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {YXmlHook} - * - * @private - * @function - */ -const readYXmlHook = decoder => - new YXmlHook(decoder.readKey()); - -/** - * Represents text in a Dom Element. In the future this type will also handle - * simple formatting information like bold and italic. - */ -class YXmlText extends YText { - /** - * @type {YXmlElement|YXmlText|null} - */ - get nextSibling () { - const n = this._item ? this._item.next : null; - return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null - } - - /** - * @type {YXmlElement|YXmlText|null} - */ - get prevSibling () { - const n = this._item ? this._item.prev : null; - return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null - } - - _copy () { - return new YXmlText() - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YXmlText} - */ - clone () { - const text = new YXmlText(); - text.applyDelta(this.toDelta()); - return text - } - - /** - * Creates a Dom Element that mirrors this YXmlText. - * - * @param {Document} [_document=document] The document object (you must define - * this when calling this method in - * nodejs) - * @param {Object} [hooks] Optional property to customize how hooks - * are presented in the DOM - * @param {any} [binding] You should not set this property. This is - * used if DomBinding wants to create a - * association to the created DOM type. - * @return {Text} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element} - * - * @public - */ - toDOM (_document = document, hooks, binding) { - const dom = _document.createTextNode(this.toString()); - if (binding !== undefined) { - binding._createAssociation(dom, this); - } - return dom - } - - toString () { - // @ts-ignore - return this.toDelta().map(delta => { - const nestedNodes = []; - for (const nodeName in delta.attributes) { - const attrs = []; - for (const key in delta.attributes[nodeName]) { - attrs.push({ key, value: delta.attributes[nodeName][key] }); - } - // sort attributes to get a unique order - attrs.sort((a, b) => a.key < b.key ? -1 : 1); - nestedNodes.push({ nodeName, attrs }); - } - // sort node order to get a unique order - nestedNodes.sort((a, b) => a.nodeName < b.nodeName ? -1 : 1); - // now convert to dom string - let str = ''; - for (let i = 0; i < nestedNodes.length; i++) { - const node = nestedNodes[i]; - str += `<${node.nodeName}`; - for (let j = 0; j < node.attrs.length; j++) { - const attr = node.attrs[j]; - str += ` ${attr.key}="${attr.value}"`; - } - str += '>'; - } - str += delta.insert; - for (let i = nestedNodes.length - 1; i >= 0; i--) { - str += ``; - } - return str - }).join('') - } - - /** - * @return {string} - */ - toJSON () { - return this.toString() - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - */ - _write (encoder) { - encoder.writeTypeRef(YXmlTextRefID); - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {YXmlText} - * - * @private - * @function - */ -const readYXmlText = decoder => new YXmlText(); - -class AbstractStruct { - /** - * @param {ID} id - * @param {number} length - */ - constructor (id, length) { - this.id = id; - this.length = length; - } - - /** - * @type {boolean} - */ - get deleted () { - throw error__namespace.methodUnimplemented() - } - - /** - * Merge this struct with the item to the right. - * This method is already assuming that `this.id.clock + this.length === this.id.clock`. - * Also this method does *not* remove right from StructStore! - * @param {AbstractStruct} right - * @return {boolean} whether this merged with right - */ - mergeWith (right) { - return false - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - * @param {number} offset - * @param {number} encodingRef - */ - write (encoder, offset, encodingRef) { - throw error__namespace.methodUnimplemented() - } - - /** - * @param {Transaction} transaction - * @param {number} offset - */ - integrate (transaction, offset) { - throw error__namespace.methodUnimplemented() - } -} - -const structGCRefNumber = 0; - -/** - * @private - */ -class GC extends AbstractStruct { - get deleted () { - return true - } - - delete () {} - - /** - * @param {GC} right - * @return {boolean} - */ - mergeWith (right) { - if (this.constructor !== right.constructor) { - return false - } - this.length += right.length; - return true - } - - /** - * @param {Transaction} transaction - * @param {number} offset - */ - integrate (transaction, offset) { - if (offset > 0) { - this.id.clock += offset; - this.length -= offset; - } - addStruct(transaction.doc.store, this); - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeInfo(structGCRefNumber); - encoder.writeLen(this.length - offset); - } - - /** - * @param {Transaction} transaction - * @param {StructStore} store - * @return {null | number} - */ - getMissing (transaction, store) { - return null - } -} - -class ContentBinary { - /** - * @param {Uint8Array} content - */ - constructor (content) { - this.content = content; - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [this.content] - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentBinary} - */ - copy () { - return new ContentBinary(this.content) - } - - /** - * @param {number} offset - * @return {ContentBinary} - */ - splice (offset) { - throw error__namespace.methodUnimplemented() - } - - /** - * @param {ContentBinary} right - * @return {boolean} - */ - mergeWith (right) { - return false - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) {} - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeBuf(this.content); - } - - /** - * @return {number} - */ - getRef () { - return 3 - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2 } decoder - * @return {ContentBinary} - */ -const readContentBinary = decoder => new ContentBinary(decoder.readBuf()); - -class ContentDeleted { - /** - * @param {number} len - */ - constructor (len) { - this.len = len; - } - - /** - * @return {number} - */ - getLength () { - return this.len - } - - /** - * @return {Array} - */ - getContent () { - return [] - } - - /** - * @return {boolean} - */ - isCountable () { - return false - } - - /** - * @return {ContentDeleted} - */ - copy () { - return new ContentDeleted(this.len) - } - - /** - * @param {number} offset - * @return {ContentDeleted} - */ - splice (offset) { - const right = new ContentDeleted(this.len - offset); - this.len = offset; - return right - } - - /** - * @param {ContentDeleted} right - * @return {boolean} - */ - mergeWith (right) { - this.len += right.len; - return true - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) { - addToDeleteSet(transaction.deleteSet, item.id.client, item.id.clock, this.len); - item.markDeleted(); - } - - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeLen(this.len - offset); - } - - /** - * @return {number} - */ - getRef () { - return 1 - } -} - -/** - * @private - * - * @param {UpdateDecoderV1 | UpdateDecoderV2 } decoder - * @return {ContentDeleted} - */ -const readContentDeleted = decoder => new ContentDeleted(decoder.readLen()); - -/** - * @param {string} guid - * @param {Object} opts - */ -const createDocFromOpts = (guid, opts) => new Doc({ guid, ...opts, shouldLoad: opts.shouldLoad || opts.autoLoad || false }); - -/** - * @private - */ -class ContentDoc { - /** - * @param {Doc} doc - */ - constructor (doc) { - if (doc._item) { - console.error('This document was already integrated as a sub-document. You should create a second instance instead with the same guid.'); - } - /** - * @type {Doc} - */ - this.doc = doc; - /** - * @type {any} - */ - const opts = {}; - this.opts = opts; - if (!doc.gc) { - opts.gc = false; - } - if (doc.autoLoad) { - opts.autoLoad = true; - } - if (doc.meta !== null) { - opts.meta = doc.meta; - } - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [this.doc] - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentDoc} - */ - copy () { - return new ContentDoc(createDocFromOpts(this.doc.guid, this.opts)) - } - - /** - * @param {number} offset - * @return {ContentDoc} - */ - splice (offset) { - throw error__namespace.methodUnimplemented() - } - - /** - * @param {ContentDoc} right - * @return {boolean} - */ - mergeWith (right) { - return false - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) { - // this needs to be reflected in doc.destroy as well - this.doc._item = item; - transaction.subdocsAdded.add(this.doc); - if (this.doc.shouldLoad) { - transaction.subdocsLoaded.add(this.doc); - } - } - - /** - * @param {Transaction} transaction - */ - delete (transaction) { - if (transaction.subdocsAdded.has(this.doc)) { - transaction.subdocsAdded.delete(this.doc); - } else { - transaction.subdocsRemoved.add(this.doc); - } - } - - /** - * @param {StructStore} store - */ - gc (store) { } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeString(this.doc.guid); - encoder.writeAny(this.opts); - } - - /** - * @return {number} - */ - getRef () { - return 9 - } -} - -/** - * @private - * - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentDoc} - */ -const readContentDoc = decoder => new ContentDoc(createDocFromOpts(decoder.readString(), decoder.readAny())); - -/** - * @private - */ -class ContentEmbed { - /** - * @param {Object} embed - */ - constructor (embed) { - this.embed = embed; - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [this.embed] - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentEmbed} - */ - copy () { - return new ContentEmbed(this.embed) - } - - /** - * @param {number} offset - * @return {ContentEmbed} - */ - splice (offset) { - throw error__namespace.methodUnimplemented() - } - - /** - * @param {ContentEmbed} right - * @return {boolean} - */ - mergeWith (right) { - return false - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) {} - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeJSON(this.embed); - } - - /** - * @return {number} - */ - getRef () { - return 5 - } -} - -/** - * @private - * - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentEmbed} - */ -const readContentEmbed = decoder => new ContentEmbed(decoder.readJSON()); - -/** - * @private - */ -class ContentFormat { - /** - * @param {string} key - * @param {Object} value - */ - constructor (key, value) { - this.key = key; - this.value = value; - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [] - } - - /** - * @return {boolean} - */ - isCountable () { - return false - } - - /** - * @return {ContentFormat} - */ - copy () { - return new ContentFormat(this.key, this.value) - } - - /** - * @param {number} _offset - * @return {ContentFormat} - */ - splice (_offset) { - throw error__namespace.methodUnimplemented() - } - - /** - * @param {ContentFormat} _right - * @return {boolean} - */ - mergeWith (_right) { - return false - } - - /** - * @param {Transaction} _transaction - * @param {Item} item - */ - integrate (_transaction, item) { - // @todo searchmarker are currently unsupported for rich text documents - const p = /** @type {YText} */ (item.parent); - p._searchMarker = null; - p._hasFormatting = true; - } - - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeKey(this.key); - encoder.writeJSON(this.value); - } - - /** - * @return {number} - */ - getRef () { - return 6 - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentFormat} - */ -const readContentFormat = decoder => new ContentFormat(decoder.readKey(), decoder.readJSON()); - -/** - * @private - */ -class ContentJSON { - /** - * @param {Array} arr - */ - constructor (arr) { - /** - * @type {Array} - */ - this.arr = arr; - } - - /** - * @return {number} - */ - getLength () { - return this.arr.length - } - - /** - * @return {Array} - */ - getContent () { - return this.arr - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentJSON} - */ - copy () { - return new ContentJSON(this.arr) - } - - /** - * @param {number} offset - * @return {ContentJSON} - */ - splice (offset) { - const right = new ContentJSON(this.arr.slice(offset)); - this.arr = this.arr.slice(0, offset); - return right - } - - /** - * @param {ContentJSON} right - * @return {boolean} - */ - mergeWith (right) { - this.arr = this.arr.concat(right.arr); - return true - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) {} - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - const len = this.arr.length; - encoder.writeLen(len - offset); - for (let i = offset; i < len; i++) { - const c = this.arr[i]; - encoder.writeString(c === undefined ? 'undefined' : JSON.stringify(c)); - } - } - - /** - * @return {number} - */ - getRef () { - return 2 - } -} - -/** - * @private - * - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentJSON} - */ -const readContentJSON = decoder => { - const len = decoder.readLen(); - const cs = []; - for (let i = 0; i < len; i++) { - const c = decoder.readString(); - if (c === 'undefined') { - cs.push(undefined); - } else { - cs.push(JSON.parse(c)); - } - } - return new ContentJSON(cs) -}; - -const isDevMode = env__namespace.getVariable('node_env') === 'development'; - -class ContentAny { - /** - * @param {Array} arr - */ - constructor (arr) { - /** - * @type {Array} - */ - this.arr = arr; - isDevMode && object__namespace.deepFreeze(arr); - } - - /** - * @return {number} - */ - getLength () { - return this.arr.length - } - - /** - * @return {Array} - */ - getContent () { - return this.arr - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentAny} - */ - copy () { - return new ContentAny(this.arr) - } - - /** - * @param {number} offset - * @return {ContentAny} - */ - splice (offset) { - const right = new ContentAny(this.arr.slice(offset)); - this.arr = this.arr.slice(0, offset); - return right - } - - /** - * @param {ContentAny} right - * @return {boolean} - */ - mergeWith (right) { - this.arr = this.arr.concat(right.arr); - return true - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) {} - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - const len = this.arr.length; - encoder.writeLen(len - offset); - for (let i = offset; i < len; i++) { - const c = this.arr[i]; - encoder.writeAny(c); - } - } - - /** - * @return {number} - */ - getRef () { - return 8 - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentAny} - */ -const readContentAny = decoder => { - const len = decoder.readLen(); - const cs = []; - for (let i = 0; i < len; i++) { - cs.push(decoder.readAny()); - } - return new ContentAny(cs) -}; - -/** - * @private - */ -class ContentString { - /** - * @param {string} str - */ - constructor (str) { - /** - * @type {string} - */ - this.str = str; - } - - /** - * @return {number} - */ - getLength () { - return this.str.length - } - - /** - * @return {Array} - */ - getContent () { - return this.str.split('') - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentString} - */ - copy () { - return new ContentString(this.str) - } - - /** - * @param {number} offset - * @return {ContentString} - */ - splice (offset) { - const right = new ContentString(this.str.slice(offset)); - this.str = this.str.slice(0, offset); - - // Prevent encoding invalid documents because of splitting of surrogate pairs: https://github.com/yjs/yjs/issues/248 - const firstCharCode = this.str.charCodeAt(offset - 1); - if (firstCharCode >= 0xD800 && firstCharCode <= 0xDBFF) { - // Last character of the left split is the start of a surrogate utf16/ucs2 pair. - // We don't support splitting of surrogate pairs because this may lead to invalid documents. - // Replace the invalid character with a unicode replacement character (� / U+FFFD) - this.str = this.str.slice(0, offset - 1) + '�'; - // replace right as well - right.str = '�' + right.str.slice(1); - } - return right - } - - /** - * @param {ContentString} right - * @return {boolean} - */ - mergeWith (right) { - this.str += right.str; - return true - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) {} - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeString(offset === 0 ? this.str : this.str.slice(offset)); - } - - /** - * @return {number} - */ - getRef () { - return 4 - } -} - -/** - * @private - * - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentString} - */ -const readContentString = decoder => new ContentString(decoder.readString()); - -/** - * @type {Array>} - * @private - */ -const typeRefs = [ - readYArray, - readYMap, - readYText, - readYXmlElement, - readYXmlFragment, - readYXmlHook, - readYXmlText -]; - -const YArrayRefID = 0; -const YMapRefID = 1; -const YTextRefID = 2; -const YXmlElementRefID = 3; -const YXmlFragmentRefID = 4; -const YXmlHookRefID = 5; -const YXmlTextRefID = 6; - -/** - * @private - */ -class ContentType { - /** - * @param {AbstractType} type - */ - constructor (type) { - /** - * @type {AbstractType} - */ - this.type = type; - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [this.type] - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentType} - */ - copy () { - return new ContentType(this.type._copy()) - } - - /** - * @param {number} offset - * @return {ContentType} - */ - splice (offset) { - throw error__namespace.methodUnimplemented() - } - - /** - * @param {ContentType} right - * @return {boolean} - */ - mergeWith (right) { - return false - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) { - this.type._integrate(transaction.doc, item); - } - - /** - * @param {Transaction} transaction - */ - delete (transaction) { - let item = this.type._start; - while (item !== null) { - if (!item.deleted) { - item.delete(transaction); - } else if (item.id.clock < (transaction.beforeState.get(item.id.client) || 0)) { - // This will be gc'd later and we want to merge it if possible - // We try to merge all deleted items after each transaction, - // but we have no knowledge about that this needs to be merged - // since it is not in transaction.ds. Hence we add it to transaction._mergeStructs - transaction._mergeStructs.push(item); - } - item = item.right; - } - this.type._map.forEach(item => { - if (!item.deleted) { - item.delete(transaction); - } else if (item.id.clock < (transaction.beforeState.get(item.id.client) || 0)) { - // same as above - transaction._mergeStructs.push(item); - } - }); - transaction.changed.delete(this.type); - } - - /** - * @param {StructStore} store - */ - gc (store) { - let item = this.type._start; - while (item !== null) { - item.gc(store, true); - item = item.right; - } - this.type._start = null; - this.type._map.forEach(/** @param {Item | null} item */ (item) => { - while (item !== null) { - item.gc(store, true); - item = item.left; - } - }); - this.type._map = new Map(); - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - this.type._write(encoder); - } - - /** - * @return {number} - */ - getRef () { - return 7 - } -} - -/** - * @private - * - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentType} - */ -const readContentType = decoder => new ContentType(typeRefs[decoder.readTypeRef()](decoder)); - -/** - * @todo This should return several items - * - * @param {StructStore} store - * @param {ID} id - * @return {{item:Item, diff:number}} - */ -const followRedone = (store, id) => { - /** - * @type {ID|null} - */ - let nextID = id; - let diff = 0; - let item; - do { - if (diff > 0) { - nextID = createID(nextID.client, nextID.clock + diff); - } - item = getItem(store, nextID); - diff = nextID.clock - item.id.clock; - nextID = item.redone; - } while (nextID !== null && item instanceof Item) - return { - item, diff - } -}; - -/** - * Make sure that neither item nor any of its parents is ever deleted. - * - * This property does not persist when storing it into a database or when - * sending it to other peers - * - * @param {Item|null} item - * @param {boolean} keep - */ -const keepItem = (item, keep) => { - while (item !== null && item.keep !== keep) { - item.keep = keep; - item = /** @type {AbstractType} */ (item.parent)._item; - } -}; - -/** - * Split leftItem into two items - * @param {Transaction} transaction - * @param {Item} leftItem - * @param {number} diff - * @return {Item} - * - * @function - * @private - */ -const splitItem = (transaction, leftItem, diff) => { - // create rightItem - const { client, clock } = leftItem.id; - const rightItem = new Item( - createID(client, clock + diff), - leftItem, - createID(client, clock + diff - 1), - leftItem.right, - leftItem.rightOrigin, - leftItem.parent, - leftItem.parentSub, - leftItem.content.splice(diff) - ); - if (leftItem.deleted) { - rightItem.markDeleted(); - } - if (leftItem.keep) { - rightItem.keep = true; - } - if (leftItem.redone !== null) { - rightItem.redone = createID(leftItem.redone.client, leftItem.redone.clock + diff); - } - // update left (do not set leftItem.rightOrigin as it will lead to problems when syncing) - leftItem.right = rightItem; - // update right - if (rightItem.right !== null) { - rightItem.right.left = rightItem; - } - // right is more specific. - transaction._mergeStructs.push(rightItem); - // update parent._map - if (rightItem.parentSub !== null && rightItem.right === null) { - /** @type {AbstractType} */ (rightItem.parent)._map.set(rightItem.parentSub, rightItem); - } - leftItem.length = diff; - return rightItem -}; - -/** - * @param {Array} stack - * @param {ID} id - */ -const isDeletedByUndoStack = (stack, id) => array__namespace.some(stack, /** @param {StackItem} s */ s => isDeleted(s.deletions, id)); - -/** - * Redoes the effect of this operation. - * - * @param {Transaction} transaction The Yjs instance. - * @param {Item} item - * @param {Set} redoitems - * @param {DeleteSet} itemsToDelete - * @param {boolean} ignoreRemoteMapChanges - * @param {import('../utils/UndoManager.js').UndoManager} um - * - * @return {Item|null} - * - * @private - */ -const redoItem = (transaction, item, redoitems, itemsToDelete, ignoreRemoteMapChanges, um) => { - const doc = transaction.doc; - const store = doc.store; - const ownClientID = doc.clientID; - const redone = item.redone; - if (redone !== null) { - return getItemCleanStart(transaction, redone) - } - let parentItem = /** @type {AbstractType} */ (item.parent)._item; - /** - * @type {Item|null} - */ - let left = null; - /** - * @type {Item|null} - */ - let right; - // make sure that parent is redone - if (parentItem !== null && parentItem.deleted === true) { - // try to undo parent if it will be undone anyway - if (parentItem.redone === null && (!redoitems.has(parentItem) || redoItem(transaction, parentItem, redoitems, itemsToDelete, ignoreRemoteMapChanges, um) === null)) { - return null - } - while (parentItem.redone !== null) { - parentItem = getItemCleanStart(transaction, parentItem.redone); - } - } - const parentType = parentItem === null ? /** @type {AbstractType} */ (item.parent) : /** @type {ContentType} */ (parentItem.content).type; - - if (item.parentSub === null) { - // Is an array item. Insert at the old position - left = item.left; - right = item; - // find next cloned_redo items - while (left !== null) { - /** - * @type {Item|null} - */ - let leftTrace = left; - // trace redone until parent matches - while (leftTrace !== null && /** @type {AbstractType} */ (leftTrace.parent)._item !== parentItem) { - leftTrace = leftTrace.redone === null ? null : getItemCleanStart(transaction, leftTrace.redone); - } - if (leftTrace !== null && /** @type {AbstractType} */ (leftTrace.parent)._item === parentItem) { - left = leftTrace; - break - } - left = left.left; - } - while (right !== null) { - /** - * @type {Item|null} - */ - let rightTrace = right; - // trace redone until parent matches - while (rightTrace !== null && /** @type {AbstractType} */ (rightTrace.parent)._item !== parentItem) { - rightTrace = rightTrace.redone === null ? null : getItemCleanStart(transaction, rightTrace.redone); - } - if (rightTrace !== null && /** @type {AbstractType} */ (rightTrace.parent)._item === parentItem) { - right = rightTrace; - break - } - right = right.right; - } - } else { - right = null; - if (item.right && !ignoreRemoteMapChanges) { - left = item; - // Iterate right while right is in itemsToDelete - // If it is intended to delete right while item is redone, we can expect that item should replace right. - while (left !== null && left.right !== null && (left.right.redone || isDeleted(itemsToDelete, left.right.id) || isDeletedByUndoStack(um.undoStack, left.right.id) || isDeletedByUndoStack(um.redoStack, left.right.id))) { - left = left.right; - // follow redone - while (left.redone) left = getItemCleanStart(transaction, left.redone); - } - if (left && left.right !== null) { - // It is not possible to redo this item because it conflicts with a - // change from another client - return null - } - } else { - left = parentType._map.get(item.parentSub) || null; - } - } - const nextClock = getState(store, ownClientID); - const nextId = createID(ownClientID, nextClock); - const redoneItem = new Item( - nextId, - left, left && left.lastId, - right, right && right.id, - parentType, - item.parentSub, - item.content.copy() - ); - item.redone = nextId; - keepItem(redoneItem, true); - redoneItem.integrate(transaction, 0); - return redoneItem -}; - -/** - * Abstract class that represents any content. - */ -class Item extends AbstractStruct { - /** - * @param {ID} id - * @param {Item | null} left - * @param {ID | null} origin - * @param {Item | null} right - * @param {ID | null} rightOrigin - * @param {AbstractType|ID|null} parent Is a type if integrated, is null if it is possible to copy parent from left or right, is ID before integration to search for it. - * @param {string | null} parentSub - * @param {AbstractContent} content - */ - constructor (id, left, origin, right, rightOrigin, parent, parentSub, content) { - super(id, content.getLength()); - /** - * The item that was originally to the left of this item. - * @type {ID | null} - */ - this.origin = origin; - /** - * The item that is currently to the left of this item. - * @type {Item | null} - */ - this.left = left; - /** - * The item that is currently to the right of this item. - * @type {Item | null} - */ - this.right = right; - /** - * The item that was originally to the right of this item. - * @type {ID | null} - */ - this.rightOrigin = rightOrigin; - /** - * @type {AbstractType|ID|null} - */ - this.parent = parent; - /** - * If the parent refers to this item with some kind of key (e.g. YMap, the - * key is specified here. The key is then used to refer to the list in which - * to insert this item. If `parentSub = null` type._start is the list in - * which to insert to. Otherwise it is `parent._map`. - * @type {String | null} - */ - this.parentSub = parentSub; - /** - * If this type's effect is redone this type refers to the type that undid - * this operation. - * @type {ID | null} - */ - this.redone = null; - /** - * @type {AbstractContent} - */ - this.content = content; - /** - * bit1: keep - * bit2: countable - * bit3: deleted - * bit4: mark - mark node as fast-search-marker - * @type {number} byte - */ - this.info = this.content.isCountable() ? binary__namespace.BIT2 : 0; - } - - /** - * This is used to mark the item as an indexed fast-search marker - * - * @type {boolean} - */ - set marker (isMarked) { - if (((this.info & binary__namespace.BIT4) > 0) !== isMarked) { - this.info ^= binary__namespace.BIT4; - } - } - - get marker () { - return (this.info & binary__namespace.BIT4) > 0 - } - - /** - * If true, do not garbage collect this Item. - */ - get keep () { - return (this.info & binary__namespace.BIT1) > 0 - } - - set keep (doKeep) { - if (this.keep !== doKeep) { - this.info ^= binary__namespace.BIT1; - } - } - - get countable () { - return (this.info & binary__namespace.BIT2) > 0 - } - - /** - * Whether this item was deleted or not. - * @type {Boolean} - */ - get deleted () { - return (this.info & binary__namespace.BIT3) > 0 - } - - set deleted (doDelete) { - if (this.deleted !== doDelete) { - this.info ^= binary__namespace.BIT3; - } - } - - markDeleted () { - this.info |= binary__namespace.BIT3; - } - - /** - * Return the creator clientID of the missing op or define missing items and return null. - * - * @param {Transaction} transaction - * @param {StructStore} store - * @return {null | number} - */ - getMissing (transaction, store) { - if (this.origin && this.origin.client !== this.id.client && this.origin.clock >= getState(store, this.origin.client)) { - return this.origin.client - } - if (this.rightOrigin && this.rightOrigin.client !== this.id.client && this.rightOrigin.clock >= getState(store, this.rightOrigin.client)) { - return this.rightOrigin.client - } - if (this.parent && this.parent.constructor === ID && this.id.client !== this.parent.client && this.parent.clock >= getState(store, this.parent.client)) { - return this.parent.client - } - - // We have all missing ids, now find the items - - if (this.origin) { - this.left = getItemCleanEnd(transaction, store, this.origin); - this.origin = this.left.lastId; - } - if (this.rightOrigin) { - this.right = getItemCleanStart(transaction, this.rightOrigin); - this.rightOrigin = this.right.id; - } - if ((this.left && this.left.constructor === GC) || (this.right && this.right.constructor === GC)) { - this.parent = null; - } else if (!this.parent) { - // only set parent if this shouldn't be garbage collected - if (this.left && this.left.constructor === Item) { - this.parent = this.left.parent; - this.parentSub = this.left.parentSub; - } else if (this.right && this.right.constructor === Item) { - this.parent = this.right.parent; - this.parentSub = this.right.parentSub; - } - } else if (this.parent.constructor === ID) { - const parentItem = getItem(store, this.parent); - if (parentItem.constructor === GC) { - this.parent = null; - } else { - this.parent = /** @type {ContentType} */ (parentItem.content).type; - } - } - return null - } - - /** - * @param {Transaction} transaction - * @param {number} offset - */ - integrate (transaction, offset) { - if (offset > 0) { - this.id.clock += offset; - this.left = getItemCleanEnd(transaction, transaction.doc.store, createID(this.id.client, this.id.clock - 1)); - this.origin = this.left.lastId; - this.content = this.content.splice(offset); - this.length -= offset; - } - - if (this.parent) { - if ((!this.left && (!this.right || this.right.left !== null)) || (this.left && this.left.right !== this.right)) { - /** - * @type {Item|null} - */ - let left = this.left; - - /** - * @type {Item|null} - */ - let o; - // set o to the first conflicting item - if (left !== null) { - o = left.right; - } else if (this.parentSub !== null) { - o = /** @type {AbstractType} */ (this.parent)._map.get(this.parentSub) || null; - while (o !== null && o.left !== null) { - o = o.left; - } - } else { - o = /** @type {AbstractType} */ (this.parent)._start; - } - // TODO: use something like DeleteSet here (a tree implementation would be best) - // @todo use global set definitions - /** - * @type {Set} - */ - const conflictingItems = new Set(); - /** - * @type {Set} - */ - const itemsBeforeOrigin = new Set(); - // Let c in conflictingItems, b in itemsBeforeOrigin - // ***{origin}bbbb{this}{c,b}{c,b}{o}*** - // Note that conflictingItems is a subset of itemsBeforeOrigin - while (o !== null && o !== this.right) { - itemsBeforeOrigin.add(o); - conflictingItems.add(o); - if (compareIDs(this.origin, o.origin)) { - // case 1 - if (o.id.client < this.id.client) { - left = o; - conflictingItems.clear(); - } else if (compareIDs(this.rightOrigin, o.rightOrigin)) { - // this and o are conflicting and point to the same integration points. The id decides which item comes first. - // Since this is to the left of o, we can break here - break - } // else, o might be integrated before an item that this conflicts with. If so, we will find it in the next iterations - } else if (o.origin !== null && itemsBeforeOrigin.has(getItem(transaction.doc.store, o.origin))) { // use getItem instead of getItemCleanEnd because we don't want / need to split items. - // case 2 - if (!conflictingItems.has(getItem(transaction.doc.store, o.origin))) { - left = o; - conflictingItems.clear(); - } - } else { - break - } - o = o.right; - } - this.left = left; - } - // reconnect left/right + update parent map/start if necessary - if (this.left !== null) { - const right = this.left.right; - this.right = right; - this.left.right = this; - } else { - let r; - if (this.parentSub !== null) { - r = /** @type {AbstractType} */ (this.parent)._map.get(this.parentSub) || null; - while (r !== null && r.left !== null) { - r = r.left; - } - } else { - r = /** @type {AbstractType} */ (this.parent)._start - ;/** @type {AbstractType} */ (this.parent)._start = this; - } - this.right = r; - } - if (this.right !== null) { - this.right.left = this; - } else if (this.parentSub !== null) { - // set as current parent value if right === null and this is parentSub - /** @type {AbstractType} */ (this.parent)._map.set(this.parentSub, this); - if (this.left !== null) { - // this is the current attribute value of parent. delete right - this.left.delete(transaction); - } - } - // adjust length of parent - if (this.parentSub === null && this.countable && !this.deleted) { - /** @type {AbstractType} */ (this.parent)._length += this.length; - } - addStruct(transaction.doc.store, this); - this.content.integrate(transaction, this); - // add parent to transaction.changed - addChangedTypeToTransaction(transaction, /** @type {AbstractType} */ (this.parent), this.parentSub); - if ((/** @type {AbstractType} */ (this.parent)._item !== null && /** @type {AbstractType} */ (this.parent)._item.deleted) || (this.parentSub !== null && this.right !== null)) { - // delete if parent is deleted or if this is not the current attribute value of parent - this.delete(transaction); - } - } else { - // parent is not defined. Integrate GC struct instead - new GC(this.id, this.length).integrate(transaction, 0); - } - } - - /** - * Returns the next non-deleted item - */ - get next () { - let n = this.right; - while (n !== null && n.deleted) { - n = n.right; - } - return n - } - - /** - * Returns the previous non-deleted item - */ - get prev () { - let n = this.left; - while (n !== null && n.deleted) { - n = n.left; - } - return n - } - - /** - * Computes the last content address of this Item. - */ - get lastId () { - // allocating ids is pretty costly because of the amount of ids created, so we try to reuse whenever possible - return this.length === 1 ? this.id : createID(this.id.client, this.id.clock + this.length - 1) - } - - /** - * Try to merge two items - * - * @param {Item} right - * @return {boolean} - */ - mergeWith (right) { - if ( - this.constructor === right.constructor && - compareIDs(right.origin, this.lastId) && - this.right === right && - compareIDs(this.rightOrigin, right.rightOrigin) && - this.id.client === right.id.client && - this.id.clock + this.length === right.id.clock && - this.deleted === right.deleted && - this.redone === null && - right.redone === null && - this.content.constructor === right.content.constructor && - this.content.mergeWith(right.content) - ) { - const searchMarker = /** @type {AbstractType} */ (this.parent)._searchMarker; - if (searchMarker) { - searchMarker.forEach(marker => { - if (marker.p === right) { - // right is going to be "forgotten" so we need to update the marker - marker.p = this; - // adjust marker index - if (!this.deleted && this.countable) { - marker.index -= this.length; - } - } - }); - } - if (right.keep) { - this.keep = true; - } - this.right = right.right; - if (this.right !== null) { - this.right.left = this; - } - this.length += right.length; - return true - } - return false - } - - /** - * Mark this Item as deleted. - * - * @param {Transaction} transaction - */ - delete (transaction) { - if (!this.deleted) { - const parent = /** @type {AbstractType} */ (this.parent); - // adjust the length of parent - if (this.countable && this.parentSub === null) { - parent._length -= this.length; - } - this.markDeleted(); - addToDeleteSet(transaction.deleteSet, this.id.client, this.id.clock, this.length); - addChangedTypeToTransaction(transaction, parent, this.parentSub); - this.content.delete(transaction); - } - } - - /** - * @param {StructStore} store - * @param {boolean} parentGCd - */ - gc (store, parentGCd) { - if (!this.deleted) { - throw error__namespace.unexpectedCase() - } - this.content.gc(store); - if (parentGCd) { - replaceStruct(store, this, new GC(this.id, this.length)); - } else { - this.content = new ContentDeleted(this.length); - } - } - - /** - * Transform the properties of this type to binary and write it to an - * BinaryEncoder. - * - * This is called when this Item is sent to a remote peer. - * - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - * @param {number} offset - */ - write (encoder, offset) { - const origin = offset > 0 ? createID(this.id.client, this.id.clock + offset - 1) : this.origin; - const rightOrigin = this.rightOrigin; - const parentSub = this.parentSub; - const info = (this.content.getRef() & binary__namespace.BITS5) | - (origin === null ? 0 : binary__namespace.BIT8) | // origin is defined - (rightOrigin === null ? 0 : binary__namespace.BIT7) | // right origin is defined - (parentSub === null ? 0 : binary__namespace.BIT6); // parentSub is non-null - encoder.writeInfo(info); - if (origin !== null) { - encoder.writeLeftID(origin); - } - if (rightOrigin !== null) { - encoder.writeRightID(rightOrigin); - } - if (origin === null && rightOrigin === null) { - const parent = /** @type {AbstractType} */ (this.parent); - if (parent._item !== undefined) { - const parentItem = parent._item; - if (parentItem === null) { - // parent type on y._map - // find the correct key - const ykey = findRootTypeKey(parent); - encoder.writeParentInfo(true); // write parentYKey - encoder.writeString(ykey); - } else { - encoder.writeParentInfo(false); // write parent id - encoder.writeLeftID(parentItem.id); - } - } else if (parent.constructor === String) { // this edge case was added by differential updates - encoder.writeParentInfo(true); // write parentYKey - encoder.writeString(parent); - } else if (parent.constructor === ID) { - encoder.writeParentInfo(false); // write parent id - encoder.writeLeftID(parent); - } else { - error__namespace.unexpectedCase(); - } - if (parentSub !== null) { - encoder.writeString(parentSub); - } - } - this.content.write(encoder, offset); - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @param {number} info - */ -const readItemContent = (decoder, info) => contentRefs[info & binary__namespace.BITS5](decoder); - -/** - * A lookup map for reading Item content. - * - * @type {Array} - */ -const contentRefs = [ - () => { error__namespace.unexpectedCase(); }, // GC is not ItemContent - readContentDeleted, // 1 - readContentJSON, // 2 - readContentBinary, // 3 - readContentString, // 4 - readContentEmbed, // 5 - readContentFormat, // 6 - readContentType, // 7 - readContentAny, // 8 - readContentDoc, // 9 - () => { error__namespace.unexpectedCase(); } // 10 - Skip is not ItemContent -]; - -const structSkipRefNumber = 10; - -/** - * @private - */ -class Skip extends AbstractStruct { - get deleted () { - return true - } - - delete () {} - - /** - * @param {Skip} right - * @return {boolean} - */ - mergeWith (right) { - if (this.constructor !== right.constructor) { - return false - } - this.length += right.length; - return true - } - - /** - * @param {Transaction} transaction - * @param {number} offset - */ - integrate (transaction, offset) { - // skip structs cannot be integrated - error__namespace.unexpectedCase(); - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeInfo(structSkipRefNumber); - // write as VarUint because Skips can't make use of predictable length-encoding - encoding__namespace.writeVarUint(encoder.restEncoder, this.length - offset); - } - - /** - * @param {Transaction} transaction - * @param {StructStore} store - * @return {null | number} - */ - getMissing (transaction, store) { - return null - } -} - -/** eslint-env browser */ - - -const glo = /** @type {any} */ (typeof globalThis !== 'undefined' - ? globalThis - : typeof window !== 'undefined' - ? window - // @ts-ignore - : typeof global !== 'undefined' ? global : {}); - -const importIdentifier = '__ $YJS$ __'; - -if (glo[importIdentifier] === true) { - /** - * Dear reader of this message. Please take this seriously. - * - * If you see this message, make sure that you only import one version of Yjs. In many cases, - * your package manager installs two versions of Yjs that are used by different packages within your project. - * Another reason for this message is that some parts of your project use the commonjs version of Yjs - * and others use the EcmaScript version of Yjs. - * - * This often leads to issues that are hard to debug. We often need to perform constructor checks, - * e.g. `struct instanceof GC`. If you imported different versions of Yjs, it is impossible for us to - * do the constructor checks anymore - which might break the CRDT algorithm. - * - * https://github.com/yjs/yjs/issues/438 - */ - console.error('Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438'); -} -glo[importIdentifier] = true; - -exports.AbsolutePosition = AbsolutePosition; -exports.AbstractConnector = AbstractConnector; -exports.AbstractStruct = AbstractStruct; -exports.AbstractType = AbstractType; -exports.Array = YArray; -exports.ContentAny = ContentAny; -exports.ContentBinary = ContentBinary; -exports.ContentDeleted = ContentDeleted; -exports.ContentDoc = ContentDoc; -exports.ContentEmbed = ContentEmbed; -exports.ContentFormat = ContentFormat; -exports.ContentJSON = ContentJSON; -exports.ContentString = ContentString; -exports.ContentType = ContentType; -exports.Doc = Doc; -exports.GC = GC; -exports.ID = ID; -exports.Item = Item; -exports.Map = YMap; -exports.PermanentUserData = PermanentUserData; -exports.RelativePosition = RelativePosition; -exports.Skip = Skip; -exports.Snapshot = Snapshot; -exports.Text = YText; -exports.Transaction = Transaction; -exports.UndoManager = UndoManager; -exports.UpdateDecoderV1 = UpdateDecoderV1; -exports.UpdateDecoderV2 = UpdateDecoderV2; -exports.UpdateEncoderV1 = UpdateEncoderV1; -exports.UpdateEncoderV2 = UpdateEncoderV2; -exports.XmlElement = YXmlElement; -exports.XmlFragment = YXmlFragment; -exports.XmlHook = YXmlHook; -exports.XmlText = YXmlText; -exports.YArrayEvent = YArrayEvent; -exports.YEvent = YEvent; -exports.YMapEvent = YMapEvent; -exports.YTextEvent = YTextEvent; -exports.YXmlEvent = YXmlEvent; -exports.applyUpdate = applyUpdate; -exports.applyUpdateV2 = applyUpdateV2; -exports.cleanupYTextFormatting = cleanupYTextFormatting; -exports.compareIDs = compareIDs; -exports.compareRelativePositions = compareRelativePositions; -exports.convertUpdateFormatV1ToV2 = convertUpdateFormatV1ToV2; -exports.convertUpdateFormatV2ToV1 = convertUpdateFormatV2ToV1; -exports.createAbsolutePositionFromRelativePosition = createAbsolutePositionFromRelativePosition; -exports.createDeleteSet = createDeleteSet; -exports.createDeleteSetFromStructStore = createDeleteSetFromStructStore; -exports.createDocFromSnapshot = createDocFromSnapshot; -exports.createID = createID; -exports.createRelativePositionFromJSON = createRelativePositionFromJSON; -exports.createRelativePositionFromTypeIndex = createRelativePositionFromTypeIndex; -exports.createSnapshot = createSnapshot; -exports.decodeRelativePosition = decodeRelativePosition; -exports.decodeSnapshot = decodeSnapshot; -exports.decodeSnapshotV2 = decodeSnapshotV2; -exports.decodeStateVector = decodeStateVector; -exports.decodeUpdate = decodeUpdate; -exports.decodeUpdateV2 = decodeUpdateV2; -exports.diffUpdate = diffUpdate; -exports.diffUpdateV2 = diffUpdateV2; -exports.emptySnapshot = emptySnapshot; -exports.encodeRelativePosition = encodeRelativePosition; -exports.encodeSnapshot = encodeSnapshot; -exports.encodeSnapshotV2 = encodeSnapshotV2; -exports.encodeStateAsUpdate = encodeStateAsUpdate; -exports.encodeStateAsUpdateV2 = encodeStateAsUpdateV2; -exports.encodeStateVector = encodeStateVector; -exports.encodeStateVectorFromUpdate = encodeStateVectorFromUpdate; -exports.encodeStateVectorFromUpdateV2 = encodeStateVectorFromUpdateV2; -exports.equalDeleteSets = equalDeleteSets; -exports.equalSnapshots = equalSnapshots; -exports.findIndexSS = findIndexSS; -exports.findRootTypeKey = findRootTypeKey; -exports.getItem = getItem; -exports.getItemCleanEnd = getItemCleanEnd; -exports.getItemCleanStart = getItemCleanStart; -exports.getState = getState; -exports.getTypeChildren = getTypeChildren; -exports.isDeleted = isDeleted; -exports.isParentOf = isParentOf; -exports.iterateDeletedStructs = iterateDeletedStructs; -exports.logType = logType; -exports.logUpdate = logUpdate; -exports.logUpdateV2 = logUpdateV2; -exports.mergeDeleteSets = mergeDeleteSets; -exports.mergeUpdates = mergeUpdates; -exports.mergeUpdatesV2 = mergeUpdatesV2; -exports.obfuscateUpdate = obfuscateUpdate; -exports.obfuscateUpdateV2 = obfuscateUpdateV2; -exports.parseUpdateMeta = parseUpdateMeta; -exports.parseUpdateMetaV2 = parseUpdateMetaV2; -exports.readUpdate = readUpdate; -exports.readUpdateV2 = readUpdateV2; -exports.relativePositionToJSON = relativePositionToJSON; -exports.snapshot = snapshot; -exports.snapshotContainsUpdate = snapshotContainsUpdate; -exports.transact = transact; -exports.tryGc = tryGc; -exports.typeListToArraySnapshot = typeListToArraySnapshot; -exports.typeMapGetAllSnapshot = typeMapGetAllSnapshot; -exports.typeMapGetSnapshot = typeMapGetSnapshot; -//# sourceMappingURL=yjs.cjs.map diff --git a/yjs-poll/node_modules/yjs/dist/yjs.cjs.map b/yjs-poll/node_modules/yjs/dist/yjs.cjs.map deleted file mode 100644 index f85364c..0000000 --- a/yjs-poll/node_modules/yjs/dist/yjs.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"yjs.cjs","sources":["../src/utils/AbstractConnector.js","../src/utils/DeleteSet.js","../src/utils/Doc.js","../src/utils/UpdateDecoder.js","../src/utils/UpdateEncoder.js","../src/utils/encoding.js","../src/utils/EventHandler.js","../src/utils/ID.js","../src/utils/isParentOf.js","../src/utils/logging.js","../src/utils/PermanentUserData.js","../src/utils/RelativePosition.js","../src/utils/Snapshot.js","../src/utils/StructStore.js","../src/utils/Transaction.js","../src/utils/UndoManager.js","../src/utils/updates.js","../src/utils/YEvent.js","../src/types/AbstractType.js","../src/types/YArray.js","../src/types/YMap.js","../src/types/YText.js","../src/types/YXmlFragment.js","../src/types/YXmlElement.js","../src/types/YXmlEvent.js","../src/types/YXmlHook.js","../src/types/YXmlText.js","../src/structs/AbstractStruct.js","../src/structs/GC.js","../src/structs/ContentBinary.js","../src/structs/ContentDeleted.js","../src/structs/ContentDoc.js","../src/structs/ContentEmbed.js","../src/structs/ContentFormat.js","../src/structs/ContentJSON.js","../src/structs/ContentAny.js","../src/structs/ContentString.js","../src/structs/ContentType.js","../src/structs/Item.js","../src/structs/Skip.js","../src/index.js"],"sourcesContent":["import { ObservableV2 } from 'lib0/observable'\n\nimport {\n Doc // eslint-disable-line\n} from '../internals.js'\n\n/**\n * This is an abstract interface that all Connectors should implement to keep them interchangeable.\n *\n * @note This interface is experimental and it is not advised to actually inherit this class.\n * It just serves as typing information.\n *\n * @extends {ObservableV2}\n */\nexport class AbstractConnector extends ObservableV2 {\n /**\n * @param {Doc} ydoc\n * @param {any} awareness\n */\n constructor (ydoc, awareness) {\n super()\n this.doc = ydoc\n this.awareness = awareness\n }\n}\n","import {\n findIndexSS,\n getState,\n splitItem,\n iterateStructs,\n UpdateEncoderV2,\n DSDecoderV1, DSEncoderV1, DSDecoderV2, DSEncoderV2, Item, GC, StructStore, Transaction, ID // eslint-disable-line\n} from '../internals.js'\n\nimport * as array from 'lib0/array'\nimport * as math from 'lib0/math'\nimport * as map from 'lib0/map'\nimport * as encoding from 'lib0/encoding'\nimport * as decoding from 'lib0/decoding'\n\nexport class DeleteItem {\n /**\n * @param {number} clock\n * @param {number} len\n */\n constructor (clock, len) {\n /**\n * @type {number}\n */\n this.clock = clock\n /**\n * @type {number}\n */\n this.len = len\n }\n}\n\n/**\n * We no longer maintain a DeleteStore. DeleteSet is a temporary object that is created when needed.\n * - When created in a transaction, it must only be accessed after sorting, and merging\n * - This DeleteSet is send to other clients\n * - We do not create a DeleteSet when we send a sync message. The DeleteSet message is created directly from StructStore\n * - We read a DeleteSet as part of a sync/update message. In this case the DeleteSet is already sorted and merged.\n */\nexport class DeleteSet {\n constructor () {\n /**\n * @type {Map>}\n */\n this.clients = new Map()\n }\n}\n\n/**\n * Iterate over all structs that the DeleteSet gc's.\n *\n * @param {Transaction} transaction\n * @param {DeleteSet} ds\n * @param {function(GC|Item):void} f\n *\n * @function\n */\nexport const iterateDeletedStructs = (transaction, ds, f) =>\n ds.clients.forEach((deletes, clientid) => {\n const structs = /** @type {Array} */ (transaction.doc.store.clients.get(clientid))\n if (structs != null) {\n const lastStruct = structs[structs.length - 1]\n const clockState = lastStruct.id.clock + lastStruct.length\n for (let i = 0, del = deletes[i]; i < deletes.length && del.clock < clockState; del = deletes[++i]) {\n iterateStructs(transaction, structs, del.clock, del.len, f)\n }\n }\n })\n\n/**\n * @param {Array} dis\n * @param {number} clock\n * @return {number|null}\n *\n * @private\n * @function\n */\nexport const findIndexDS = (dis, clock) => {\n let left = 0\n let right = dis.length - 1\n while (left <= right) {\n const midindex = math.floor((left + right) / 2)\n const mid = dis[midindex]\n const midclock = mid.clock\n if (midclock <= clock) {\n if (clock < midclock + mid.len) {\n return midindex\n }\n left = midindex + 1\n } else {\n right = midindex - 1\n }\n }\n return null\n}\n\n/**\n * @param {DeleteSet} ds\n * @param {ID} id\n * @return {boolean}\n *\n * @private\n * @function\n */\nexport const isDeleted = (ds, id) => {\n const dis = ds.clients.get(id.client)\n return dis !== undefined && findIndexDS(dis, id.clock) !== null\n}\n\n/**\n * @param {DeleteSet} ds\n *\n * @private\n * @function\n */\nexport const sortAndMergeDeleteSet = ds => {\n ds.clients.forEach(dels => {\n dels.sort((a, b) => a.clock - b.clock)\n // merge items without filtering or splicing the array\n // i is the current pointer\n // j refers to the current insert position for the pointed item\n // try to merge dels[i] into dels[j-1] or set dels[j]=dels[i]\n let i, j\n for (i = 1, j = 1; i < dels.length; i++) {\n const left = dels[j - 1]\n const right = dels[i]\n if (left.clock + left.len >= right.clock) {\n left.len = math.max(left.len, right.clock + right.len - left.clock)\n } else {\n if (j < i) {\n dels[j] = right\n }\n j++\n }\n }\n dels.length = j\n })\n}\n\n/**\n * @param {Array} dss\n * @return {DeleteSet} A fresh DeleteSet\n */\nexport const mergeDeleteSets = dss => {\n const merged = new DeleteSet()\n for (let dssI = 0; dssI < dss.length; dssI++) {\n dss[dssI].clients.forEach((delsLeft, client) => {\n if (!merged.clients.has(client)) {\n // Write all missing keys from current ds and all following.\n // If merged already contains `client` current ds has already been added.\n /**\n * @type {Array}\n */\n const dels = delsLeft.slice()\n for (let i = dssI + 1; i < dss.length; i++) {\n array.appendTo(dels, dss[i].clients.get(client) || [])\n }\n merged.clients.set(client, dels)\n }\n })\n }\n sortAndMergeDeleteSet(merged)\n return merged\n}\n\n/**\n * @param {DeleteSet} ds\n * @param {number} client\n * @param {number} clock\n * @param {number} length\n *\n * @private\n * @function\n */\nexport const addToDeleteSet = (ds, client, clock, length) => {\n map.setIfUndefined(ds.clients, client, () => /** @type {Array} */ ([])).push(new DeleteItem(clock, length))\n}\n\nexport const createDeleteSet = () => new DeleteSet()\n\n/**\n * @param {StructStore} ss\n * @return {DeleteSet} Merged and sorted DeleteSet\n *\n * @private\n * @function\n */\nexport const createDeleteSetFromStructStore = ss => {\n const ds = createDeleteSet()\n ss.clients.forEach((structs, client) => {\n /**\n * @type {Array}\n */\n const dsitems = []\n for (let i = 0; i < structs.length; i++) {\n const struct = structs[i]\n if (struct.deleted) {\n const clock = struct.id.clock\n let len = struct.length\n if (i + 1 < structs.length) {\n for (let next = structs[i + 1]; i + 1 < structs.length && next.deleted; next = structs[++i + 1]) {\n len += next.length\n }\n }\n dsitems.push(new DeleteItem(clock, len))\n }\n }\n if (dsitems.length > 0) {\n ds.clients.set(client, dsitems)\n }\n })\n return ds\n}\n\n/**\n * @param {DSEncoderV1 | DSEncoderV2} encoder\n * @param {DeleteSet} ds\n *\n * @private\n * @function\n */\nexport const writeDeleteSet = (encoder, ds) => {\n encoding.writeVarUint(encoder.restEncoder, ds.clients.size)\n\n // Ensure that the delete set is written in a deterministic order\n array.from(ds.clients.entries())\n .sort((a, b) => b[0] - a[0])\n .forEach(([client, dsitems]) => {\n encoder.resetDsCurVal()\n encoding.writeVarUint(encoder.restEncoder, client)\n const len = dsitems.length\n encoding.writeVarUint(encoder.restEncoder, len)\n for (let i = 0; i < len; i++) {\n const item = dsitems[i]\n encoder.writeDsClock(item.clock)\n encoder.writeDsLen(item.len)\n }\n })\n}\n\n/**\n * @param {DSDecoderV1 | DSDecoderV2} decoder\n * @return {DeleteSet}\n *\n * @private\n * @function\n */\nexport const readDeleteSet = decoder => {\n const ds = new DeleteSet()\n const numClients = decoding.readVarUint(decoder.restDecoder)\n for (let i = 0; i < numClients; i++) {\n decoder.resetDsCurVal()\n const client = decoding.readVarUint(decoder.restDecoder)\n const numberOfDeletes = decoding.readVarUint(decoder.restDecoder)\n if (numberOfDeletes > 0) {\n const dsField = map.setIfUndefined(ds.clients, client, () => /** @type {Array} */ ([]))\n for (let i = 0; i < numberOfDeletes; i++) {\n dsField.push(new DeleteItem(decoder.readDsClock(), decoder.readDsLen()))\n }\n }\n }\n return ds\n}\n\n/**\n * @todo YDecoder also contains references to String and other Decoders. Would make sense to exchange YDecoder.toUint8Array for YDecoder.DsToUint8Array()..\n */\n\n/**\n * @param {DSDecoderV1 | DSDecoderV2} decoder\n * @param {Transaction} transaction\n * @param {StructStore} store\n * @return {Uint8Array|null} Returns a v2 update containing all deletes that couldn't be applied yet; or null if all deletes were applied successfully.\n *\n * @private\n * @function\n */\nexport const readAndApplyDeleteSet = (decoder, transaction, store) => {\n const unappliedDS = new DeleteSet()\n const numClients = decoding.readVarUint(decoder.restDecoder)\n for (let i = 0; i < numClients; i++) {\n decoder.resetDsCurVal()\n const client = decoding.readVarUint(decoder.restDecoder)\n const numberOfDeletes = decoding.readVarUint(decoder.restDecoder)\n const structs = store.clients.get(client) || []\n const state = getState(store, client)\n for (let i = 0; i < numberOfDeletes; i++) {\n const clock = decoder.readDsClock()\n const clockEnd = clock + decoder.readDsLen()\n if (clock < state) {\n if (state < clockEnd) {\n addToDeleteSet(unappliedDS, client, state, clockEnd - state)\n }\n let index = findIndexSS(structs, clock)\n /**\n * We can ignore the case of GC and Delete structs, because we are going to skip them\n * @type {Item}\n */\n // @ts-ignore\n let struct = structs[index]\n // split the first item if necessary\n if (!struct.deleted && struct.id.clock < clock) {\n structs.splice(index + 1, 0, splitItem(transaction, struct, clock - struct.id.clock))\n index++ // increase we now want to use the next struct\n }\n while (index < structs.length) {\n // @ts-ignore\n struct = structs[index++]\n if (struct.id.clock < clockEnd) {\n if (!struct.deleted) {\n if (clockEnd < struct.id.clock + struct.length) {\n structs.splice(index, 0, splitItem(transaction, struct, clockEnd - struct.id.clock))\n }\n struct.delete(transaction)\n }\n } else {\n break\n }\n }\n } else {\n addToDeleteSet(unappliedDS, client, clock, clockEnd - clock)\n }\n }\n }\n if (unappliedDS.clients.size > 0) {\n const ds = new UpdateEncoderV2()\n encoding.writeVarUint(ds.restEncoder, 0) // encode 0 structs\n writeDeleteSet(ds, unappliedDS)\n return ds.toUint8Array()\n }\n return null\n}\n\n/**\n * @param {DeleteSet} ds1\n * @param {DeleteSet} ds2\n */\nexport const equalDeleteSets = (ds1, ds2) => {\n if (ds1.clients.size !== ds2.clients.size) return false\n for (const [client, deleteItems1] of ds1.clients.entries()) {\n const deleteItems2 = /** @type {Array} */ (ds2.clients.get(client))\n if (deleteItems2 === undefined || deleteItems1.length !== deleteItems2.length) return false\n for (let i = 0; i < deleteItems1.length; i++) {\n const di1 = deleteItems1[i]\n const di2 = deleteItems2[i]\n if (di1.clock !== di2.clock || di1.len !== di2.len) {\n return false\n }\n }\n }\n return true\n}\n","/**\n * @module Y\n */\n\nimport {\n StructStore,\n AbstractType,\n YArray,\n YText,\n YMap,\n YXmlElement,\n YXmlFragment,\n transact,\n ContentDoc, Item, Transaction, YEvent // eslint-disable-line\n} from '../internals.js'\n\nimport { ObservableV2 } from 'lib0/observable'\nimport * as random from 'lib0/random'\nimport * as map from 'lib0/map'\nimport * as array from 'lib0/array'\nimport * as promise from 'lib0/promise'\n\nexport const generateNewClientId = random.uint32\n\n/**\n * @typedef {Object} DocOpts\n * @property {boolean} [DocOpts.gc=true] Disable garbage collection (default: gc=true)\n * @property {function(Item):boolean} [DocOpts.gcFilter] Will be called before an Item is garbage collected. Return false to keep the Item.\n * @property {string} [DocOpts.guid] Define a globally unique identifier for this document\n * @property {string | null} [DocOpts.collectionid] Associate this document with a collection. This only plays a role if your provider has a concept of collection.\n * @property {any} [DocOpts.meta] Any kind of meta information you want to associate with this document. If this is a subdocument, remote peers will store the meta information as well.\n * @property {boolean} [DocOpts.autoLoad] If a subdocument, automatically load document. If this is a subdocument, remote peers will load the document as well automatically.\n * @property {boolean} [DocOpts.shouldLoad] Whether the document should be synced by the provider now. This is toggled to true when you call ydoc.load()\n */\n\n/**\n * @typedef {Object} DocEvents\n * @property {function(Doc):void} DocEvents.destroy\n * @property {function(Doc):void} DocEvents.load\n * @property {function(boolean, Doc):void} DocEvents.sync\n * @property {function(Uint8Array, any, Doc, Transaction):void} DocEvents.update\n * @property {function(Uint8Array, any, Doc, Transaction):void} DocEvents.updateV2\n * @property {function(Doc):void} DocEvents.beforeAllTransactions\n * @property {function(Transaction, Doc):void} DocEvents.beforeTransaction\n * @property {function(Transaction, Doc):void} DocEvents.beforeObserverCalls\n * @property {function(Transaction, Doc):void} DocEvents.afterTransaction\n * @property {function(Transaction, Doc):void} DocEvents.afterTransactionCleanup\n * @property {function(Doc, Array):void} DocEvents.afterAllTransactions\n * @property {function({ loaded: Set, added: Set, removed: Set }, Doc, Transaction):void} DocEvents.subdocs\n */\n\n/**\n * A Yjs instance handles the state of shared data.\n * @extends ObservableV2\n */\nexport class Doc extends ObservableV2 {\n /**\n * @param {DocOpts} opts configuration\n */\n constructor ({ guid = random.uuidv4(), collectionid = null, gc = true, gcFilter = () => true, meta = null, autoLoad = false, shouldLoad = true } = {}) {\n super()\n this.gc = gc\n this.gcFilter = gcFilter\n this.clientID = generateNewClientId()\n this.guid = guid\n this.collectionid = collectionid\n /**\n * @type {Map>>}\n */\n this.share = new Map()\n this.store = new StructStore()\n /**\n * @type {Transaction | null}\n */\n this._transaction = null\n /**\n * @type {Array}\n */\n this._transactionCleanups = []\n /**\n * @type {Set}\n */\n this.subdocs = new Set()\n /**\n * If this document is a subdocument - a document integrated into another document - then _item is defined.\n * @type {Item?}\n */\n this._item = null\n this.shouldLoad = shouldLoad\n this.autoLoad = autoLoad\n this.meta = meta\n /**\n * This is set to true when the persistence provider loaded the document from the database or when the `sync` event fires.\n * Note that not all providers implement this feature. Provider authors are encouraged to fire the `load` event when the doc content is loaded from the database.\n *\n * @type {boolean}\n */\n this.isLoaded = false\n /**\n * This is set to true when the connection provider has successfully synced with a backend.\n * Note that when using peer-to-peer providers this event may not provide very useful.\n * Also note that not all providers implement this feature. Provider authors are encouraged to fire\n * the `sync` event when the doc has been synced (with `true` as a parameter) or if connection is\n * lost (with false as a parameter).\n */\n this.isSynced = false\n this.isDestroyed = false\n /**\n * Promise that resolves once the document has been loaded from a persistence provider.\n */\n this.whenLoaded = promise.create(resolve => {\n this.on('load', () => {\n this.isLoaded = true\n resolve(this)\n })\n })\n const provideSyncedPromise = () => promise.create(resolve => {\n /**\n * @param {boolean} isSynced\n */\n const eventHandler = (isSynced) => {\n if (isSynced === undefined || isSynced === true) {\n this.off('sync', eventHandler)\n resolve()\n }\n }\n this.on('sync', eventHandler)\n })\n this.on('sync', isSynced => {\n if (isSynced === false && this.isSynced) {\n this.whenSynced = provideSyncedPromise()\n }\n this.isSynced = isSynced === undefined || isSynced === true\n if (this.isSynced && !this.isLoaded) {\n this.emit('load', [this])\n }\n })\n /**\n * Promise that resolves once the document has been synced with a backend.\n * This promise is recreated when the connection is lost.\n * Note the documentation about the `isSynced` property.\n */\n this.whenSynced = provideSyncedPromise()\n }\n\n /**\n * Notify the parent document that you request to load data into this subdocument (if it is a subdocument).\n *\n * `load()` might be used in the future to request any provider to load the most current data.\n *\n * It is safe to call `load()` multiple times.\n */\n load () {\n const item = this._item\n if (item !== null && !this.shouldLoad) {\n transact(/** @type {any} */ (item.parent).doc, transaction => {\n transaction.subdocsLoaded.add(this)\n }, null, true)\n }\n this.shouldLoad = true\n }\n\n getSubdocs () {\n return this.subdocs\n }\n\n getSubdocGuids () {\n return new Set(array.from(this.subdocs).map(doc => doc.guid))\n }\n\n /**\n * Changes that happen inside of a transaction are bundled. This means that\n * the observer fires _after_ the transaction is finished and that all changes\n * that happened inside of the transaction are sent as one message to the\n * other peers.\n *\n * @template T\n * @param {function(Transaction):T} f The function that should be executed as a transaction\n * @param {any} [origin] Origin of who started the transaction. Will be stored on transaction.origin\n * @return T\n *\n * @public\n */\n transact (f, origin = null) {\n return transact(this, f, origin)\n }\n\n /**\n * Define a shared data type.\n *\n * Multiple calls of `ydoc.get(name, TypeConstructor)` yield the same result\n * and do not overwrite each other. I.e.\n * `ydoc.get(name, Y.Array) === ydoc.get(name, Y.Array)`\n *\n * After this method is called, the type is also available on `ydoc.share.get(name)`.\n *\n * *Best Practices:*\n * Define all types right after the Y.Doc instance is created and store them in a separate object.\n * Also use the typed methods `getText(name)`, `getArray(name)`, ..\n *\n * @template {typeof AbstractType} Type\n * @example\n * const ydoc = new Y.Doc(..)\n * const appState = {\n * document: ydoc.getText('document')\n * comments: ydoc.getArray('comments')\n * }\n *\n * @param {string} name\n * @param {Type} TypeConstructor The constructor of the type definition. E.g. Y.Text, Y.Array, Y.Map, ...\n * @return {InstanceType} The created type. Constructed with TypeConstructor\n *\n * @public\n */\n get (name, TypeConstructor = /** @type {any} */ (AbstractType)) {\n const type = map.setIfUndefined(this.share, name, () => {\n // @ts-ignore\n const t = new TypeConstructor()\n t._integrate(this, null)\n return t\n })\n const Constr = type.constructor\n if (TypeConstructor !== AbstractType && Constr !== TypeConstructor) {\n if (Constr === AbstractType) {\n // @ts-ignore\n const t = new TypeConstructor()\n t._map = type._map\n type._map.forEach(/** @param {Item?} n */ n => {\n for (; n !== null; n = n.left) {\n // @ts-ignore\n n.parent = t\n }\n })\n t._start = type._start\n for (let n = t._start; n !== null; n = n.right) {\n n.parent = t\n }\n t._length = type._length\n this.share.set(name, t)\n t._integrate(this, null)\n return /** @type {InstanceType} */ (t)\n } else {\n throw new Error(`Type with the name ${name} has already been defined with a different constructor`)\n }\n }\n return /** @type {InstanceType} */ (type)\n }\n\n /**\n * @template T\n * @param {string} [name]\n * @return {YArray}\n *\n * @public\n */\n getArray (name = '') {\n return /** @type {YArray} */ (this.get(name, YArray))\n }\n\n /**\n * @param {string} [name]\n * @return {YText}\n *\n * @public\n */\n getText (name = '') {\n return this.get(name, YText)\n }\n\n /**\n * @template T\n * @param {string} [name]\n * @return {YMap}\n *\n * @public\n */\n getMap (name = '') {\n return /** @type {YMap} */ (this.get(name, YMap))\n }\n\n /**\n * @param {string} [name]\n * @return {YXmlElement}\n *\n * @public\n */\n getXmlElement (name = '') {\n return /** @type {YXmlElement<{[key:string]:string}>} */ (this.get(name, YXmlElement))\n }\n\n /**\n * @param {string} [name]\n * @return {YXmlFragment}\n *\n * @public\n */\n getXmlFragment (name = '') {\n return this.get(name, YXmlFragment)\n }\n\n /**\n * Converts the entire document into a js object, recursively traversing each yjs type\n * Doesn't log types that have not been defined (using ydoc.getType(..)).\n *\n * @deprecated Do not use this method and rather call toJSON directly on the shared types.\n *\n * @return {Object}\n */\n toJSON () {\n /**\n * @type {Object}\n */\n const doc = {}\n\n this.share.forEach((value, key) => {\n doc[key] = value.toJSON()\n })\n\n return doc\n }\n\n /**\n * Emit `destroy` event and unregister all event handlers.\n */\n destroy () {\n this.isDestroyed = true\n array.from(this.subdocs).forEach(subdoc => subdoc.destroy())\n const item = this._item\n if (item !== null) {\n this._item = null\n const content = /** @type {ContentDoc} */ (item.content)\n content.doc = new Doc({ guid: this.guid, ...content.opts, shouldLoad: false })\n content.doc._item = item\n transact(/** @type {any} */ (item).parent.doc, transaction => {\n const doc = content.doc\n if (!item.deleted) {\n transaction.subdocsAdded.add(doc)\n }\n transaction.subdocsRemoved.add(this)\n }, null, true)\n }\n // @ts-ignore\n this.emit('destroyed', [true]) // DEPRECATED!\n this.emit('destroy', [this])\n super.destroy()\n }\n}\n","import * as buffer from 'lib0/buffer'\nimport * as decoding from 'lib0/decoding'\nimport {\n ID, createID\n} from '../internals.js'\n\nexport class DSDecoderV1 {\n /**\n * @param {decoding.Decoder} decoder\n */\n constructor (decoder) {\n this.restDecoder = decoder\n }\n\n resetDsCurVal () {\n // nop\n }\n\n /**\n * @return {number}\n */\n readDsClock () {\n return decoding.readVarUint(this.restDecoder)\n }\n\n /**\n * @return {number}\n */\n readDsLen () {\n return decoding.readVarUint(this.restDecoder)\n }\n}\n\nexport class UpdateDecoderV1 extends DSDecoderV1 {\n /**\n * @return {ID}\n */\n readLeftID () {\n return createID(decoding.readVarUint(this.restDecoder), decoding.readVarUint(this.restDecoder))\n }\n\n /**\n * @return {ID}\n */\n readRightID () {\n return createID(decoding.readVarUint(this.restDecoder), decoding.readVarUint(this.restDecoder))\n }\n\n /**\n * Read the next client id.\n * Use this in favor of readID whenever possible to reduce the number of objects created.\n */\n readClient () {\n return decoding.readVarUint(this.restDecoder)\n }\n\n /**\n * @return {number} info An unsigned 8-bit integer\n */\n readInfo () {\n return decoding.readUint8(this.restDecoder)\n }\n\n /**\n * @return {string}\n */\n readString () {\n return decoding.readVarString(this.restDecoder)\n }\n\n /**\n * @return {boolean} isKey\n */\n readParentInfo () {\n return decoding.readVarUint(this.restDecoder) === 1\n }\n\n /**\n * @return {number} info An unsigned 8-bit integer\n */\n readTypeRef () {\n return decoding.readVarUint(this.restDecoder)\n }\n\n /**\n * Write len of a struct - well suited for Opt RLE encoder.\n *\n * @return {number} len\n */\n readLen () {\n return decoding.readVarUint(this.restDecoder)\n }\n\n /**\n * @return {any}\n */\n readAny () {\n return decoding.readAny(this.restDecoder)\n }\n\n /**\n * @return {Uint8Array}\n */\n readBuf () {\n return buffer.copyUint8Array(decoding.readVarUint8Array(this.restDecoder))\n }\n\n /**\n * Legacy implementation uses JSON parse. We use any-decoding in v2.\n *\n * @return {any}\n */\n readJSON () {\n return JSON.parse(decoding.readVarString(this.restDecoder))\n }\n\n /**\n * @return {string}\n */\n readKey () {\n return decoding.readVarString(this.restDecoder)\n }\n}\n\nexport class DSDecoderV2 {\n /**\n * @param {decoding.Decoder} decoder\n */\n constructor (decoder) {\n /**\n * @private\n */\n this.dsCurrVal = 0\n this.restDecoder = decoder\n }\n\n resetDsCurVal () {\n this.dsCurrVal = 0\n }\n\n /**\n * @return {number}\n */\n readDsClock () {\n this.dsCurrVal += decoding.readVarUint(this.restDecoder)\n return this.dsCurrVal\n }\n\n /**\n * @return {number}\n */\n readDsLen () {\n const diff = decoding.readVarUint(this.restDecoder) + 1\n this.dsCurrVal += diff\n return diff\n }\n}\n\nexport class UpdateDecoderV2 extends DSDecoderV2 {\n /**\n * @param {decoding.Decoder} decoder\n */\n constructor (decoder) {\n super(decoder)\n /**\n * List of cached keys. If the keys[id] does not exist, we read a new key\n * from stringEncoder and push it to keys.\n *\n * @type {Array}\n */\n this.keys = []\n decoding.readVarUint(decoder) // read feature flag - currently unused\n this.keyClockDecoder = new decoding.IntDiffOptRleDecoder(decoding.readVarUint8Array(decoder))\n this.clientDecoder = new decoding.UintOptRleDecoder(decoding.readVarUint8Array(decoder))\n this.leftClockDecoder = new decoding.IntDiffOptRleDecoder(decoding.readVarUint8Array(decoder))\n this.rightClockDecoder = new decoding.IntDiffOptRleDecoder(decoding.readVarUint8Array(decoder))\n this.infoDecoder = new decoding.RleDecoder(decoding.readVarUint8Array(decoder), decoding.readUint8)\n this.stringDecoder = new decoding.StringDecoder(decoding.readVarUint8Array(decoder))\n this.parentInfoDecoder = new decoding.RleDecoder(decoding.readVarUint8Array(decoder), decoding.readUint8)\n this.typeRefDecoder = new decoding.UintOptRleDecoder(decoding.readVarUint8Array(decoder))\n this.lenDecoder = new decoding.UintOptRleDecoder(decoding.readVarUint8Array(decoder))\n }\n\n /**\n * @return {ID}\n */\n readLeftID () {\n return new ID(this.clientDecoder.read(), this.leftClockDecoder.read())\n }\n\n /**\n * @return {ID}\n */\n readRightID () {\n return new ID(this.clientDecoder.read(), this.rightClockDecoder.read())\n }\n\n /**\n * Read the next client id.\n * Use this in favor of readID whenever possible to reduce the number of objects created.\n */\n readClient () {\n return this.clientDecoder.read()\n }\n\n /**\n * @return {number} info An unsigned 8-bit integer\n */\n readInfo () {\n return /** @type {number} */ (this.infoDecoder.read())\n }\n\n /**\n * @return {string}\n */\n readString () {\n return this.stringDecoder.read()\n }\n\n /**\n * @return {boolean}\n */\n readParentInfo () {\n return this.parentInfoDecoder.read() === 1\n }\n\n /**\n * @return {number} An unsigned 8-bit integer\n */\n readTypeRef () {\n return this.typeRefDecoder.read()\n }\n\n /**\n * Write len of a struct - well suited for Opt RLE encoder.\n *\n * @return {number}\n */\n readLen () {\n return this.lenDecoder.read()\n }\n\n /**\n * @return {any}\n */\n readAny () {\n return decoding.readAny(this.restDecoder)\n }\n\n /**\n * @return {Uint8Array}\n */\n readBuf () {\n return decoding.readVarUint8Array(this.restDecoder)\n }\n\n /**\n * This is mainly here for legacy purposes.\n *\n * Initial we incoded objects using JSON. Now we use the much faster lib0/any-encoder. This method mainly exists for legacy purposes for the v1 encoder.\n *\n * @return {any}\n */\n readJSON () {\n return decoding.readAny(this.restDecoder)\n }\n\n /**\n * @return {string}\n */\n readKey () {\n const keyClock = this.keyClockDecoder.read()\n if (keyClock < this.keys.length) {\n return this.keys[keyClock]\n } else {\n const key = this.stringDecoder.read()\n this.keys.push(key)\n return key\n }\n }\n}\n","import * as error from 'lib0/error'\nimport * as encoding from 'lib0/encoding'\n\nimport {\n ID // eslint-disable-line\n} from '../internals.js'\n\nexport class DSEncoderV1 {\n constructor () {\n this.restEncoder = encoding.createEncoder()\n }\n\n toUint8Array () {\n return encoding.toUint8Array(this.restEncoder)\n }\n\n resetDsCurVal () {\n // nop\n }\n\n /**\n * @param {number} clock\n */\n writeDsClock (clock) {\n encoding.writeVarUint(this.restEncoder, clock)\n }\n\n /**\n * @param {number} len\n */\n writeDsLen (len) {\n encoding.writeVarUint(this.restEncoder, len)\n }\n}\n\nexport class UpdateEncoderV1 extends DSEncoderV1 {\n /**\n * @param {ID} id\n */\n writeLeftID (id) {\n encoding.writeVarUint(this.restEncoder, id.client)\n encoding.writeVarUint(this.restEncoder, id.clock)\n }\n\n /**\n * @param {ID} id\n */\n writeRightID (id) {\n encoding.writeVarUint(this.restEncoder, id.client)\n encoding.writeVarUint(this.restEncoder, id.clock)\n }\n\n /**\n * Use writeClient and writeClock instead of writeID if possible.\n * @param {number} client\n */\n writeClient (client) {\n encoding.writeVarUint(this.restEncoder, client)\n }\n\n /**\n * @param {number} info An unsigned 8-bit integer\n */\n writeInfo (info) {\n encoding.writeUint8(this.restEncoder, info)\n }\n\n /**\n * @param {string} s\n */\n writeString (s) {\n encoding.writeVarString(this.restEncoder, s)\n }\n\n /**\n * @param {boolean} isYKey\n */\n writeParentInfo (isYKey) {\n encoding.writeVarUint(this.restEncoder, isYKey ? 1 : 0)\n }\n\n /**\n * @param {number} info An unsigned 8-bit integer\n */\n writeTypeRef (info) {\n encoding.writeVarUint(this.restEncoder, info)\n }\n\n /**\n * Write len of a struct - well suited for Opt RLE encoder.\n *\n * @param {number} len\n */\n writeLen (len) {\n encoding.writeVarUint(this.restEncoder, len)\n }\n\n /**\n * @param {any} any\n */\n writeAny (any) {\n encoding.writeAny(this.restEncoder, any)\n }\n\n /**\n * @param {Uint8Array} buf\n */\n writeBuf (buf) {\n encoding.writeVarUint8Array(this.restEncoder, buf)\n }\n\n /**\n * @param {any} embed\n */\n writeJSON (embed) {\n encoding.writeVarString(this.restEncoder, JSON.stringify(embed))\n }\n\n /**\n * @param {string} key\n */\n writeKey (key) {\n encoding.writeVarString(this.restEncoder, key)\n }\n}\n\nexport class DSEncoderV2 {\n constructor () {\n this.restEncoder = encoding.createEncoder() // encodes all the rest / non-optimized\n this.dsCurrVal = 0\n }\n\n toUint8Array () {\n return encoding.toUint8Array(this.restEncoder)\n }\n\n resetDsCurVal () {\n this.dsCurrVal = 0\n }\n\n /**\n * @param {number} clock\n */\n writeDsClock (clock) {\n const diff = clock - this.dsCurrVal\n this.dsCurrVal = clock\n encoding.writeVarUint(this.restEncoder, diff)\n }\n\n /**\n * @param {number} len\n */\n writeDsLen (len) {\n if (len === 0) {\n error.unexpectedCase()\n }\n encoding.writeVarUint(this.restEncoder, len - 1)\n this.dsCurrVal += len\n }\n}\n\nexport class UpdateEncoderV2 extends DSEncoderV2 {\n constructor () {\n super()\n /**\n * @type {Map}\n */\n this.keyMap = new Map()\n /**\n * Refers to the next unique key-identifier to me used.\n * See writeKey method for more information.\n *\n * @type {number}\n */\n this.keyClock = 0\n this.keyClockEncoder = new encoding.IntDiffOptRleEncoder()\n this.clientEncoder = new encoding.UintOptRleEncoder()\n this.leftClockEncoder = new encoding.IntDiffOptRleEncoder()\n this.rightClockEncoder = new encoding.IntDiffOptRleEncoder()\n this.infoEncoder = new encoding.RleEncoder(encoding.writeUint8)\n this.stringEncoder = new encoding.StringEncoder()\n this.parentInfoEncoder = new encoding.RleEncoder(encoding.writeUint8)\n this.typeRefEncoder = new encoding.UintOptRleEncoder()\n this.lenEncoder = new encoding.UintOptRleEncoder()\n }\n\n toUint8Array () {\n const encoder = encoding.createEncoder()\n encoding.writeVarUint(encoder, 0) // this is a feature flag that we might use in the future\n encoding.writeVarUint8Array(encoder, this.keyClockEncoder.toUint8Array())\n encoding.writeVarUint8Array(encoder, this.clientEncoder.toUint8Array())\n encoding.writeVarUint8Array(encoder, this.leftClockEncoder.toUint8Array())\n encoding.writeVarUint8Array(encoder, this.rightClockEncoder.toUint8Array())\n encoding.writeVarUint8Array(encoder, encoding.toUint8Array(this.infoEncoder))\n encoding.writeVarUint8Array(encoder, this.stringEncoder.toUint8Array())\n encoding.writeVarUint8Array(encoder, encoding.toUint8Array(this.parentInfoEncoder))\n encoding.writeVarUint8Array(encoder, this.typeRefEncoder.toUint8Array())\n encoding.writeVarUint8Array(encoder, this.lenEncoder.toUint8Array())\n // @note The rest encoder is appended! (note the missing var)\n encoding.writeUint8Array(encoder, encoding.toUint8Array(this.restEncoder))\n return encoding.toUint8Array(encoder)\n }\n\n /**\n * @param {ID} id\n */\n writeLeftID (id) {\n this.clientEncoder.write(id.client)\n this.leftClockEncoder.write(id.clock)\n }\n\n /**\n * @param {ID} id\n */\n writeRightID (id) {\n this.clientEncoder.write(id.client)\n this.rightClockEncoder.write(id.clock)\n }\n\n /**\n * @param {number} client\n */\n writeClient (client) {\n this.clientEncoder.write(client)\n }\n\n /**\n * @param {number} info An unsigned 8-bit integer\n */\n writeInfo (info) {\n this.infoEncoder.write(info)\n }\n\n /**\n * @param {string} s\n */\n writeString (s) {\n this.stringEncoder.write(s)\n }\n\n /**\n * @param {boolean} isYKey\n */\n writeParentInfo (isYKey) {\n this.parentInfoEncoder.write(isYKey ? 1 : 0)\n }\n\n /**\n * @param {number} info An unsigned 8-bit integer\n */\n writeTypeRef (info) {\n this.typeRefEncoder.write(info)\n }\n\n /**\n * Write len of a struct - well suited for Opt RLE encoder.\n *\n * @param {number} len\n */\n writeLen (len) {\n this.lenEncoder.write(len)\n }\n\n /**\n * @param {any} any\n */\n writeAny (any) {\n encoding.writeAny(this.restEncoder, any)\n }\n\n /**\n * @param {Uint8Array} buf\n */\n writeBuf (buf) {\n encoding.writeVarUint8Array(this.restEncoder, buf)\n }\n\n /**\n * This is mainly here for legacy purposes.\n *\n * Initial we incoded objects using JSON. Now we use the much faster lib0/any-encoder. This method mainly exists for legacy purposes for the v1 encoder.\n *\n * @param {any} embed\n */\n writeJSON (embed) {\n encoding.writeAny(this.restEncoder, embed)\n }\n\n /**\n * Property keys are often reused. For example, in y-prosemirror the key `bold` might\n * occur very often. For a 3d application, the key `position` might occur very often.\n *\n * We cache these keys in a Map and refer to them via a unique number.\n *\n * @param {string} key\n */\n writeKey (key) {\n const clock = this.keyMap.get(key)\n if (clock === undefined) {\n /**\n * @todo uncomment to introduce this feature finally\n *\n * Background. The ContentFormat object was always encoded using writeKey, but the decoder used to use readString.\n * Furthermore, I forgot to set the keyclock. So everything was working fine.\n *\n * However, this feature here is basically useless as it is not being used (it actually only consumes extra memory).\n *\n * I don't know yet how to reintroduce this feature..\n *\n * Older clients won't be able to read updates when we reintroduce this feature. So this should probably be done using a flag.\n *\n */\n // this.keyMap.set(key, this.keyClock)\n this.keyClockEncoder.write(this.keyClock++)\n this.stringEncoder.write(key)\n } else {\n this.keyClockEncoder.write(clock)\n }\n }\n}\n","/**\n * @module encoding\n */\n/*\n * We use the first five bits in the info flag for determining the type of the struct.\n *\n * 0: GC\n * 1: Item with Deleted content\n * 2: Item with JSON content\n * 3: Item with Binary content\n * 4: Item with String content\n * 5: Item with Embed content (for richtext content)\n * 6: Item with Format content (a formatting marker for richtext content)\n * 7: Item with Type\n */\n\nimport {\n findIndexSS,\n getState,\n createID,\n getStateVector,\n readAndApplyDeleteSet,\n writeDeleteSet,\n createDeleteSetFromStructStore,\n transact,\n readItemContent,\n UpdateDecoderV1,\n UpdateDecoderV2,\n UpdateEncoderV1,\n UpdateEncoderV2,\n DSEncoderV2,\n DSDecoderV1,\n DSEncoderV1,\n mergeUpdates,\n mergeUpdatesV2,\n Skip,\n diffUpdateV2,\n convertUpdateFormatV2ToV1,\n DSDecoderV2, Doc, Transaction, GC, Item, StructStore // eslint-disable-line\n} from '../internals.js'\n\nimport * as encoding from 'lib0/encoding'\nimport * as decoding from 'lib0/decoding'\nimport * as binary from 'lib0/binary'\nimport * as map from 'lib0/map'\nimport * as math from 'lib0/math'\nimport * as array from 'lib0/array'\n\n/**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {Array} structs All structs by `client`\n * @param {number} client\n * @param {number} clock write structs starting with `ID(client,clock)`\n *\n * @function\n */\nconst writeStructs = (encoder, structs, client, clock) => {\n // write first id\n clock = math.max(clock, structs[0].id.clock) // make sure the first id exists\n const startNewStructs = findIndexSS(structs, clock)\n // write # encoded structs\n encoding.writeVarUint(encoder.restEncoder, structs.length - startNewStructs)\n encoder.writeClient(client)\n encoding.writeVarUint(encoder.restEncoder, clock)\n const firstStruct = structs[startNewStructs]\n // write first struct with an offset\n firstStruct.write(encoder, clock - firstStruct.id.clock)\n for (let i = startNewStructs + 1; i < structs.length; i++) {\n structs[i].write(encoder, 0)\n }\n}\n\n/**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {StructStore} store\n * @param {Map} _sm\n *\n * @private\n * @function\n */\nexport const writeClientsStructs = (encoder, store, _sm) => {\n // we filter all valid _sm entries into sm\n const sm = new Map()\n _sm.forEach((clock, client) => {\n // only write if new structs are available\n if (getState(store, client) > clock) {\n sm.set(client, clock)\n }\n })\n getStateVector(store).forEach((_clock, client) => {\n if (!_sm.has(client)) {\n sm.set(client, 0)\n }\n })\n // write # states that were updated\n encoding.writeVarUint(encoder.restEncoder, sm.size)\n // Write items with higher client ids first\n // This heavily improves the conflict algorithm.\n array.from(sm.entries()).sort((a, b) => b[0] - a[0]).forEach(([client, clock]) => {\n writeStructs(encoder, /** @type {Array} */ (store.clients.get(client)), client, clock)\n })\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder The decoder object to read data from.\n * @param {Doc} doc\n * @return {Map }>}\n *\n * @private\n * @function\n */\nexport const readClientsStructRefs = (decoder, doc) => {\n /**\n * @type {Map }>}\n */\n const clientRefs = map.create()\n const numOfStateUpdates = decoding.readVarUint(decoder.restDecoder)\n for (let i = 0; i < numOfStateUpdates; i++) {\n const numberOfStructs = decoding.readVarUint(decoder.restDecoder)\n /**\n * @type {Array}\n */\n const refs = new Array(numberOfStructs)\n const client = decoder.readClient()\n let clock = decoding.readVarUint(decoder.restDecoder)\n // const start = performance.now()\n clientRefs.set(client, { i: 0, refs })\n for (let i = 0; i < numberOfStructs; i++) {\n const info = decoder.readInfo()\n switch (binary.BITS5 & info) {\n case 0: { // GC\n const len = decoder.readLen()\n refs[i] = new GC(createID(client, clock), len)\n clock += len\n break\n }\n case 10: { // Skip Struct (nothing to apply)\n // @todo we could reduce the amount of checks by adding Skip struct to clientRefs so we know that something is missing.\n const len = decoding.readVarUint(decoder.restDecoder)\n refs[i] = new Skip(createID(client, clock), len)\n clock += len\n break\n }\n default: { // Item with content\n /**\n * The optimized implementation doesn't use any variables because inlining variables is faster.\n * Below a non-optimized version is shown that implements the basic algorithm with\n * a few comments\n */\n const cantCopyParentInfo = (info & (binary.BIT7 | binary.BIT8)) === 0\n // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y`\n // and we read the next string as parentYKey.\n // It indicates how we store/retrieve parent from `y.share`\n // @type {string|null}\n const struct = new Item(\n createID(client, clock),\n null, // left\n (info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null, // origin\n null, // right\n (info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null, // right origin\n cantCopyParentInfo ? (decoder.readParentInfo() ? doc.get(decoder.readString()) : decoder.readLeftID()) : null, // parent\n cantCopyParentInfo && (info & binary.BIT6) === binary.BIT6 ? decoder.readString() : null, // parentSub\n readItemContent(decoder, info) // item content\n )\n /* A non-optimized implementation of the above algorithm:\n\n // The item that was originally to the left of this item.\n const origin = (info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null\n // The item that was originally to the right of this item.\n const rightOrigin = (info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null\n const cantCopyParentInfo = (info & (binary.BIT7 | binary.BIT8)) === 0\n const hasParentYKey = cantCopyParentInfo ? decoder.readParentInfo() : false\n // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y`\n // and we read the next string as parentYKey.\n // It indicates how we store/retrieve parent from `y.share`\n // @type {string|null}\n const parentYKey = cantCopyParentInfo && hasParentYKey ? decoder.readString() : null\n\n const struct = new Item(\n createID(client, clock),\n null, // left\n origin, // origin\n null, // right\n rightOrigin, // right origin\n cantCopyParentInfo && !hasParentYKey ? decoder.readLeftID() : (parentYKey !== null ? doc.get(parentYKey) : null), // parent\n cantCopyParentInfo && (info & binary.BIT6) === binary.BIT6 ? decoder.readString() : null, // parentSub\n readItemContent(decoder, info) // item content\n )\n */\n refs[i] = struct\n clock += struct.length\n }\n }\n }\n // console.log('time to read: ', performance.now() - start) // @todo remove\n }\n return clientRefs\n}\n\n/**\n * Resume computing structs generated by struct readers.\n *\n * While there is something to do, we integrate structs in this order\n * 1. top element on stack, if stack is not empty\n * 2. next element from current struct reader (if empty, use next struct reader)\n *\n * If struct causally depends on another struct (ref.missing), we put next reader of\n * `ref.id.client` on top of stack.\n *\n * At some point we find a struct that has no causal dependencies,\n * then we start emptying the stack.\n *\n * It is not possible to have circles: i.e. struct1 (from client1) depends on struct2 (from client2)\n * depends on struct3 (from client1). Therefore the max stack size is equal to `structReaders.length`.\n *\n * This method is implemented in a way so that we can resume computation if this update\n * causally depends on another update.\n *\n * @param {Transaction} transaction\n * @param {StructStore} store\n * @param {Map} clientsStructRefs\n * @return { null | { update: Uint8Array, missing: Map } }\n *\n * @private\n * @function\n */\nconst integrateStructs = (transaction, store, clientsStructRefs) => {\n /**\n * @type {Array}\n */\n const stack = []\n // sort them so that we take the higher id first, in case of conflicts the lower id will probably not conflict with the id from the higher user.\n let clientsStructRefsIds = array.from(clientsStructRefs.keys()).sort((a, b) => a - b)\n if (clientsStructRefsIds.length === 0) {\n return null\n }\n const getNextStructTarget = () => {\n if (clientsStructRefsIds.length === 0) {\n return null\n }\n let nextStructsTarget = /** @type {{i:number,refs:Array}} */ (clientsStructRefs.get(clientsStructRefsIds[clientsStructRefsIds.length - 1]))\n while (nextStructsTarget.refs.length === nextStructsTarget.i) {\n clientsStructRefsIds.pop()\n if (clientsStructRefsIds.length > 0) {\n nextStructsTarget = /** @type {{i:number,refs:Array}} */ (clientsStructRefs.get(clientsStructRefsIds[clientsStructRefsIds.length - 1]))\n } else {\n return null\n }\n }\n return nextStructsTarget\n }\n let curStructsTarget = getNextStructTarget()\n if (curStructsTarget === null) {\n return null\n }\n\n /**\n * @type {StructStore}\n */\n const restStructs = new StructStore()\n const missingSV = new Map()\n /**\n * @param {number} client\n * @param {number} clock\n */\n const updateMissingSv = (client, clock) => {\n const mclock = missingSV.get(client)\n if (mclock == null || mclock > clock) {\n missingSV.set(client, clock)\n }\n }\n /**\n * @type {GC|Item}\n */\n let stackHead = /** @type {any} */ (curStructsTarget).refs[/** @type {any} */ (curStructsTarget).i++]\n // caching the state because it is used very often\n const state = new Map()\n\n const addStackToRestSS = () => {\n for (const item of stack) {\n const client = item.id.client\n const inapplicableItems = clientsStructRefs.get(client)\n if (inapplicableItems) {\n // decrement because we weren't able to apply previous operation\n inapplicableItems.i--\n restStructs.clients.set(client, inapplicableItems.refs.slice(inapplicableItems.i))\n clientsStructRefs.delete(client)\n inapplicableItems.i = 0\n inapplicableItems.refs = []\n } else {\n // item was the last item on clientsStructRefs and the field was already cleared. Add item to restStructs and continue\n restStructs.clients.set(client, [item])\n }\n // remove client from clientsStructRefsIds to prevent users from applying the same update again\n clientsStructRefsIds = clientsStructRefsIds.filter(c => c !== client)\n }\n stack.length = 0\n }\n\n // iterate over all struct readers until we are done\n while (true) {\n if (stackHead.constructor !== Skip) {\n const localClock = map.setIfUndefined(state, stackHead.id.client, () => getState(store, stackHead.id.client))\n const offset = localClock - stackHead.id.clock\n if (offset < 0) {\n // update from the same client is missing\n stack.push(stackHead)\n updateMissingSv(stackHead.id.client, stackHead.id.clock - 1)\n // hid a dead wall, add all items from stack to restSS\n addStackToRestSS()\n } else {\n const missing = stackHead.getMissing(transaction, store)\n if (missing !== null) {\n stack.push(stackHead)\n // get the struct reader that has the missing struct\n /**\n * @type {{ refs: Array, i: number }}\n */\n const structRefs = clientsStructRefs.get(/** @type {number} */ (missing)) || { refs: [], i: 0 }\n if (structRefs.refs.length === structRefs.i) {\n // This update message causally depends on another update message that doesn't exist yet\n updateMissingSv(/** @type {number} */ (missing), getState(store, missing))\n addStackToRestSS()\n } else {\n stackHead = structRefs.refs[structRefs.i++]\n continue\n }\n } else if (offset === 0 || offset < stackHead.length) {\n // all fine, apply the stackhead\n stackHead.integrate(transaction, offset)\n state.set(stackHead.id.client, stackHead.id.clock + stackHead.length)\n }\n }\n }\n // iterate to next stackHead\n if (stack.length > 0) {\n stackHead = /** @type {GC|Item} */ (stack.pop())\n } else if (curStructsTarget !== null && curStructsTarget.i < curStructsTarget.refs.length) {\n stackHead = /** @type {GC|Item} */ (curStructsTarget.refs[curStructsTarget.i++])\n } else {\n curStructsTarget = getNextStructTarget()\n if (curStructsTarget === null) {\n // we are done!\n break\n } else {\n stackHead = /** @type {GC|Item} */ (curStructsTarget.refs[curStructsTarget.i++])\n }\n }\n }\n if (restStructs.clients.size > 0) {\n const encoder = new UpdateEncoderV2()\n writeClientsStructs(encoder, restStructs, new Map())\n // write empty deleteset\n // writeDeleteSet(encoder, new DeleteSet())\n encoding.writeVarUint(encoder.restEncoder, 0) // => no need for an extra function call, just write 0 deletes\n return { missing: missingSV, update: encoder.toUint8Array() }\n }\n return null\n}\n\n/**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {Transaction} transaction\n *\n * @private\n * @function\n */\nexport const writeStructsFromTransaction = (encoder, transaction) => writeClientsStructs(encoder, transaction.doc.store, transaction.beforeState)\n\n/**\n * Read and apply a document update.\n *\n * This function has the same effect as `applyUpdate` but accepts a decoder.\n *\n * @param {decoding.Decoder} decoder\n * @param {Doc} ydoc\n * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))`\n * @param {UpdateDecoderV1 | UpdateDecoderV2} [structDecoder]\n *\n * @function\n */\nexport const readUpdateV2 = (decoder, ydoc, transactionOrigin, structDecoder = new UpdateDecoderV2(decoder)) =>\n transact(ydoc, transaction => {\n // force that transaction.local is set to non-local\n transaction.local = false\n let retry = false\n const doc = transaction.doc\n const store = doc.store\n // let start = performance.now()\n const ss = readClientsStructRefs(structDecoder, doc)\n // console.log('time to read structs: ', performance.now() - start) // @todo remove\n // start = performance.now()\n // console.log('time to merge: ', performance.now() - start) // @todo remove\n // start = performance.now()\n const restStructs = integrateStructs(transaction, store, ss)\n const pending = store.pendingStructs\n if (pending) {\n // check if we can apply something\n for (const [client, clock] of pending.missing) {\n if (clock < getState(store, client)) {\n retry = true\n break\n }\n }\n if (restStructs) {\n // merge restStructs into store.pending\n for (const [client, clock] of restStructs.missing) {\n const mclock = pending.missing.get(client)\n if (mclock == null || mclock > clock) {\n pending.missing.set(client, clock)\n }\n }\n pending.update = mergeUpdatesV2([pending.update, restStructs.update])\n }\n } else {\n store.pendingStructs = restStructs\n }\n // console.log('time to integrate: ', performance.now() - start) // @todo remove\n // start = performance.now()\n const dsRest = readAndApplyDeleteSet(structDecoder, transaction, store)\n if (store.pendingDs) {\n // @todo we could make a lower-bound state-vector check as we do above\n const pendingDSUpdate = new UpdateDecoderV2(decoding.createDecoder(store.pendingDs))\n decoding.readVarUint(pendingDSUpdate.restDecoder) // read 0 structs, because we only encode deletes in pendingdsupdate\n const dsRest2 = readAndApplyDeleteSet(pendingDSUpdate, transaction, store)\n if (dsRest && dsRest2) {\n // case 1: ds1 != null && ds2 != null\n store.pendingDs = mergeUpdatesV2([dsRest, dsRest2])\n } else {\n // case 2: ds1 != null\n // case 3: ds2 != null\n // case 4: ds1 == null && ds2 == null\n store.pendingDs = dsRest || dsRest2\n }\n } else {\n // Either dsRest == null && pendingDs == null OR dsRest != null\n store.pendingDs = dsRest\n }\n // console.log('time to cleanup: ', performance.now() - start) // @todo remove\n // start = performance.now()\n\n // console.log('time to resume delete readers: ', performance.now() - start) // @todo remove\n // start = performance.now()\n if (retry) {\n const update = /** @type {{update: Uint8Array}} */ (store.pendingStructs).update\n store.pendingStructs = null\n applyUpdateV2(transaction.doc, update)\n }\n }, transactionOrigin, false)\n\n/**\n * Read and apply a document update.\n *\n * This function has the same effect as `applyUpdate` but accepts a decoder.\n *\n * @param {decoding.Decoder} decoder\n * @param {Doc} ydoc\n * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))`\n *\n * @function\n */\nexport const readUpdate = (decoder, ydoc, transactionOrigin) => readUpdateV2(decoder, ydoc, transactionOrigin, new UpdateDecoderV1(decoder))\n\n/**\n * Apply a document update created by, for example, `y.on('update', update => ..)` or `update = encodeStateAsUpdate()`.\n *\n * This function has the same effect as `readUpdate` but accepts an Uint8Array instead of a Decoder.\n *\n * @param {Doc} ydoc\n * @param {Uint8Array} update\n * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))`\n * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder]\n *\n * @function\n */\nexport const applyUpdateV2 = (ydoc, update, transactionOrigin, YDecoder = UpdateDecoderV2) => {\n const decoder = decoding.createDecoder(update)\n readUpdateV2(decoder, ydoc, transactionOrigin, new YDecoder(decoder))\n}\n\n/**\n * Apply a document update created by, for example, `y.on('update', update => ..)` or `update = encodeStateAsUpdate()`.\n *\n * This function has the same effect as `readUpdate` but accepts an Uint8Array instead of a Decoder.\n *\n * @param {Doc} ydoc\n * @param {Uint8Array} update\n * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))`\n *\n * @function\n */\nexport const applyUpdate = (ydoc, update, transactionOrigin) => applyUpdateV2(ydoc, update, transactionOrigin, UpdateDecoderV1)\n\n/**\n * Write all the document as a single update message. If you specify the state of the remote client (`targetStateVector`) it will\n * only write the operations that are missing.\n *\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {Doc} doc\n * @param {Map} [targetStateVector] The state of the target that receives the update. Leave empty to write all known structs\n *\n * @function\n */\nexport const writeStateAsUpdate = (encoder, doc, targetStateVector = new Map()) => {\n writeClientsStructs(encoder, doc.store, targetStateVector)\n writeDeleteSet(encoder, createDeleteSetFromStructStore(doc.store))\n}\n\n/**\n * Write all the document as a single update message that can be applied on the remote document. If you specify the state of the remote client (`targetState`) it will\n * only write the operations that are missing.\n *\n * Use `writeStateAsUpdate` instead if you are working with lib0/encoding.js#Encoder\n *\n * @param {Doc} doc\n * @param {Uint8Array} [encodedTargetStateVector] The state of the target that receives the update. Leave empty to write all known structs\n * @param {UpdateEncoderV1 | UpdateEncoderV2} [encoder]\n * @return {Uint8Array}\n *\n * @function\n */\nexport const encodeStateAsUpdateV2 = (doc, encodedTargetStateVector = new Uint8Array([0]), encoder = new UpdateEncoderV2()) => {\n const targetStateVector = decodeStateVector(encodedTargetStateVector)\n writeStateAsUpdate(encoder, doc, targetStateVector)\n const updates = [encoder.toUint8Array()]\n // also add the pending updates (if there are any)\n if (doc.store.pendingDs) {\n updates.push(doc.store.pendingDs)\n }\n if (doc.store.pendingStructs) {\n updates.push(diffUpdateV2(doc.store.pendingStructs.update, encodedTargetStateVector))\n }\n if (updates.length > 1) {\n if (encoder.constructor === UpdateEncoderV1) {\n return mergeUpdates(updates.map((update, i) => i === 0 ? update : convertUpdateFormatV2ToV1(update)))\n } else if (encoder.constructor === UpdateEncoderV2) {\n return mergeUpdatesV2(updates)\n }\n }\n return updates[0]\n}\n\n/**\n * Write all the document as a single update message that can be applied on the remote document. If you specify the state of the remote client (`targetState`) it will\n * only write the operations that are missing.\n *\n * Use `writeStateAsUpdate` instead if you are working with lib0/encoding.js#Encoder\n *\n * @param {Doc} doc\n * @param {Uint8Array} [encodedTargetStateVector] The state of the target that receives the update. Leave empty to write all known structs\n * @return {Uint8Array}\n *\n * @function\n */\nexport const encodeStateAsUpdate = (doc, encodedTargetStateVector) => encodeStateAsUpdateV2(doc, encodedTargetStateVector, new UpdateEncoderV1())\n\n/**\n * Read state vector from Decoder and return as Map\n *\n * @param {DSDecoderV1 | DSDecoderV2} decoder\n * @return {Map} Maps `client` to the number next expected `clock` from that client.\n *\n * @function\n */\nexport const readStateVector = decoder => {\n const ss = new Map()\n const ssLength = decoding.readVarUint(decoder.restDecoder)\n for (let i = 0; i < ssLength; i++) {\n const client = decoding.readVarUint(decoder.restDecoder)\n const clock = decoding.readVarUint(decoder.restDecoder)\n ss.set(client, clock)\n }\n return ss\n}\n\n/**\n * Read decodedState and return State as Map.\n *\n * @param {Uint8Array} decodedState\n * @return {Map} Maps `client` to the number next expected `clock` from that client.\n *\n * @function\n */\n// export const decodeStateVectorV2 = decodedState => readStateVector(new DSDecoderV2(decoding.createDecoder(decodedState)))\n\n/**\n * Read decodedState and return State as Map.\n *\n * @param {Uint8Array} decodedState\n * @return {Map} Maps `client` to the number next expected `clock` from that client.\n *\n * @function\n */\nexport const decodeStateVector = decodedState => readStateVector(new DSDecoderV1(decoding.createDecoder(decodedState)))\n\n/**\n * @param {DSEncoderV1 | DSEncoderV2} encoder\n * @param {Map} sv\n * @function\n */\nexport const writeStateVector = (encoder, sv) => {\n encoding.writeVarUint(encoder.restEncoder, sv.size)\n array.from(sv.entries()).sort((a, b) => b[0] - a[0]).forEach(([client, clock]) => {\n encoding.writeVarUint(encoder.restEncoder, client) // @todo use a special client decoder that is based on mapping\n encoding.writeVarUint(encoder.restEncoder, clock)\n })\n return encoder\n}\n\n/**\n * @param {DSEncoderV1 | DSEncoderV2} encoder\n * @param {Doc} doc\n *\n * @function\n */\nexport const writeDocumentStateVector = (encoder, doc) => writeStateVector(encoder, getStateVector(doc.store))\n\n/**\n * Encode State as Uint8Array.\n *\n * @param {Doc|Map} doc\n * @param {DSEncoderV1 | DSEncoderV2} [encoder]\n * @return {Uint8Array}\n *\n * @function\n */\nexport const encodeStateVectorV2 = (doc, encoder = new DSEncoderV2()) => {\n if (doc instanceof Map) {\n writeStateVector(encoder, doc)\n } else {\n writeDocumentStateVector(encoder, doc)\n }\n return encoder.toUint8Array()\n}\n\n/**\n * Encode State as Uint8Array.\n *\n * @param {Doc|Map} doc\n * @return {Uint8Array}\n *\n * @function\n */\nexport const encodeStateVector = doc => encodeStateVectorV2(doc, new DSEncoderV1())\n","import * as f from 'lib0/function'\n\n/**\n * General event handler implementation.\n *\n * @template ARG0, ARG1\n *\n * @private\n */\nexport class EventHandler {\n constructor () {\n /**\n * @type {Array}\n */\n this.l = []\n }\n}\n\n/**\n * @template ARG0,ARG1\n * @returns {EventHandler}\n *\n * @private\n * @function\n */\nexport const createEventHandler = () => new EventHandler()\n\n/**\n * Adds an event listener that is called when\n * {@link EventHandler#callEventListeners} is called.\n *\n * @template ARG0,ARG1\n * @param {EventHandler} eventHandler\n * @param {function(ARG0,ARG1):void} f The event handler.\n *\n * @private\n * @function\n */\nexport const addEventHandlerListener = (eventHandler, f) =>\n eventHandler.l.push(f)\n\n/**\n * Removes an event listener.\n *\n * @template ARG0,ARG1\n * @param {EventHandler} eventHandler\n * @param {function(ARG0,ARG1):void} f The event handler that was added with\n * {@link EventHandler#addEventListener}\n *\n * @private\n * @function\n */\nexport const removeEventHandlerListener = (eventHandler, f) => {\n const l = eventHandler.l\n const len = l.length\n eventHandler.l = l.filter(g => f !== g)\n if (len === eventHandler.l.length) {\n console.error('[yjs] Tried to remove event handler that doesn\\'t exist.')\n }\n}\n\n/**\n * Removes all event listeners.\n * @template ARG0,ARG1\n * @param {EventHandler} eventHandler\n *\n * @private\n * @function\n */\nexport const removeAllEventHandlerListeners = eventHandler => {\n eventHandler.l.length = 0\n}\n\n/**\n * Call all event listeners that were added via\n * {@link EventHandler#addEventListener}.\n *\n * @template ARG0,ARG1\n * @param {EventHandler} eventHandler\n * @param {ARG0} arg0\n * @param {ARG1} arg1\n *\n * @private\n * @function\n */\nexport const callEventHandlerListeners = (eventHandler, arg0, arg1) =>\n f.callAll(eventHandler.l, [arg0, arg1])\n","import { AbstractType } from '../internals.js' // eslint-disable-line\n\nimport * as decoding from 'lib0/decoding'\nimport * as encoding from 'lib0/encoding'\nimport * as error from 'lib0/error'\n\nexport class ID {\n /**\n * @param {number} client client id\n * @param {number} clock unique per client id, continuous number\n */\n constructor (client, clock) {\n /**\n * Client id\n * @type {number}\n */\n this.client = client\n /**\n * unique per client id, continuous number\n * @type {number}\n */\n this.clock = clock\n }\n}\n\n/**\n * @param {ID | null} a\n * @param {ID | null} b\n * @return {boolean}\n *\n * @function\n */\nexport const compareIDs = (a, b) => a === b || (a !== null && b !== null && a.client === b.client && a.clock === b.clock)\n\n/**\n * @param {number} client\n * @param {number} clock\n *\n * @private\n * @function\n */\nexport const createID = (client, clock) => new ID(client, clock)\n\n/**\n * @param {encoding.Encoder} encoder\n * @param {ID} id\n *\n * @private\n * @function\n */\nexport const writeID = (encoder, id) => {\n encoding.writeVarUint(encoder, id.client)\n encoding.writeVarUint(encoder, id.clock)\n}\n\n/**\n * Read ID.\n * * If first varUint read is 0xFFFFFF a RootID is returned.\n * * Otherwise an ID is returned\n *\n * @param {decoding.Decoder} decoder\n * @return {ID}\n *\n * @private\n * @function\n */\nexport const readID = decoder =>\n createID(decoding.readVarUint(decoder), decoding.readVarUint(decoder))\n\n/**\n * The top types are mapped from y.share.get(keyname) => type.\n * `type` does not store any information about the `keyname`.\n * This function finds the correct `keyname` for `type` and throws otherwise.\n *\n * @param {AbstractType} type\n * @return {string}\n *\n * @private\n * @function\n */\nexport const findRootTypeKey = type => {\n // @ts-ignore _y must be defined, otherwise unexpected case\n for (const [key, value] of type.doc.share.entries()) {\n if (value === type) {\n return key\n }\n }\n throw error.unexpectedCase()\n}\n","import { AbstractType, Item } from '../internals.js' // eslint-disable-line\n\n/**\n * Check if `parent` is a parent of `child`.\n *\n * @param {AbstractType} parent\n * @param {Item|null} child\n * @return {Boolean} Whether `parent` is a parent of `child`.\n *\n * @private\n * @function\n */\nexport const isParentOf = (parent, child) => {\n while (child !== null) {\n if (child.parent === parent) {\n return true\n }\n child = /** @type {AbstractType} */ (child.parent)._item\n }\n return false\n}\n","import {\n AbstractType // eslint-disable-line\n} from '../internals.js'\n\n/**\n * Convenient helper to log type information.\n *\n * Do not use in productive systems as the output can be immense!\n *\n * @param {AbstractType} type\n */\nexport const logType = type => {\n const res = []\n let n = type._start\n while (n) {\n res.push(n)\n n = n.right\n }\n console.log('Children: ', res)\n console.log('Children content: ', res.filter(m => !m.deleted).map(m => m.content))\n}\n","import {\n YArray,\n YMap,\n readDeleteSet,\n writeDeleteSet,\n createDeleteSet,\n DSEncoderV1, DSDecoderV1, ID, DeleteSet, YArrayEvent, Transaction, Doc // eslint-disable-line\n} from '../internals.js'\n\nimport * as decoding from 'lib0/decoding'\n\nimport { mergeDeleteSets, isDeleted } from './DeleteSet.js'\n\nexport class PermanentUserData {\n /**\n * @param {Doc} doc\n * @param {YMap} [storeType]\n */\n constructor (doc, storeType = doc.getMap('users')) {\n /**\n * @type {Map}\n */\n const dss = new Map()\n this.yusers = storeType\n this.doc = doc\n /**\n * Maps from clientid to userDescription\n *\n * @type {Map}\n */\n this.clients = new Map()\n this.dss = dss\n /**\n * @param {YMap} user\n * @param {string} userDescription\n */\n const initUser = (user, userDescription) => {\n /**\n * @type {YArray}\n */\n const ds = user.get('ds')\n const ids = user.get('ids')\n const addClientId = /** @param {number} clientid */ clientid => this.clients.set(clientid, userDescription)\n ds.observe(/** @param {YArrayEvent} event */ event => {\n event.changes.added.forEach(item => {\n item.content.getContent().forEach(encodedDs => {\n if (encodedDs instanceof Uint8Array) {\n this.dss.set(userDescription, mergeDeleteSets([this.dss.get(userDescription) || createDeleteSet(), readDeleteSet(new DSDecoderV1(decoding.createDecoder(encodedDs)))]))\n }\n })\n })\n })\n this.dss.set(userDescription, mergeDeleteSets(ds.map(encodedDs => readDeleteSet(new DSDecoderV1(decoding.createDecoder(encodedDs))))))\n ids.observe(/** @param {YArrayEvent} event */ event =>\n event.changes.added.forEach(item => item.content.getContent().forEach(addClientId))\n )\n ids.forEach(addClientId)\n }\n // observe users\n storeType.observe(event => {\n event.keysChanged.forEach(userDescription =>\n initUser(storeType.get(userDescription), userDescription)\n )\n })\n // add initial data\n storeType.forEach(initUser)\n }\n\n /**\n * @param {Doc} doc\n * @param {number} clientid\n * @param {string} userDescription\n * @param {Object} conf\n * @param {function(Transaction, DeleteSet):boolean} [conf.filter]\n */\n setUserMapping (doc, clientid, userDescription, { filter = () => true } = {}) {\n const users = this.yusers\n let user = users.get(userDescription)\n if (!user) {\n user = new YMap()\n user.set('ids', new YArray())\n user.set('ds', new YArray())\n users.set(userDescription, user)\n }\n user.get('ids').push([clientid])\n users.observe(_event => {\n setTimeout(() => {\n const userOverwrite = users.get(userDescription)\n if (userOverwrite !== user) {\n // user was overwritten, port all data over to the next user object\n // @todo Experiment with Y.Sets here\n user = userOverwrite\n // @todo iterate over old type\n this.clients.forEach((_userDescription, clientid) => {\n if (userDescription === _userDescription) {\n user.get('ids').push([clientid])\n }\n })\n const encoder = new DSEncoderV1()\n const ds = this.dss.get(userDescription)\n if (ds) {\n writeDeleteSet(encoder, ds)\n user.get('ds').push([encoder.toUint8Array()])\n }\n }\n }, 0)\n })\n doc.on('afterTransaction', /** @param {Transaction} transaction */ transaction => {\n setTimeout(() => {\n const yds = user.get('ds')\n const ds = transaction.deleteSet\n if (transaction.local && ds.clients.size > 0 && filter(transaction, ds)) {\n const encoder = new DSEncoderV1()\n writeDeleteSet(encoder, ds)\n yds.push([encoder.toUint8Array()])\n }\n })\n })\n }\n\n /**\n * @param {number} clientid\n * @return {any}\n */\n getUserByClientId (clientid) {\n return this.clients.get(clientid) || null\n }\n\n /**\n * @param {ID} id\n * @return {string | null}\n */\n getUserByDeletedId (id) {\n for (const [userDescription, ds] of this.dss.entries()) {\n if (isDeleted(ds, id)) {\n return userDescription\n }\n }\n return null\n }\n}\n","import {\n writeID,\n readID,\n compareIDs,\n getState,\n findRootTypeKey,\n Item,\n createID,\n ContentType,\n followRedone,\n getItem,\n StructStore, ID, Doc, AbstractType, // eslint-disable-line\n} from '../internals.js'\n\nimport * as encoding from 'lib0/encoding'\nimport * as decoding from 'lib0/decoding'\nimport * as error from 'lib0/error'\n\n/**\n * A relative position is based on the Yjs model and is not affected by document changes.\n * E.g. If you place a relative position before a certain character, it will always point to this character.\n * If you place a relative position at the end of a type, it will always point to the end of the type.\n *\n * A numeric position is often unsuited for user selections, because it does not change when content is inserted\n * before or after.\n *\n * ```Insert(0, 'x')('a|bc') = 'xa|bc'``` Where | is the relative position.\n *\n * One of the properties must be defined.\n *\n * @example\n * // Current cursor position is at position 10\n * const relativePosition = createRelativePositionFromIndex(yText, 10)\n * // modify yText\n * yText.insert(0, 'abc')\n * yText.delete(3, 10)\n * // Compute the cursor position\n * const absolutePosition = createAbsolutePositionFromRelativePosition(y, relativePosition)\n * absolutePosition.type === yText // => true\n * console.log('cursor location is ' + absolutePosition.index) // => cursor location is 3\n *\n */\nexport class RelativePosition {\n /**\n * @param {ID|null} type\n * @param {string|null} tname\n * @param {ID|null} item\n * @param {number} assoc\n */\n constructor (type, tname, item, assoc = 0) {\n /**\n * @type {ID|null}\n */\n this.type = type\n /**\n * @type {string|null}\n */\n this.tname = tname\n /**\n * @type {ID | null}\n */\n this.item = item\n /**\n * A relative position is associated to a specific character. By default\n * assoc >= 0, the relative position is associated to the character\n * after the meant position.\n * I.e. position 1 in 'ab' is associated to character 'b'.\n *\n * If assoc < 0, then the relative position is associated to the character\n * before the meant position.\n *\n * @type {number}\n */\n this.assoc = assoc\n }\n}\n\n/**\n * @param {RelativePosition} rpos\n * @return {any}\n */\nexport const relativePositionToJSON = rpos => {\n const json = {}\n if (rpos.type) {\n json.type = rpos.type\n }\n if (rpos.tname) {\n json.tname = rpos.tname\n }\n if (rpos.item) {\n json.item = rpos.item\n }\n if (rpos.assoc != null) {\n json.assoc = rpos.assoc\n }\n return json\n}\n\n/**\n * @param {any} json\n * @return {RelativePosition}\n *\n * @function\n */\nexport const createRelativePositionFromJSON = json => new RelativePosition(json.type == null ? null : createID(json.type.client, json.type.clock), json.tname ?? null, json.item == null ? null : createID(json.item.client, json.item.clock), json.assoc == null ? 0 : json.assoc)\n\nexport class AbsolutePosition {\n /**\n * @param {AbstractType} type\n * @param {number} index\n * @param {number} [assoc]\n */\n constructor (type, index, assoc = 0) {\n /**\n * @type {AbstractType}\n */\n this.type = type\n /**\n * @type {number}\n */\n this.index = index\n this.assoc = assoc\n }\n}\n\n/**\n * @param {AbstractType} type\n * @param {number} index\n * @param {number} [assoc]\n *\n * @function\n */\nexport const createAbsolutePosition = (type, index, assoc = 0) => new AbsolutePosition(type, index, assoc)\n\n/**\n * @param {AbstractType} type\n * @param {ID|null} item\n * @param {number} [assoc]\n *\n * @function\n */\nexport const createRelativePosition = (type, item, assoc) => {\n let typeid = null\n let tname = null\n if (type._item === null) {\n tname = findRootTypeKey(type)\n } else {\n typeid = createID(type._item.id.client, type._item.id.clock)\n }\n return new RelativePosition(typeid, tname, item, assoc)\n}\n\n/**\n * Create a relativePosition based on a absolute position.\n *\n * @param {AbstractType} type The base type (e.g. YText or YArray).\n * @param {number} index The absolute position.\n * @param {number} [assoc]\n * @return {RelativePosition}\n *\n * @function\n */\nexport const createRelativePositionFromTypeIndex = (type, index, assoc = 0) => {\n let t = type._start\n if (assoc < 0) {\n // associated to the left character or the beginning of a type, increment index if possible.\n if (index === 0) {\n return createRelativePosition(type, null, assoc)\n }\n index--\n }\n while (t !== null) {\n if (!t.deleted && t.countable) {\n if (t.length > index) {\n // case 1: found position somewhere in the linked list\n return createRelativePosition(type, createID(t.id.client, t.id.clock + index), assoc)\n }\n index -= t.length\n }\n if (t.right === null && assoc < 0) {\n // left-associated position, return last available id\n return createRelativePosition(type, t.lastId, assoc)\n }\n t = t.right\n }\n return createRelativePosition(type, null, assoc)\n}\n\n/**\n * @param {encoding.Encoder} encoder\n * @param {RelativePosition} rpos\n *\n * @function\n */\nexport const writeRelativePosition = (encoder, rpos) => {\n const { type, tname, item, assoc } = rpos\n if (item !== null) {\n encoding.writeVarUint(encoder, 0)\n writeID(encoder, item)\n } else if (tname !== null) {\n // case 2: found position at the end of the list and type is stored in y.share\n encoding.writeUint8(encoder, 1)\n encoding.writeVarString(encoder, tname)\n } else if (type !== null) {\n // case 3: found position at the end of the list and type is attached to an item\n encoding.writeUint8(encoder, 2)\n writeID(encoder, type)\n } else {\n throw error.unexpectedCase()\n }\n encoding.writeVarInt(encoder, assoc)\n return encoder\n}\n\n/**\n * @param {RelativePosition} rpos\n * @return {Uint8Array}\n */\nexport const encodeRelativePosition = rpos => {\n const encoder = encoding.createEncoder()\n writeRelativePosition(encoder, rpos)\n return encoding.toUint8Array(encoder)\n}\n\n/**\n * @param {decoding.Decoder} decoder\n * @return {RelativePosition}\n *\n * @function\n */\nexport const readRelativePosition = decoder => {\n let type = null\n let tname = null\n let itemID = null\n switch (decoding.readVarUint(decoder)) {\n case 0:\n // case 1: found position somewhere in the linked list\n itemID = readID(decoder)\n break\n case 1:\n // case 2: found position at the end of the list and type is stored in y.share\n tname = decoding.readVarString(decoder)\n break\n case 2: {\n // case 3: found position at the end of the list and type is attached to an item\n type = readID(decoder)\n }\n }\n const assoc = decoding.hasContent(decoder) ? decoding.readVarInt(decoder) : 0\n return new RelativePosition(type, tname, itemID, assoc)\n}\n\n/**\n * @param {Uint8Array} uint8Array\n * @return {RelativePosition}\n */\nexport const decodeRelativePosition = uint8Array => readRelativePosition(decoding.createDecoder(uint8Array))\n\n/**\n * @param {StructStore} store\n * @param {ID} id\n */\nconst getItemWithOffset = (store, id) => {\n const item = getItem(store, id)\n const diff = id.clock - item.id.clock\n return {\n item, diff\n }\n}\n\n/**\n * Transform a relative position to an absolute position.\n *\n * If you want to share the relative position with other users, you should set\n * `followUndoneDeletions` to false to get consistent results across all clients.\n *\n * When calculating the absolute position, we try to follow the \"undone deletions\". This yields\n * better results for the user who performed undo. However, only the user who performed the undo\n * will get the better results, the other users don't know which operations recreated a deleted\n * range of content. There is more information in this ticket: https://github.com/yjs/yjs/issues/638\n *\n * @param {RelativePosition} rpos\n * @param {Doc} doc\n * @param {boolean} followUndoneDeletions - whether to follow undone deletions - see https://github.com/yjs/yjs/issues/638\n * @return {AbsolutePosition|null}\n *\n * @function\n */\nexport const createAbsolutePositionFromRelativePosition = (rpos, doc, followUndoneDeletions = true) => {\n const store = doc.store\n const rightID = rpos.item\n const typeID = rpos.type\n const tname = rpos.tname\n const assoc = rpos.assoc\n let type = null\n let index = 0\n if (rightID !== null) {\n if (getState(store, rightID.client) <= rightID.clock) {\n return null\n }\n const res = followUndoneDeletions ? followRedone(store, rightID) : getItemWithOffset(store, rightID)\n const right = res.item\n if (!(right instanceof Item)) {\n return null\n }\n type = /** @type {AbstractType} */ (right.parent)\n if (type._item === null || !type._item.deleted) {\n index = (right.deleted || !right.countable) ? 0 : (res.diff + (assoc >= 0 ? 0 : 1)) // adjust position based on left association if necessary\n let n = right.left\n while (n !== null) {\n if (!n.deleted && n.countable) {\n index += n.length\n }\n n = n.left\n }\n }\n } else {\n if (tname !== null) {\n type = doc.get(tname)\n } else if (typeID !== null) {\n if (getState(store, typeID.client) <= typeID.clock) {\n // type does not exist yet\n return null\n }\n const { item } = followUndoneDeletions ? followRedone(store, typeID) : { item: getItem(store, typeID) }\n if (item instanceof Item && item.content instanceof ContentType) {\n type = item.content.type\n } else {\n // struct is garbage collected\n return null\n }\n } else {\n throw error.unexpectedCase()\n }\n if (assoc >= 0) {\n index = type._length\n } else {\n index = 0\n }\n }\n return createAbsolutePosition(type, index, rpos.assoc)\n}\n\n/**\n * @param {RelativePosition|null} a\n * @param {RelativePosition|null} b\n * @return {boolean}\n *\n * @function\n */\nexport const compareRelativePositions = (a, b) => a === b || (\n a !== null && b !== null && a.tname === b.tname && compareIDs(a.item, b.item) && compareIDs(a.type, b.type) && a.assoc === b.assoc\n)\n","import {\n isDeleted,\n createDeleteSetFromStructStore,\n getStateVector,\n getItemCleanStart,\n iterateDeletedStructs,\n writeDeleteSet,\n writeStateVector,\n readDeleteSet,\n readStateVector,\n createDeleteSet,\n createID,\n getState,\n findIndexSS,\n UpdateEncoderV2,\n applyUpdateV2,\n LazyStructReader,\n equalDeleteSets,\n UpdateDecoderV1, UpdateDecoderV2, DSEncoderV1, DSEncoderV2, DSDecoderV1, DSDecoderV2, Transaction, Doc, DeleteSet, Item, // eslint-disable-line\n mergeDeleteSets\n} from '../internals.js'\n\nimport * as map from 'lib0/map'\nimport * as set from 'lib0/set'\nimport * as decoding from 'lib0/decoding'\nimport * as encoding from 'lib0/encoding'\n\nexport class Snapshot {\n /**\n * @param {DeleteSet} ds\n * @param {Map} sv state map\n */\n constructor (ds, sv) {\n /**\n * @type {DeleteSet}\n */\n this.ds = ds\n /**\n * State Map\n * @type {Map}\n */\n this.sv = sv\n }\n}\n\n/**\n * @param {Snapshot} snap1\n * @param {Snapshot} snap2\n * @return {boolean}\n */\nexport const equalSnapshots = (snap1, snap2) => {\n const ds1 = snap1.ds.clients\n const ds2 = snap2.ds.clients\n const sv1 = snap1.sv\n const sv2 = snap2.sv\n if (sv1.size !== sv2.size || ds1.size !== ds2.size) {\n return false\n }\n for (const [key, value] of sv1.entries()) {\n if (sv2.get(key) !== value) {\n return false\n }\n }\n for (const [client, dsitems1] of ds1.entries()) {\n const dsitems2 = ds2.get(client) || []\n if (dsitems1.length !== dsitems2.length) {\n return false\n }\n for (let i = 0; i < dsitems1.length; i++) {\n const dsitem1 = dsitems1[i]\n const dsitem2 = dsitems2[i]\n if (dsitem1.clock !== dsitem2.clock || dsitem1.len !== dsitem2.len) {\n return false\n }\n }\n }\n return true\n}\n\n/**\n * @param {Snapshot} snapshot\n * @param {DSEncoderV1 | DSEncoderV2} [encoder]\n * @return {Uint8Array}\n */\nexport const encodeSnapshotV2 = (snapshot, encoder = new DSEncoderV2()) => {\n writeDeleteSet(encoder, snapshot.ds)\n writeStateVector(encoder, snapshot.sv)\n return encoder.toUint8Array()\n}\n\n/**\n * @param {Snapshot} snapshot\n * @return {Uint8Array}\n */\nexport const encodeSnapshot = snapshot => encodeSnapshotV2(snapshot, new DSEncoderV1())\n\n/**\n * @param {Uint8Array} buf\n * @param {DSDecoderV1 | DSDecoderV2} [decoder]\n * @return {Snapshot}\n */\nexport const decodeSnapshotV2 = (buf, decoder = new DSDecoderV2(decoding.createDecoder(buf))) => {\n return new Snapshot(readDeleteSet(decoder), readStateVector(decoder))\n}\n\n/**\n * @param {Uint8Array} buf\n * @return {Snapshot}\n */\nexport const decodeSnapshot = buf => decodeSnapshotV2(buf, new DSDecoderV1(decoding.createDecoder(buf)))\n\n/**\n * @param {DeleteSet} ds\n * @param {Map} sm\n * @return {Snapshot}\n */\nexport const createSnapshot = (ds, sm) => new Snapshot(ds, sm)\n\nexport const emptySnapshot = createSnapshot(createDeleteSet(), new Map())\n\n/**\n * @param {Doc} doc\n * @return {Snapshot}\n */\nexport const snapshot = doc => createSnapshot(createDeleteSetFromStructStore(doc.store), getStateVector(doc.store))\n\n/**\n * @param {Item} item\n * @param {Snapshot|undefined} snapshot\n *\n * @protected\n * @function\n */\nexport const isVisible = (item, snapshot) => snapshot === undefined\n ? !item.deleted\n : snapshot.sv.has(item.id.client) && (snapshot.sv.get(item.id.client) || 0) > item.id.clock && !isDeleted(snapshot.ds, item.id)\n\n/**\n * @param {Transaction} transaction\n * @param {Snapshot} snapshot\n */\nexport const splitSnapshotAffectedStructs = (transaction, snapshot) => {\n const meta = map.setIfUndefined(transaction.meta, splitSnapshotAffectedStructs, set.create)\n const store = transaction.doc.store\n // check if we already split for this snapshot\n if (!meta.has(snapshot)) {\n snapshot.sv.forEach((clock, client) => {\n if (clock < getState(store, client)) {\n getItemCleanStart(transaction, createID(client, clock))\n }\n })\n iterateDeletedStructs(transaction, snapshot.ds, _item => {})\n meta.add(snapshot)\n }\n}\n\n/**\n * @example\n * const ydoc = new Y.Doc({ gc: false })\n * ydoc.getText().insert(0, 'world!')\n * const snapshot = Y.snapshot(ydoc)\n * ydoc.getText().insert(0, 'hello ')\n * const restored = Y.createDocFromSnapshot(ydoc, snapshot)\n * assert(restored.getText().toString() === 'world!')\n *\n * @param {Doc} originDoc\n * @param {Snapshot} snapshot\n * @param {Doc} [newDoc] Optionally, you may define the Yjs document that receives the data from originDoc\n * @return {Doc}\n */\nexport const createDocFromSnapshot = (originDoc, snapshot, newDoc = new Doc()) => {\n if (originDoc.gc) {\n // we should not try to restore a GC-ed document, because some of the restored items might have their content deleted\n throw new Error('Garbage-collection must be disabled in `originDoc`!')\n }\n const { sv, ds } = snapshot\n\n const encoder = new UpdateEncoderV2()\n originDoc.transact(transaction => {\n let size = 0\n sv.forEach(clock => {\n if (clock > 0) {\n size++\n }\n })\n encoding.writeVarUint(encoder.restEncoder, size)\n // splitting the structs before writing them to the encoder\n for (const [client, clock] of sv) {\n if (clock === 0) {\n continue\n }\n if (clock < getState(originDoc.store, client)) {\n getItemCleanStart(transaction, createID(client, clock))\n }\n const structs = originDoc.store.clients.get(client) || []\n const lastStructIndex = findIndexSS(structs, clock - 1)\n // write # encoded structs\n encoding.writeVarUint(encoder.restEncoder, lastStructIndex + 1)\n encoder.writeClient(client)\n // first clock written is 0\n encoding.writeVarUint(encoder.restEncoder, 0)\n for (let i = 0; i <= lastStructIndex; i++) {\n structs[i].write(encoder, 0)\n }\n }\n writeDeleteSet(encoder, ds)\n })\n\n applyUpdateV2(newDoc, encoder.toUint8Array(), 'snapshot')\n return newDoc\n}\n\n/**\n * @param {Snapshot} snapshot\n * @param {Uint8Array} update\n * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder]\n */\nexport const snapshotContainsUpdateV2 = (snapshot, update, YDecoder = UpdateDecoderV2) => {\n const structs = []\n const updateDecoder = new YDecoder(decoding.createDecoder(update))\n const lazyDecoder = new LazyStructReader(updateDecoder, false)\n for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) {\n structs.push(curr)\n if ((snapshot.sv.get(curr.id.client) || 0) < curr.id.clock + curr.length) {\n return false\n }\n }\n const mergedDS = mergeDeleteSets([snapshot.ds, readDeleteSet(updateDecoder)])\n return equalDeleteSets(snapshot.ds, mergedDS)\n}\n\n/**\n * @param {Snapshot} snapshot\n * @param {Uint8Array} update\n */\nexport const snapshotContainsUpdate = (snapshot, update) => snapshotContainsUpdateV2(snapshot, update, UpdateDecoderV1)\n","import {\n GC,\n splitItem,\n Transaction, ID, Item, DSDecoderV2 // eslint-disable-line\n} from '../internals.js'\n\nimport * as math from 'lib0/math'\nimport * as error from 'lib0/error'\n\nexport class StructStore {\n constructor () {\n /**\n * @type {Map>}\n */\n this.clients = new Map()\n /**\n * @type {null | { missing: Map, update: Uint8Array }}\n */\n this.pendingStructs = null\n /**\n * @type {null | Uint8Array}\n */\n this.pendingDs = null\n }\n}\n\n/**\n * Return the states as a Map.\n * Note that clock refers to the next expected clock id.\n *\n * @param {StructStore} store\n * @return {Map}\n *\n * @public\n * @function\n */\nexport const getStateVector = store => {\n const sm = new Map()\n store.clients.forEach((structs, client) => {\n const struct = structs[structs.length - 1]\n sm.set(client, struct.id.clock + struct.length)\n })\n return sm\n}\n\n/**\n * @param {StructStore} store\n * @param {number} client\n * @return {number}\n *\n * @public\n * @function\n */\nexport const getState = (store, client) => {\n const structs = store.clients.get(client)\n if (structs === undefined) {\n return 0\n }\n const lastStruct = structs[structs.length - 1]\n return lastStruct.id.clock + lastStruct.length\n}\n\n/**\n * @param {StructStore} store\n *\n * @private\n * @function\n */\nexport const integrityCheck = store => {\n store.clients.forEach(structs => {\n for (let i = 1; i < structs.length; i++) {\n const l = structs[i - 1]\n const r = structs[i]\n if (l.id.clock + l.length !== r.id.clock) {\n throw new Error('StructStore failed integrity check')\n }\n }\n })\n}\n\n/**\n * @param {StructStore} store\n * @param {GC|Item} struct\n *\n * @private\n * @function\n */\nexport const addStruct = (store, struct) => {\n let structs = store.clients.get(struct.id.client)\n if (structs === undefined) {\n structs = []\n store.clients.set(struct.id.client, structs)\n } else {\n const lastStruct = structs[structs.length - 1]\n if (lastStruct.id.clock + lastStruct.length !== struct.id.clock) {\n throw error.unexpectedCase()\n }\n }\n structs.push(struct)\n}\n\n/**\n * Perform a binary search on a sorted array\n * @param {Array} structs\n * @param {number} clock\n * @return {number}\n *\n * @private\n * @function\n */\nexport const findIndexSS = (structs, clock) => {\n let left = 0\n let right = structs.length - 1\n let mid = structs[right]\n let midclock = mid.id.clock\n if (midclock === clock) {\n return right\n }\n // @todo does it even make sense to pivot the search?\n // If a good split misses, it might actually increase the time to find the correct item.\n // Currently, the only advantage is that search with pivoting might find the item on the first try.\n let midindex = math.floor((clock / (midclock + mid.length - 1)) * right) // pivoting the search\n while (left <= right) {\n mid = structs[midindex]\n midclock = mid.id.clock\n if (midclock <= clock) {\n if (clock < midclock + mid.length) {\n return midindex\n }\n left = midindex + 1\n } else {\n right = midindex - 1\n }\n midindex = math.floor((left + right) / 2)\n }\n // Always check state before looking for a struct in StructStore\n // Therefore the case of not finding a struct is unexpected\n throw error.unexpectedCase()\n}\n\n/**\n * Expects that id is actually in store. This function throws or is an infinite loop otherwise.\n *\n * @param {StructStore} store\n * @param {ID} id\n * @return {GC|Item}\n *\n * @private\n * @function\n */\nexport const find = (store, id) => {\n /**\n * @type {Array}\n */\n // @ts-ignore\n const structs = store.clients.get(id.client)\n return structs[findIndexSS(structs, id.clock)]\n}\n\n/**\n * Expects that id is actually in store. This function throws or is an infinite loop otherwise.\n * @private\n * @function\n */\nexport const getItem = /** @type {function(StructStore,ID):Item} */ (find)\n\n/**\n * @param {Transaction} transaction\n * @param {Array} structs\n * @param {number} clock\n */\nexport const findIndexCleanStart = (transaction, structs, clock) => {\n const index = findIndexSS(structs, clock)\n const struct = structs[index]\n if (struct.id.clock < clock && struct instanceof Item) {\n structs.splice(index + 1, 0, splitItem(transaction, struct, clock - struct.id.clock))\n return index + 1\n }\n return index\n}\n\n/**\n * Expects that id is actually in store. This function throws or is an infinite loop otherwise.\n *\n * @param {Transaction} transaction\n * @param {ID} id\n * @return {Item}\n *\n * @private\n * @function\n */\nexport const getItemCleanStart = (transaction, id) => {\n const structs = /** @type {Array} */ (transaction.doc.store.clients.get(id.client))\n return structs[findIndexCleanStart(transaction, structs, id.clock)]\n}\n\n/**\n * Expects that id is actually in store. This function throws or is an infinite loop otherwise.\n *\n * @param {Transaction} transaction\n * @param {StructStore} store\n * @param {ID} id\n * @return {Item}\n *\n * @private\n * @function\n */\nexport const getItemCleanEnd = (transaction, store, id) => {\n /**\n * @type {Array}\n */\n // @ts-ignore\n const structs = store.clients.get(id.client)\n const index = findIndexSS(structs, id.clock)\n const struct = structs[index]\n if (id.clock !== struct.id.clock + struct.length - 1 && struct.constructor !== GC) {\n structs.splice(index + 1, 0, splitItem(transaction, struct, id.clock - struct.id.clock + 1))\n }\n return struct\n}\n\n/**\n * Replace `item` with `newitem` in store\n * @param {StructStore} store\n * @param {GC|Item} struct\n * @param {GC|Item} newStruct\n *\n * @private\n * @function\n */\nexport const replaceStruct = (store, struct, newStruct) => {\n const structs = /** @type {Array} */ (store.clients.get(struct.id.client))\n structs[findIndexSS(structs, struct.id.clock)] = newStruct\n}\n\n/**\n * Iterate over a range of structs\n *\n * @param {Transaction} transaction\n * @param {Array} structs\n * @param {number} clockStart Inclusive start\n * @param {number} len\n * @param {function(GC|Item):void} f\n *\n * @function\n */\nexport const iterateStructs = (transaction, structs, clockStart, len, f) => {\n if (len === 0) {\n return\n }\n const clockEnd = clockStart + len\n let index = findIndexCleanStart(transaction, structs, clockStart)\n let struct\n do {\n struct = structs[index++]\n if (clockEnd < struct.id.clock + struct.length) {\n findIndexCleanStart(transaction, structs, clockEnd)\n }\n f(struct)\n } while (index < structs.length && structs[index].id.clock < clockEnd)\n}\n","import {\n getState,\n writeStructsFromTransaction,\n writeDeleteSet,\n DeleteSet,\n sortAndMergeDeleteSet,\n getStateVector,\n findIndexSS,\n callEventHandlerListeners,\n Item,\n generateNewClientId,\n createID,\n cleanupYTextAfterTransaction,\n UpdateEncoderV1, UpdateEncoderV2, GC, StructStore, AbstractType, AbstractStruct, YEvent, Doc // eslint-disable-line\n} from '../internals.js'\n\nimport * as map from 'lib0/map'\nimport * as math from 'lib0/math'\nimport * as set from 'lib0/set'\nimport * as logging from 'lib0/logging'\nimport { callAll } from 'lib0/function'\n\n/**\n * A transaction is created for every change on the Yjs model. It is possible\n * to bundle changes on the Yjs model in a single transaction to\n * minimize the number on messages sent and the number of observer calls.\n * If possible the user of this library should bundle as many changes as\n * possible. Here is an example to illustrate the advantages of bundling:\n *\n * @example\n * const ydoc = new Y.Doc()\n * const map = ydoc.getMap('map')\n * // Log content when change is triggered\n * map.observe(() => {\n * console.log('change triggered')\n * })\n * // Each change on the map type triggers a log message:\n * map.set('a', 0) // => \"change triggered\"\n * map.set('b', 0) // => \"change triggered\"\n * // When put in a transaction, it will trigger the log after the transaction:\n * ydoc.transact(() => {\n * map.set('a', 1)\n * map.set('b', 1)\n * }) // => \"change triggered\"\n *\n * @public\n */\nexport class Transaction {\n /**\n * @param {Doc} doc\n * @param {any} origin\n * @param {boolean} local\n */\n constructor (doc, origin, local) {\n /**\n * The Yjs instance.\n * @type {Doc}\n */\n this.doc = doc\n /**\n * Describes the set of deleted items by ids\n * @type {DeleteSet}\n */\n this.deleteSet = new DeleteSet()\n /**\n * Holds the state before the transaction started.\n * @type {Map}\n */\n this.beforeState = getStateVector(doc.store)\n /**\n * Holds the state after the transaction.\n * @type {Map}\n */\n this.afterState = new Map()\n /**\n * All types that were directly modified (property added or child\n * inserted/deleted). New types are not included in this Set.\n * Maps from type to parentSubs (`item.parentSub = null` for YArray)\n * @type {Map>,Set>}\n */\n this.changed = new Map()\n /**\n * Stores the events for the types that observe also child elements.\n * It is mainly used by `observeDeep`.\n * @type {Map>,Array>>}\n */\n this.changedParentTypes = new Map()\n /**\n * @type {Array}\n */\n this._mergeStructs = []\n /**\n * @type {any}\n */\n this.origin = origin\n /**\n * Stores meta information on the transaction\n * @type {Map}\n */\n this.meta = new Map()\n /**\n * Whether this change originates from this doc.\n * @type {boolean}\n */\n this.local = local\n /**\n * @type {Set}\n */\n this.subdocsAdded = new Set()\n /**\n * @type {Set}\n */\n this.subdocsRemoved = new Set()\n /**\n * @type {Set}\n */\n this.subdocsLoaded = new Set()\n /**\n * @type {boolean}\n */\n this._needFormattingCleanup = false\n }\n}\n\n/**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {Transaction} transaction\n * @return {boolean} Whether data was written.\n */\nexport const writeUpdateMessageFromTransaction = (encoder, transaction) => {\n if (transaction.deleteSet.clients.size === 0 && !map.any(transaction.afterState, (clock, client) => transaction.beforeState.get(client) !== clock)) {\n return false\n }\n sortAndMergeDeleteSet(transaction.deleteSet)\n writeStructsFromTransaction(encoder, transaction)\n writeDeleteSet(encoder, transaction.deleteSet)\n return true\n}\n\n/**\n * @param {Transaction} transaction\n *\n * @private\n * @function\n */\nexport const nextID = transaction => {\n const y = transaction.doc\n return createID(y.clientID, getState(y.store, y.clientID))\n}\n\n/**\n * If `type.parent` was added in current transaction, `type` technically\n * did not change, it was just added and we should not fire events for `type`.\n *\n * @param {Transaction} transaction\n * @param {AbstractType>} type\n * @param {string|null} parentSub\n */\nexport const addChangedTypeToTransaction = (transaction, type, parentSub) => {\n const item = type._item\n if (item === null || (item.id.clock < (transaction.beforeState.get(item.id.client) || 0) && !item.deleted)) {\n map.setIfUndefined(transaction.changed, type, set.create).add(parentSub)\n }\n}\n\n/**\n * @param {Array} structs\n * @param {number} pos\n * @return {number} # of merged structs\n */\nconst tryToMergeWithLefts = (structs, pos) => {\n let right = structs[pos]\n let left = structs[pos - 1]\n let i = pos\n for (; i > 0; right = left, left = structs[--i - 1]) {\n if (left.deleted === right.deleted && left.constructor === right.constructor) {\n if (left.mergeWith(right)) {\n if (right instanceof Item && right.parentSub !== null && /** @type {AbstractType} */ (right.parent)._map.get(right.parentSub) === right) {\n /** @type {AbstractType} */ (right.parent)._map.set(right.parentSub, /** @type {Item} */ (left))\n }\n continue\n }\n }\n break\n }\n const merged = pos - i\n if (merged) {\n // remove all merged structs from the array\n structs.splice(pos + 1 - merged, merged)\n }\n return merged\n}\n\n/**\n * @param {DeleteSet} ds\n * @param {StructStore} store\n * @param {function(Item):boolean} gcFilter\n */\nconst tryGcDeleteSet = (ds, store, gcFilter) => {\n for (const [client, deleteItems] of ds.clients.entries()) {\n const structs = /** @type {Array} */ (store.clients.get(client))\n for (let di = deleteItems.length - 1; di >= 0; di--) {\n const deleteItem = deleteItems[di]\n const endDeleteItemClock = deleteItem.clock + deleteItem.len\n for (\n let si = findIndexSS(structs, deleteItem.clock), struct = structs[si];\n si < structs.length && struct.id.clock < endDeleteItemClock;\n struct = structs[++si]\n ) {\n const struct = structs[si]\n if (deleteItem.clock + deleteItem.len <= struct.id.clock) {\n break\n }\n if (struct instanceof Item && struct.deleted && !struct.keep && gcFilter(struct)) {\n struct.gc(store, false)\n }\n }\n }\n }\n}\n\n/**\n * @param {DeleteSet} ds\n * @param {StructStore} store\n */\nconst tryMergeDeleteSet = (ds, store) => {\n // try to merge deleted / gc'd items\n // merge from right to left for better efficiency and so we don't miss any merge targets\n ds.clients.forEach((deleteItems, client) => {\n const structs = /** @type {Array} */ (store.clients.get(client))\n for (let di = deleteItems.length - 1; di >= 0; di--) {\n const deleteItem = deleteItems[di]\n // start with merging the item next to the last deleted item\n const mostRightIndexToCheck = math.min(structs.length - 1, 1 + findIndexSS(structs, deleteItem.clock + deleteItem.len - 1))\n for (\n let si = mostRightIndexToCheck, struct = structs[si];\n si > 0 && struct.id.clock >= deleteItem.clock;\n struct = structs[si]\n ) {\n si -= 1 + tryToMergeWithLefts(structs, si)\n }\n }\n })\n}\n\n/**\n * @param {DeleteSet} ds\n * @param {StructStore} store\n * @param {function(Item):boolean} gcFilter\n */\nexport const tryGc = (ds, store, gcFilter) => {\n tryGcDeleteSet(ds, store, gcFilter)\n tryMergeDeleteSet(ds, store)\n}\n\n/**\n * @param {Array} transactionCleanups\n * @param {number} i\n */\nconst cleanupTransactions = (transactionCleanups, i) => {\n if (i < transactionCleanups.length) {\n const transaction = transactionCleanups[i]\n const doc = transaction.doc\n const store = doc.store\n const ds = transaction.deleteSet\n const mergeStructs = transaction._mergeStructs\n try {\n sortAndMergeDeleteSet(ds)\n transaction.afterState = getStateVector(transaction.doc.store)\n doc.emit('beforeObserverCalls', [transaction, doc])\n /**\n * An array of event callbacks.\n *\n * Each callback is called even if the other ones throw errors.\n *\n * @type {Array}\n */\n const fs = []\n // observe events on changed types\n transaction.changed.forEach((subs, itemtype) =>\n fs.push(() => {\n if (itemtype._item === null || !itemtype._item.deleted) {\n itemtype._callObserver(transaction, subs)\n }\n })\n )\n fs.push(() => {\n // deep observe events\n transaction.changedParentTypes.forEach((events, type) => {\n // We need to think about the possibility that the user transforms the\n // Y.Doc in the event.\n if (type._dEH.l.length > 0 && (type._item === null || !type._item.deleted)) {\n events = events\n .filter(event =>\n event.target._item === null || !event.target._item.deleted\n )\n events\n .forEach(event => {\n event.currentTarget = type\n // path is relative to the current target\n event._path = null\n })\n // sort events by path length so that top-level events are fired first.\n events\n .sort((event1, event2) => event1.path.length - event2.path.length)\n fs.push(() => {\n // We don't need to check for events.length\n // because we know it has at least one element\n callEventHandlerListeners(type._dEH, events, transaction)\n })\n }\n })\n fs.push(() => doc.emit('afterTransaction', [transaction, doc]))\n fs.push(() => {\n if (transaction._needFormattingCleanup) {\n cleanupYTextAfterTransaction(transaction)\n }\n })\n })\n callAll(fs, [])\n } finally {\n // Replace deleted items with ItemDeleted / GC.\n // This is where content is actually remove from the Yjs Doc.\n if (doc.gc) {\n tryGcDeleteSet(ds, store, doc.gcFilter)\n }\n tryMergeDeleteSet(ds, store)\n\n // on all affected store.clients props, try to merge\n transaction.afterState.forEach((clock, client) => {\n const beforeClock = transaction.beforeState.get(client) || 0\n if (beforeClock !== clock) {\n const structs = /** @type {Array} */ (store.clients.get(client))\n // we iterate from right to left so we can safely remove entries\n const firstChangePos = math.max(findIndexSS(structs, beforeClock), 1)\n for (let i = structs.length - 1; i >= firstChangePos;) {\n i -= 1 + tryToMergeWithLefts(structs, i)\n }\n }\n })\n // try to merge mergeStructs\n // @todo: it makes more sense to transform mergeStructs to a DS, sort it, and merge from right to left\n // but at the moment DS does not handle duplicates\n for (let i = mergeStructs.length - 1; i >= 0; i--) {\n const { client, clock } = mergeStructs[i].id\n const structs = /** @type {Array} */ (store.clients.get(client))\n const replacedStructPos = findIndexSS(structs, clock)\n if (replacedStructPos + 1 < structs.length) {\n if (tryToMergeWithLefts(structs, replacedStructPos + 1) > 1) {\n continue // no need to perform next check, both are already merged\n }\n }\n if (replacedStructPos > 0) {\n tryToMergeWithLefts(structs, replacedStructPos)\n }\n }\n if (!transaction.local && transaction.afterState.get(doc.clientID) !== transaction.beforeState.get(doc.clientID)) {\n logging.print(logging.ORANGE, logging.BOLD, '[yjs] ', logging.UNBOLD, logging.RED, 'Changed the client-id because another client seems to be using it.')\n doc.clientID = generateNewClientId()\n }\n // @todo Merge all the transactions into one and provide send the data as a single update message\n doc.emit('afterTransactionCleanup', [transaction, doc])\n if (doc._observers.has('update')) {\n const encoder = new UpdateEncoderV1()\n const hasContent = writeUpdateMessageFromTransaction(encoder, transaction)\n if (hasContent) {\n doc.emit('update', [encoder.toUint8Array(), transaction.origin, doc, transaction])\n }\n }\n if (doc._observers.has('updateV2')) {\n const encoder = new UpdateEncoderV2()\n const hasContent = writeUpdateMessageFromTransaction(encoder, transaction)\n if (hasContent) {\n doc.emit('updateV2', [encoder.toUint8Array(), transaction.origin, doc, transaction])\n }\n }\n const { subdocsAdded, subdocsLoaded, subdocsRemoved } = transaction\n if (subdocsAdded.size > 0 || subdocsRemoved.size > 0 || subdocsLoaded.size > 0) {\n subdocsAdded.forEach(subdoc => {\n subdoc.clientID = doc.clientID\n if (subdoc.collectionid == null) {\n subdoc.collectionid = doc.collectionid\n }\n doc.subdocs.add(subdoc)\n })\n subdocsRemoved.forEach(subdoc => doc.subdocs.delete(subdoc))\n doc.emit('subdocs', [{ loaded: subdocsLoaded, added: subdocsAdded, removed: subdocsRemoved }, doc, transaction])\n subdocsRemoved.forEach(subdoc => subdoc.destroy())\n }\n\n if (transactionCleanups.length <= i + 1) {\n doc._transactionCleanups = []\n doc.emit('afterAllTransactions', [doc, transactionCleanups])\n } else {\n cleanupTransactions(transactionCleanups, i + 1)\n }\n }\n }\n}\n\n/**\n * Implements the functionality of `y.transact(()=>{..})`\n *\n * @template T\n * @param {Doc} doc\n * @param {function(Transaction):T} f\n * @param {any} [origin=true]\n * @return {T}\n *\n * @function\n */\nexport const transact = (doc, f, origin = null, local = true) => {\n const transactionCleanups = doc._transactionCleanups\n let initialCall = false\n /**\n * @type {any}\n */\n let result = null\n if (doc._transaction === null) {\n initialCall = true\n doc._transaction = new Transaction(doc, origin, local)\n transactionCleanups.push(doc._transaction)\n if (transactionCleanups.length === 1) {\n doc.emit('beforeAllTransactions', [doc])\n }\n doc.emit('beforeTransaction', [doc._transaction, doc])\n }\n try {\n result = f(doc._transaction)\n } finally {\n if (initialCall) {\n const finishCleanup = doc._transaction === transactionCleanups[0]\n doc._transaction = null\n if (finishCleanup) {\n // The first transaction ended, now process observer calls.\n // Observer call may create new transactions for which we need to call the observers and do cleanup.\n // We don't want to nest these calls, so we execute these calls one after\n // another.\n // Also we need to ensure that all cleanups are called, even if the\n // observes throw errors.\n // This file is full of hacky try {} finally {} blocks to ensure that an\n // event can throw errors and also that the cleanup is called.\n cleanupTransactions(transactionCleanups, 0)\n }\n }\n }\n return result\n}\n","import {\n mergeDeleteSets,\n iterateDeletedStructs,\n keepItem,\n transact,\n createID,\n redoItem,\n isParentOf,\n followRedone,\n getItemCleanStart,\n isDeleted,\n addToDeleteSet,\n YEvent, Transaction, Doc, Item, GC, DeleteSet, AbstractType // eslint-disable-line\n} from '../internals.js'\n\nimport * as time from 'lib0/time'\nimport * as array from 'lib0/array'\nimport * as logging from 'lib0/logging'\nimport { ObservableV2 } from 'lib0/observable'\n\nexport class StackItem {\n /**\n * @param {DeleteSet} deletions\n * @param {DeleteSet} insertions\n */\n constructor (deletions, insertions) {\n this.insertions = insertions\n this.deletions = deletions\n /**\n * Use this to save and restore metadata like selection range\n */\n this.meta = new Map()\n }\n}\n/**\n * @param {Transaction} tr\n * @param {UndoManager} um\n * @param {StackItem} stackItem\n */\nconst clearUndoManagerStackItem = (tr, um, stackItem) => {\n iterateDeletedStructs(tr, stackItem.deletions, item => {\n if (item instanceof Item && um.scope.some(type => type === tr.doc || isParentOf(/** @type {AbstractType} */ (type), item))) {\n keepItem(item, false)\n }\n })\n}\n\n/**\n * @param {UndoManager} undoManager\n * @param {Array} stack\n * @param {'undo'|'redo'} eventType\n * @return {StackItem?}\n */\nconst popStackItem = (undoManager, stack, eventType) => {\n /**\n * Keep a reference to the transaction so we can fire the event with the changedParentTypes\n * @type {any}\n */\n let _tr = null\n const doc = undoManager.doc\n const scope = undoManager.scope\n transact(doc, transaction => {\n while (stack.length > 0 && undoManager.currStackItem === null) {\n const store = doc.store\n const stackItem = /** @type {StackItem} */ (stack.pop())\n /**\n * @type {Set}\n */\n const itemsToRedo = new Set()\n /**\n * @type {Array}\n */\n const itemsToDelete = []\n let performedChange = false\n iterateDeletedStructs(transaction, stackItem.insertions, struct => {\n if (struct instanceof Item) {\n if (struct.redone !== null) {\n let { item, diff } = followRedone(store, struct.id)\n if (diff > 0) {\n item = getItemCleanStart(transaction, createID(item.id.client, item.id.clock + diff))\n }\n struct = item\n }\n if (!struct.deleted && scope.some(type => type === transaction.doc || isParentOf(/** @type {AbstractType} */ (type), /** @type {Item} */ (struct)))) {\n itemsToDelete.push(struct)\n }\n }\n })\n iterateDeletedStructs(transaction, stackItem.deletions, struct => {\n if (\n struct instanceof Item &&\n scope.some(type => type === transaction.doc || isParentOf(/** @type {AbstractType} */ (type), struct)) &&\n // Never redo structs in stackItem.insertions because they were created and deleted in the same capture interval.\n !isDeleted(stackItem.insertions, struct.id)\n ) {\n itemsToRedo.add(struct)\n }\n })\n itemsToRedo.forEach(struct => {\n performedChange = redoItem(transaction, struct, itemsToRedo, stackItem.insertions, undoManager.ignoreRemoteMapChanges, undoManager) !== null || performedChange\n })\n // We want to delete in reverse order so that children are deleted before\n // parents, so we have more information available when items are filtered.\n for (let i = itemsToDelete.length - 1; i >= 0; i--) {\n const item = itemsToDelete[i]\n if (undoManager.deleteFilter(item)) {\n item.delete(transaction)\n performedChange = true\n }\n }\n undoManager.currStackItem = performedChange ? stackItem : null\n }\n transaction.changed.forEach((subProps, type) => {\n // destroy search marker if necessary\n if (subProps.has(null) && type._searchMarker) {\n type._searchMarker.length = 0\n }\n })\n _tr = transaction\n }, undoManager)\n const res = undoManager.currStackItem\n if (res != null) {\n const changedParentTypes = _tr.changedParentTypes\n undoManager.emit('stack-item-popped', [{ stackItem: res, type: eventType, changedParentTypes, origin: undoManager }, undoManager])\n undoManager.currStackItem = null\n }\n return res\n}\n\n/**\n * @typedef {Object} UndoManagerOptions\n * @property {number} [UndoManagerOptions.captureTimeout=500]\n * @property {function(Transaction):boolean} [UndoManagerOptions.captureTransaction] Do not capture changes of a Transaction if result false.\n * @property {function(Item):boolean} [UndoManagerOptions.deleteFilter=()=>true] Sometimes\n * it is necessary to filter what an Undo/Redo operation can delete. If this\n * filter returns false, the type/item won't be deleted even it is in the\n * undo/redo scope.\n * @property {Set} [UndoManagerOptions.trackedOrigins=new Set([null])]\n * @property {boolean} [ignoreRemoteMapChanges] Experimental. By default, the UndoManager will never overwrite remote changes. Enable this property to enable overwriting remote changes on key-value changes (Y.Map, properties on Y.Xml, etc..).\n * @property {Doc} [doc] The document that this UndoManager operates on. Only needed if typeScope is empty.\n */\n\n/**\n * @typedef {Object} StackItemEvent\n * @property {StackItem} StackItemEvent.stackItem\n * @property {any} StackItemEvent.origin\n * @property {'undo'|'redo'} StackItemEvent.type\n * @property {Map>,Array>>} StackItemEvent.changedParentTypes\n */\n\n/**\n * Fires 'stack-item-added' event when a stack item was added to either the undo- or\n * the redo-stack. You may store additional stack information via the\n * metadata property on `event.stackItem.meta` (it is a `Map` of metadata properties).\n * Fires 'stack-item-popped' event when a stack item was popped from either the\n * undo- or the redo-stack. You may restore the saved stack information from `event.stackItem.meta`.\n *\n * @extends {ObservableV2<{'stack-item-added':function(StackItemEvent, UndoManager):void, 'stack-item-popped': function(StackItemEvent, UndoManager):void, 'stack-cleared': function({ undoStackCleared: boolean, redoStackCleared: boolean }):void, 'stack-item-updated': function(StackItemEvent, UndoManager):void }>}\n */\nexport class UndoManager extends ObservableV2 {\n /**\n * @param {Doc|AbstractType|Array>} typeScope Limits the scope of the UndoManager. If this is set to a ydoc instance, all changes on that ydoc will be undone. If set to a specific type, only changes on that type or its children will be undone. Also accepts an array of types.\n * @param {UndoManagerOptions} options\n */\n constructor (typeScope, {\n captureTimeout = 500,\n captureTransaction = _tr => true,\n deleteFilter = () => true,\n trackedOrigins = new Set([null]),\n ignoreRemoteMapChanges = false,\n doc = /** @type {Doc} */ (array.isArray(typeScope) ? typeScope[0].doc : typeScope instanceof Doc ? typeScope : typeScope.doc)\n } = {}) {\n super()\n /**\n * @type {Array | Doc>}\n */\n this.scope = []\n this.doc = doc\n this.addToScope(typeScope)\n this.deleteFilter = deleteFilter\n trackedOrigins.add(this)\n this.trackedOrigins = trackedOrigins\n this.captureTransaction = captureTransaction\n /**\n * @type {Array}\n */\n this.undoStack = []\n /**\n * @type {Array}\n */\n this.redoStack = []\n /**\n * Whether the client is currently undoing (calling UndoManager.undo)\n *\n * @type {boolean}\n */\n this.undoing = false\n this.redoing = false\n /**\n * The currently popped stack item if UndoManager.undoing or UndoManager.redoing\n *\n * @type {StackItem|null}\n */\n this.currStackItem = null\n this.lastChange = 0\n this.ignoreRemoteMapChanges = ignoreRemoteMapChanges\n this.captureTimeout = captureTimeout\n /**\n * @param {Transaction} transaction\n */\n this.afterTransactionHandler = transaction => {\n // Only track certain transactions\n if (\n !this.captureTransaction(transaction) ||\n !this.scope.some(type => transaction.changedParentTypes.has(/** @type {AbstractType} */ (type)) || type === this.doc) ||\n (!this.trackedOrigins.has(transaction.origin) && (!transaction.origin || !this.trackedOrigins.has(transaction.origin.constructor)))\n ) {\n return\n }\n const undoing = this.undoing\n const redoing = this.redoing\n const stack = undoing ? this.redoStack : this.undoStack\n if (undoing) {\n this.stopCapturing() // next undo should not be appended to last stack item\n } else if (!redoing) {\n // neither undoing nor redoing: delete redoStack\n this.clear(false, true)\n }\n const insertions = new DeleteSet()\n transaction.afterState.forEach((endClock, client) => {\n const startClock = transaction.beforeState.get(client) || 0\n const len = endClock - startClock\n if (len > 0) {\n addToDeleteSet(insertions, client, startClock, len)\n }\n })\n const now = time.getUnixTime()\n let didAdd = false\n if (this.lastChange > 0 && now - this.lastChange < this.captureTimeout && stack.length > 0 && !undoing && !redoing) {\n // append change to last stack op\n const lastOp = stack[stack.length - 1]\n lastOp.deletions = mergeDeleteSets([lastOp.deletions, transaction.deleteSet])\n lastOp.insertions = mergeDeleteSets([lastOp.insertions, insertions])\n } else {\n // create a new stack op\n stack.push(new StackItem(transaction.deleteSet, insertions))\n didAdd = true\n }\n if (!undoing && !redoing) {\n this.lastChange = now\n }\n // make sure that deleted structs are not gc'd\n iterateDeletedStructs(transaction, transaction.deleteSet, /** @param {Item|GC} item */ item => {\n if (item instanceof Item && this.scope.some(type => type === transaction.doc || isParentOf(/** @type {AbstractType} */ (type), item))) {\n keepItem(item, true)\n }\n })\n /**\n * @type {[StackItemEvent, UndoManager]}\n */\n const changeEvent = [{ stackItem: stack[stack.length - 1], origin: transaction.origin, type: undoing ? 'redo' : 'undo', changedParentTypes: transaction.changedParentTypes }, this]\n if (didAdd) {\n this.emit('stack-item-added', changeEvent)\n } else {\n this.emit('stack-item-updated', changeEvent)\n }\n }\n this.doc.on('afterTransaction', this.afterTransactionHandler)\n this.doc.on('destroy', () => {\n this.destroy()\n })\n }\n\n /**\n * Extend the scope.\n *\n * @param {Array | Doc> | AbstractType | Doc} ytypes\n */\n addToScope (ytypes) {\n const tmpSet = new Set(this.scope)\n ytypes = array.isArray(ytypes) ? ytypes : [ytypes]\n ytypes.forEach(ytype => {\n if (!tmpSet.has(ytype)) {\n tmpSet.add(ytype)\n if (ytype instanceof AbstractType ? ytype.doc !== this.doc : ytype !== this.doc) logging.warn('[yjs#509] Not same Y.Doc') // use MultiDocUndoManager instead. also see https://github.com/yjs/yjs/issues/509\n this.scope.push(ytype)\n }\n })\n }\n\n /**\n * @param {any} origin\n */\n addTrackedOrigin (origin) {\n this.trackedOrigins.add(origin)\n }\n\n /**\n * @param {any} origin\n */\n removeTrackedOrigin (origin) {\n this.trackedOrigins.delete(origin)\n }\n\n clear (clearUndoStack = true, clearRedoStack = true) {\n if ((clearUndoStack && this.canUndo()) || (clearRedoStack && this.canRedo())) {\n this.doc.transact(tr => {\n if (clearUndoStack) {\n this.undoStack.forEach(item => clearUndoManagerStackItem(tr, this, item))\n this.undoStack = []\n }\n if (clearRedoStack) {\n this.redoStack.forEach(item => clearUndoManagerStackItem(tr, this, item))\n this.redoStack = []\n }\n this.emit('stack-cleared', [{ undoStackCleared: clearUndoStack, redoStackCleared: clearRedoStack }])\n })\n }\n }\n\n /**\n * UndoManager merges Undo-StackItem if they are created within time-gap\n * smaller than `options.captureTimeout`. Call `um.stopCapturing()` so that the next\n * StackItem won't be merged.\n *\n *\n * @example\n * // without stopCapturing\n * ytext.insert(0, 'a')\n * ytext.insert(1, 'b')\n * um.undo()\n * ytext.toString() // => '' (note that 'ab' was removed)\n * // with stopCapturing\n * ytext.insert(0, 'a')\n * um.stopCapturing()\n * ytext.insert(0, 'b')\n * um.undo()\n * ytext.toString() // => 'a' (note that only 'b' was removed)\n *\n */\n stopCapturing () {\n this.lastChange = 0\n }\n\n /**\n * Undo last changes on type.\n *\n * @return {StackItem?} Returns StackItem if a change was applied\n */\n undo () {\n this.undoing = true\n let res\n try {\n res = popStackItem(this, this.undoStack, 'undo')\n } finally {\n this.undoing = false\n }\n return res\n }\n\n /**\n * Redo last undo operation.\n *\n * @return {StackItem?} Returns StackItem if a change was applied\n */\n redo () {\n this.redoing = true\n let res\n try {\n res = popStackItem(this, this.redoStack, 'redo')\n } finally {\n this.redoing = false\n }\n return res\n }\n\n /**\n * Are undo steps available?\n *\n * @return {boolean} `true` if undo is possible\n */\n canUndo () {\n return this.undoStack.length > 0\n }\n\n /**\n * Are redo steps available?\n *\n * @return {boolean} `true` if redo is possible\n */\n canRedo () {\n return this.redoStack.length > 0\n }\n\n destroy () {\n this.trackedOrigins.delete(this)\n this.doc.off('afterTransaction', this.afterTransactionHandler)\n super.destroy()\n }\n}\n","import * as binary from 'lib0/binary'\nimport * as decoding from 'lib0/decoding'\nimport * as encoding from 'lib0/encoding'\nimport * as error from 'lib0/error'\nimport * as f from 'lib0/function'\nimport * as logging from 'lib0/logging'\nimport * as map from 'lib0/map'\nimport * as math from 'lib0/math'\nimport * as string from 'lib0/string'\n\nimport {\n ContentAny,\n ContentBinary,\n ContentDeleted,\n ContentDoc,\n ContentEmbed,\n ContentFormat,\n ContentJSON,\n ContentString,\n ContentType,\n createID,\n decodeStateVector,\n DSEncoderV1,\n DSEncoderV2,\n GC,\n Item,\n mergeDeleteSets,\n readDeleteSet,\n readItemContent,\n Skip,\n UpdateDecoderV1,\n UpdateDecoderV2,\n UpdateEncoderV1,\n UpdateEncoderV2,\n writeDeleteSet,\n YXmlElement,\n YXmlHook\n} from '../internals.js'\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n */\nfunction * lazyStructReaderGenerator (decoder) {\n const numOfStateUpdates = decoding.readVarUint(decoder.restDecoder)\n for (let i = 0; i < numOfStateUpdates; i++) {\n const numberOfStructs = decoding.readVarUint(decoder.restDecoder)\n const client = decoder.readClient()\n let clock = decoding.readVarUint(decoder.restDecoder)\n for (let i = 0; i < numberOfStructs; i++) {\n const info = decoder.readInfo()\n // @todo use switch instead of ifs\n if (info === 10) {\n const len = decoding.readVarUint(decoder.restDecoder)\n yield new Skip(createID(client, clock), len)\n clock += len\n } else if ((binary.BITS5 & info) !== 0) {\n const cantCopyParentInfo = (info & (binary.BIT7 | binary.BIT8)) === 0\n // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y`\n // and we read the next string as parentYKey.\n // It indicates how we store/retrieve parent from `y.share`\n // @type {string|null}\n const struct = new Item(\n createID(client, clock),\n null, // left\n (info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null, // origin\n null, // right\n (info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null, // right origin\n // @ts-ignore Force writing a string here.\n cantCopyParentInfo ? (decoder.readParentInfo() ? decoder.readString() : decoder.readLeftID()) : null, // parent\n cantCopyParentInfo && (info & binary.BIT6) === binary.BIT6 ? decoder.readString() : null, // parentSub\n readItemContent(decoder, info) // item content\n )\n yield struct\n clock += struct.length\n } else {\n const len = decoder.readLen()\n yield new GC(createID(client, clock), len)\n clock += len\n }\n }\n }\n}\n\nexport class LazyStructReader {\n /**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @param {boolean} filterSkips\n */\n constructor (decoder, filterSkips) {\n this.gen = lazyStructReaderGenerator(decoder)\n /**\n * @type {null | Item | Skip | GC}\n */\n this.curr = null\n this.done = false\n this.filterSkips = filterSkips\n this.next()\n }\n\n /**\n * @return {Item | GC | Skip |null}\n */\n next () {\n // ignore \"Skip\" structs\n do {\n this.curr = this.gen.next().value || null\n } while (this.filterSkips && this.curr !== null && this.curr.constructor === Skip)\n return this.curr\n }\n}\n\n/**\n * @param {Uint8Array} update\n *\n */\nexport const logUpdate = update => logUpdateV2(update, UpdateDecoderV1)\n\n/**\n * @param {Uint8Array} update\n * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder]\n *\n */\nexport const logUpdateV2 = (update, YDecoder = UpdateDecoderV2) => {\n const structs = []\n const updateDecoder = new YDecoder(decoding.createDecoder(update))\n const lazyDecoder = new LazyStructReader(updateDecoder, false)\n for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) {\n structs.push(curr)\n }\n logging.print('Structs: ', structs)\n const ds = readDeleteSet(updateDecoder)\n logging.print('DeleteSet: ', ds)\n}\n\n/**\n * @param {Uint8Array} update\n *\n */\nexport const decodeUpdate = (update) => decodeUpdateV2(update, UpdateDecoderV1)\n\n/**\n * @param {Uint8Array} update\n * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder]\n *\n */\nexport const decodeUpdateV2 = (update, YDecoder = UpdateDecoderV2) => {\n const structs = []\n const updateDecoder = new YDecoder(decoding.createDecoder(update))\n const lazyDecoder = new LazyStructReader(updateDecoder, false)\n for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) {\n structs.push(curr)\n }\n return {\n structs,\n ds: readDeleteSet(updateDecoder)\n }\n}\n\nexport class LazyStructWriter {\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n */\n constructor (encoder) {\n this.currClient = 0\n this.startClock = 0\n this.written = 0\n this.encoder = encoder\n /**\n * We want to write operations lazily, but also we need to know beforehand how many operations we want to write for each client.\n *\n * This kind of meta-information (#clients, #structs-per-client-written) is written to the restEncoder.\n *\n * We fragment the restEncoder and store a slice of it per-client until we know how many clients there are.\n * When we flush (toUint8Array) we write the restEncoder using the fragments and the meta-information.\n *\n * @type {Array<{ written: number, restEncoder: Uint8Array }>}\n */\n this.clientStructs = []\n }\n}\n\n/**\n * @param {Array} updates\n * @return {Uint8Array}\n */\nexport const mergeUpdates = updates => mergeUpdatesV2(updates, UpdateDecoderV1, UpdateEncoderV1)\n\n/**\n * @param {Uint8Array} update\n * @param {typeof DSEncoderV1 | typeof DSEncoderV2} YEncoder\n * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} YDecoder\n * @return {Uint8Array}\n */\nexport const encodeStateVectorFromUpdateV2 = (update, YEncoder = DSEncoderV2, YDecoder = UpdateDecoderV2) => {\n const encoder = new YEncoder()\n const updateDecoder = new LazyStructReader(new YDecoder(decoding.createDecoder(update)), false)\n let curr = updateDecoder.curr\n if (curr !== null) {\n let size = 0\n let currClient = curr.id.client\n let stopCounting = curr.id.clock !== 0 // must start at 0\n let currClock = stopCounting ? 0 : curr.id.clock + curr.length\n for (; curr !== null; curr = updateDecoder.next()) {\n if (currClient !== curr.id.client) {\n if (currClock !== 0) {\n size++\n // We found a new client\n // write what we have to the encoder\n encoding.writeVarUint(encoder.restEncoder, currClient)\n encoding.writeVarUint(encoder.restEncoder, currClock)\n }\n currClient = curr.id.client\n currClock = 0\n stopCounting = curr.id.clock !== 0\n }\n // we ignore skips\n if (curr.constructor === Skip) {\n stopCounting = true\n }\n if (!stopCounting) {\n currClock = curr.id.clock + curr.length\n }\n }\n // write what we have\n if (currClock !== 0) {\n size++\n encoding.writeVarUint(encoder.restEncoder, currClient)\n encoding.writeVarUint(encoder.restEncoder, currClock)\n }\n // prepend the size of the state vector\n const enc = encoding.createEncoder()\n encoding.writeVarUint(enc, size)\n encoding.writeBinaryEncoder(enc, encoder.restEncoder)\n encoder.restEncoder = enc\n return encoder.toUint8Array()\n } else {\n encoding.writeVarUint(encoder.restEncoder, 0)\n return encoder.toUint8Array()\n }\n}\n\n/**\n * @param {Uint8Array} update\n * @return {Uint8Array}\n */\nexport const encodeStateVectorFromUpdate = update => encodeStateVectorFromUpdateV2(update, DSEncoderV1, UpdateDecoderV1)\n\n/**\n * @param {Uint8Array} update\n * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} YDecoder\n * @return {{ from: Map, to: Map }}\n */\nexport const parseUpdateMetaV2 = (update, YDecoder = UpdateDecoderV2) => {\n /**\n * @type {Map}\n */\n const from = new Map()\n /**\n * @type {Map}\n */\n const to = new Map()\n const updateDecoder = new LazyStructReader(new YDecoder(decoding.createDecoder(update)), false)\n let curr = updateDecoder.curr\n if (curr !== null) {\n let currClient = curr.id.client\n let currClock = curr.id.clock\n // write the beginning to `from`\n from.set(currClient, currClock)\n for (; curr !== null; curr = updateDecoder.next()) {\n if (currClient !== curr.id.client) {\n // We found a new client\n // write the end to `to`\n to.set(currClient, currClock)\n // write the beginning to `from`\n from.set(curr.id.client, curr.id.clock)\n // update currClient\n currClient = curr.id.client\n }\n currClock = curr.id.clock + curr.length\n }\n // write the end to `to`\n to.set(currClient, currClock)\n }\n return { from, to }\n}\n\n/**\n * @param {Uint8Array} update\n * @return {{ from: Map, to: Map }}\n */\nexport const parseUpdateMeta = update => parseUpdateMetaV2(update, UpdateDecoderV1)\n\n/**\n * This method is intended to slice any kind of struct and retrieve the right part.\n * It does not handle side-effects, so it should only be used by the lazy-encoder.\n *\n * @param {Item | GC | Skip} left\n * @param {number} diff\n * @return {Item | GC}\n */\nconst sliceStruct = (left, diff) => {\n if (left.constructor === GC) {\n const { client, clock } = left.id\n return new GC(createID(client, clock + diff), left.length - diff)\n } else if (left.constructor === Skip) {\n const { client, clock } = left.id\n return new Skip(createID(client, clock + diff), left.length - diff)\n } else {\n const leftItem = /** @type {Item} */ (left)\n const { client, clock } = leftItem.id\n return new Item(\n createID(client, clock + diff),\n null,\n createID(client, clock + diff - 1),\n null,\n leftItem.rightOrigin,\n leftItem.parent,\n leftItem.parentSub,\n leftItem.content.splice(diff)\n )\n }\n}\n\n/**\n *\n * This function works similarly to `readUpdateV2`.\n *\n * @param {Array} updates\n * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder]\n * @param {typeof UpdateEncoderV1 | typeof UpdateEncoderV2} [YEncoder]\n * @return {Uint8Array}\n */\nexport const mergeUpdatesV2 = (updates, YDecoder = UpdateDecoderV2, YEncoder = UpdateEncoderV2) => {\n if (updates.length === 1) {\n return updates[0]\n }\n const updateDecoders = updates.map(update => new YDecoder(decoding.createDecoder(update)))\n let lazyStructDecoders = updateDecoders.map(decoder => new LazyStructReader(decoder, true))\n\n /**\n * @todo we don't need offset because we always slice before\n * @type {null | { struct: Item | GC | Skip, offset: number }}\n */\n let currWrite = null\n\n const updateEncoder = new YEncoder()\n // write structs lazily\n const lazyStructEncoder = new LazyStructWriter(updateEncoder)\n\n // Note: We need to ensure that all lazyStructDecoders are fully consumed\n // Note: Should merge document updates whenever possible - even from different updates\n // Note: Should handle that some operations cannot be applied yet ()\n\n while (true) {\n // Write higher clients first ⇒ sort by clientID & clock and remove decoders without content\n lazyStructDecoders = lazyStructDecoders.filter(dec => dec.curr !== null)\n lazyStructDecoders.sort(\n /** @type {function(any,any):number} */ (dec1, dec2) => {\n if (dec1.curr.id.client === dec2.curr.id.client) {\n const clockDiff = dec1.curr.id.clock - dec2.curr.id.clock\n if (clockDiff === 0) {\n // @todo remove references to skip since the structDecoders must filter Skips.\n return dec1.curr.constructor === dec2.curr.constructor\n ? 0\n : dec1.curr.constructor === Skip ? 1 : -1 // we are filtering skips anyway.\n } else {\n return clockDiff\n }\n } else {\n return dec2.curr.id.client - dec1.curr.id.client\n }\n }\n )\n if (lazyStructDecoders.length === 0) {\n break\n }\n const currDecoder = lazyStructDecoders[0]\n // write from currDecoder until the next operation is from another client or if filler-struct\n // then we need to reorder the decoders and find the next operation to write\n const firstClient = /** @type {Item | GC} */ (currDecoder.curr).id.client\n\n if (currWrite !== null) {\n let curr = /** @type {Item | GC | null} */ (currDecoder.curr)\n let iterated = false\n\n // iterate until we find something that we haven't written already\n // remember: first the high client-ids are written\n while (curr !== null && curr.id.clock + curr.length <= currWrite.struct.id.clock + currWrite.struct.length && curr.id.client >= currWrite.struct.id.client) {\n curr = currDecoder.next()\n iterated = true\n }\n if (\n curr === null || // current decoder is empty\n curr.id.client !== firstClient || // check whether there is another decoder that has has updates from `firstClient`\n (iterated && curr.id.clock > currWrite.struct.id.clock + currWrite.struct.length) // the above while loop was used and we are potentially missing updates\n ) {\n continue\n }\n\n if (firstClient !== currWrite.struct.id.client) {\n writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset)\n currWrite = { struct: curr, offset: 0 }\n currDecoder.next()\n } else {\n if (currWrite.struct.id.clock + currWrite.struct.length < curr.id.clock) {\n // @todo write currStruct & set currStruct = Skip(clock = currStruct.id.clock + currStruct.length, length = curr.id.clock - self.clock)\n if (currWrite.struct.constructor === Skip) {\n // extend existing skip\n currWrite.struct.length = curr.id.clock + curr.length - currWrite.struct.id.clock\n } else {\n writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset)\n const diff = curr.id.clock - currWrite.struct.id.clock - currWrite.struct.length\n /**\n * @type {Skip}\n */\n const struct = new Skip(createID(firstClient, currWrite.struct.id.clock + currWrite.struct.length), diff)\n currWrite = { struct, offset: 0 }\n }\n } else { // if (currWrite.struct.id.clock + currWrite.struct.length >= curr.id.clock) {\n const diff = currWrite.struct.id.clock + currWrite.struct.length - curr.id.clock\n if (diff > 0) {\n if (currWrite.struct.constructor === Skip) {\n // prefer to slice Skip because the other struct might contain more information\n currWrite.struct.length -= diff\n } else {\n curr = sliceStruct(curr, diff)\n }\n }\n if (!currWrite.struct.mergeWith(/** @type {any} */ (curr))) {\n writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset)\n currWrite = { struct: curr, offset: 0 }\n currDecoder.next()\n }\n }\n }\n } else {\n currWrite = { struct: /** @type {Item | GC} */ (currDecoder.curr), offset: 0 }\n currDecoder.next()\n }\n for (\n let next = currDecoder.curr;\n next !== null && next.id.client === firstClient && next.id.clock === currWrite.struct.id.clock + currWrite.struct.length && next.constructor !== Skip;\n next = currDecoder.next()\n ) {\n writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset)\n currWrite = { struct: next, offset: 0 }\n }\n }\n if (currWrite !== null) {\n writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset)\n currWrite = null\n }\n finishLazyStructWriting(lazyStructEncoder)\n\n const dss = updateDecoders.map(decoder => readDeleteSet(decoder))\n const ds = mergeDeleteSets(dss)\n writeDeleteSet(updateEncoder, ds)\n return updateEncoder.toUint8Array()\n}\n\n/**\n * @param {Uint8Array} update\n * @param {Uint8Array} sv\n * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder]\n * @param {typeof UpdateEncoderV1 | typeof UpdateEncoderV2} [YEncoder]\n */\nexport const diffUpdateV2 = (update, sv, YDecoder = UpdateDecoderV2, YEncoder = UpdateEncoderV2) => {\n const state = decodeStateVector(sv)\n const encoder = new YEncoder()\n const lazyStructWriter = new LazyStructWriter(encoder)\n const decoder = new YDecoder(decoding.createDecoder(update))\n const reader = new LazyStructReader(decoder, false)\n while (reader.curr) {\n const curr = reader.curr\n const currClient = curr.id.client\n const svClock = state.get(currClient) || 0\n if (reader.curr.constructor === Skip) {\n // the first written struct shouldn't be a skip\n reader.next()\n continue\n }\n if (curr.id.clock + curr.length > svClock) {\n writeStructToLazyStructWriter(lazyStructWriter, curr, math.max(svClock - curr.id.clock, 0))\n reader.next()\n while (reader.curr && reader.curr.id.client === currClient) {\n writeStructToLazyStructWriter(lazyStructWriter, reader.curr, 0)\n reader.next()\n }\n } else {\n // read until something new comes up\n while (reader.curr && reader.curr.id.client === currClient && reader.curr.id.clock + reader.curr.length <= svClock) {\n reader.next()\n }\n }\n }\n finishLazyStructWriting(lazyStructWriter)\n // write ds\n const ds = readDeleteSet(decoder)\n writeDeleteSet(encoder, ds)\n return encoder.toUint8Array()\n}\n\n/**\n * @param {Uint8Array} update\n * @param {Uint8Array} sv\n */\nexport const diffUpdate = (update, sv) => diffUpdateV2(update, sv, UpdateDecoderV1, UpdateEncoderV1)\n\n/**\n * @param {LazyStructWriter} lazyWriter\n */\nconst flushLazyStructWriter = lazyWriter => {\n if (lazyWriter.written > 0) {\n lazyWriter.clientStructs.push({ written: lazyWriter.written, restEncoder: encoding.toUint8Array(lazyWriter.encoder.restEncoder) })\n lazyWriter.encoder.restEncoder = encoding.createEncoder()\n lazyWriter.written = 0\n }\n}\n\n/**\n * @param {LazyStructWriter} lazyWriter\n * @param {Item | GC} struct\n * @param {number} offset\n */\nconst writeStructToLazyStructWriter = (lazyWriter, struct, offset) => {\n // flush curr if we start another client\n if (lazyWriter.written > 0 && lazyWriter.currClient !== struct.id.client) {\n flushLazyStructWriter(lazyWriter)\n }\n if (lazyWriter.written === 0) {\n lazyWriter.currClient = struct.id.client\n // write next client\n lazyWriter.encoder.writeClient(struct.id.client)\n // write startClock\n encoding.writeVarUint(lazyWriter.encoder.restEncoder, struct.id.clock + offset)\n }\n struct.write(lazyWriter.encoder, offset)\n lazyWriter.written++\n}\n/**\n * Call this function when we collected all parts and want to\n * put all the parts together. After calling this method,\n * you can continue using the UpdateEncoder.\n *\n * @param {LazyStructWriter} lazyWriter\n */\nconst finishLazyStructWriting = (lazyWriter) => {\n flushLazyStructWriter(lazyWriter)\n\n // this is a fresh encoder because we called flushCurr\n const restEncoder = lazyWriter.encoder.restEncoder\n\n /**\n * Now we put all the fragments together.\n * This works similarly to `writeClientsStructs`\n */\n\n // write # states that were updated - i.e. the clients\n encoding.writeVarUint(restEncoder, lazyWriter.clientStructs.length)\n\n for (let i = 0; i < lazyWriter.clientStructs.length; i++) {\n const partStructs = lazyWriter.clientStructs[i]\n /**\n * Works similarly to `writeStructs`\n */\n // write # encoded structs\n encoding.writeVarUint(restEncoder, partStructs.written)\n // write the rest of the fragment\n encoding.writeUint8Array(restEncoder, partStructs.restEncoder)\n }\n}\n\n/**\n * @param {Uint8Array} update\n * @param {function(Item|GC|Skip):Item|GC|Skip} blockTransformer\n * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} YDecoder\n * @param {typeof UpdateEncoderV2 | typeof UpdateEncoderV1 } YEncoder\n */\nexport const convertUpdateFormat = (update, blockTransformer, YDecoder, YEncoder) => {\n const updateDecoder = new YDecoder(decoding.createDecoder(update))\n const lazyDecoder = new LazyStructReader(updateDecoder, false)\n const updateEncoder = new YEncoder()\n const lazyWriter = new LazyStructWriter(updateEncoder)\n for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) {\n writeStructToLazyStructWriter(lazyWriter, blockTransformer(curr), 0)\n }\n finishLazyStructWriting(lazyWriter)\n const ds = readDeleteSet(updateDecoder)\n writeDeleteSet(updateEncoder, ds)\n return updateEncoder.toUint8Array()\n}\n\n/**\n * @typedef {Object} ObfuscatorOptions\n * @property {boolean} [ObfuscatorOptions.formatting=true]\n * @property {boolean} [ObfuscatorOptions.subdocs=true]\n * @property {boolean} [ObfuscatorOptions.yxml=true] Whether to obfuscate nodeName / hookName\n */\n\n/**\n * @param {ObfuscatorOptions} obfuscator\n */\nconst createObfuscator = ({ formatting = true, subdocs = true, yxml = true } = {}) => {\n let i = 0\n const mapKeyCache = map.create()\n const nodeNameCache = map.create()\n const formattingKeyCache = map.create()\n const formattingValueCache = map.create()\n formattingValueCache.set(null, null) // end of a formatting range should always be the end of a formatting range\n /**\n * @param {Item|GC|Skip} block\n * @return {Item|GC|Skip}\n */\n return block => {\n switch (block.constructor) {\n case GC:\n case Skip:\n return block\n case Item: {\n const item = /** @type {Item} */ (block)\n const content = item.content\n switch (content.constructor) {\n case ContentDeleted:\n break\n case ContentType: {\n if (yxml) {\n const type = /** @type {ContentType} */ (content).type\n if (type instanceof YXmlElement) {\n type.nodeName = map.setIfUndefined(nodeNameCache, type.nodeName, () => 'node-' + i)\n }\n if (type instanceof YXmlHook) {\n type.hookName = map.setIfUndefined(nodeNameCache, type.hookName, () => 'hook-' + i)\n }\n }\n break\n }\n case ContentAny: {\n const c = /** @type {ContentAny} */ (content)\n c.arr = c.arr.map(() => i)\n break\n }\n case ContentBinary: {\n const c = /** @type {ContentBinary} */ (content)\n c.content = new Uint8Array([i])\n break\n }\n case ContentDoc: {\n const c = /** @type {ContentDoc} */ (content)\n if (subdocs) {\n c.opts = {}\n c.doc.guid = i + ''\n }\n break\n }\n case ContentEmbed: {\n const c = /** @type {ContentEmbed} */ (content)\n c.embed = {}\n break\n }\n case ContentFormat: {\n const c = /** @type {ContentFormat} */ (content)\n if (formatting) {\n c.key = map.setIfUndefined(formattingKeyCache, c.key, () => i + '')\n c.value = map.setIfUndefined(formattingValueCache, c.value, () => ({ i }))\n }\n break\n }\n case ContentJSON: {\n const c = /** @type {ContentJSON} */ (content)\n c.arr = c.arr.map(() => i)\n break\n }\n case ContentString: {\n const c = /** @type {ContentString} */ (content)\n c.str = string.repeat((i % 10) + '', c.str.length)\n break\n }\n default:\n // unknown content type\n error.unexpectedCase()\n }\n if (item.parentSub) {\n item.parentSub = map.setIfUndefined(mapKeyCache, item.parentSub, () => i + '')\n }\n i++\n return block\n }\n default:\n // unknown block-type\n error.unexpectedCase()\n }\n }\n}\n\n/**\n * This function obfuscates the content of a Yjs update. This is useful to share\n * buggy Yjs documents while significantly limiting the possibility that a\n * developer can on the user. Note that it might still be possible to deduce\n * some information by analyzing the \"structure\" of the document or by analyzing\n * the typing behavior using the CRDT-related metadata that is still kept fully\n * intact.\n *\n * @param {Uint8Array} update\n * @param {ObfuscatorOptions} [opts]\n */\nexport const obfuscateUpdate = (update, opts) => convertUpdateFormat(update, createObfuscator(opts), UpdateDecoderV1, UpdateEncoderV1)\n\n/**\n * @param {Uint8Array} update\n * @param {ObfuscatorOptions} [opts]\n */\nexport const obfuscateUpdateV2 = (update, opts) => convertUpdateFormat(update, createObfuscator(opts), UpdateDecoderV2, UpdateEncoderV2)\n\n/**\n * @param {Uint8Array} update\n */\nexport const convertUpdateFormatV1ToV2 = update => convertUpdateFormat(update, f.id, UpdateDecoderV1, UpdateEncoderV2)\n\n/**\n * @param {Uint8Array} update\n */\nexport const convertUpdateFormatV2ToV1 = update => convertUpdateFormat(update, f.id, UpdateDecoderV2, UpdateEncoderV1)\n","import {\n isDeleted,\n Item, AbstractType, Transaction, AbstractStruct // eslint-disable-line\n} from '../internals.js'\n\nimport * as set from 'lib0/set'\nimport * as array from 'lib0/array'\nimport * as error from 'lib0/error'\n\nconst errorComputeChanges = 'You must not compute changes after the event-handler fired.'\n\n/**\n * @template {AbstractType} T\n * YEvent describes the changes on a YType.\n */\nexport class YEvent {\n /**\n * @param {T} target The changed type.\n * @param {Transaction} transaction\n */\n constructor (target, transaction) {\n /**\n * The type on which this event was created on.\n * @type {T}\n */\n this.target = target\n /**\n * The current target on which the observe callback is called.\n * @type {AbstractType}\n */\n this.currentTarget = target\n /**\n * The transaction that triggered this event.\n * @type {Transaction}\n */\n this.transaction = transaction\n /**\n * @type {Object|null}\n */\n this._changes = null\n /**\n * @type {null | Map}\n */\n this._keys = null\n /**\n * @type {null | Array<{ insert?: string | Array | object | AbstractType, retain?: number, delete?: number, attributes?: Object }>}\n */\n this._delta = null\n /**\n * @type {Array|null}\n */\n this._path = null\n }\n\n /**\n * Computes the path from `y` to the changed type.\n *\n * @todo v14 should standardize on path: Array<{parent, index}> because that is easier to work with.\n *\n * The following property holds:\n * @example\n * let type = y\n * event.path.forEach(dir => {\n * type = type.get(dir)\n * })\n * type === event.target // => true\n */\n get path () {\n return this._path || (this._path = getPathTo(this.currentTarget, this.target))\n }\n\n /**\n * Check if a struct is deleted by this event.\n *\n * In contrast to change.deleted, this method also returns true if the struct was added and then deleted.\n *\n * @param {AbstractStruct} struct\n * @return {boolean}\n */\n deletes (struct) {\n return isDeleted(this.transaction.deleteSet, struct.id)\n }\n\n /**\n * @type {Map}\n */\n get keys () {\n if (this._keys === null) {\n if (this.transaction.doc._transactionCleanups.length === 0) {\n throw error.create(errorComputeChanges)\n }\n const keys = new Map()\n const target = this.target\n const changed = /** @type Set */ (this.transaction.changed.get(target))\n changed.forEach(key => {\n if (key !== null) {\n const item = /** @type {Item} */ (target._map.get(key))\n /**\n * @type {'delete' | 'add' | 'update'}\n */\n let action\n let oldValue\n if (this.adds(item)) {\n let prev = item.left\n while (prev !== null && this.adds(prev)) {\n prev = prev.left\n }\n if (this.deletes(item)) {\n if (prev !== null && this.deletes(prev)) {\n action = 'delete'\n oldValue = array.last(prev.content.getContent())\n } else {\n return\n }\n } else {\n if (prev !== null && this.deletes(prev)) {\n action = 'update'\n oldValue = array.last(prev.content.getContent())\n } else {\n action = 'add'\n oldValue = undefined\n }\n }\n } else {\n if (this.deletes(item)) {\n action = 'delete'\n oldValue = array.last(/** @type {Item} */ item.content.getContent())\n } else {\n return // nop\n }\n }\n keys.set(key, { action, oldValue })\n }\n })\n this._keys = keys\n }\n return this._keys\n }\n\n /**\n * This is a computed property. Note that this can only be safely computed during the\n * event call. Computing this property after other changes happened might result in\n * unexpected behavior (incorrect computation of deltas). A safe way to collect changes\n * is to store the `changes` or the `delta` object. Avoid storing the `transaction` object.\n *\n * @type {Array<{insert?: string | Array | object | AbstractType, retain?: number, delete?: number, attributes?: Object}>}\n */\n get delta () {\n return this.changes.delta\n }\n\n /**\n * Check if a struct is added by this event.\n *\n * In contrast to change.deleted, this method also returns true if the struct was added and then deleted.\n *\n * @param {AbstractStruct} struct\n * @return {boolean}\n */\n adds (struct) {\n return struct.id.clock >= (this.transaction.beforeState.get(struct.id.client) || 0)\n }\n\n /**\n * This is a computed property. Note that this can only be safely computed during the\n * event call. Computing this property after other changes happened might result in\n * unexpected behavior (incorrect computation of deltas). A safe way to collect changes\n * is to store the `changes` or the `delta` object. Avoid storing the `transaction` object.\n *\n * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string, delete?:number, retain?:number}>}}\n */\n get changes () {\n let changes = this._changes\n if (changes === null) {\n if (this.transaction.doc._transactionCleanups.length === 0) {\n throw error.create(errorComputeChanges)\n }\n const target = this.target\n const added = set.create()\n const deleted = set.create()\n /**\n * @type {Array<{insert:Array}|{delete:number}|{retain:number}>}\n */\n const delta = []\n changes = {\n added,\n deleted,\n delta,\n keys: this.keys\n }\n const changed = /** @type Set */ (this.transaction.changed.get(target))\n if (changed.has(null)) {\n /**\n * @type {any}\n */\n let lastOp = null\n const packOp = () => {\n if (lastOp) {\n delta.push(lastOp)\n }\n }\n for (let item = target._start; item !== null; item = item.right) {\n if (item.deleted) {\n if (this.deletes(item) && !this.adds(item)) {\n if (lastOp === null || lastOp.delete === undefined) {\n packOp()\n lastOp = { delete: 0 }\n }\n lastOp.delete += item.length\n deleted.add(item)\n } // else nop\n } else {\n if (this.adds(item)) {\n if (lastOp === null || lastOp.insert === undefined) {\n packOp()\n lastOp = { insert: [] }\n }\n lastOp.insert = lastOp.insert.concat(item.content.getContent())\n added.add(item)\n } else {\n if (lastOp === null || lastOp.retain === undefined) {\n packOp()\n lastOp = { retain: 0 }\n }\n lastOp.retain += item.length\n }\n }\n }\n if (lastOp !== null && lastOp.retain === undefined) {\n packOp()\n }\n }\n this._changes = changes\n }\n return /** @type {any} */ (changes)\n }\n}\n\n/**\n * Compute the path from this type to the specified target.\n *\n * @example\n * // `child` should be accessible via `type.get(path[0]).get(path[1])..`\n * const path = type.getPathTo(child)\n * // assuming `type instanceof YArray`\n * console.log(path) // might look like => [2, 'key1']\n * child === type.get(path[0]).get(path[1])\n *\n * @param {AbstractType} parent\n * @param {AbstractType} child target\n * @return {Array} Path to the target\n *\n * @private\n * @function\n */\nconst getPathTo = (parent, child) => {\n const path = []\n while (child._item !== null && child !== parent) {\n if (child._item.parentSub !== null) {\n // parent is map-ish\n path.unshift(child._item.parentSub)\n } else {\n // parent is array-ish\n let i = 0\n let c = /** @type {AbstractType} */ (child._item.parent)._start\n while (c !== child._item && c !== null) {\n if (!c.deleted && c.countable) {\n i += c.length\n }\n c = c.right\n }\n path.unshift(i)\n }\n child = /** @type {AbstractType} */ (child._item.parent)\n }\n return path\n}\n","import {\n removeEventHandlerListener,\n callEventHandlerListeners,\n addEventHandlerListener,\n createEventHandler,\n getState,\n isVisible,\n ContentType,\n createID,\n ContentAny,\n ContentBinary,\n getItemCleanStart,\n ContentDoc, YText, YArray, UpdateEncoderV1, UpdateEncoderV2, Doc, Snapshot, Transaction, EventHandler, YEvent, Item, // eslint-disable-line\n} from '../internals.js'\n\nimport * as map from 'lib0/map'\nimport * as iterator from 'lib0/iterator'\nimport * as error from 'lib0/error'\nimport * as math from 'lib0/math'\nimport * as log from 'lib0/logging'\n\n/**\n * https://docs.yjs.dev/getting-started/working-with-shared-types#caveats\n */\nexport const warnPrematureAccess = () => { log.warn('Invalid access: Add Yjs type to a document before reading data.') }\n\nconst maxSearchMarker = 80\n\n/**\n * A unique timestamp that identifies each marker.\n *\n * Time is relative,.. this is more like an ever-increasing clock.\n *\n * @type {number}\n */\nlet globalSearchMarkerTimestamp = 0\n\nexport class ArraySearchMarker {\n /**\n * @param {Item} p\n * @param {number} index\n */\n constructor (p, index) {\n p.marker = true\n this.p = p\n this.index = index\n this.timestamp = globalSearchMarkerTimestamp++\n }\n}\n\n/**\n * @param {ArraySearchMarker} marker\n */\nconst refreshMarkerTimestamp = marker => { marker.timestamp = globalSearchMarkerTimestamp++ }\n\n/**\n * This is rather complex so this function is the only thing that should overwrite a marker\n *\n * @param {ArraySearchMarker} marker\n * @param {Item} p\n * @param {number} index\n */\nconst overwriteMarker = (marker, p, index) => {\n marker.p.marker = false\n marker.p = p\n p.marker = true\n marker.index = index\n marker.timestamp = globalSearchMarkerTimestamp++\n}\n\n/**\n * @param {Array} searchMarker\n * @param {Item} p\n * @param {number} index\n */\nconst markPosition = (searchMarker, p, index) => {\n if (searchMarker.length >= maxSearchMarker) {\n // override oldest marker (we don't want to create more objects)\n const marker = searchMarker.reduce((a, b) => a.timestamp < b.timestamp ? a : b)\n overwriteMarker(marker, p, index)\n return marker\n } else {\n // create new marker\n const pm = new ArraySearchMarker(p, index)\n searchMarker.push(pm)\n return pm\n }\n}\n\n/**\n * Search marker help us to find positions in the associative array faster.\n *\n * They speed up the process of finding a position without much bookkeeping.\n *\n * A maximum of `maxSearchMarker` objects are created.\n *\n * This function always returns a refreshed marker (updated timestamp)\n *\n * @param {AbstractType} yarray\n * @param {number} index\n */\nexport const findMarker = (yarray, index) => {\n if (yarray._start === null || index === 0 || yarray._searchMarker === null) {\n return null\n }\n const marker = yarray._searchMarker.length === 0 ? null : yarray._searchMarker.reduce((a, b) => math.abs(index - a.index) < math.abs(index - b.index) ? a : b)\n let p = yarray._start\n let pindex = 0\n if (marker !== null) {\n p = marker.p\n pindex = marker.index\n refreshMarkerTimestamp(marker) // we used it, we might need to use it again\n }\n // iterate to right if possible\n while (p.right !== null && pindex < index) {\n if (!p.deleted && p.countable) {\n if (index < pindex + p.length) {\n break\n }\n pindex += p.length\n }\n p = p.right\n }\n // iterate to left if necessary (might be that pindex > index)\n while (p.left !== null && pindex > index) {\n p = p.left\n if (!p.deleted && p.countable) {\n pindex -= p.length\n }\n }\n // we want to make sure that p can't be merged with left, because that would screw up everything\n // in that cas just return what we have (it is most likely the best marker anyway)\n // iterate to left until p can't be merged with left\n while (p.left !== null && p.left.id.client === p.id.client && p.left.id.clock + p.left.length === p.id.clock) {\n p = p.left\n if (!p.deleted && p.countable) {\n pindex -= p.length\n }\n }\n\n // @todo remove!\n // assure position\n // {\n // let start = yarray._start\n // let pos = 0\n // while (start !== p) {\n // if (!start.deleted && start.countable) {\n // pos += start.length\n // }\n // start = /** @type {Item} */ (start.right)\n // }\n // if (pos !== pindex) {\n // debugger\n // throw new Error('Gotcha position fail!')\n // }\n // }\n // if (marker) {\n // if (window.lengths == null) {\n // window.lengths = []\n // window.getLengths = () => window.lengths.sort((a, b) => a - b)\n // }\n // window.lengths.push(marker.index - pindex)\n // console.log('distance', marker.index - pindex, 'len', p && p.parent.length)\n // }\n if (marker !== null && math.abs(marker.index - pindex) < /** @type {YText|YArray} */ (p.parent).length / maxSearchMarker) {\n // adjust existing marker\n overwriteMarker(marker, p, pindex)\n return marker\n } else {\n // create new marker\n return markPosition(yarray._searchMarker, p, pindex)\n }\n}\n\n/**\n * Update markers when a change happened.\n *\n * This should be called before doing a deletion!\n *\n * @param {Array} searchMarker\n * @param {number} index\n * @param {number} len If insertion, len is positive. If deletion, len is negative.\n */\nexport const updateMarkerChanges = (searchMarker, index, len) => {\n for (let i = searchMarker.length - 1; i >= 0; i--) {\n const m = searchMarker[i]\n if (len > 0) {\n /**\n * @type {Item|null}\n */\n let p = m.p\n p.marker = false\n // Ideally we just want to do a simple position comparison, but this will only work if\n // search markers don't point to deleted items for formats.\n // Iterate marker to prev undeleted countable position so we know what to do when updating a position\n while (p && (p.deleted || !p.countable)) {\n p = p.left\n if (p && !p.deleted && p.countable) {\n // adjust position. the loop should break now\n m.index -= p.length\n }\n }\n if (p === null || p.marker === true) {\n // remove search marker if updated position is null or if position is already marked\n searchMarker.splice(i, 1)\n continue\n }\n m.p = p\n p.marker = true\n }\n if (index < m.index || (len > 0 && index === m.index)) { // a simple index <= m.index check would actually suffice\n m.index = math.max(index, m.index + len)\n }\n }\n}\n\n/**\n * Accumulate all (list) children of a type and return them as an Array.\n *\n * @param {AbstractType} t\n * @return {Array}\n */\nexport const getTypeChildren = t => {\n t.doc ?? warnPrematureAccess()\n let s = t._start\n const arr = []\n while (s) {\n arr.push(s)\n s = s.right\n }\n return arr\n}\n\n/**\n * Call event listeners with an event. This will also add an event to all\n * parents (for `.observeDeep` handlers).\n *\n * @template EventType\n * @param {AbstractType} type\n * @param {Transaction} transaction\n * @param {EventType} event\n */\nexport const callTypeObservers = (type, transaction, event) => {\n const changedType = type\n const changedParentTypes = transaction.changedParentTypes\n while (true) {\n // @ts-ignore\n map.setIfUndefined(changedParentTypes, type, () => []).push(event)\n if (type._item === null) {\n break\n }\n type = /** @type {AbstractType} */ (type._item.parent)\n }\n callEventHandlerListeners(changedType._eH, event, transaction)\n}\n\n/**\n * @template EventType\n * Abstract Yjs Type class\n */\nexport class AbstractType {\n constructor () {\n /**\n * @type {Item|null}\n */\n this._item = null\n /**\n * @type {Map}\n */\n this._map = new Map()\n /**\n * @type {Item|null}\n */\n this._start = null\n /**\n * @type {Doc|null}\n */\n this.doc = null\n this._length = 0\n /**\n * Event handlers\n * @type {EventHandler}\n */\n this._eH = createEventHandler()\n /**\n * Deep event handlers\n * @type {EventHandler>,Transaction>}\n */\n this._dEH = createEventHandler()\n /**\n * @type {null | Array}\n */\n this._searchMarker = null\n }\n\n /**\n * @return {AbstractType|null}\n */\n get parent () {\n return this._item ? /** @type {AbstractType} */ (this._item.parent) : null\n }\n\n /**\n * Integrate this type into the Yjs instance.\n *\n * * Save this struct in the os\n * * This type is sent to other client\n * * Observer functions are fired\n *\n * @param {Doc} y The Yjs instance\n * @param {Item|null} item\n */\n _integrate (y, item) {\n this.doc = y\n this._item = item\n }\n\n /**\n * @return {AbstractType}\n */\n _copy () {\n throw error.methodUnimplemented()\n }\n\n /**\n * Makes a copy of this data type that can be included somewhere else.\n *\n * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.\n *\n * @return {AbstractType}\n */\n clone () {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} _encoder\n */\n _write (_encoder) { }\n\n /**\n * The first non-deleted item\n */\n get _first () {\n let n = this._start\n while (n !== null && n.deleted) {\n n = n.right\n }\n return n\n }\n\n /**\n * Creates YEvent and calls all type observers.\n * Must be implemented by each type.\n *\n * @param {Transaction} transaction\n * @param {Set} _parentSubs Keys changed on this type. `null` if list was modified.\n */\n _callObserver (transaction, _parentSubs) {\n if (!transaction.local && this._searchMarker) {\n this._searchMarker.length = 0\n }\n }\n\n /**\n * Observe all events that are created on this type.\n *\n * @param {function(EventType, Transaction):void} f Observer function\n */\n observe (f) {\n addEventHandlerListener(this._eH, f)\n }\n\n /**\n * Observe all events that are created by this type and its children.\n *\n * @param {function(Array>,Transaction):void} f Observer function\n */\n observeDeep (f) {\n addEventHandlerListener(this._dEH, f)\n }\n\n /**\n * Unregister an observer function.\n *\n * @param {function(EventType,Transaction):void} f Observer function\n */\n unobserve (f) {\n removeEventHandlerListener(this._eH, f)\n }\n\n /**\n * Unregister an observer function.\n *\n * @param {function(Array>,Transaction):void} f Observer function\n */\n unobserveDeep (f) {\n removeEventHandlerListener(this._dEH, f)\n }\n\n /**\n * @abstract\n * @return {any}\n */\n toJSON () {}\n}\n\n/**\n * @param {AbstractType} type\n * @param {number} start\n * @param {number} end\n * @return {Array}\n *\n * @private\n * @function\n */\nexport const typeListSlice = (type, start, end) => {\n type.doc ?? warnPrematureAccess()\n if (start < 0) {\n start = type._length + start\n }\n if (end < 0) {\n end = type._length + end\n }\n let len = end - start\n const cs = []\n let n = type._start\n while (n !== null && len > 0) {\n if (n.countable && !n.deleted) {\n const c = n.content.getContent()\n if (c.length <= start) {\n start -= c.length\n } else {\n for (let i = start; i < c.length && len > 0; i++) {\n cs.push(c[i])\n len--\n }\n start = 0\n }\n }\n n = n.right\n }\n return cs\n}\n\n/**\n * @param {AbstractType} type\n * @return {Array}\n *\n * @private\n * @function\n */\nexport const typeListToArray = type => {\n type.doc ?? warnPrematureAccess()\n const cs = []\n let n = type._start\n while (n !== null) {\n if (n.countable && !n.deleted) {\n const c = n.content.getContent()\n for (let i = 0; i < c.length; i++) {\n cs.push(c[i])\n }\n }\n n = n.right\n }\n return cs\n}\n\n/**\n * @param {AbstractType} type\n * @param {Snapshot} snapshot\n * @return {Array}\n *\n * @private\n * @function\n */\nexport const typeListToArraySnapshot = (type, snapshot) => {\n const cs = []\n let n = type._start\n while (n !== null) {\n if (n.countable && isVisible(n, snapshot)) {\n const c = n.content.getContent()\n for (let i = 0; i < c.length; i++) {\n cs.push(c[i])\n }\n }\n n = n.right\n }\n return cs\n}\n\n/**\n * Executes a provided function on once on every element of this YArray.\n *\n * @param {AbstractType} type\n * @param {function(any,number,any):void} f A function to execute on every element of this YArray.\n *\n * @private\n * @function\n */\nexport const typeListForEach = (type, f) => {\n let index = 0\n let n = type._start\n type.doc ?? warnPrematureAccess()\n while (n !== null) {\n if (n.countable && !n.deleted) {\n const c = n.content.getContent()\n for (let i = 0; i < c.length; i++) {\n f(c[i], index++, type)\n }\n }\n n = n.right\n }\n}\n\n/**\n * @template C,R\n * @param {AbstractType} type\n * @param {function(C,number,AbstractType):R} f\n * @return {Array}\n *\n * @private\n * @function\n */\nexport const typeListMap = (type, f) => {\n /**\n * @type {Array}\n */\n const result = []\n typeListForEach(type, (c, i) => {\n result.push(f(c, i, type))\n })\n return result\n}\n\n/**\n * @param {AbstractType} type\n * @return {IterableIterator}\n *\n * @private\n * @function\n */\nexport const typeListCreateIterator = type => {\n let n = type._start\n /**\n * @type {Array|null}\n */\n let currentContent = null\n let currentContentIndex = 0\n return {\n [Symbol.iterator] () {\n return this\n },\n next: () => {\n // find some content\n if (currentContent === null) {\n while (n !== null && n.deleted) {\n n = n.right\n }\n // check if we reached the end, no need to check currentContent, because it does not exist\n if (n === null) {\n return {\n done: true,\n value: undefined\n }\n }\n // we found n, so we can set currentContent\n currentContent = n.content.getContent()\n currentContentIndex = 0\n n = n.right // we used the content of n, now iterate to next\n }\n const value = currentContent[currentContentIndex++]\n // check if we need to empty currentContent\n if (currentContent.length <= currentContentIndex) {\n currentContent = null\n }\n return {\n done: false,\n value\n }\n }\n }\n}\n\n/**\n * Executes a provided function on once on every element of this YArray.\n * Operates on a snapshotted state of the document.\n *\n * @param {AbstractType} type\n * @param {function(any,number,AbstractType):void} f A function to execute on every element of this YArray.\n * @param {Snapshot} snapshot\n *\n * @private\n * @function\n */\nexport const typeListForEachSnapshot = (type, f, snapshot) => {\n let index = 0\n let n = type._start\n while (n !== null) {\n if (n.countable && isVisible(n, snapshot)) {\n const c = n.content.getContent()\n for (let i = 0; i < c.length; i++) {\n f(c[i], index++, type)\n }\n }\n n = n.right\n }\n}\n\n/**\n * @param {AbstractType} type\n * @param {number} index\n * @return {any}\n *\n * @private\n * @function\n */\nexport const typeListGet = (type, index) => {\n type.doc ?? warnPrematureAccess()\n const marker = findMarker(type, index)\n let n = type._start\n if (marker !== null) {\n n = marker.p\n index -= marker.index\n }\n for (; n !== null; n = n.right) {\n if (!n.deleted && n.countable) {\n if (index < n.length) {\n return n.content.getContent()[index]\n }\n index -= n.length\n }\n }\n}\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {Item?} referenceItem\n * @param {Array|Array|boolean|number|null|string|Uint8Array>} content\n *\n * @private\n * @function\n */\nexport const typeListInsertGenericsAfter = (transaction, parent, referenceItem, content) => {\n let left = referenceItem\n const doc = transaction.doc\n const ownClientId = doc.clientID\n const store = doc.store\n const right = referenceItem === null ? parent._start : referenceItem.right\n /**\n * @type {Array|number|null>}\n */\n let jsonContent = []\n const packJsonContent = () => {\n if (jsonContent.length > 0) {\n left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentAny(jsonContent))\n left.integrate(transaction, 0)\n jsonContent = []\n }\n }\n content.forEach(c => {\n if (c === null) {\n jsonContent.push(c)\n } else {\n switch (c.constructor) {\n case Number:\n case Object:\n case Boolean:\n case Array:\n case String:\n jsonContent.push(c)\n break\n default:\n packJsonContent()\n switch (c.constructor) {\n case Uint8Array:\n case ArrayBuffer:\n left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentBinary(new Uint8Array(/** @type {Uint8Array} */ (c))))\n left.integrate(transaction, 0)\n break\n case Doc:\n left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentDoc(/** @type {Doc} */ (c)))\n left.integrate(transaction, 0)\n break\n default:\n if (c instanceof AbstractType) {\n left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentType(c))\n left.integrate(transaction, 0)\n } else {\n throw new Error('Unexpected content type in insert operation')\n }\n }\n }\n }\n })\n packJsonContent()\n}\n\nconst lengthExceeded = () => error.create('Length exceeded!')\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {number} index\n * @param {Array|Array|number|null|string|Uint8Array>} content\n *\n * @private\n * @function\n */\nexport const typeListInsertGenerics = (transaction, parent, index, content) => {\n if (index > parent._length) {\n throw lengthExceeded()\n }\n if (index === 0) {\n if (parent._searchMarker) {\n updateMarkerChanges(parent._searchMarker, index, content.length)\n }\n return typeListInsertGenericsAfter(transaction, parent, null, content)\n }\n const startIndex = index\n const marker = findMarker(parent, index)\n let n = parent._start\n if (marker !== null) {\n n = marker.p\n index -= marker.index\n // we need to iterate one to the left so that the algorithm works\n if (index === 0) {\n // @todo refactor this as it actually doesn't consider formats\n n = n.prev // important! get the left undeleted item so that we can actually decrease index\n index += (n && n.countable && !n.deleted) ? n.length : 0\n }\n }\n for (; n !== null; n = n.right) {\n if (!n.deleted && n.countable) {\n if (index <= n.length) {\n if (index < n.length) {\n // insert in-between\n getItemCleanStart(transaction, createID(n.id.client, n.id.clock + index))\n }\n break\n }\n index -= n.length\n }\n }\n if (parent._searchMarker) {\n updateMarkerChanges(parent._searchMarker, startIndex, content.length)\n }\n return typeListInsertGenericsAfter(transaction, parent, n, content)\n}\n\n/**\n * Pushing content is special as we generally want to push after the last item. So we don't have to update\n * the search marker.\n *\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {Array|Array|number|null|string|Uint8Array>} content\n *\n * @private\n * @function\n */\nexport const typeListPushGenerics = (transaction, parent, content) => {\n // Use the marker with the highest index and iterate to the right.\n const marker = (parent._searchMarker || []).reduce((maxMarker, currMarker) => currMarker.index > maxMarker.index ? currMarker : maxMarker, { index: 0, p: parent._start })\n let n = marker.p\n if (n) {\n while (n.right) {\n n = n.right\n }\n }\n return typeListInsertGenericsAfter(transaction, parent, n, content)\n}\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {number} index\n * @param {number} length\n *\n * @private\n * @function\n */\nexport const typeListDelete = (transaction, parent, index, length) => {\n if (length === 0) { return }\n const startIndex = index\n const startLength = length\n const marker = findMarker(parent, index)\n let n = parent._start\n if (marker !== null) {\n n = marker.p\n index -= marker.index\n }\n // compute the first item to be deleted\n for (; n !== null && index > 0; n = n.right) {\n if (!n.deleted && n.countable) {\n if (index < n.length) {\n getItemCleanStart(transaction, createID(n.id.client, n.id.clock + index))\n }\n index -= n.length\n }\n }\n // delete all items until done\n while (length > 0 && n !== null) {\n if (!n.deleted) {\n if (length < n.length) {\n getItemCleanStart(transaction, createID(n.id.client, n.id.clock + length))\n }\n n.delete(transaction)\n length -= n.length\n }\n n = n.right\n }\n if (length > 0) {\n throw lengthExceeded()\n }\n if (parent._searchMarker) {\n updateMarkerChanges(parent._searchMarker, startIndex, -startLength + length /* in case we remove the above exception */)\n }\n}\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {string} key\n *\n * @private\n * @function\n */\nexport const typeMapDelete = (transaction, parent, key) => {\n const c = parent._map.get(key)\n if (c !== undefined) {\n c.delete(transaction)\n }\n}\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {string} key\n * @param {Object|number|null|Array|string|Uint8Array|AbstractType} value\n *\n * @private\n * @function\n */\nexport const typeMapSet = (transaction, parent, key, value) => {\n const left = parent._map.get(key) || null\n const doc = transaction.doc\n const ownClientId = doc.clientID\n let content\n if (value == null) {\n content = new ContentAny([value])\n } else {\n switch (value.constructor) {\n case Number:\n case Object:\n case Boolean:\n case Array:\n case String:\n case Date:\n case BigInt:\n content = new ContentAny([value])\n break\n case Uint8Array:\n content = new ContentBinary(/** @type {Uint8Array} */ (value))\n break\n case Doc:\n content = new ContentDoc(/** @type {Doc} */ (value))\n break\n default:\n if (value instanceof AbstractType) {\n content = new ContentType(value)\n } else {\n throw new Error('Unexpected content type')\n }\n }\n }\n new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, null, null, parent, key, content).integrate(transaction, 0)\n}\n\n/**\n * @param {AbstractType} parent\n * @param {string} key\n * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined}\n *\n * @private\n * @function\n */\nexport const typeMapGet = (parent, key) => {\n parent.doc ?? warnPrematureAccess()\n const val = parent._map.get(key)\n return val !== undefined && !val.deleted ? val.content.getContent()[val.length - 1] : undefined\n}\n\n/**\n * @param {AbstractType} parent\n * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined>}\n *\n * @private\n * @function\n */\nexport const typeMapGetAll = (parent) => {\n /**\n * @type {Object}\n */\n const res = {}\n parent.doc ?? warnPrematureAccess()\n parent._map.forEach((value, key) => {\n if (!value.deleted) {\n res[key] = value.content.getContent()[value.length - 1]\n }\n })\n return res\n}\n\n/**\n * @param {AbstractType} parent\n * @param {string} key\n * @return {boolean}\n *\n * @private\n * @function\n */\nexport const typeMapHas = (parent, key) => {\n parent.doc ?? warnPrematureAccess()\n const val = parent._map.get(key)\n return val !== undefined && !val.deleted\n}\n\n/**\n * @param {AbstractType} parent\n * @param {string} key\n * @param {Snapshot} snapshot\n * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined}\n *\n * @private\n * @function\n */\nexport const typeMapGetSnapshot = (parent, key, snapshot) => {\n let v = parent._map.get(key) || null\n while (v !== null && (!snapshot.sv.has(v.id.client) || v.id.clock >= (snapshot.sv.get(v.id.client) || 0))) {\n v = v.left\n }\n return v !== null && isVisible(v, snapshot) ? v.content.getContent()[v.length - 1] : undefined\n}\n\n/**\n * @param {AbstractType} parent\n * @param {Snapshot} snapshot\n * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined>}\n *\n * @private\n * @function\n */\nexport const typeMapGetAllSnapshot = (parent, snapshot) => {\n /**\n * @type {Object}\n */\n const res = {}\n parent._map.forEach((value, key) => {\n /**\n * @type {Item|null}\n */\n let v = value\n while (v !== null && (!snapshot.sv.has(v.id.client) || v.id.clock >= (snapshot.sv.get(v.id.client) || 0))) {\n v = v.left\n }\n if (v !== null && isVisible(v, snapshot)) {\n res[key] = v.content.getContent()[v.length - 1]\n }\n })\n return res\n}\n\n/**\n * @param {AbstractType & { _map: Map }} type\n * @return {IterableIterator>}\n *\n * @private\n * @function\n */\nexport const createMapIterator = type => {\n type.doc ?? warnPrematureAccess()\n return iterator.iteratorFilter(type._map.entries(), /** @param {any} entry */ entry => !entry[1].deleted)\n}\n","/**\n * @module YArray\n */\n\nimport {\n YEvent,\n AbstractType,\n typeListGet,\n typeListToArray,\n typeListForEach,\n typeListCreateIterator,\n typeListInsertGenerics,\n typeListPushGenerics,\n typeListDelete,\n typeListMap,\n YArrayRefID,\n callTypeObservers,\n transact,\n warnPrematureAccess,\n ArraySearchMarker, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Doc, Transaction, Item // eslint-disable-line\n} from '../internals.js'\nimport { typeListSlice } from './AbstractType.js'\n\n/**\n * Event that describes the changes on a YArray\n * @template T\n * @extends YEvent>\n */\nexport class YArrayEvent extends YEvent {}\n\n/**\n * A shared Array implementation.\n * @template T\n * @extends AbstractType>\n * @implements {Iterable}\n */\nexport class YArray extends AbstractType {\n constructor () {\n super()\n /**\n * @type {Array?}\n * @private\n */\n this._prelimContent = []\n /**\n * @type {Array}\n */\n this._searchMarker = []\n }\n\n /**\n * Construct a new YArray containing the specified items.\n * @template {Object|Array|number|null|string|Uint8Array} T\n * @param {Array} items\n * @return {YArray}\n */\n static from (items) {\n /**\n * @type {YArray}\n */\n const a = new YArray()\n a.push(items)\n return a\n }\n\n /**\n * Integrate this type into the Yjs instance.\n *\n * * Save this struct in the os\n * * This type is sent to other client\n * * Observer functions are fired\n *\n * @param {Doc} y The Yjs instance\n * @param {Item} item\n */\n _integrate (y, item) {\n super._integrate(y, item)\n this.insert(0, /** @type {Array} */ (this._prelimContent))\n this._prelimContent = null\n }\n\n /**\n * @return {YArray}\n */\n _copy () {\n return new YArray()\n }\n\n /**\n * Makes a copy of this data type that can be included somewhere else.\n *\n * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.\n *\n * @return {YArray}\n */\n clone () {\n /**\n * @type {YArray}\n */\n const arr = new YArray()\n arr.insert(0, this.toArray().map(el =>\n el instanceof AbstractType ? /** @type {typeof el} */ (el.clone()) : el\n ))\n return arr\n }\n\n get length () {\n this.doc ?? warnPrematureAccess()\n return this._length\n }\n\n /**\n * Creates YArrayEvent and calls observers.\n *\n * @param {Transaction} transaction\n * @param {Set} parentSubs Keys changed on this type. `null` if list was modified.\n */\n _callObserver (transaction, parentSubs) {\n super._callObserver(transaction, parentSubs)\n callTypeObservers(this, transaction, new YArrayEvent(this, transaction))\n }\n\n /**\n * Inserts new content at an index.\n *\n * Important: This function expects an array of content. Not just a content\n * object. The reason for this \"weirdness\" is that inserting several elements\n * is very efficient when it is done as a single operation.\n *\n * @example\n * // Insert character 'a' at position 0\n * yarray.insert(0, ['a'])\n * // Insert numbers 1, 2 at position 1\n * yarray.insert(1, [1, 2])\n *\n * @param {number} index The index to insert content at.\n * @param {Array} content The array of content\n */\n insert (index, content) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeListInsertGenerics(transaction, this, index, /** @type {any} */ (content))\n })\n } else {\n /** @type {Array} */ (this._prelimContent).splice(index, 0, ...content)\n }\n }\n\n /**\n * Appends content to this YArray.\n *\n * @param {Array} content Array of content to append.\n *\n * @todo Use the following implementation in all types.\n */\n push (content) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeListPushGenerics(transaction, this, /** @type {any} */ (content))\n })\n } else {\n /** @type {Array} */ (this._prelimContent).push(...content)\n }\n }\n\n /**\n * Prepends content to this YArray.\n *\n * @param {Array} content Array of content to prepend.\n */\n unshift (content) {\n this.insert(0, content)\n }\n\n /**\n * Deletes elements starting from an index.\n *\n * @param {number} index Index at which to start deleting elements\n * @param {number} length The number of elements to remove. Defaults to 1.\n */\n delete (index, length = 1) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeListDelete(transaction, this, index, length)\n })\n } else {\n /** @type {Array} */ (this._prelimContent).splice(index, length)\n }\n }\n\n /**\n * Returns the i-th element from a YArray.\n *\n * @param {number} index The index of the element to return from the YArray\n * @return {T}\n */\n get (index) {\n return typeListGet(this, index)\n }\n\n /**\n * Transforms this YArray to a JavaScript Array.\n *\n * @return {Array}\n */\n toArray () {\n return typeListToArray(this)\n }\n\n /**\n * Returns a portion of this YArray into a JavaScript Array selected\n * from start to end (end not included).\n *\n * @param {number} [start]\n * @param {number} [end]\n * @return {Array}\n */\n slice (start = 0, end = this.length) {\n return typeListSlice(this, start, end)\n }\n\n /**\n * Transforms this Shared Type to a JSON object.\n *\n * @return {Array}\n */\n toJSON () {\n return this.map(c => c instanceof AbstractType ? c.toJSON() : c)\n }\n\n /**\n * Returns an Array with the result of calling a provided function on every\n * element of this YArray.\n *\n * @template M\n * @param {function(T,number,YArray):M} f Function that produces an element of the new Array\n * @return {Array} A new array with each element being the result of the\n * callback function\n */\n map (f) {\n return typeListMap(this, /** @type {any} */ (f))\n }\n\n /**\n * Executes a provided function once on every element of this YArray.\n *\n * @param {function(T,number,YArray):void} f A function to execute on every element of this YArray.\n */\n forEach (f) {\n typeListForEach(this, f)\n }\n\n /**\n * @return {IterableIterator}\n */\n [Symbol.iterator] () {\n return typeListCreateIterator(this)\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n */\n _write (encoder) {\n encoder.writeTypeRef(YArrayRefID)\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder\n *\n * @private\n * @function\n */\nexport const readYArray = _decoder => new YArray()\n","/**\n * @module YMap\n */\n\nimport {\n YEvent,\n AbstractType,\n typeMapDelete,\n typeMapSet,\n typeMapGet,\n typeMapHas,\n createMapIterator,\n YMapRefID,\n callTypeObservers,\n transact,\n warnPrematureAccess,\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Doc, Transaction, Item // eslint-disable-line\n} from '../internals.js'\n\nimport * as iterator from 'lib0/iterator'\n\n/**\n * @template T\n * @extends YEvent>\n * Event that describes the changes on a YMap.\n */\nexport class YMapEvent extends YEvent {\n /**\n * @param {YMap} ymap The YArray that changed.\n * @param {Transaction} transaction\n * @param {Set} subs The keys that changed.\n */\n constructor (ymap, transaction, subs) {\n super(ymap, transaction)\n this.keysChanged = subs\n }\n}\n\n/**\n * @template MapType\n * A shared Map implementation.\n *\n * @extends AbstractType>\n * @implements {Iterable<[string, MapType]>}\n */\nexport class YMap extends AbstractType {\n /**\n *\n * @param {Iterable=} entries - an optional iterable to initialize the YMap\n */\n constructor (entries) {\n super()\n /**\n * @type {Map?}\n * @private\n */\n this._prelimContent = null\n\n if (entries === undefined) {\n this._prelimContent = new Map()\n } else {\n this._prelimContent = new Map(entries)\n }\n }\n\n /**\n * Integrate this type into the Yjs instance.\n *\n * * Save this struct in the os\n * * This type is sent to other client\n * * Observer functions are fired\n *\n * @param {Doc} y The Yjs instance\n * @param {Item} item\n */\n _integrate (y, item) {\n super._integrate(y, item)\n ;/** @type {Map} */ (this._prelimContent).forEach((value, key) => {\n this.set(key, value)\n })\n this._prelimContent = null\n }\n\n /**\n * @return {YMap}\n */\n _copy () {\n return new YMap()\n }\n\n /**\n * Makes a copy of this data type that can be included somewhere else.\n *\n * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.\n *\n * @return {YMap}\n */\n clone () {\n /**\n * @type {YMap}\n */\n const map = new YMap()\n this.forEach((value, key) => {\n map.set(key, value instanceof AbstractType ? /** @type {typeof value} */ (value.clone()) : value)\n })\n return map\n }\n\n /**\n * Creates YMapEvent and calls observers.\n *\n * @param {Transaction} transaction\n * @param {Set} parentSubs Keys changed on this type. `null` if list was modified.\n */\n _callObserver (transaction, parentSubs) {\n callTypeObservers(this, transaction, new YMapEvent(this, transaction, parentSubs))\n }\n\n /**\n * Transforms this Shared Type to a JSON object.\n *\n * @return {Object}\n */\n toJSON () {\n this.doc ?? warnPrematureAccess()\n /**\n * @type {Object}\n */\n const map = {}\n this._map.forEach((item, key) => {\n if (!item.deleted) {\n const v = item.content.getContent()[item.length - 1]\n map[key] = v instanceof AbstractType ? v.toJSON() : v\n }\n })\n return map\n }\n\n /**\n * Returns the size of the YMap (count of key/value pairs)\n *\n * @return {number}\n */\n get size () {\n return [...createMapIterator(this)].length\n }\n\n /**\n * Returns the keys for each element in the YMap Type.\n *\n * @return {IterableIterator}\n */\n keys () {\n return iterator.iteratorMap(createMapIterator(this), /** @param {any} v */ v => v[0])\n }\n\n /**\n * Returns the values for each element in the YMap Type.\n *\n * @return {IterableIterator}\n */\n values () {\n return iterator.iteratorMap(createMapIterator(this), /** @param {any} v */ v => v[1].content.getContent()[v[1].length - 1])\n }\n\n /**\n * Returns an Iterator of [key, value] pairs\n *\n * @return {IterableIterator<[string, MapType]>}\n */\n entries () {\n return iterator.iteratorMap(createMapIterator(this), /** @param {any} v */ v => /** @type {any} */ ([v[0], v[1].content.getContent()[v[1].length - 1]]))\n }\n\n /**\n * Executes a provided function on once on every key-value pair.\n *\n * @param {function(MapType,string,YMap):void} f A function to execute on every element of this YArray.\n */\n forEach (f) {\n this.doc ?? warnPrematureAccess()\n this._map.forEach((item, key) => {\n if (!item.deleted) {\n f(item.content.getContent()[item.length - 1], key, this)\n }\n })\n }\n\n /**\n * Returns an Iterator of [key, value] pairs\n *\n * @return {IterableIterator<[string, MapType]>}\n */\n [Symbol.iterator] () {\n return this.entries()\n }\n\n /**\n * Remove a specified element from this YMap.\n *\n * @param {string} key The key of the element to remove.\n */\n delete (key) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeMapDelete(transaction, this, key)\n })\n } else {\n /** @type {Map} */ (this._prelimContent).delete(key)\n }\n }\n\n /**\n * Adds or updates an element with a specified key and value.\n * @template {MapType} VAL\n *\n * @param {string} key The key of the element to add to this YMap\n * @param {VAL} value The value of the element to add\n * @return {VAL}\n */\n set (key, value) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeMapSet(transaction, this, key, /** @type {any} */ (value))\n })\n } else {\n /** @type {Map} */ (this._prelimContent).set(key, value)\n }\n return value\n }\n\n /**\n * Returns a specified element from this YMap.\n *\n * @param {string} key\n * @return {MapType|undefined}\n */\n get (key) {\n return /** @type {any} */ (typeMapGet(this, key))\n }\n\n /**\n * Returns a boolean indicating whether the specified key exists or not.\n *\n * @param {string} key The key to test.\n * @return {boolean}\n */\n has (key) {\n return typeMapHas(this, key)\n }\n\n /**\n * Removes all elements from this YMap.\n */\n clear () {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n this.forEach(function (_value, key, map) {\n typeMapDelete(transaction, map, key)\n })\n })\n } else {\n /** @type {Map} */ (this._prelimContent).clear()\n }\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n */\n _write (encoder) {\n encoder.writeTypeRef(YMapRefID)\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder\n *\n * @private\n * @function\n */\nexport const readYMap = _decoder => new YMap()\n","/**\n * @module YText\n */\n\nimport {\n YEvent,\n AbstractType,\n getItemCleanStart,\n getState,\n isVisible,\n createID,\n YTextRefID,\n callTypeObservers,\n transact,\n ContentEmbed,\n GC,\n ContentFormat,\n ContentString,\n splitSnapshotAffectedStructs,\n iterateDeletedStructs,\n iterateStructs,\n findMarker,\n typeMapDelete,\n typeMapSet,\n typeMapGet,\n typeMapGetAll,\n updateMarkerChanges,\n ContentType,\n warnPrematureAccess,\n ArraySearchMarker, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, ID, Doc, Item, Snapshot, Transaction // eslint-disable-line\n} from '../internals.js'\n\nimport * as object from 'lib0/object'\nimport * as map from 'lib0/map'\nimport * as error from 'lib0/error'\n\n/**\n * @param {any} a\n * @param {any} b\n * @return {boolean}\n */\nconst equalAttrs = (a, b) => a === b || (typeof a === 'object' && typeof b === 'object' && a && b && object.equalFlat(a, b))\n\nexport class ItemTextListPosition {\n /**\n * @param {Item|null} left\n * @param {Item|null} right\n * @param {number} index\n * @param {Map} currentAttributes\n */\n constructor (left, right, index, currentAttributes) {\n this.left = left\n this.right = right\n this.index = index\n this.currentAttributes = currentAttributes\n }\n\n /**\n * Only call this if you know that this.right is defined\n */\n forward () {\n if (this.right === null) {\n error.unexpectedCase()\n }\n switch (this.right.content.constructor) {\n case ContentFormat:\n if (!this.right.deleted) {\n updateCurrentAttributes(this.currentAttributes, /** @type {ContentFormat} */ (this.right.content))\n }\n break\n default:\n if (!this.right.deleted) {\n this.index += this.right.length\n }\n break\n }\n this.left = this.right\n this.right = this.right.right\n }\n}\n\n/**\n * @param {Transaction} transaction\n * @param {ItemTextListPosition} pos\n * @param {number} count steps to move forward\n * @return {ItemTextListPosition}\n *\n * @private\n * @function\n */\nconst findNextPosition = (transaction, pos, count) => {\n while (pos.right !== null && count > 0) {\n switch (pos.right.content.constructor) {\n case ContentFormat:\n if (!pos.right.deleted) {\n updateCurrentAttributes(pos.currentAttributes, /** @type {ContentFormat} */ (pos.right.content))\n }\n break\n default:\n if (!pos.right.deleted) {\n if (count < pos.right.length) {\n // split right\n getItemCleanStart(transaction, createID(pos.right.id.client, pos.right.id.clock + count))\n }\n pos.index += pos.right.length\n count -= pos.right.length\n }\n break\n }\n pos.left = pos.right\n pos.right = pos.right.right\n // pos.forward() - we don't forward because that would halve the performance because we already do the checks above\n }\n return pos\n}\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {number} index\n * @param {boolean} useSearchMarker\n * @return {ItemTextListPosition}\n *\n * @private\n * @function\n */\nconst findPosition = (transaction, parent, index, useSearchMarker) => {\n const currentAttributes = new Map()\n const marker = useSearchMarker ? findMarker(parent, index) : null\n if (marker) {\n const pos = new ItemTextListPosition(marker.p.left, marker.p, marker.index, currentAttributes)\n return findNextPosition(transaction, pos, index - marker.index)\n } else {\n const pos = new ItemTextListPosition(null, parent._start, 0, currentAttributes)\n return findNextPosition(transaction, pos, index)\n }\n}\n\n/**\n * Negate applied formats\n *\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {ItemTextListPosition} currPos\n * @param {Map} negatedAttributes\n *\n * @private\n * @function\n */\nconst insertNegatedAttributes = (transaction, parent, currPos, negatedAttributes) => {\n // check if we really need to remove attributes\n while (\n currPos.right !== null && (\n currPos.right.deleted === true || (\n currPos.right.content.constructor === ContentFormat &&\n equalAttrs(negatedAttributes.get(/** @type {ContentFormat} */ (currPos.right.content).key), /** @type {ContentFormat} */ (currPos.right.content).value)\n )\n )\n ) {\n if (!currPos.right.deleted) {\n negatedAttributes.delete(/** @type {ContentFormat} */ (currPos.right.content).key)\n }\n currPos.forward()\n }\n const doc = transaction.doc\n const ownClientId = doc.clientID\n negatedAttributes.forEach((val, key) => {\n const left = currPos.left\n const right = currPos.right\n const nextFormat = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentFormat(key, val))\n nextFormat.integrate(transaction, 0)\n currPos.right = nextFormat\n currPos.forward()\n })\n}\n\n/**\n * @param {Map} currentAttributes\n * @param {ContentFormat} format\n *\n * @private\n * @function\n */\nconst updateCurrentAttributes = (currentAttributes, format) => {\n const { key, value } = format\n if (value === null) {\n currentAttributes.delete(key)\n } else {\n currentAttributes.set(key, value)\n }\n}\n\n/**\n * @param {ItemTextListPosition} currPos\n * @param {Object} attributes\n *\n * @private\n * @function\n */\nconst minimizeAttributeChanges = (currPos, attributes) => {\n // go right while attributes[right.key] === right.value (or right is deleted)\n while (true) {\n if (currPos.right === null) {\n break\n } else if (currPos.right.deleted || (currPos.right.content.constructor === ContentFormat && equalAttrs(attributes[(/** @type {ContentFormat} */ (currPos.right.content)).key] ?? null, /** @type {ContentFormat} */ (currPos.right.content).value))) {\n //\n } else {\n break\n }\n currPos.forward()\n }\n}\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {ItemTextListPosition} currPos\n * @param {Object} attributes\n * @return {Map}\n *\n * @private\n * @function\n **/\nconst insertAttributes = (transaction, parent, currPos, attributes) => {\n const doc = transaction.doc\n const ownClientId = doc.clientID\n const negatedAttributes = new Map()\n // insert format-start items\n for (const key in attributes) {\n const val = attributes[key]\n const currentVal = currPos.currentAttributes.get(key) ?? null\n if (!equalAttrs(currentVal, val)) {\n // save negated attribute (set null if currentVal undefined)\n negatedAttributes.set(key, currentVal)\n const { left, right } = currPos\n currPos.right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentFormat(key, val))\n currPos.right.integrate(transaction, 0)\n currPos.forward()\n }\n }\n return negatedAttributes\n}\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {ItemTextListPosition} currPos\n * @param {string|object|AbstractType} text\n * @param {Object} attributes\n *\n * @private\n * @function\n **/\nconst insertText = (transaction, parent, currPos, text, attributes) => {\n currPos.currentAttributes.forEach((_val, key) => {\n if (attributes[key] === undefined) {\n attributes[key] = null\n }\n })\n const doc = transaction.doc\n const ownClientId = doc.clientID\n minimizeAttributeChanges(currPos, attributes)\n const negatedAttributes = insertAttributes(transaction, parent, currPos, attributes)\n // insert content\n const content = text.constructor === String ? new ContentString(/** @type {string} */ (text)) : (text instanceof AbstractType ? new ContentType(text) : new ContentEmbed(text))\n let { left, right, index } = currPos\n if (parent._searchMarker) {\n updateMarkerChanges(parent._searchMarker, currPos.index, content.getLength())\n }\n right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, content)\n right.integrate(transaction, 0)\n currPos.right = right\n currPos.index = index\n currPos.forward()\n insertNegatedAttributes(transaction, parent, currPos, negatedAttributes)\n}\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {ItemTextListPosition} currPos\n * @param {number} length\n * @param {Object} attributes\n *\n * @private\n * @function\n */\nconst formatText = (transaction, parent, currPos, length, attributes) => {\n const doc = transaction.doc\n const ownClientId = doc.clientID\n minimizeAttributeChanges(currPos, attributes)\n const negatedAttributes = insertAttributes(transaction, parent, currPos, attributes)\n // iterate until first non-format or null is found\n // delete all formats with attributes[format.key] != null\n // also check the attributes after the first non-format as we do not want to insert redundant negated attributes there\n // eslint-disable-next-line no-labels\n iterationLoop: while (\n currPos.right !== null &&\n (length > 0 ||\n (\n negatedAttributes.size > 0 &&\n (currPos.right.deleted || currPos.right.content.constructor === ContentFormat)\n )\n )\n ) {\n if (!currPos.right.deleted) {\n switch (currPos.right.content.constructor) {\n case ContentFormat: {\n const { key, value } = /** @type {ContentFormat} */ (currPos.right.content)\n const attr = attributes[key]\n if (attr !== undefined) {\n if (equalAttrs(attr, value)) {\n negatedAttributes.delete(key)\n } else {\n if (length === 0) {\n // no need to further extend negatedAttributes\n // eslint-disable-next-line no-labels\n break iterationLoop\n }\n negatedAttributes.set(key, value)\n }\n currPos.right.delete(transaction)\n } else {\n currPos.currentAttributes.set(key, value)\n }\n break\n }\n default:\n if (length < currPos.right.length) {\n getItemCleanStart(transaction, createID(currPos.right.id.client, currPos.right.id.clock + length))\n }\n length -= currPos.right.length\n break\n }\n }\n currPos.forward()\n }\n // Quill just assumes that the editor starts with a newline and that it always\n // ends with a newline. We only insert that newline when a new newline is\n // inserted - i.e when length is bigger than type.length\n if (length > 0) {\n let newlines = ''\n for (; length > 0; length--) {\n newlines += '\\n'\n }\n currPos.right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), currPos.left, currPos.left && currPos.left.lastId, currPos.right, currPos.right && currPos.right.id, parent, null, new ContentString(newlines))\n currPos.right.integrate(transaction, 0)\n currPos.forward()\n }\n insertNegatedAttributes(transaction, parent, currPos, negatedAttributes)\n}\n\n/**\n * Call this function after string content has been deleted in order to\n * clean up formatting Items.\n *\n * @param {Transaction} transaction\n * @param {Item} start\n * @param {Item|null} curr exclusive end, automatically iterates to the next Content Item\n * @param {Map} startAttributes\n * @param {Map} currAttributes\n * @return {number} The amount of formatting Items deleted.\n *\n * @function\n */\nconst cleanupFormattingGap = (transaction, start, curr, startAttributes, currAttributes) => {\n /**\n * @type {Item|null}\n */\n let end = start\n /**\n * @type {Map}\n */\n const endFormats = map.create()\n while (end && (!end.countable || end.deleted)) {\n if (!end.deleted && end.content.constructor === ContentFormat) {\n const cf = /** @type {ContentFormat} */ (end.content)\n endFormats.set(cf.key, cf)\n }\n end = end.right\n }\n let cleanups = 0\n let reachedCurr = false\n while (start !== end) {\n if (curr === start) {\n reachedCurr = true\n }\n if (!start.deleted) {\n const content = start.content\n switch (content.constructor) {\n case ContentFormat: {\n const { key, value } = /** @type {ContentFormat} */ (content)\n const startAttrValue = startAttributes.get(key) ?? null\n if (endFormats.get(key) !== content || startAttrValue === value) {\n // Either this format is overwritten or it is not necessary because the attribute already existed.\n start.delete(transaction)\n cleanups++\n if (!reachedCurr && (currAttributes.get(key) ?? null) === value && startAttrValue !== value) {\n if (startAttrValue === null) {\n currAttributes.delete(key)\n } else {\n currAttributes.set(key, startAttrValue)\n }\n }\n }\n if (!reachedCurr && !start.deleted) {\n updateCurrentAttributes(currAttributes, /** @type {ContentFormat} */ (content))\n }\n break\n }\n }\n }\n start = /** @type {Item} */ (start.right)\n }\n return cleanups\n}\n\n/**\n * @param {Transaction} transaction\n * @param {Item | null} item\n */\nconst cleanupContextlessFormattingGap = (transaction, item) => {\n // iterate until item.right is null or content\n while (item && item.right && (item.right.deleted || !item.right.countable)) {\n item = item.right\n }\n const attrs = new Set()\n // iterate back until a content item is found\n while (item && (item.deleted || !item.countable)) {\n if (!item.deleted && item.content.constructor === ContentFormat) {\n const key = /** @type {ContentFormat} */ (item.content).key\n if (attrs.has(key)) {\n item.delete(transaction)\n } else {\n attrs.add(key)\n }\n }\n item = item.left\n }\n}\n\n/**\n * This function is experimental and subject to change / be removed.\n *\n * Ideally, we don't need this function at all. Formatting attributes should be cleaned up\n * automatically after each change. This function iterates twice over the complete YText type\n * and removes unnecessary formatting attributes. This is also helpful for testing.\n *\n * This function won't be exported anymore as soon as there is confidence that the YText type works as intended.\n *\n * @param {YText} type\n * @return {number} How many formatting attributes have been cleaned up.\n */\nexport const cleanupYTextFormatting = type => {\n let res = 0\n transact(/** @type {Doc} */ (type.doc), transaction => {\n let start = /** @type {Item} */ (type._start)\n let end = type._start\n let startAttributes = map.create()\n const currentAttributes = map.copy(startAttributes)\n while (end) {\n if (end.deleted === false) {\n switch (end.content.constructor) {\n case ContentFormat:\n updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (end.content))\n break\n default:\n res += cleanupFormattingGap(transaction, start, end, startAttributes, currentAttributes)\n startAttributes = map.copy(currentAttributes)\n start = end\n break\n }\n }\n end = end.right\n }\n })\n return res\n}\n\n/**\n * This will be called by the transaction once the event handlers are called to potentially cleanup\n * formatting attributes.\n *\n * @param {Transaction} transaction\n */\nexport const cleanupYTextAfterTransaction = transaction => {\n /**\n * @type {Set}\n */\n const needFullCleanup = new Set()\n // check if another formatting item was inserted\n const doc = transaction.doc\n for (const [client, afterClock] of transaction.afterState.entries()) {\n const clock = transaction.beforeState.get(client) || 0\n if (afterClock === clock) {\n continue\n }\n iterateStructs(transaction, /** @type {Array} */ (doc.store.clients.get(client)), clock, afterClock, item => {\n if (\n !item.deleted && /** @type {Item} */ (item).content.constructor === ContentFormat && item.constructor !== GC\n ) {\n needFullCleanup.add(/** @type {any} */ (item).parent)\n }\n })\n }\n // cleanup in a new transaction\n transact(doc, (t) => {\n iterateDeletedStructs(transaction, transaction.deleteSet, item => {\n if (item instanceof GC || !(/** @type {YText} */ (item.parent)._hasFormatting) || needFullCleanup.has(/** @type {YText} */ (item.parent))) {\n return\n }\n const parent = /** @type {YText} */ (item.parent)\n if (item.content.constructor === ContentFormat) {\n needFullCleanup.add(parent)\n } else {\n // If no formatting attribute was inserted or deleted, we can make due with contextless\n // formatting cleanups.\n // Contextless: it is not necessary to compute currentAttributes for the affected position.\n cleanupContextlessFormattingGap(t, item)\n }\n })\n // If a formatting item was inserted, we simply clean the whole type.\n // We need to compute currentAttributes for the current position anyway.\n for (const yText of needFullCleanup) {\n cleanupYTextFormatting(yText)\n }\n })\n}\n\n/**\n * @param {Transaction} transaction\n * @param {ItemTextListPosition} currPos\n * @param {number} length\n * @return {ItemTextListPosition}\n *\n * @private\n * @function\n */\nconst deleteText = (transaction, currPos, length) => {\n const startLength = length\n const startAttrs = map.copy(currPos.currentAttributes)\n const start = currPos.right\n while (length > 0 && currPos.right !== null) {\n if (currPos.right.deleted === false) {\n switch (currPos.right.content.constructor) {\n case ContentType:\n case ContentEmbed:\n case ContentString:\n if (length < currPos.right.length) {\n getItemCleanStart(transaction, createID(currPos.right.id.client, currPos.right.id.clock + length))\n }\n length -= currPos.right.length\n currPos.right.delete(transaction)\n break\n }\n }\n currPos.forward()\n }\n if (start) {\n cleanupFormattingGap(transaction, start, currPos.right, startAttrs, currPos.currentAttributes)\n }\n const parent = /** @type {AbstractType} */ (/** @type {Item} */ (currPos.left || currPos.right).parent)\n if (parent._searchMarker) {\n updateMarkerChanges(parent._searchMarker, currPos.index, -startLength + length)\n }\n return currPos\n}\n\n/**\n * The Quill Delta format represents changes on a text document with\n * formatting information. For more information visit {@link https://quilljs.com/docs/delta/|Quill Delta}\n *\n * @example\n * {\n * ops: [\n * { insert: 'Gandalf', attributes: { bold: true } },\n * { insert: ' the ' },\n * { insert: 'Grey', attributes: { color: '#cccccc' } }\n * ]\n * }\n *\n */\n\n/**\n * Attributes that can be assigned to a selection of text.\n *\n * @example\n * {\n * bold: true,\n * font-size: '40px'\n * }\n *\n * @typedef {Object} TextAttributes\n */\n\n/**\n * @extends YEvent\n * Event that describes the changes on a YText type.\n */\nexport class YTextEvent extends YEvent {\n /**\n * @param {YText} ytext\n * @param {Transaction} transaction\n * @param {Set} subs The keys that changed\n */\n constructor (ytext, transaction, subs) {\n super(ytext, transaction)\n /**\n * Whether the children changed.\n * @type {Boolean}\n * @private\n */\n this.childListChanged = false\n /**\n * Set of all changed attributes.\n * @type {Set}\n */\n this.keysChanged = new Set()\n subs.forEach((sub) => {\n if (sub === null) {\n this.childListChanged = true\n } else {\n this.keysChanged.add(sub)\n }\n })\n }\n\n /**\n * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string, delete?:number, retain?:number}>}}\n */\n get changes () {\n if (this._changes === null) {\n /**\n * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string|AbstractType|object, delete?:number, retain?:number}>}}\n */\n const changes = {\n keys: this.keys,\n delta: this.delta,\n added: new Set(),\n deleted: new Set()\n }\n this._changes = changes\n }\n return /** @type {any} */ (this._changes)\n }\n\n /**\n * Compute the changes in the delta format.\n * A {@link https://quilljs.com/docs/delta/|Quill Delta}) that represents the changes on the document.\n *\n * @type {Array<{insert?:string|object|AbstractType, delete?:number, retain?:number, attributes?: Object}>}\n *\n * @public\n */\n get delta () {\n if (this._delta === null) {\n const y = /** @type {Doc} */ (this.target.doc)\n /**\n * @type {Array<{insert?:string|object|AbstractType, delete?:number, retain?:number, attributes?: Object}>}\n */\n const delta = []\n transact(y, transaction => {\n const currentAttributes = new Map() // saves all current attributes for insert\n const oldAttributes = new Map()\n let item = this.target._start\n /**\n * @type {string?}\n */\n let action = null\n /**\n * @type {Object}\n */\n const attributes = {} // counts added or removed new attributes for retain\n /**\n * @type {string|object}\n */\n let insert = ''\n let retain = 0\n let deleteLen = 0\n const addOp = () => {\n if (action !== null) {\n /**\n * @type {any}\n */\n let op = null\n switch (action) {\n case 'delete':\n if (deleteLen > 0) {\n op = { delete: deleteLen }\n }\n deleteLen = 0\n break\n case 'insert':\n if (typeof insert === 'object' || insert.length > 0) {\n op = { insert }\n if (currentAttributes.size > 0) {\n op.attributes = {}\n currentAttributes.forEach((value, key) => {\n if (value !== null) {\n op.attributes[key] = value\n }\n })\n }\n }\n insert = ''\n break\n case 'retain':\n if (retain > 0) {\n op = { retain }\n if (!object.isEmpty(attributes)) {\n op.attributes = object.assign({}, attributes)\n }\n }\n retain = 0\n break\n }\n if (op) delta.push(op)\n action = null\n }\n }\n while (item !== null) {\n switch (item.content.constructor) {\n case ContentType:\n case ContentEmbed:\n if (this.adds(item)) {\n if (!this.deletes(item)) {\n addOp()\n action = 'insert'\n insert = item.content.getContent()[0]\n addOp()\n }\n } else if (this.deletes(item)) {\n if (action !== 'delete') {\n addOp()\n action = 'delete'\n }\n deleteLen += 1\n } else if (!item.deleted) {\n if (action !== 'retain') {\n addOp()\n action = 'retain'\n }\n retain += 1\n }\n break\n case ContentString:\n if (this.adds(item)) {\n if (!this.deletes(item)) {\n if (action !== 'insert') {\n addOp()\n action = 'insert'\n }\n insert += /** @type {ContentString} */ (item.content).str\n }\n } else if (this.deletes(item)) {\n if (action !== 'delete') {\n addOp()\n action = 'delete'\n }\n deleteLen += item.length\n } else if (!item.deleted) {\n if (action !== 'retain') {\n addOp()\n action = 'retain'\n }\n retain += item.length\n }\n break\n case ContentFormat: {\n const { key, value } = /** @type {ContentFormat} */ (item.content)\n if (this.adds(item)) {\n if (!this.deletes(item)) {\n const curVal = currentAttributes.get(key) ?? null\n if (!equalAttrs(curVal, value)) {\n if (action === 'retain') {\n addOp()\n }\n if (equalAttrs(value, (oldAttributes.get(key) ?? null))) {\n delete attributes[key]\n } else {\n attributes[key] = value\n }\n } else if (value !== null) {\n item.delete(transaction)\n }\n }\n } else if (this.deletes(item)) {\n oldAttributes.set(key, value)\n const curVal = currentAttributes.get(key) ?? null\n if (!equalAttrs(curVal, value)) {\n if (action === 'retain') {\n addOp()\n }\n attributes[key] = curVal\n }\n } else if (!item.deleted) {\n oldAttributes.set(key, value)\n const attr = attributes[key]\n if (attr !== undefined) {\n if (!equalAttrs(attr, value)) {\n if (action === 'retain') {\n addOp()\n }\n if (value === null) {\n delete attributes[key]\n } else {\n attributes[key] = value\n }\n } else if (attr !== null) { // this will be cleaned up automatically by the contextless cleanup function\n item.delete(transaction)\n }\n }\n }\n if (!item.deleted) {\n if (action === 'insert') {\n addOp()\n }\n updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (item.content))\n }\n break\n }\n }\n item = item.right\n }\n addOp()\n while (delta.length > 0) {\n const lastOp = delta[delta.length - 1]\n if (lastOp.retain !== undefined && lastOp.attributes === undefined) {\n // retain delta's if they don't assign attributes\n delta.pop()\n } else {\n break\n }\n }\n })\n this._delta = delta\n }\n return /** @type {any} */ (this._delta)\n }\n}\n\n/**\n * Type that represents text with formatting information.\n *\n * This type replaces y-richtext as this implementation is able to handle\n * block formats (format information on a paragraph), embeds (complex elements\n * like pictures and videos), and text formats (**bold**, *italic*).\n *\n * @extends AbstractType\n */\nexport class YText extends AbstractType {\n /**\n * @param {String} [string] The initial value of the YText.\n */\n constructor (string) {\n super()\n /**\n * Array of pending operations on this type\n * @type {Array?}\n */\n this._pending = string !== undefined ? [() => this.insert(0, string)] : []\n /**\n * @type {Array|null}\n */\n this._searchMarker = []\n /**\n * Whether this YText contains formatting attributes.\n * This flag is updated when a formatting item is integrated (see ContentFormat.integrate)\n */\n this._hasFormatting = false\n }\n\n /**\n * Number of characters of this text type.\n *\n * @type {number}\n */\n get length () {\n this.doc ?? warnPrematureAccess()\n return this._length\n }\n\n /**\n * @param {Doc} y\n * @param {Item} item\n */\n _integrate (y, item) {\n super._integrate(y, item)\n try {\n /** @type {Array} */ (this._pending).forEach(f => f())\n } catch (e) {\n console.error(e)\n }\n this._pending = null\n }\n\n _copy () {\n return new YText()\n }\n\n /**\n * Makes a copy of this data type that can be included somewhere else.\n *\n * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.\n *\n * @return {YText}\n */\n clone () {\n const text = new YText()\n text.applyDelta(this.toDelta())\n return text\n }\n\n /**\n * Creates YTextEvent and calls observers.\n *\n * @param {Transaction} transaction\n * @param {Set} parentSubs Keys changed on this type. `null` if list was modified.\n */\n _callObserver (transaction, parentSubs) {\n super._callObserver(transaction, parentSubs)\n const event = new YTextEvent(this, transaction, parentSubs)\n callTypeObservers(this, transaction, event)\n // If a remote change happened, we try to cleanup potential formatting duplicates.\n if (!transaction.local && this._hasFormatting) {\n transaction._needFormattingCleanup = true\n }\n }\n\n /**\n * Returns the unformatted string representation of this YText type.\n *\n * @public\n */\n toString () {\n this.doc ?? warnPrematureAccess()\n let str = ''\n /**\n * @type {Item|null}\n */\n let n = this._start\n while (n !== null) {\n if (!n.deleted && n.countable && n.content.constructor === ContentString) {\n str += /** @type {ContentString} */ (n.content).str\n }\n n = n.right\n }\n return str\n }\n\n /**\n * Returns the unformatted string representation of this YText type.\n *\n * @return {string}\n * @public\n */\n toJSON () {\n return this.toString()\n }\n\n /**\n * Apply a {@link Delta} on this shared YText type.\n *\n * @param {Array} delta The changes to apply on this element.\n * @param {object} opts\n * @param {boolean} [opts.sanitize] Sanitize input delta. Removes ending newlines if set to true.\n *\n *\n * @public\n */\n applyDelta (delta, { sanitize = true } = {}) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n const currPos = new ItemTextListPosition(null, this._start, 0, new Map())\n for (let i = 0; i < delta.length; i++) {\n const op = delta[i]\n if (op.insert !== undefined) {\n // Quill assumes that the content starts with an empty paragraph.\n // Yjs/Y.Text assumes that it starts empty. We always hide that\n // there is a newline at the end of the content.\n // If we omit this step, clients will see a different number of\n // paragraphs, but nothing bad will happen.\n const ins = (!sanitize && typeof op.insert === 'string' && i === delta.length - 1 && currPos.right === null && op.insert.slice(-1) === '\\n') ? op.insert.slice(0, -1) : op.insert\n if (typeof ins !== 'string' || ins.length > 0) {\n insertText(transaction, this, currPos, ins, op.attributes || {})\n }\n } else if (op.retain !== undefined) {\n formatText(transaction, this, currPos, op.retain, op.attributes || {})\n } else if (op.delete !== undefined) {\n deleteText(transaction, currPos, op.delete)\n }\n }\n })\n } else {\n /** @type {Array} */ (this._pending).push(() => this.applyDelta(delta))\n }\n }\n\n /**\n * Returns the Delta representation of this YText type.\n *\n * @param {Snapshot} [snapshot]\n * @param {Snapshot} [prevSnapshot]\n * @param {function('removed' | 'added', ID):any} [computeYChange]\n * @return {any} The Delta representation of this type.\n *\n * @public\n */\n toDelta (snapshot, prevSnapshot, computeYChange) {\n this.doc ?? warnPrematureAccess()\n /**\n * @type{Array}\n */\n const ops = []\n const currentAttributes = new Map()\n const doc = /** @type {Doc} */ (this.doc)\n let str = ''\n let n = this._start\n function packStr () {\n if (str.length > 0) {\n // pack str with attributes to ops\n /**\n * @type {Object}\n */\n const attributes = {}\n let addAttributes = false\n currentAttributes.forEach((value, key) => {\n addAttributes = true\n attributes[key] = value\n })\n /**\n * @type {Object}\n */\n const op = { insert: str }\n if (addAttributes) {\n op.attributes = attributes\n }\n ops.push(op)\n str = ''\n }\n }\n const computeDelta = () => {\n while (n !== null) {\n if (isVisible(n, snapshot) || (prevSnapshot !== undefined && isVisible(n, prevSnapshot))) {\n switch (n.content.constructor) {\n case ContentString: {\n const cur = currentAttributes.get('ychange')\n if (snapshot !== undefined && !isVisible(n, snapshot)) {\n if (cur === undefined || cur.user !== n.id.client || cur.type !== 'removed') {\n packStr()\n currentAttributes.set('ychange', computeYChange ? computeYChange('removed', n.id) : { type: 'removed' })\n }\n } else if (prevSnapshot !== undefined && !isVisible(n, prevSnapshot)) {\n if (cur === undefined || cur.user !== n.id.client || cur.type !== 'added') {\n packStr()\n currentAttributes.set('ychange', computeYChange ? computeYChange('added', n.id) : { type: 'added' })\n }\n } else if (cur !== undefined) {\n packStr()\n currentAttributes.delete('ychange')\n }\n str += /** @type {ContentString} */ (n.content).str\n break\n }\n case ContentType:\n case ContentEmbed: {\n packStr()\n /**\n * @type {Object}\n */\n const op = {\n insert: n.content.getContent()[0]\n }\n if (currentAttributes.size > 0) {\n const attrs = /** @type {Object} */ ({})\n op.attributes = attrs\n currentAttributes.forEach((value, key) => {\n attrs[key] = value\n })\n }\n ops.push(op)\n break\n }\n case ContentFormat:\n if (isVisible(n, snapshot)) {\n packStr()\n updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (n.content))\n }\n break\n }\n }\n n = n.right\n }\n packStr()\n }\n if (snapshot || prevSnapshot) {\n // snapshots are merged again after the transaction, so we need to keep the\n // transaction alive until we are done\n transact(doc, transaction => {\n if (snapshot) {\n splitSnapshotAffectedStructs(transaction, snapshot)\n }\n if (prevSnapshot) {\n splitSnapshotAffectedStructs(transaction, prevSnapshot)\n }\n computeDelta()\n }, 'cleanup')\n } else {\n computeDelta()\n }\n return ops\n }\n\n /**\n * Insert text at a given index.\n *\n * @param {number} index The index at which to start inserting.\n * @param {String} text The text to insert at the specified position.\n * @param {TextAttributes} [attributes] Optionally define some formatting\n * information to apply on the inserted\n * Text.\n * @public\n */\n insert (index, text, attributes) {\n if (text.length <= 0) {\n return\n }\n const y = this.doc\n if (y !== null) {\n transact(y, transaction => {\n const pos = findPosition(transaction, this, index, !attributes)\n if (!attributes) {\n attributes = {}\n // @ts-ignore\n pos.currentAttributes.forEach((v, k) => { attributes[k] = v })\n }\n insertText(transaction, this, pos, text, attributes)\n })\n } else {\n /** @type {Array} */ (this._pending).push(() => this.insert(index, text, attributes))\n }\n }\n\n /**\n * Inserts an embed at a index.\n *\n * @param {number} index The index to insert the embed at.\n * @param {Object | AbstractType} embed The Object that represents the embed.\n * @param {TextAttributes} [attributes] Attribute information to apply on the\n * embed\n *\n * @public\n */\n insertEmbed (index, embed, attributes) {\n const y = this.doc\n if (y !== null) {\n transact(y, transaction => {\n const pos = findPosition(transaction, this, index, !attributes)\n insertText(transaction, this, pos, embed, attributes || {})\n })\n } else {\n /** @type {Array} */ (this._pending).push(() => this.insertEmbed(index, embed, attributes || {}))\n }\n }\n\n /**\n * Deletes text starting from an index.\n *\n * @param {number} index Index at which to start deleting.\n * @param {number} length The number of characters to remove. Defaults to 1.\n *\n * @public\n */\n delete (index, length) {\n if (length === 0) {\n return\n }\n const y = this.doc\n if (y !== null) {\n transact(y, transaction => {\n deleteText(transaction, findPosition(transaction, this, index, true), length)\n })\n } else {\n /** @type {Array} */ (this._pending).push(() => this.delete(index, length))\n }\n }\n\n /**\n * Assigns properties to a range of text.\n *\n * @param {number} index The position where to start formatting.\n * @param {number} length The amount of characters to assign properties to.\n * @param {TextAttributes} attributes Attribute information to apply on the\n * text.\n *\n * @public\n */\n format (index, length, attributes) {\n if (length === 0) {\n return\n }\n const y = this.doc\n if (y !== null) {\n transact(y, transaction => {\n const pos = findPosition(transaction, this, index, false)\n if (pos.right === null) {\n return\n }\n formatText(transaction, this, pos, length, attributes)\n })\n } else {\n /** @type {Array} */ (this._pending).push(() => this.format(index, length, attributes))\n }\n }\n\n /**\n * Removes an attribute.\n *\n * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.\n *\n * @param {String} attributeName The attribute name that is to be removed.\n *\n * @public\n */\n removeAttribute (attributeName) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeMapDelete(transaction, this, attributeName)\n })\n } else {\n /** @type {Array} */ (this._pending).push(() => this.removeAttribute(attributeName))\n }\n }\n\n /**\n * Sets or updates an attribute.\n *\n * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.\n *\n * @param {String} attributeName The attribute name that is to be set.\n * @param {any} attributeValue The attribute value that is to be set.\n *\n * @public\n */\n setAttribute (attributeName, attributeValue) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeMapSet(transaction, this, attributeName, attributeValue)\n })\n } else {\n /** @type {Array} */ (this._pending).push(() => this.setAttribute(attributeName, attributeValue))\n }\n }\n\n /**\n * Returns an attribute value that belongs to the attribute name.\n *\n * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.\n *\n * @param {String} attributeName The attribute name that identifies the\n * queried value.\n * @return {any} The queried attribute value.\n *\n * @public\n */\n getAttribute (attributeName) {\n return /** @type {any} */ (typeMapGet(this, attributeName))\n }\n\n /**\n * Returns all attribute name/value pairs in a JSON Object.\n *\n * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.\n *\n * @return {Object} A JSON Object that describes the attributes.\n *\n * @public\n */\n getAttributes () {\n return typeMapGetAll(this)\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n */\n _write (encoder) {\n encoder.writeTypeRef(YTextRefID)\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder\n * @return {YText}\n *\n * @private\n * @function\n */\nexport const readYText = _decoder => new YText()\n","/**\n * @module YXml\n */\n\nimport {\n YXmlEvent,\n YXmlElement,\n AbstractType,\n typeListMap,\n typeListForEach,\n typeListInsertGenerics,\n typeListInsertGenericsAfter,\n typeListDelete,\n typeListToArray,\n YXmlFragmentRefID,\n callTypeObservers,\n transact,\n typeListGet,\n typeListSlice,\n warnPrematureAccess,\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Doc, ContentType, Transaction, Item, YXmlText, YXmlHook // eslint-disable-line\n} from '../internals.js'\n\nimport * as error from 'lib0/error'\nimport * as array from 'lib0/array'\n\n/**\n * Define the elements to which a set of CSS queries apply.\n * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors|CSS_Selectors}\n *\n * @example\n * query = '.classSelector'\n * query = 'nodeSelector'\n * query = '#idSelector'\n *\n * @typedef {string} CSS_Selector\n */\n\n/**\n * Dom filter function.\n *\n * @callback domFilter\n * @param {string} nodeName The nodeName of the element\n * @param {Map} attributes The map of attributes.\n * @return {boolean} Whether to include the Dom node in the YXmlElement.\n */\n\n/**\n * Represents a subset of the nodes of a YXmlElement / YXmlFragment and a\n * position within them.\n *\n * Can be created with {@link YXmlFragment#createTreeWalker}\n *\n * @public\n * @implements {Iterable}\n */\nexport class YXmlTreeWalker {\n /**\n * @param {YXmlFragment | YXmlElement} root\n * @param {function(AbstractType):boolean} [f]\n */\n constructor (root, f = () => true) {\n this._filter = f\n this._root = root\n /**\n * @type {Item}\n */\n this._currentNode = /** @type {Item} */ (root._start)\n this._firstCall = true\n root.doc ?? warnPrematureAccess()\n }\n\n [Symbol.iterator] () {\n return this\n }\n\n /**\n * Get the next node.\n *\n * @return {IteratorResult} The next node.\n *\n * @public\n */\n next () {\n /**\n * @type {Item|null}\n */\n let n = this._currentNode\n let type = n && n.content && /** @type {any} */ (n.content).type\n if (n !== null && (!this._firstCall || n.deleted || !this._filter(type))) { // if first call, we check if we can use the first item\n do {\n type = /** @type {any} */ (n.content).type\n if (!n.deleted && (type.constructor === YXmlElement || type.constructor === YXmlFragment) && type._start !== null) {\n // walk down in the tree\n n = type._start\n } else {\n // walk right or up in the tree\n while (n !== null) {\n /**\n * @type {Item | null}\n */\n const nxt = n.next\n if (nxt !== null) {\n n = nxt\n break\n } else if (n.parent === this._root) {\n n = null\n } else {\n n = /** @type {AbstractType} */ (n.parent)._item\n }\n }\n }\n } while (n !== null && (n.deleted || !this._filter(/** @type {ContentType} */ (n.content).type)))\n }\n this._firstCall = false\n if (n === null) {\n // @ts-ignore\n return { value: undefined, done: true }\n }\n this._currentNode = n\n return { value: /** @type {any} */ (n.content).type, done: false }\n }\n}\n\n/**\n * Represents a list of {@link YXmlElement}.and {@link YXmlText} types.\n * A YxmlFragment is similar to a {@link YXmlElement}, but it does not have a\n * nodeName and it does not have attributes. Though it can be bound to a DOM\n * element - in this case the attributes and the nodeName are not shared.\n *\n * @public\n * @extends AbstractType\n */\nexport class YXmlFragment extends AbstractType {\n constructor () {\n super()\n /**\n * @type {Array|null}\n */\n this._prelimContent = []\n }\n\n /**\n * @type {YXmlElement|YXmlText|null}\n */\n get firstChild () {\n const first = this._first\n return first ? first.content.getContent()[0] : null\n }\n\n /**\n * Integrate this type into the Yjs instance.\n *\n * * Save this struct in the os\n * * This type is sent to other client\n * * Observer functions are fired\n *\n * @param {Doc} y The Yjs instance\n * @param {Item} item\n */\n _integrate (y, item) {\n super._integrate(y, item)\n this.insert(0, /** @type {Array} */ (this._prelimContent))\n this._prelimContent = null\n }\n\n _copy () {\n return new YXmlFragment()\n }\n\n /**\n * Makes a copy of this data type that can be included somewhere else.\n *\n * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.\n *\n * @return {YXmlFragment}\n */\n clone () {\n const el = new YXmlFragment()\n // @ts-ignore\n el.insert(0, this.toArray().map(item => item instanceof AbstractType ? item.clone() : item))\n return el\n }\n\n get length () {\n this.doc ?? warnPrematureAccess()\n return this._prelimContent === null ? this._length : this._prelimContent.length\n }\n\n /**\n * Create a subtree of childNodes.\n *\n * @example\n * const walker = elem.createTreeWalker(dom => dom.nodeName === 'div')\n * for (let node in walker) {\n * // `node` is a div node\n * nop(node)\n * }\n *\n * @param {function(AbstractType):boolean} filter Function that is called on each child element and\n * returns a Boolean indicating whether the child\n * is to be included in the subtree.\n * @return {YXmlTreeWalker} A subtree and a position within it.\n *\n * @public\n */\n createTreeWalker (filter) {\n return new YXmlTreeWalker(this, filter)\n }\n\n /**\n * Returns the first YXmlElement that matches the query.\n * Similar to DOM's {@link querySelector}.\n *\n * Query support:\n * - tagname\n * TODO:\n * - id\n * - attribute\n *\n * @param {CSS_Selector} query The query on the children.\n * @return {YXmlElement|YXmlText|YXmlHook|null} The first element that matches the query or null.\n *\n * @public\n */\n querySelector (query) {\n query = query.toUpperCase()\n // @ts-ignore\n const iterator = new YXmlTreeWalker(this, element => element.nodeName && element.nodeName.toUpperCase() === query)\n const next = iterator.next()\n if (next.done) {\n return null\n } else {\n return next.value\n }\n }\n\n /**\n * Returns all YXmlElements that match the query.\n * Similar to Dom's {@link querySelectorAll}.\n *\n * @todo Does not yet support all queries. Currently only query by tagName.\n *\n * @param {CSS_Selector} query The query on the children\n * @return {Array} The elements that match this query.\n *\n * @public\n */\n querySelectorAll (query) {\n query = query.toUpperCase()\n // @ts-ignore\n return array.from(new YXmlTreeWalker(this, element => element.nodeName && element.nodeName.toUpperCase() === query))\n }\n\n /**\n * Creates YXmlEvent and calls observers.\n *\n * @param {Transaction} transaction\n * @param {Set} parentSubs Keys changed on this type. `null` if list was modified.\n */\n _callObserver (transaction, parentSubs) {\n callTypeObservers(this, transaction, new YXmlEvent(this, parentSubs, transaction))\n }\n\n /**\n * Get the string representation of all the children of this YXmlFragment.\n *\n * @return {string} The string representation of all children.\n */\n toString () {\n return typeListMap(this, xml => xml.toString()).join('')\n }\n\n /**\n * @return {string}\n */\n toJSON () {\n return this.toString()\n }\n\n /**\n * Creates a Dom Element that mirrors this YXmlElement.\n *\n * @param {Document} [_document=document] The document object (you must define\n * this when calling this method in\n * nodejs)\n * @param {Object} [hooks={}] Optional property to customize how hooks\n * are presented in the DOM\n * @param {any} [binding] You should not set this property. This is\n * used if DomBinding wants to create a\n * association to the created DOM type.\n * @return {Node} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element}\n *\n * @public\n */\n toDOM (_document = document, hooks = {}, binding) {\n const fragment = _document.createDocumentFragment()\n if (binding !== undefined) {\n binding._createAssociation(fragment, this)\n }\n typeListForEach(this, xmlType => {\n fragment.insertBefore(xmlType.toDOM(_document, hooks, binding), null)\n })\n return fragment\n }\n\n /**\n * Inserts new content at an index.\n *\n * @example\n * // Insert character 'a' at position 0\n * xml.insert(0, [new Y.XmlText('text')])\n *\n * @param {number} index The index to insert content at\n * @param {Array} content The array of content\n */\n insert (index, content) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeListInsertGenerics(transaction, this, index, content)\n })\n } else {\n // @ts-ignore _prelimContent is defined because this is not yet integrated\n this._prelimContent.splice(index, 0, ...content)\n }\n }\n\n /**\n * Inserts new content at an index.\n *\n * @example\n * // Insert character 'a' at position 0\n * xml.insert(0, [new Y.XmlText('text')])\n *\n * @param {null|Item|YXmlElement|YXmlText} ref The index to insert content at\n * @param {Array} content The array of content\n */\n insertAfter (ref, content) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n const refItem = (ref && ref instanceof AbstractType) ? ref._item : ref\n typeListInsertGenericsAfter(transaction, this, refItem, content)\n })\n } else {\n const pc = /** @type {Array} */ (this._prelimContent)\n const index = ref === null ? 0 : pc.findIndex(el => el === ref) + 1\n if (index === 0 && ref !== null) {\n throw error.create('Reference item not found')\n }\n pc.splice(index, 0, ...content)\n }\n }\n\n /**\n * Deletes elements starting from an index.\n *\n * @param {number} index Index at which to start deleting elements\n * @param {number} [length=1] The number of elements to remove. Defaults to 1.\n */\n delete (index, length = 1) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeListDelete(transaction, this, index, length)\n })\n } else {\n // @ts-ignore _prelimContent is defined because this is not yet integrated\n this._prelimContent.splice(index, length)\n }\n }\n\n /**\n * Transforms this YArray to a JavaScript Array.\n *\n * @return {Array}\n */\n toArray () {\n return typeListToArray(this)\n }\n\n /**\n * Appends content to this YArray.\n *\n * @param {Array} content Array of content to append.\n */\n push (content) {\n this.insert(this.length, content)\n }\n\n /**\n * Prepends content to this YArray.\n *\n * @param {Array} content Array of content to prepend.\n */\n unshift (content) {\n this.insert(0, content)\n }\n\n /**\n * Returns the i-th element from a YArray.\n *\n * @param {number} index The index of the element to return from the YArray\n * @return {YXmlElement|YXmlText}\n */\n get (index) {\n return typeListGet(this, index)\n }\n\n /**\n * Returns a portion of this YXmlFragment into a JavaScript Array selected\n * from start to end (end not included).\n *\n * @param {number} [start]\n * @param {number} [end]\n * @return {Array}\n */\n slice (start = 0, end = this.length) {\n return typeListSlice(this, start, end)\n }\n\n /**\n * Executes a provided function on once on every child element.\n *\n * @param {function(YXmlElement|YXmlText,number, typeof self):void} f A function to execute on every element of this YArray.\n */\n forEach (f) {\n typeListForEach(this, f)\n }\n\n /**\n * Transform the properties of this type to binary and write it to an\n * BinaryEncoder.\n *\n * This is called when this Item is sent to a remote peer.\n *\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.\n */\n _write (encoder) {\n encoder.writeTypeRef(YXmlFragmentRefID)\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder\n * @return {YXmlFragment}\n *\n * @private\n * @function\n */\nexport const readYXmlFragment = _decoder => new YXmlFragment()\n","import * as object from 'lib0/object'\n\nimport {\n YXmlFragment,\n transact,\n typeMapDelete,\n typeMapHas,\n typeMapSet,\n typeMapGet,\n typeMapGetAll,\n typeMapGetAllSnapshot,\n typeListForEach,\n YXmlElementRefID,\n Snapshot, YXmlText, ContentType, AbstractType, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Doc, Item // eslint-disable-line\n} from '../internals.js'\n\n/**\n * @typedef {Object|number|null|Array|string|Uint8Array|AbstractType} ValueTypes\n */\n\n/**\n * An YXmlElement imitates the behavior of a\n * https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element\n *\n * * An YXmlElement has attributes (key value pairs)\n * * An YXmlElement has childElements that must inherit from YXmlElement\n *\n * @template {{ [key: string]: ValueTypes }} [KV={ [key: string]: string }]\n */\nexport class YXmlElement extends YXmlFragment {\n constructor (nodeName = 'UNDEFINED') {\n super()\n this.nodeName = nodeName\n /**\n * @type {Map|null}\n */\n this._prelimAttrs = new Map()\n }\n\n /**\n * @type {YXmlElement|YXmlText|null}\n */\n get nextSibling () {\n const n = this._item ? this._item.next : null\n return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null\n }\n\n /**\n * @type {YXmlElement|YXmlText|null}\n */\n get prevSibling () {\n const n = this._item ? this._item.prev : null\n return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null\n }\n\n /**\n * Integrate this type into the Yjs instance.\n *\n * * Save this struct in the os\n * * This type is sent to other client\n * * Observer functions are fired\n *\n * @param {Doc} y The Yjs instance\n * @param {Item} item\n */\n _integrate (y, item) {\n super._integrate(y, item)\n ;(/** @type {Map} */ (this._prelimAttrs)).forEach((value, key) => {\n this.setAttribute(key, value)\n })\n this._prelimAttrs = null\n }\n\n /**\n * Creates an Item with the same effect as this Item (without position effect)\n *\n * @return {YXmlElement}\n */\n _copy () {\n return new YXmlElement(this.nodeName)\n }\n\n /**\n * Makes a copy of this data type that can be included somewhere else.\n *\n * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.\n *\n * @return {YXmlElement}\n */\n clone () {\n /**\n * @type {YXmlElement}\n */\n const el = new YXmlElement(this.nodeName)\n const attrs = this.getAttributes()\n object.forEach(attrs, (value, key) => {\n el.setAttribute(key, /** @type {any} */ (value))\n })\n // @ts-ignore\n el.insert(0, this.toArray().map(v => v instanceof AbstractType ? v.clone() : v))\n return el\n }\n\n /**\n * Returns the XML serialization of this YXmlElement.\n * The attributes are ordered by attribute-name, so you can easily use this\n * method to compare YXmlElements\n *\n * @return {string} The string representation of this type.\n *\n * @public\n */\n toString () {\n const attrs = this.getAttributes()\n const stringBuilder = []\n const keys = []\n for (const key in attrs) {\n keys.push(key)\n }\n keys.sort()\n const keysLen = keys.length\n for (let i = 0; i < keysLen; i++) {\n const key = keys[i]\n stringBuilder.push(key + '=\"' + attrs[key] + '\"')\n }\n const nodeName = this.nodeName.toLocaleLowerCase()\n const attrsString = stringBuilder.length > 0 ? ' ' + stringBuilder.join(' ') : ''\n return `<${nodeName}${attrsString}>${super.toString()}`\n }\n\n /**\n * Removes an attribute from this YXmlElement.\n *\n * @param {string} attributeName The attribute name that is to be removed.\n *\n * @public\n */\n removeAttribute (attributeName) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeMapDelete(transaction, this, attributeName)\n })\n } else {\n /** @type {Map} */ (this._prelimAttrs).delete(attributeName)\n }\n }\n\n /**\n * Sets or updates an attribute.\n *\n * @template {keyof KV & string} KEY\n *\n * @param {KEY} attributeName The attribute name that is to be set.\n * @param {KV[KEY]} attributeValue The attribute value that is to be set.\n *\n * @public\n */\n setAttribute (attributeName, attributeValue) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeMapSet(transaction, this, attributeName, attributeValue)\n })\n } else {\n /** @type {Map} */ (this._prelimAttrs).set(attributeName, attributeValue)\n }\n }\n\n /**\n * Returns an attribute value that belongs to the attribute name.\n *\n * @template {keyof KV & string} KEY\n *\n * @param {KEY} attributeName The attribute name that identifies the\n * queried value.\n * @return {KV[KEY]|undefined} The queried attribute value.\n *\n * @public\n */\n getAttribute (attributeName) {\n return /** @type {any} */ (typeMapGet(this, attributeName))\n }\n\n /**\n * Returns whether an attribute exists\n *\n * @param {string} attributeName The attribute name to check for existence.\n * @return {boolean} whether the attribute exists.\n *\n * @public\n */\n hasAttribute (attributeName) {\n return /** @type {any} */ (typeMapHas(this, attributeName))\n }\n\n /**\n * Returns all attribute name/value pairs in a JSON Object.\n *\n * @param {Snapshot} [snapshot]\n * @return {{ [Key in Extract]?: KV[Key]}} A JSON Object that describes the attributes.\n *\n * @public\n */\n getAttributes (snapshot) {\n return /** @type {any} */ (snapshot ? typeMapGetAllSnapshot(this, snapshot) : typeMapGetAll(this))\n }\n\n /**\n * Creates a Dom Element that mirrors this YXmlElement.\n *\n * @param {Document} [_document=document] The document object (you must define\n * this when calling this method in\n * nodejs)\n * @param {Object} [hooks={}] Optional property to customize how hooks\n * are presented in the DOM\n * @param {any} [binding] You should not set this property. This is\n * used if DomBinding wants to create a\n * association to the created DOM type.\n * @return {Node} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element}\n *\n * @public\n */\n toDOM (_document = document, hooks = {}, binding) {\n const dom = _document.createElement(this.nodeName)\n const attrs = this.getAttributes()\n for (const key in attrs) {\n const value = attrs[key]\n if (typeof value === 'string') {\n dom.setAttribute(key, value)\n }\n }\n typeListForEach(this, yxml => {\n dom.appendChild(yxml.toDOM(_document, hooks, binding))\n })\n if (binding !== undefined) {\n binding._createAssociation(dom, this)\n }\n return dom\n }\n\n /**\n * Transform the properties of this type to binary and write it to an\n * BinaryEncoder.\n *\n * This is called when this Item is sent to a remote peer.\n *\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.\n */\n _write (encoder) {\n encoder.writeTypeRef(YXmlElementRefID)\n encoder.writeKey(this.nodeName)\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {YXmlElement}\n *\n * @function\n */\nexport const readYXmlElement = decoder => new YXmlElement(decoder.readKey())\n","import {\n YEvent,\n YXmlText, YXmlElement, YXmlFragment, Transaction // eslint-disable-line\n} from '../internals.js'\n\n/**\n * @extends YEvent\n * An Event that describes changes on a YXml Element or Yxml Fragment\n */\nexport class YXmlEvent extends YEvent {\n /**\n * @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created.\n * @param {Set} subs The set of changed attributes. `null` is included if the\n * child list changed.\n * @param {Transaction} transaction The transaction instance with which the\n * change was created.\n */\n constructor (target, subs, transaction) {\n super(target, transaction)\n /**\n * Whether the children changed.\n * @type {Boolean}\n * @private\n */\n this.childListChanged = false\n /**\n * Set of all changed attributes.\n * @type {Set}\n */\n this.attributesChanged = new Set()\n subs.forEach((sub) => {\n if (sub === null) {\n this.childListChanged = true\n } else {\n this.attributesChanged.add(sub)\n }\n })\n }\n}\n","import {\n YMap,\n YXmlHookRefID,\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2 // eslint-disable-line\n} from '../internals.js'\n\n/**\n * You can manage binding to a custom type with YXmlHook.\n *\n * @extends {YMap}\n */\nexport class YXmlHook extends YMap {\n /**\n * @param {string} hookName nodeName of the Dom Node.\n */\n constructor (hookName) {\n super()\n /**\n * @type {string}\n */\n this.hookName = hookName\n }\n\n /**\n * Creates an Item with the same effect as this Item (without position effect)\n */\n _copy () {\n return new YXmlHook(this.hookName)\n }\n\n /**\n * Makes a copy of this data type that can be included somewhere else.\n *\n * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.\n *\n * @return {YXmlHook}\n */\n clone () {\n const el = new YXmlHook(this.hookName)\n this.forEach((value, key) => {\n el.set(key, value)\n })\n return el\n }\n\n /**\n * Creates a Dom Element that mirrors this YXmlElement.\n *\n * @param {Document} [_document=document] The document object (you must define\n * this when calling this method in\n * nodejs)\n * @param {Object.} [hooks] Optional property to customize how hooks\n * are presented in the DOM\n * @param {any} [binding] You should not set this property. This is\n * used if DomBinding wants to create a\n * association to the created DOM type\n * @return {Element} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element}\n *\n * @public\n */\n toDOM (_document = document, hooks = {}, binding) {\n const hook = hooks[this.hookName]\n let dom\n if (hook !== undefined) {\n dom = hook.createDom(this)\n } else {\n dom = document.createElement(this.hookName)\n }\n dom.setAttribute('data-yjs-hook', this.hookName)\n if (binding !== undefined) {\n binding._createAssociation(dom, this)\n }\n return dom\n }\n\n /**\n * Transform the properties of this type to binary and write it to an\n * BinaryEncoder.\n *\n * This is called when this Item is sent to a remote peer.\n *\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.\n */\n _write (encoder) {\n encoder.writeTypeRef(YXmlHookRefID)\n encoder.writeKey(this.hookName)\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {YXmlHook}\n *\n * @private\n * @function\n */\nexport const readYXmlHook = decoder =>\n new YXmlHook(decoder.readKey())\n","import {\n YText,\n YXmlTextRefID,\n ContentType, YXmlElement, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, // eslint-disable-line\n} from '../internals.js'\n\n/**\n * Represents text in a Dom Element. In the future this type will also handle\n * simple formatting information like bold and italic.\n */\nexport class YXmlText extends YText {\n /**\n * @type {YXmlElement|YXmlText|null}\n */\n get nextSibling () {\n const n = this._item ? this._item.next : null\n return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null\n }\n\n /**\n * @type {YXmlElement|YXmlText|null}\n */\n get prevSibling () {\n const n = this._item ? this._item.prev : null\n return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null\n }\n\n _copy () {\n return new YXmlText()\n }\n\n /**\n * Makes a copy of this data type that can be included somewhere else.\n *\n * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.\n *\n * @return {YXmlText}\n */\n clone () {\n const text = new YXmlText()\n text.applyDelta(this.toDelta())\n return text\n }\n\n /**\n * Creates a Dom Element that mirrors this YXmlText.\n *\n * @param {Document} [_document=document] The document object (you must define\n * this when calling this method in\n * nodejs)\n * @param {Object} [hooks] Optional property to customize how hooks\n * are presented in the DOM\n * @param {any} [binding] You should not set this property. This is\n * used if DomBinding wants to create a\n * association to the created DOM type.\n * @return {Text} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element}\n *\n * @public\n */\n toDOM (_document = document, hooks, binding) {\n const dom = _document.createTextNode(this.toString())\n if (binding !== undefined) {\n binding._createAssociation(dom, this)\n }\n return dom\n }\n\n toString () {\n // @ts-ignore\n return this.toDelta().map(delta => {\n const nestedNodes = []\n for (const nodeName in delta.attributes) {\n const attrs = []\n for (const key in delta.attributes[nodeName]) {\n attrs.push({ key, value: delta.attributes[nodeName][key] })\n }\n // sort attributes to get a unique order\n attrs.sort((a, b) => a.key < b.key ? -1 : 1)\n nestedNodes.push({ nodeName, attrs })\n }\n // sort node order to get a unique order\n nestedNodes.sort((a, b) => a.nodeName < b.nodeName ? -1 : 1)\n // now convert to dom string\n let str = ''\n for (let i = 0; i < nestedNodes.length; i++) {\n const node = nestedNodes[i]\n str += `<${node.nodeName}`\n for (let j = 0; j < node.attrs.length; j++) {\n const attr = node.attrs[j]\n str += ` ${attr.key}=\"${attr.value}\"`\n }\n str += '>'\n }\n str += delta.insert\n for (let i = nestedNodes.length - 1; i >= 0; i--) {\n str += ``\n }\n return str\n }).join('')\n }\n\n /**\n * @return {string}\n */\n toJSON () {\n return this.toString()\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n */\n _write (encoder) {\n encoder.writeTypeRef(YXmlTextRefID)\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {YXmlText}\n *\n * @private\n * @function\n */\nexport const readYXmlText = decoder => new YXmlText()\n","import {\n UpdateEncoderV1, UpdateEncoderV2, ID, Transaction // eslint-disable-line\n} from '../internals.js'\n\nimport * as error from 'lib0/error'\n\nexport class AbstractStruct {\n /**\n * @param {ID} id\n * @param {number} length\n */\n constructor (id, length) {\n this.id = id\n this.length = length\n }\n\n /**\n * @type {boolean}\n */\n get deleted () {\n throw error.methodUnimplemented()\n }\n\n /**\n * Merge this struct with the item to the right.\n * This method is already assuming that `this.id.clock + this.length === this.id.clock`.\n * Also this method does *not* remove right from StructStore!\n * @param {AbstractStruct} right\n * @return {boolean} whether this merged with right\n */\n mergeWith (right) {\n return false\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.\n * @param {number} offset\n * @param {number} encodingRef\n */\n write (encoder, offset, encodingRef) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {Transaction} transaction\n * @param {number} offset\n */\n integrate (transaction, offset) {\n throw error.methodUnimplemented()\n }\n}\n","import {\n AbstractStruct,\n addStruct,\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, StructStore, Transaction, ID // eslint-disable-line\n} from '../internals.js'\n\nexport const structGCRefNumber = 0\n\n/**\n * @private\n */\nexport class GC extends AbstractStruct {\n get deleted () {\n return true\n }\n\n delete () {}\n\n /**\n * @param {GC} right\n * @return {boolean}\n */\n mergeWith (right) {\n if (this.constructor !== right.constructor) {\n return false\n }\n this.length += right.length\n return true\n }\n\n /**\n * @param {Transaction} transaction\n * @param {number} offset\n */\n integrate (transaction, offset) {\n if (offset > 0) {\n this.id.clock += offset\n this.length -= offset\n }\n addStruct(transaction.doc.store, this)\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeInfo(structGCRefNumber)\n encoder.writeLen(this.length - offset)\n }\n\n /**\n * @param {Transaction} transaction\n * @param {StructStore} store\n * @return {null | number}\n */\n getMissing (transaction, store) {\n return null\n }\n}\n","import {\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, StructStore, Item, Transaction // eslint-disable-line\n} from '../internals.js'\n\nimport * as error from 'lib0/error'\n\nexport class ContentBinary {\n /**\n * @param {Uint8Array} content\n */\n constructor (content) {\n this.content = content\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return 1\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return [this.content]\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentBinary}\n */\n copy () {\n return new ContentBinary(this.content)\n }\n\n /**\n * @param {number} offset\n * @return {ContentBinary}\n */\n splice (offset) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {ContentBinary} right\n * @return {boolean}\n */\n mergeWith (right) {\n return false\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {}\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeBuf(this.content)\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 3\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2 } decoder\n * @return {ContentBinary}\n */\nexport const readContentBinary = decoder => new ContentBinary(decoder.readBuf())\n","import {\n addToDeleteSet,\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, StructStore, Item, Transaction // eslint-disable-line\n} from '../internals.js'\n\nexport class ContentDeleted {\n /**\n * @param {number} len\n */\n constructor (len) {\n this.len = len\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return this.len\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return []\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return false\n }\n\n /**\n * @return {ContentDeleted}\n */\n copy () {\n return new ContentDeleted(this.len)\n }\n\n /**\n * @param {number} offset\n * @return {ContentDeleted}\n */\n splice (offset) {\n const right = new ContentDeleted(this.len - offset)\n this.len = offset\n return right\n }\n\n /**\n * @param {ContentDeleted} right\n * @return {boolean}\n */\n mergeWith (right) {\n this.len += right.len\n return true\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {\n addToDeleteSet(transaction.deleteSet, item.id.client, item.id.clock, this.len)\n item.markDeleted()\n }\n\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeLen(this.len - offset)\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 1\n }\n}\n\n/**\n * @private\n *\n * @param {UpdateDecoderV1 | UpdateDecoderV2 } decoder\n * @return {ContentDeleted}\n */\nexport const readContentDeleted = decoder => new ContentDeleted(decoder.readLen())\n","import {\n Doc, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, StructStore, Transaction, Item // eslint-disable-line\n} from '../internals.js'\n\nimport * as error from 'lib0/error'\n\n/**\n * @param {string} guid\n * @param {Object} opts\n */\nconst createDocFromOpts = (guid, opts) => new Doc({ guid, ...opts, shouldLoad: opts.shouldLoad || opts.autoLoad || false })\n\n/**\n * @private\n */\nexport class ContentDoc {\n /**\n * @param {Doc} doc\n */\n constructor (doc) {\n if (doc._item) {\n console.error('This document was already integrated as a sub-document. You should create a second instance instead with the same guid.')\n }\n /**\n * @type {Doc}\n */\n this.doc = doc\n /**\n * @type {any}\n */\n const opts = {}\n this.opts = opts\n if (!doc.gc) {\n opts.gc = false\n }\n if (doc.autoLoad) {\n opts.autoLoad = true\n }\n if (doc.meta !== null) {\n opts.meta = doc.meta\n }\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return 1\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return [this.doc]\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentDoc}\n */\n copy () {\n return new ContentDoc(createDocFromOpts(this.doc.guid, this.opts))\n }\n\n /**\n * @param {number} offset\n * @return {ContentDoc}\n */\n splice (offset) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {ContentDoc} right\n * @return {boolean}\n */\n mergeWith (right) {\n return false\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {\n // this needs to be reflected in doc.destroy as well\n this.doc._item = item\n transaction.subdocsAdded.add(this.doc)\n if (this.doc.shouldLoad) {\n transaction.subdocsLoaded.add(this.doc)\n }\n }\n\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {\n if (transaction.subdocsAdded.has(this.doc)) {\n transaction.subdocsAdded.delete(this.doc)\n } else {\n transaction.subdocsRemoved.add(this.doc)\n }\n }\n\n /**\n * @param {StructStore} store\n */\n gc (store) { }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeString(this.doc.guid)\n encoder.writeAny(this.opts)\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 9\n }\n}\n\n/**\n * @private\n *\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentDoc}\n */\nexport const readContentDoc = decoder => new ContentDoc(createDocFromOpts(decoder.readString(), decoder.readAny()))\n","import {\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, StructStore, Item, Transaction // eslint-disable-line\n} from '../internals.js'\n\nimport * as error from 'lib0/error'\n\n/**\n * @private\n */\nexport class ContentEmbed {\n /**\n * @param {Object} embed\n */\n constructor (embed) {\n this.embed = embed\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return 1\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return [this.embed]\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentEmbed}\n */\n copy () {\n return new ContentEmbed(this.embed)\n }\n\n /**\n * @param {number} offset\n * @return {ContentEmbed}\n */\n splice (offset) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {ContentEmbed} right\n * @return {boolean}\n */\n mergeWith (right) {\n return false\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {}\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeJSON(this.embed)\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 5\n }\n}\n\n/**\n * @private\n *\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentEmbed}\n */\nexport const readContentEmbed = decoder => new ContentEmbed(decoder.readJSON())\n","import {\n YText, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Item, StructStore, Transaction // eslint-disable-line\n} from '../internals.js'\n\nimport * as error from 'lib0/error'\n\n/**\n * @private\n */\nexport class ContentFormat {\n /**\n * @param {string} key\n * @param {Object} value\n */\n constructor (key, value) {\n this.key = key\n this.value = value\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return 1\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return []\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return false\n }\n\n /**\n * @return {ContentFormat}\n */\n copy () {\n return new ContentFormat(this.key, this.value)\n }\n\n /**\n * @param {number} _offset\n * @return {ContentFormat}\n */\n splice (_offset) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {ContentFormat} _right\n * @return {boolean}\n */\n mergeWith (_right) {\n return false\n }\n\n /**\n * @param {Transaction} _transaction\n * @param {Item} item\n */\n integrate (_transaction, item) {\n // @todo searchmarker are currently unsupported for rich text documents\n const p = /** @type {YText} */ (item.parent)\n p._searchMarker = null\n p._hasFormatting = true\n }\n\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeKey(this.key)\n encoder.writeJSON(this.value)\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 6\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentFormat}\n */\nexport const readContentFormat = decoder => new ContentFormat(decoder.readKey(), decoder.readJSON())\n","import {\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Transaction, Item, StructStore // eslint-disable-line\n} from '../internals.js'\n\n/**\n * @private\n */\nexport class ContentJSON {\n /**\n * @param {Array} arr\n */\n constructor (arr) {\n /**\n * @type {Array}\n */\n this.arr = arr\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return this.arr.length\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return this.arr\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentJSON}\n */\n copy () {\n return new ContentJSON(this.arr)\n }\n\n /**\n * @param {number} offset\n * @return {ContentJSON}\n */\n splice (offset) {\n const right = new ContentJSON(this.arr.slice(offset))\n this.arr = this.arr.slice(0, offset)\n return right\n }\n\n /**\n * @param {ContentJSON} right\n * @return {boolean}\n */\n mergeWith (right) {\n this.arr = this.arr.concat(right.arr)\n return true\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {}\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n const len = this.arr.length\n encoder.writeLen(len - offset)\n for (let i = offset; i < len; i++) {\n const c = this.arr[i]\n encoder.writeString(c === undefined ? 'undefined' : JSON.stringify(c))\n }\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 2\n }\n}\n\n/**\n * @private\n *\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentJSON}\n */\nexport const readContentJSON = decoder => {\n const len = decoder.readLen()\n const cs = []\n for (let i = 0; i < len; i++) {\n const c = decoder.readString()\n if (c === 'undefined') {\n cs.push(undefined)\n } else {\n cs.push(JSON.parse(c))\n }\n }\n return new ContentJSON(cs)\n}\n","import {\n UpdateEncoderV1, UpdateEncoderV2, UpdateDecoderV1, UpdateDecoderV2, Transaction, Item, StructStore // eslint-disable-line\n} from '../internals.js'\n\nimport * as env from 'lib0/environment'\nimport * as object from 'lib0/object'\n\nconst isDevMode = env.getVariable('node_env') === 'development'\n\nexport class ContentAny {\n /**\n * @param {Array} arr\n */\n constructor (arr) {\n /**\n * @type {Array}\n */\n this.arr = arr\n isDevMode && object.deepFreeze(arr)\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return this.arr.length\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return this.arr\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentAny}\n */\n copy () {\n return new ContentAny(this.arr)\n }\n\n /**\n * @param {number} offset\n * @return {ContentAny}\n */\n splice (offset) {\n const right = new ContentAny(this.arr.slice(offset))\n this.arr = this.arr.slice(0, offset)\n return right\n }\n\n /**\n * @param {ContentAny} right\n * @return {boolean}\n */\n mergeWith (right) {\n this.arr = this.arr.concat(right.arr)\n return true\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {}\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n const len = this.arr.length\n encoder.writeLen(len - offset)\n for (let i = offset; i < len; i++) {\n const c = this.arr[i]\n encoder.writeAny(c)\n }\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 8\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentAny}\n */\nexport const readContentAny = decoder => {\n const len = decoder.readLen()\n const cs = []\n for (let i = 0; i < len; i++) {\n cs.push(decoder.readAny())\n }\n return new ContentAny(cs)\n}\n","import {\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Transaction, Item, StructStore // eslint-disable-line\n} from '../internals.js'\n\n/**\n * @private\n */\nexport class ContentString {\n /**\n * @param {string} str\n */\n constructor (str) {\n /**\n * @type {string}\n */\n this.str = str\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return this.str.length\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return this.str.split('')\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentString}\n */\n copy () {\n return new ContentString(this.str)\n }\n\n /**\n * @param {number} offset\n * @return {ContentString}\n */\n splice (offset) {\n const right = new ContentString(this.str.slice(offset))\n this.str = this.str.slice(0, offset)\n\n // Prevent encoding invalid documents because of splitting of surrogate pairs: https://github.com/yjs/yjs/issues/248\n const firstCharCode = this.str.charCodeAt(offset - 1)\n if (firstCharCode >= 0xD800 && firstCharCode <= 0xDBFF) {\n // Last character of the left split is the start of a surrogate utf16/ucs2 pair.\n // We don't support splitting of surrogate pairs because this may lead to invalid documents.\n // Replace the invalid character with a unicode replacement character (� / U+FFFD)\n this.str = this.str.slice(0, offset - 1) + '�'\n // replace right as well\n right.str = '�' + right.str.slice(1)\n }\n return right\n }\n\n /**\n * @param {ContentString} right\n * @return {boolean}\n */\n mergeWith (right) {\n this.str += right.str\n return true\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {}\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeString(offset === 0 ? this.str : this.str.slice(offset))\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 4\n }\n}\n\n/**\n * @private\n *\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentString}\n */\nexport const readContentString = decoder => new ContentString(decoder.readString())\n","import {\n readYArray,\n readYMap,\n readYText,\n readYXmlElement,\n readYXmlFragment,\n readYXmlHook,\n readYXmlText,\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, StructStore, Transaction, Item, YEvent, AbstractType // eslint-disable-line\n} from '../internals.js'\n\nimport * as error from 'lib0/error'\n\n/**\n * @type {Array>}\n * @private\n */\nexport const typeRefs = [\n readYArray,\n readYMap,\n readYText,\n readYXmlElement,\n readYXmlFragment,\n readYXmlHook,\n readYXmlText\n]\n\nexport const YArrayRefID = 0\nexport const YMapRefID = 1\nexport const YTextRefID = 2\nexport const YXmlElementRefID = 3\nexport const YXmlFragmentRefID = 4\nexport const YXmlHookRefID = 5\nexport const YXmlTextRefID = 6\n\n/**\n * @private\n */\nexport class ContentType {\n /**\n * @param {AbstractType} type\n */\n constructor (type) {\n /**\n * @type {AbstractType}\n */\n this.type = type\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return 1\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return [this.type]\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentType}\n */\n copy () {\n return new ContentType(this.type._copy())\n }\n\n /**\n * @param {number} offset\n * @return {ContentType}\n */\n splice (offset) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {ContentType} right\n * @return {boolean}\n */\n mergeWith (right) {\n return false\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {\n this.type._integrate(transaction.doc, item)\n }\n\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {\n let item = this.type._start\n while (item !== null) {\n if (!item.deleted) {\n item.delete(transaction)\n } else if (item.id.clock < (transaction.beforeState.get(item.id.client) || 0)) {\n // This will be gc'd later and we want to merge it if possible\n // We try to merge all deleted items after each transaction,\n // but we have no knowledge about that this needs to be merged\n // since it is not in transaction.ds. Hence we add it to transaction._mergeStructs\n transaction._mergeStructs.push(item)\n }\n item = item.right\n }\n this.type._map.forEach(item => {\n if (!item.deleted) {\n item.delete(transaction)\n } else if (item.id.clock < (transaction.beforeState.get(item.id.client) || 0)) {\n // same as above\n transaction._mergeStructs.push(item)\n }\n })\n transaction.changed.delete(this.type)\n }\n\n /**\n * @param {StructStore} store\n */\n gc (store) {\n let item = this.type._start\n while (item !== null) {\n item.gc(store, true)\n item = item.right\n }\n this.type._start = null\n this.type._map.forEach(/** @param {Item | null} item */ (item) => {\n while (item !== null) {\n item.gc(store, true)\n item = item.left\n }\n })\n this.type._map = new Map()\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n this.type._write(encoder)\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 7\n }\n}\n\n/**\n * @private\n *\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentType}\n */\nexport const readContentType = decoder => new ContentType(typeRefs[decoder.readTypeRef()](decoder))\n","import {\n GC,\n getState,\n AbstractStruct,\n replaceStruct,\n addStruct,\n addToDeleteSet,\n findRootTypeKey,\n compareIDs,\n getItem,\n getItemCleanEnd,\n getItemCleanStart,\n readContentDeleted,\n readContentBinary,\n readContentJSON,\n readContentAny,\n readContentString,\n readContentEmbed,\n readContentDoc,\n createID,\n readContentFormat,\n readContentType,\n addChangedTypeToTransaction,\n isDeleted,\n StackItem, DeleteSet, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, ContentType, ContentDeleted, StructStore, ID, AbstractType, Transaction // eslint-disable-line\n} from '../internals.js'\n\nimport * as error from 'lib0/error'\nimport * as binary from 'lib0/binary'\nimport * as array from 'lib0/array'\n\n/**\n * @todo This should return several items\n *\n * @param {StructStore} store\n * @param {ID} id\n * @return {{item:Item, diff:number}}\n */\nexport const followRedone = (store, id) => {\n /**\n * @type {ID|null}\n */\n let nextID = id\n let diff = 0\n let item\n do {\n if (diff > 0) {\n nextID = createID(nextID.client, nextID.clock + diff)\n }\n item = getItem(store, nextID)\n diff = nextID.clock - item.id.clock\n nextID = item.redone\n } while (nextID !== null && item instanceof Item)\n return {\n item, diff\n }\n}\n\n/**\n * Make sure that neither item nor any of its parents is ever deleted.\n *\n * This property does not persist when storing it into a database or when\n * sending it to other peers\n *\n * @param {Item|null} item\n * @param {boolean} keep\n */\nexport const keepItem = (item, keep) => {\n while (item !== null && item.keep !== keep) {\n item.keep = keep\n item = /** @type {AbstractType} */ (item.parent)._item\n }\n}\n\n/**\n * Split leftItem into two items\n * @param {Transaction} transaction\n * @param {Item} leftItem\n * @param {number} diff\n * @return {Item}\n *\n * @function\n * @private\n */\nexport const splitItem = (transaction, leftItem, diff) => {\n // create rightItem\n const { client, clock } = leftItem.id\n const rightItem = new Item(\n createID(client, clock + diff),\n leftItem,\n createID(client, clock + diff - 1),\n leftItem.right,\n leftItem.rightOrigin,\n leftItem.parent,\n leftItem.parentSub,\n leftItem.content.splice(diff)\n )\n if (leftItem.deleted) {\n rightItem.markDeleted()\n }\n if (leftItem.keep) {\n rightItem.keep = true\n }\n if (leftItem.redone !== null) {\n rightItem.redone = createID(leftItem.redone.client, leftItem.redone.clock + diff)\n }\n // update left (do not set leftItem.rightOrigin as it will lead to problems when syncing)\n leftItem.right = rightItem\n // update right\n if (rightItem.right !== null) {\n rightItem.right.left = rightItem\n }\n // right is more specific.\n transaction._mergeStructs.push(rightItem)\n // update parent._map\n if (rightItem.parentSub !== null && rightItem.right === null) {\n /** @type {AbstractType} */ (rightItem.parent)._map.set(rightItem.parentSub, rightItem)\n }\n leftItem.length = diff\n return rightItem\n}\n\n/**\n * @param {Array} stack\n * @param {ID} id\n */\nconst isDeletedByUndoStack = (stack, id) => array.some(stack, /** @param {StackItem} s */ s => isDeleted(s.deletions, id))\n\n/**\n * Redoes the effect of this operation.\n *\n * @param {Transaction} transaction The Yjs instance.\n * @param {Item} item\n * @param {Set} redoitems\n * @param {DeleteSet} itemsToDelete\n * @param {boolean} ignoreRemoteMapChanges\n * @param {import('../utils/UndoManager.js').UndoManager} um\n *\n * @return {Item|null}\n *\n * @private\n */\nexport const redoItem = (transaction, item, redoitems, itemsToDelete, ignoreRemoteMapChanges, um) => {\n const doc = transaction.doc\n const store = doc.store\n const ownClientID = doc.clientID\n const redone = item.redone\n if (redone !== null) {\n return getItemCleanStart(transaction, redone)\n }\n let parentItem = /** @type {AbstractType} */ (item.parent)._item\n /**\n * @type {Item|null}\n */\n let left = null\n /**\n * @type {Item|null}\n */\n let right\n // make sure that parent is redone\n if (parentItem !== null && parentItem.deleted === true) {\n // try to undo parent if it will be undone anyway\n if (parentItem.redone === null && (!redoitems.has(parentItem) || redoItem(transaction, parentItem, redoitems, itemsToDelete, ignoreRemoteMapChanges, um) === null)) {\n return null\n }\n while (parentItem.redone !== null) {\n parentItem = getItemCleanStart(transaction, parentItem.redone)\n }\n }\n const parentType = parentItem === null ? /** @type {AbstractType} */ (item.parent) : /** @type {ContentType} */ (parentItem.content).type\n\n if (item.parentSub === null) {\n // Is an array item. Insert at the old position\n left = item.left\n right = item\n // find next cloned_redo items\n while (left !== null) {\n /**\n * @type {Item|null}\n */\n let leftTrace = left\n // trace redone until parent matches\n while (leftTrace !== null && /** @type {AbstractType} */ (leftTrace.parent)._item !== parentItem) {\n leftTrace = leftTrace.redone === null ? null : getItemCleanStart(transaction, leftTrace.redone)\n }\n if (leftTrace !== null && /** @type {AbstractType} */ (leftTrace.parent)._item === parentItem) {\n left = leftTrace\n break\n }\n left = left.left\n }\n while (right !== null) {\n /**\n * @type {Item|null}\n */\n let rightTrace = right\n // trace redone until parent matches\n while (rightTrace !== null && /** @type {AbstractType} */ (rightTrace.parent)._item !== parentItem) {\n rightTrace = rightTrace.redone === null ? null : getItemCleanStart(transaction, rightTrace.redone)\n }\n if (rightTrace !== null && /** @type {AbstractType} */ (rightTrace.parent)._item === parentItem) {\n right = rightTrace\n break\n }\n right = right.right\n }\n } else {\n right = null\n if (item.right && !ignoreRemoteMapChanges) {\n left = item\n // Iterate right while right is in itemsToDelete\n // If it is intended to delete right while item is redone, we can expect that item should replace right.\n while (left !== null && left.right !== null && (left.right.redone || isDeleted(itemsToDelete, left.right.id) || isDeletedByUndoStack(um.undoStack, left.right.id) || isDeletedByUndoStack(um.redoStack, left.right.id))) {\n left = left.right\n // follow redone\n while (left.redone) left = getItemCleanStart(transaction, left.redone)\n }\n if (left && left.right !== null) {\n // It is not possible to redo this item because it conflicts with a\n // change from another client\n return null\n }\n } else {\n left = parentType._map.get(item.parentSub) || null\n }\n }\n const nextClock = getState(store, ownClientID)\n const nextId = createID(ownClientID, nextClock)\n const redoneItem = new Item(\n nextId,\n left, left && left.lastId,\n right, right && right.id,\n parentType,\n item.parentSub,\n item.content.copy()\n )\n item.redone = nextId\n keepItem(redoneItem, true)\n redoneItem.integrate(transaction, 0)\n return redoneItem\n}\n\n/**\n * Abstract class that represents any content.\n */\nexport class Item extends AbstractStruct {\n /**\n * @param {ID} id\n * @param {Item | null} left\n * @param {ID | null} origin\n * @param {Item | null} right\n * @param {ID | null} rightOrigin\n * @param {AbstractType|ID|null} parent Is a type if integrated, is null if it is possible to copy parent from left or right, is ID before integration to search for it.\n * @param {string | null} parentSub\n * @param {AbstractContent} content\n */\n constructor (id, left, origin, right, rightOrigin, parent, parentSub, content) {\n super(id, content.getLength())\n /**\n * The item that was originally to the left of this item.\n * @type {ID | null}\n */\n this.origin = origin\n /**\n * The item that is currently to the left of this item.\n * @type {Item | null}\n */\n this.left = left\n /**\n * The item that is currently to the right of this item.\n * @type {Item | null}\n */\n this.right = right\n /**\n * The item that was originally to the right of this item.\n * @type {ID | null}\n */\n this.rightOrigin = rightOrigin\n /**\n * @type {AbstractType|ID|null}\n */\n this.parent = parent\n /**\n * If the parent refers to this item with some kind of key (e.g. YMap, the\n * key is specified here. The key is then used to refer to the list in which\n * to insert this item. If `parentSub = null` type._start is the list in\n * which to insert to. Otherwise it is `parent._map`.\n * @type {String | null}\n */\n this.parentSub = parentSub\n /**\n * If this type's effect is redone this type refers to the type that undid\n * this operation.\n * @type {ID | null}\n */\n this.redone = null\n /**\n * @type {AbstractContent}\n */\n this.content = content\n /**\n * bit1: keep\n * bit2: countable\n * bit3: deleted\n * bit4: mark - mark node as fast-search-marker\n * @type {number} byte\n */\n this.info = this.content.isCountable() ? binary.BIT2 : 0\n }\n\n /**\n * This is used to mark the item as an indexed fast-search marker\n *\n * @type {boolean}\n */\n set marker (isMarked) {\n if (((this.info & binary.BIT4) > 0) !== isMarked) {\n this.info ^= binary.BIT4\n }\n }\n\n get marker () {\n return (this.info & binary.BIT4) > 0\n }\n\n /**\n * If true, do not garbage collect this Item.\n */\n get keep () {\n return (this.info & binary.BIT1) > 0\n }\n\n set keep (doKeep) {\n if (this.keep !== doKeep) {\n this.info ^= binary.BIT1\n }\n }\n\n get countable () {\n return (this.info & binary.BIT2) > 0\n }\n\n /**\n * Whether this item was deleted or not.\n * @type {Boolean}\n */\n get deleted () {\n return (this.info & binary.BIT3) > 0\n }\n\n set deleted (doDelete) {\n if (this.deleted !== doDelete) {\n this.info ^= binary.BIT3\n }\n }\n\n markDeleted () {\n this.info |= binary.BIT3\n }\n\n /**\n * Return the creator clientID of the missing op or define missing items and return null.\n *\n * @param {Transaction} transaction\n * @param {StructStore} store\n * @return {null | number}\n */\n getMissing (transaction, store) {\n if (this.origin && this.origin.client !== this.id.client && this.origin.clock >= getState(store, this.origin.client)) {\n return this.origin.client\n }\n if (this.rightOrigin && this.rightOrigin.client !== this.id.client && this.rightOrigin.clock >= getState(store, this.rightOrigin.client)) {\n return this.rightOrigin.client\n }\n if (this.parent && this.parent.constructor === ID && this.id.client !== this.parent.client && this.parent.clock >= getState(store, this.parent.client)) {\n return this.parent.client\n }\n\n // We have all missing ids, now find the items\n\n if (this.origin) {\n this.left = getItemCleanEnd(transaction, store, this.origin)\n this.origin = this.left.lastId\n }\n if (this.rightOrigin) {\n this.right = getItemCleanStart(transaction, this.rightOrigin)\n this.rightOrigin = this.right.id\n }\n if ((this.left && this.left.constructor === GC) || (this.right && this.right.constructor === GC)) {\n this.parent = null\n } else if (!this.parent) {\n // only set parent if this shouldn't be garbage collected\n if (this.left && this.left.constructor === Item) {\n this.parent = this.left.parent\n this.parentSub = this.left.parentSub\n } else if (this.right && this.right.constructor === Item) {\n this.parent = this.right.parent\n this.parentSub = this.right.parentSub\n }\n } else if (this.parent.constructor === ID) {\n const parentItem = getItem(store, this.parent)\n if (parentItem.constructor === GC) {\n this.parent = null\n } else {\n this.parent = /** @type {ContentType} */ (parentItem.content).type\n }\n }\n return null\n }\n\n /**\n * @param {Transaction} transaction\n * @param {number} offset\n */\n integrate (transaction, offset) {\n if (offset > 0) {\n this.id.clock += offset\n this.left = getItemCleanEnd(transaction, transaction.doc.store, createID(this.id.client, this.id.clock - 1))\n this.origin = this.left.lastId\n this.content = this.content.splice(offset)\n this.length -= offset\n }\n\n if (this.parent) {\n if ((!this.left && (!this.right || this.right.left !== null)) || (this.left && this.left.right !== this.right)) {\n /**\n * @type {Item|null}\n */\n let left = this.left\n\n /**\n * @type {Item|null}\n */\n let o\n // set o to the first conflicting item\n if (left !== null) {\n o = left.right\n } else if (this.parentSub !== null) {\n o = /** @type {AbstractType} */ (this.parent)._map.get(this.parentSub) || null\n while (o !== null && o.left !== null) {\n o = o.left\n }\n } else {\n o = /** @type {AbstractType} */ (this.parent)._start\n }\n // TODO: use something like DeleteSet here (a tree implementation would be best)\n // @todo use global set definitions\n /**\n * @type {Set}\n */\n const conflictingItems = new Set()\n /**\n * @type {Set}\n */\n const itemsBeforeOrigin = new Set()\n // Let c in conflictingItems, b in itemsBeforeOrigin\n // ***{origin}bbbb{this}{c,b}{c,b}{o}***\n // Note that conflictingItems is a subset of itemsBeforeOrigin\n while (o !== null && o !== this.right) {\n itemsBeforeOrigin.add(o)\n conflictingItems.add(o)\n if (compareIDs(this.origin, o.origin)) {\n // case 1\n if (o.id.client < this.id.client) {\n left = o\n conflictingItems.clear()\n } else if (compareIDs(this.rightOrigin, o.rightOrigin)) {\n // this and o are conflicting and point to the same integration points. The id decides which item comes first.\n // Since this is to the left of o, we can break here\n break\n } // else, o might be integrated before an item that this conflicts with. If so, we will find it in the next iterations\n } else if (o.origin !== null && itemsBeforeOrigin.has(getItem(transaction.doc.store, o.origin))) { // use getItem instead of getItemCleanEnd because we don't want / need to split items.\n // case 2\n if (!conflictingItems.has(getItem(transaction.doc.store, o.origin))) {\n left = o\n conflictingItems.clear()\n }\n } else {\n break\n }\n o = o.right\n }\n this.left = left\n }\n // reconnect left/right + update parent map/start if necessary\n if (this.left !== null) {\n const right = this.left.right\n this.right = right\n this.left.right = this\n } else {\n let r\n if (this.parentSub !== null) {\n r = /** @type {AbstractType} */ (this.parent)._map.get(this.parentSub) || null\n while (r !== null && r.left !== null) {\n r = r.left\n }\n } else {\n r = /** @type {AbstractType} */ (this.parent)._start\n ;/** @type {AbstractType} */ (this.parent)._start = this\n }\n this.right = r\n }\n if (this.right !== null) {\n this.right.left = this\n } else if (this.parentSub !== null) {\n // set as current parent value if right === null and this is parentSub\n /** @type {AbstractType} */ (this.parent)._map.set(this.parentSub, this)\n if (this.left !== null) {\n // this is the current attribute value of parent. delete right\n this.left.delete(transaction)\n }\n }\n // adjust length of parent\n if (this.parentSub === null && this.countable && !this.deleted) {\n /** @type {AbstractType} */ (this.parent)._length += this.length\n }\n addStruct(transaction.doc.store, this)\n this.content.integrate(transaction, this)\n // add parent to transaction.changed\n addChangedTypeToTransaction(transaction, /** @type {AbstractType} */ (this.parent), this.parentSub)\n if ((/** @type {AbstractType} */ (this.parent)._item !== null && /** @type {AbstractType} */ (this.parent)._item.deleted) || (this.parentSub !== null && this.right !== null)) {\n // delete if parent is deleted or if this is not the current attribute value of parent\n this.delete(transaction)\n }\n } else {\n // parent is not defined. Integrate GC struct instead\n new GC(this.id, this.length).integrate(transaction, 0)\n }\n }\n\n /**\n * Returns the next non-deleted item\n */\n get next () {\n let n = this.right\n while (n !== null && n.deleted) {\n n = n.right\n }\n return n\n }\n\n /**\n * Returns the previous non-deleted item\n */\n get prev () {\n let n = this.left\n while (n !== null && n.deleted) {\n n = n.left\n }\n return n\n }\n\n /**\n * Computes the last content address of this Item.\n */\n get lastId () {\n // allocating ids is pretty costly because of the amount of ids created, so we try to reuse whenever possible\n return this.length === 1 ? this.id : createID(this.id.client, this.id.clock + this.length - 1)\n }\n\n /**\n * Try to merge two items\n *\n * @param {Item} right\n * @return {boolean}\n */\n mergeWith (right) {\n if (\n this.constructor === right.constructor &&\n compareIDs(right.origin, this.lastId) &&\n this.right === right &&\n compareIDs(this.rightOrigin, right.rightOrigin) &&\n this.id.client === right.id.client &&\n this.id.clock + this.length === right.id.clock &&\n this.deleted === right.deleted &&\n this.redone === null &&\n right.redone === null &&\n this.content.constructor === right.content.constructor &&\n this.content.mergeWith(right.content)\n ) {\n const searchMarker = /** @type {AbstractType} */ (this.parent)._searchMarker\n if (searchMarker) {\n searchMarker.forEach(marker => {\n if (marker.p === right) {\n // right is going to be \"forgotten\" so we need to update the marker\n marker.p = this\n // adjust marker index\n if (!this.deleted && this.countable) {\n marker.index -= this.length\n }\n }\n })\n }\n if (right.keep) {\n this.keep = true\n }\n this.right = right.right\n if (this.right !== null) {\n this.right.left = this\n }\n this.length += right.length\n return true\n }\n return false\n }\n\n /**\n * Mark this Item as deleted.\n *\n * @param {Transaction} transaction\n */\n delete (transaction) {\n if (!this.deleted) {\n const parent = /** @type {AbstractType} */ (this.parent)\n // adjust the length of parent\n if (this.countable && this.parentSub === null) {\n parent._length -= this.length\n }\n this.markDeleted()\n addToDeleteSet(transaction.deleteSet, this.id.client, this.id.clock, this.length)\n addChangedTypeToTransaction(transaction, parent, this.parentSub)\n this.content.delete(transaction)\n }\n }\n\n /**\n * @param {StructStore} store\n * @param {boolean} parentGCd\n */\n gc (store, parentGCd) {\n if (!this.deleted) {\n throw error.unexpectedCase()\n }\n this.content.gc(store)\n if (parentGCd) {\n replaceStruct(store, this, new GC(this.id, this.length))\n } else {\n this.content = new ContentDeleted(this.length)\n }\n }\n\n /**\n * Transform the properties of this type to binary and write it to an\n * BinaryEncoder.\n *\n * This is called when this Item is sent to a remote peer.\n *\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.\n * @param {number} offset\n */\n write (encoder, offset) {\n const origin = offset > 0 ? createID(this.id.client, this.id.clock + offset - 1) : this.origin\n const rightOrigin = this.rightOrigin\n const parentSub = this.parentSub\n const info = (this.content.getRef() & binary.BITS5) |\n (origin === null ? 0 : binary.BIT8) | // origin is defined\n (rightOrigin === null ? 0 : binary.BIT7) | // right origin is defined\n (parentSub === null ? 0 : binary.BIT6) // parentSub is non-null\n encoder.writeInfo(info)\n if (origin !== null) {\n encoder.writeLeftID(origin)\n }\n if (rightOrigin !== null) {\n encoder.writeRightID(rightOrigin)\n }\n if (origin === null && rightOrigin === null) {\n const parent = /** @type {AbstractType} */ (this.parent)\n if (parent._item !== undefined) {\n const parentItem = parent._item\n if (parentItem === null) {\n // parent type on y._map\n // find the correct key\n const ykey = findRootTypeKey(parent)\n encoder.writeParentInfo(true) // write parentYKey\n encoder.writeString(ykey)\n } else {\n encoder.writeParentInfo(false) // write parent id\n encoder.writeLeftID(parentItem.id)\n }\n } else if (parent.constructor === String) { // this edge case was added by differential updates\n encoder.writeParentInfo(true) // write parentYKey\n encoder.writeString(parent)\n } else if (parent.constructor === ID) {\n encoder.writeParentInfo(false) // write parent id\n encoder.writeLeftID(parent)\n } else {\n error.unexpectedCase()\n }\n if (parentSub !== null) {\n encoder.writeString(parentSub)\n }\n }\n this.content.write(encoder, offset)\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @param {number} info\n */\nexport const readItemContent = (decoder, info) => contentRefs[info & binary.BITS5](decoder)\n\n/**\n * A lookup map for reading Item content.\n *\n * @type {Array}\n */\nexport const contentRefs = [\n () => { error.unexpectedCase() }, // GC is not ItemContent\n readContentDeleted, // 1\n readContentJSON, // 2\n readContentBinary, // 3\n readContentString, // 4\n readContentEmbed, // 5\n readContentFormat, // 6\n readContentType, // 7\n readContentAny, // 8\n readContentDoc, // 9\n () => { error.unexpectedCase() } // 10 - Skip is not ItemContent\n]\n\n/**\n * Do not implement this class!\n */\nexport class AbstractContent {\n /**\n * @return {number}\n */\n getLength () {\n throw error.methodUnimplemented()\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n throw error.methodUnimplemented()\n }\n\n /**\n * Should return false if this Item is some kind of meta information\n * (e.g. format information).\n *\n * * Whether this Item should be addressable via `yarray.get(i)`\n * * Whether this Item should be counted when computing yarray.length\n *\n * @return {boolean}\n */\n isCountable () {\n throw error.methodUnimplemented()\n }\n\n /**\n * @return {AbstractContent}\n */\n copy () {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {number} _offset\n * @return {AbstractContent}\n */\n splice (_offset) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {AbstractContent} _right\n * @return {boolean}\n */\n mergeWith (_right) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {Transaction} _transaction\n * @param {Item} _item\n */\n integrate (_transaction, _item) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {Transaction} _transaction\n */\n delete (_transaction) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {StructStore} _store\n */\n gc (_store) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} _encoder\n * @param {number} _offset\n */\n write (_encoder, _offset) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @return {number}\n */\n getRef () {\n throw error.methodUnimplemented()\n }\n}\n","import {\n AbstractStruct,\n UpdateEncoderV1, UpdateEncoderV2, StructStore, Transaction, ID // eslint-disable-line\n} from '../internals.js'\nimport * as error from 'lib0/error'\nimport * as encoding from 'lib0/encoding'\n\nexport const structSkipRefNumber = 10\n\n/**\n * @private\n */\nexport class Skip extends AbstractStruct {\n get deleted () {\n return true\n }\n\n delete () {}\n\n /**\n * @param {Skip} right\n * @return {boolean}\n */\n mergeWith (right) {\n if (this.constructor !== right.constructor) {\n return false\n }\n this.length += right.length\n return true\n }\n\n /**\n * @param {Transaction} transaction\n * @param {number} offset\n */\n integrate (transaction, offset) {\n // skip structs cannot be integrated\n error.unexpectedCase()\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeInfo(structSkipRefNumber)\n // write as VarUint because Skips can't make use of predictable length-encoding\n encoding.writeVarUint(encoder.restEncoder, this.length - offset)\n }\n\n /**\n * @param {Transaction} transaction\n * @param {StructStore} store\n * @return {null | number}\n */\n getMissing (transaction, store) {\n return null\n }\n}\n","/** eslint-env browser */\n\nexport {\n Doc,\n Transaction,\n YArray as Array,\n YMap as Map,\n YText as Text,\n YXmlText as XmlText,\n YXmlHook as XmlHook,\n YXmlElement as XmlElement,\n YXmlFragment as XmlFragment,\n YXmlEvent,\n YMapEvent,\n YArrayEvent,\n YTextEvent,\n YEvent,\n Item,\n AbstractStruct,\n GC,\n Skip,\n ContentBinary,\n ContentDeleted,\n ContentDoc,\n ContentEmbed,\n ContentFormat,\n ContentJSON,\n ContentAny,\n ContentString,\n ContentType,\n AbstractType,\n getTypeChildren,\n createRelativePositionFromTypeIndex,\n createRelativePositionFromJSON,\n createAbsolutePositionFromRelativePosition,\n compareRelativePositions,\n AbsolutePosition,\n RelativePosition,\n ID,\n createID,\n compareIDs,\n getState,\n Snapshot,\n createSnapshot,\n createDeleteSet,\n createDeleteSetFromStructStore,\n cleanupYTextFormatting,\n snapshot,\n emptySnapshot,\n findRootTypeKey,\n findIndexSS,\n getItem,\n getItemCleanStart,\n getItemCleanEnd,\n typeListToArraySnapshot,\n typeMapGetSnapshot,\n typeMapGetAllSnapshot,\n createDocFromSnapshot,\n iterateDeletedStructs,\n applyUpdate,\n applyUpdateV2,\n readUpdate,\n readUpdateV2,\n encodeStateAsUpdate,\n encodeStateAsUpdateV2,\n encodeStateVector,\n UndoManager,\n decodeSnapshot,\n encodeSnapshot,\n decodeSnapshotV2,\n encodeSnapshotV2,\n decodeStateVector,\n logUpdate,\n logUpdateV2,\n decodeUpdate,\n decodeUpdateV2,\n relativePositionToJSON,\n isDeleted,\n isParentOf,\n equalSnapshots,\n PermanentUserData, // @TODO experimental\n tryGc,\n transact,\n AbstractConnector,\n logType,\n mergeUpdates,\n mergeUpdatesV2,\n parseUpdateMeta,\n parseUpdateMetaV2,\n encodeStateVectorFromUpdate,\n encodeStateVectorFromUpdateV2,\n encodeRelativePosition,\n decodeRelativePosition,\n diffUpdate,\n diffUpdateV2,\n convertUpdateFormatV1ToV2,\n convertUpdateFormatV2ToV1,\n obfuscateUpdate,\n obfuscateUpdateV2,\n UpdateEncoderV1,\n UpdateEncoderV2,\n UpdateDecoderV1,\n UpdateDecoderV2,\n equalDeleteSets,\n mergeDeleteSets,\n snapshotContainsUpdate\n} from './internals.js'\n\nconst glo = /** @type {any} */ (typeof globalThis !== 'undefined'\n ? globalThis\n : typeof window !== 'undefined'\n ? window\n // @ts-ignore\n : typeof global !== 'undefined' ? global : {})\n\nconst importIdentifier = '__ $YJS$ __'\n\nif (glo[importIdentifier] === true) {\n /**\n * Dear reader of this message. Please take this seriously.\n *\n * If you see this message, make sure that you only import one version of Yjs. In many cases,\n * your package manager installs two versions of Yjs that are used by different packages within your project.\n * Another reason for this message is that some parts of your project use the commonjs version of Yjs\n * and others use the EcmaScript version of Yjs.\n *\n * This often leads to issues that are hard to debug. We often need to perform constructor checks,\n * e.g. `struct instanceof GC`. If you imported different versions of Yjs, it is impossible for us to\n * do the constructor checks anymore - which might break the CRDT algorithm.\n *\n * https://github.com/yjs/yjs/issues/438\n */\n console.error('Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438')\n}\nglo[importIdentifier] = true\n"],"names":["ObservableV2","math","array","map","encoding","decoding","random","promise","buffer","error","binary","f","set","callAll","logging","time","string","log","iterator","object","env"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,iBAAiB,SAASA,uBAAY,CAAC;AACpD;AACA;AACA;AACA;AACA,EAAE,WAAW,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE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C1B,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE;AAC1B,IAAI,OAAO,CAAC,SAAS,CAAC,mBAAmB,EAAC;AAC1C;AACA,IAAIL,mBAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,GAAG,MAAM,EAAC;AACpE,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,UAAU,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE;AAClC,IAAI,OAAO,IAAI;AACf,GAAG;AACH;;AC1DA;AACA;AA0GA;AACA,MAAM,GAAG,uBAAuB,OAAO,UAAU,KAAK,WAAW;AACjE,IAAI,UAAU;AACd,IAAI,OAAO,MAAM,KAAK,WAAW;AACjC,MAAM,MAAM;AACZ;AACA,MAAM,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,GAAG,EAAE,EAAC;AAClD;AACA,MAAM,gBAAgB,GAAG,cAAa;AACtC;AACA,IAAI,GAAG,CAAC,gBAAgB,CAAC,KAAK,IAAI,EAAE;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,OAAO,CAAC,KAAK,CAAC,2HAA2H,EAAC;AAC5I,CAAC;AACD,GAAG,CAAC,gBAAgB,CAAC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/dist/yjs.mjs b/yjs-poll/node_modules/yjs/dist/yjs.mjs deleted file mode 100644 index d6f800c..0000000 --- a/yjs-poll/node_modules/yjs/dist/yjs.mjs +++ /dev/null @@ -1,10295 +0,0 @@ -import { ObservableV2 } from 'lib0/observable'; -import * as array from 'lib0/array'; -import * as math from 'lib0/math'; -import * as map from 'lib0/map'; -import * as encoding from 'lib0/encoding'; -import * as decoding from 'lib0/decoding'; -import * as random from 'lib0/random'; -import * as promise from 'lib0/promise'; -import * as buffer from 'lib0/buffer'; -import * as error from 'lib0/error'; -import * as binary from 'lib0/binary'; -import * as f from 'lib0/function'; -import { callAll } from 'lib0/function'; -import * as set from 'lib0/set'; -import * as logging from 'lib0/logging'; -import * as time from 'lib0/time'; -import * as string from 'lib0/string'; -import * as iterator from 'lib0/iterator'; -import * as object from 'lib0/object'; -import * as env from 'lib0/environment'; - -/** - * This is an abstract interface that all Connectors should implement to keep them interchangeable. - * - * @note This interface is experimental and it is not advised to actually inherit this class. - * It just serves as typing information. - * - * @extends {ObservableV2} - */ -class AbstractConnector extends ObservableV2 { - /** - * @param {Doc} ydoc - * @param {any} awareness - */ - constructor (ydoc, awareness) { - super(); - this.doc = ydoc; - this.awareness = awareness; - } -} - -class DeleteItem { - /** - * @param {number} clock - * @param {number} len - */ - constructor (clock, len) { - /** - * @type {number} - */ - this.clock = clock; - /** - * @type {number} - */ - this.len = len; - } -} - -/** - * We no longer maintain a DeleteStore. DeleteSet is a temporary object that is created when needed. - * - When created in a transaction, it must only be accessed after sorting, and merging - * - This DeleteSet is send to other clients - * - We do not create a DeleteSet when we send a sync message. The DeleteSet message is created directly from StructStore - * - We read a DeleteSet as part of a sync/update message. In this case the DeleteSet is already sorted and merged. - */ -class DeleteSet { - constructor () { - /** - * @type {Map>} - */ - this.clients = new Map(); - } -} - -/** - * Iterate over all structs that the DeleteSet gc's. - * - * @param {Transaction} transaction - * @param {DeleteSet} ds - * @param {function(GC|Item):void} f - * - * @function - */ -const iterateDeletedStructs = (transaction, ds, f) => - ds.clients.forEach((deletes, clientid) => { - const structs = /** @type {Array} */ (transaction.doc.store.clients.get(clientid)); - if (structs != null) { - const lastStruct = structs[structs.length - 1]; - const clockState = lastStruct.id.clock + lastStruct.length; - for (let i = 0, del = deletes[i]; i < deletes.length && del.clock < clockState; del = deletes[++i]) { - iterateStructs(transaction, structs, del.clock, del.len, f); - } - } - }); - -/** - * @param {Array} dis - * @param {number} clock - * @return {number|null} - * - * @private - * @function - */ -const findIndexDS = (dis, clock) => { - let left = 0; - let right = dis.length - 1; - while (left <= right) { - const midindex = math.floor((left + right) / 2); - const mid = dis[midindex]; - const midclock = mid.clock; - if (midclock <= clock) { - if (clock < midclock + mid.len) { - return midindex - } - left = midindex + 1; - } else { - right = midindex - 1; - } - } - return null -}; - -/** - * @param {DeleteSet} ds - * @param {ID} id - * @return {boolean} - * - * @private - * @function - */ -const isDeleted = (ds, id) => { - const dis = ds.clients.get(id.client); - return dis !== undefined && findIndexDS(dis, id.clock) !== null -}; - -/** - * @param {DeleteSet} ds - * - * @private - * @function - */ -const sortAndMergeDeleteSet = ds => { - ds.clients.forEach(dels => { - dels.sort((a, b) => a.clock - b.clock); - // merge items without filtering or splicing the array - // i is the current pointer - // j refers to the current insert position for the pointed item - // try to merge dels[i] into dels[j-1] or set dels[j]=dels[i] - let i, j; - for (i = 1, j = 1; i < dels.length; i++) { - const left = dels[j - 1]; - const right = dels[i]; - if (left.clock + left.len >= right.clock) { - left.len = math.max(left.len, right.clock + right.len - left.clock); - } else { - if (j < i) { - dels[j] = right; - } - j++; - } - } - dels.length = j; - }); -}; - -/** - * @param {Array} dss - * @return {DeleteSet} A fresh DeleteSet - */ -const mergeDeleteSets = dss => { - const merged = new DeleteSet(); - for (let dssI = 0; dssI < dss.length; dssI++) { - dss[dssI].clients.forEach((delsLeft, client) => { - if (!merged.clients.has(client)) { - // Write all missing keys from current ds and all following. - // If merged already contains `client` current ds has already been added. - /** - * @type {Array} - */ - const dels = delsLeft.slice(); - for (let i = dssI + 1; i < dss.length; i++) { - array.appendTo(dels, dss[i].clients.get(client) || []); - } - merged.clients.set(client, dels); - } - }); - } - sortAndMergeDeleteSet(merged); - return merged -}; - -/** - * @param {DeleteSet} ds - * @param {number} client - * @param {number} clock - * @param {number} length - * - * @private - * @function - */ -const addToDeleteSet = (ds, client, clock, length) => { - map.setIfUndefined(ds.clients, client, () => /** @type {Array} */ ([])).push(new DeleteItem(clock, length)); -}; - -const createDeleteSet = () => new DeleteSet(); - -/** - * @param {StructStore} ss - * @return {DeleteSet} Merged and sorted DeleteSet - * - * @private - * @function - */ -const createDeleteSetFromStructStore = ss => { - const ds = createDeleteSet(); - ss.clients.forEach((structs, client) => { - /** - * @type {Array} - */ - const dsitems = []; - for (let i = 0; i < structs.length; i++) { - const struct = structs[i]; - if (struct.deleted) { - const clock = struct.id.clock; - let len = struct.length; - if (i + 1 < structs.length) { - for (let next = structs[i + 1]; i + 1 < structs.length && next.deleted; next = structs[++i + 1]) { - len += next.length; - } - } - dsitems.push(new DeleteItem(clock, len)); - } - } - if (dsitems.length > 0) { - ds.clients.set(client, dsitems); - } - }); - return ds -}; - -/** - * @param {DSEncoderV1 | DSEncoderV2} encoder - * @param {DeleteSet} ds - * - * @private - * @function - */ -const writeDeleteSet = (encoder, ds) => { - encoding.writeVarUint(encoder.restEncoder, ds.clients.size); - - // Ensure that the delete set is written in a deterministic order - array.from(ds.clients.entries()) - .sort((a, b) => b[0] - a[0]) - .forEach(([client, dsitems]) => { - encoder.resetDsCurVal(); - encoding.writeVarUint(encoder.restEncoder, client); - const len = dsitems.length; - encoding.writeVarUint(encoder.restEncoder, len); - for (let i = 0; i < len; i++) { - const item = dsitems[i]; - encoder.writeDsClock(item.clock); - encoder.writeDsLen(item.len); - } - }); -}; - -/** - * @param {DSDecoderV1 | DSDecoderV2} decoder - * @return {DeleteSet} - * - * @private - * @function - */ -const readDeleteSet = decoder => { - const ds = new DeleteSet(); - const numClients = decoding.readVarUint(decoder.restDecoder); - for (let i = 0; i < numClients; i++) { - decoder.resetDsCurVal(); - const client = decoding.readVarUint(decoder.restDecoder); - const numberOfDeletes = decoding.readVarUint(decoder.restDecoder); - if (numberOfDeletes > 0) { - const dsField = map.setIfUndefined(ds.clients, client, () => /** @type {Array} */ ([])); - for (let i = 0; i < numberOfDeletes; i++) { - dsField.push(new DeleteItem(decoder.readDsClock(), decoder.readDsLen())); - } - } - } - return ds -}; - -/** - * @todo YDecoder also contains references to String and other Decoders. Would make sense to exchange YDecoder.toUint8Array for YDecoder.DsToUint8Array().. - */ - -/** - * @param {DSDecoderV1 | DSDecoderV2} decoder - * @param {Transaction} transaction - * @param {StructStore} store - * @return {Uint8Array|null} Returns a v2 update containing all deletes that couldn't be applied yet; or null if all deletes were applied successfully. - * - * @private - * @function - */ -const readAndApplyDeleteSet = (decoder, transaction, store) => { - const unappliedDS = new DeleteSet(); - const numClients = decoding.readVarUint(decoder.restDecoder); - for (let i = 0; i < numClients; i++) { - decoder.resetDsCurVal(); - const client = decoding.readVarUint(decoder.restDecoder); - const numberOfDeletes = decoding.readVarUint(decoder.restDecoder); - const structs = store.clients.get(client) || []; - const state = getState(store, client); - for (let i = 0; i < numberOfDeletes; i++) { - const clock = decoder.readDsClock(); - const clockEnd = clock + decoder.readDsLen(); - if (clock < state) { - if (state < clockEnd) { - addToDeleteSet(unappliedDS, client, state, clockEnd - state); - } - let index = findIndexSS(structs, clock); - /** - * We can ignore the case of GC and Delete structs, because we are going to skip them - * @type {Item} - */ - // @ts-ignore - let struct = structs[index]; - // split the first item if necessary - if (!struct.deleted && struct.id.clock < clock) { - structs.splice(index + 1, 0, splitItem(transaction, struct, clock - struct.id.clock)); - index++; // increase we now want to use the next struct - } - while (index < structs.length) { - // @ts-ignore - struct = structs[index++]; - if (struct.id.clock < clockEnd) { - if (!struct.deleted) { - if (clockEnd < struct.id.clock + struct.length) { - structs.splice(index, 0, splitItem(transaction, struct, clockEnd - struct.id.clock)); - } - struct.delete(transaction); - } - } else { - break - } - } - } else { - addToDeleteSet(unappliedDS, client, clock, clockEnd - clock); - } - } - } - if (unappliedDS.clients.size > 0) { - const ds = new UpdateEncoderV2(); - encoding.writeVarUint(ds.restEncoder, 0); // encode 0 structs - writeDeleteSet(ds, unappliedDS); - return ds.toUint8Array() - } - return null -}; - -/** - * @param {DeleteSet} ds1 - * @param {DeleteSet} ds2 - */ -const equalDeleteSets = (ds1, ds2) => { - if (ds1.clients.size !== ds2.clients.size) return false - for (const [client, deleteItems1] of ds1.clients.entries()) { - const deleteItems2 = /** @type {Array} */ (ds2.clients.get(client)); - if (deleteItems2 === undefined || deleteItems1.length !== deleteItems2.length) return false - for (let i = 0; i < deleteItems1.length; i++) { - const di1 = deleteItems1[i]; - const di2 = deleteItems2[i]; - if (di1.clock !== di2.clock || di1.len !== di2.len) { - return false - } - } - } - return true -}; - -/** - * @module Y - */ - - -const generateNewClientId = random.uint32; - -/** - * @typedef {Object} DocOpts - * @property {boolean} [DocOpts.gc=true] Disable garbage collection (default: gc=true) - * @property {function(Item):boolean} [DocOpts.gcFilter] Will be called before an Item is garbage collected. Return false to keep the Item. - * @property {string} [DocOpts.guid] Define a globally unique identifier for this document - * @property {string | null} [DocOpts.collectionid] Associate this document with a collection. This only plays a role if your provider has a concept of collection. - * @property {any} [DocOpts.meta] Any kind of meta information you want to associate with this document. If this is a subdocument, remote peers will store the meta information as well. - * @property {boolean} [DocOpts.autoLoad] If a subdocument, automatically load document. If this is a subdocument, remote peers will load the document as well automatically. - * @property {boolean} [DocOpts.shouldLoad] Whether the document should be synced by the provider now. This is toggled to true when you call ydoc.load() - */ - -/** - * @typedef {Object} DocEvents - * @property {function(Doc):void} DocEvents.destroy - * @property {function(Doc):void} DocEvents.load - * @property {function(boolean, Doc):void} DocEvents.sync - * @property {function(Uint8Array, any, Doc, Transaction):void} DocEvents.update - * @property {function(Uint8Array, any, Doc, Transaction):void} DocEvents.updateV2 - * @property {function(Doc):void} DocEvents.beforeAllTransactions - * @property {function(Transaction, Doc):void} DocEvents.beforeTransaction - * @property {function(Transaction, Doc):void} DocEvents.beforeObserverCalls - * @property {function(Transaction, Doc):void} DocEvents.afterTransaction - * @property {function(Transaction, Doc):void} DocEvents.afterTransactionCleanup - * @property {function(Doc, Array):void} DocEvents.afterAllTransactions - * @property {function({ loaded: Set, added: Set, removed: Set }, Doc, Transaction):void} DocEvents.subdocs - */ - -/** - * A Yjs instance handles the state of shared data. - * @extends ObservableV2 - */ -class Doc extends ObservableV2 { - /** - * @param {DocOpts} opts configuration - */ - constructor ({ guid = random.uuidv4(), collectionid = null, gc = true, gcFilter = () => true, meta = null, autoLoad = false, shouldLoad = true } = {}) { - super(); - this.gc = gc; - this.gcFilter = gcFilter; - this.clientID = generateNewClientId(); - this.guid = guid; - this.collectionid = collectionid; - /** - * @type {Map>>} - */ - this.share = new Map(); - this.store = new StructStore(); - /** - * @type {Transaction | null} - */ - this._transaction = null; - /** - * @type {Array} - */ - this._transactionCleanups = []; - /** - * @type {Set} - */ - this.subdocs = new Set(); - /** - * If this document is a subdocument - a document integrated into another document - then _item is defined. - * @type {Item?} - */ - this._item = null; - this.shouldLoad = shouldLoad; - this.autoLoad = autoLoad; - this.meta = meta; - /** - * This is set to true when the persistence provider loaded the document from the database or when the `sync` event fires. - * Note that not all providers implement this feature. Provider authors are encouraged to fire the `load` event when the doc content is loaded from the database. - * - * @type {boolean} - */ - this.isLoaded = false; - /** - * This is set to true when the connection provider has successfully synced with a backend. - * Note that when using peer-to-peer providers this event may not provide very useful. - * Also note that not all providers implement this feature. Provider authors are encouraged to fire - * the `sync` event when the doc has been synced (with `true` as a parameter) or if connection is - * lost (with false as a parameter). - */ - this.isSynced = false; - this.isDestroyed = false; - /** - * Promise that resolves once the document has been loaded from a persistence provider. - */ - this.whenLoaded = promise.create(resolve => { - this.on('load', () => { - this.isLoaded = true; - resolve(this); - }); - }); - const provideSyncedPromise = () => promise.create(resolve => { - /** - * @param {boolean} isSynced - */ - const eventHandler = (isSynced) => { - if (isSynced === undefined || isSynced === true) { - this.off('sync', eventHandler); - resolve(); - } - }; - this.on('sync', eventHandler); - }); - this.on('sync', isSynced => { - if (isSynced === false && this.isSynced) { - this.whenSynced = provideSyncedPromise(); - } - this.isSynced = isSynced === undefined || isSynced === true; - if (this.isSynced && !this.isLoaded) { - this.emit('load', [this]); - } - }); - /** - * Promise that resolves once the document has been synced with a backend. - * This promise is recreated when the connection is lost. - * Note the documentation about the `isSynced` property. - */ - this.whenSynced = provideSyncedPromise(); - } - - /** - * Notify the parent document that you request to load data into this subdocument (if it is a subdocument). - * - * `load()` might be used in the future to request any provider to load the most current data. - * - * It is safe to call `load()` multiple times. - */ - load () { - const item = this._item; - if (item !== null && !this.shouldLoad) { - transact(/** @type {any} */ (item.parent).doc, transaction => { - transaction.subdocsLoaded.add(this); - }, null, true); - } - this.shouldLoad = true; - } - - getSubdocs () { - return this.subdocs - } - - getSubdocGuids () { - return new Set(array.from(this.subdocs).map(doc => doc.guid)) - } - - /** - * Changes that happen inside of a transaction are bundled. This means that - * the observer fires _after_ the transaction is finished and that all changes - * that happened inside of the transaction are sent as one message to the - * other peers. - * - * @template T - * @param {function(Transaction):T} f The function that should be executed as a transaction - * @param {any} [origin] Origin of who started the transaction. Will be stored on transaction.origin - * @return T - * - * @public - */ - transact (f, origin = null) { - return transact(this, f, origin) - } - - /** - * Define a shared data type. - * - * Multiple calls of `ydoc.get(name, TypeConstructor)` yield the same result - * and do not overwrite each other. I.e. - * `ydoc.get(name, Y.Array) === ydoc.get(name, Y.Array)` - * - * After this method is called, the type is also available on `ydoc.share.get(name)`. - * - * *Best Practices:* - * Define all types right after the Y.Doc instance is created and store them in a separate object. - * Also use the typed methods `getText(name)`, `getArray(name)`, .. - * - * @template {typeof AbstractType} Type - * @example - * const ydoc = new Y.Doc(..) - * const appState = { - * document: ydoc.getText('document') - * comments: ydoc.getArray('comments') - * } - * - * @param {string} name - * @param {Type} TypeConstructor The constructor of the type definition. E.g. Y.Text, Y.Array, Y.Map, ... - * @return {InstanceType} The created type. Constructed with TypeConstructor - * - * @public - */ - get (name, TypeConstructor = /** @type {any} */ (AbstractType)) { - const type = map.setIfUndefined(this.share, name, () => { - // @ts-ignore - const t = new TypeConstructor(); - t._integrate(this, null); - return t - }); - const Constr = type.constructor; - if (TypeConstructor !== AbstractType && Constr !== TypeConstructor) { - if (Constr === AbstractType) { - // @ts-ignore - const t = new TypeConstructor(); - t._map = type._map; - type._map.forEach(/** @param {Item?} n */ n => { - for (; n !== null; n = n.left) { - // @ts-ignore - n.parent = t; - } - }); - t._start = type._start; - for (let n = t._start; n !== null; n = n.right) { - n.parent = t; - } - t._length = type._length; - this.share.set(name, t); - t._integrate(this, null); - return /** @type {InstanceType} */ (t) - } else { - throw new Error(`Type with the name ${name} has already been defined with a different constructor`) - } - } - return /** @type {InstanceType} */ (type) - } - - /** - * @template T - * @param {string} [name] - * @return {YArray} - * - * @public - */ - getArray (name = '') { - return /** @type {YArray} */ (this.get(name, YArray)) - } - - /** - * @param {string} [name] - * @return {YText} - * - * @public - */ - getText (name = '') { - return this.get(name, YText) - } - - /** - * @template T - * @param {string} [name] - * @return {YMap} - * - * @public - */ - getMap (name = '') { - return /** @type {YMap} */ (this.get(name, YMap)) - } - - /** - * @param {string} [name] - * @return {YXmlElement} - * - * @public - */ - getXmlElement (name = '') { - return /** @type {YXmlElement<{[key:string]:string}>} */ (this.get(name, YXmlElement)) - } - - /** - * @param {string} [name] - * @return {YXmlFragment} - * - * @public - */ - getXmlFragment (name = '') { - return this.get(name, YXmlFragment) - } - - /** - * Converts the entire document into a js object, recursively traversing each yjs type - * Doesn't log types that have not been defined (using ydoc.getType(..)). - * - * @deprecated Do not use this method and rather call toJSON directly on the shared types. - * - * @return {Object} - */ - toJSON () { - /** - * @type {Object} - */ - const doc = {}; - - this.share.forEach((value, key) => { - doc[key] = value.toJSON(); - }); - - return doc - } - - /** - * Emit `destroy` event and unregister all event handlers. - */ - destroy () { - this.isDestroyed = true; - array.from(this.subdocs).forEach(subdoc => subdoc.destroy()); - const item = this._item; - if (item !== null) { - this._item = null; - const content = /** @type {ContentDoc} */ (item.content); - content.doc = new Doc({ guid: this.guid, ...content.opts, shouldLoad: false }); - content.doc._item = item; - transact(/** @type {any} */ (item).parent.doc, transaction => { - const doc = content.doc; - if (!item.deleted) { - transaction.subdocsAdded.add(doc); - } - transaction.subdocsRemoved.add(this); - }, null, true); - } - // @ts-ignore - this.emit('destroyed', [true]); // DEPRECATED! - this.emit('destroy', [this]); - super.destroy(); - } -} - -class DSDecoderV1 { - /** - * @param {decoding.Decoder} decoder - */ - constructor (decoder) { - this.restDecoder = decoder; - } - - resetDsCurVal () { - // nop - } - - /** - * @return {number} - */ - readDsClock () { - return decoding.readVarUint(this.restDecoder) - } - - /** - * @return {number} - */ - readDsLen () { - return decoding.readVarUint(this.restDecoder) - } -} - -class UpdateDecoderV1 extends DSDecoderV1 { - /** - * @return {ID} - */ - readLeftID () { - return createID(decoding.readVarUint(this.restDecoder), decoding.readVarUint(this.restDecoder)) - } - - /** - * @return {ID} - */ - readRightID () { - return createID(decoding.readVarUint(this.restDecoder), decoding.readVarUint(this.restDecoder)) - } - - /** - * Read the next client id. - * Use this in favor of readID whenever possible to reduce the number of objects created. - */ - readClient () { - return decoding.readVarUint(this.restDecoder) - } - - /** - * @return {number} info An unsigned 8-bit integer - */ - readInfo () { - return decoding.readUint8(this.restDecoder) - } - - /** - * @return {string} - */ - readString () { - return decoding.readVarString(this.restDecoder) - } - - /** - * @return {boolean} isKey - */ - readParentInfo () { - return decoding.readVarUint(this.restDecoder) === 1 - } - - /** - * @return {number} info An unsigned 8-bit integer - */ - readTypeRef () { - return decoding.readVarUint(this.restDecoder) - } - - /** - * Write len of a struct - well suited for Opt RLE encoder. - * - * @return {number} len - */ - readLen () { - return decoding.readVarUint(this.restDecoder) - } - - /** - * @return {any} - */ - readAny () { - return decoding.readAny(this.restDecoder) - } - - /** - * @return {Uint8Array} - */ - readBuf () { - return buffer.copyUint8Array(decoding.readVarUint8Array(this.restDecoder)) - } - - /** - * Legacy implementation uses JSON parse. We use any-decoding in v2. - * - * @return {any} - */ - readJSON () { - return JSON.parse(decoding.readVarString(this.restDecoder)) - } - - /** - * @return {string} - */ - readKey () { - return decoding.readVarString(this.restDecoder) - } -} - -class DSDecoderV2 { - /** - * @param {decoding.Decoder} decoder - */ - constructor (decoder) { - /** - * @private - */ - this.dsCurrVal = 0; - this.restDecoder = decoder; - } - - resetDsCurVal () { - this.dsCurrVal = 0; - } - - /** - * @return {number} - */ - readDsClock () { - this.dsCurrVal += decoding.readVarUint(this.restDecoder); - return this.dsCurrVal - } - - /** - * @return {number} - */ - readDsLen () { - const diff = decoding.readVarUint(this.restDecoder) + 1; - this.dsCurrVal += diff; - return diff - } -} - -class UpdateDecoderV2 extends DSDecoderV2 { - /** - * @param {decoding.Decoder} decoder - */ - constructor (decoder) { - super(decoder); - /** - * List of cached keys. If the keys[id] does not exist, we read a new key - * from stringEncoder and push it to keys. - * - * @type {Array} - */ - this.keys = []; - decoding.readVarUint(decoder); // read feature flag - currently unused - this.keyClockDecoder = new decoding.IntDiffOptRleDecoder(decoding.readVarUint8Array(decoder)); - this.clientDecoder = new decoding.UintOptRleDecoder(decoding.readVarUint8Array(decoder)); - this.leftClockDecoder = new decoding.IntDiffOptRleDecoder(decoding.readVarUint8Array(decoder)); - this.rightClockDecoder = new decoding.IntDiffOptRleDecoder(decoding.readVarUint8Array(decoder)); - this.infoDecoder = new decoding.RleDecoder(decoding.readVarUint8Array(decoder), decoding.readUint8); - this.stringDecoder = new decoding.StringDecoder(decoding.readVarUint8Array(decoder)); - this.parentInfoDecoder = new decoding.RleDecoder(decoding.readVarUint8Array(decoder), decoding.readUint8); - this.typeRefDecoder = new decoding.UintOptRleDecoder(decoding.readVarUint8Array(decoder)); - this.lenDecoder = new decoding.UintOptRleDecoder(decoding.readVarUint8Array(decoder)); - } - - /** - * @return {ID} - */ - readLeftID () { - return new ID(this.clientDecoder.read(), this.leftClockDecoder.read()) - } - - /** - * @return {ID} - */ - readRightID () { - return new ID(this.clientDecoder.read(), this.rightClockDecoder.read()) - } - - /** - * Read the next client id. - * Use this in favor of readID whenever possible to reduce the number of objects created. - */ - readClient () { - return this.clientDecoder.read() - } - - /** - * @return {number} info An unsigned 8-bit integer - */ - readInfo () { - return /** @type {number} */ (this.infoDecoder.read()) - } - - /** - * @return {string} - */ - readString () { - return this.stringDecoder.read() - } - - /** - * @return {boolean} - */ - readParentInfo () { - return this.parentInfoDecoder.read() === 1 - } - - /** - * @return {number} An unsigned 8-bit integer - */ - readTypeRef () { - return this.typeRefDecoder.read() - } - - /** - * Write len of a struct - well suited for Opt RLE encoder. - * - * @return {number} - */ - readLen () { - return this.lenDecoder.read() - } - - /** - * @return {any} - */ - readAny () { - return decoding.readAny(this.restDecoder) - } - - /** - * @return {Uint8Array} - */ - readBuf () { - return decoding.readVarUint8Array(this.restDecoder) - } - - /** - * This is mainly here for legacy purposes. - * - * Initial we incoded objects using JSON. Now we use the much faster lib0/any-encoder. This method mainly exists for legacy purposes for the v1 encoder. - * - * @return {any} - */ - readJSON () { - return decoding.readAny(this.restDecoder) - } - - /** - * @return {string} - */ - readKey () { - const keyClock = this.keyClockDecoder.read(); - if (keyClock < this.keys.length) { - return this.keys[keyClock] - } else { - const key = this.stringDecoder.read(); - this.keys.push(key); - return key - } - } -} - -class DSEncoderV1 { - constructor () { - this.restEncoder = encoding.createEncoder(); - } - - toUint8Array () { - return encoding.toUint8Array(this.restEncoder) - } - - resetDsCurVal () { - // nop - } - - /** - * @param {number} clock - */ - writeDsClock (clock) { - encoding.writeVarUint(this.restEncoder, clock); - } - - /** - * @param {number} len - */ - writeDsLen (len) { - encoding.writeVarUint(this.restEncoder, len); - } -} - -class UpdateEncoderV1 extends DSEncoderV1 { - /** - * @param {ID} id - */ - writeLeftID (id) { - encoding.writeVarUint(this.restEncoder, id.client); - encoding.writeVarUint(this.restEncoder, id.clock); - } - - /** - * @param {ID} id - */ - writeRightID (id) { - encoding.writeVarUint(this.restEncoder, id.client); - encoding.writeVarUint(this.restEncoder, id.clock); - } - - /** - * Use writeClient and writeClock instead of writeID if possible. - * @param {number} client - */ - writeClient (client) { - encoding.writeVarUint(this.restEncoder, client); - } - - /** - * @param {number} info An unsigned 8-bit integer - */ - writeInfo (info) { - encoding.writeUint8(this.restEncoder, info); - } - - /** - * @param {string} s - */ - writeString (s) { - encoding.writeVarString(this.restEncoder, s); - } - - /** - * @param {boolean} isYKey - */ - writeParentInfo (isYKey) { - encoding.writeVarUint(this.restEncoder, isYKey ? 1 : 0); - } - - /** - * @param {number} info An unsigned 8-bit integer - */ - writeTypeRef (info) { - encoding.writeVarUint(this.restEncoder, info); - } - - /** - * Write len of a struct - well suited for Opt RLE encoder. - * - * @param {number} len - */ - writeLen (len) { - encoding.writeVarUint(this.restEncoder, len); - } - - /** - * @param {any} any - */ - writeAny (any) { - encoding.writeAny(this.restEncoder, any); - } - - /** - * @param {Uint8Array} buf - */ - writeBuf (buf) { - encoding.writeVarUint8Array(this.restEncoder, buf); - } - - /** - * @param {any} embed - */ - writeJSON (embed) { - encoding.writeVarString(this.restEncoder, JSON.stringify(embed)); - } - - /** - * @param {string} key - */ - writeKey (key) { - encoding.writeVarString(this.restEncoder, key); - } -} - -class DSEncoderV2 { - constructor () { - this.restEncoder = encoding.createEncoder(); // encodes all the rest / non-optimized - this.dsCurrVal = 0; - } - - toUint8Array () { - return encoding.toUint8Array(this.restEncoder) - } - - resetDsCurVal () { - this.dsCurrVal = 0; - } - - /** - * @param {number} clock - */ - writeDsClock (clock) { - const diff = clock - this.dsCurrVal; - this.dsCurrVal = clock; - encoding.writeVarUint(this.restEncoder, diff); - } - - /** - * @param {number} len - */ - writeDsLen (len) { - if (len === 0) { - error.unexpectedCase(); - } - encoding.writeVarUint(this.restEncoder, len - 1); - this.dsCurrVal += len; - } -} - -class UpdateEncoderV2 extends DSEncoderV2 { - constructor () { - super(); - /** - * @type {Map} - */ - this.keyMap = new Map(); - /** - * Refers to the next unique key-identifier to me used. - * See writeKey method for more information. - * - * @type {number} - */ - this.keyClock = 0; - this.keyClockEncoder = new encoding.IntDiffOptRleEncoder(); - this.clientEncoder = new encoding.UintOptRleEncoder(); - this.leftClockEncoder = new encoding.IntDiffOptRleEncoder(); - this.rightClockEncoder = new encoding.IntDiffOptRleEncoder(); - this.infoEncoder = new encoding.RleEncoder(encoding.writeUint8); - this.stringEncoder = new encoding.StringEncoder(); - this.parentInfoEncoder = new encoding.RleEncoder(encoding.writeUint8); - this.typeRefEncoder = new encoding.UintOptRleEncoder(); - this.lenEncoder = new encoding.UintOptRleEncoder(); - } - - toUint8Array () { - const encoder = encoding.createEncoder(); - encoding.writeVarUint(encoder, 0); // this is a feature flag that we might use in the future - encoding.writeVarUint8Array(encoder, this.keyClockEncoder.toUint8Array()); - encoding.writeVarUint8Array(encoder, this.clientEncoder.toUint8Array()); - encoding.writeVarUint8Array(encoder, this.leftClockEncoder.toUint8Array()); - encoding.writeVarUint8Array(encoder, this.rightClockEncoder.toUint8Array()); - encoding.writeVarUint8Array(encoder, encoding.toUint8Array(this.infoEncoder)); - encoding.writeVarUint8Array(encoder, this.stringEncoder.toUint8Array()); - encoding.writeVarUint8Array(encoder, encoding.toUint8Array(this.parentInfoEncoder)); - encoding.writeVarUint8Array(encoder, this.typeRefEncoder.toUint8Array()); - encoding.writeVarUint8Array(encoder, this.lenEncoder.toUint8Array()); - // @note The rest encoder is appended! (note the missing var) - encoding.writeUint8Array(encoder, encoding.toUint8Array(this.restEncoder)); - return encoding.toUint8Array(encoder) - } - - /** - * @param {ID} id - */ - writeLeftID (id) { - this.clientEncoder.write(id.client); - this.leftClockEncoder.write(id.clock); - } - - /** - * @param {ID} id - */ - writeRightID (id) { - this.clientEncoder.write(id.client); - this.rightClockEncoder.write(id.clock); - } - - /** - * @param {number} client - */ - writeClient (client) { - this.clientEncoder.write(client); - } - - /** - * @param {number} info An unsigned 8-bit integer - */ - writeInfo (info) { - this.infoEncoder.write(info); - } - - /** - * @param {string} s - */ - writeString (s) { - this.stringEncoder.write(s); - } - - /** - * @param {boolean} isYKey - */ - writeParentInfo (isYKey) { - this.parentInfoEncoder.write(isYKey ? 1 : 0); - } - - /** - * @param {number} info An unsigned 8-bit integer - */ - writeTypeRef (info) { - this.typeRefEncoder.write(info); - } - - /** - * Write len of a struct - well suited for Opt RLE encoder. - * - * @param {number} len - */ - writeLen (len) { - this.lenEncoder.write(len); - } - - /** - * @param {any} any - */ - writeAny (any) { - encoding.writeAny(this.restEncoder, any); - } - - /** - * @param {Uint8Array} buf - */ - writeBuf (buf) { - encoding.writeVarUint8Array(this.restEncoder, buf); - } - - /** - * This is mainly here for legacy purposes. - * - * Initial we incoded objects using JSON. Now we use the much faster lib0/any-encoder. This method mainly exists for legacy purposes for the v1 encoder. - * - * @param {any} embed - */ - writeJSON (embed) { - encoding.writeAny(this.restEncoder, embed); - } - - /** - * Property keys are often reused. For example, in y-prosemirror the key `bold` might - * occur very often. For a 3d application, the key `position` might occur very often. - * - * We cache these keys in a Map and refer to them via a unique number. - * - * @param {string} key - */ - writeKey (key) { - const clock = this.keyMap.get(key); - if (clock === undefined) { - /** - * @todo uncomment to introduce this feature finally - * - * Background. The ContentFormat object was always encoded using writeKey, but the decoder used to use readString. - * Furthermore, I forgot to set the keyclock. So everything was working fine. - * - * However, this feature here is basically useless as it is not being used (it actually only consumes extra memory). - * - * I don't know yet how to reintroduce this feature.. - * - * Older clients won't be able to read updates when we reintroduce this feature. So this should probably be done using a flag. - * - */ - // this.keyMap.set(key, this.keyClock) - this.keyClockEncoder.write(this.keyClock++); - this.stringEncoder.write(key); - } else { - this.keyClockEncoder.write(clock); - } - } -} - -/** - * @module encoding - */ -/* - * We use the first five bits in the info flag for determining the type of the struct. - * - * 0: GC - * 1: Item with Deleted content - * 2: Item with JSON content - * 3: Item with Binary content - * 4: Item with String content - * 5: Item with Embed content (for richtext content) - * 6: Item with Format content (a formatting marker for richtext content) - * 7: Item with Type - */ - - -/** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {Array} structs All structs by `client` - * @param {number} client - * @param {number} clock write structs starting with `ID(client,clock)` - * - * @function - */ -const writeStructs = (encoder, structs, client, clock) => { - // write first id - clock = math.max(clock, structs[0].id.clock); // make sure the first id exists - const startNewStructs = findIndexSS(structs, clock); - // write # encoded structs - encoding.writeVarUint(encoder.restEncoder, structs.length - startNewStructs); - encoder.writeClient(client); - encoding.writeVarUint(encoder.restEncoder, clock); - const firstStruct = structs[startNewStructs]; - // write first struct with an offset - firstStruct.write(encoder, clock - firstStruct.id.clock); - for (let i = startNewStructs + 1; i < structs.length; i++) { - structs[i].write(encoder, 0); - } -}; - -/** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {StructStore} store - * @param {Map} _sm - * - * @private - * @function - */ -const writeClientsStructs = (encoder, store, _sm) => { - // we filter all valid _sm entries into sm - const sm = new Map(); - _sm.forEach((clock, client) => { - // only write if new structs are available - if (getState(store, client) > clock) { - sm.set(client, clock); - } - }); - getStateVector(store).forEach((_clock, client) => { - if (!_sm.has(client)) { - sm.set(client, 0); - } - }); - // write # states that were updated - encoding.writeVarUint(encoder.restEncoder, sm.size); - // Write items with higher client ids first - // This heavily improves the conflict algorithm. - array.from(sm.entries()).sort((a, b) => b[0] - a[0]).forEach(([client, clock]) => { - writeStructs(encoder, /** @type {Array} */ (store.clients.get(client)), client, clock); - }); -}; - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder The decoder object to read data from. - * @param {Doc} doc - * @return {Map }>} - * - * @private - * @function - */ -const readClientsStructRefs = (decoder, doc) => { - /** - * @type {Map }>} - */ - const clientRefs = map.create(); - const numOfStateUpdates = decoding.readVarUint(decoder.restDecoder); - for (let i = 0; i < numOfStateUpdates; i++) { - const numberOfStructs = decoding.readVarUint(decoder.restDecoder); - /** - * @type {Array} - */ - const refs = new Array(numberOfStructs); - const client = decoder.readClient(); - let clock = decoding.readVarUint(decoder.restDecoder); - // const start = performance.now() - clientRefs.set(client, { i: 0, refs }); - for (let i = 0; i < numberOfStructs; i++) { - const info = decoder.readInfo(); - switch (binary.BITS5 & info) { - case 0: { // GC - const len = decoder.readLen(); - refs[i] = new GC(createID(client, clock), len); - clock += len; - break - } - case 10: { // Skip Struct (nothing to apply) - // @todo we could reduce the amount of checks by adding Skip struct to clientRefs so we know that something is missing. - const len = decoding.readVarUint(decoder.restDecoder); - refs[i] = new Skip(createID(client, clock), len); - clock += len; - break - } - default: { // Item with content - /** - * The optimized implementation doesn't use any variables because inlining variables is faster. - * Below a non-optimized version is shown that implements the basic algorithm with - * a few comments - */ - const cantCopyParentInfo = (info & (binary.BIT7 | binary.BIT8)) === 0; - // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y` - // and we read the next string as parentYKey. - // It indicates how we store/retrieve parent from `y.share` - // @type {string|null} - const struct = new Item( - createID(client, clock), - null, // left - (info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null, // origin - null, // right - (info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null, // right origin - cantCopyParentInfo ? (decoder.readParentInfo() ? doc.get(decoder.readString()) : decoder.readLeftID()) : null, // parent - cantCopyParentInfo && (info & binary.BIT6) === binary.BIT6 ? decoder.readString() : null, // parentSub - readItemContent(decoder, info) // item content - ); - /* A non-optimized implementation of the above algorithm: - - // The item that was originally to the left of this item. - const origin = (info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null - // The item that was originally to the right of this item. - const rightOrigin = (info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null - const cantCopyParentInfo = (info & (binary.BIT7 | binary.BIT8)) === 0 - const hasParentYKey = cantCopyParentInfo ? decoder.readParentInfo() : false - // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y` - // and we read the next string as parentYKey. - // It indicates how we store/retrieve parent from `y.share` - // @type {string|null} - const parentYKey = cantCopyParentInfo && hasParentYKey ? decoder.readString() : null - - const struct = new Item( - createID(client, clock), - null, // left - origin, // origin - null, // right - rightOrigin, // right origin - cantCopyParentInfo && !hasParentYKey ? decoder.readLeftID() : (parentYKey !== null ? doc.get(parentYKey) : null), // parent - cantCopyParentInfo && (info & binary.BIT6) === binary.BIT6 ? decoder.readString() : null, // parentSub - readItemContent(decoder, info) // item content - ) - */ - refs[i] = struct; - clock += struct.length; - } - } - } - // console.log('time to read: ', performance.now() - start) // @todo remove - } - return clientRefs -}; - -/** - * Resume computing structs generated by struct readers. - * - * While there is something to do, we integrate structs in this order - * 1. top element on stack, if stack is not empty - * 2. next element from current struct reader (if empty, use next struct reader) - * - * If struct causally depends on another struct (ref.missing), we put next reader of - * `ref.id.client` on top of stack. - * - * At some point we find a struct that has no causal dependencies, - * then we start emptying the stack. - * - * It is not possible to have circles: i.e. struct1 (from client1) depends on struct2 (from client2) - * depends on struct3 (from client1). Therefore the max stack size is equal to `structReaders.length`. - * - * This method is implemented in a way so that we can resume computation if this update - * causally depends on another update. - * - * @param {Transaction} transaction - * @param {StructStore} store - * @param {Map} clientsStructRefs - * @return { null | { update: Uint8Array, missing: Map } } - * - * @private - * @function - */ -const integrateStructs = (transaction, store, clientsStructRefs) => { - /** - * @type {Array} - */ - const stack = []; - // sort them so that we take the higher id first, in case of conflicts the lower id will probably not conflict with the id from the higher user. - let clientsStructRefsIds = array.from(clientsStructRefs.keys()).sort((a, b) => a - b); - if (clientsStructRefsIds.length === 0) { - return null - } - const getNextStructTarget = () => { - if (clientsStructRefsIds.length === 0) { - return null - } - let nextStructsTarget = /** @type {{i:number,refs:Array}} */ (clientsStructRefs.get(clientsStructRefsIds[clientsStructRefsIds.length - 1])); - while (nextStructsTarget.refs.length === nextStructsTarget.i) { - clientsStructRefsIds.pop(); - if (clientsStructRefsIds.length > 0) { - nextStructsTarget = /** @type {{i:number,refs:Array}} */ (clientsStructRefs.get(clientsStructRefsIds[clientsStructRefsIds.length - 1])); - } else { - return null - } - } - return nextStructsTarget - }; - let curStructsTarget = getNextStructTarget(); - if (curStructsTarget === null) { - return null - } - - /** - * @type {StructStore} - */ - const restStructs = new StructStore(); - const missingSV = new Map(); - /** - * @param {number} client - * @param {number} clock - */ - const updateMissingSv = (client, clock) => { - const mclock = missingSV.get(client); - if (mclock == null || mclock > clock) { - missingSV.set(client, clock); - } - }; - /** - * @type {GC|Item} - */ - let stackHead = /** @type {any} */ (curStructsTarget).refs[/** @type {any} */ (curStructsTarget).i++]; - // caching the state because it is used very often - const state = new Map(); - - const addStackToRestSS = () => { - for (const item of stack) { - const client = item.id.client; - const inapplicableItems = clientsStructRefs.get(client); - if (inapplicableItems) { - // decrement because we weren't able to apply previous operation - inapplicableItems.i--; - restStructs.clients.set(client, inapplicableItems.refs.slice(inapplicableItems.i)); - clientsStructRefs.delete(client); - inapplicableItems.i = 0; - inapplicableItems.refs = []; - } else { - // item was the last item on clientsStructRefs and the field was already cleared. Add item to restStructs and continue - restStructs.clients.set(client, [item]); - } - // remove client from clientsStructRefsIds to prevent users from applying the same update again - clientsStructRefsIds = clientsStructRefsIds.filter(c => c !== client); - } - stack.length = 0; - }; - - // iterate over all struct readers until we are done - while (true) { - if (stackHead.constructor !== Skip) { - const localClock = map.setIfUndefined(state, stackHead.id.client, () => getState(store, stackHead.id.client)); - const offset = localClock - stackHead.id.clock; - if (offset < 0) { - // update from the same client is missing - stack.push(stackHead); - updateMissingSv(stackHead.id.client, stackHead.id.clock - 1); - // hid a dead wall, add all items from stack to restSS - addStackToRestSS(); - } else { - const missing = stackHead.getMissing(transaction, store); - if (missing !== null) { - stack.push(stackHead); - // get the struct reader that has the missing struct - /** - * @type {{ refs: Array, i: number }} - */ - const structRefs = clientsStructRefs.get(/** @type {number} */ (missing)) || { refs: [], i: 0 }; - if (structRefs.refs.length === structRefs.i) { - // This update message causally depends on another update message that doesn't exist yet - updateMissingSv(/** @type {number} */ (missing), getState(store, missing)); - addStackToRestSS(); - } else { - stackHead = structRefs.refs[structRefs.i++]; - continue - } - } else if (offset === 0 || offset < stackHead.length) { - // all fine, apply the stackhead - stackHead.integrate(transaction, offset); - state.set(stackHead.id.client, stackHead.id.clock + stackHead.length); - } - } - } - // iterate to next stackHead - if (stack.length > 0) { - stackHead = /** @type {GC|Item} */ (stack.pop()); - } else if (curStructsTarget !== null && curStructsTarget.i < curStructsTarget.refs.length) { - stackHead = /** @type {GC|Item} */ (curStructsTarget.refs[curStructsTarget.i++]); - } else { - curStructsTarget = getNextStructTarget(); - if (curStructsTarget === null) { - // we are done! - break - } else { - stackHead = /** @type {GC|Item} */ (curStructsTarget.refs[curStructsTarget.i++]); - } - } - } - if (restStructs.clients.size > 0) { - const encoder = new UpdateEncoderV2(); - writeClientsStructs(encoder, restStructs, new Map()); - // write empty deleteset - // writeDeleteSet(encoder, new DeleteSet()) - encoding.writeVarUint(encoder.restEncoder, 0); // => no need for an extra function call, just write 0 deletes - return { missing: missingSV, update: encoder.toUint8Array() } - } - return null -}; - -/** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {Transaction} transaction - * - * @private - * @function - */ -const writeStructsFromTransaction = (encoder, transaction) => writeClientsStructs(encoder, transaction.doc.store, transaction.beforeState); - -/** - * Read and apply a document update. - * - * This function has the same effect as `applyUpdate` but accepts a decoder. - * - * @param {decoding.Decoder} decoder - * @param {Doc} ydoc - * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))` - * @param {UpdateDecoderV1 | UpdateDecoderV2} [structDecoder] - * - * @function - */ -const readUpdateV2 = (decoder, ydoc, transactionOrigin, structDecoder = new UpdateDecoderV2(decoder)) => - transact(ydoc, transaction => { - // force that transaction.local is set to non-local - transaction.local = false; - let retry = false; - const doc = transaction.doc; - const store = doc.store; - // let start = performance.now() - const ss = readClientsStructRefs(structDecoder, doc); - // console.log('time to read structs: ', performance.now() - start) // @todo remove - // start = performance.now() - // console.log('time to merge: ', performance.now() - start) // @todo remove - // start = performance.now() - const restStructs = integrateStructs(transaction, store, ss); - const pending = store.pendingStructs; - if (pending) { - // check if we can apply something - for (const [client, clock] of pending.missing) { - if (clock < getState(store, client)) { - retry = true; - break - } - } - if (restStructs) { - // merge restStructs into store.pending - for (const [client, clock] of restStructs.missing) { - const mclock = pending.missing.get(client); - if (mclock == null || mclock > clock) { - pending.missing.set(client, clock); - } - } - pending.update = mergeUpdatesV2([pending.update, restStructs.update]); - } - } else { - store.pendingStructs = restStructs; - } - // console.log('time to integrate: ', performance.now() - start) // @todo remove - // start = performance.now() - const dsRest = readAndApplyDeleteSet(structDecoder, transaction, store); - if (store.pendingDs) { - // @todo we could make a lower-bound state-vector check as we do above - const pendingDSUpdate = new UpdateDecoderV2(decoding.createDecoder(store.pendingDs)); - decoding.readVarUint(pendingDSUpdate.restDecoder); // read 0 structs, because we only encode deletes in pendingdsupdate - const dsRest2 = readAndApplyDeleteSet(pendingDSUpdate, transaction, store); - if (dsRest && dsRest2) { - // case 1: ds1 != null && ds2 != null - store.pendingDs = mergeUpdatesV2([dsRest, dsRest2]); - } else { - // case 2: ds1 != null - // case 3: ds2 != null - // case 4: ds1 == null && ds2 == null - store.pendingDs = dsRest || dsRest2; - } - } else { - // Either dsRest == null && pendingDs == null OR dsRest != null - store.pendingDs = dsRest; - } - // console.log('time to cleanup: ', performance.now() - start) // @todo remove - // start = performance.now() - - // console.log('time to resume delete readers: ', performance.now() - start) // @todo remove - // start = performance.now() - if (retry) { - const update = /** @type {{update: Uint8Array}} */ (store.pendingStructs).update; - store.pendingStructs = null; - applyUpdateV2(transaction.doc, update); - } - }, transactionOrigin, false); - -/** - * Read and apply a document update. - * - * This function has the same effect as `applyUpdate` but accepts a decoder. - * - * @param {decoding.Decoder} decoder - * @param {Doc} ydoc - * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))` - * - * @function - */ -const readUpdate = (decoder, ydoc, transactionOrigin) => readUpdateV2(decoder, ydoc, transactionOrigin, new UpdateDecoderV1(decoder)); - -/** - * Apply a document update created by, for example, `y.on('update', update => ..)` or `update = encodeStateAsUpdate()`. - * - * This function has the same effect as `readUpdate` but accepts an Uint8Array instead of a Decoder. - * - * @param {Doc} ydoc - * @param {Uint8Array} update - * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))` - * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder] - * - * @function - */ -const applyUpdateV2 = (ydoc, update, transactionOrigin, YDecoder = UpdateDecoderV2) => { - const decoder = decoding.createDecoder(update); - readUpdateV2(decoder, ydoc, transactionOrigin, new YDecoder(decoder)); -}; - -/** - * Apply a document update created by, for example, `y.on('update', update => ..)` or `update = encodeStateAsUpdate()`. - * - * This function has the same effect as `readUpdate` but accepts an Uint8Array instead of a Decoder. - * - * @param {Doc} ydoc - * @param {Uint8Array} update - * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))` - * - * @function - */ -const applyUpdate = (ydoc, update, transactionOrigin) => applyUpdateV2(ydoc, update, transactionOrigin, UpdateDecoderV1); - -/** - * Write all the document as a single update message. If you specify the state of the remote client (`targetStateVector`) it will - * only write the operations that are missing. - * - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {Doc} doc - * @param {Map} [targetStateVector] The state of the target that receives the update. Leave empty to write all known structs - * - * @function - */ -const writeStateAsUpdate = (encoder, doc, targetStateVector = new Map()) => { - writeClientsStructs(encoder, doc.store, targetStateVector); - writeDeleteSet(encoder, createDeleteSetFromStructStore(doc.store)); -}; - -/** - * Write all the document as a single update message that can be applied on the remote document. If you specify the state of the remote client (`targetState`) it will - * only write the operations that are missing. - * - * Use `writeStateAsUpdate` instead if you are working with lib0/encoding.js#Encoder - * - * @param {Doc} doc - * @param {Uint8Array} [encodedTargetStateVector] The state of the target that receives the update. Leave empty to write all known structs - * @param {UpdateEncoderV1 | UpdateEncoderV2} [encoder] - * @return {Uint8Array} - * - * @function - */ -const encodeStateAsUpdateV2 = (doc, encodedTargetStateVector = new Uint8Array([0]), encoder = new UpdateEncoderV2()) => { - const targetStateVector = decodeStateVector(encodedTargetStateVector); - writeStateAsUpdate(encoder, doc, targetStateVector); - const updates = [encoder.toUint8Array()]; - // also add the pending updates (if there are any) - if (doc.store.pendingDs) { - updates.push(doc.store.pendingDs); - } - if (doc.store.pendingStructs) { - updates.push(diffUpdateV2(doc.store.pendingStructs.update, encodedTargetStateVector)); - } - if (updates.length > 1) { - if (encoder.constructor === UpdateEncoderV1) { - return mergeUpdates(updates.map((update, i) => i === 0 ? update : convertUpdateFormatV2ToV1(update))) - } else if (encoder.constructor === UpdateEncoderV2) { - return mergeUpdatesV2(updates) - } - } - return updates[0] -}; - -/** - * Write all the document as a single update message that can be applied on the remote document. If you specify the state of the remote client (`targetState`) it will - * only write the operations that are missing. - * - * Use `writeStateAsUpdate` instead if you are working with lib0/encoding.js#Encoder - * - * @param {Doc} doc - * @param {Uint8Array} [encodedTargetStateVector] The state of the target that receives the update. Leave empty to write all known structs - * @return {Uint8Array} - * - * @function - */ -const encodeStateAsUpdate = (doc, encodedTargetStateVector) => encodeStateAsUpdateV2(doc, encodedTargetStateVector, new UpdateEncoderV1()); - -/** - * Read state vector from Decoder and return as Map - * - * @param {DSDecoderV1 | DSDecoderV2} decoder - * @return {Map} Maps `client` to the number next expected `clock` from that client. - * - * @function - */ -const readStateVector = decoder => { - const ss = new Map(); - const ssLength = decoding.readVarUint(decoder.restDecoder); - for (let i = 0; i < ssLength; i++) { - const client = decoding.readVarUint(decoder.restDecoder); - const clock = decoding.readVarUint(decoder.restDecoder); - ss.set(client, clock); - } - return ss -}; - -/** - * Read decodedState and return State as Map. - * - * @param {Uint8Array} decodedState - * @return {Map} Maps `client` to the number next expected `clock` from that client. - * - * @function - */ -// export const decodeStateVectorV2 = decodedState => readStateVector(new DSDecoderV2(decoding.createDecoder(decodedState))) - -/** - * Read decodedState and return State as Map. - * - * @param {Uint8Array} decodedState - * @return {Map} Maps `client` to the number next expected `clock` from that client. - * - * @function - */ -const decodeStateVector = decodedState => readStateVector(new DSDecoderV1(decoding.createDecoder(decodedState))); - -/** - * @param {DSEncoderV1 | DSEncoderV2} encoder - * @param {Map} sv - * @function - */ -const writeStateVector = (encoder, sv) => { - encoding.writeVarUint(encoder.restEncoder, sv.size); - array.from(sv.entries()).sort((a, b) => b[0] - a[0]).forEach(([client, clock]) => { - encoding.writeVarUint(encoder.restEncoder, client); // @todo use a special client decoder that is based on mapping - encoding.writeVarUint(encoder.restEncoder, clock); - }); - return encoder -}; - -/** - * @param {DSEncoderV1 | DSEncoderV2} encoder - * @param {Doc} doc - * - * @function - */ -const writeDocumentStateVector = (encoder, doc) => writeStateVector(encoder, getStateVector(doc.store)); - -/** - * Encode State as Uint8Array. - * - * @param {Doc|Map} doc - * @param {DSEncoderV1 | DSEncoderV2} [encoder] - * @return {Uint8Array} - * - * @function - */ -const encodeStateVectorV2 = (doc, encoder = new DSEncoderV2()) => { - if (doc instanceof Map) { - writeStateVector(encoder, doc); - } else { - writeDocumentStateVector(encoder, doc); - } - return encoder.toUint8Array() -}; - -/** - * Encode State as Uint8Array. - * - * @param {Doc|Map} doc - * @return {Uint8Array} - * - * @function - */ -const encodeStateVector = doc => encodeStateVectorV2(doc, new DSEncoderV1()); - -/** - * General event handler implementation. - * - * @template ARG0, ARG1 - * - * @private - */ -class EventHandler { - constructor () { - /** - * @type {Array} - */ - this.l = []; - } -} - -/** - * @template ARG0,ARG1 - * @returns {EventHandler} - * - * @private - * @function - */ -const createEventHandler = () => new EventHandler(); - -/** - * Adds an event listener that is called when - * {@link EventHandler#callEventListeners} is called. - * - * @template ARG0,ARG1 - * @param {EventHandler} eventHandler - * @param {function(ARG0,ARG1):void} f The event handler. - * - * @private - * @function - */ -const addEventHandlerListener = (eventHandler, f) => - eventHandler.l.push(f); - -/** - * Removes an event listener. - * - * @template ARG0,ARG1 - * @param {EventHandler} eventHandler - * @param {function(ARG0,ARG1):void} f The event handler that was added with - * {@link EventHandler#addEventListener} - * - * @private - * @function - */ -const removeEventHandlerListener = (eventHandler, f) => { - const l = eventHandler.l; - const len = l.length; - eventHandler.l = l.filter(g => f !== g); - if (len === eventHandler.l.length) { - console.error('[yjs] Tried to remove event handler that doesn\'t exist.'); - } -}; - -/** - * Call all event listeners that were added via - * {@link EventHandler#addEventListener}. - * - * @template ARG0,ARG1 - * @param {EventHandler} eventHandler - * @param {ARG0} arg0 - * @param {ARG1} arg1 - * - * @private - * @function - */ -const callEventHandlerListeners = (eventHandler, arg0, arg1) => - f.callAll(eventHandler.l, [arg0, arg1]); - -class ID { - /** - * @param {number} client client id - * @param {number} clock unique per client id, continuous number - */ - constructor (client, clock) { - /** - * Client id - * @type {number} - */ - this.client = client; - /** - * unique per client id, continuous number - * @type {number} - */ - this.clock = clock; - } -} - -/** - * @param {ID | null} a - * @param {ID | null} b - * @return {boolean} - * - * @function - */ -const compareIDs = (a, b) => a === b || (a !== null && b !== null && a.client === b.client && a.clock === b.clock); - -/** - * @param {number} client - * @param {number} clock - * - * @private - * @function - */ -const createID = (client, clock) => new ID(client, clock); - -/** - * @param {encoding.Encoder} encoder - * @param {ID} id - * - * @private - * @function - */ -const writeID = (encoder, id) => { - encoding.writeVarUint(encoder, id.client); - encoding.writeVarUint(encoder, id.clock); -}; - -/** - * Read ID. - * * If first varUint read is 0xFFFFFF a RootID is returned. - * * Otherwise an ID is returned - * - * @param {decoding.Decoder} decoder - * @return {ID} - * - * @private - * @function - */ -const readID = decoder => - createID(decoding.readVarUint(decoder), decoding.readVarUint(decoder)); - -/** - * The top types are mapped from y.share.get(keyname) => type. - * `type` does not store any information about the `keyname`. - * This function finds the correct `keyname` for `type` and throws otherwise. - * - * @param {AbstractType} type - * @return {string} - * - * @private - * @function - */ -const findRootTypeKey = type => { - // @ts-ignore _y must be defined, otherwise unexpected case - for (const [key, value] of type.doc.share.entries()) { - if (value === type) { - return key - } - } - throw error.unexpectedCase() -}; - -/** - * Check if `parent` is a parent of `child`. - * - * @param {AbstractType} parent - * @param {Item|null} child - * @return {Boolean} Whether `parent` is a parent of `child`. - * - * @private - * @function - */ -const isParentOf = (parent, child) => { - while (child !== null) { - if (child.parent === parent) { - return true - } - child = /** @type {AbstractType} */ (child.parent)._item; - } - return false -}; - -/** - * Convenient helper to log type information. - * - * Do not use in productive systems as the output can be immense! - * - * @param {AbstractType} type - */ -const logType = type => { - const res = []; - let n = type._start; - while (n) { - res.push(n); - n = n.right; - } - console.log('Children: ', res); - console.log('Children content: ', res.filter(m => !m.deleted).map(m => m.content)); -}; - -class PermanentUserData { - /** - * @param {Doc} doc - * @param {YMap} [storeType] - */ - constructor (doc, storeType = doc.getMap('users')) { - /** - * @type {Map} - */ - const dss = new Map(); - this.yusers = storeType; - this.doc = doc; - /** - * Maps from clientid to userDescription - * - * @type {Map} - */ - this.clients = new Map(); - this.dss = dss; - /** - * @param {YMap} user - * @param {string} userDescription - */ - const initUser = (user, userDescription) => { - /** - * @type {YArray} - */ - const ds = user.get('ds'); - const ids = user.get('ids'); - const addClientId = /** @param {number} clientid */ clientid => this.clients.set(clientid, userDescription); - ds.observe(/** @param {YArrayEvent} event */ event => { - event.changes.added.forEach(item => { - item.content.getContent().forEach(encodedDs => { - if (encodedDs instanceof Uint8Array) { - this.dss.set(userDescription, mergeDeleteSets([this.dss.get(userDescription) || createDeleteSet(), readDeleteSet(new DSDecoderV1(decoding.createDecoder(encodedDs)))])); - } - }); - }); - }); - this.dss.set(userDescription, mergeDeleteSets(ds.map(encodedDs => readDeleteSet(new DSDecoderV1(decoding.createDecoder(encodedDs)))))); - ids.observe(/** @param {YArrayEvent} event */ event => - event.changes.added.forEach(item => item.content.getContent().forEach(addClientId)) - ); - ids.forEach(addClientId); - }; - // observe users - storeType.observe(event => { - event.keysChanged.forEach(userDescription => - initUser(storeType.get(userDescription), userDescription) - ); - }); - // add initial data - storeType.forEach(initUser); - } - - /** - * @param {Doc} doc - * @param {number} clientid - * @param {string} userDescription - * @param {Object} conf - * @param {function(Transaction, DeleteSet):boolean} [conf.filter] - */ - setUserMapping (doc, clientid, userDescription, { filter = () => true } = {}) { - const users = this.yusers; - let user = users.get(userDescription); - if (!user) { - user = new YMap(); - user.set('ids', new YArray()); - user.set('ds', new YArray()); - users.set(userDescription, user); - } - user.get('ids').push([clientid]); - users.observe(_event => { - setTimeout(() => { - const userOverwrite = users.get(userDescription); - if (userOverwrite !== user) { - // user was overwritten, port all data over to the next user object - // @todo Experiment with Y.Sets here - user = userOverwrite; - // @todo iterate over old type - this.clients.forEach((_userDescription, clientid) => { - if (userDescription === _userDescription) { - user.get('ids').push([clientid]); - } - }); - const encoder = new DSEncoderV1(); - const ds = this.dss.get(userDescription); - if (ds) { - writeDeleteSet(encoder, ds); - user.get('ds').push([encoder.toUint8Array()]); - } - } - }, 0); - }); - doc.on('afterTransaction', /** @param {Transaction} transaction */ transaction => { - setTimeout(() => { - const yds = user.get('ds'); - const ds = transaction.deleteSet; - if (transaction.local && ds.clients.size > 0 && filter(transaction, ds)) { - const encoder = new DSEncoderV1(); - writeDeleteSet(encoder, ds); - yds.push([encoder.toUint8Array()]); - } - }); - }); - } - - /** - * @param {number} clientid - * @return {any} - */ - getUserByClientId (clientid) { - return this.clients.get(clientid) || null - } - - /** - * @param {ID} id - * @return {string | null} - */ - getUserByDeletedId (id) { - for (const [userDescription, ds] of this.dss.entries()) { - if (isDeleted(ds, id)) { - return userDescription - } - } - return null - } -} - -/** - * A relative position is based on the Yjs model and is not affected by document changes. - * E.g. If you place a relative position before a certain character, it will always point to this character. - * If you place a relative position at the end of a type, it will always point to the end of the type. - * - * A numeric position is often unsuited for user selections, because it does not change when content is inserted - * before or after. - * - * ```Insert(0, 'x')('a|bc') = 'xa|bc'``` Where | is the relative position. - * - * One of the properties must be defined. - * - * @example - * // Current cursor position is at position 10 - * const relativePosition = createRelativePositionFromIndex(yText, 10) - * // modify yText - * yText.insert(0, 'abc') - * yText.delete(3, 10) - * // Compute the cursor position - * const absolutePosition = createAbsolutePositionFromRelativePosition(y, relativePosition) - * absolutePosition.type === yText // => true - * console.log('cursor location is ' + absolutePosition.index) // => cursor location is 3 - * - */ -class RelativePosition { - /** - * @param {ID|null} type - * @param {string|null} tname - * @param {ID|null} item - * @param {number} assoc - */ - constructor (type, tname, item, assoc = 0) { - /** - * @type {ID|null} - */ - this.type = type; - /** - * @type {string|null} - */ - this.tname = tname; - /** - * @type {ID | null} - */ - this.item = item; - /** - * A relative position is associated to a specific character. By default - * assoc >= 0, the relative position is associated to the character - * after the meant position. - * I.e. position 1 in 'ab' is associated to character 'b'. - * - * If assoc < 0, then the relative position is associated to the character - * before the meant position. - * - * @type {number} - */ - this.assoc = assoc; - } -} - -/** - * @param {RelativePosition} rpos - * @return {any} - */ -const relativePositionToJSON = rpos => { - const json = {}; - if (rpos.type) { - json.type = rpos.type; - } - if (rpos.tname) { - json.tname = rpos.tname; - } - if (rpos.item) { - json.item = rpos.item; - } - if (rpos.assoc != null) { - json.assoc = rpos.assoc; - } - return json -}; - -/** - * @param {any} json - * @return {RelativePosition} - * - * @function - */ -const createRelativePositionFromJSON = json => new RelativePosition(json.type == null ? null : createID(json.type.client, json.type.clock), json.tname ?? null, json.item == null ? null : createID(json.item.client, json.item.clock), json.assoc == null ? 0 : json.assoc); - -class AbsolutePosition { - /** - * @param {AbstractType} type - * @param {number} index - * @param {number} [assoc] - */ - constructor (type, index, assoc = 0) { - /** - * @type {AbstractType} - */ - this.type = type; - /** - * @type {number} - */ - this.index = index; - this.assoc = assoc; - } -} - -/** - * @param {AbstractType} type - * @param {number} index - * @param {number} [assoc] - * - * @function - */ -const createAbsolutePosition = (type, index, assoc = 0) => new AbsolutePosition(type, index, assoc); - -/** - * @param {AbstractType} type - * @param {ID|null} item - * @param {number} [assoc] - * - * @function - */ -const createRelativePosition = (type, item, assoc) => { - let typeid = null; - let tname = null; - if (type._item === null) { - tname = findRootTypeKey(type); - } else { - typeid = createID(type._item.id.client, type._item.id.clock); - } - return new RelativePosition(typeid, tname, item, assoc) -}; - -/** - * Create a relativePosition based on a absolute position. - * - * @param {AbstractType} type The base type (e.g. YText or YArray). - * @param {number} index The absolute position. - * @param {number} [assoc] - * @return {RelativePosition} - * - * @function - */ -const createRelativePositionFromTypeIndex = (type, index, assoc = 0) => { - let t = type._start; - if (assoc < 0) { - // associated to the left character or the beginning of a type, increment index if possible. - if (index === 0) { - return createRelativePosition(type, null, assoc) - } - index--; - } - while (t !== null) { - if (!t.deleted && t.countable) { - if (t.length > index) { - // case 1: found position somewhere in the linked list - return createRelativePosition(type, createID(t.id.client, t.id.clock + index), assoc) - } - index -= t.length; - } - if (t.right === null && assoc < 0) { - // left-associated position, return last available id - return createRelativePosition(type, t.lastId, assoc) - } - t = t.right; - } - return createRelativePosition(type, null, assoc) -}; - -/** - * @param {encoding.Encoder} encoder - * @param {RelativePosition} rpos - * - * @function - */ -const writeRelativePosition = (encoder, rpos) => { - const { type, tname, item, assoc } = rpos; - if (item !== null) { - encoding.writeVarUint(encoder, 0); - writeID(encoder, item); - } else if (tname !== null) { - // case 2: found position at the end of the list and type is stored in y.share - encoding.writeUint8(encoder, 1); - encoding.writeVarString(encoder, tname); - } else if (type !== null) { - // case 3: found position at the end of the list and type is attached to an item - encoding.writeUint8(encoder, 2); - writeID(encoder, type); - } else { - throw error.unexpectedCase() - } - encoding.writeVarInt(encoder, assoc); - return encoder -}; - -/** - * @param {RelativePosition} rpos - * @return {Uint8Array} - */ -const encodeRelativePosition = rpos => { - const encoder = encoding.createEncoder(); - writeRelativePosition(encoder, rpos); - return encoding.toUint8Array(encoder) -}; - -/** - * @param {decoding.Decoder} decoder - * @return {RelativePosition} - * - * @function - */ -const readRelativePosition = decoder => { - let type = null; - let tname = null; - let itemID = null; - switch (decoding.readVarUint(decoder)) { - case 0: - // case 1: found position somewhere in the linked list - itemID = readID(decoder); - break - case 1: - // case 2: found position at the end of the list and type is stored in y.share - tname = decoding.readVarString(decoder); - break - case 2: { - // case 3: found position at the end of the list and type is attached to an item - type = readID(decoder); - } - } - const assoc = decoding.hasContent(decoder) ? decoding.readVarInt(decoder) : 0; - return new RelativePosition(type, tname, itemID, assoc) -}; - -/** - * @param {Uint8Array} uint8Array - * @return {RelativePosition} - */ -const decodeRelativePosition = uint8Array => readRelativePosition(decoding.createDecoder(uint8Array)); - -/** - * @param {StructStore} store - * @param {ID} id - */ -const getItemWithOffset = (store, id) => { - const item = getItem(store, id); - const diff = id.clock - item.id.clock; - return { - item, diff - } -}; - -/** - * Transform a relative position to an absolute position. - * - * If you want to share the relative position with other users, you should set - * `followUndoneDeletions` to false to get consistent results across all clients. - * - * When calculating the absolute position, we try to follow the "undone deletions". This yields - * better results for the user who performed undo. However, only the user who performed the undo - * will get the better results, the other users don't know which operations recreated a deleted - * range of content. There is more information in this ticket: https://github.com/yjs/yjs/issues/638 - * - * @param {RelativePosition} rpos - * @param {Doc} doc - * @param {boolean} followUndoneDeletions - whether to follow undone deletions - see https://github.com/yjs/yjs/issues/638 - * @return {AbsolutePosition|null} - * - * @function - */ -const createAbsolutePositionFromRelativePosition = (rpos, doc, followUndoneDeletions = true) => { - const store = doc.store; - const rightID = rpos.item; - const typeID = rpos.type; - const tname = rpos.tname; - const assoc = rpos.assoc; - let type = null; - let index = 0; - if (rightID !== null) { - if (getState(store, rightID.client) <= rightID.clock) { - return null - } - const res = followUndoneDeletions ? followRedone(store, rightID) : getItemWithOffset(store, rightID); - const right = res.item; - if (!(right instanceof Item)) { - return null - } - type = /** @type {AbstractType} */ (right.parent); - if (type._item === null || !type._item.deleted) { - index = (right.deleted || !right.countable) ? 0 : (res.diff + (assoc >= 0 ? 0 : 1)); // adjust position based on left association if necessary - let n = right.left; - while (n !== null) { - if (!n.deleted && n.countable) { - index += n.length; - } - n = n.left; - } - } - } else { - if (tname !== null) { - type = doc.get(tname); - } else if (typeID !== null) { - if (getState(store, typeID.client) <= typeID.clock) { - // type does not exist yet - return null - } - const { item } = followUndoneDeletions ? followRedone(store, typeID) : { item: getItem(store, typeID) }; - if (item instanceof Item && item.content instanceof ContentType) { - type = item.content.type; - } else { - // struct is garbage collected - return null - } - } else { - throw error.unexpectedCase() - } - if (assoc >= 0) { - index = type._length; - } else { - index = 0; - } - } - return createAbsolutePosition(type, index, rpos.assoc) -}; - -/** - * @param {RelativePosition|null} a - * @param {RelativePosition|null} b - * @return {boolean} - * - * @function - */ -const compareRelativePositions = (a, b) => a === b || ( - a !== null && b !== null && a.tname === b.tname && compareIDs(a.item, b.item) && compareIDs(a.type, b.type) && a.assoc === b.assoc -); - -class Snapshot { - /** - * @param {DeleteSet} ds - * @param {Map} sv state map - */ - constructor (ds, sv) { - /** - * @type {DeleteSet} - */ - this.ds = ds; - /** - * State Map - * @type {Map} - */ - this.sv = sv; - } -} - -/** - * @param {Snapshot} snap1 - * @param {Snapshot} snap2 - * @return {boolean} - */ -const equalSnapshots = (snap1, snap2) => { - const ds1 = snap1.ds.clients; - const ds2 = snap2.ds.clients; - const sv1 = snap1.sv; - const sv2 = snap2.sv; - if (sv1.size !== sv2.size || ds1.size !== ds2.size) { - return false - } - for (const [key, value] of sv1.entries()) { - if (sv2.get(key) !== value) { - return false - } - } - for (const [client, dsitems1] of ds1.entries()) { - const dsitems2 = ds2.get(client) || []; - if (dsitems1.length !== dsitems2.length) { - return false - } - for (let i = 0; i < dsitems1.length; i++) { - const dsitem1 = dsitems1[i]; - const dsitem2 = dsitems2[i]; - if (dsitem1.clock !== dsitem2.clock || dsitem1.len !== dsitem2.len) { - return false - } - } - } - return true -}; - -/** - * @param {Snapshot} snapshot - * @param {DSEncoderV1 | DSEncoderV2} [encoder] - * @return {Uint8Array} - */ -const encodeSnapshotV2 = (snapshot, encoder = new DSEncoderV2()) => { - writeDeleteSet(encoder, snapshot.ds); - writeStateVector(encoder, snapshot.sv); - return encoder.toUint8Array() -}; - -/** - * @param {Snapshot} snapshot - * @return {Uint8Array} - */ -const encodeSnapshot = snapshot => encodeSnapshotV2(snapshot, new DSEncoderV1()); - -/** - * @param {Uint8Array} buf - * @param {DSDecoderV1 | DSDecoderV2} [decoder] - * @return {Snapshot} - */ -const decodeSnapshotV2 = (buf, decoder = new DSDecoderV2(decoding.createDecoder(buf))) => { - return new Snapshot(readDeleteSet(decoder), readStateVector(decoder)) -}; - -/** - * @param {Uint8Array} buf - * @return {Snapshot} - */ -const decodeSnapshot = buf => decodeSnapshotV2(buf, new DSDecoderV1(decoding.createDecoder(buf))); - -/** - * @param {DeleteSet} ds - * @param {Map} sm - * @return {Snapshot} - */ -const createSnapshot = (ds, sm) => new Snapshot(ds, sm); - -const emptySnapshot = createSnapshot(createDeleteSet(), new Map()); - -/** - * @param {Doc} doc - * @return {Snapshot} - */ -const snapshot = doc => createSnapshot(createDeleteSetFromStructStore(doc.store), getStateVector(doc.store)); - -/** - * @param {Item} item - * @param {Snapshot|undefined} snapshot - * - * @protected - * @function - */ -const isVisible = (item, snapshot) => snapshot === undefined - ? !item.deleted - : snapshot.sv.has(item.id.client) && (snapshot.sv.get(item.id.client) || 0) > item.id.clock && !isDeleted(snapshot.ds, item.id); - -/** - * @param {Transaction} transaction - * @param {Snapshot} snapshot - */ -const splitSnapshotAffectedStructs = (transaction, snapshot) => { - const meta = map.setIfUndefined(transaction.meta, splitSnapshotAffectedStructs, set.create); - const store = transaction.doc.store; - // check if we already split for this snapshot - if (!meta.has(snapshot)) { - snapshot.sv.forEach((clock, client) => { - if (clock < getState(store, client)) { - getItemCleanStart(transaction, createID(client, clock)); - } - }); - iterateDeletedStructs(transaction, snapshot.ds, _item => {}); - meta.add(snapshot); - } -}; - -/** - * @example - * const ydoc = new Y.Doc({ gc: false }) - * ydoc.getText().insert(0, 'world!') - * const snapshot = Y.snapshot(ydoc) - * ydoc.getText().insert(0, 'hello ') - * const restored = Y.createDocFromSnapshot(ydoc, snapshot) - * assert(restored.getText().toString() === 'world!') - * - * @param {Doc} originDoc - * @param {Snapshot} snapshot - * @param {Doc} [newDoc] Optionally, you may define the Yjs document that receives the data from originDoc - * @return {Doc} - */ -const createDocFromSnapshot = (originDoc, snapshot, newDoc = new Doc()) => { - if (originDoc.gc) { - // we should not try to restore a GC-ed document, because some of the restored items might have their content deleted - throw new Error('Garbage-collection must be disabled in `originDoc`!') - } - const { sv, ds } = snapshot; - - const encoder = new UpdateEncoderV2(); - originDoc.transact(transaction => { - let size = 0; - sv.forEach(clock => { - if (clock > 0) { - size++; - } - }); - encoding.writeVarUint(encoder.restEncoder, size); - // splitting the structs before writing them to the encoder - for (const [client, clock] of sv) { - if (clock === 0) { - continue - } - if (clock < getState(originDoc.store, client)) { - getItemCleanStart(transaction, createID(client, clock)); - } - const structs = originDoc.store.clients.get(client) || []; - const lastStructIndex = findIndexSS(structs, clock - 1); - // write # encoded structs - encoding.writeVarUint(encoder.restEncoder, lastStructIndex + 1); - encoder.writeClient(client); - // first clock written is 0 - encoding.writeVarUint(encoder.restEncoder, 0); - for (let i = 0; i <= lastStructIndex; i++) { - structs[i].write(encoder, 0); - } - } - writeDeleteSet(encoder, ds); - }); - - applyUpdateV2(newDoc, encoder.toUint8Array(), 'snapshot'); - return newDoc -}; - -/** - * @param {Snapshot} snapshot - * @param {Uint8Array} update - * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder] - */ -const snapshotContainsUpdateV2 = (snapshot, update, YDecoder = UpdateDecoderV2) => { - const updateDecoder = new YDecoder(decoding.createDecoder(update)); - const lazyDecoder = new LazyStructReader(updateDecoder, false); - for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) { - if ((snapshot.sv.get(curr.id.client) || 0) < curr.id.clock + curr.length) { - return false - } - } - const mergedDS = mergeDeleteSets([snapshot.ds, readDeleteSet(updateDecoder)]); - return equalDeleteSets(snapshot.ds, mergedDS) -}; - -/** - * @param {Snapshot} snapshot - * @param {Uint8Array} update - */ -const snapshotContainsUpdate = (snapshot, update) => snapshotContainsUpdateV2(snapshot, update, UpdateDecoderV1); - -class StructStore { - constructor () { - /** - * @type {Map>} - */ - this.clients = new Map(); - /** - * @type {null | { missing: Map, update: Uint8Array }} - */ - this.pendingStructs = null; - /** - * @type {null | Uint8Array} - */ - this.pendingDs = null; - } -} - -/** - * Return the states as a Map. - * Note that clock refers to the next expected clock id. - * - * @param {StructStore} store - * @return {Map} - * - * @public - * @function - */ -const getStateVector = store => { - const sm = new Map(); - store.clients.forEach((structs, client) => { - const struct = structs[structs.length - 1]; - sm.set(client, struct.id.clock + struct.length); - }); - return sm -}; - -/** - * @param {StructStore} store - * @param {number} client - * @return {number} - * - * @public - * @function - */ -const getState = (store, client) => { - const structs = store.clients.get(client); - if (structs === undefined) { - return 0 - } - const lastStruct = structs[structs.length - 1]; - return lastStruct.id.clock + lastStruct.length -}; - -/** - * @param {StructStore} store - * @param {GC|Item} struct - * - * @private - * @function - */ -const addStruct = (store, struct) => { - let structs = store.clients.get(struct.id.client); - if (structs === undefined) { - structs = []; - store.clients.set(struct.id.client, structs); - } else { - const lastStruct = structs[structs.length - 1]; - if (lastStruct.id.clock + lastStruct.length !== struct.id.clock) { - throw error.unexpectedCase() - } - } - structs.push(struct); -}; - -/** - * Perform a binary search on a sorted array - * @param {Array} structs - * @param {number} clock - * @return {number} - * - * @private - * @function - */ -const findIndexSS = (structs, clock) => { - let left = 0; - let right = structs.length - 1; - let mid = structs[right]; - let midclock = mid.id.clock; - if (midclock === clock) { - return right - } - // @todo does it even make sense to pivot the search? - // If a good split misses, it might actually increase the time to find the correct item. - // Currently, the only advantage is that search with pivoting might find the item on the first try. - let midindex = math.floor((clock / (midclock + mid.length - 1)) * right); // pivoting the search - while (left <= right) { - mid = structs[midindex]; - midclock = mid.id.clock; - if (midclock <= clock) { - if (clock < midclock + mid.length) { - return midindex - } - left = midindex + 1; - } else { - right = midindex - 1; - } - midindex = math.floor((left + right) / 2); - } - // Always check state before looking for a struct in StructStore - // Therefore the case of not finding a struct is unexpected - throw error.unexpectedCase() -}; - -/** - * Expects that id is actually in store. This function throws or is an infinite loop otherwise. - * - * @param {StructStore} store - * @param {ID} id - * @return {GC|Item} - * - * @private - * @function - */ -const find = (store, id) => { - /** - * @type {Array} - */ - // @ts-ignore - const structs = store.clients.get(id.client); - return structs[findIndexSS(structs, id.clock)] -}; - -/** - * Expects that id is actually in store. This function throws or is an infinite loop otherwise. - * @private - * @function - */ -const getItem = /** @type {function(StructStore,ID):Item} */ (find); - -/** - * @param {Transaction} transaction - * @param {Array} structs - * @param {number} clock - */ -const findIndexCleanStart = (transaction, structs, clock) => { - const index = findIndexSS(structs, clock); - const struct = structs[index]; - if (struct.id.clock < clock && struct instanceof Item) { - structs.splice(index + 1, 0, splitItem(transaction, struct, clock - struct.id.clock)); - return index + 1 - } - return index -}; - -/** - * Expects that id is actually in store. This function throws or is an infinite loop otherwise. - * - * @param {Transaction} transaction - * @param {ID} id - * @return {Item} - * - * @private - * @function - */ -const getItemCleanStart = (transaction, id) => { - const structs = /** @type {Array} */ (transaction.doc.store.clients.get(id.client)); - return structs[findIndexCleanStart(transaction, structs, id.clock)] -}; - -/** - * Expects that id is actually in store. This function throws or is an infinite loop otherwise. - * - * @param {Transaction} transaction - * @param {StructStore} store - * @param {ID} id - * @return {Item} - * - * @private - * @function - */ -const getItemCleanEnd = (transaction, store, id) => { - /** - * @type {Array} - */ - // @ts-ignore - const structs = store.clients.get(id.client); - const index = findIndexSS(structs, id.clock); - const struct = structs[index]; - if (id.clock !== struct.id.clock + struct.length - 1 && struct.constructor !== GC) { - structs.splice(index + 1, 0, splitItem(transaction, struct, id.clock - struct.id.clock + 1)); - } - return struct -}; - -/** - * Replace `item` with `newitem` in store - * @param {StructStore} store - * @param {GC|Item} struct - * @param {GC|Item} newStruct - * - * @private - * @function - */ -const replaceStruct = (store, struct, newStruct) => { - const structs = /** @type {Array} */ (store.clients.get(struct.id.client)); - structs[findIndexSS(structs, struct.id.clock)] = newStruct; -}; - -/** - * Iterate over a range of structs - * - * @param {Transaction} transaction - * @param {Array} structs - * @param {number} clockStart Inclusive start - * @param {number} len - * @param {function(GC|Item):void} f - * - * @function - */ -const iterateStructs = (transaction, structs, clockStart, len, f) => { - if (len === 0) { - return - } - const clockEnd = clockStart + len; - let index = findIndexCleanStart(transaction, structs, clockStart); - let struct; - do { - struct = structs[index++]; - if (clockEnd < struct.id.clock + struct.length) { - findIndexCleanStart(transaction, structs, clockEnd); - } - f(struct); - } while (index < structs.length && structs[index].id.clock < clockEnd) -}; - -/** - * A transaction is created for every change on the Yjs model. It is possible - * to bundle changes on the Yjs model in a single transaction to - * minimize the number on messages sent and the number of observer calls. - * If possible the user of this library should bundle as many changes as - * possible. Here is an example to illustrate the advantages of bundling: - * - * @example - * const ydoc = new Y.Doc() - * const map = ydoc.getMap('map') - * // Log content when change is triggered - * map.observe(() => { - * console.log('change triggered') - * }) - * // Each change on the map type triggers a log message: - * map.set('a', 0) // => "change triggered" - * map.set('b', 0) // => "change triggered" - * // When put in a transaction, it will trigger the log after the transaction: - * ydoc.transact(() => { - * map.set('a', 1) - * map.set('b', 1) - * }) // => "change triggered" - * - * @public - */ -class Transaction { - /** - * @param {Doc} doc - * @param {any} origin - * @param {boolean} local - */ - constructor (doc, origin, local) { - /** - * The Yjs instance. - * @type {Doc} - */ - this.doc = doc; - /** - * Describes the set of deleted items by ids - * @type {DeleteSet} - */ - this.deleteSet = new DeleteSet(); - /** - * Holds the state before the transaction started. - * @type {Map} - */ - this.beforeState = getStateVector(doc.store); - /** - * Holds the state after the transaction. - * @type {Map} - */ - this.afterState = new Map(); - /** - * All types that were directly modified (property added or child - * inserted/deleted). New types are not included in this Set. - * Maps from type to parentSubs (`item.parentSub = null` for YArray) - * @type {Map>,Set>} - */ - this.changed = new Map(); - /** - * Stores the events for the types that observe also child elements. - * It is mainly used by `observeDeep`. - * @type {Map>,Array>>} - */ - this.changedParentTypes = new Map(); - /** - * @type {Array} - */ - this._mergeStructs = []; - /** - * @type {any} - */ - this.origin = origin; - /** - * Stores meta information on the transaction - * @type {Map} - */ - this.meta = new Map(); - /** - * Whether this change originates from this doc. - * @type {boolean} - */ - this.local = local; - /** - * @type {Set} - */ - this.subdocsAdded = new Set(); - /** - * @type {Set} - */ - this.subdocsRemoved = new Set(); - /** - * @type {Set} - */ - this.subdocsLoaded = new Set(); - /** - * @type {boolean} - */ - this._needFormattingCleanup = false; - } -} - -/** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {Transaction} transaction - * @return {boolean} Whether data was written. - */ -const writeUpdateMessageFromTransaction = (encoder, transaction) => { - if (transaction.deleteSet.clients.size === 0 && !map.any(transaction.afterState, (clock, client) => transaction.beforeState.get(client) !== clock)) { - return false - } - sortAndMergeDeleteSet(transaction.deleteSet); - writeStructsFromTransaction(encoder, transaction); - writeDeleteSet(encoder, transaction.deleteSet); - return true -}; - -/** - * If `type.parent` was added in current transaction, `type` technically - * did not change, it was just added and we should not fire events for `type`. - * - * @param {Transaction} transaction - * @param {AbstractType>} type - * @param {string|null} parentSub - */ -const addChangedTypeToTransaction = (transaction, type, parentSub) => { - const item = type._item; - if (item === null || (item.id.clock < (transaction.beforeState.get(item.id.client) || 0) && !item.deleted)) { - map.setIfUndefined(transaction.changed, type, set.create).add(parentSub); - } -}; - -/** - * @param {Array} structs - * @param {number} pos - * @return {number} # of merged structs - */ -const tryToMergeWithLefts = (structs, pos) => { - let right = structs[pos]; - let left = structs[pos - 1]; - let i = pos; - for (; i > 0; right = left, left = structs[--i - 1]) { - if (left.deleted === right.deleted && left.constructor === right.constructor) { - if (left.mergeWith(right)) { - if (right instanceof Item && right.parentSub !== null && /** @type {AbstractType} */ (right.parent)._map.get(right.parentSub) === right) { - /** @type {AbstractType} */ (right.parent)._map.set(right.parentSub, /** @type {Item} */ (left)); - } - continue - } - } - break - } - const merged = pos - i; - if (merged) { - // remove all merged structs from the array - structs.splice(pos + 1 - merged, merged); - } - return merged -}; - -/** - * @param {DeleteSet} ds - * @param {StructStore} store - * @param {function(Item):boolean} gcFilter - */ -const tryGcDeleteSet = (ds, store, gcFilter) => { - for (const [client, deleteItems] of ds.clients.entries()) { - const structs = /** @type {Array} */ (store.clients.get(client)); - for (let di = deleteItems.length - 1; di >= 0; di--) { - const deleteItem = deleteItems[di]; - const endDeleteItemClock = deleteItem.clock + deleteItem.len; - for ( - let si = findIndexSS(structs, deleteItem.clock), struct = structs[si]; - si < structs.length && struct.id.clock < endDeleteItemClock; - struct = structs[++si] - ) { - const struct = structs[si]; - if (deleteItem.clock + deleteItem.len <= struct.id.clock) { - break - } - if (struct instanceof Item && struct.deleted && !struct.keep && gcFilter(struct)) { - struct.gc(store, false); - } - } - } - } -}; - -/** - * @param {DeleteSet} ds - * @param {StructStore} store - */ -const tryMergeDeleteSet = (ds, store) => { - // try to merge deleted / gc'd items - // merge from right to left for better efficiency and so we don't miss any merge targets - ds.clients.forEach((deleteItems, client) => { - const structs = /** @type {Array} */ (store.clients.get(client)); - for (let di = deleteItems.length - 1; di >= 0; di--) { - const deleteItem = deleteItems[di]; - // start with merging the item next to the last deleted item - const mostRightIndexToCheck = math.min(structs.length - 1, 1 + findIndexSS(structs, deleteItem.clock + deleteItem.len - 1)); - for ( - let si = mostRightIndexToCheck, struct = structs[si]; - si > 0 && struct.id.clock >= deleteItem.clock; - struct = structs[si] - ) { - si -= 1 + tryToMergeWithLefts(structs, si); - } - } - }); -}; - -/** - * @param {DeleteSet} ds - * @param {StructStore} store - * @param {function(Item):boolean} gcFilter - */ -const tryGc = (ds, store, gcFilter) => { - tryGcDeleteSet(ds, store, gcFilter); - tryMergeDeleteSet(ds, store); -}; - -/** - * @param {Array} transactionCleanups - * @param {number} i - */ -const cleanupTransactions = (transactionCleanups, i) => { - if (i < transactionCleanups.length) { - const transaction = transactionCleanups[i]; - const doc = transaction.doc; - const store = doc.store; - const ds = transaction.deleteSet; - const mergeStructs = transaction._mergeStructs; - try { - sortAndMergeDeleteSet(ds); - transaction.afterState = getStateVector(transaction.doc.store); - doc.emit('beforeObserverCalls', [transaction, doc]); - /** - * An array of event callbacks. - * - * Each callback is called even if the other ones throw errors. - * - * @type {Array} - */ - const fs = []; - // observe events on changed types - transaction.changed.forEach((subs, itemtype) => - fs.push(() => { - if (itemtype._item === null || !itemtype._item.deleted) { - itemtype._callObserver(transaction, subs); - } - }) - ); - fs.push(() => { - // deep observe events - transaction.changedParentTypes.forEach((events, type) => { - // We need to think about the possibility that the user transforms the - // Y.Doc in the event. - if (type._dEH.l.length > 0 && (type._item === null || !type._item.deleted)) { - events = events - .filter(event => - event.target._item === null || !event.target._item.deleted - ); - events - .forEach(event => { - event.currentTarget = type; - // path is relative to the current target - event._path = null; - }); - // sort events by path length so that top-level events are fired first. - events - .sort((event1, event2) => event1.path.length - event2.path.length); - fs.push(() => { - // We don't need to check for events.length - // because we know it has at least one element - callEventHandlerListeners(type._dEH, events, transaction); - }); - } - }); - fs.push(() => doc.emit('afterTransaction', [transaction, doc])); - fs.push(() => { - if (transaction._needFormattingCleanup) { - cleanupYTextAfterTransaction(transaction); - } - }); - }); - callAll(fs, []); - } finally { - // Replace deleted items with ItemDeleted / GC. - // This is where content is actually remove from the Yjs Doc. - if (doc.gc) { - tryGcDeleteSet(ds, store, doc.gcFilter); - } - tryMergeDeleteSet(ds, store); - - // on all affected store.clients props, try to merge - transaction.afterState.forEach((clock, client) => { - const beforeClock = transaction.beforeState.get(client) || 0; - if (beforeClock !== clock) { - const structs = /** @type {Array} */ (store.clients.get(client)); - // we iterate from right to left so we can safely remove entries - const firstChangePos = math.max(findIndexSS(structs, beforeClock), 1); - for (let i = structs.length - 1; i >= firstChangePos;) { - i -= 1 + tryToMergeWithLefts(structs, i); - } - } - }); - // try to merge mergeStructs - // @todo: it makes more sense to transform mergeStructs to a DS, sort it, and merge from right to left - // but at the moment DS does not handle duplicates - for (let i = mergeStructs.length - 1; i >= 0; i--) { - const { client, clock } = mergeStructs[i].id; - const structs = /** @type {Array} */ (store.clients.get(client)); - const replacedStructPos = findIndexSS(structs, clock); - if (replacedStructPos + 1 < structs.length) { - if (tryToMergeWithLefts(structs, replacedStructPos + 1) > 1) { - continue // no need to perform next check, both are already merged - } - } - if (replacedStructPos > 0) { - tryToMergeWithLefts(structs, replacedStructPos); - } - } - if (!transaction.local && transaction.afterState.get(doc.clientID) !== transaction.beforeState.get(doc.clientID)) { - logging.print(logging.ORANGE, logging.BOLD, '[yjs] ', logging.UNBOLD, logging.RED, 'Changed the client-id because another client seems to be using it.'); - doc.clientID = generateNewClientId(); - } - // @todo Merge all the transactions into one and provide send the data as a single update message - doc.emit('afterTransactionCleanup', [transaction, doc]); - if (doc._observers.has('update')) { - const encoder = new UpdateEncoderV1(); - const hasContent = writeUpdateMessageFromTransaction(encoder, transaction); - if (hasContent) { - doc.emit('update', [encoder.toUint8Array(), transaction.origin, doc, transaction]); - } - } - if (doc._observers.has('updateV2')) { - const encoder = new UpdateEncoderV2(); - const hasContent = writeUpdateMessageFromTransaction(encoder, transaction); - if (hasContent) { - doc.emit('updateV2', [encoder.toUint8Array(), transaction.origin, doc, transaction]); - } - } - const { subdocsAdded, subdocsLoaded, subdocsRemoved } = transaction; - if (subdocsAdded.size > 0 || subdocsRemoved.size > 0 || subdocsLoaded.size > 0) { - subdocsAdded.forEach(subdoc => { - subdoc.clientID = doc.clientID; - if (subdoc.collectionid == null) { - subdoc.collectionid = doc.collectionid; - } - doc.subdocs.add(subdoc); - }); - subdocsRemoved.forEach(subdoc => doc.subdocs.delete(subdoc)); - doc.emit('subdocs', [{ loaded: subdocsLoaded, added: subdocsAdded, removed: subdocsRemoved }, doc, transaction]); - subdocsRemoved.forEach(subdoc => subdoc.destroy()); - } - - if (transactionCleanups.length <= i + 1) { - doc._transactionCleanups = []; - doc.emit('afterAllTransactions', [doc, transactionCleanups]); - } else { - cleanupTransactions(transactionCleanups, i + 1); - } - } - } -}; - -/** - * Implements the functionality of `y.transact(()=>{..})` - * - * @template T - * @param {Doc} doc - * @param {function(Transaction):T} f - * @param {any} [origin=true] - * @return {T} - * - * @function - */ -const transact = (doc, f, origin = null, local = true) => { - const transactionCleanups = doc._transactionCleanups; - let initialCall = false; - /** - * @type {any} - */ - let result = null; - if (doc._transaction === null) { - initialCall = true; - doc._transaction = new Transaction(doc, origin, local); - transactionCleanups.push(doc._transaction); - if (transactionCleanups.length === 1) { - doc.emit('beforeAllTransactions', [doc]); - } - doc.emit('beforeTransaction', [doc._transaction, doc]); - } - try { - result = f(doc._transaction); - } finally { - if (initialCall) { - const finishCleanup = doc._transaction === transactionCleanups[0]; - doc._transaction = null; - if (finishCleanup) { - // The first transaction ended, now process observer calls. - // Observer call may create new transactions for which we need to call the observers and do cleanup. - // We don't want to nest these calls, so we execute these calls one after - // another. - // Also we need to ensure that all cleanups are called, even if the - // observes throw errors. - // This file is full of hacky try {} finally {} blocks to ensure that an - // event can throw errors and also that the cleanup is called. - cleanupTransactions(transactionCleanups, 0); - } - } - } - return result -}; - -class StackItem { - /** - * @param {DeleteSet} deletions - * @param {DeleteSet} insertions - */ - constructor (deletions, insertions) { - this.insertions = insertions; - this.deletions = deletions; - /** - * Use this to save and restore metadata like selection range - */ - this.meta = new Map(); - } -} -/** - * @param {Transaction} tr - * @param {UndoManager} um - * @param {StackItem} stackItem - */ -const clearUndoManagerStackItem = (tr, um, stackItem) => { - iterateDeletedStructs(tr, stackItem.deletions, item => { - if (item instanceof Item && um.scope.some(type => type === tr.doc || isParentOf(/** @type {AbstractType} */ (type), item))) { - keepItem(item, false); - } - }); -}; - -/** - * @param {UndoManager} undoManager - * @param {Array} stack - * @param {'undo'|'redo'} eventType - * @return {StackItem?} - */ -const popStackItem = (undoManager, stack, eventType) => { - /** - * Keep a reference to the transaction so we can fire the event with the changedParentTypes - * @type {any} - */ - let _tr = null; - const doc = undoManager.doc; - const scope = undoManager.scope; - transact(doc, transaction => { - while (stack.length > 0 && undoManager.currStackItem === null) { - const store = doc.store; - const stackItem = /** @type {StackItem} */ (stack.pop()); - /** - * @type {Set} - */ - const itemsToRedo = new Set(); - /** - * @type {Array} - */ - const itemsToDelete = []; - let performedChange = false; - iterateDeletedStructs(transaction, stackItem.insertions, struct => { - if (struct instanceof Item) { - if (struct.redone !== null) { - let { item, diff } = followRedone(store, struct.id); - if (diff > 0) { - item = getItemCleanStart(transaction, createID(item.id.client, item.id.clock + diff)); - } - struct = item; - } - if (!struct.deleted && scope.some(type => type === transaction.doc || isParentOf(/** @type {AbstractType} */ (type), /** @type {Item} */ (struct)))) { - itemsToDelete.push(struct); - } - } - }); - iterateDeletedStructs(transaction, stackItem.deletions, struct => { - if ( - struct instanceof Item && - scope.some(type => type === transaction.doc || isParentOf(/** @type {AbstractType} */ (type), struct)) && - // Never redo structs in stackItem.insertions because they were created and deleted in the same capture interval. - !isDeleted(stackItem.insertions, struct.id) - ) { - itemsToRedo.add(struct); - } - }); - itemsToRedo.forEach(struct => { - performedChange = redoItem(transaction, struct, itemsToRedo, stackItem.insertions, undoManager.ignoreRemoteMapChanges, undoManager) !== null || performedChange; - }); - // We want to delete in reverse order so that children are deleted before - // parents, so we have more information available when items are filtered. - for (let i = itemsToDelete.length - 1; i >= 0; i--) { - const item = itemsToDelete[i]; - if (undoManager.deleteFilter(item)) { - item.delete(transaction); - performedChange = true; - } - } - undoManager.currStackItem = performedChange ? stackItem : null; - } - transaction.changed.forEach((subProps, type) => { - // destroy search marker if necessary - if (subProps.has(null) && type._searchMarker) { - type._searchMarker.length = 0; - } - }); - _tr = transaction; - }, undoManager); - const res = undoManager.currStackItem; - if (res != null) { - const changedParentTypes = _tr.changedParentTypes; - undoManager.emit('stack-item-popped', [{ stackItem: res, type: eventType, changedParentTypes, origin: undoManager }, undoManager]); - undoManager.currStackItem = null; - } - return res -}; - -/** - * @typedef {Object} UndoManagerOptions - * @property {number} [UndoManagerOptions.captureTimeout=500] - * @property {function(Transaction):boolean} [UndoManagerOptions.captureTransaction] Do not capture changes of a Transaction if result false. - * @property {function(Item):boolean} [UndoManagerOptions.deleteFilter=()=>true] Sometimes - * it is necessary to filter what an Undo/Redo operation can delete. If this - * filter returns false, the type/item won't be deleted even it is in the - * undo/redo scope. - * @property {Set} [UndoManagerOptions.trackedOrigins=new Set([null])] - * @property {boolean} [ignoreRemoteMapChanges] Experimental. By default, the UndoManager will never overwrite remote changes. Enable this property to enable overwriting remote changes on key-value changes (Y.Map, properties on Y.Xml, etc..). - * @property {Doc} [doc] The document that this UndoManager operates on. Only needed if typeScope is empty. - */ - -/** - * @typedef {Object} StackItemEvent - * @property {StackItem} StackItemEvent.stackItem - * @property {any} StackItemEvent.origin - * @property {'undo'|'redo'} StackItemEvent.type - * @property {Map>,Array>>} StackItemEvent.changedParentTypes - */ - -/** - * Fires 'stack-item-added' event when a stack item was added to either the undo- or - * the redo-stack. You may store additional stack information via the - * metadata property on `event.stackItem.meta` (it is a `Map` of metadata properties). - * Fires 'stack-item-popped' event when a stack item was popped from either the - * undo- or the redo-stack. You may restore the saved stack information from `event.stackItem.meta`. - * - * @extends {ObservableV2<{'stack-item-added':function(StackItemEvent, UndoManager):void, 'stack-item-popped': function(StackItemEvent, UndoManager):void, 'stack-cleared': function({ undoStackCleared: boolean, redoStackCleared: boolean }):void, 'stack-item-updated': function(StackItemEvent, UndoManager):void }>} - */ -class UndoManager extends ObservableV2 { - /** - * @param {Doc|AbstractType|Array>} typeScope Limits the scope of the UndoManager. If this is set to a ydoc instance, all changes on that ydoc will be undone. If set to a specific type, only changes on that type or its children will be undone. Also accepts an array of types. - * @param {UndoManagerOptions} options - */ - constructor (typeScope, { - captureTimeout = 500, - captureTransaction = _tr => true, - deleteFilter = () => true, - trackedOrigins = new Set([null]), - ignoreRemoteMapChanges = false, - doc = /** @type {Doc} */ (array.isArray(typeScope) ? typeScope[0].doc : typeScope instanceof Doc ? typeScope : typeScope.doc) - } = {}) { - super(); - /** - * @type {Array | Doc>} - */ - this.scope = []; - this.doc = doc; - this.addToScope(typeScope); - this.deleteFilter = deleteFilter; - trackedOrigins.add(this); - this.trackedOrigins = trackedOrigins; - this.captureTransaction = captureTransaction; - /** - * @type {Array} - */ - this.undoStack = []; - /** - * @type {Array} - */ - this.redoStack = []; - /** - * Whether the client is currently undoing (calling UndoManager.undo) - * - * @type {boolean} - */ - this.undoing = false; - this.redoing = false; - /** - * The currently popped stack item if UndoManager.undoing or UndoManager.redoing - * - * @type {StackItem|null} - */ - this.currStackItem = null; - this.lastChange = 0; - this.ignoreRemoteMapChanges = ignoreRemoteMapChanges; - this.captureTimeout = captureTimeout; - /** - * @param {Transaction} transaction - */ - this.afterTransactionHandler = transaction => { - // Only track certain transactions - if ( - !this.captureTransaction(transaction) || - !this.scope.some(type => transaction.changedParentTypes.has(/** @type {AbstractType} */ (type)) || type === this.doc) || - (!this.trackedOrigins.has(transaction.origin) && (!transaction.origin || !this.trackedOrigins.has(transaction.origin.constructor))) - ) { - return - } - const undoing = this.undoing; - const redoing = this.redoing; - const stack = undoing ? this.redoStack : this.undoStack; - if (undoing) { - this.stopCapturing(); // next undo should not be appended to last stack item - } else if (!redoing) { - // neither undoing nor redoing: delete redoStack - this.clear(false, true); - } - const insertions = new DeleteSet(); - transaction.afterState.forEach((endClock, client) => { - const startClock = transaction.beforeState.get(client) || 0; - const len = endClock - startClock; - if (len > 0) { - addToDeleteSet(insertions, client, startClock, len); - } - }); - const now = time.getUnixTime(); - let didAdd = false; - if (this.lastChange > 0 && now - this.lastChange < this.captureTimeout && stack.length > 0 && !undoing && !redoing) { - // append change to last stack op - const lastOp = stack[stack.length - 1]; - lastOp.deletions = mergeDeleteSets([lastOp.deletions, transaction.deleteSet]); - lastOp.insertions = mergeDeleteSets([lastOp.insertions, insertions]); - } else { - // create a new stack op - stack.push(new StackItem(transaction.deleteSet, insertions)); - didAdd = true; - } - if (!undoing && !redoing) { - this.lastChange = now; - } - // make sure that deleted structs are not gc'd - iterateDeletedStructs(transaction, transaction.deleteSet, /** @param {Item|GC} item */ item => { - if (item instanceof Item && this.scope.some(type => type === transaction.doc || isParentOf(/** @type {AbstractType} */ (type), item))) { - keepItem(item, true); - } - }); - /** - * @type {[StackItemEvent, UndoManager]} - */ - const changeEvent = [{ stackItem: stack[stack.length - 1], origin: transaction.origin, type: undoing ? 'redo' : 'undo', changedParentTypes: transaction.changedParentTypes }, this]; - if (didAdd) { - this.emit('stack-item-added', changeEvent); - } else { - this.emit('stack-item-updated', changeEvent); - } - }; - this.doc.on('afterTransaction', this.afterTransactionHandler); - this.doc.on('destroy', () => { - this.destroy(); - }); - } - - /** - * Extend the scope. - * - * @param {Array | Doc> | AbstractType | Doc} ytypes - */ - addToScope (ytypes) { - const tmpSet = new Set(this.scope); - ytypes = array.isArray(ytypes) ? ytypes : [ytypes]; - ytypes.forEach(ytype => { - if (!tmpSet.has(ytype)) { - tmpSet.add(ytype); - if (ytype instanceof AbstractType ? ytype.doc !== this.doc : ytype !== this.doc) logging.warn('[yjs#509] Not same Y.Doc'); // use MultiDocUndoManager instead. also see https://github.com/yjs/yjs/issues/509 - this.scope.push(ytype); - } - }); - } - - /** - * @param {any} origin - */ - addTrackedOrigin (origin) { - this.trackedOrigins.add(origin); - } - - /** - * @param {any} origin - */ - removeTrackedOrigin (origin) { - this.trackedOrigins.delete(origin); - } - - clear (clearUndoStack = true, clearRedoStack = true) { - if ((clearUndoStack && this.canUndo()) || (clearRedoStack && this.canRedo())) { - this.doc.transact(tr => { - if (clearUndoStack) { - this.undoStack.forEach(item => clearUndoManagerStackItem(tr, this, item)); - this.undoStack = []; - } - if (clearRedoStack) { - this.redoStack.forEach(item => clearUndoManagerStackItem(tr, this, item)); - this.redoStack = []; - } - this.emit('stack-cleared', [{ undoStackCleared: clearUndoStack, redoStackCleared: clearRedoStack }]); - }); - } - } - - /** - * UndoManager merges Undo-StackItem if they are created within time-gap - * smaller than `options.captureTimeout`. Call `um.stopCapturing()` so that the next - * StackItem won't be merged. - * - * - * @example - * // without stopCapturing - * ytext.insert(0, 'a') - * ytext.insert(1, 'b') - * um.undo() - * ytext.toString() // => '' (note that 'ab' was removed) - * // with stopCapturing - * ytext.insert(0, 'a') - * um.stopCapturing() - * ytext.insert(0, 'b') - * um.undo() - * ytext.toString() // => 'a' (note that only 'b' was removed) - * - */ - stopCapturing () { - this.lastChange = 0; - } - - /** - * Undo last changes on type. - * - * @return {StackItem?} Returns StackItem if a change was applied - */ - undo () { - this.undoing = true; - let res; - try { - res = popStackItem(this, this.undoStack, 'undo'); - } finally { - this.undoing = false; - } - return res - } - - /** - * Redo last undo operation. - * - * @return {StackItem?} Returns StackItem if a change was applied - */ - redo () { - this.redoing = true; - let res; - try { - res = popStackItem(this, this.redoStack, 'redo'); - } finally { - this.redoing = false; - } - return res - } - - /** - * Are undo steps available? - * - * @return {boolean} `true` if undo is possible - */ - canUndo () { - return this.undoStack.length > 0 - } - - /** - * Are redo steps available? - * - * @return {boolean} `true` if redo is possible - */ - canRedo () { - return this.redoStack.length > 0 - } - - destroy () { - this.trackedOrigins.delete(this); - this.doc.off('afterTransaction', this.afterTransactionHandler); - super.destroy(); - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - */ -function * lazyStructReaderGenerator (decoder) { - const numOfStateUpdates = decoding.readVarUint(decoder.restDecoder); - for (let i = 0; i < numOfStateUpdates; i++) { - const numberOfStructs = decoding.readVarUint(decoder.restDecoder); - const client = decoder.readClient(); - let clock = decoding.readVarUint(decoder.restDecoder); - for (let i = 0; i < numberOfStructs; i++) { - const info = decoder.readInfo(); - // @todo use switch instead of ifs - if (info === 10) { - const len = decoding.readVarUint(decoder.restDecoder); - yield new Skip(createID(client, clock), len); - clock += len; - } else if ((binary.BITS5 & info) !== 0) { - const cantCopyParentInfo = (info & (binary.BIT7 | binary.BIT8)) === 0; - // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y` - // and we read the next string as parentYKey. - // It indicates how we store/retrieve parent from `y.share` - // @type {string|null} - const struct = new Item( - createID(client, clock), - null, // left - (info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null, // origin - null, // right - (info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null, // right origin - // @ts-ignore Force writing a string here. - cantCopyParentInfo ? (decoder.readParentInfo() ? decoder.readString() : decoder.readLeftID()) : null, // parent - cantCopyParentInfo && (info & binary.BIT6) === binary.BIT6 ? decoder.readString() : null, // parentSub - readItemContent(decoder, info) // item content - ); - yield struct; - clock += struct.length; - } else { - const len = decoder.readLen(); - yield new GC(createID(client, clock), len); - clock += len; - } - } - } -} - -class LazyStructReader { - /** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @param {boolean} filterSkips - */ - constructor (decoder, filterSkips) { - this.gen = lazyStructReaderGenerator(decoder); - /** - * @type {null | Item | Skip | GC} - */ - this.curr = null; - this.done = false; - this.filterSkips = filterSkips; - this.next(); - } - - /** - * @return {Item | GC | Skip |null} - */ - next () { - // ignore "Skip" structs - do { - this.curr = this.gen.next().value || null; - } while (this.filterSkips && this.curr !== null && this.curr.constructor === Skip) - return this.curr - } -} - -/** - * @param {Uint8Array} update - * - */ -const logUpdate = update => logUpdateV2(update, UpdateDecoderV1); - -/** - * @param {Uint8Array} update - * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder] - * - */ -const logUpdateV2 = (update, YDecoder = UpdateDecoderV2) => { - const structs = []; - const updateDecoder = new YDecoder(decoding.createDecoder(update)); - const lazyDecoder = new LazyStructReader(updateDecoder, false); - for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) { - structs.push(curr); - } - logging.print('Structs: ', structs); - const ds = readDeleteSet(updateDecoder); - logging.print('DeleteSet: ', ds); -}; - -/** - * @param {Uint8Array} update - * - */ -const decodeUpdate = (update) => decodeUpdateV2(update, UpdateDecoderV1); - -/** - * @param {Uint8Array} update - * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder] - * - */ -const decodeUpdateV2 = (update, YDecoder = UpdateDecoderV2) => { - const structs = []; - const updateDecoder = new YDecoder(decoding.createDecoder(update)); - const lazyDecoder = new LazyStructReader(updateDecoder, false); - for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) { - structs.push(curr); - } - return { - structs, - ds: readDeleteSet(updateDecoder) - } -}; - -class LazyStructWriter { - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - */ - constructor (encoder) { - this.currClient = 0; - this.startClock = 0; - this.written = 0; - this.encoder = encoder; - /** - * We want to write operations lazily, but also we need to know beforehand how many operations we want to write for each client. - * - * This kind of meta-information (#clients, #structs-per-client-written) is written to the restEncoder. - * - * We fragment the restEncoder and store a slice of it per-client until we know how many clients there are. - * When we flush (toUint8Array) we write the restEncoder using the fragments and the meta-information. - * - * @type {Array<{ written: number, restEncoder: Uint8Array }>} - */ - this.clientStructs = []; - } -} - -/** - * @param {Array} updates - * @return {Uint8Array} - */ -const mergeUpdates = updates => mergeUpdatesV2(updates, UpdateDecoderV1, UpdateEncoderV1); - -/** - * @param {Uint8Array} update - * @param {typeof DSEncoderV1 | typeof DSEncoderV2} YEncoder - * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} YDecoder - * @return {Uint8Array} - */ -const encodeStateVectorFromUpdateV2 = (update, YEncoder = DSEncoderV2, YDecoder = UpdateDecoderV2) => { - const encoder = new YEncoder(); - const updateDecoder = new LazyStructReader(new YDecoder(decoding.createDecoder(update)), false); - let curr = updateDecoder.curr; - if (curr !== null) { - let size = 0; - let currClient = curr.id.client; - let stopCounting = curr.id.clock !== 0; // must start at 0 - let currClock = stopCounting ? 0 : curr.id.clock + curr.length; - for (; curr !== null; curr = updateDecoder.next()) { - if (currClient !== curr.id.client) { - if (currClock !== 0) { - size++; - // We found a new client - // write what we have to the encoder - encoding.writeVarUint(encoder.restEncoder, currClient); - encoding.writeVarUint(encoder.restEncoder, currClock); - } - currClient = curr.id.client; - currClock = 0; - stopCounting = curr.id.clock !== 0; - } - // we ignore skips - if (curr.constructor === Skip) { - stopCounting = true; - } - if (!stopCounting) { - currClock = curr.id.clock + curr.length; - } - } - // write what we have - if (currClock !== 0) { - size++; - encoding.writeVarUint(encoder.restEncoder, currClient); - encoding.writeVarUint(encoder.restEncoder, currClock); - } - // prepend the size of the state vector - const enc = encoding.createEncoder(); - encoding.writeVarUint(enc, size); - encoding.writeBinaryEncoder(enc, encoder.restEncoder); - encoder.restEncoder = enc; - return encoder.toUint8Array() - } else { - encoding.writeVarUint(encoder.restEncoder, 0); - return encoder.toUint8Array() - } -}; - -/** - * @param {Uint8Array} update - * @return {Uint8Array} - */ -const encodeStateVectorFromUpdate = update => encodeStateVectorFromUpdateV2(update, DSEncoderV1, UpdateDecoderV1); - -/** - * @param {Uint8Array} update - * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} YDecoder - * @return {{ from: Map, to: Map }} - */ -const parseUpdateMetaV2 = (update, YDecoder = UpdateDecoderV2) => { - /** - * @type {Map} - */ - const from = new Map(); - /** - * @type {Map} - */ - const to = new Map(); - const updateDecoder = new LazyStructReader(new YDecoder(decoding.createDecoder(update)), false); - let curr = updateDecoder.curr; - if (curr !== null) { - let currClient = curr.id.client; - let currClock = curr.id.clock; - // write the beginning to `from` - from.set(currClient, currClock); - for (; curr !== null; curr = updateDecoder.next()) { - if (currClient !== curr.id.client) { - // We found a new client - // write the end to `to` - to.set(currClient, currClock); - // write the beginning to `from` - from.set(curr.id.client, curr.id.clock); - // update currClient - currClient = curr.id.client; - } - currClock = curr.id.clock + curr.length; - } - // write the end to `to` - to.set(currClient, currClock); - } - return { from, to } -}; - -/** - * @param {Uint8Array} update - * @return {{ from: Map, to: Map }} - */ -const parseUpdateMeta = update => parseUpdateMetaV2(update, UpdateDecoderV1); - -/** - * This method is intended to slice any kind of struct and retrieve the right part. - * It does not handle side-effects, so it should only be used by the lazy-encoder. - * - * @param {Item | GC | Skip} left - * @param {number} diff - * @return {Item | GC} - */ -const sliceStruct = (left, diff) => { - if (left.constructor === GC) { - const { client, clock } = left.id; - return new GC(createID(client, clock + diff), left.length - diff) - } else if (left.constructor === Skip) { - const { client, clock } = left.id; - return new Skip(createID(client, clock + diff), left.length - diff) - } else { - const leftItem = /** @type {Item} */ (left); - const { client, clock } = leftItem.id; - return new Item( - createID(client, clock + diff), - null, - createID(client, clock + diff - 1), - null, - leftItem.rightOrigin, - leftItem.parent, - leftItem.parentSub, - leftItem.content.splice(diff) - ) - } -}; - -/** - * - * This function works similarly to `readUpdateV2`. - * - * @param {Array} updates - * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder] - * @param {typeof UpdateEncoderV1 | typeof UpdateEncoderV2} [YEncoder] - * @return {Uint8Array} - */ -const mergeUpdatesV2 = (updates, YDecoder = UpdateDecoderV2, YEncoder = UpdateEncoderV2) => { - if (updates.length === 1) { - return updates[0] - } - const updateDecoders = updates.map(update => new YDecoder(decoding.createDecoder(update))); - let lazyStructDecoders = updateDecoders.map(decoder => new LazyStructReader(decoder, true)); - - /** - * @todo we don't need offset because we always slice before - * @type {null | { struct: Item | GC | Skip, offset: number }} - */ - let currWrite = null; - - const updateEncoder = new YEncoder(); - // write structs lazily - const lazyStructEncoder = new LazyStructWriter(updateEncoder); - - // Note: We need to ensure that all lazyStructDecoders are fully consumed - // Note: Should merge document updates whenever possible - even from different updates - // Note: Should handle that some operations cannot be applied yet () - - while (true) { - // Write higher clients first ⇒ sort by clientID & clock and remove decoders without content - lazyStructDecoders = lazyStructDecoders.filter(dec => dec.curr !== null); - lazyStructDecoders.sort( - /** @type {function(any,any):number} */ (dec1, dec2) => { - if (dec1.curr.id.client === dec2.curr.id.client) { - const clockDiff = dec1.curr.id.clock - dec2.curr.id.clock; - if (clockDiff === 0) { - // @todo remove references to skip since the structDecoders must filter Skips. - return dec1.curr.constructor === dec2.curr.constructor - ? 0 - : dec1.curr.constructor === Skip ? 1 : -1 // we are filtering skips anyway. - } else { - return clockDiff - } - } else { - return dec2.curr.id.client - dec1.curr.id.client - } - } - ); - if (lazyStructDecoders.length === 0) { - break - } - const currDecoder = lazyStructDecoders[0]; - // write from currDecoder until the next operation is from another client or if filler-struct - // then we need to reorder the decoders and find the next operation to write - const firstClient = /** @type {Item | GC} */ (currDecoder.curr).id.client; - - if (currWrite !== null) { - let curr = /** @type {Item | GC | null} */ (currDecoder.curr); - let iterated = false; - - // iterate until we find something that we haven't written already - // remember: first the high client-ids are written - while (curr !== null && curr.id.clock + curr.length <= currWrite.struct.id.clock + currWrite.struct.length && curr.id.client >= currWrite.struct.id.client) { - curr = currDecoder.next(); - iterated = true; - } - if ( - curr === null || // current decoder is empty - curr.id.client !== firstClient || // check whether there is another decoder that has has updates from `firstClient` - (iterated && curr.id.clock > currWrite.struct.id.clock + currWrite.struct.length) // the above while loop was used and we are potentially missing updates - ) { - continue - } - - if (firstClient !== currWrite.struct.id.client) { - writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset); - currWrite = { struct: curr, offset: 0 }; - currDecoder.next(); - } else { - if (currWrite.struct.id.clock + currWrite.struct.length < curr.id.clock) { - // @todo write currStruct & set currStruct = Skip(clock = currStruct.id.clock + currStruct.length, length = curr.id.clock - self.clock) - if (currWrite.struct.constructor === Skip) { - // extend existing skip - currWrite.struct.length = curr.id.clock + curr.length - currWrite.struct.id.clock; - } else { - writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset); - const diff = curr.id.clock - currWrite.struct.id.clock - currWrite.struct.length; - /** - * @type {Skip} - */ - const struct = new Skip(createID(firstClient, currWrite.struct.id.clock + currWrite.struct.length), diff); - currWrite = { struct, offset: 0 }; - } - } else { // if (currWrite.struct.id.clock + currWrite.struct.length >= curr.id.clock) { - const diff = currWrite.struct.id.clock + currWrite.struct.length - curr.id.clock; - if (diff > 0) { - if (currWrite.struct.constructor === Skip) { - // prefer to slice Skip because the other struct might contain more information - currWrite.struct.length -= diff; - } else { - curr = sliceStruct(curr, diff); - } - } - if (!currWrite.struct.mergeWith(/** @type {any} */ (curr))) { - writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset); - currWrite = { struct: curr, offset: 0 }; - currDecoder.next(); - } - } - } - } else { - currWrite = { struct: /** @type {Item | GC} */ (currDecoder.curr), offset: 0 }; - currDecoder.next(); - } - for ( - let next = currDecoder.curr; - next !== null && next.id.client === firstClient && next.id.clock === currWrite.struct.id.clock + currWrite.struct.length && next.constructor !== Skip; - next = currDecoder.next() - ) { - writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset); - currWrite = { struct: next, offset: 0 }; - } - } - if (currWrite !== null) { - writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset); - currWrite = null; - } - finishLazyStructWriting(lazyStructEncoder); - - const dss = updateDecoders.map(decoder => readDeleteSet(decoder)); - const ds = mergeDeleteSets(dss); - writeDeleteSet(updateEncoder, ds); - return updateEncoder.toUint8Array() -}; - -/** - * @param {Uint8Array} update - * @param {Uint8Array} sv - * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder] - * @param {typeof UpdateEncoderV1 | typeof UpdateEncoderV2} [YEncoder] - */ -const diffUpdateV2 = (update, sv, YDecoder = UpdateDecoderV2, YEncoder = UpdateEncoderV2) => { - const state = decodeStateVector(sv); - const encoder = new YEncoder(); - const lazyStructWriter = new LazyStructWriter(encoder); - const decoder = new YDecoder(decoding.createDecoder(update)); - const reader = new LazyStructReader(decoder, false); - while (reader.curr) { - const curr = reader.curr; - const currClient = curr.id.client; - const svClock = state.get(currClient) || 0; - if (reader.curr.constructor === Skip) { - // the first written struct shouldn't be a skip - reader.next(); - continue - } - if (curr.id.clock + curr.length > svClock) { - writeStructToLazyStructWriter(lazyStructWriter, curr, math.max(svClock - curr.id.clock, 0)); - reader.next(); - while (reader.curr && reader.curr.id.client === currClient) { - writeStructToLazyStructWriter(lazyStructWriter, reader.curr, 0); - reader.next(); - } - } else { - // read until something new comes up - while (reader.curr && reader.curr.id.client === currClient && reader.curr.id.clock + reader.curr.length <= svClock) { - reader.next(); - } - } - } - finishLazyStructWriting(lazyStructWriter); - // write ds - const ds = readDeleteSet(decoder); - writeDeleteSet(encoder, ds); - return encoder.toUint8Array() -}; - -/** - * @param {Uint8Array} update - * @param {Uint8Array} sv - */ -const diffUpdate = (update, sv) => diffUpdateV2(update, sv, UpdateDecoderV1, UpdateEncoderV1); - -/** - * @param {LazyStructWriter} lazyWriter - */ -const flushLazyStructWriter = lazyWriter => { - if (lazyWriter.written > 0) { - lazyWriter.clientStructs.push({ written: lazyWriter.written, restEncoder: encoding.toUint8Array(lazyWriter.encoder.restEncoder) }); - lazyWriter.encoder.restEncoder = encoding.createEncoder(); - lazyWriter.written = 0; - } -}; - -/** - * @param {LazyStructWriter} lazyWriter - * @param {Item | GC} struct - * @param {number} offset - */ -const writeStructToLazyStructWriter = (lazyWriter, struct, offset) => { - // flush curr if we start another client - if (lazyWriter.written > 0 && lazyWriter.currClient !== struct.id.client) { - flushLazyStructWriter(lazyWriter); - } - if (lazyWriter.written === 0) { - lazyWriter.currClient = struct.id.client; - // write next client - lazyWriter.encoder.writeClient(struct.id.client); - // write startClock - encoding.writeVarUint(lazyWriter.encoder.restEncoder, struct.id.clock + offset); - } - struct.write(lazyWriter.encoder, offset); - lazyWriter.written++; -}; -/** - * Call this function when we collected all parts and want to - * put all the parts together. After calling this method, - * you can continue using the UpdateEncoder. - * - * @param {LazyStructWriter} lazyWriter - */ -const finishLazyStructWriting = (lazyWriter) => { - flushLazyStructWriter(lazyWriter); - - // this is a fresh encoder because we called flushCurr - const restEncoder = lazyWriter.encoder.restEncoder; - - /** - * Now we put all the fragments together. - * This works similarly to `writeClientsStructs` - */ - - // write # states that were updated - i.e. the clients - encoding.writeVarUint(restEncoder, lazyWriter.clientStructs.length); - - for (let i = 0; i < lazyWriter.clientStructs.length; i++) { - const partStructs = lazyWriter.clientStructs[i]; - /** - * Works similarly to `writeStructs` - */ - // write # encoded structs - encoding.writeVarUint(restEncoder, partStructs.written); - // write the rest of the fragment - encoding.writeUint8Array(restEncoder, partStructs.restEncoder); - } -}; - -/** - * @param {Uint8Array} update - * @param {function(Item|GC|Skip):Item|GC|Skip} blockTransformer - * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} YDecoder - * @param {typeof UpdateEncoderV2 | typeof UpdateEncoderV1 } YEncoder - */ -const convertUpdateFormat = (update, blockTransformer, YDecoder, YEncoder) => { - const updateDecoder = new YDecoder(decoding.createDecoder(update)); - const lazyDecoder = new LazyStructReader(updateDecoder, false); - const updateEncoder = new YEncoder(); - const lazyWriter = new LazyStructWriter(updateEncoder); - for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) { - writeStructToLazyStructWriter(lazyWriter, blockTransformer(curr), 0); - } - finishLazyStructWriting(lazyWriter); - const ds = readDeleteSet(updateDecoder); - writeDeleteSet(updateEncoder, ds); - return updateEncoder.toUint8Array() -}; - -/** - * @typedef {Object} ObfuscatorOptions - * @property {boolean} [ObfuscatorOptions.formatting=true] - * @property {boolean} [ObfuscatorOptions.subdocs=true] - * @property {boolean} [ObfuscatorOptions.yxml=true] Whether to obfuscate nodeName / hookName - */ - -/** - * @param {ObfuscatorOptions} obfuscator - */ -const createObfuscator = ({ formatting = true, subdocs = true, yxml = true } = {}) => { - let i = 0; - const mapKeyCache = map.create(); - const nodeNameCache = map.create(); - const formattingKeyCache = map.create(); - const formattingValueCache = map.create(); - formattingValueCache.set(null, null); // end of a formatting range should always be the end of a formatting range - /** - * @param {Item|GC|Skip} block - * @return {Item|GC|Skip} - */ - return block => { - switch (block.constructor) { - case GC: - case Skip: - return block - case Item: { - const item = /** @type {Item} */ (block); - const content = item.content; - switch (content.constructor) { - case ContentDeleted: - break - case ContentType: { - if (yxml) { - const type = /** @type {ContentType} */ (content).type; - if (type instanceof YXmlElement) { - type.nodeName = map.setIfUndefined(nodeNameCache, type.nodeName, () => 'node-' + i); - } - if (type instanceof YXmlHook) { - type.hookName = map.setIfUndefined(nodeNameCache, type.hookName, () => 'hook-' + i); - } - } - break - } - case ContentAny: { - const c = /** @type {ContentAny} */ (content); - c.arr = c.arr.map(() => i); - break - } - case ContentBinary: { - const c = /** @type {ContentBinary} */ (content); - c.content = new Uint8Array([i]); - break - } - case ContentDoc: { - const c = /** @type {ContentDoc} */ (content); - if (subdocs) { - c.opts = {}; - c.doc.guid = i + ''; - } - break - } - case ContentEmbed: { - const c = /** @type {ContentEmbed} */ (content); - c.embed = {}; - break - } - case ContentFormat: { - const c = /** @type {ContentFormat} */ (content); - if (formatting) { - c.key = map.setIfUndefined(formattingKeyCache, c.key, () => i + ''); - c.value = map.setIfUndefined(formattingValueCache, c.value, () => ({ i })); - } - break - } - case ContentJSON: { - const c = /** @type {ContentJSON} */ (content); - c.arr = c.arr.map(() => i); - break - } - case ContentString: { - const c = /** @type {ContentString} */ (content); - c.str = string.repeat((i % 10) + '', c.str.length); - break - } - default: - // unknown content type - error.unexpectedCase(); - } - if (item.parentSub) { - item.parentSub = map.setIfUndefined(mapKeyCache, item.parentSub, () => i + ''); - } - i++; - return block - } - default: - // unknown block-type - error.unexpectedCase(); - } - } -}; - -/** - * This function obfuscates the content of a Yjs update. This is useful to share - * buggy Yjs documents while significantly limiting the possibility that a - * developer can on the user. Note that it might still be possible to deduce - * some information by analyzing the "structure" of the document or by analyzing - * the typing behavior using the CRDT-related metadata that is still kept fully - * intact. - * - * @param {Uint8Array} update - * @param {ObfuscatorOptions} [opts] - */ -const obfuscateUpdate = (update, opts) => convertUpdateFormat(update, createObfuscator(opts), UpdateDecoderV1, UpdateEncoderV1); - -/** - * @param {Uint8Array} update - * @param {ObfuscatorOptions} [opts] - */ -const obfuscateUpdateV2 = (update, opts) => convertUpdateFormat(update, createObfuscator(opts), UpdateDecoderV2, UpdateEncoderV2); - -/** - * @param {Uint8Array} update - */ -const convertUpdateFormatV1ToV2 = update => convertUpdateFormat(update, f.id, UpdateDecoderV1, UpdateEncoderV2); - -/** - * @param {Uint8Array} update - */ -const convertUpdateFormatV2ToV1 = update => convertUpdateFormat(update, f.id, UpdateDecoderV2, UpdateEncoderV1); - -const errorComputeChanges = 'You must not compute changes after the event-handler fired.'; - -/** - * @template {AbstractType} T - * YEvent describes the changes on a YType. - */ -class YEvent { - /** - * @param {T} target The changed type. - * @param {Transaction} transaction - */ - constructor (target, transaction) { - /** - * The type on which this event was created on. - * @type {T} - */ - this.target = target; - /** - * The current target on which the observe callback is called. - * @type {AbstractType} - */ - this.currentTarget = target; - /** - * The transaction that triggered this event. - * @type {Transaction} - */ - this.transaction = transaction; - /** - * @type {Object|null} - */ - this._changes = null; - /** - * @type {null | Map} - */ - this._keys = null; - /** - * @type {null | Array<{ insert?: string | Array | object | AbstractType, retain?: number, delete?: number, attributes?: Object }>} - */ - this._delta = null; - /** - * @type {Array|null} - */ - this._path = null; - } - - /** - * Computes the path from `y` to the changed type. - * - * @todo v14 should standardize on path: Array<{parent, index}> because that is easier to work with. - * - * The following property holds: - * @example - * let type = y - * event.path.forEach(dir => { - * type = type.get(dir) - * }) - * type === event.target // => true - */ - get path () { - return this._path || (this._path = getPathTo(this.currentTarget, this.target)) - } - - /** - * Check if a struct is deleted by this event. - * - * In contrast to change.deleted, this method also returns true if the struct was added and then deleted. - * - * @param {AbstractStruct} struct - * @return {boolean} - */ - deletes (struct) { - return isDeleted(this.transaction.deleteSet, struct.id) - } - - /** - * @type {Map} - */ - get keys () { - if (this._keys === null) { - if (this.transaction.doc._transactionCleanups.length === 0) { - throw error.create(errorComputeChanges) - } - const keys = new Map(); - const target = this.target; - const changed = /** @type Set */ (this.transaction.changed.get(target)); - changed.forEach(key => { - if (key !== null) { - const item = /** @type {Item} */ (target._map.get(key)); - /** - * @type {'delete' | 'add' | 'update'} - */ - let action; - let oldValue; - if (this.adds(item)) { - let prev = item.left; - while (prev !== null && this.adds(prev)) { - prev = prev.left; - } - if (this.deletes(item)) { - if (prev !== null && this.deletes(prev)) { - action = 'delete'; - oldValue = array.last(prev.content.getContent()); - } else { - return - } - } else { - if (prev !== null && this.deletes(prev)) { - action = 'update'; - oldValue = array.last(prev.content.getContent()); - } else { - action = 'add'; - oldValue = undefined; - } - } - } else { - if (this.deletes(item)) { - action = 'delete'; - oldValue = array.last(/** @type {Item} */ item.content.getContent()); - } else { - return // nop - } - } - keys.set(key, { action, oldValue }); - } - }); - this._keys = keys; - } - return this._keys - } - - /** - * This is a computed property. Note that this can only be safely computed during the - * event call. Computing this property after other changes happened might result in - * unexpected behavior (incorrect computation of deltas). A safe way to collect changes - * is to store the `changes` or the `delta` object. Avoid storing the `transaction` object. - * - * @type {Array<{insert?: string | Array | object | AbstractType, retain?: number, delete?: number, attributes?: Object}>} - */ - get delta () { - return this.changes.delta - } - - /** - * Check if a struct is added by this event. - * - * In contrast to change.deleted, this method also returns true if the struct was added and then deleted. - * - * @param {AbstractStruct} struct - * @return {boolean} - */ - adds (struct) { - return struct.id.clock >= (this.transaction.beforeState.get(struct.id.client) || 0) - } - - /** - * This is a computed property. Note that this can only be safely computed during the - * event call. Computing this property after other changes happened might result in - * unexpected behavior (incorrect computation of deltas). A safe way to collect changes - * is to store the `changes` or the `delta` object. Avoid storing the `transaction` object. - * - * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string, delete?:number, retain?:number}>}} - */ - get changes () { - let changes = this._changes; - if (changes === null) { - if (this.transaction.doc._transactionCleanups.length === 0) { - throw error.create(errorComputeChanges) - } - const target = this.target; - const added = set.create(); - const deleted = set.create(); - /** - * @type {Array<{insert:Array}|{delete:number}|{retain:number}>} - */ - const delta = []; - changes = { - added, - deleted, - delta, - keys: this.keys - }; - const changed = /** @type Set */ (this.transaction.changed.get(target)); - if (changed.has(null)) { - /** - * @type {any} - */ - let lastOp = null; - const packOp = () => { - if (lastOp) { - delta.push(lastOp); - } - }; - for (let item = target._start; item !== null; item = item.right) { - if (item.deleted) { - if (this.deletes(item) && !this.adds(item)) { - if (lastOp === null || lastOp.delete === undefined) { - packOp(); - lastOp = { delete: 0 }; - } - lastOp.delete += item.length; - deleted.add(item); - } // else nop - } else { - if (this.adds(item)) { - if (lastOp === null || lastOp.insert === undefined) { - packOp(); - lastOp = { insert: [] }; - } - lastOp.insert = lastOp.insert.concat(item.content.getContent()); - added.add(item); - } else { - if (lastOp === null || lastOp.retain === undefined) { - packOp(); - lastOp = { retain: 0 }; - } - lastOp.retain += item.length; - } - } - } - if (lastOp !== null && lastOp.retain === undefined) { - packOp(); - } - } - this._changes = changes; - } - return /** @type {any} */ (changes) - } -} - -/** - * Compute the path from this type to the specified target. - * - * @example - * // `child` should be accessible via `type.get(path[0]).get(path[1])..` - * const path = type.getPathTo(child) - * // assuming `type instanceof YArray` - * console.log(path) // might look like => [2, 'key1'] - * child === type.get(path[0]).get(path[1]) - * - * @param {AbstractType} parent - * @param {AbstractType} child target - * @return {Array} Path to the target - * - * @private - * @function - */ -const getPathTo = (parent, child) => { - const path = []; - while (child._item !== null && child !== parent) { - if (child._item.parentSub !== null) { - // parent is map-ish - path.unshift(child._item.parentSub); - } else { - // parent is array-ish - let i = 0; - let c = /** @type {AbstractType} */ (child._item.parent)._start; - while (c !== child._item && c !== null) { - if (!c.deleted && c.countable) { - i += c.length; - } - c = c.right; - } - path.unshift(i); - } - child = /** @type {AbstractType} */ (child._item.parent); - } - return path -}; - -/** - * https://docs.yjs.dev/getting-started/working-with-shared-types#caveats - */ -const warnPrematureAccess = () => { logging.warn('Invalid access: Add Yjs type to a document before reading data.'); }; - -const maxSearchMarker = 80; - -/** - * A unique timestamp that identifies each marker. - * - * Time is relative,.. this is more like an ever-increasing clock. - * - * @type {number} - */ -let globalSearchMarkerTimestamp = 0; - -class ArraySearchMarker { - /** - * @param {Item} p - * @param {number} index - */ - constructor (p, index) { - p.marker = true; - this.p = p; - this.index = index; - this.timestamp = globalSearchMarkerTimestamp++; - } -} - -/** - * @param {ArraySearchMarker} marker - */ -const refreshMarkerTimestamp = marker => { marker.timestamp = globalSearchMarkerTimestamp++; }; - -/** - * This is rather complex so this function is the only thing that should overwrite a marker - * - * @param {ArraySearchMarker} marker - * @param {Item} p - * @param {number} index - */ -const overwriteMarker = (marker, p, index) => { - marker.p.marker = false; - marker.p = p; - p.marker = true; - marker.index = index; - marker.timestamp = globalSearchMarkerTimestamp++; -}; - -/** - * @param {Array} searchMarker - * @param {Item} p - * @param {number} index - */ -const markPosition = (searchMarker, p, index) => { - if (searchMarker.length >= maxSearchMarker) { - // override oldest marker (we don't want to create more objects) - const marker = searchMarker.reduce((a, b) => a.timestamp < b.timestamp ? a : b); - overwriteMarker(marker, p, index); - return marker - } else { - // create new marker - const pm = new ArraySearchMarker(p, index); - searchMarker.push(pm); - return pm - } -}; - -/** - * Search marker help us to find positions in the associative array faster. - * - * They speed up the process of finding a position without much bookkeeping. - * - * A maximum of `maxSearchMarker` objects are created. - * - * This function always returns a refreshed marker (updated timestamp) - * - * @param {AbstractType} yarray - * @param {number} index - */ -const findMarker = (yarray, index) => { - if (yarray._start === null || index === 0 || yarray._searchMarker === null) { - return null - } - const marker = yarray._searchMarker.length === 0 ? null : yarray._searchMarker.reduce((a, b) => math.abs(index - a.index) < math.abs(index - b.index) ? a : b); - let p = yarray._start; - let pindex = 0; - if (marker !== null) { - p = marker.p; - pindex = marker.index; - refreshMarkerTimestamp(marker); // we used it, we might need to use it again - } - // iterate to right if possible - while (p.right !== null && pindex < index) { - if (!p.deleted && p.countable) { - if (index < pindex + p.length) { - break - } - pindex += p.length; - } - p = p.right; - } - // iterate to left if necessary (might be that pindex > index) - while (p.left !== null && pindex > index) { - p = p.left; - if (!p.deleted && p.countable) { - pindex -= p.length; - } - } - // we want to make sure that p can't be merged with left, because that would screw up everything - // in that cas just return what we have (it is most likely the best marker anyway) - // iterate to left until p can't be merged with left - while (p.left !== null && p.left.id.client === p.id.client && p.left.id.clock + p.left.length === p.id.clock) { - p = p.left; - if (!p.deleted && p.countable) { - pindex -= p.length; - } - } - - // @todo remove! - // assure position - // { - // let start = yarray._start - // let pos = 0 - // while (start !== p) { - // if (!start.deleted && start.countable) { - // pos += start.length - // } - // start = /** @type {Item} */ (start.right) - // } - // if (pos !== pindex) { - // debugger - // throw new Error('Gotcha position fail!') - // } - // } - // if (marker) { - // if (window.lengths == null) { - // window.lengths = [] - // window.getLengths = () => window.lengths.sort((a, b) => a - b) - // } - // window.lengths.push(marker.index - pindex) - // console.log('distance', marker.index - pindex, 'len', p && p.parent.length) - // } - if (marker !== null && math.abs(marker.index - pindex) < /** @type {YText|YArray} */ (p.parent).length / maxSearchMarker) { - // adjust existing marker - overwriteMarker(marker, p, pindex); - return marker - } else { - // create new marker - return markPosition(yarray._searchMarker, p, pindex) - } -}; - -/** - * Update markers when a change happened. - * - * This should be called before doing a deletion! - * - * @param {Array} searchMarker - * @param {number} index - * @param {number} len If insertion, len is positive. If deletion, len is negative. - */ -const updateMarkerChanges = (searchMarker, index, len) => { - for (let i = searchMarker.length - 1; i >= 0; i--) { - const m = searchMarker[i]; - if (len > 0) { - /** - * @type {Item|null} - */ - let p = m.p; - p.marker = false; - // Ideally we just want to do a simple position comparison, but this will only work if - // search markers don't point to deleted items for formats. - // Iterate marker to prev undeleted countable position so we know what to do when updating a position - while (p && (p.deleted || !p.countable)) { - p = p.left; - if (p && !p.deleted && p.countable) { - // adjust position. the loop should break now - m.index -= p.length; - } - } - if (p === null || p.marker === true) { - // remove search marker if updated position is null or if position is already marked - searchMarker.splice(i, 1); - continue - } - m.p = p; - p.marker = true; - } - if (index < m.index || (len > 0 && index === m.index)) { // a simple index <= m.index check would actually suffice - m.index = math.max(index, m.index + len); - } - } -}; - -/** - * Accumulate all (list) children of a type and return them as an Array. - * - * @param {AbstractType} t - * @return {Array} - */ -const getTypeChildren = t => { - t.doc ?? warnPrematureAccess(); - let s = t._start; - const arr = []; - while (s) { - arr.push(s); - s = s.right; - } - return arr -}; - -/** - * Call event listeners with an event. This will also add an event to all - * parents (for `.observeDeep` handlers). - * - * @template EventType - * @param {AbstractType} type - * @param {Transaction} transaction - * @param {EventType} event - */ -const callTypeObservers = (type, transaction, event) => { - const changedType = type; - const changedParentTypes = transaction.changedParentTypes; - while (true) { - // @ts-ignore - map.setIfUndefined(changedParentTypes, type, () => []).push(event); - if (type._item === null) { - break - } - type = /** @type {AbstractType} */ (type._item.parent); - } - callEventHandlerListeners(changedType._eH, event, transaction); -}; - -/** - * @template EventType - * Abstract Yjs Type class - */ -class AbstractType { - constructor () { - /** - * @type {Item|null} - */ - this._item = null; - /** - * @type {Map} - */ - this._map = new Map(); - /** - * @type {Item|null} - */ - this._start = null; - /** - * @type {Doc|null} - */ - this.doc = null; - this._length = 0; - /** - * Event handlers - * @type {EventHandler} - */ - this._eH = createEventHandler(); - /** - * Deep event handlers - * @type {EventHandler>,Transaction>} - */ - this._dEH = createEventHandler(); - /** - * @type {null | Array} - */ - this._searchMarker = null; - } - - /** - * @return {AbstractType|null} - */ - get parent () { - return this._item ? /** @type {AbstractType} */ (this._item.parent) : null - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item|null} item - */ - _integrate (y, item) { - this.doc = y; - this._item = item; - } - - /** - * @return {AbstractType} - */ - _copy () { - throw error.methodUnimplemented() - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {AbstractType} - */ - clone () { - throw error.methodUnimplemented() - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} _encoder - */ - _write (_encoder) { } - - /** - * The first non-deleted item - */ - get _first () { - let n = this._start; - while (n !== null && n.deleted) { - n = n.right; - } - return n - } - - /** - * Creates YEvent and calls all type observers. - * Must be implemented by each type. - * - * @param {Transaction} transaction - * @param {Set} _parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, _parentSubs) { - if (!transaction.local && this._searchMarker) { - this._searchMarker.length = 0; - } - } - - /** - * Observe all events that are created on this type. - * - * @param {function(EventType, Transaction):void} f Observer function - */ - observe (f) { - addEventHandlerListener(this._eH, f); - } - - /** - * Observe all events that are created by this type and its children. - * - * @param {function(Array>,Transaction):void} f Observer function - */ - observeDeep (f) { - addEventHandlerListener(this._dEH, f); - } - - /** - * Unregister an observer function. - * - * @param {function(EventType,Transaction):void} f Observer function - */ - unobserve (f) { - removeEventHandlerListener(this._eH, f); - } - - /** - * Unregister an observer function. - * - * @param {function(Array>,Transaction):void} f Observer function - */ - unobserveDeep (f) { - removeEventHandlerListener(this._dEH, f); - } - - /** - * @abstract - * @return {any} - */ - toJSON () {} -} - -/** - * @param {AbstractType} type - * @param {number} start - * @param {number} end - * @return {Array} - * - * @private - * @function - */ -const typeListSlice = (type, start, end) => { - type.doc ?? warnPrematureAccess(); - if (start < 0) { - start = type._length + start; - } - if (end < 0) { - end = type._length + end; - } - let len = end - start; - const cs = []; - let n = type._start; - while (n !== null && len > 0) { - if (n.countable && !n.deleted) { - const c = n.content.getContent(); - if (c.length <= start) { - start -= c.length; - } else { - for (let i = start; i < c.length && len > 0; i++) { - cs.push(c[i]); - len--; - } - start = 0; - } - } - n = n.right; - } - return cs -}; - -/** - * @param {AbstractType} type - * @return {Array} - * - * @private - * @function - */ -const typeListToArray = type => { - type.doc ?? warnPrematureAccess(); - const cs = []; - let n = type._start; - while (n !== null) { - if (n.countable && !n.deleted) { - const c = n.content.getContent(); - for (let i = 0; i < c.length; i++) { - cs.push(c[i]); - } - } - n = n.right; - } - return cs -}; - -/** - * @param {AbstractType} type - * @param {Snapshot} snapshot - * @return {Array} - * - * @private - * @function - */ -const typeListToArraySnapshot = (type, snapshot) => { - const cs = []; - let n = type._start; - while (n !== null) { - if (n.countable && isVisible(n, snapshot)) { - const c = n.content.getContent(); - for (let i = 0; i < c.length; i++) { - cs.push(c[i]); - } - } - n = n.right; - } - return cs -}; - -/** - * Executes a provided function on once on every element of this YArray. - * - * @param {AbstractType} type - * @param {function(any,number,any):void} f A function to execute on every element of this YArray. - * - * @private - * @function - */ -const typeListForEach = (type, f) => { - let index = 0; - let n = type._start; - type.doc ?? warnPrematureAccess(); - while (n !== null) { - if (n.countable && !n.deleted) { - const c = n.content.getContent(); - for (let i = 0; i < c.length; i++) { - f(c[i], index++, type); - } - } - n = n.right; - } -}; - -/** - * @template C,R - * @param {AbstractType} type - * @param {function(C,number,AbstractType):R} f - * @return {Array} - * - * @private - * @function - */ -const typeListMap = (type, f) => { - /** - * @type {Array} - */ - const result = []; - typeListForEach(type, (c, i) => { - result.push(f(c, i, type)); - }); - return result -}; - -/** - * @param {AbstractType} type - * @return {IterableIterator} - * - * @private - * @function - */ -const typeListCreateIterator = type => { - let n = type._start; - /** - * @type {Array|null} - */ - let currentContent = null; - let currentContentIndex = 0; - return { - [Symbol.iterator] () { - return this - }, - next: () => { - // find some content - if (currentContent === null) { - while (n !== null && n.deleted) { - n = n.right; - } - // check if we reached the end, no need to check currentContent, because it does not exist - if (n === null) { - return { - done: true, - value: undefined - } - } - // we found n, so we can set currentContent - currentContent = n.content.getContent(); - currentContentIndex = 0; - n = n.right; // we used the content of n, now iterate to next - } - const value = currentContent[currentContentIndex++]; - // check if we need to empty currentContent - if (currentContent.length <= currentContentIndex) { - currentContent = null; - } - return { - done: false, - value - } - } - } -}; - -/** - * @param {AbstractType} type - * @param {number} index - * @return {any} - * - * @private - * @function - */ -const typeListGet = (type, index) => { - type.doc ?? warnPrematureAccess(); - const marker = findMarker(type, index); - let n = type._start; - if (marker !== null) { - n = marker.p; - index -= marker.index; - } - for (; n !== null; n = n.right) { - if (!n.deleted && n.countable) { - if (index < n.length) { - return n.content.getContent()[index] - } - index -= n.length; - } - } -}; - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {Item?} referenceItem - * @param {Array|Array|boolean|number|null|string|Uint8Array>} content - * - * @private - * @function - */ -const typeListInsertGenericsAfter = (transaction, parent, referenceItem, content) => { - let left = referenceItem; - const doc = transaction.doc; - const ownClientId = doc.clientID; - const store = doc.store; - const right = referenceItem === null ? parent._start : referenceItem.right; - /** - * @type {Array|number|null>} - */ - let jsonContent = []; - const packJsonContent = () => { - if (jsonContent.length > 0) { - left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentAny(jsonContent)); - left.integrate(transaction, 0); - jsonContent = []; - } - }; - content.forEach(c => { - if (c === null) { - jsonContent.push(c); - } else { - switch (c.constructor) { - case Number: - case Object: - case Boolean: - case Array: - case String: - jsonContent.push(c); - break - default: - packJsonContent(); - switch (c.constructor) { - case Uint8Array: - case ArrayBuffer: - left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentBinary(new Uint8Array(/** @type {Uint8Array} */ (c)))); - left.integrate(transaction, 0); - break - case Doc: - left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentDoc(/** @type {Doc} */ (c))); - left.integrate(transaction, 0); - break - default: - if (c instanceof AbstractType) { - left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentType(c)); - left.integrate(transaction, 0); - } else { - throw new Error('Unexpected content type in insert operation') - } - } - } - } - }); - packJsonContent(); -}; - -const lengthExceeded = () => error.create('Length exceeded!'); - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {number} index - * @param {Array|Array|number|null|string|Uint8Array>} content - * - * @private - * @function - */ -const typeListInsertGenerics = (transaction, parent, index, content) => { - if (index > parent._length) { - throw lengthExceeded() - } - if (index === 0) { - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, index, content.length); - } - return typeListInsertGenericsAfter(transaction, parent, null, content) - } - const startIndex = index; - const marker = findMarker(parent, index); - let n = parent._start; - if (marker !== null) { - n = marker.p; - index -= marker.index; - // we need to iterate one to the left so that the algorithm works - if (index === 0) { - // @todo refactor this as it actually doesn't consider formats - n = n.prev; // important! get the left undeleted item so that we can actually decrease index - index += (n && n.countable && !n.deleted) ? n.length : 0; - } - } - for (; n !== null; n = n.right) { - if (!n.deleted && n.countable) { - if (index <= n.length) { - if (index < n.length) { - // insert in-between - getItemCleanStart(transaction, createID(n.id.client, n.id.clock + index)); - } - break - } - index -= n.length; - } - } - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, startIndex, content.length); - } - return typeListInsertGenericsAfter(transaction, parent, n, content) -}; - -/** - * Pushing content is special as we generally want to push after the last item. So we don't have to update - * the search marker. - * - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {Array|Array|number|null|string|Uint8Array>} content - * - * @private - * @function - */ -const typeListPushGenerics = (transaction, parent, content) => { - // Use the marker with the highest index and iterate to the right. - const marker = (parent._searchMarker || []).reduce((maxMarker, currMarker) => currMarker.index > maxMarker.index ? currMarker : maxMarker, { index: 0, p: parent._start }); - let n = marker.p; - if (n) { - while (n.right) { - n = n.right; - } - } - return typeListInsertGenericsAfter(transaction, parent, n, content) -}; - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {number} index - * @param {number} length - * - * @private - * @function - */ -const typeListDelete = (transaction, parent, index, length) => { - if (length === 0) { return } - const startIndex = index; - const startLength = length; - const marker = findMarker(parent, index); - let n = parent._start; - if (marker !== null) { - n = marker.p; - index -= marker.index; - } - // compute the first item to be deleted - for (; n !== null && index > 0; n = n.right) { - if (!n.deleted && n.countable) { - if (index < n.length) { - getItemCleanStart(transaction, createID(n.id.client, n.id.clock + index)); - } - index -= n.length; - } - } - // delete all items until done - while (length > 0 && n !== null) { - if (!n.deleted) { - if (length < n.length) { - getItemCleanStart(transaction, createID(n.id.client, n.id.clock + length)); - } - n.delete(transaction); - length -= n.length; - } - n = n.right; - } - if (length > 0) { - throw lengthExceeded() - } - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, startIndex, -startLength + length /* in case we remove the above exception */); - } -}; - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {string} key - * - * @private - * @function - */ -const typeMapDelete = (transaction, parent, key) => { - const c = parent._map.get(key); - if (c !== undefined) { - c.delete(transaction); - } -}; - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {string} key - * @param {Object|number|null|Array|string|Uint8Array|AbstractType} value - * - * @private - * @function - */ -const typeMapSet = (transaction, parent, key, value) => { - const left = parent._map.get(key) || null; - const doc = transaction.doc; - const ownClientId = doc.clientID; - let content; - if (value == null) { - content = new ContentAny([value]); - } else { - switch (value.constructor) { - case Number: - case Object: - case Boolean: - case Array: - case String: - case Date: - case BigInt: - content = new ContentAny([value]); - break - case Uint8Array: - content = new ContentBinary(/** @type {Uint8Array} */ (value)); - break - case Doc: - content = new ContentDoc(/** @type {Doc} */ (value)); - break - default: - if (value instanceof AbstractType) { - content = new ContentType(value); - } else { - throw new Error('Unexpected content type') - } - } - } - new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, null, null, parent, key, content).integrate(transaction, 0); -}; - -/** - * @param {AbstractType} parent - * @param {string} key - * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined} - * - * @private - * @function - */ -const typeMapGet = (parent, key) => { - parent.doc ?? warnPrematureAccess(); - const val = parent._map.get(key); - return val !== undefined && !val.deleted ? val.content.getContent()[val.length - 1] : undefined -}; - -/** - * @param {AbstractType} parent - * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined>} - * - * @private - * @function - */ -const typeMapGetAll = (parent) => { - /** - * @type {Object} - */ - const res = {}; - parent.doc ?? warnPrematureAccess(); - parent._map.forEach((value, key) => { - if (!value.deleted) { - res[key] = value.content.getContent()[value.length - 1]; - } - }); - return res -}; - -/** - * @param {AbstractType} parent - * @param {string} key - * @return {boolean} - * - * @private - * @function - */ -const typeMapHas = (parent, key) => { - parent.doc ?? warnPrematureAccess(); - const val = parent._map.get(key); - return val !== undefined && !val.deleted -}; - -/** - * @param {AbstractType} parent - * @param {string} key - * @param {Snapshot} snapshot - * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined} - * - * @private - * @function - */ -const typeMapGetSnapshot = (parent, key, snapshot) => { - let v = parent._map.get(key) || null; - while (v !== null && (!snapshot.sv.has(v.id.client) || v.id.clock >= (snapshot.sv.get(v.id.client) || 0))) { - v = v.left; - } - return v !== null && isVisible(v, snapshot) ? v.content.getContent()[v.length - 1] : undefined -}; - -/** - * @param {AbstractType} parent - * @param {Snapshot} snapshot - * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined>} - * - * @private - * @function - */ -const typeMapGetAllSnapshot = (parent, snapshot) => { - /** - * @type {Object} - */ - const res = {}; - parent._map.forEach((value, key) => { - /** - * @type {Item|null} - */ - let v = value; - while (v !== null && (!snapshot.sv.has(v.id.client) || v.id.clock >= (snapshot.sv.get(v.id.client) || 0))) { - v = v.left; - } - if (v !== null && isVisible(v, snapshot)) { - res[key] = v.content.getContent()[v.length - 1]; - } - }); - return res -}; - -/** - * @param {AbstractType & { _map: Map }} type - * @return {IterableIterator>} - * - * @private - * @function - */ -const createMapIterator = type => { - type.doc ?? warnPrematureAccess(); - return iterator.iteratorFilter(type._map.entries(), /** @param {any} entry */ entry => !entry[1].deleted) -}; - -/** - * @module YArray - */ - - -/** - * Event that describes the changes on a YArray - * @template T - * @extends YEvent> - */ -class YArrayEvent extends YEvent {} - -/** - * A shared Array implementation. - * @template T - * @extends AbstractType> - * @implements {Iterable} - */ -class YArray extends AbstractType { - constructor () { - super(); - /** - * @type {Array?} - * @private - */ - this._prelimContent = []; - /** - * @type {Array} - */ - this._searchMarker = []; - } - - /** - * Construct a new YArray containing the specified items. - * @template {Object|Array|number|null|string|Uint8Array} T - * @param {Array} items - * @return {YArray} - */ - static from (items) { - /** - * @type {YArray} - */ - const a = new YArray(); - a.push(items); - return a - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item); - this.insert(0, /** @type {Array} */ (this._prelimContent)); - this._prelimContent = null; - } - - /** - * @return {YArray} - */ - _copy () { - return new YArray() - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YArray} - */ - clone () { - /** - * @type {YArray} - */ - const arr = new YArray(); - arr.insert(0, this.toArray().map(el => - el instanceof AbstractType ? /** @type {typeof el} */ (el.clone()) : el - )); - return arr - } - - get length () { - this.doc ?? warnPrematureAccess(); - return this._length - } - - /** - * Creates YArrayEvent and calls observers. - * - * @param {Transaction} transaction - * @param {Set} parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, parentSubs) { - super._callObserver(transaction, parentSubs); - callTypeObservers(this, transaction, new YArrayEvent(this, transaction)); - } - - /** - * Inserts new content at an index. - * - * Important: This function expects an array of content. Not just a content - * object. The reason for this "weirdness" is that inserting several elements - * is very efficient when it is done as a single operation. - * - * @example - * // Insert character 'a' at position 0 - * yarray.insert(0, ['a']) - * // Insert numbers 1, 2 at position 1 - * yarray.insert(1, [1, 2]) - * - * @param {number} index The index to insert content at. - * @param {Array} content The array of content - */ - insert (index, content) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListInsertGenerics(transaction, this, index, /** @type {any} */ (content)); - }); - } else { - /** @type {Array} */ (this._prelimContent).splice(index, 0, ...content); - } - } - - /** - * Appends content to this YArray. - * - * @param {Array} content Array of content to append. - * - * @todo Use the following implementation in all types. - */ - push (content) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListPushGenerics(transaction, this, /** @type {any} */ (content)); - }); - } else { - /** @type {Array} */ (this._prelimContent).push(...content); - } - } - - /** - * Prepends content to this YArray. - * - * @param {Array} content Array of content to prepend. - */ - unshift (content) { - this.insert(0, content); - } - - /** - * Deletes elements starting from an index. - * - * @param {number} index Index at which to start deleting elements - * @param {number} length The number of elements to remove. Defaults to 1. - */ - delete (index, length = 1) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListDelete(transaction, this, index, length); - }); - } else { - /** @type {Array} */ (this._prelimContent).splice(index, length); - } - } - - /** - * Returns the i-th element from a YArray. - * - * @param {number} index The index of the element to return from the YArray - * @return {T} - */ - get (index) { - return typeListGet(this, index) - } - - /** - * Transforms this YArray to a JavaScript Array. - * - * @return {Array} - */ - toArray () { - return typeListToArray(this) - } - - /** - * Returns a portion of this YArray into a JavaScript Array selected - * from start to end (end not included). - * - * @param {number} [start] - * @param {number} [end] - * @return {Array} - */ - slice (start = 0, end = this.length) { - return typeListSlice(this, start, end) - } - - /** - * Transforms this Shared Type to a JSON object. - * - * @return {Array} - */ - toJSON () { - return this.map(c => c instanceof AbstractType ? c.toJSON() : c) - } - - /** - * Returns an Array with the result of calling a provided function on every - * element of this YArray. - * - * @template M - * @param {function(T,number,YArray):M} f Function that produces an element of the new Array - * @return {Array} A new array with each element being the result of the - * callback function - */ - map (f) { - return typeListMap(this, /** @type {any} */ (f)) - } - - /** - * Executes a provided function once on every element of this YArray. - * - * @param {function(T,number,YArray):void} f A function to execute on every element of this YArray. - */ - forEach (f) { - typeListForEach(this, f); - } - - /** - * @return {IterableIterator} - */ - [Symbol.iterator] () { - return typeListCreateIterator(this) - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - */ - _write (encoder) { - encoder.writeTypeRef(YArrayRefID); - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder - * - * @private - * @function - */ -const readYArray = _decoder => new YArray(); - -/** - * @module YMap - */ - - -/** - * @template T - * @extends YEvent> - * Event that describes the changes on a YMap. - */ -class YMapEvent extends YEvent { - /** - * @param {YMap} ymap The YArray that changed. - * @param {Transaction} transaction - * @param {Set} subs The keys that changed. - */ - constructor (ymap, transaction, subs) { - super(ymap, transaction); - this.keysChanged = subs; - } -} - -/** - * @template MapType - * A shared Map implementation. - * - * @extends AbstractType> - * @implements {Iterable<[string, MapType]>} - */ -class YMap extends AbstractType { - /** - * - * @param {Iterable=} entries - an optional iterable to initialize the YMap - */ - constructor (entries) { - super(); - /** - * @type {Map?} - * @private - */ - this._prelimContent = null; - - if (entries === undefined) { - this._prelimContent = new Map(); - } else { - this._prelimContent = new Map(entries); - } - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item) - ;/** @type {Map} */ (this._prelimContent).forEach((value, key) => { - this.set(key, value); - }); - this._prelimContent = null; - } - - /** - * @return {YMap} - */ - _copy () { - return new YMap() - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YMap} - */ - clone () { - /** - * @type {YMap} - */ - const map = new YMap(); - this.forEach((value, key) => { - map.set(key, value instanceof AbstractType ? /** @type {typeof value} */ (value.clone()) : value); - }); - return map - } - - /** - * Creates YMapEvent and calls observers. - * - * @param {Transaction} transaction - * @param {Set} parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, parentSubs) { - callTypeObservers(this, transaction, new YMapEvent(this, transaction, parentSubs)); - } - - /** - * Transforms this Shared Type to a JSON object. - * - * @return {Object} - */ - toJSON () { - this.doc ?? warnPrematureAccess(); - /** - * @type {Object} - */ - const map = {}; - this._map.forEach((item, key) => { - if (!item.deleted) { - const v = item.content.getContent()[item.length - 1]; - map[key] = v instanceof AbstractType ? v.toJSON() : v; - } - }); - return map - } - - /** - * Returns the size of the YMap (count of key/value pairs) - * - * @return {number} - */ - get size () { - return [...createMapIterator(this)].length - } - - /** - * Returns the keys for each element in the YMap Type. - * - * @return {IterableIterator} - */ - keys () { - return iterator.iteratorMap(createMapIterator(this), /** @param {any} v */ v => v[0]) - } - - /** - * Returns the values for each element in the YMap Type. - * - * @return {IterableIterator} - */ - values () { - return iterator.iteratorMap(createMapIterator(this), /** @param {any} v */ v => v[1].content.getContent()[v[1].length - 1]) - } - - /** - * Returns an Iterator of [key, value] pairs - * - * @return {IterableIterator<[string, MapType]>} - */ - entries () { - return iterator.iteratorMap(createMapIterator(this), /** @param {any} v */ v => /** @type {any} */ ([v[0], v[1].content.getContent()[v[1].length - 1]])) - } - - /** - * Executes a provided function on once on every key-value pair. - * - * @param {function(MapType,string,YMap):void} f A function to execute on every element of this YArray. - */ - forEach (f) { - this.doc ?? warnPrematureAccess(); - this._map.forEach((item, key) => { - if (!item.deleted) { - f(item.content.getContent()[item.length - 1], key, this); - } - }); - } - - /** - * Returns an Iterator of [key, value] pairs - * - * @return {IterableIterator<[string, MapType]>} - */ - [Symbol.iterator] () { - return this.entries() - } - - /** - * Remove a specified element from this YMap. - * - * @param {string} key The key of the element to remove. - */ - delete (key) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapDelete(transaction, this, key); - }); - } else { - /** @type {Map} */ (this._prelimContent).delete(key); - } - } - - /** - * Adds or updates an element with a specified key and value. - * @template {MapType} VAL - * - * @param {string} key The key of the element to add to this YMap - * @param {VAL} value The value of the element to add - * @return {VAL} - */ - set (key, value) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapSet(transaction, this, key, /** @type {any} */ (value)); - }); - } else { - /** @type {Map} */ (this._prelimContent).set(key, value); - } - return value - } - - /** - * Returns a specified element from this YMap. - * - * @param {string} key - * @return {MapType|undefined} - */ - get (key) { - return /** @type {any} */ (typeMapGet(this, key)) - } - - /** - * Returns a boolean indicating whether the specified key exists or not. - * - * @param {string} key The key to test. - * @return {boolean} - */ - has (key) { - return typeMapHas(this, key) - } - - /** - * Removes all elements from this YMap. - */ - clear () { - if (this.doc !== null) { - transact(this.doc, transaction => { - this.forEach(function (_value, key, map) { - typeMapDelete(transaction, map, key); - }); - }); - } else { - /** @type {Map} */ (this._prelimContent).clear(); - } - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - */ - _write (encoder) { - encoder.writeTypeRef(YMapRefID); - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder - * - * @private - * @function - */ -const readYMap = _decoder => new YMap(); - -/** - * @module YText - */ - - -/** - * @param {any} a - * @param {any} b - * @return {boolean} - */ -const equalAttrs = (a, b) => a === b || (typeof a === 'object' && typeof b === 'object' && a && b && object.equalFlat(a, b)); - -class ItemTextListPosition { - /** - * @param {Item|null} left - * @param {Item|null} right - * @param {number} index - * @param {Map} currentAttributes - */ - constructor (left, right, index, currentAttributes) { - this.left = left; - this.right = right; - this.index = index; - this.currentAttributes = currentAttributes; - } - - /** - * Only call this if you know that this.right is defined - */ - forward () { - if (this.right === null) { - error.unexpectedCase(); - } - switch (this.right.content.constructor) { - case ContentFormat: - if (!this.right.deleted) { - updateCurrentAttributes(this.currentAttributes, /** @type {ContentFormat} */ (this.right.content)); - } - break - default: - if (!this.right.deleted) { - this.index += this.right.length; - } - break - } - this.left = this.right; - this.right = this.right.right; - } -} - -/** - * @param {Transaction} transaction - * @param {ItemTextListPosition} pos - * @param {number} count steps to move forward - * @return {ItemTextListPosition} - * - * @private - * @function - */ -const findNextPosition = (transaction, pos, count) => { - while (pos.right !== null && count > 0) { - switch (pos.right.content.constructor) { - case ContentFormat: - if (!pos.right.deleted) { - updateCurrentAttributes(pos.currentAttributes, /** @type {ContentFormat} */ (pos.right.content)); - } - break - default: - if (!pos.right.deleted) { - if (count < pos.right.length) { - // split right - getItemCleanStart(transaction, createID(pos.right.id.client, pos.right.id.clock + count)); - } - pos.index += pos.right.length; - count -= pos.right.length; - } - break - } - pos.left = pos.right; - pos.right = pos.right.right; - // pos.forward() - we don't forward because that would halve the performance because we already do the checks above - } - return pos -}; - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {number} index - * @param {boolean} useSearchMarker - * @return {ItemTextListPosition} - * - * @private - * @function - */ -const findPosition = (transaction, parent, index, useSearchMarker) => { - const currentAttributes = new Map(); - const marker = useSearchMarker ? findMarker(parent, index) : null; - if (marker) { - const pos = new ItemTextListPosition(marker.p.left, marker.p, marker.index, currentAttributes); - return findNextPosition(transaction, pos, index - marker.index) - } else { - const pos = new ItemTextListPosition(null, parent._start, 0, currentAttributes); - return findNextPosition(transaction, pos, index) - } -}; - -/** - * Negate applied formats - * - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {ItemTextListPosition} currPos - * @param {Map} negatedAttributes - * - * @private - * @function - */ -const insertNegatedAttributes = (transaction, parent, currPos, negatedAttributes) => { - // check if we really need to remove attributes - while ( - currPos.right !== null && ( - currPos.right.deleted === true || ( - currPos.right.content.constructor === ContentFormat && - equalAttrs(negatedAttributes.get(/** @type {ContentFormat} */ (currPos.right.content).key), /** @type {ContentFormat} */ (currPos.right.content).value) - ) - ) - ) { - if (!currPos.right.deleted) { - negatedAttributes.delete(/** @type {ContentFormat} */ (currPos.right.content).key); - } - currPos.forward(); - } - const doc = transaction.doc; - const ownClientId = doc.clientID; - negatedAttributes.forEach((val, key) => { - const left = currPos.left; - const right = currPos.right; - const nextFormat = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentFormat(key, val)); - nextFormat.integrate(transaction, 0); - currPos.right = nextFormat; - currPos.forward(); - }); -}; - -/** - * @param {Map} currentAttributes - * @param {ContentFormat} format - * - * @private - * @function - */ -const updateCurrentAttributes = (currentAttributes, format) => { - const { key, value } = format; - if (value === null) { - currentAttributes.delete(key); - } else { - currentAttributes.set(key, value); - } -}; - -/** - * @param {ItemTextListPosition} currPos - * @param {Object} attributes - * - * @private - * @function - */ -const minimizeAttributeChanges = (currPos, attributes) => { - // go right while attributes[right.key] === right.value (or right is deleted) - while (true) { - if (currPos.right === null) { - break - } else if (currPos.right.deleted || (currPos.right.content.constructor === ContentFormat && equalAttrs(attributes[(/** @type {ContentFormat} */ (currPos.right.content)).key] ?? null, /** @type {ContentFormat} */ (currPos.right.content).value))) ; else { - break - } - currPos.forward(); - } -}; - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {ItemTextListPosition} currPos - * @param {Object} attributes - * @return {Map} - * - * @private - * @function - **/ -const insertAttributes = (transaction, parent, currPos, attributes) => { - const doc = transaction.doc; - const ownClientId = doc.clientID; - const negatedAttributes = new Map(); - // insert format-start items - for (const key in attributes) { - const val = attributes[key]; - const currentVal = currPos.currentAttributes.get(key) ?? null; - if (!equalAttrs(currentVal, val)) { - // save negated attribute (set null if currentVal undefined) - negatedAttributes.set(key, currentVal); - const { left, right } = currPos; - currPos.right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentFormat(key, val)); - currPos.right.integrate(transaction, 0); - currPos.forward(); - } - } - return negatedAttributes -}; - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {ItemTextListPosition} currPos - * @param {string|object|AbstractType} text - * @param {Object} attributes - * - * @private - * @function - **/ -const insertText = (transaction, parent, currPos, text, attributes) => { - currPos.currentAttributes.forEach((_val, key) => { - if (attributes[key] === undefined) { - attributes[key] = null; - } - }); - const doc = transaction.doc; - const ownClientId = doc.clientID; - minimizeAttributeChanges(currPos, attributes); - const negatedAttributes = insertAttributes(transaction, parent, currPos, attributes); - // insert content - const content = text.constructor === String ? new ContentString(/** @type {string} */ (text)) : (text instanceof AbstractType ? new ContentType(text) : new ContentEmbed(text)); - let { left, right, index } = currPos; - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, currPos.index, content.getLength()); - } - right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, content); - right.integrate(transaction, 0); - currPos.right = right; - currPos.index = index; - currPos.forward(); - insertNegatedAttributes(transaction, parent, currPos, negatedAttributes); -}; - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {ItemTextListPosition} currPos - * @param {number} length - * @param {Object} attributes - * - * @private - * @function - */ -const formatText = (transaction, parent, currPos, length, attributes) => { - const doc = transaction.doc; - const ownClientId = doc.clientID; - minimizeAttributeChanges(currPos, attributes); - const negatedAttributes = insertAttributes(transaction, parent, currPos, attributes); - // iterate until first non-format or null is found - // delete all formats with attributes[format.key] != null - // also check the attributes after the first non-format as we do not want to insert redundant negated attributes there - // eslint-disable-next-line no-labels - iterationLoop: while ( - currPos.right !== null && - (length > 0 || - ( - negatedAttributes.size > 0 && - (currPos.right.deleted || currPos.right.content.constructor === ContentFormat) - ) - ) - ) { - if (!currPos.right.deleted) { - switch (currPos.right.content.constructor) { - case ContentFormat: { - const { key, value } = /** @type {ContentFormat} */ (currPos.right.content); - const attr = attributes[key]; - if (attr !== undefined) { - if (equalAttrs(attr, value)) { - negatedAttributes.delete(key); - } else { - if (length === 0) { - // no need to further extend negatedAttributes - // eslint-disable-next-line no-labels - break iterationLoop - } - negatedAttributes.set(key, value); - } - currPos.right.delete(transaction); - } else { - currPos.currentAttributes.set(key, value); - } - break - } - default: - if (length < currPos.right.length) { - getItemCleanStart(transaction, createID(currPos.right.id.client, currPos.right.id.clock + length)); - } - length -= currPos.right.length; - break - } - } - currPos.forward(); - } - // Quill just assumes that the editor starts with a newline and that it always - // ends with a newline. We only insert that newline when a new newline is - // inserted - i.e when length is bigger than type.length - if (length > 0) { - let newlines = ''; - for (; length > 0; length--) { - newlines += '\n'; - } - currPos.right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), currPos.left, currPos.left && currPos.left.lastId, currPos.right, currPos.right && currPos.right.id, parent, null, new ContentString(newlines)); - currPos.right.integrate(transaction, 0); - currPos.forward(); - } - insertNegatedAttributes(transaction, parent, currPos, negatedAttributes); -}; - -/** - * Call this function after string content has been deleted in order to - * clean up formatting Items. - * - * @param {Transaction} transaction - * @param {Item} start - * @param {Item|null} curr exclusive end, automatically iterates to the next Content Item - * @param {Map} startAttributes - * @param {Map} currAttributes - * @return {number} The amount of formatting Items deleted. - * - * @function - */ -const cleanupFormattingGap = (transaction, start, curr, startAttributes, currAttributes) => { - /** - * @type {Item|null} - */ - let end = start; - /** - * @type {Map} - */ - const endFormats = map.create(); - while (end && (!end.countable || end.deleted)) { - if (!end.deleted && end.content.constructor === ContentFormat) { - const cf = /** @type {ContentFormat} */ (end.content); - endFormats.set(cf.key, cf); - } - end = end.right; - } - let cleanups = 0; - let reachedCurr = false; - while (start !== end) { - if (curr === start) { - reachedCurr = true; - } - if (!start.deleted) { - const content = start.content; - switch (content.constructor) { - case ContentFormat: { - const { key, value } = /** @type {ContentFormat} */ (content); - const startAttrValue = startAttributes.get(key) ?? null; - if (endFormats.get(key) !== content || startAttrValue === value) { - // Either this format is overwritten or it is not necessary because the attribute already existed. - start.delete(transaction); - cleanups++; - if (!reachedCurr && (currAttributes.get(key) ?? null) === value && startAttrValue !== value) { - if (startAttrValue === null) { - currAttributes.delete(key); - } else { - currAttributes.set(key, startAttrValue); - } - } - } - if (!reachedCurr && !start.deleted) { - updateCurrentAttributes(currAttributes, /** @type {ContentFormat} */ (content)); - } - break - } - } - } - start = /** @type {Item} */ (start.right); - } - return cleanups -}; - -/** - * @param {Transaction} transaction - * @param {Item | null} item - */ -const cleanupContextlessFormattingGap = (transaction, item) => { - // iterate until item.right is null or content - while (item && item.right && (item.right.deleted || !item.right.countable)) { - item = item.right; - } - const attrs = new Set(); - // iterate back until a content item is found - while (item && (item.deleted || !item.countable)) { - if (!item.deleted && item.content.constructor === ContentFormat) { - const key = /** @type {ContentFormat} */ (item.content).key; - if (attrs.has(key)) { - item.delete(transaction); - } else { - attrs.add(key); - } - } - item = item.left; - } -}; - -/** - * This function is experimental and subject to change / be removed. - * - * Ideally, we don't need this function at all. Formatting attributes should be cleaned up - * automatically after each change. This function iterates twice over the complete YText type - * and removes unnecessary formatting attributes. This is also helpful for testing. - * - * This function won't be exported anymore as soon as there is confidence that the YText type works as intended. - * - * @param {YText} type - * @return {number} How many formatting attributes have been cleaned up. - */ -const cleanupYTextFormatting = type => { - let res = 0; - transact(/** @type {Doc} */ (type.doc), transaction => { - let start = /** @type {Item} */ (type._start); - let end = type._start; - let startAttributes = map.create(); - const currentAttributes = map.copy(startAttributes); - while (end) { - if (end.deleted === false) { - switch (end.content.constructor) { - case ContentFormat: - updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (end.content)); - break - default: - res += cleanupFormattingGap(transaction, start, end, startAttributes, currentAttributes); - startAttributes = map.copy(currentAttributes); - start = end; - break - } - } - end = end.right; - } - }); - return res -}; - -/** - * This will be called by the transaction once the event handlers are called to potentially cleanup - * formatting attributes. - * - * @param {Transaction} transaction - */ -const cleanupYTextAfterTransaction = transaction => { - /** - * @type {Set} - */ - const needFullCleanup = new Set(); - // check if another formatting item was inserted - const doc = transaction.doc; - for (const [client, afterClock] of transaction.afterState.entries()) { - const clock = transaction.beforeState.get(client) || 0; - if (afterClock === clock) { - continue - } - iterateStructs(transaction, /** @type {Array} */ (doc.store.clients.get(client)), clock, afterClock, item => { - if ( - !item.deleted && /** @type {Item} */ (item).content.constructor === ContentFormat && item.constructor !== GC - ) { - needFullCleanup.add(/** @type {any} */ (item).parent); - } - }); - } - // cleanup in a new transaction - transact(doc, (t) => { - iterateDeletedStructs(transaction, transaction.deleteSet, item => { - if (item instanceof GC || !(/** @type {YText} */ (item.parent)._hasFormatting) || needFullCleanup.has(/** @type {YText} */ (item.parent))) { - return - } - const parent = /** @type {YText} */ (item.parent); - if (item.content.constructor === ContentFormat) { - needFullCleanup.add(parent); - } else { - // If no formatting attribute was inserted or deleted, we can make due with contextless - // formatting cleanups. - // Contextless: it is not necessary to compute currentAttributes for the affected position. - cleanupContextlessFormattingGap(t, item); - } - }); - // If a formatting item was inserted, we simply clean the whole type. - // We need to compute currentAttributes for the current position anyway. - for (const yText of needFullCleanup) { - cleanupYTextFormatting(yText); - } - }); -}; - -/** - * @param {Transaction} transaction - * @param {ItemTextListPosition} currPos - * @param {number} length - * @return {ItemTextListPosition} - * - * @private - * @function - */ -const deleteText = (transaction, currPos, length) => { - const startLength = length; - const startAttrs = map.copy(currPos.currentAttributes); - const start = currPos.right; - while (length > 0 && currPos.right !== null) { - if (currPos.right.deleted === false) { - switch (currPos.right.content.constructor) { - case ContentType: - case ContentEmbed: - case ContentString: - if (length < currPos.right.length) { - getItemCleanStart(transaction, createID(currPos.right.id.client, currPos.right.id.clock + length)); - } - length -= currPos.right.length; - currPos.right.delete(transaction); - break - } - } - currPos.forward(); - } - if (start) { - cleanupFormattingGap(transaction, start, currPos.right, startAttrs, currPos.currentAttributes); - } - const parent = /** @type {AbstractType} */ (/** @type {Item} */ (currPos.left || currPos.right).parent); - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, currPos.index, -startLength + length); - } - return currPos -}; - -/** - * The Quill Delta format represents changes on a text document with - * formatting information. For more information visit {@link https://quilljs.com/docs/delta/|Quill Delta} - * - * @example - * { - * ops: [ - * { insert: 'Gandalf', attributes: { bold: true } }, - * { insert: ' the ' }, - * { insert: 'Grey', attributes: { color: '#cccccc' } } - * ] - * } - * - */ - -/** - * Attributes that can be assigned to a selection of text. - * - * @example - * { - * bold: true, - * font-size: '40px' - * } - * - * @typedef {Object} TextAttributes - */ - -/** - * @extends YEvent - * Event that describes the changes on a YText type. - */ -class YTextEvent extends YEvent { - /** - * @param {YText} ytext - * @param {Transaction} transaction - * @param {Set} subs The keys that changed - */ - constructor (ytext, transaction, subs) { - super(ytext, transaction); - /** - * Whether the children changed. - * @type {Boolean} - * @private - */ - this.childListChanged = false; - /** - * Set of all changed attributes. - * @type {Set} - */ - this.keysChanged = new Set(); - subs.forEach((sub) => { - if (sub === null) { - this.childListChanged = true; - } else { - this.keysChanged.add(sub); - } - }); - } - - /** - * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string, delete?:number, retain?:number}>}} - */ - get changes () { - if (this._changes === null) { - /** - * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string|AbstractType|object, delete?:number, retain?:number}>}} - */ - const changes = { - keys: this.keys, - delta: this.delta, - added: new Set(), - deleted: new Set() - }; - this._changes = changes; - } - return /** @type {any} */ (this._changes) - } - - /** - * Compute the changes in the delta format. - * A {@link https://quilljs.com/docs/delta/|Quill Delta}) that represents the changes on the document. - * - * @type {Array<{insert?:string|object|AbstractType, delete?:number, retain?:number, attributes?: Object}>} - * - * @public - */ - get delta () { - if (this._delta === null) { - const y = /** @type {Doc} */ (this.target.doc); - /** - * @type {Array<{insert?:string|object|AbstractType, delete?:number, retain?:number, attributes?: Object}>} - */ - const delta = []; - transact(y, transaction => { - const currentAttributes = new Map(); // saves all current attributes for insert - const oldAttributes = new Map(); - let item = this.target._start; - /** - * @type {string?} - */ - let action = null; - /** - * @type {Object} - */ - const attributes = {}; // counts added or removed new attributes for retain - /** - * @type {string|object} - */ - let insert = ''; - let retain = 0; - let deleteLen = 0; - const addOp = () => { - if (action !== null) { - /** - * @type {any} - */ - let op = null; - switch (action) { - case 'delete': - if (deleteLen > 0) { - op = { delete: deleteLen }; - } - deleteLen = 0; - break - case 'insert': - if (typeof insert === 'object' || insert.length > 0) { - op = { insert }; - if (currentAttributes.size > 0) { - op.attributes = {}; - currentAttributes.forEach((value, key) => { - if (value !== null) { - op.attributes[key] = value; - } - }); - } - } - insert = ''; - break - case 'retain': - if (retain > 0) { - op = { retain }; - if (!object.isEmpty(attributes)) { - op.attributes = object.assign({}, attributes); - } - } - retain = 0; - break - } - if (op) delta.push(op); - action = null; - } - }; - while (item !== null) { - switch (item.content.constructor) { - case ContentType: - case ContentEmbed: - if (this.adds(item)) { - if (!this.deletes(item)) { - addOp(); - action = 'insert'; - insert = item.content.getContent()[0]; - addOp(); - } - } else if (this.deletes(item)) { - if (action !== 'delete') { - addOp(); - action = 'delete'; - } - deleteLen += 1; - } else if (!item.deleted) { - if (action !== 'retain') { - addOp(); - action = 'retain'; - } - retain += 1; - } - break - case ContentString: - if (this.adds(item)) { - if (!this.deletes(item)) { - if (action !== 'insert') { - addOp(); - action = 'insert'; - } - insert += /** @type {ContentString} */ (item.content).str; - } - } else if (this.deletes(item)) { - if (action !== 'delete') { - addOp(); - action = 'delete'; - } - deleteLen += item.length; - } else if (!item.deleted) { - if (action !== 'retain') { - addOp(); - action = 'retain'; - } - retain += item.length; - } - break - case ContentFormat: { - const { key, value } = /** @type {ContentFormat} */ (item.content); - if (this.adds(item)) { - if (!this.deletes(item)) { - const curVal = currentAttributes.get(key) ?? null; - if (!equalAttrs(curVal, value)) { - if (action === 'retain') { - addOp(); - } - if (equalAttrs(value, (oldAttributes.get(key) ?? null))) { - delete attributes[key]; - } else { - attributes[key] = value; - } - } else if (value !== null) { - item.delete(transaction); - } - } - } else if (this.deletes(item)) { - oldAttributes.set(key, value); - const curVal = currentAttributes.get(key) ?? null; - if (!equalAttrs(curVal, value)) { - if (action === 'retain') { - addOp(); - } - attributes[key] = curVal; - } - } else if (!item.deleted) { - oldAttributes.set(key, value); - const attr = attributes[key]; - if (attr !== undefined) { - if (!equalAttrs(attr, value)) { - if (action === 'retain') { - addOp(); - } - if (value === null) { - delete attributes[key]; - } else { - attributes[key] = value; - } - } else if (attr !== null) { // this will be cleaned up automatically by the contextless cleanup function - item.delete(transaction); - } - } - } - if (!item.deleted) { - if (action === 'insert') { - addOp(); - } - updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (item.content)); - } - break - } - } - item = item.right; - } - addOp(); - while (delta.length > 0) { - const lastOp = delta[delta.length - 1]; - if (lastOp.retain !== undefined && lastOp.attributes === undefined) { - // retain delta's if they don't assign attributes - delta.pop(); - } else { - break - } - } - }); - this._delta = delta; - } - return /** @type {any} */ (this._delta) - } -} - -/** - * Type that represents text with formatting information. - * - * This type replaces y-richtext as this implementation is able to handle - * block formats (format information on a paragraph), embeds (complex elements - * like pictures and videos), and text formats (**bold**, *italic*). - * - * @extends AbstractType - */ -class YText extends AbstractType { - /** - * @param {String} [string] The initial value of the YText. - */ - constructor (string) { - super(); - /** - * Array of pending operations on this type - * @type {Array?} - */ - this._pending = string !== undefined ? [() => this.insert(0, string)] : []; - /** - * @type {Array|null} - */ - this._searchMarker = []; - /** - * Whether this YText contains formatting attributes. - * This flag is updated when a formatting item is integrated (see ContentFormat.integrate) - */ - this._hasFormatting = false; - } - - /** - * Number of characters of this text type. - * - * @type {number} - */ - get length () { - this.doc ?? warnPrematureAccess(); - return this._length - } - - /** - * @param {Doc} y - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item); - try { - /** @type {Array} */ (this._pending).forEach(f => f()); - } catch (e) { - console.error(e); - } - this._pending = null; - } - - _copy () { - return new YText() - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YText} - */ - clone () { - const text = new YText(); - text.applyDelta(this.toDelta()); - return text - } - - /** - * Creates YTextEvent and calls observers. - * - * @param {Transaction} transaction - * @param {Set} parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, parentSubs) { - super._callObserver(transaction, parentSubs); - const event = new YTextEvent(this, transaction, parentSubs); - callTypeObservers(this, transaction, event); - // If a remote change happened, we try to cleanup potential formatting duplicates. - if (!transaction.local && this._hasFormatting) { - transaction._needFormattingCleanup = true; - } - } - - /** - * Returns the unformatted string representation of this YText type. - * - * @public - */ - toString () { - this.doc ?? warnPrematureAccess(); - let str = ''; - /** - * @type {Item|null} - */ - let n = this._start; - while (n !== null) { - if (!n.deleted && n.countable && n.content.constructor === ContentString) { - str += /** @type {ContentString} */ (n.content).str; - } - n = n.right; - } - return str - } - - /** - * Returns the unformatted string representation of this YText type. - * - * @return {string} - * @public - */ - toJSON () { - return this.toString() - } - - /** - * Apply a {@link Delta} on this shared YText type. - * - * @param {Array} delta The changes to apply on this element. - * @param {object} opts - * @param {boolean} [opts.sanitize] Sanitize input delta. Removes ending newlines if set to true. - * - * - * @public - */ - applyDelta (delta, { sanitize = true } = {}) { - if (this.doc !== null) { - transact(this.doc, transaction => { - const currPos = new ItemTextListPosition(null, this._start, 0, new Map()); - for (let i = 0; i < delta.length; i++) { - const op = delta[i]; - if (op.insert !== undefined) { - // Quill assumes that the content starts with an empty paragraph. - // Yjs/Y.Text assumes that it starts empty. We always hide that - // there is a newline at the end of the content. - // If we omit this step, clients will see a different number of - // paragraphs, but nothing bad will happen. - const ins = (!sanitize && typeof op.insert === 'string' && i === delta.length - 1 && currPos.right === null && op.insert.slice(-1) === '\n') ? op.insert.slice(0, -1) : op.insert; - if (typeof ins !== 'string' || ins.length > 0) { - insertText(transaction, this, currPos, ins, op.attributes || {}); - } - } else if (op.retain !== undefined) { - formatText(transaction, this, currPos, op.retain, op.attributes || {}); - } else if (op.delete !== undefined) { - deleteText(transaction, currPos, op.delete); - } - } - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.applyDelta(delta)); - } - } - - /** - * Returns the Delta representation of this YText type. - * - * @param {Snapshot} [snapshot] - * @param {Snapshot} [prevSnapshot] - * @param {function('removed' | 'added', ID):any} [computeYChange] - * @return {any} The Delta representation of this type. - * - * @public - */ - toDelta (snapshot, prevSnapshot, computeYChange) { - this.doc ?? warnPrematureAccess(); - /** - * @type{Array} - */ - const ops = []; - const currentAttributes = new Map(); - const doc = /** @type {Doc} */ (this.doc); - let str = ''; - let n = this._start; - function packStr () { - if (str.length > 0) { - // pack str with attributes to ops - /** - * @type {Object} - */ - const attributes = {}; - let addAttributes = false; - currentAttributes.forEach((value, key) => { - addAttributes = true; - attributes[key] = value; - }); - /** - * @type {Object} - */ - const op = { insert: str }; - if (addAttributes) { - op.attributes = attributes; - } - ops.push(op); - str = ''; - } - } - const computeDelta = () => { - while (n !== null) { - if (isVisible(n, snapshot) || (prevSnapshot !== undefined && isVisible(n, prevSnapshot))) { - switch (n.content.constructor) { - case ContentString: { - const cur = currentAttributes.get('ychange'); - if (snapshot !== undefined && !isVisible(n, snapshot)) { - if (cur === undefined || cur.user !== n.id.client || cur.type !== 'removed') { - packStr(); - currentAttributes.set('ychange', computeYChange ? computeYChange('removed', n.id) : { type: 'removed' }); - } - } else if (prevSnapshot !== undefined && !isVisible(n, prevSnapshot)) { - if (cur === undefined || cur.user !== n.id.client || cur.type !== 'added') { - packStr(); - currentAttributes.set('ychange', computeYChange ? computeYChange('added', n.id) : { type: 'added' }); - } - } else if (cur !== undefined) { - packStr(); - currentAttributes.delete('ychange'); - } - str += /** @type {ContentString} */ (n.content).str; - break - } - case ContentType: - case ContentEmbed: { - packStr(); - /** - * @type {Object} - */ - const op = { - insert: n.content.getContent()[0] - }; - if (currentAttributes.size > 0) { - const attrs = /** @type {Object} */ ({}); - op.attributes = attrs; - currentAttributes.forEach((value, key) => { - attrs[key] = value; - }); - } - ops.push(op); - break - } - case ContentFormat: - if (isVisible(n, snapshot)) { - packStr(); - updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (n.content)); - } - break - } - } - n = n.right; - } - packStr(); - }; - if (snapshot || prevSnapshot) { - // snapshots are merged again after the transaction, so we need to keep the - // transaction alive until we are done - transact(doc, transaction => { - if (snapshot) { - splitSnapshotAffectedStructs(transaction, snapshot); - } - if (prevSnapshot) { - splitSnapshotAffectedStructs(transaction, prevSnapshot); - } - computeDelta(); - }, 'cleanup'); - } else { - computeDelta(); - } - return ops - } - - /** - * Insert text at a given index. - * - * @param {number} index The index at which to start inserting. - * @param {String} text The text to insert at the specified position. - * @param {TextAttributes} [attributes] Optionally define some formatting - * information to apply on the inserted - * Text. - * @public - */ - insert (index, text, attributes) { - if (text.length <= 0) { - return - } - const y = this.doc; - if (y !== null) { - transact(y, transaction => { - const pos = findPosition(transaction, this, index, !attributes); - if (!attributes) { - attributes = {}; - // @ts-ignore - pos.currentAttributes.forEach((v, k) => { attributes[k] = v; }); - } - insertText(transaction, this, pos, text, attributes); - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.insert(index, text, attributes)); - } - } - - /** - * Inserts an embed at a index. - * - * @param {number} index The index to insert the embed at. - * @param {Object | AbstractType} embed The Object that represents the embed. - * @param {TextAttributes} [attributes] Attribute information to apply on the - * embed - * - * @public - */ - insertEmbed (index, embed, attributes) { - const y = this.doc; - if (y !== null) { - transact(y, transaction => { - const pos = findPosition(transaction, this, index, !attributes); - insertText(transaction, this, pos, embed, attributes || {}); - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.insertEmbed(index, embed, attributes || {})); - } - } - - /** - * Deletes text starting from an index. - * - * @param {number} index Index at which to start deleting. - * @param {number} length The number of characters to remove. Defaults to 1. - * - * @public - */ - delete (index, length) { - if (length === 0) { - return - } - const y = this.doc; - if (y !== null) { - transact(y, transaction => { - deleteText(transaction, findPosition(transaction, this, index, true), length); - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.delete(index, length)); - } - } - - /** - * Assigns properties to a range of text. - * - * @param {number} index The position where to start formatting. - * @param {number} length The amount of characters to assign properties to. - * @param {TextAttributes} attributes Attribute information to apply on the - * text. - * - * @public - */ - format (index, length, attributes) { - if (length === 0) { - return - } - const y = this.doc; - if (y !== null) { - transact(y, transaction => { - const pos = findPosition(transaction, this, index, false); - if (pos.right === null) { - return - } - formatText(transaction, this, pos, length, attributes); - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.format(index, length, attributes)); - } - } - - /** - * Removes an attribute. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @param {String} attributeName The attribute name that is to be removed. - * - * @public - */ - removeAttribute (attributeName) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapDelete(transaction, this, attributeName); - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.removeAttribute(attributeName)); - } - } - - /** - * Sets or updates an attribute. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @param {String} attributeName The attribute name that is to be set. - * @param {any} attributeValue The attribute value that is to be set. - * - * @public - */ - setAttribute (attributeName, attributeValue) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapSet(transaction, this, attributeName, attributeValue); - }); - } else { - /** @type {Array} */ (this._pending).push(() => this.setAttribute(attributeName, attributeValue)); - } - } - - /** - * Returns an attribute value that belongs to the attribute name. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @param {String} attributeName The attribute name that identifies the - * queried value. - * @return {any} The queried attribute value. - * - * @public - */ - getAttribute (attributeName) { - return /** @type {any} */ (typeMapGet(this, attributeName)) - } - - /** - * Returns all attribute name/value pairs in a JSON Object. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @return {Object} A JSON Object that describes the attributes. - * - * @public - */ - getAttributes () { - return typeMapGetAll(this) - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - */ - _write (encoder) { - encoder.writeTypeRef(YTextRefID); - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder - * @return {YText} - * - * @private - * @function - */ -const readYText = _decoder => new YText(); - -/** - * @module YXml - */ - - -/** - * Define the elements to which a set of CSS queries apply. - * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors|CSS_Selectors} - * - * @example - * query = '.classSelector' - * query = 'nodeSelector' - * query = '#idSelector' - * - * @typedef {string} CSS_Selector - */ - -/** - * Dom filter function. - * - * @callback domFilter - * @param {string} nodeName The nodeName of the element - * @param {Map} attributes The map of attributes. - * @return {boolean} Whether to include the Dom node in the YXmlElement. - */ - -/** - * Represents a subset of the nodes of a YXmlElement / YXmlFragment and a - * position within them. - * - * Can be created with {@link YXmlFragment#createTreeWalker} - * - * @public - * @implements {Iterable} - */ -class YXmlTreeWalker { - /** - * @param {YXmlFragment | YXmlElement} root - * @param {function(AbstractType):boolean} [f] - */ - constructor (root, f = () => true) { - this._filter = f; - this._root = root; - /** - * @type {Item} - */ - this._currentNode = /** @type {Item} */ (root._start); - this._firstCall = true; - root.doc ?? warnPrematureAccess(); - } - - [Symbol.iterator] () { - return this - } - - /** - * Get the next node. - * - * @return {IteratorResult} The next node. - * - * @public - */ - next () { - /** - * @type {Item|null} - */ - let n = this._currentNode; - let type = n && n.content && /** @type {any} */ (n.content).type; - if (n !== null && (!this._firstCall || n.deleted || !this._filter(type))) { // if first call, we check if we can use the first item - do { - type = /** @type {any} */ (n.content).type; - if (!n.deleted && (type.constructor === YXmlElement || type.constructor === YXmlFragment) && type._start !== null) { - // walk down in the tree - n = type._start; - } else { - // walk right or up in the tree - while (n !== null) { - /** - * @type {Item | null} - */ - const nxt = n.next; - if (nxt !== null) { - n = nxt; - break - } else if (n.parent === this._root) { - n = null; - } else { - n = /** @type {AbstractType} */ (n.parent)._item; - } - } - } - } while (n !== null && (n.deleted || !this._filter(/** @type {ContentType} */ (n.content).type))) - } - this._firstCall = false; - if (n === null) { - // @ts-ignore - return { value: undefined, done: true } - } - this._currentNode = n; - return { value: /** @type {any} */ (n.content).type, done: false } - } -} - -/** - * Represents a list of {@link YXmlElement}.and {@link YXmlText} types. - * A YxmlFragment is similar to a {@link YXmlElement}, but it does not have a - * nodeName and it does not have attributes. Though it can be bound to a DOM - * element - in this case the attributes and the nodeName are not shared. - * - * @public - * @extends AbstractType - */ -class YXmlFragment extends AbstractType { - constructor () { - super(); - /** - * @type {Array|null} - */ - this._prelimContent = []; - } - - /** - * @type {YXmlElement|YXmlText|null} - */ - get firstChild () { - const first = this._first; - return first ? first.content.getContent()[0] : null - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item); - this.insert(0, /** @type {Array} */ (this._prelimContent)); - this._prelimContent = null; - } - - _copy () { - return new YXmlFragment() - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YXmlFragment} - */ - clone () { - const el = new YXmlFragment(); - // @ts-ignore - el.insert(0, this.toArray().map(item => item instanceof AbstractType ? item.clone() : item)); - return el - } - - get length () { - this.doc ?? warnPrematureAccess(); - return this._prelimContent === null ? this._length : this._prelimContent.length - } - - /** - * Create a subtree of childNodes. - * - * @example - * const walker = elem.createTreeWalker(dom => dom.nodeName === 'div') - * for (let node in walker) { - * // `node` is a div node - * nop(node) - * } - * - * @param {function(AbstractType):boolean} filter Function that is called on each child element and - * returns a Boolean indicating whether the child - * is to be included in the subtree. - * @return {YXmlTreeWalker} A subtree and a position within it. - * - * @public - */ - createTreeWalker (filter) { - return new YXmlTreeWalker(this, filter) - } - - /** - * Returns the first YXmlElement that matches the query. - * Similar to DOM's {@link querySelector}. - * - * Query support: - * - tagname - * TODO: - * - id - * - attribute - * - * @param {CSS_Selector} query The query on the children. - * @return {YXmlElement|YXmlText|YXmlHook|null} The first element that matches the query or null. - * - * @public - */ - querySelector (query) { - query = query.toUpperCase(); - // @ts-ignore - const iterator = new YXmlTreeWalker(this, element => element.nodeName && element.nodeName.toUpperCase() === query); - const next = iterator.next(); - if (next.done) { - return null - } else { - return next.value - } - } - - /** - * Returns all YXmlElements that match the query. - * Similar to Dom's {@link querySelectorAll}. - * - * @todo Does not yet support all queries. Currently only query by tagName. - * - * @param {CSS_Selector} query The query on the children - * @return {Array} The elements that match this query. - * - * @public - */ - querySelectorAll (query) { - query = query.toUpperCase(); - // @ts-ignore - return array.from(new YXmlTreeWalker(this, element => element.nodeName && element.nodeName.toUpperCase() === query)) - } - - /** - * Creates YXmlEvent and calls observers. - * - * @param {Transaction} transaction - * @param {Set} parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, parentSubs) { - callTypeObservers(this, transaction, new YXmlEvent(this, parentSubs, transaction)); - } - - /** - * Get the string representation of all the children of this YXmlFragment. - * - * @return {string} The string representation of all children. - */ - toString () { - return typeListMap(this, xml => xml.toString()).join('') - } - - /** - * @return {string} - */ - toJSON () { - return this.toString() - } - - /** - * Creates a Dom Element that mirrors this YXmlElement. - * - * @param {Document} [_document=document] The document object (you must define - * this when calling this method in - * nodejs) - * @param {Object} [hooks={}] Optional property to customize how hooks - * are presented in the DOM - * @param {any} [binding] You should not set this property. This is - * used if DomBinding wants to create a - * association to the created DOM type. - * @return {Node} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element} - * - * @public - */ - toDOM (_document = document, hooks = {}, binding) { - const fragment = _document.createDocumentFragment(); - if (binding !== undefined) { - binding._createAssociation(fragment, this); - } - typeListForEach(this, xmlType => { - fragment.insertBefore(xmlType.toDOM(_document, hooks, binding), null); - }); - return fragment - } - - /** - * Inserts new content at an index. - * - * @example - * // Insert character 'a' at position 0 - * xml.insert(0, [new Y.XmlText('text')]) - * - * @param {number} index The index to insert content at - * @param {Array} content The array of content - */ - insert (index, content) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListInsertGenerics(transaction, this, index, content); - }); - } else { - // @ts-ignore _prelimContent is defined because this is not yet integrated - this._prelimContent.splice(index, 0, ...content); - } - } - - /** - * Inserts new content at an index. - * - * @example - * // Insert character 'a' at position 0 - * xml.insert(0, [new Y.XmlText('text')]) - * - * @param {null|Item|YXmlElement|YXmlText} ref The index to insert content at - * @param {Array} content The array of content - */ - insertAfter (ref, content) { - if (this.doc !== null) { - transact(this.doc, transaction => { - const refItem = (ref && ref instanceof AbstractType) ? ref._item : ref; - typeListInsertGenericsAfter(transaction, this, refItem, content); - }); - } else { - const pc = /** @type {Array} */ (this._prelimContent); - const index = ref === null ? 0 : pc.findIndex(el => el === ref) + 1; - if (index === 0 && ref !== null) { - throw error.create('Reference item not found') - } - pc.splice(index, 0, ...content); - } - } - - /** - * Deletes elements starting from an index. - * - * @param {number} index Index at which to start deleting elements - * @param {number} [length=1] The number of elements to remove. Defaults to 1. - */ - delete (index, length = 1) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListDelete(transaction, this, index, length); - }); - } else { - // @ts-ignore _prelimContent is defined because this is not yet integrated - this._prelimContent.splice(index, length); - } - } - - /** - * Transforms this YArray to a JavaScript Array. - * - * @return {Array} - */ - toArray () { - return typeListToArray(this) - } - - /** - * Appends content to this YArray. - * - * @param {Array} content Array of content to append. - */ - push (content) { - this.insert(this.length, content); - } - - /** - * Prepends content to this YArray. - * - * @param {Array} content Array of content to prepend. - */ - unshift (content) { - this.insert(0, content); - } - - /** - * Returns the i-th element from a YArray. - * - * @param {number} index The index of the element to return from the YArray - * @return {YXmlElement|YXmlText} - */ - get (index) { - return typeListGet(this, index) - } - - /** - * Returns a portion of this YXmlFragment into a JavaScript Array selected - * from start to end (end not included). - * - * @param {number} [start] - * @param {number} [end] - * @return {Array} - */ - slice (start = 0, end = this.length) { - return typeListSlice(this, start, end) - } - - /** - * Executes a provided function on once on every child element. - * - * @param {function(YXmlElement|YXmlText,number, typeof self):void} f A function to execute on every element of this YArray. - */ - forEach (f) { - typeListForEach(this, f); - } - - /** - * Transform the properties of this type to binary and write it to an - * BinaryEncoder. - * - * This is called when this Item is sent to a remote peer. - * - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - */ - _write (encoder) { - encoder.writeTypeRef(YXmlFragmentRefID); - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder - * @return {YXmlFragment} - * - * @private - * @function - */ -const readYXmlFragment = _decoder => new YXmlFragment(); - -/** - * @typedef {Object|number|null|Array|string|Uint8Array|AbstractType} ValueTypes - */ - -/** - * An YXmlElement imitates the behavior of a - * https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element - * - * * An YXmlElement has attributes (key value pairs) - * * An YXmlElement has childElements that must inherit from YXmlElement - * - * @template {{ [key: string]: ValueTypes }} [KV={ [key: string]: string }] - */ -class YXmlElement extends YXmlFragment { - constructor (nodeName = 'UNDEFINED') { - super(); - this.nodeName = nodeName; - /** - * @type {Map|null} - */ - this._prelimAttrs = new Map(); - } - - /** - * @type {YXmlElement|YXmlText|null} - */ - get nextSibling () { - const n = this._item ? this._item.next : null; - return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null - } - - /** - * @type {YXmlElement|YXmlText|null} - */ - get prevSibling () { - const n = this._item ? this._item.prev : null; - return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item) - ;(/** @type {Map} */ (this._prelimAttrs)).forEach((value, key) => { - this.setAttribute(key, value); - }); - this._prelimAttrs = null; - } - - /** - * Creates an Item with the same effect as this Item (without position effect) - * - * @return {YXmlElement} - */ - _copy () { - return new YXmlElement(this.nodeName) - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YXmlElement} - */ - clone () { - /** - * @type {YXmlElement} - */ - const el = new YXmlElement(this.nodeName); - const attrs = this.getAttributes(); - object.forEach(attrs, (value, key) => { - el.setAttribute(key, /** @type {any} */ (value)); - }); - // @ts-ignore - el.insert(0, this.toArray().map(v => v instanceof AbstractType ? v.clone() : v)); - return el - } - - /** - * Returns the XML serialization of this YXmlElement. - * The attributes are ordered by attribute-name, so you can easily use this - * method to compare YXmlElements - * - * @return {string} The string representation of this type. - * - * @public - */ - toString () { - const attrs = this.getAttributes(); - const stringBuilder = []; - const keys = []; - for (const key in attrs) { - keys.push(key); - } - keys.sort(); - const keysLen = keys.length; - for (let i = 0; i < keysLen; i++) { - const key = keys[i]; - stringBuilder.push(key + '="' + attrs[key] + '"'); - } - const nodeName = this.nodeName.toLocaleLowerCase(); - const attrsString = stringBuilder.length > 0 ? ' ' + stringBuilder.join(' ') : ''; - return `<${nodeName}${attrsString}>${super.toString()}` - } - - /** - * Removes an attribute from this YXmlElement. - * - * @param {string} attributeName The attribute name that is to be removed. - * - * @public - */ - removeAttribute (attributeName) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapDelete(transaction, this, attributeName); - }); - } else { - /** @type {Map} */ (this._prelimAttrs).delete(attributeName); - } - } - - /** - * Sets or updates an attribute. - * - * @template {keyof KV & string} KEY - * - * @param {KEY} attributeName The attribute name that is to be set. - * @param {KV[KEY]} attributeValue The attribute value that is to be set. - * - * @public - */ - setAttribute (attributeName, attributeValue) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapSet(transaction, this, attributeName, attributeValue); - }); - } else { - /** @type {Map} */ (this._prelimAttrs).set(attributeName, attributeValue); - } - } - - /** - * Returns an attribute value that belongs to the attribute name. - * - * @template {keyof KV & string} KEY - * - * @param {KEY} attributeName The attribute name that identifies the - * queried value. - * @return {KV[KEY]|undefined} The queried attribute value. - * - * @public - */ - getAttribute (attributeName) { - return /** @type {any} */ (typeMapGet(this, attributeName)) - } - - /** - * Returns whether an attribute exists - * - * @param {string} attributeName The attribute name to check for existence. - * @return {boolean} whether the attribute exists. - * - * @public - */ - hasAttribute (attributeName) { - return /** @type {any} */ (typeMapHas(this, attributeName)) - } - - /** - * Returns all attribute name/value pairs in a JSON Object. - * - * @param {Snapshot} [snapshot] - * @return {{ [Key in Extract]?: KV[Key]}} A JSON Object that describes the attributes. - * - * @public - */ - getAttributes (snapshot) { - return /** @type {any} */ (snapshot ? typeMapGetAllSnapshot(this, snapshot) : typeMapGetAll(this)) - } - - /** - * Creates a Dom Element that mirrors this YXmlElement. - * - * @param {Document} [_document=document] The document object (you must define - * this when calling this method in - * nodejs) - * @param {Object} [hooks={}] Optional property to customize how hooks - * are presented in the DOM - * @param {any} [binding] You should not set this property. This is - * used if DomBinding wants to create a - * association to the created DOM type. - * @return {Node} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element} - * - * @public - */ - toDOM (_document = document, hooks = {}, binding) { - const dom = _document.createElement(this.nodeName); - const attrs = this.getAttributes(); - for (const key in attrs) { - const value = attrs[key]; - if (typeof value === 'string') { - dom.setAttribute(key, value); - } - } - typeListForEach(this, yxml => { - dom.appendChild(yxml.toDOM(_document, hooks, binding)); - }); - if (binding !== undefined) { - binding._createAssociation(dom, this); - } - return dom - } - - /** - * Transform the properties of this type to binary and write it to an - * BinaryEncoder. - * - * This is called when this Item is sent to a remote peer. - * - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - */ - _write (encoder) { - encoder.writeTypeRef(YXmlElementRefID); - encoder.writeKey(this.nodeName); - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {YXmlElement} - * - * @function - */ -const readYXmlElement = decoder => new YXmlElement(decoder.readKey()); - -/** - * @extends YEvent - * An Event that describes changes on a YXml Element or Yxml Fragment - */ -class YXmlEvent extends YEvent { - /** - * @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created. - * @param {Set} subs The set of changed attributes. `null` is included if the - * child list changed. - * @param {Transaction} transaction The transaction instance with which the - * change was created. - */ - constructor (target, subs, transaction) { - super(target, transaction); - /** - * Whether the children changed. - * @type {Boolean} - * @private - */ - this.childListChanged = false; - /** - * Set of all changed attributes. - * @type {Set} - */ - this.attributesChanged = new Set(); - subs.forEach((sub) => { - if (sub === null) { - this.childListChanged = true; - } else { - this.attributesChanged.add(sub); - } - }); - } -} - -/** - * You can manage binding to a custom type with YXmlHook. - * - * @extends {YMap} - */ -class YXmlHook extends YMap { - /** - * @param {string} hookName nodeName of the Dom Node. - */ - constructor (hookName) { - super(); - /** - * @type {string} - */ - this.hookName = hookName; - } - - /** - * Creates an Item with the same effect as this Item (without position effect) - */ - _copy () { - return new YXmlHook(this.hookName) - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YXmlHook} - */ - clone () { - const el = new YXmlHook(this.hookName); - this.forEach((value, key) => { - el.set(key, value); - }); - return el - } - - /** - * Creates a Dom Element that mirrors this YXmlElement. - * - * @param {Document} [_document=document] The document object (you must define - * this when calling this method in - * nodejs) - * @param {Object.} [hooks] Optional property to customize how hooks - * are presented in the DOM - * @param {any} [binding] You should not set this property. This is - * used if DomBinding wants to create a - * association to the created DOM type - * @return {Element} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element} - * - * @public - */ - toDOM (_document = document, hooks = {}, binding) { - const hook = hooks[this.hookName]; - let dom; - if (hook !== undefined) { - dom = hook.createDom(this); - } else { - dom = document.createElement(this.hookName); - } - dom.setAttribute('data-yjs-hook', this.hookName); - if (binding !== undefined) { - binding._createAssociation(dom, this); - } - return dom - } - - /** - * Transform the properties of this type to binary and write it to an - * BinaryEncoder. - * - * This is called when this Item is sent to a remote peer. - * - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - */ - _write (encoder) { - encoder.writeTypeRef(YXmlHookRefID); - encoder.writeKey(this.hookName); - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {YXmlHook} - * - * @private - * @function - */ -const readYXmlHook = decoder => - new YXmlHook(decoder.readKey()); - -/** - * Represents text in a Dom Element. In the future this type will also handle - * simple formatting information like bold and italic. - */ -class YXmlText extends YText { - /** - * @type {YXmlElement|YXmlText|null} - */ - get nextSibling () { - const n = this._item ? this._item.next : null; - return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null - } - - /** - * @type {YXmlElement|YXmlText|null} - */ - get prevSibling () { - const n = this._item ? this._item.prev : null; - return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null - } - - _copy () { - return new YXmlText() - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YXmlText} - */ - clone () { - const text = new YXmlText(); - text.applyDelta(this.toDelta()); - return text - } - - /** - * Creates a Dom Element that mirrors this YXmlText. - * - * @param {Document} [_document=document] The document object (you must define - * this when calling this method in - * nodejs) - * @param {Object} [hooks] Optional property to customize how hooks - * are presented in the DOM - * @param {any} [binding] You should not set this property. This is - * used if DomBinding wants to create a - * association to the created DOM type. - * @return {Text} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element} - * - * @public - */ - toDOM (_document = document, hooks, binding) { - const dom = _document.createTextNode(this.toString()); - if (binding !== undefined) { - binding._createAssociation(dom, this); - } - return dom - } - - toString () { - // @ts-ignore - return this.toDelta().map(delta => { - const nestedNodes = []; - for (const nodeName in delta.attributes) { - const attrs = []; - for (const key in delta.attributes[nodeName]) { - attrs.push({ key, value: delta.attributes[nodeName][key] }); - } - // sort attributes to get a unique order - attrs.sort((a, b) => a.key < b.key ? -1 : 1); - nestedNodes.push({ nodeName, attrs }); - } - // sort node order to get a unique order - nestedNodes.sort((a, b) => a.nodeName < b.nodeName ? -1 : 1); - // now convert to dom string - let str = ''; - for (let i = 0; i < nestedNodes.length; i++) { - const node = nestedNodes[i]; - str += `<${node.nodeName}`; - for (let j = 0; j < node.attrs.length; j++) { - const attr = node.attrs[j]; - str += ` ${attr.key}="${attr.value}"`; - } - str += '>'; - } - str += delta.insert; - for (let i = nestedNodes.length - 1; i >= 0; i--) { - str += ``; - } - return str - }).join('') - } - - /** - * @return {string} - */ - toJSON () { - return this.toString() - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - */ - _write (encoder) { - encoder.writeTypeRef(YXmlTextRefID); - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {YXmlText} - * - * @private - * @function - */ -const readYXmlText = decoder => new YXmlText(); - -class AbstractStruct { - /** - * @param {ID} id - * @param {number} length - */ - constructor (id, length) { - this.id = id; - this.length = length; - } - - /** - * @type {boolean} - */ - get deleted () { - throw error.methodUnimplemented() - } - - /** - * Merge this struct with the item to the right. - * This method is already assuming that `this.id.clock + this.length === this.id.clock`. - * Also this method does *not* remove right from StructStore! - * @param {AbstractStruct} right - * @return {boolean} whether this merged with right - */ - mergeWith (right) { - return false - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - * @param {number} offset - * @param {number} encodingRef - */ - write (encoder, offset, encodingRef) { - throw error.methodUnimplemented() - } - - /** - * @param {Transaction} transaction - * @param {number} offset - */ - integrate (transaction, offset) { - throw error.methodUnimplemented() - } -} - -const structGCRefNumber = 0; - -/** - * @private - */ -class GC extends AbstractStruct { - get deleted () { - return true - } - - delete () {} - - /** - * @param {GC} right - * @return {boolean} - */ - mergeWith (right) { - if (this.constructor !== right.constructor) { - return false - } - this.length += right.length; - return true - } - - /** - * @param {Transaction} transaction - * @param {number} offset - */ - integrate (transaction, offset) { - if (offset > 0) { - this.id.clock += offset; - this.length -= offset; - } - addStruct(transaction.doc.store, this); - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeInfo(structGCRefNumber); - encoder.writeLen(this.length - offset); - } - - /** - * @param {Transaction} transaction - * @param {StructStore} store - * @return {null | number} - */ - getMissing (transaction, store) { - return null - } -} - -class ContentBinary { - /** - * @param {Uint8Array} content - */ - constructor (content) { - this.content = content; - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [this.content] - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentBinary} - */ - copy () { - return new ContentBinary(this.content) - } - - /** - * @param {number} offset - * @return {ContentBinary} - */ - splice (offset) { - throw error.methodUnimplemented() - } - - /** - * @param {ContentBinary} right - * @return {boolean} - */ - mergeWith (right) { - return false - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) {} - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeBuf(this.content); - } - - /** - * @return {number} - */ - getRef () { - return 3 - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2 } decoder - * @return {ContentBinary} - */ -const readContentBinary = decoder => new ContentBinary(decoder.readBuf()); - -class ContentDeleted { - /** - * @param {number} len - */ - constructor (len) { - this.len = len; - } - - /** - * @return {number} - */ - getLength () { - return this.len - } - - /** - * @return {Array} - */ - getContent () { - return [] - } - - /** - * @return {boolean} - */ - isCountable () { - return false - } - - /** - * @return {ContentDeleted} - */ - copy () { - return new ContentDeleted(this.len) - } - - /** - * @param {number} offset - * @return {ContentDeleted} - */ - splice (offset) { - const right = new ContentDeleted(this.len - offset); - this.len = offset; - return right - } - - /** - * @param {ContentDeleted} right - * @return {boolean} - */ - mergeWith (right) { - this.len += right.len; - return true - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) { - addToDeleteSet(transaction.deleteSet, item.id.client, item.id.clock, this.len); - item.markDeleted(); - } - - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeLen(this.len - offset); - } - - /** - * @return {number} - */ - getRef () { - return 1 - } -} - -/** - * @private - * - * @param {UpdateDecoderV1 | UpdateDecoderV2 } decoder - * @return {ContentDeleted} - */ -const readContentDeleted = decoder => new ContentDeleted(decoder.readLen()); - -/** - * @param {string} guid - * @param {Object} opts - */ -const createDocFromOpts = (guid, opts) => new Doc({ guid, ...opts, shouldLoad: opts.shouldLoad || opts.autoLoad || false }); - -/** - * @private - */ -class ContentDoc { - /** - * @param {Doc} doc - */ - constructor (doc) { - if (doc._item) { - console.error('This document was already integrated as a sub-document. You should create a second instance instead with the same guid.'); - } - /** - * @type {Doc} - */ - this.doc = doc; - /** - * @type {any} - */ - const opts = {}; - this.opts = opts; - if (!doc.gc) { - opts.gc = false; - } - if (doc.autoLoad) { - opts.autoLoad = true; - } - if (doc.meta !== null) { - opts.meta = doc.meta; - } - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [this.doc] - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentDoc} - */ - copy () { - return new ContentDoc(createDocFromOpts(this.doc.guid, this.opts)) - } - - /** - * @param {number} offset - * @return {ContentDoc} - */ - splice (offset) { - throw error.methodUnimplemented() - } - - /** - * @param {ContentDoc} right - * @return {boolean} - */ - mergeWith (right) { - return false - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) { - // this needs to be reflected in doc.destroy as well - this.doc._item = item; - transaction.subdocsAdded.add(this.doc); - if (this.doc.shouldLoad) { - transaction.subdocsLoaded.add(this.doc); - } - } - - /** - * @param {Transaction} transaction - */ - delete (transaction) { - if (transaction.subdocsAdded.has(this.doc)) { - transaction.subdocsAdded.delete(this.doc); - } else { - transaction.subdocsRemoved.add(this.doc); - } - } - - /** - * @param {StructStore} store - */ - gc (store) { } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeString(this.doc.guid); - encoder.writeAny(this.opts); - } - - /** - * @return {number} - */ - getRef () { - return 9 - } -} - -/** - * @private - * - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentDoc} - */ -const readContentDoc = decoder => new ContentDoc(createDocFromOpts(decoder.readString(), decoder.readAny())); - -/** - * @private - */ -class ContentEmbed { - /** - * @param {Object} embed - */ - constructor (embed) { - this.embed = embed; - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [this.embed] - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentEmbed} - */ - copy () { - return new ContentEmbed(this.embed) - } - - /** - * @param {number} offset - * @return {ContentEmbed} - */ - splice (offset) { - throw error.methodUnimplemented() - } - - /** - * @param {ContentEmbed} right - * @return {boolean} - */ - mergeWith (right) { - return false - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) {} - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeJSON(this.embed); - } - - /** - * @return {number} - */ - getRef () { - return 5 - } -} - -/** - * @private - * - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentEmbed} - */ -const readContentEmbed = decoder => new ContentEmbed(decoder.readJSON()); - -/** - * @private - */ -class ContentFormat { - /** - * @param {string} key - * @param {Object} value - */ - constructor (key, value) { - this.key = key; - this.value = value; - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [] - } - - /** - * @return {boolean} - */ - isCountable () { - return false - } - - /** - * @return {ContentFormat} - */ - copy () { - return new ContentFormat(this.key, this.value) - } - - /** - * @param {number} _offset - * @return {ContentFormat} - */ - splice (_offset) { - throw error.methodUnimplemented() - } - - /** - * @param {ContentFormat} _right - * @return {boolean} - */ - mergeWith (_right) { - return false - } - - /** - * @param {Transaction} _transaction - * @param {Item} item - */ - integrate (_transaction, item) { - // @todo searchmarker are currently unsupported for rich text documents - const p = /** @type {YText} */ (item.parent); - p._searchMarker = null; - p._hasFormatting = true; - } - - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeKey(this.key); - encoder.writeJSON(this.value); - } - - /** - * @return {number} - */ - getRef () { - return 6 - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentFormat} - */ -const readContentFormat = decoder => new ContentFormat(decoder.readKey(), decoder.readJSON()); - -/** - * @private - */ -class ContentJSON { - /** - * @param {Array} arr - */ - constructor (arr) { - /** - * @type {Array} - */ - this.arr = arr; - } - - /** - * @return {number} - */ - getLength () { - return this.arr.length - } - - /** - * @return {Array} - */ - getContent () { - return this.arr - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentJSON} - */ - copy () { - return new ContentJSON(this.arr) - } - - /** - * @param {number} offset - * @return {ContentJSON} - */ - splice (offset) { - const right = new ContentJSON(this.arr.slice(offset)); - this.arr = this.arr.slice(0, offset); - return right - } - - /** - * @param {ContentJSON} right - * @return {boolean} - */ - mergeWith (right) { - this.arr = this.arr.concat(right.arr); - return true - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) {} - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - const len = this.arr.length; - encoder.writeLen(len - offset); - for (let i = offset; i < len; i++) { - const c = this.arr[i]; - encoder.writeString(c === undefined ? 'undefined' : JSON.stringify(c)); - } - } - - /** - * @return {number} - */ - getRef () { - return 2 - } -} - -/** - * @private - * - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentJSON} - */ -const readContentJSON = decoder => { - const len = decoder.readLen(); - const cs = []; - for (let i = 0; i < len; i++) { - const c = decoder.readString(); - if (c === 'undefined') { - cs.push(undefined); - } else { - cs.push(JSON.parse(c)); - } - } - return new ContentJSON(cs) -}; - -const isDevMode = env.getVariable('node_env') === 'development'; - -class ContentAny { - /** - * @param {Array} arr - */ - constructor (arr) { - /** - * @type {Array} - */ - this.arr = arr; - isDevMode && object.deepFreeze(arr); - } - - /** - * @return {number} - */ - getLength () { - return this.arr.length - } - - /** - * @return {Array} - */ - getContent () { - return this.arr - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentAny} - */ - copy () { - return new ContentAny(this.arr) - } - - /** - * @param {number} offset - * @return {ContentAny} - */ - splice (offset) { - const right = new ContentAny(this.arr.slice(offset)); - this.arr = this.arr.slice(0, offset); - return right - } - - /** - * @param {ContentAny} right - * @return {boolean} - */ - mergeWith (right) { - this.arr = this.arr.concat(right.arr); - return true - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) {} - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - const len = this.arr.length; - encoder.writeLen(len - offset); - for (let i = offset; i < len; i++) { - const c = this.arr[i]; - encoder.writeAny(c); - } - } - - /** - * @return {number} - */ - getRef () { - return 8 - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentAny} - */ -const readContentAny = decoder => { - const len = decoder.readLen(); - const cs = []; - for (let i = 0; i < len; i++) { - cs.push(decoder.readAny()); - } - return new ContentAny(cs) -}; - -/** - * @private - */ -class ContentString { - /** - * @param {string} str - */ - constructor (str) { - /** - * @type {string} - */ - this.str = str; - } - - /** - * @return {number} - */ - getLength () { - return this.str.length - } - - /** - * @return {Array} - */ - getContent () { - return this.str.split('') - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentString} - */ - copy () { - return new ContentString(this.str) - } - - /** - * @param {number} offset - * @return {ContentString} - */ - splice (offset) { - const right = new ContentString(this.str.slice(offset)); - this.str = this.str.slice(0, offset); - - // Prevent encoding invalid documents because of splitting of surrogate pairs: https://github.com/yjs/yjs/issues/248 - const firstCharCode = this.str.charCodeAt(offset - 1); - if (firstCharCode >= 0xD800 && firstCharCode <= 0xDBFF) { - // Last character of the left split is the start of a surrogate utf16/ucs2 pair. - // We don't support splitting of surrogate pairs because this may lead to invalid documents. - // Replace the invalid character with a unicode replacement character (� / U+FFFD) - this.str = this.str.slice(0, offset - 1) + '�'; - // replace right as well - right.str = '�' + right.str.slice(1); - } - return right - } - - /** - * @param {ContentString} right - * @return {boolean} - */ - mergeWith (right) { - this.str += right.str; - return true - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) {} - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeString(offset === 0 ? this.str : this.str.slice(offset)); - } - - /** - * @return {number} - */ - getRef () { - return 4 - } -} - -/** - * @private - * - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentString} - */ -const readContentString = decoder => new ContentString(decoder.readString()); - -/** - * @type {Array>} - * @private - */ -const typeRefs = [ - readYArray, - readYMap, - readYText, - readYXmlElement, - readYXmlFragment, - readYXmlHook, - readYXmlText -]; - -const YArrayRefID = 0; -const YMapRefID = 1; -const YTextRefID = 2; -const YXmlElementRefID = 3; -const YXmlFragmentRefID = 4; -const YXmlHookRefID = 5; -const YXmlTextRefID = 6; - -/** - * @private - */ -class ContentType { - /** - * @param {AbstractType} type - */ - constructor (type) { - /** - * @type {AbstractType} - */ - this.type = type; - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [this.type] - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentType} - */ - copy () { - return new ContentType(this.type._copy()) - } - - /** - * @param {number} offset - * @return {ContentType} - */ - splice (offset) { - throw error.methodUnimplemented() - } - - /** - * @param {ContentType} right - * @return {boolean} - */ - mergeWith (right) { - return false - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) { - this.type._integrate(transaction.doc, item); - } - - /** - * @param {Transaction} transaction - */ - delete (transaction) { - let item = this.type._start; - while (item !== null) { - if (!item.deleted) { - item.delete(transaction); - } else if (item.id.clock < (transaction.beforeState.get(item.id.client) || 0)) { - // This will be gc'd later and we want to merge it if possible - // We try to merge all deleted items after each transaction, - // but we have no knowledge about that this needs to be merged - // since it is not in transaction.ds. Hence we add it to transaction._mergeStructs - transaction._mergeStructs.push(item); - } - item = item.right; - } - this.type._map.forEach(item => { - if (!item.deleted) { - item.delete(transaction); - } else if (item.id.clock < (transaction.beforeState.get(item.id.client) || 0)) { - // same as above - transaction._mergeStructs.push(item); - } - }); - transaction.changed.delete(this.type); - } - - /** - * @param {StructStore} store - */ - gc (store) { - let item = this.type._start; - while (item !== null) { - item.gc(store, true); - item = item.right; - } - this.type._start = null; - this.type._map.forEach(/** @param {Item | null} item */ (item) => { - while (item !== null) { - item.gc(store, true); - item = item.left; - } - }); - this.type._map = new Map(); - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - this.type._write(encoder); - } - - /** - * @return {number} - */ - getRef () { - return 7 - } -} - -/** - * @private - * - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentType} - */ -const readContentType = decoder => new ContentType(typeRefs[decoder.readTypeRef()](decoder)); - -/** - * @todo This should return several items - * - * @param {StructStore} store - * @param {ID} id - * @return {{item:Item, diff:number}} - */ -const followRedone = (store, id) => { - /** - * @type {ID|null} - */ - let nextID = id; - let diff = 0; - let item; - do { - if (diff > 0) { - nextID = createID(nextID.client, nextID.clock + diff); - } - item = getItem(store, nextID); - diff = nextID.clock - item.id.clock; - nextID = item.redone; - } while (nextID !== null && item instanceof Item) - return { - item, diff - } -}; - -/** - * Make sure that neither item nor any of its parents is ever deleted. - * - * This property does not persist when storing it into a database or when - * sending it to other peers - * - * @param {Item|null} item - * @param {boolean} keep - */ -const keepItem = (item, keep) => { - while (item !== null && item.keep !== keep) { - item.keep = keep; - item = /** @type {AbstractType} */ (item.parent)._item; - } -}; - -/** - * Split leftItem into two items - * @param {Transaction} transaction - * @param {Item} leftItem - * @param {number} diff - * @return {Item} - * - * @function - * @private - */ -const splitItem = (transaction, leftItem, diff) => { - // create rightItem - const { client, clock } = leftItem.id; - const rightItem = new Item( - createID(client, clock + diff), - leftItem, - createID(client, clock + diff - 1), - leftItem.right, - leftItem.rightOrigin, - leftItem.parent, - leftItem.parentSub, - leftItem.content.splice(diff) - ); - if (leftItem.deleted) { - rightItem.markDeleted(); - } - if (leftItem.keep) { - rightItem.keep = true; - } - if (leftItem.redone !== null) { - rightItem.redone = createID(leftItem.redone.client, leftItem.redone.clock + diff); - } - // update left (do not set leftItem.rightOrigin as it will lead to problems when syncing) - leftItem.right = rightItem; - // update right - if (rightItem.right !== null) { - rightItem.right.left = rightItem; - } - // right is more specific. - transaction._mergeStructs.push(rightItem); - // update parent._map - if (rightItem.parentSub !== null && rightItem.right === null) { - /** @type {AbstractType} */ (rightItem.parent)._map.set(rightItem.parentSub, rightItem); - } - leftItem.length = diff; - return rightItem -}; - -/** - * @param {Array} stack - * @param {ID} id - */ -const isDeletedByUndoStack = (stack, id) => array.some(stack, /** @param {StackItem} s */ s => isDeleted(s.deletions, id)); - -/** - * Redoes the effect of this operation. - * - * @param {Transaction} transaction The Yjs instance. - * @param {Item} item - * @param {Set} redoitems - * @param {DeleteSet} itemsToDelete - * @param {boolean} ignoreRemoteMapChanges - * @param {import('../utils/UndoManager.js').UndoManager} um - * - * @return {Item|null} - * - * @private - */ -const redoItem = (transaction, item, redoitems, itemsToDelete, ignoreRemoteMapChanges, um) => { - const doc = transaction.doc; - const store = doc.store; - const ownClientID = doc.clientID; - const redone = item.redone; - if (redone !== null) { - return getItemCleanStart(transaction, redone) - } - let parentItem = /** @type {AbstractType} */ (item.parent)._item; - /** - * @type {Item|null} - */ - let left = null; - /** - * @type {Item|null} - */ - let right; - // make sure that parent is redone - if (parentItem !== null && parentItem.deleted === true) { - // try to undo parent if it will be undone anyway - if (parentItem.redone === null && (!redoitems.has(parentItem) || redoItem(transaction, parentItem, redoitems, itemsToDelete, ignoreRemoteMapChanges, um) === null)) { - return null - } - while (parentItem.redone !== null) { - parentItem = getItemCleanStart(transaction, parentItem.redone); - } - } - const parentType = parentItem === null ? /** @type {AbstractType} */ (item.parent) : /** @type {ContentType} */ (parentItem.content).type; - - if (item.parentSub === null) { - // Is an array item. Insert at the old position - left = item.left; - right = item; - // find next cloned_redo items - while (left !== null) { - /** - * @type {Item|null} - */ - let leftTrace = left; - // trace redone until parent matches - while (leftTrace !== null && /** @type {AbstractType} */ (leftTrace.parent)._item !== parentItem) { - leftTrace = leftTrace.redone === null ? null : getItemCleanStart(transaction, leftTrace.redone); - } - if (leftTrace !== null && /** @type {AbstractType} */ (leftTrace.parent)._item === parentItem) { - left = leftTrace; - break - } - left = left.left; - } - while (right !== null) { - /** - * @type {Item|null} - */ - let rightTrace = right; - // trace redone until parent matches - while (rightTrace !== null && /** @type {AbstractType} */ (rightTrace.parent)._item !== parentItem) { - rightTrace = rightTrace.redone === null ? null : getItemCleanStart(transaction, rightTrace.redone); - } - if (rightTrace !== null && /** @type {AbstractType} */ (rightTrace.parent)._item === parentItem) { - right = rightTrace; - break - } - right = right.right; - } - } else { - right = null; - if (item.right && !ignoreRemoteMapChanges) { - left = item; - // Iterate right while right is in itemsToDelete - // If it is intended to delete right while item is redone, we can expect that item should replace right. - while (left !== null && left.right !== null && (left.right.redone || isDeleted(itemsToDelete, left.right.id) || isDeletedByUndoStack(um.undoStack, left.right.id) || isDeletedByUndoStack(um.redoStack, left.right.id))) { - left = left.right; - // follow redone - while (left.redone) left = getItemCleanStart(transaction, left.redone); - } - if (left && left.right !== null) { - // It is not possible to redo this item because it conflicts with a - // change from another client - return null - } - } else { - left = parentType._map.get(item.parentSub) || null; - } - } - const nextClock = getState(store, ownClientID); - const nextId = createID(ownClientID, nextClock); - const redoneItem = new Item( - nextId, - left, left && left.lastId, - right, right && right.id, - parentType, - item.parentSub, - item.content.copy() - ); - item.redone = nextId; - keepItem(redoneItem, true); - redoneItem.integrate(transaction, 0); - return redoneItem -}; - -/** - * Abstract class that represents any content. - */ -class Item extends AbstractStruct { - /** - * @param {ID} id - * @param {Item | null} left - * @param {ID | null} origin - * @param {Item | null} right - * @param {ID | null} rightOrigin - * @param {AbstractType|ID|null} parent Is a type if integrated, is null if it is possible to copy parent from left or right, is ID before integration to search for it. - * @param {string | null} parentSub - * @param {AbstractContent} content - */ - constructor (id, left, origin, right, rightOrigin, parent, parentSub, content) { - super(id, content.getLength()); - /** - * The item that was originally to the left of this item. - * @type {ID | null} - */ - this.origin = origin; - /** - * The item that is currently to the left of this item. - * @type {Item | null} - */ - this.left = left; - /** - * The item that is currently to the right of this item. - * @type {Item | null} - */ - this.right = right; - /** - * The item that was originally to the right of this item. - * @type {ID | null} - */ - this.rightOrigin = rightOrigin; - /** - * @type {AbstractType|ID|null} - */ - this.parent = parent; - /** - * If the parent refers to this item with some kind of key (e.g. YMap, the - * key is specified here. The key is then used to refer to the list in which - * to insert this item. If `parentSub = null` type._start is the list in - * which to insert to. Otherwise it is `parent._map`. - * @type {String | null} - */ - this.parentSub = parentSub; - /** - * If this type's effect is redone this type refers to the type that undid - * this operation. - * @type {ID | null} - */ - this.redone = null; - /** - * @type {AbstractContent} - */ - this.content = content; - /** - * bit1: keep - * bit2: countable - * bit3: deleted - * bit4: mark - mark node as fast-search-marker - * @type {number} byte - */ - this.info = this.content.isCountable() ? binary.BIT2 : 0; - } - - /** - * This is used to mark the item as an indexed fast-search marker - * - * @type {boolean} - */ - set marker (isMarked) { - if (((this.info & binary.BIT4) > 0) !== isMarked) { - this.info ^= binary.BIT4; - } - } - - get marker () { - return (this.info & binary.BIT4) > 0 - } - - /** - * If true, do not garbage collect this Item. - */ - get keep () { - return (this.info & binary.BIT1) > 0 - } - - set keep (doKeep) { - if (this.keep !== doKeep) { - this.info ^= binary.BIT1; - } - } - - get countable () { - return (this.info & binary.BIT2) > 0 - } - - /** - * Whether this item was deleted or not. - * @type {Boolean} - */ - get deleted () { - return (this.info & binary.BIT3) > 0 - } - - set deleted (doDelete) { - if (this.deleted !== doDelete) { - this.info ^= binary.BIT3; - } - } - - markDeleted () { - this.info |= binary.BIT3; - } - - /** - * Return the creator clientID of the missing op or define missing items and return null. - * - * @param {Transaction} transaction - * @param {StructStore} store - * @return {null | number} - */ - getMissing (transaction, store) { - if (this.origin && this.origin.client !== this.id.client && this.origin.clock >= getState(store, this.origin.client)) { - return this.origin.client - } - if (this.rightOrigin && this.rightOrigin.client !== this.id.client && this.rightOrigin.clock >= getState(store, this.rightOrigin.client)) { - return this.rightOrigin.client - } - if (this.parent && this.parent.constructor === ID && this.id.client !== this.parent.client && this.parent.clock >= getState(store, this.parent.client)) { - return this.parent.client - } - - // We have all missing ids, now find the items - - if (this.origin) { - this.left = getItemCleanEnd(transaction, store, this.origin); - this.origin = this.left.lastId; - } - if (this.rightOrigin) { - this.right = getItemCleanStart(transaction, this.rightOrigin); - this.rightOrigin = this.right.id; - } - if ((this.left && this.left.constructor === GC) || (this.right && this.right.constructor === GC)) { - this.parent = null; - } else if (!this.parent) { - // only set parent if this shouldn't be garbage collected - if (this.left && this.left.constructor === Item) { - this.parent = this.left.parent; - this.parentSub = this.left.parentSub; - } else if (this.right && this.right.constructor === Item) { - this.parent = this.right.parent; - this.parentSub = this.right.parentSub; - } - } else if (this.parent.constructor === ID) { - const parentItem = getItem(store, this.parent); - if (parentItem.constructor === GC) { - this.parent = null; - } else { - this.parent = /** @type {ContentType} */ (parentItem.content).type; - } - } - return null - } - - /** - * @param {Transaction} transaction - * @param {number} offset - */ - integrate (transaction, offset) { - if (offset > 0) { - this.id.clock += offset; - this.left = getItemCleanEnd(transaction, transaction.doc.store, createID(this.id.client, this.id.clock - 1)); - this.origin = this.left.lastId; - this.content = this.content.splice(offset); - this.length -= offset; - } - - if (this.parent) { - if ((!this.left && (!this.right || this.right.left !== null)) || (this.left && this.left.right !== this.right)) { - /** - * @type {Item|null} - */ - let left = this.left; - - /** - * @type {Item|null} - */ - let o; - // set o to the first conflicting item - if (left !== null) { - o = left.right; - } else if (this.parentSub !== null) { - o = /** @type {AbstractType} */ (this.parent)._map.get(this.parentSub) || null; - while (o !== null && o.left !== null) { - o = o.left; - } - } else { - o = /** @type {AbstractType} */ (this.parent)._start; - } - // TODO: use something like DeleteSet here (a tree implementation would be best) - // @todo use global set definitions - /** - * @type {Set} - */ - const conflictingItems = new Set(); - /** - * @type {Set} - */ - const itemsBeforeOrigin = new Set(); - // Let c in conflictingItems, b in itemsBeforeOrigin - // ***{origin}bbbb{this}{c,b}{c,b}{o}*** - // Note that conflictingItems is a subset of itemsBeforeOrigin - while (o !== null && o !== this.right) { - itemsBeforeOrigin.add(o); - conflictingItems.add(o); - if (compareIDs(this.origin, o.origin)) { - // case 1 - if (o.id.client < this.id.client) { - left = o; - conflictingItems.clear(); - } else if (compareIDs(this.rightOrigin, o.rightOrigin)) { - // this and o are conflicting and point to the same integration points. The id decides which item comes first. - // Since this is to the left of o, we can break here - break - } // else, o might be integrated before an item that this conflicts with. If so, we will find it in the next iterations - } else if (o.origin !== null && itemsBeforeOrigin.has(getItem(transaction.doc.store, o.origin))) { // use getItem instead of getItemCleanEnd because we don't want / need to split items. - // case 2 - if (!conflictingItems.has(getItem(transaction.doc.store, o.origin))) { - left = o; - conflictingItems.clear(); - } - } else { - break - } - o = o.right; - } - this.left = left; - } - // reconnect left/right + update parent map/start if necessary - if (this.left !== null) { - const right = this.left.right; - this.right = right; - this.left.right = this; - } else { - let r; - if (this.parentSub !== null) { - r = /** @type {AbstractType} */ (this.parent)._map.get(this.parentSub) || null; - while (r !== null && r.left !== null) { - r = r.left; - } - } else { - r = /** @type {AbstractType} */ (this.parent)._start - ;/** @type {AbstractType} */ (this.parent)._start = this; - } - this.right = r; - } - if (this.right !== null) { - this.right.left = this; - } else if (this.parentSub !== null) { - // set as current parent value if right === null and this is parentSub - /** @type {AbstractType} */ (this.parent)._map.set(this.parentSub, this); - if (this.left !== null) { - // this is the current attribute value of parent. delete right - this.left.delete(transaction); - } - } - // adjust length of parent - if (this.parentSub === null && this.countable && !this.deleted) { - /** @type {AbstractType} */ (this.parent)._length += this.length; - } - addStruct(transaction.doc.store, this); - this.content.integrate(transaction, this); - // add parent to transaction.changed - addChangedTypeToTransaction(transaction, /** @type {AbstractType} */ (this.parent), this.parentSub); - if ((/** @type {AbstractType} */ (this.parent)._item !== null && /** @type {AbstractType} */ (this.parent)._item.deleted) || (this.parentSub !== null && this.right !== null)) { - // delete if parent is deleted or if this is not the current attribute value of parent - this.delete(transaction); - } - } else { - // parent is not defined. Integrate GC struct instead - new GC(this.id, this.length).integrate(transaction, 0); - } - } - - /** - * Returns the next non-deleted item - */ - get next () { - let n = this.right; - while (n !== null && n.deleted) { - n = n.right; - } - return n - } - - /** - * Returns the previous non-deleted item - */ - get prev () { - let n = this.left; - while (n !== null && n.deleted) { - n = n.left; - } - return n - } - - /** - * Computes the last content address of this Item. - */ - get lastId () { - // allocating ids is pretty costly because of the amount of ids created, so we try to reuse whenever possible - return this.length === 1 ? this.id : createID(this.id.client, this.id.clock + this.length - 1) - } - - /** - * Try to merge two items - * - * @param {Item} right - * @return {boolean} - */ - mergeWith (right) { - if ( - this.constructor === right.constructor && - compareIDs(right.origin, this.lastId) && - this.right === right && - compareIDs(this.rightOrigin, right.rightOrigin) && - this.id.client === right.id.client && - this.id.clock + this.length === right.id.clock && - this.deleted === right.deleted && - this.redone === null && - right.redone === null && - this.content.constructor === right.content.constructor && - this.content.mergeWith(right.content) - ) { - const searchMarker = /** @type {AbstractType} */ (this.parent)._searchMarker; - if (searchMarker) { - searchMarker.forEach(marker => { - if (marker.p === right) { - // right is going to be "forgotten" so we need to update the marker - marker.p = this; - // adjust marker index - if (!this.deleted && this.countable) { - marker.index -= this.length; - } - } - }); - } - if (right.keep) { - this.keep = true; - } - this.right = right.right; - if (this.right !== null) { - this.right.left = this; - } - this.length += right.length; - return true - } - return false - } - - /** - * Mark this Item as deleted. - * - * @param {Transaction} transaction - */ - delete (transaction) { - if (!this.deleted) { - const parent = /** @type {AbstractType} */ (this.parent); - // adjust the length of parent - if (this.countable && this.parentSub === null) { - parent._length -= this.length; - } - this.markDeleted(); - addToDeleteSet(transaction.deleteSet, this.id.client, this.id.clock, this.length); - addChangedTypeToTransaction(transaction, parent, this.parentSub); - this.content.delete(transaction); - } - } - - /** - * @param {StructStore} store - * @param {boolean} parentGCd - */ - gc (store, parentGCd) { - if (!this.deleted) { - throw error.unexpectedCase() - } - this.content.gc(store); - if (parentGCd) { - replaceStruct(store, this, new GC(this.id, this.length)); - } else { - this.content = new ContentDeleted(this.length); - } - } - - /** - * Transform the properties of this type to binary and write it to an - * BinaryEncoder. - * - * This is called when this Item is sent to a remote peer. - * - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - * @param {number} offset - */ - write (encoder, offset) { - const origin = offset > 0 ? createID(this.id.client, this.id.clock + offset - 1) : this.origin; - const rightOrigin = this.rightOrigin; - const parentSub = this.parentSub; - const info = (this.content.getRef() & binary.BITS5) | - (origin === null ? 0 : binary.BIT8) | // origin is defined - (rightOrigin === null ? 0 : binary.BIT7) | // right origin is defined - (parentSub === null ? 0 : binary.BIT6); // parentSub is non-null - encoder.writeInfo(info); - if (origin !== null) { - encoder.writeLeftID(origin); - } - if (rightOrigin !== null) { - encoder.writeRightID(rightOrigin); - } - if (origin === null && rightOrigin === null) { - const parent = /** @type {AbstractType} */ (this.parent); - if (parent._item !== undefined) { - const parentItem = parent._item; - if (parentItem === null) { - // parent type on y._map - // find the correct key - const ykey = findRootTypeKey(parent); - encoder.writeParentInfo(true); // write parentYKey - encoder.writeString(ykey); - } else { - encoder.writeParentInfo(false); // write parent id - encoder.writeLeftID(parentItem.id); - } - } else if (parent.constructor === String) { // this edge case was added by differential updates - encoder.writeParentInfo(true); // write parentYKey - encoder.writeString(parent); - } else if (parent.constructor === ID) { - encoder.writeParentInfo(false); // write parent id - encoder.writeLeftID(parent); - } else { - error.unexpectedCase(); - } - if (parentSub !== null) { - encoder.writeString(parentSub); - } - } - this.content.write(encoder, offset); - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @param {number} info - */ -const readItemContent = (decoder, info) => contentRefs[info & binary.BITS5](decoder); - -/** - * A lookup map for reading Item content. - * - * @type {Array} - */ -const contentRefs = [ - () => { error.unexpectedCase(); }, // GC is not ItemContent - readContentDeleted, // 1 - readContentJSON, // 2 - readContentBinary, // 3 - readContentString, // 4 - readContentEmbed, // 5 - readContentFormat, // 6 - readContentType, // 7 - readContentAny, // 8 - readContentDoc, // 9 - () => { error.unexpectedCase(); } // 10 - Skip is not ItemContent -]; - -const structSkipRefNumber = 10; - -/** - * @private - */ -class Skip extends AbstractStruct { - get deleted () { - return true - } - - delete () {} - - /** - * @param {Skip} right - * @return {boolean} - */ - mergeWith (right) { - if (this.constructor !== right.constructor) { - return false - } - this.length += right.length; - return true - } - - /** - * @param {Transaction} transaction - * @param {number} offset - */ - integrate (transaction, offset) { - // skip structs cannot be integrated - error.unexpectedCase(); - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeInfo(structSkipRefNumber); - // write as VarUint because Skips can't make use of predictable length-encoding - encoding.writeVarUint(encoder.restEncoder, this.length - offset); - } - - /** - * @param {Transaction} transaction - * @param {StructStore} store - * @return {null | number} - */ - getMissing (transaction, store) { - return null - } -} - -/** eslint-env browser */ - - -const glo = /** @type {any} */ (typeof globalThis !== 'undefined' - ? globalThis - : typeof window !== 'undefined' - ? window - // @ts-ignore - : typeof global !== 'undefined' ? global : {}); - -const importIdentifier = '__ $YJS$ __'; - -if (glo[importIdentifier] === true) { - /** - * Dear reader of this message. Please take this seriously. - * - * If you see this message, make sure that you only import one version of Yjs. In many cases, - * your package manager installs two versions of Yjs that are used by different packages within your project. - * Another reason for this message is that some parts of your project use the commonjs version of Yjs - * and others use the EcmaScript version of Yjs. - * - * This often leads to issues that are hard to debug. We often need to perform constructor checks, - * e.g. `struct instanceof GC`. If you imported different versions of Yjs, it is impossible for us to - * do the constructor checks anymore - which might break the CRDT algorithm. - * - * https://github.com/yjs/yjs/issues/438 - */ - console.error('Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438'); -} -glo[importIdentifier] = true; - -export { AbsolutePosition, AbstractConnector, AbstractStruct, AbstractType, YArray as Array, ContentAny, ContentBinary, ContentDeleted, ContentDoc, ContentEmbed, ContentFormat, ContentJSON, ContentString, ContentType, Doc, GC, ID, Item, YMap as Map, PermanentUserData, RelativePosition, Skip, Snapshot, YText as Text, Transaction, UndoManager, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, YXmlElement as XmlElement, YXmlFragment as XmlFragment, YXmlHook as XmlHook, YXmlText as XmlText, YArrayEvent, YEvent, YMapEvent, YTextEvent, YXmlEvent, applyUpdate, applyUpdateV2, cleanupYTextFormatting, compareIDs, compareRelativePositions, convertUpdateFormatV1ToV2, convertUpdateFormatV2ToV1, createAbsolutePositionFromRelativePosition, createDeleteSet, createDeleteSetFromStructStore, createDocFromSnapshot, createID, createRelativePositionFromJSON, createRelativePositionFromTypeIndex, createSnapshot, decodeRelativePosition, decodeSnapshot, decodeSnapshotV2, decodeStateVector, decodeUpdate, decodeUpdateV2, diffUpdate, diffUpdateV2, emptySnapshot, encodeRelativePosition, encodeSnapshot, encodeSnapshotV2, encodeStateAsUpdate, encodeStateAsUpdateV2, encodeStateVector, encodeStateVectorFromUpdate, encodeStateVectorFromUpdateV2, equalDeleteSets, equalSnapshots, findIndexSS, findRootTypeKey, getItem, getItemCleanEnd, getItemCleanStart, getState, getTypeChildren, isDeleted, isParentOf, iterateDeletedStructs, logType, logUpdate, logUpdateV2, mergeDeleteSets, mergeUpdates, mergeUpdatesV2, obfuscateUpdate, obfuscateUpdateV2, parseUpdateMeta, parseUpdateMetaV2, readUpdate, readUpdateV2, relativePositionToJSON, snapshot, snapshotContainsUpdate, transact, tryGc, typeListToArraySnapshot, typeMapGetAllSnapshot, typeMapGetSnapshot }; -//# sourceMappingURL=yjs.mjs.map diff --git a/yjs-poll/node_modules/yjs/dist/yjs.mjs.map b/yjs-poll/node_modules/yjs/dist/yjs.mjs.map deleted file mode 100644 index e45bf86..0000000 --- a/yjs-poll/node_modules/yjs/dist/yjs.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"yjs.mjs","sources":["../src/utils/AbstractConnector.js","../src/utils/DeleteSet.js","../src/utils/Doc.js","../src/utils/UpdateDecoder.js","../src/utils/UpdateEncoder.js","../src/utils/encoding.js","../src/utils/EventHandler.js","../src/utils/ID.js","../src/utils/isParentOf.js","../src/utils/logging.js","../src/utils/PermanentUserData.js","../src/utils/RelativePosition.js","../src/utils/Snapshot.js","../src/utils/StructStore.js","../src/utils/Transaction.js","../src/utils/UndoManager.js","../src/utils/updates.js","../src/utils/YEvent.js","../src/types/AbstractType.js","../src/types/YArray.js","../src/types/YMap.js","../src/types/YText.js","../src/types/YXmlFragment.js","../src/types/YXmlElement.js","../src/types/YXmlEvent.js","../src/types/YXmlHook.js","../src/types/YXmlText.js","../src/structs/AbstractStruct.js","../src/structs/GC.js","../src/structs/ContentBinary.js","../src/structs/ContentDeleted.js","../src/structs/ContentDoc.js","../src/structs/ContentEmbed.js","../src/structs/ContentFormat.js","../src/structs/ContentJSON.js","../src/structs/ContentAny.js","../src/structs/ContentString.js","../src/structs/ContentType.js","../src/structs/Item.js","../src/structs/Skip.js","../src/index.js"],"sourcesContent":["import { ObservableV2 } from 'lib0/observable'\n\nimport {\n Doc // eslint-disable-line\n} from '../internals.js'\n\n/**\n * This is an abstract interface that all Connectors should implement to keep them interchangeable.\n *\n * @note This interface is experimental and it is not advised to actually inherit this class.\n * It just serves as typing information.\n *\n * @extends {ObservableV2}\n */\nexport class AbstractConnector extends ObservableV2 {\n /**\n * @param {Doc} ydoc\n * @param {any} awareness\n */\n constructor (ydoc, awareness) {\n super()\n this.doc = ydoc\n this.awareness = awareness\n }\n}\n","import {\n findIndexSS,\n getState,\n splitItem,\n iterateStructs,\n UpdateEncoderV2,\n DSDecoderV1, DSEncoderV1, DSDecoderV2, DSEncoderV2, Item, GC, StructStore, Transaction, ID // eslint-disable-line\n} from '../internals.js'\n\nimport * as array from 'lib0/array'\nimport * as math from 'lib0/math'\nimport * as map from 'lib0/map'\nimport * as encoding from 'lib0/encoding'\nimport * as decoding from 'lib0/decoding'\n\nexport class DeleteItem {\n /**\n * @param {number} clock\n * @param {number} len\n */\n constructor (clock, len) {\n /**\n * @type {number}\n */\n this.clock = clock\n /**\n * @type {number}\n */\n this.len = len\n }\n}\n\n/**\n * We no longer maintain a DeleteStore. DeleteSet is a temporary object that is created when needed.\n * - When created in a transaction, it must only be accessed after sorting, and merging\n * - This DeleteSet is send to other clients\n * - We do not create a DeleteSet when we send a sync message. The DeleteSet message is created directly from StructStore\n * - We read a DeleteSet as part of a sync/update message. In this case the DeleteSet is already sorted and merged.\n */\nexport class DeleteSet {\n constructor () {\n /**\n * @type {Map>}\n */\n this.clients = new Map()\n }\n}\n\n/**\n * Iterate over all structs that the DeleteSet gc's.\n *\n * @param {Transaction} transaction\n * @param {DeleteSet} ds\n * @param {function(GC|Item):void} f\n *\n * @function\n */\nexport const iterateDeletedStructs = (transaction, ds, f) =>\n ds.clients.forEach((deletes, clientid) => {\n const structs = /** @type {Array} */ (transaction.doc.store.clients.get(clientid))\n if (structs != null) {\n const lastStruct = structs[structs.length - 1]\n const clockState = lastStruct.id.clock + lastStruct.length\n for (let i = 0, del = deletes[i]; i < deletes.length && del.clock < clockState; del = deletes[++i]) {\n iterateStructs(transaction, structs, del.clock, del.len, f)\n }\n }\n })\n\n/**\n * @param {Array} dis\n * @param {number} clock\n * @return {number|null}\n *\n * @private\n * @function\n */\nexport const findIndexDS = (dis, clock) => {\n let left = 0\n let right = dis.length - 1\n while (left <= right) {\n const midindex = math.floor((left + right) / 2)\n const mid = dis[midindex]\n const midclock = mid.clock\n if (midclock <= clock) {\n if (clock < midclock + mid.len) {\n return midindex\n }\n left = midindex + 1\n } else {\n right = midindex - 1\n }\n }\n return null\n}\n\n/**\n * @param {DeleteSet} ds\n * @param {ID} id\n * @return {boolean}\n *\n * @private\n * @function\n */\nexport const isDeleted = (ds, id) => {\n const dis = ds.clients.get(id.client)\n return dis !== undefined && findIndexDS(dis, id.clock) !== null\n}\n\n/**\n * @param {DeleteSet} ds\n *\n * @private\n * @function\n */\nexport const sortAndMergeDeleteSet = ds => {\n ds.clients.forEach(dels => {\n dels.sort((a, b) => a.clock - b.clock)\n // merge items without filtering or splicing the array\n // i is the current pointer\n // j refers to the current insert position for the pointed item\n // try to merge dels[i] into dels[j-1] or set dels[j]=dels[i]\n let i, j\n for (i = 1, j = 1; i < dels.length; i++) {\n const left = dels[j - 1]\n const right = dels[i]\n if (left.clock + left.len >= right.clock) {\n left.len = math.max(left.len, right.clock + right.len - left.clock)\n } else {\n if (j < i) {\n dels[j] = right\n }\n j++\n }\n }\n dels.length = j\n })\n}\n\n/**\n * @param {Array} dss\n * @return {DeleteSet} A fresh DeleteSet\n */\nexport const mergeDeleteSets = dss => {\n const merged = new DeleteSet()\n for (let dssI = 0; dssI < dss.length; dssI++) {\n dss[dssI].clients.forEach((delsLeft, client) => {\n if (!merged.clients.has(client)) {\n // Write all missing keys from current ds and all following.\n // If merged already contains `client` current ds has already been added.\n /**\n * @type {Array}\n */\n const dels = delsLeft.slice()\n for (let i = dssI + 1; i < dss.length; i++) {\n array.appendTo(dels, dss[i].clients.get(client) || [])\n }\n merged.clients.set(client, dels)\n }\n })\n }\n sortAndMergeDeleteSet(merged)\n return merged\n}\n\n/**\n * @param {DeleteSet} ds\n * @param {number} client\n * @param {number} clock\n * @param {number} length\n *\n * @private\n * @function\n */\nexport const addToDeleteSet = (ds, client, clock, length) => {\n map.setIfUndefined(ds.clients, client, () => /** @type {Array} */ ([])).push(new DeleteItem(clock, length))\n}\n\nexport const createDeleteSet = () => new DeleteSet()\n\n/**\n * @param {StructStore} ss\n * @return {DeleteSet} Merged and sorted DeleteSet\n *\n * @private\n * @function\n */\nexport const createDeleteSetFromStructStore = ss => {\n const ds = createDeleteSet()\n ss.clients.forEach((structs, client) => {\n /**\n * @type {Array}\n */\n const dsitems = []\n for (let i = 0; i < structs.length; i++) {\n const struct = structs[i]\n if (struct.deleted) {\n const clock = struct.id.clock\n let len = struct.length\n if (i + 1 < structs.length) {\n for (let next = structs[i + 1]; i + 1 < structs.length && next.deleted; next = structs[++i + 1]) {\n len += next.length\n }\n }\n dsitems.push(new DeleteItem(clock, len))\n }\n }\n if (dsitems.length > 0) {\n ds.clients.set(client, dsitems)\n }\n })\n return ds\n}\n\n/**\n * @param {DSEncoderV1 | DSEncoderV2} encoder\n * @param {DeleteSet} ds\n *\n * @private\n * @function\n */\nexport const writeDeleteSet = (encoder, ds) => {\n encoding.writeVarUint(encoder.restEncoder, ds.clients.size)\n\n // Ensure that the delete set is written in a deterministic order\n array.from(ds.clients.entries())\n .sort((a, b) => b[0] - a[0])\n .forEach(([client, dsitems]) => {\n encoder.resetDsCurVal()\n encoding.writeVarUint(encoder.restEncoder, client)\n const len = dsitems.length\n encoding.writeVarUint(encoder.restEncoder, len)\n for (let i = 0; i < len; i++) {\n const item = dsitems[i]\n encoder.writeDsClock(item.clock)\n encoder.writeDsLen(item.len)\n }\n })\n}\n\n/**\n * @param {DSDecoderV1 | DSDecoderV2} decoder\n * @return {DeleteSet}\n *\n * @private\n * @function\n */\nexport const readDeleteSet = decoder => {\n const ds = new DeleteSet()\n const numClients = decoding.readVarUint(decoder.restDecoder)\n for (let i = 0; i < numClients; i++) {\n decoder.resetDsCurVal()\n const client = decoding.readVarUint(decoder.restDecoder)\n const numberOfDeletes = decoding.readVarUint(decoder.restDecoder)\n if (numberOfDeletes > 0) {\n const dsField = map.setIfUndefined(ds.clients, client, () => /** @type {Array} */ ([]))\n for (let i = 0; i < numberOfDeletes; i++) {\n dsField.push(new DeleteItem(decoder.readDsClock(), decoder.readDsLen()))\n }\n }\n }\n return ds\n}\n\n/**\n * @todo YDecoder also contains references to String and other Decoders. Would make sense to exchange YDecoder.toUint8Array for YDecoder.DsToUint8Array()..\n */\n\n/**\n * @param {DSDecoderV1 | DSDecoderV2} decoder\n * @param {Transaction} transaction\n * @param {StructStore} store\n * @return {Uint8Array|null} Returns a v2 update containing all deletes that couldn't be applied yet; or null if all deletes were applied successfully.\n *\n * @private\n * @function\n */\nexport const readAndApplyDeleteSet = (decoder, transaction, store) => {\n const unappliedDS = new DeleteSet()\n const numClients = decoding.readVarUint(decoder.restDecoder)\n for (let i = 0; i < numClients; i++) {\n decoder.resetDsCurVal()\n const client = decoding.readVarUint(decoder.restDecoder)\n const numberOfDeletes = decoding.readVarUint(decoder.restDecoder)\n const structs = store.clients.get(client) || []\n const state = getState(store, client)\n for (let i = 0; i < numberOfDeletes; i++) {\n const clock = decoder.readDsClock()\n const clockEnd = clock + decoder.readDsLen()\n if (clock < state) {\n if (state < clockEnd) {\n addToDeleteSet(unappliedDS, client, state, clockEnd - state)\n }\n let index = findIndexSS(structs, clock)\n /**\n * We can ignore the case of GC and Delete structs, because we are going to skip them\n * @type {Item}\n */\n // @ts-ignore\n let struct = structs[index]\n // split the first item if necessary\n if (!struct.deleted && struct.id.clock < clock) {\n structs.splice(index + 1, 0, splitItem(transaction, struct, clock - struct.id.clock))\n index++ // increase we now want to use the next struct\n }\n while (index < structs.length) {\n // @ts-ignore\n struct = structs[index++]\n if (struct.id.clock < clockEnd) {\n if (!struct.deleted) {\n if (clockEnd < struct.id.clock + struct.length) {\n structs.splice(index, 0, splitItem(transaction, struct, clockEnd - struct.id.clock))\n }\n struct.delete(transaction)\n }\n } else {\n break\n }\n }\n } else {\n addToDeleteSet(unappliedDS, client, clock, clockEnd - clock)\n }\n }\n }\n if (unappliedDS.clients.size > 0) {\n const ds = new UpdateEncoderV2()\n encoding.writeVarUint(ds.restEncoder, 0) // encode 0 structs\n writeDeleteSet(ds, unappliedDS)\n return ds.toUint8Array()\n }\n return null\n}\n\n/**\n * @param {DeleteSet} ds1\n * @param {DeleteSet} ds2\n */\nexport const equalDeleteSets = (ds1, ds2) => {\n if (ds1.clients.size !== ds2.clients.size) return false\n for (const [client, deleteItems1] of ds1.clients.entries()) {\n const deleteItems2 = /** @type {Array} */ (ds2.clients.get(client))\n if (deleteItems2 === undefined || deleteItems1.length !== deleteItems2.length) return false\n for (let i = 0; i < deleteItems1.length; i++) {\n const di1 = deleteItems1[i]\n const di2 = deleteItems2[i]\n if (di1.clock !== di2.clock || di1.len !== di2.len) {\n return false\n }\n }\n }\n return true\n}\n","/**\n * @module Y\n */\n\nimport {\n StructStore,\n AbstractType,\n YArray,\n YText,\n YMap,\n YXmlElement,\n YXmlFragment,\n transact,\n ContentDoc, Item, Transaction, YEvent // eslint-disable-line\n} from '../internals.js'\n\nimport { ObservableV2 } from 'lib0/observable'\nimport * as random from 'lib0/random'\nimport * as map from 'lib0/map'\nimport * as array from 'lib0/array'\nimport * as promise from 'lib0/promise'\n\nexport const generateNewClientId = random.uint32\n\n/**\n * @typedef {Object} DocOpts\n * @property {boolean} [DocOpts.gc=true] Disable garbage collection (default: gc=true)\n * @property {function(Item):boolean} [DocOpts.gcFilter] Will be called before an Item is garbage collected. Return false to keep the Item.\n * @property {string} [DocOpts.guid] Define a globally unique identifier for this document\n * @property {string | null} [DocOpts.collectionid] Associate this document with a collection. This only plays a role if your provider has a concept of collection.\n * @property {any} [DocOpts.meta] Any kind of meta information you want to associate with this document. If this is a subdocument, remote peers will store the meta information as well.\n * @property {boolean} [DocOpts.autoLoad] If a subdocument, automatically load document. If this is a subdocument, remote peers will load the document as well automatically.\n * @property {boolean} [DocOpts.shouldLoad] Whether the document should be synced by the provider now. This is toggled to true when you call ydoc.load()\n */\n\n/**\n * @typedef {Object} DocEvents\n * @property {function(Doc):void} DocEvents.destroy\n * @property {function(Doc):void} DocEvents.load\n * @property {function(boolean, Doc):void} DocEvents.sync\n * @property {function(Uint8Array, any, Doc, Transaction):void} DocEvents.update\n * @property {function(Uint8Array, any, Doc, Transaction):void} DocEvents.updateV2\n * @property {function(Doc):void} DocEvents.beforeAllTransactions\n * @property {function(Transaction, Doc):void} DocEvents.beforeTransaction\n * @property {function(Transaction, Doc):void} DocEvents.beforeObserverCalls\n * @property {function(Transaction, Doc):void} DocEvents.afterTransaction\n * @property {function(Transaction, Doc):void} DocEvents.afterTransactionCleanup\n * @property {function(Doc, Array):void} DocEvents.afterAllTransactions\n * @property {function({ loaded: Set, added: Set, removed: Set }, Doc, Transaction):void} DocEvents.subdocs\n */\n\n/**\n * A Yjs instance handles the state of shared data.\n * @extends ObservableV2\n */\nexport class Doc extends ObservableV2 {\n /**\n * @param {DocOpts} opts configuration\n */\n constructor ({ guid = random.uuidv4(), collectionid = null, gc = true, gcFilter = () => true, meta = null, autoLoad = false, shouldLoad = true } = {}) {\n super()\n this.gc = gc\n this.gcFilter = gcFilter\n this.clientID = generateNewClientId()\n this.guid = guid\n this.collectionid = collectionid\n /**\n * @type {Map>>}\n */\n this.share = new Map()\n this.store = new StructStore()\n /**\n * @type {Transaction | null}\n */\n this._transaction = null\n /**\n * @type {Array}\n */\n this._transactionCleanups = []\n /**\n * @type {Set}\n */\n this.subdocs = new Set()\n /**\n * If this document is a subdocument - a document integrated into another document - then _item is defined.\n * @type {Item?}\n */\n this._item = null\n this.shouldLoad = shouldLoad\n this.autoLoad = autoLoad\n this.meta = meta\n /**\n * This is set to true when the persistence provider loaded the document from the database or when the `sync` event fires.\n * Note that not all providers implement this feature. Provider authors are encouraged to fire the `load` event when the doc content is loaded from the database.\n *\n * @type {boolean}\n */\n this.isLoaded = false\n /**\n * This is set to true when the connection provider has successfully synced with a backend.\n * Note that when using peer-to-peer providers this event may not provide very useful.\n * Also note that not all providers implement this feature. Provider authors are encouraged to fire\n * the `sync` event when the doc has been synced (with `true` as a parameter) or if connection is\n * lost (with false as a parameter).\n */\n this.isSynced = false\n this.isDestroyed = false\n /**\n * Promise that resolves once the document has been loaded from a persistence provider.\n */\n this.whenLoaded = promise.create(resolve => {\n this.on('load', () => {\n this.isLoaded = true\n resolve(this)\n })\n })\n const provideSyncedPromise = () => promise.create(resolve => {\n /**\n * @param {boolean} isSynced\n */\n const eventHandler = (isSynced) => {\n if (isSynced === undefined || isSynced === true) {\n this.off('sync', eventHandler)\n resolve()\n }\n }\n this.on('sync', eventHandler)\n })\n this.on('sync', isSynced => {\n if (isSynced === false && this.isSynced) {\n this.whenSynced = provideSyncedPromise()\n }\n this.isSynced = isSynced === undefined || isSynced === true\n if (this.isSynced && !this.isLoaded) {\n this.emit('load', [this])\n }\n })\n /**\n * Promise that resolves once the document has been synced with a backend.\n * This promise is recreated when the connection is lost.\n * Note the documentation about the `isSynced` property.\n */\n this.whenSynced = provideSyncedPromise()\n }\n\n /**\n * Notify the parent document that you request to load data into this subdocument (if it is a subdocument).\n *\n * `load()` might be used in the future to request any provider to load the most current data.\n *\n * It is safe to call `load()` multiple times.\n */\n load () {\n const item = this._item\n if (item !== null && !this.shouldLoad) {\n transact(/** @type {any} */ (item.parent).doc, transaction => {\n transaction.subdocsLoaded.add(this)\n }, null, true)\n }\n this.shouldLoad = true\n }\n\n getSubdocs () {\n return this.subdocs\n }\n\n getSubdocGuids () {\n return new Set(array.from(this.subdocs).map(doc => doc.guid))\n }\n\n /**\n * Changes that happen inside of a transaction are bundled. This means that\n * the observer fires _after_ the transaction is finished and that all changes\n * that happened inside of the transaction are sent as one message to the\n * other peers.\n *\n * @template T\n * @param {function(Transaction):T} f The function that should be executed as a transaction\n * @param {any} [origin] Origin of who started the transaction. Will be stored on transaction.origin\n * @return T\n *\n * @public\n */\n transact (f, origin = null) {\n return transact(this, f, origin)\n }\n\n /**\n * Define a shared data type.\n *\n * Multiple calls of `ydoc.get(name, TypeConstructor)` yield the same result\n * and do not overwrite each other. I.e.\n * `ydoc.get(name, Y.Array) === ydoc.get(name, Y.Array)`\n *\n * After this method is called, the type is also available on `ydoc.share.get(name)`.\n *\n * *Best Practices:*\n * Define all types right after the Y.Doc instance is created and store them in a separate object.\n * Also use the typed methods `getText(name)`, `getArray(name)`, ..\n *\n * @template {typeof AbstractType} Type\n * @example\n * const ydoc = new Y.Doc(..)\n * const appState = {\n * document: ydoc.getText('document')\n * comments: ydoc.getArray('comments')\n * }\n *\n * @param {string} name\n * @param {Type} TypeConstructor The constructor of the type definition. E.g. Y.Text, Y.Array, Y.Map, ...\n * @return {InstanceType} The created type. Constructed with TypeConstructor\n *\n * @public\n */\n get (name, TypeConstructor = /** @type {any} */ (AbstractType)) {\n const type = map.setIfUndefined(this.share, name, () => {\n // @ts-ignore\n const t = new TypeConstructor()\n t._integrate(this, null)\n return t\n })\n const Constr = type.constructor\n if (TypeConstructor !== AbstractType && Constr !== TypeConstructor) {\n if (Constr === AbstractType) {\n // @ts-ignore\n const t = new TypeConstructor()\n t._map = type._map\n type._map.forEach(/** @param {Item?} n */ n => {\n for (; n !== null; n = n.left) {\n // @ts-ignore\n n.parent = t\n }\n })\n t._start = type._start\n for (let n = t._start; n !== null; n = n.right) {\n n.parent = t\n }\n t._length = type._length\n this.share.set(name, t)\n t._integrate(this, null)\n return /** @type {InstanceType} */ (t)\n } else {\n throw new Error(`Type with the name ${name} has already been defined with a different constructor`)\n }\n }\n return /** @type {InstanceType} */ (type)\n }\n\n /**\n * @template T\n * @param {string} [name]\n * @return {YArray}\n *\n * @public\n */\n getArray (name = '') {\n return /** @type {YArray} */ (this.get(name, YArray))\n }\n\n /**\n * @param {string} [name]\n * @return {YText}\n *\n * @public\n */\n getText (name = '') {\n return this.get(name, YText)\n }\n\n /**\n * @template T\n * @param {string} [name]\n * @return {YMap}\n *\n * @public\n */\n getMap (name = '') {\n return /** @type {YMap} */ (this.get(name, YMap))\n }\n\n /**\n * @param {string} [name]\n * @return {YXmlElement}\n *\n * @public\n */\n getXmlElement (name = '') {\n return /** @type {YXmlElement<{[key:string]:string}>} */ (this.get(name, YXmlElement))\n }\n\n /**\n * @param {string} [name]\n * @return {YXmlFragment}\n *\n * @public\n */\n getXmlFragment (name = '') {\n return this.get(name, YXmlFragment)\n }\n\n /**\n * Converts the entire document into a js object, recursively traversing each yjs type\n * Doesn't log types that have not been defined (using ydoc.getType(..)).\n *\n * @deprecated Do not use this method and rather call toJSON directly on the shared types.\n *\n * @return {Object}\n */\n toJSON () {\n /**\n * @type {Object}\n */\n const doc = {}\n\n this.share.forEach((value, key) => {\n doc[key] = value.toJSON()\n })\n\n return doc\n }\n\n /**\n * Emit `destroy` event and unregister all event handlers.\n */\n destroy () {\n this.isDestroyed = true\n array.from(this.subdocs).forEach(subdoc => subdoc.destroy())\n const item = this._item\n if (item !== null) {\n this._item = null\n const content = /** @type {ContentDoc} */ (item.content)\n content.doc = new Doc({ guid: this.guid, ...content.opts, shouldLoad: false })\n content.doc._item = item\n transact(/** @type {any} */ (item).parent.doc, transaction => {\n const doc = content.doc\n if (!item.deleted) {\n transaction.subdocsAdded.add(doc)\n }\n transaction.subdocsRemoved.add(this)\n }, null, true)\n }\n // @ts-ignore\n this.emit('destroyed', [true]) // DEPRECATED!\n this.emit('destroy', [this])\n super.destroy()\n }\n}\n","import * as buffer from 'lib0/buffer'\nimport * as decoding from 'lib0/decoding'\nimport {\n ID, createID\n} from '../internals.js'\n\nexport class DSDecoderV1 {\n /**\n * @param {decoding.Decoder} decoder\n */\n constructor (decoder) {\n this.restDecoder = decoder\n }\n\n resetDsCurVal () {\n // nop\n }\n\n /**\n * @return {number}\n */\n readDsClock () {\n return decoding.readVarUint(this.restDecoder)\n }\n\n /**\n * @return {number}\n */\n readDsLen () {\n return decoding.readVarUint(this.restDecoder)\n }\n}\n\nexport class UpdateDecoderV1 extends DSDecoderV1 {\n /**\n * @return {ID}\n */\n readLeftID () {\n return createID(decoding.readVarUint(this.restDecoder), decoding.readVarUint(this.restDecoder))\n }\n\n /**\n * @return {ID}\n */\n readRightID () {\n return createID(decoding.readVarUint(this.restDecoder), decoding.readVarUint(this.restDecoder))\n }\n\n /**\n * Read the next client id.\n * Use this in favor of readID whenever possible to reduce the number of objects created.\n */\n readClient () {\n return decoding.readVarUint(this.restDecoder)\n }\n\n /**\n * @return {number} info An unsigned 8-bit integer\n */\n readInfo () {\n return decoding.readUint8(this.restDecoder)\n }\n\n /**\n * @return {string}\n */\n readString () {\n return decoding.readVarString(this.restDecoder)\n }\n\n /**\n * @return {boolean} isKey\n */\n readParentInfo () {\n return decoding.readVarUint(this.restDecoder) === 1\n }\n\n /**\n * @return {number} info An unsigned 8-bit integer\n */\n readTypeRef () {\n return decoding.readVarUint(this.restDecoder)\n }\n\n /**\n * Write len of a struct - well suited for Opt RLE encoder.\n *\n * @return {number} len\n */\n readLen () {\n return decoding.readVarUint(this.restDecoder)\n }\n\n /**\n * @return {any}\n */\n readAny () {\n return decoding.readAny(this.restDecoder)\n }\n\n /**\n * @return {Uint8Array}\n */\n readBuf () {\n return buffer.copyUint8Array(decoding.readVarUint8Array(this.restDecoder))\n }\n\n /**\n * Legacy implementation uses JSON parse. We use any-decoding in v2.\n *\n * @return {any}\n */\n readJSON () {\n return JSON.parse(decoding.readVarString(this.restDecoder))\n }\n\n /**\n * @return {string}\n */\n readKey () {\n return decoding.readVarString(this.restDecoder)\n }\n}\n\nexport class DSDecoderV2 {\n /**\n * @param {decoding.Decoder} decoder\n */\n constructor (decoder) {\n /**\n * @private\n */\n this.dsCurrVal = 0\n this.restDecoder = decoder\n }\n\n resetDsCurVal () {\n this.dsCurrVal = 0\n }\n\n /**\n * @return {number}\n */\n readDsClock () {\n this.dsCurrVal += decoding.readVarUint(this.restDecoder)\n return this.dsCurrVal\n }\n\n /**\n * @return {number}\n */\n readDsLen () {\n const diff = decoding.readVarUint(this.restDecoder) + 1\n this.dsCurrVal += diff\n return diff\n }\n}\n\nexport class UpdateDecoderV2 extends DSDecoderV2 {\n /**\n * @param {decoding.Decoder} decoder\n */\n constructor (decoder) {\n super(decoder)\n /**\n * List of cached keys. If the keys[id] does not exist, we read a new key\n * from stringEncoder and push it to keys.\n *\n * @type {Array}\n */\n this.keys = []\n decoding.readVarUint(decoder) // read feature flag - currently unused\n this.keyClockDecoder = new decoding.IntDiffOptRleDecoder(decoding.readVarUint8Array(decoder))\n this.clientDecoder = new decoding.UintOptRleDecoder(decoding.readVarUint8Array(decoder))\n this.leftClockDecoder = new decoding.IntDiffOptRleDecoder(decoding.readVarUint8Array(decoder))\n this.rightClockDecoder = new decoding.IntDiffOptRleDecoder(decoding.readVarUint8Array(decoder))\n this.infoDecoder = new decoding.RleDecoder(decoding.readVarUint8Array(decoder), decoding.readUint8)\n this.stringDecoder = new decoding.StringDecoder(decoding.readVarUint8Array(decoder))\n this.parentInfoDecoder = new decoding.RleDecoder(decoding.readVarUint8Array(decoder), decoding.readUint8)\n this.typeRefDecoder = new decoding.UintOptRleDecoder(decoding.readVarUint8Array(decoder))\n this.lenDecoder = new decoding.UintOptRleDecoder(decoding.readVarUint8Array(decoder))\n }\n\n /**\n * @return {ID}\n */\n readLeftID () {\n return new ID(this.clientDecoder.read(), this.leftClockDecoder.read())\n }\n\n /**\n * @return {ID}\n */\n readRightID () {\n return new ID(this.clientDecoder.read(), this.rightClockDecoder.read())\n }\n\n /**\n * Read the next client id.\n * Use this in favor of readID whenever possible to reduce the number of objects created.\n */\n readClient () {\n return this.clientDecoder.read()\n }\n\n /**\n * @return {number} info An unsigned 8-bit integer\n */\n readInfo () {\n return /** @type {number} */ (this.infoDecoder.read())\n }\n\n /**\n * @return {string}\n */\n readString () {\n return this.stringDecoder.read()\n }\n\n /**\n * @return {boolean}\n */\n readParentInfo () {\n return this.parentInfoDecoder.read() === 1\n }\n\n /**\n * @return {number} An unsigned 8-bit integer\n */\n readTypeRef () {\n return this.typeRefDecoder.read()\n }\n\n /**\n * Write len of a struct - well suited for Opt RLE encoder.\n *\n * @return {number}\n */\n readLen () {\n return this.lenDecoder.read()\n }\n\n /**\n * @return {any}\n */\n readAny () {\n return decoding.readAny(this.restDecoder)\n }\n\n /**\n * @return {Uint8Array}\n */\n readBuf () {\n return decoding.readVarUint8Array(this.restDecoder)\n }\n\n /**\n * This is mainly here for legacy purposes.\n *\n * Initial we incoded objects using JSON. Now we use the much faster lib0/any-encoder. This method mainly exists for legacy purposes for the v1 encoder.\n *\n * @return {any}\n */\n readJSON () {\n return decoding.readAny(this.restDecoder)\n }\n\n /**\n * @return {string}\n */\n readKey () {\n const keyClock = this.keyClockDecoder.read()\n if (keyClock < this.keys.length) {\n return this.keys[keyClock]\n } else {\n const key = this.stringDecoder.read()\n this.keys.push(key)\n return key\n }\n }\n}\n","import * as error from 'lib0/error'\nimport * as encoding from 'lib0/encoding'\n\nimport {\n ID // eslint-disable-line\n} from '../internals.js'\n\nexport class DSEncoderV1 {\n constructor () {\n this.restEncoder = encoding.createEncoder()\n }\n\n toUint8Array () {\n return encoding.toUint8Array(this.restEncoder)\n }\n\n resetDsCurVal () {\n // nop\n }\n\n /**\n * @param {number} clock\n */\n writeDsClock (clock) {\n encoding.writeVarUint(this.restEncoder, clock)\n }\n\n /**\n * @param {number} len\n */\n writeDsLen (len) {\n encoding.writeVarUint(this.restEncoder, len)\n }\n}\n\nexport class UpdateEncoderV1 extends DSEncoderV1 {\n /**\n * @param {ID} id\n */\n writeLeftID (id) {\n encoding.writeVarUint(this.restEncoder, id.client)\n encoding.writeVarUint(this.restEncoder, id.clock)\n }\n\n /**\n * @param {ID} id\n */\n writeRightID (id) {\n encoding.writeVarUint(this.restEncoder, id.client)\n encoding.writeVarUint(this.restEncoder, id.clock)\n }\n\n /**\n * Use writeClient and writeClock instead of writeID if possible.\n * @param {number} client\n */\n writeClient (client) {\n encoding.writeVarUint(this.restEncoder, client)\n }\n\n /**\n * @param {number} info An unsigned 8-bit integer\n */\n writeInfo (info) {\n encoding.writeUint8(this.restEncoder, info)\n }\n\n /**\n * @param {string} s\n */\n writeString (s) {\n encoding.writeVarString(this.restEncoder, s)\n }\n\n /**\n * @param {boolean} isYKey\n */\n writeParentInfo (isYKey) {\n encoding.writeVarUint(this.restEncoder, isYKey ? 1 : 0)\n }\n\n /**\n * @param {number} info An unsigned 8-bit integer\n */\n writeTypeRef (info) {\n encoding.writeVarUint(this.restEncoder, info)\n }\n\n /**\n * Write len of a struct - well suited for Opt RLE encoder.\n *\n * @param {number} len\n */\n writeLen (len) {\n encoding.writeVarUint(this.restEncoder, len)\n }\n\n /**\n * @param {any} any\n */\n writeAny (any) {\n encoding.writeAny(this.restEncoder, any)\n }\n\n /**\n * @param {Uint8Array} buf\n */\n writeBuf (buf) {\n encoding.writeVarUint8Array(this.restEncoder, buf)\n }\n\n /**\n * @param {any} embed\n */\n writeJSON (embed) {\n encoding.writeVarString(this.restEncoder, JSON.stringify(embed))\n }\n\n /**\n * @param {string} key\n */\n writeKey (key) {\n encoding.writeVarString(this.restEncoder, key)\n }\n}\n\nexport class DSEncoderV2 {\n constructor () {\n this.restEncoder = encoding.createEncoder() // encodes all the rest / non-optimized\n this.dsCurrVal = 0\n }\n\n toUint8Array () {\n return encoding.toUint8Array(this.restEncoder)\n }\n\n resetDsCurVal () {\n this.dsCurrVal = 0\n }\n\n /**\n * @param {number} clock\n */\n writeDsClock (clock) {\n const diff = clock - this.dsCurrVal\n this.dsCurrVal = clock\n encoding.writeVarUint(this.restEncoder, diff)\n }\n\n /**\n * @param {number} len\n */\n writeDsLen (len) {\n if (len === 0) {\n error.unexpectedCase()\n }\n encoding.writeVarUint(this.restEncoder, len - 1)\n this.dsCurrVal += len\n }\n}\n\nexport class UpdateEncoderV2 extends DSEncoderV2 {\n constructor () {\n super()\n /**\n * @type {Map}\n */\n this.keyMap = new Map()\n /**\n * Refers to the next unique key-identifier to me used.\n * See writeKey method for more information.\n *\n * @type {number}\n */\n this.keyClock = 0\n this.keyClockEncoder = new encoding.IntDiffOptRleEncoder()\n this.clientEncoder = new encoding.UintOptRleEncoder()\n this.leftClockEncoder = new encoding.IntDiffOptRleEncoder()\n this.rightClockEncoder = new encoding.IntDiffOptRleEncoder()\n this.infoEncoder = new encoding.RleEncoder(encoding.writeUint8)\n this.stringEncoder = new encoding.StringEncoder()\n this.parentInfoEncoder = new encoding.RleEncoder(encoding.writeUint8)\n this.typeRefEncoder = new encoding.UintOptRleEncoder()\n this.lenEncoder = new encoding.UintOptRleEncoder()\n }\n\n toUint8Array () {\n const encoder = encoding.createEncoder()\n encoding.writeVarUint(encoder, 0) // this is a feature flag that we might use in the future\n encoding.writeVarUint8Array(encoder, this.keyClockEncoder.toUint8Array())\n encoding.writeVarUint8Array(encoder, this.clientEncoder.toUint8Array())\n encoding.writeVarUint8Array(encoder, this.leftClockEncoder.toUint8Array())\n encoding.writeVarUint8Array(encoder, this.rightClockEncoder.toUint8Array())\n encoding.writeVarUint8Array(encoder, encoding.toUint8Array(this.infoEncoder))\n encoding.writeVarUint8Array(encoder, this.stringEncoder.toUint8Array())\n encoding.writeVarUint8Array(encoder, encoding.toUint8Array(this.parentInfoEncoder))\n encoding.writeVarUint8Array(encoder, this.typeRefEncoder.toUint8Array())\n encoding.writeVarUint8Array(encoder, this.lenEncoder.toUint8Array())\n // @note The rest encoder is appended! (note the missing var)\n encoding.writeUint8Array(encoder, encoding.toUint8Array(this.restEncoder))\n return encoding.toUint8Array(encoder)\n }\n\n /**\n * @param {ID} id\n */\n writeLeftID (id) {\n this.clientEncoder.write(id.client)\n this.leftClockEncoder.write(id.clock)\n }\n\n /**\n * @param {ID} id\n */\n writeRightID (id) {\n this.clientEncoder.write(id.client)\n this.rightClockEncoder.write(id.clock)\n }\n\n /**\n * @param {number} client\n */\n writeClient (client) {\n this.clientEncoder.write(client)\n }\n\n /**\n * @param {number} info An unsigned 8-bit integer\n */\n writeInfo (info) {\n this.infoEncoder.write(info)\n }\n\n /**\n * @param {string} s\n */\n writeString (s) {\n this.stringEncoder.write(s)\n }\n\n /**\n * @param {boolean} isYKey\n */\n writeParentInfo (isYKey) {\n this.parentInfoEncoder.write(isYKey ? 1 : 0)\n }\n\n /**\n * @param {number} info An unsigned 8-bit integer\n */\n writeTypeRef (info) {\n this.typeRefEncoder.write(info)\n }\n\n /**\n * Write len of a struct - well suited for Opt RLE encoder.\n *\n * @param {number} len\n */\n writeLen (len) {\n this.lenEncoder.write(len)\n }\n\n /**\n * @param {any} any\n */\n writeAny (any) {\n encoding.writeAny(this.restEncoder, any)\n }\n\n /**\n * @param {Uint8Array} buf\n */\n writeBuf (buf) {\n encoding.writeVarUint8Array(this.restEncoder, buf)\n }\n\n /**\n * This is mainly here for legacy purposes.\n *\n * Initial we incoded objects using JSON. Now we use the much faster lib0/any-encoder. This method mainly exists for legacy purposes for the v1 encoder.\n *\n * @param {any} embed\n */\n writeJSON (embed) {\n encoding.writeAny(this.restEncoder, embed)\n }\n\n /**\n * Property keys are often reused. For example, in y-prosemirror the key `bold` might\n * occur very often. For a 3d application, the key `position` might occur very often.\n *\n * We cache these keys in a Map and refer to them via a unique number.\n *\n * @param {string} key\n */\n writeKey (key) {\n const clock = this.keyMap.get(key)\n if (clock === undefined) {\n /**\n * @todo uncomment to introduce this feature finally\n *\n * Background. The ContentFormat object was always encoded using writeKey, but the decoder used to use readString.\n * Furthermore, I forgot to set the keyclock. So everything was working fine.\n *\n * However, this feature here is basically useless as it is not being used (it actually only consumes extra memory).\n *\n * I don't know yet how to reintroduce this feature..\n *\n * Older clients won't be able to read updates when we reintroduce this feature. So this should probably be done using a flag.\n *\n */\n // this.keyMap.set(key, this.keyClock)\n this.keyClockEncoder.write(this.keyClock++)\n this.stringEncoder.write(key)\n } else {\n this.keyClockEncoder.write(clock)\n }\n }\n}\n","/**\n * @module encoding\n */\n/*\n * We use the first five bits in the info flag for determining the type of the struct.\n *\n * 0: GC\n * 1: Item with Deleted content\n * 2: Item with JSON content\n * 3: Item with Binary content\n * 4: Item with String content\n * 5: Item with Embed content (for richtext content)\n * 6: Item with Format content (a formatting marker for richtext content)\n * 7: Item with Type\n */\n\nimport {\n findIndexSS,\n getState,\n createID,\n getStateVector,\n readAndApplyDeleteSet,\n writeDeleteSet,\n createDeleteSetFromStructStore,\n transact,\n readItemContent,\n UpdateDecoderV1,\n UpdateDecoderV2,\n UpdateEncoderV1,\n UpdateEncoderV2,\n DSEncoderV2,\n DSDecoderV1,\n DSEncoderV1,\n mergeUpdates,\n mergeUpdatesV2,\n Skip,\n diffUpdateV2,\n convertUpdateFormatV2ToV1,\n DSDecoderV2, Doc, Transaction, GC, Item, StructStore // eslint-disable-line\n} from '../internals.js'\n\nimport * as encoding from 'lib0/encoding'\nimport * as decoding from 'lib0/decoding'\nimport * as binary from 'lib0/binary'\nimport * as map from 'lib0/map'\nimport * as math from 'lib0/math'\nimport * as array from 'lib0/array'\n\n/**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {Array} structs All structs by `client`\n * @param {number} client\n * @param {number} clock write structs starting with `ID(client,clock)`\n *\n * @function\n */\nconst writeStructs = (encoder, structs, client, clock) => {\n // write first id\n clock = math.max(clock, structs[0].id.clock) // make sure the first id exists\n const startNewStructs = findIndexSS(structs, clock)\n // write # encoded structs\n encoding.writeVarUint(encoder.restEncoder, structs.length - startNewStructs)\n encoder.writeClient(client)\n encoding.writeVarUint(encoder.restEncoder, clock)\n const firstStruct = structs[startNewStructs]\n // write first struct with an offset\n firstStruct.write(encoder, clock - firstStruct.id.clock)\n for (let i = startNewStructs + 1; i < structs.length; i++) {\n structs[i].write(encoder, 0)\n }\n}\n\n/**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {StructStore} store\n * @param {Map} _sm\n *\n * @private\n * @function\n */\nexport const writeClientsStructs = (encoder, store, _sm) => {\n // we filter all valid _sm entries into sm\n const sm = new Map()\n _sm.forEach((clock, client) => {\n // only write if new structs are available\n if (getState(store, client) > clock) {\n sm.set(client, clock)\n }\n })\n getStateVector(store).forEach((_clock, client) => {\n if (!_sm.has(client)) {\n sm.set(client, 0)\n }\n })\n // write # states that were updated\n encoding.writeVarUint(encoder.restEncoder, sm.size)\n // Write items with higher client ids first\n // This heavily improves the conflict algorithm.\n array.from(sm.entries()).sort((a, b) => b[0] - a[0]).forEach(([client, clock]) => {\n writeStructs(encoder, /** @type {Array} */ (store.clients.get(client)), client, clock)\n })\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder The decoder object to read data from.\n * @param {Doc} doc\n * @return {Map }>}\n *\n * @private\n * @function\n */\nexport const readClientsStructRefs = (decoder, doc) => {\n /**\n * @type {Map }>}\n */\n const clientRefs = map.create()\n const numOfStateUpdates = decoding.readVarUint(decoder.restDecoder)\n for (let i = 0; i < numOfStateUpdates; i++) {\n const numberOfStructs = decoding.readVarUint(decoder.restDecoder)\n /**\n * @type {Array}\n */\n const refs = new Array(numberOfStructs)\n const client = decoder.readClient()\n let clock = decoding.readVarUint(decoder.restDecoder)\n // const start = performance.now()\n clientRefs.set(client, { i: 0, refs })\n for (let i = 0; i < numberOfStructs; i++) {\n const info = decoder.readInfo()\n switch (binary.BITS5 & info) {\n case 0: { // GC\n const len = decoder.readLen()\n refs[i] = new GC(createID(client, clock), len)\n clock += len\n break\n }\n case 10: { // Skip Struct (nothing to apply)\n // @todo we could reduce the amount of checks by adding Skip struct to clientRefs so we know that something is missing.\n const len = decoding.readVarUint(decoder.restDecoder)\n refs[i] = new Skip(createID(client, clock), len)\n clock += len\n break\n }\n default: { // Item with content\n /**\n * The optimized implementation doesn't use any variables because inlining variables is faster.\n * Below a non-optimized version is shown that implements the basic algorithm with\n * a few comments\n */\n const cantCopyParentInfo = (info & (binary.BIT7 | binary.BIT8)) === 0\n // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y`\n // and we read the next string as parentYKey.\n // It indicates how we store/retrieve parent from `y.share`\n // @type {string|null}\n const struct = new Item(\n createID(client, clock),\n null, // left\n (info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null, // origin\n null, // right\n (info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null, // right origin\n cantCopyParentInfo ? (decoder.readParentInfo() ? doc.get(decoder.readString()) : decoder.readLeftID()) : null, // parent\n cantCopyParentInfo && (info & binary.BIT6) === binary.BIT6 ? decoder.readString() : null, // parentSub\n readItemContent(decoder, info) // item content\n )\n /* A non-optimized implementation of the above algorithm:\n\n // The item that was originally to the left of this item.\n const origin = (info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null\n // The item that was originally to the right of this item.\n const rightOrigin = (info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null\n const cantCopyParentInfo = (info & (binary.BIT7 | binary.BIT8)) === 0\n const hasParentYKey = cantCopyParentInfo ? decoder.readParentInfo() : false\n // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y`\n // and we read the next string as parentYKey.\n // It indicates how we store/retrieve parent from `y.share`\n // @type {string|null}\n const parentYKey = cantCopyParentInfo && hasParentYKey ? decoder.readString() : null\n\n const struct = new Item(\n createID(client, clock),\n null, // left\n origin, // origin\n null, // right\n rightOrigin, // right origin\n cantCopyParentInfo && !hasParentYKey ? decoder.readLeftID() : (parentYKey !== null ? doc.get(parentYKey) : null), // parent\n cantCopyParentInfo && (info & binary.BIT6) === binary.BIT6 ? decoder.readString() : null, // parentSub\n readItemContent(decoder, info) // item content\n )\n */\n refs[i] = struct\n clock += struct.length\n }\n }\n }\n // console.log('time to read: ', performance.now() - start) // @todo remove\n }\n return clientRefs\n}\n\n/**\n * Resume computing structs generated by struct readers.\n *\n * While there is something to do, we integrate structs in this order\n * 1. top element on stack, if stack is not empty\n * 2. next element from current struct reader (if empty, use next struct reader)\n *\n * If struct causally depends on another struct (ref.missing), we put next reader of\n * `ref.id.client` on top of stack.\n *\n * At some point we find a struct that has no causal dependencies,\n * then we start emptying the stack.\n *\n * It is not possible to have circles: i.e. struct1 (from client1) depends on struct2 (from client2)\n * depends on struct3 (from client1). Therefore the max stack size is equal to `structReaders.length`.\n *\n * This method is implemented in a way so that we can resume computation if this update\n * causally depends on another update.\n *\n * @param {Transaction} transaction\n * @param {StructStore} store\n * @param {Map} clientsStructRefs\n * @return { null | { update: Uint8Array, missing: Map } }\n *\n * @private\n * @function\n */\nconst integrateStructs = (transaction, store, clientsStructRefs) => {\n /**\n * @type {Array}\n */\n const stack = []\n // sort them so that we take the higher id first, in case of conflicts the lower id will probably not conflict with the id from the higher user.\n let clientsStructRefsIds = array.from(clientsStructRefs.keys()).sort((a, b) => a - b)\n if (clientsStructRefsIds.length === 0) {\n return null\n }\n const getNextStructTarget = () => {\n if (clientsStructRefsIds.length === 0) {\n return null\n }\n let nextStructsTarget = /** @type {{i:number,refs:Array}} */ (clientsStructRefs.get(clientsStructRefsIds[clientsStructRefsIds.length - 1]))\n while (nextStructsTarget.refs.length === nextStructsTarget.i) {\n clientsStructRefsIds.pop()\n if (clientsStructRefsIds.length > 0) {\n nextStructsTarget = /** @type {{i:number,refs:Array}} */ (clientsStructRefs.get(clientsStructRefsIds[clientsStructRefsIds.length - 1]))\n } else {\n return null\n }\n }\n return nextStructsTarget\n }\n let curStructsTarget = getNextStructTarget()\n if (curStructsTarget === null) {\n return null\n }\n\n /**\n * @type {StructStore}\n */\n const restStructs = new StructStore()\n const missingSV = new Map()\n /**\n * @param {number} client\n * @param {number} clock\n */\n const updateMissingSv = (client, clock) => {\n const mclock = missingSV.get(client)\n if (mclock == null || mclock > clock) {\n missingSV.set(client, clock)\n }\n }\n /**\n * @type {GC|Item}\n */\n let stackHead = /** @type {any} */ (curStructsTarget).refs[/** @type {any} */ (curStructsTarget).i++]\n // caching the state because it is used very often\n const state = new Map()\n\n const addStackToRestSS = () => {\n for (const item of stack) {\n const client = item.id.client\n const inapplicableItems = clientsStructRefs.get(client)\n if (inapplicableItems) {\n // decrement because we weren't able to apply previous operation\n inapplicableItems.i--\n restStructs.clients.set(client, inapplicableItems.refs.slice(inapplicableItems.i))\n clientsStructRefs.delete(client)\n inapplicableItems.i = 0\n inapplicableItems.refs = []\n } else {\n // item was the last item on clientsStructRefs and the field was already cleared. Add item to restStructs and continue\n restStructs.clients.set(client, [item])\n }\n // remove client from clientsStructRefsIds to prevent users from applying the same update again\n clientsStructRefsIds = clientsStructRefsIds.filter(c => c !== client)\n }\n stack.length = 0\n }\n\n // iterate over all struct readers until we are done\n while (true) {\n if (stackHead.constructor !== Skip) {\n const localClock = map.setIfUndefined(state, stackHead.id.client, () => getState(store, stackHead.id.client))\n const offset = localClock - stackHead.id.clock\n if (offset < 0) {\n // update from the same client is missing\n stack.push(stackHead)\n updateMissingSv(stackHead.id.client, stackHead.id.clock - 1)\n // hid a dead wall, add all items from stack to restSS\n addStackToRestSS()\n } else {\n const missing = stackHead.getMissing(transaction, store)\n if (missing !== null) {\n stack.push(stackHead)\n // get the struct reader that has the missing struct\n /**\n * @type {{ refs: Array, i: number }}\n */\n const structRefs = clientsStructRefs.get(/** @type {number} */ (missing)) || { refs: [], i: 0 }\n if (structRefs.refs.length === structRefs.i) {\n // This update message causally depends on another update message that doesn't exist yet\n updateMissingSv(/** @type {number} */ (missing), getState(store, missing))\n addStackToRestSS()\n } else {\n stackHead = structRefs.refs[structRefs.i++]\n continue\n }\n } else if (offset === 0 || offset < stackHead.length) {\n // all fine, apply the stackhead\n stackHead.integrate(transaction, offset)\n state.set(stackHead.id.client, stackHead.id.clock + stackHead.length)\n }\n }\n }\n // iterate to next stackHead\n if (stack.length > 0) {\n stackHead = /** @type {GC|Item} */ (stack.pop())\n } else if (curStructsTarget !== null && curStructsTarget.i < curStructsTarget.refs.length) {\n stackHead = /** @type {GC|Item} */ (curStructsTarget.refs[curStructsTarget.i++])\n } else {\n curStructsTarget = getNextStructTarget()\n if (curStructsTarget === null) {\n // we are done!\n break\n } else {\n stackHead = /** @type {GC|Item} */ (curStructsTarget.refs[curStructsTarget.i++])\n }\n }\n }\n if (restStructs.clients.size > 0) {\n const encoder = new UpdateEncoderV2()\n writeClientsStructs(encoder, restStructs, new Map())\n // write empty deleteset\n // writeDeleteSet(encoder, new DeleteSet())\n encoding.writeVarUint(encoder.restEncoder, 0) // => no need for an extra function call, just write 0 deletes\n return { missing: missingSV, update: encoder.toUint8Array() }\n }\n return null\n}\n\n/**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {Transaction} transaction\n *\n * @private\n * @function\n */\nexport const writeStructsFromTransaction = (encoder, transaction) => writeClientsStructs(encoder, transaction.doc.store, transaction.beforeState)\n\n/**\n * Read and apply a document update.\n *\n * This function has the same effect as `applyUpdate` but accepts a decoder.\n *\n * @param {decoding.Decoder} decoder\n * @param {Doc} ydoc\n * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))`\n * @param {UpdateDecoderV1 | UpdateDecoderV2} [structDecoder]\n *\n * @function\n */\nexport const readUpdateV2 = (decoder, ydoc, transactionOrigin, structDecoder = new UpdateDecoderV2(decoder)) =>\n transact(ydoc, transaction => {\n // force that transaction.local is set to non-local\n transaction.local = false\n let retry = false\n const doc = transaction.doc\n const store = doc.store\n // let start = performance.now()\n const ss = readClientsStructRefs(structDecoder, doc)\n // console.log('time to read structs: ', performance.now() - start) // @todo remove\n // start = performance.now()\n // console.log('time to merge: ', performance.now() - start) // @todo remove\n // start = performance.now()\n const restStructs = integrateStructs(transaction, store, ss)\n const pending = store.pendingStructs\n if (pending) {\n // check if we can apply something\n for (const [client, clock] of pending.missing) {\n if (clock < getState(store, client)) {\n retry = true\n break\n }\n }\n if (restStructs) {\n // merge restStructs into store.pending\n for (const [client, clock] of restStructs.missing) {\n const mclock = pending.missing.get(client)\n if (mclock == null || mclock > clock) {\n pending.missing.set(client, clock)\n }\n }\n pending.update = mergeUpdatesV2([pending.update, restStructs.update])\n }\n } else {\n store.pendingStructs = restStructs\n }\n // console.log('time to integrate: ', performance.now() - start) // @todo remove\n // start = performance.now()\n const dsRest = readAndApplyDeleteSet(structDecoder, transaction, store)\n if (store.pendingDs) {\n // @todo we could make a lower-bound state-vector check as we do above\n const pendingDSUpdate = new UpdateDecoderV2(decoding.createDecoder(store.pendingDs))\n decoding.readVarUint(pendingDSUpdate.restDecoder) // read 0 structs, because we only encode deletes in pendingdsupdate\n const dsRest2 = readAndApplyDeleteSet(pendingDSUpdate, transaction, store)\n if (dsRest && dsRest2) {\n // case 1: ds1 != null && ds2 != null\n store.pendingDs = mergeUpdatesV2([dsRest, dsRest2])\n } else {\n // case 2: ds1 != null\n // case 3: ds2 != null\n // case 4: ds1 == null && ds2 == null\n store.pendingDs = dsRest || dsRest2\n }\n } else {\n // Either dsRest == null && pendingDs == null OR dsRest != null\n store.pendingDs = dsRest\n }\n // console.log('time to cleanup: ', performance.now() - start) // @todo remove\n // start = performance.now()\n\n // console.log('time to resume delete readers: ', performance.now() - start) // @todo remove\n // start = performance.now()\n if (retry) {\n const update = /** @type {{update: Uint8Array}} */ (store.pendingStructs).update\n store.pendingStructs = null\n applyUpdateV2(transaction.doc, update)\n }\n }, transactionOrigin, false)\n\n/**\n * Read and apply a document update.\n *\n * This function has the same effect as `applyUpdate` but accepts a decoder.\n *\n * @param {decoding.Decoder} decoder\n * @param {Doc} ydoc\n * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))`\n *\n * @function\n */\nexport const readUpdate = (decoder, ydoc, transactionOrigin) => readUpdateV2(decoder, ydoc, transactionOrigin, new UpdateDecoderV1(decoder))\n\n/**\n * Apply a document update created by, for example, `y.on('update', update => ..)` or `update = encodeStateAsUpdate()`.\n *\n * This function has the same effect as `readUpdate` but accepts an Uint8Array instead of a Decoder.\n *\n * @param {Doc} ydoc\n * @param {Uint8Array} update\n * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))`\n * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder]\n *\n * @function\n */\nexport const applyUpdateV2 = (ydoc, update, transactionOrigin, YDecoder = UpdateDecoderV2) => {\n const decoder = decoding.createDecoder(update)\n readUpdateV2(decoder, ydoc, transactionOrigin, new YDecoder(decoder))\n}\n\n/**\n * Apply a document update created by, for example, `y.on('update', update => ..)` or `update = encodeStateAsUpdate()`.\n *\n * This function has the same effect as `readUpdate` but accepts an Uint8Array instead of a Decoder.\n *\n * @param {Doc} ydoc\n * @param {Uint8Array} update\n * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))`\n *\n * @function\n */\nexport const applyUpdate = (ydoc, update, transactionOrigin) => applyUpdateV2(ydoc, update, transactionOrigin, UpdateDecoderV1)\n\n/**\n * Write all the document as a single update message. If you specify the state of the remote client (`targetStateVector`) it will\n * only write the operations that are missing.\n *\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {Doc} doc\n * @param {Map} [targetStateVector] The state of the target that receives the update. Leave empty to write all known structs\n *\n * @function\n */\nexport const writeStateAsUpdate = (encoder, doc, targetStateVector = new Map()) => {\n writeClientsStructs(encoder, doc.store, targetStateVector)\n writeDeleteSet(encoder, createDeleteSetFromStructStore(doc.store))\n}\n\n/**\n * Write all the document as a single update message that can be applied on the remote document. If you specify the state of the remote client (`targetState`) it will\n * only write the operations that are missing.\n *\n * Use `writeStateAsUpdate` instead if you are working with lib0/encoding.js#Encoder\n *\n * @param {Doc} doc\n * @param {Uint8Array} [encodedTargetStateVector] The state of the target that receives the update. Leave empty to write all known structs\n * @param {UpdateEncoderV1 | UpdateEncoderV2} [encoder]\n * @return {Uint8Array}\n *\n * @function\n */\nexport const encodeStateAsUpdateV2 = (doc, encodedTargetStateVector = new Uint8Array([0]), encoder = new UpdateEncoderV2()) => {\n const targetStateVector = decodeStateVector(encodedTargetStateVector)\n writeStateAsUpdate(encoder, doc, targetStateVector)\n const updates = [encoder.toUint8Array()]\n // also add the pending updates (if there are any)\n if (doc.store.pendingDs) {\n updates.push(doc.store.pendingDs)\n }\n if (doc.store.pendingStructs) {\n updates.push(diffUpdateV2(doc.store.pendingStructs.update, encodedTargetStateVector))\n }\n if (updates.length > 1) {\n if (encoder.constructor === UpdateEncoderV1) {\n return mergeUpdates(updates.map((update, i) => i === 0 ? update : convertUpdateFormatV2ToV1(update)))\n } else if (encoder.constructor === UpdateEncoderV2) {\n return mergeUpdatesV2(updates)\n }\n }\n return updates[0]\n}\n\n/**\n * Write all the document as a single update message that can be applied on the remote document. If you specify the state of the remote client (`targetState`) it will\n * only write the operations that are missing.\n *\n * Use `writeStateAsUpdate` instead if you are working with lib0/encoding.js#Encoder\n *\n * @param {Doc} doc\n * @param {Uint8Array} [encodedTargetStateVector] The state of the target that receives the update. Leave empty to write all known structs\n * @return {Uint8Array}\n *\n * @function\n */\nexport const encodeStateAsUpdate = (doc, encodedTargetStateVector) => encodeStateAsUpdateV2(doc, encodedTargetStateVector, new UpdateEncoderV1())\n\n/**\n * Read state vector from Decoder and return as Map\n *\n * @param {DSDecoderV1 | DSDecoderV2} decoder\n * @return {Map} Maps `client` to the number next expected `clock` from that client.\n *\n * @function\n */\nexport const readStateVector = decoder => {\n const ss = new Map()\n const ssLength = decoding.readVarUint(decoder.restDecoder)\n for (let i = 0; i < ssLength; i++) {\n const client = decoding.readVarUint(decoder.restDecoder)\n const clock = decoding.readVarUint(decoder.restDecoder)\n ss.set(client, clock)\n }\n return ss\n}\n\n/**\n * Read decodedState and return State as Map.\n *\n * @param {Uint8Array} decodedState\n * @return {Map} Maps `client` to the number next expected `clock` from that client.\n *\n * @function\n */\n// export const decodeStateVectorV2 = decodedState => readStateVector(new DSDecoderV2(decoding.createDecoder(decodedState)))\n\n/**\n * Read decodedState and return State as Map.\n *\n * @param {Uint8Array} decodedState\n * @return {Map} Maps `client` to the number next expected `clock` from that client.\n *\n * @function\n */\nexport const decodeStateVector = decodedState => readStateVector(new DSDecoderV1(decoding.createDecoder(decodedState)))\n\n/**\n * @param {DSEncoderV1 | DSEncoderV2} encoder\n * @param {Map} sv\n * @function\n */\nexport const writeStateVector = (encoder, sv) => {\n encoding.writeVarUint(encoder.restEncoder, sv.size)\n array.from(sv.entries()).sort((a, b) => b[0] - a[0]).forEach(([client, clock]) => {\n encoding.writeVarUint(encoder.restEncoder, client) // @todo use a special client decoder that is based on mapping\n encoding.writeVarUint(encoder.restEncoder, clock)\n })\n return encoder\n}\n\n/**\n * @param {DSEncoderV1 | DSEncoderV2} encoder\n * @param {Doc} doc\n *\n * @function\n */\nexport const writeDocumentStateVector = (encoder, doc) => writeStateVector(encoder, getStateVector(doc.store))\n\n/**\n * Encode State as Uint8Array.\n *\n * @param {Doc|Map} doc\n * @param {DSEncoderV1 | DSEncoderV2} [encoder]\n * @return {Uint8Array}\n *\n * @function\n */\nexport const encodeStateVectorV2 = (doc, encoder = new DSEncoderV2()) => {\n if (doc instanceof Map) {\n writeStateVector(encoder, doc)\n } else {\n writeDocumentStateVector(encoder, doc)\n }\n return encoder.toUint8Array()\n}\n\n/**\n * Encode State as Uint8Array.\n *\n * @param {Doc|Map} doc\n * @return {Uint8Array}\n *\n * @function\n */\nexport const encodeStateVector = doc => encodeStateVectorV2(doc, new DSEncoderV1())\n","import * as f from 'lib0/function'\n\n/**\n * General event handler implementation.\n *\n * @template ARG0, ARG1\n *\n * @private\n */\nexport class EventHandler {\n constructor () {\n /**\n * @type {Array}\n */\n this.l = []\n }\n}\n\n/**\n * @template ARG0,ARG1\n * @returns {EventHandler}\n *\n * @private\n * @function\n */\nexport const createEventHandler = () => new EventHandler()\n\n/**\n * Adds an event listener that is called when\n * {@link EventHandler#callEventListeners} is called.\n *\n * @template ARG0,ARG1\n * @param {EventHandler} eventHandler\n * @param {function(ARG0,ARG1):void} f The event handler.\n *\n * @private\n * @function\n */\nexport const addEventHandlerListener = (eventHandler, f) =>\n eventHandler.l.push(f)\n\n/**\n * Removes an event listener.\n *\n * @template ARG0,ARG1\n * @param {EventHandler} eventHandler\n * @param {function(ARG0,ARG1):void} f The event handler that was added with\n * {@link EventHandler#addEventListener}\n *\n * @private\n * @function\n */\nexport const removeEventHandlerListener = (eventHandler, f) => {\n const l = eventHandler.l\n const len = l.length\n eventHandler.l = l.filter(g => f !== g)\n if (len === eventHandler.l.length) {\n console.error('[yjs] Tried to remove event handler that doesn\\'t exist.')\n }\n}\n\n/**\n * Removes all event listeners.\n * @template ARG0,ARG1\n * @param {EventHandler} eventHandler\n *\n * @private\n * @function\n */\nexport const removeAllEventHandlerListeners = eventHandler => {\n eventHandler.l.length = 0\n}\n\n/**\n * Call all event listeners that were added via\n * {@link EventHandler#addEventListener}.\n *\n * @template ARG0,ARG1\n * @param {EventHandler} eventHandler\n * @param {ARG0} arg0\n * @param {ARG1} arg1\n *\n * @private\n * @function\n */\nexport const callEventHandlerListeners = (eventHandler, arg0, arg1) =>\n f.callAll(eventHandler.l, [arg0, arg1])\n","import { AbstractType } from '../internals.js' // eslint-disable-line\n\nimport * as decoding from 'lib0/decoding'\nimport * as encoding from 'lib0/encoding'\nimport * as error from 'lib0/error'\n\nexport class ID {\n /**\n * @param {number} client client id\n * @param {number} clock unique per client id, continuous number\n */\n constructor (client, clock) {\n /**\n * Client id\n * @type {number}\n */\n this.client = client\n /**\n * unique per client id, continuous number\n * @type {number}\n */\n this.clock = clock\n }\n}\n\n/**\n * @param {ID | null} a\n * @param {ID | null} b\n * @return {boolean}\n *\n * @function\n */\nexport const compareIDs = (a, b) => a === b || (a !== null && b !== null && a.client === b.client && a.clock === b.clock)\n\n/**\n * @param {number} client\n * @param {number} clock\n *\n * @private\n * @function\n */\nexport const createID = (client, clock) => new ID(client, clock)\n\n/**\n * @param {encoding.Encoder} encoder\n * @param {ID} id\n *\n * @private\n * @function\n */\nexport const writeID = (encoder, id) => {\n encoding.writeVarUint(encoder, id.client)\n encoding.writeVarUint(encoder, id.clock)\n}\n\n/**\n * Read ID.\n * * If first varUint read is 0xFFFFFF a RootID is returned.\n * * Otherwise an ID is returned\n *\n * @param {decoding.Decoder} decoder\n * @return {ID}\n *\n * @private\n * @function\n */\nexport const readID = decoder =>\n createID(decoding.readVarUint(decoder), decoding.readVarUint(decoder))\n\n/**\n * The top types are mapped from y.share.get(keyname) => type.\n * `type` does not store any information about the `keyname`.\n * This function finds the correct `keyname` for `type` and throws otherwise.\n *\n * @param {AbstractType} type\n * @return {string}\n *\n * @private\n * @function\n */\nexport const findRootTypeKey = type => {\n // @ts-ignore _y must be defined, otherwise unexpected case\n for (const [key, value] of type.doc.share.entries()) {\n if (value === type) {\n return key\n }\n }\n throw error.unexpectedCase()\n}\n","import { AbstractType, Item } from '../internals.js' // eslint-disable-line\n\n/**\n * Check if `parent` is a parent of `child`.\n *\n * @param {AbstractType} parent\n * @param {Item|null} child\n * @return {Boolean} Whether `parent` is a parent of `child`.\n *\n * @private\n * @function\n */\nexport const isParentOf = (parent, child) => {\n while (child !== null) {\n if (child.parent === parent) {\n return true\n }\n child = /** @type {AbstractType} */ (child.parent)._item\n }\n return false\n}\n","import {\n AbstractType // eslint-disable-line\n} from '../internals.js'\n\n/**\n * Convenient helper to log type information.\n *\n * Do not use in productive systems as the output can be immense!\n *\n * @param {AbstractType} type\n */\nexport const logType = type => {\n const res = []\n let n = type._start\n while (n) {\n res.push(n)\n n = n.right\n }\n console.log('Children: ', res)\n console.log('Children content: ', res.filter(m => !m.deleted).map(m => m.content))\n}\n","import {\n YArray,\n YMap,\n readDeleteSet,\n writeDeleteSet,\n createDeleteSet,\n DSEncoderV1, DSDecoderV1, ID, DeleteSet, YArrayEvent, Transaction, Doc // eslint-disable-line\n} from '../internals.js'\n\nimport * as decoding from 'lib0/decoding'\n\nimport { mergeDeleteSets, isDeleted } from './DeleteSet.js'\n\nexport class PermanentUserData {\n /**\n * @param {Doc} doc\n * @param {YMap} [storeType]\n */\n constructor (doc, storeType = doc.getMap('users')) {\n /**\n * @type {Map}\n */\n const dss = new Map()\n this.yusers = storeType\n this.doc = doc\n /**\n * Maps from clientid to userDescription\n *\n * @type {Map}\n */\n this.clients = new Map()\n this.dss = dss\n /**\n * @param {YMap} user\n * @param {string} userDescription\n */\n const initUser = (user, userDescription) => {\n /**\n * @type {YArray}\n */\n const ds = user.get('ds')\n const ids = user.get('ids')\n const addClientId = /** @param {number} clientid */ clientid => this.clients.set(clientid, userDescription)\n ds.observe(/** @param {YArrayEvent} event */ event => {\n event.changes.added.forEach(item => {\n item.content.getContent().forEach(encodedDs => {\n if (encodedDs instanceof Uint8Array) {\n this.dss.set(userDescription, mergeDeleteSets([this.dss.get(userDescription) || createDeleteSet(), readDeleteSet(new DSDecoderV1(decoding.createDecoder(encodedDs)))]))\n }\n })\n })\n })\n this.dss.set(userDescription, mergeDeleteSets(ds.map(encodedDs => readDeleteSet(new DSDecoderV1(decoding.createDecoder(encodedDs))))))\n ids.observe(/** @param {YArrayEvent} event */ event =>\n event.changes.added.forEach(item => item.content.getContent().forEach(addClientId))\n )\n ids.forEach(addClientId)\n }\n // observe users\n storeType.observe(event => {\n event.keysChanged.forEach(userDescription =>\n initUser(storeType.get(userDescription), userDescription)\n )\n })\n // add initial data\n storeType.forEach(initUser)\n }\n\n /**\n * @param {Doc} doc\n * @param {number} clientid\n * @param {string} userDescription\n * @param {Object} conf\n * @param {function(Transaction, DeleteSet):boolean} [conf.filter]\n */\n setUserMapping (doc, clientid, userDescription, { filter = () => true } = {}) {\n const users = this.yusers\n let user = users.get(userDescription)\n if (!user) {\n user = new YMap()\n user.set('ids', new YArray())\n user.set('ds', new YArray())\n users.set(userDescription, user)\n }\n user.get('ids').push([clientid])\n users.observe(_event => {\n setTimeout(() => {\n const userOverwrite = users.get(userDescription)\n if (userOverwrite !== user) {\n // user was overwritten, port all data over to the next user object\n // @todo Experiment with Y.Sets here\n user = userOverwrite\n // @todo iterate over old type\n this.clients.forEach((_userDescription, clientid) => {\n if (userDescription === _userDescription) {\n user.get('ids').push([clientid])\n }\n })\n const encoder = new DSEncoderV1()\n const ds = this.dss.get(userDescription)\n if (ds) {\n writeDeleteSet(encoder, ds)\n user.get('ds').push([encoder.toUint8Array()])\n }\n }\n }, 0)\n })\n doc.on('afterTransaction', /** @param {Transaction} transaction */ transaction => {\n setTimeout(() => {\n const yds = user.get('ds')\n const ds = transaction.deleteSet\n if (transaction.local && ds.clients.size > 0 && filter(transaction, ds)) {\n const encoder = new DSEncoderV1()\n writeDeleteSet(encoder, ds)\n yds.push([encoder.toUint8Array()])\n }\n })\n })\n }\n\n /**\n * @param {number} clientid\n * @return {any}\n */\n getUserByClientId (clientid) {\n return this.clients.get(clientid) || null\n }\n\n /**\n * @param {ID} id\n * @return {string | null}\n */\n getUserByDeletedId (id) {\n for (const [userDescription, ds] of this.dss.entries()) {\n if (isDeleted(ds, id)) {\n return userDescription\n }\n }\n return null\n }\n}\n","import {\n writeID,\n readID,\n compareIDs,\n getState,\n findRootTypeKey,\n Item,\n createID,\n ContentType,\n followRedone,\n getItem,\n StructStore, ID, Doc, AbstractType, // eslint-disable-line\n} from '../internals.js'\n\nimport * as encoding from 'lib0/encoding'\nimport * as decoding from 'lib0/decoding'\nimport * as error from 'lib0/error'\n\n/**\n * A relative position is based on the Yjs model and is not affected by document changes.\n * E.g. If you place a relative position before a certain character, it will always point to this character.\n * If you place a relative position at the end of a type, it will always point to the end of the type.\n *\n * A numeric position is often unsuited for user selections, because it does not change when content is inserted\n * before or after.\n *\n * ```Insert(0, 'x')('a|bc') = 'xa|bc'``` Where | is the relative position.\n *\n * One of the properties must be defined.\n *\n * @example\n * // Current cursor position is at position 10\n * const relativePosition = createRelativePositionFromIndex(yText, 10)\n * // modify yText\n * yText.insert(0, 'abc')\n * yText.delete(3, 10)\n * // Compute the cursor position\n * const absolutePosition = createAbsolutePositionFromRelativePosition(y, relativePosition)\n * absolutePosition.type === yText // => true\n * console.log('cursor location is ' + absolutePosition.index) // => cursor location is 3\n *\n */\nexport class RelativePosition {\n /**\n * @param {ID|null} type\n * @param {string|null} tname\n * @param {ID|null} item\n * @param {number} assoc\n */\n constructor (type, tname, item, assoc = 0) {\n /**\n * @type {ID|null}\n */\n this.type = type\n /**\n * @type {string|null}\n */\n this.tname = tname\n /**\n * @type {ID | null}\n */\n this.item = item\n /**\n * A relative position is associated to a specific character. By default\n * assoc >= 0, the relative position is associated to the character\n * after the meant position.\n * I.e. position 1 in 'ab' is associated to character 'b'.\n *\n * If assoc < 0, then the relative position is associated to the character\n * before the meant position.\n *\n * @type {number}\n */\n this.assoc = assoc\n }\n}\n\n/**\n * @param {RelativePosition} rpos\n * @return {any}\n */\nexport const relativePositionToJSON = rpos => {\n const json = {}\n if (rpos.type) {\n json.type = rpos.type\n }\n if (rpos.tname) {\n json.tname = rpos.tname\n }\n if (rpos.item) {\n json.item = rpos.item\n }\n if (rpos.assoc != null) {\n json.assoc = rpos.assoc\n }\n return json\n}\n\n/**\n * @param {any} json\n * @return {RelativePosition}\n *\n * @function\n */\nexport const createRelativePositionFromJSON = json => new RelativePosition(json.type == null ? null : createID(json.type.client, json.type.clock), json.tname ?? null, json.item == null ? null : createID(json.item.client, json.item.clock), json.assoc == null ? 0 : json.assoc)\n\nexport class AbsolutePosition {\n /**\n * @param {AbstractType} type\n * @param {number} index\n * @param {number} [assoc]\n */\n constructor (type, index, assoc = 0) {\n /**\n * @type {AbstractType}\n */\n this.type = type\n /**\n * @type {number}\n */\n this.index = index\n this.assoc = assoc\n }\n}\n\n/**\n * @param {AbstractType} type\n * @param {number} index\n * @param {number} [assoc]\n *\n * @function\n */\nexport const createAbsolutePosition = (type, index, assoc = 0) => new AbsolutePosition(type, index, assoc)\n\n/**\n * @param {AbstractType} type\n * @param {ID|null} item\n * @param {number} [assoc]\n *\n * @function\n */\nexport const createRelativePosition = (type, item, assoc) => {\n let typeid = null\n let tname = null\n if (type._item === null) {\n tname = findRootTypeKey(type)\n } else {\n typeid = createID(type._item.id.client, type._item.id.clock)\n }\n return new RelativePosition(typeid, tname, item, assoc)\n}\n\n/**\n * Create a relativePosition based on a absolute position.\n *\n * @param {AbstractType} type The base type (e.g. YText or YArray).\n * @param {number} index The absolute position.\n * @param {number} [assoc]\n * @return {RelativePosition}\n *\n * @function\n */\nexport const createRelativePositionFromTypeIndex = (type, index, assoc = 0) => {\n let t = type._start\n if (assoc < 0) {\n // associated to the left character or the beginning of a type, increment index if possible.\n if (index === 0) {\n return createRelativePosition(type, null, assoc)\n }\n index--\n }\n while (t !== null) {\n if (!t.deleted && t.countable) {\n if (t.length > index) {\n // case 1: found position somewhere in the linked list\n return createRelativePosition(type, createID(t.id.client, t.id.clock + index), assoc)\n }\n index -= t.length\n }\n if (t.right === null && assoc < 0) {\n // left-associated position, return last available id\n return createRelativePosition(type, t.lastId, assoc)\n }\n t = t.right\n }\n return createRelativePosition(type, null, assoc)\n}\n\n/**\n * @param {encoding.Encoder} encoder\n * @param {RelativePosition} rpos\n *\n * @function\n */\nexport const writeRelativePosition = (encoder, rpos) => {\n const { type, tname, item, assoc } = rpos\n if (item !== null) {\n encoding.writeVarUint(encoder, 0)\n writeID(encoder, item)\n } else if (tname !== null) {\n // case 2: found position at the end of the list and type is stored in y.share\n encoding.writeUint8(encoder, 1)\n encoding.writeVarString(encoder, tname)\n } else if (type !== null) {\n // case 3: found position at the end of the list and type is attached to an item\n encoding.writeUint8(encoder, 2)\n writeID(encoder, type)\n } else {\n throw error.unexpectedCase()\n }\n encoding.writeVarInt(encoder, assoc)\n return encoder\n}\n\n/**\n * @param {RelativePosition} rpos\n * @return {Uint8Array}\n */\nexport const encodeRelativePosition = rpos => {\n const encoder = encoding.createEncoder()\n writeRelativePosition(encoder, rpos)\n return encoding.toUint8Array(encoder)\n}\n\n/**\n * @param {decoding.Decoder} decoder\n * @return {RelativePosition}\n *\n * @function\n */\nexport const readRelativePosition = decoder => {\n let type = null\n let tname = null\n let itemID = null\n switch (decoding.readVarUint(decoder)) {\n case 0:\n // case 1: found position somewhere in the linked list\n itemID = readID(decoder)\n break\n case 1:\n // case 2: found position at the end of the list and type is stored in y.share\n tname = decoding.readVarString(decoder)\n break\n case 2: {\n // case 3: found position at the end of the list and type is attached to an item\n type = readID(decoder)\n }\n }\n const assoc = decoding.hasContent(decoder) ? decoding.readVarInt(decoder) : 0\n return new RelativePosition(type, tname, itemID, assoc)\n}\n\n/**\n * @param {Uint8Array} uint8Array\n * @return {RelativePosition}\n */\nexport const decodeRelativePosition = uint8Array => readRelativePosition(decoding.createDecoder(uint8Array))\n\n/**\n * @param {StructStore} store\n * @param {ID} id\n */\nconst getItemWithOffset = (store, id) => {\n const item = getItem(store, id)\n const diff = id.clock - item.id.clock\n return {\n item, diff\n }\n}\n\n/**\n * Transform a relative position to an absolute position.\n *\n * If you want to share the relative position with other users, you should set\n * `followUndoneDeletions` to false to get consistent results across all clients.\n *\n * When calculating the absolute position, we try to follow the \"undone deletions\". This yields\n * better results for the user who performed undo. However, only the user who performed the undo\n * will get the better results, the other users don't know which operations recreated a deleted\n * range of content. There is more information in this ticket: https://github.com/yjs/yjs/issues/638\n *\n * @param {RelativePosition} rpos\n * @param {Doc} doc\n * @param {boolean} followUndoneDeletions - whether to follow undone deletions - see https://github.com/yjs/yjs/issues/638\n * @return {AbsolutePosition|null}\n *\n * @function\n */\nexport const createAbsolutePositionFromRelativePosition = (rpos, doc, followUndoneDeletions = true) => {\n const store = doc.store\n const rightID = rpos.item\n const typeID = rpos.type\n const tname = rpos.tname\n const assoc = rpos.assoc\n let type = null\n let index = 0\n if (rightID !== null) {\n if (getState(store, rightID.client) <= rightID.clock) {\n return null\n }\n const res = followUndoneDeletions ? followRedone(store, rightID) : getItemWithOffset(store, rightID)\n const right = res.item\n if (!(right instanceof Item)) {\n return null\n }\n type = /** @type {AbstractType} */ (right.parent)\n if (type._item === null || !type._item.deleted) {\n index = (right.deleted || !right.countable) ? 0 : (res.diff + (assoc >= 0 ? 0 : 1)) // adjust position based on left association if necessary\n let n = right.left\n while (n !== null) {\n if (!n.deleted && n.countable) {\n index += n.length\n }\n n = n.left\n }\n }\n } else {\n if (tname !== null) {\n type = doc.get(tname)\n } else if (typeID !== null) {\n if (getState(store, typeID.client) <= typeID.clock) {\n // type does not exist yet\n return null\n }\n const { item } = followUndoneDeletions ? followRedone(store, typeID) : { item: getItem(store, typeID) }\n if (item instanceof Item && item.content instanceof ContentType) {\n type = item.content.type\n } else {\n // struct is garbage collected\n return null\n }\n } else {\n throw error.unexpectedCase()\n }\n if (assoc >= 0) {\n index = type._length\n } else {\n index = 0\n }\n }\n return createAbsolutePosition(type, index, rpos.assoc)\n}\n\n/**\n * @param {RelativePosition|null} a\n * @param {RelativePosition|null} b\n * @return {boolean}\n *\n * @function\n */\nexport const compareRelativePositions = (a, b) => a === b || (\n a !== null && b !== null && a.tname === b.tname && compareIDs(a.item, b.item) && compareIDs(a.type, b.type) && a.assoc === b.assoc\n)\n","import {\n isDeleted,\n createDeleteSetFromStructStore,\n getStateVector,\n getItemCleanStart,\n iterateDeletedStructs,\n writeDeleteSet,\n writeStateVector,\n readDeleteSet,\n readStateVector,\n createDeleteSet,\n createID,\n getState,\n findIndexSS,\n UpdateEncoderV2,\n applyUpdateV2,\n LazyStructReader,\n equalDeleteSets,\n UpdateDecoderV1, UpdateDecoderV2, DSEncoderV1, DSEncoderV2, DSDecoderV1, DSDecoderV2, Transaction, Doc, DeleteSet, Item, // eslint-disable-line\n mergeDeleteSets\n} from '../internals.js'\n\nimport * as map from 'lib0/map'\nimport * as set from 'lib0/set'\nimport * as decoding from 'lib0/decoding'\nimport * as encoding from 'lib0/encoding'\n\nexport class Snapshot {\n /**\n * @param {DeleteSet} ds\n * @param {Map} sv state map\n */\n constructor (ds, sv) {\n /**\n * @type {DeleteSet}\n */\n this.ds = ds\n /**\n * State Map\n * @type {Map}\n */\n this.sv = sv\n }\n}\n\n/**\n * @param {Snapshot} snap1\n * @param {Snapshot} snap2\n * @return {boolean}\n */\nexport const equalSnapshots = (snap1, snap2) => {\n const ds1 = snap1.ds.clients\n const ds2 = snap2.ds.clients\n const sv1 = snap1.sv\n const sv2 = snap2.sv\n if (sv1.size !== sv2.size || ds1.size !== ds2.size) {\n return false\n }\n for (const [key, value] of sv1.entries()) {\n if (sv2.get(key) !== value) {\n return false\n }\n }\n for (const [client, dsitems1] of ds1.entries()) {\n const dsitems2 = ds2.get(client) || []\n if (dsitems1.length !== dsitems2.length) {\n return false\n }\n for (let i = 0; i < dsitems1.length; i++) {\n const dsitem1 = dsitems1[i]\n const dsitem2 = dsitems2[i]\n if (dsitem1.clock !== dsitem2.clock || dsitem1.len !== dsitem2.len) {\n return false\n }\n }\n }\n return true\n}\n\n/**\n * @param {Snapshot} snapshot\n * @param {DSEncoderV1 | DSEncoderV2} [encoder]\n * @return {Uint8Array}\n */\nexport const encodeSnapshotV2 = (snapshot, encoder = new DSEncoderV2()) => {\n writeDeleteSet(encoder, snapshot.ds)\n writeStateVector(encoder, snapshot.sv)\n return encoder.toUint8Array()\n}\n\n/**\n * @param {Snapshot} snapshot\n * @return {Uint8Array}\n */\nexport const encodeSnapshot = snapshot => encodeSnapshotV2(snapshot, new DSEncoderV1())\n\n/**\n * @param {Uint8Array} buf\n * @param {DSDecoderV1 | DSDecoderV2} [decoder]\n * @return {Snapshot}\n */\nexport const decodeSnapshotV2 = (buf, decoder = new DSDecoderV2(decoding.createDecoder(buf))) => {\n return new Snapshot(readDeleteSet(decoder), readStateVector(decoder))\n}\n\n/**\n * @param {Uint8Array} buf\n * @return {Snapshot}\n */\nexport const decodeSnapshot = buf => decodeSnapshotV2(buf, new DSDecoderV1(decoding.createDecoder(buf)))\n\n/**\n * @param {DeleteSet} ds\n * @param {Map} sm\n * @return {Snapshot}\n */\nexport const createSnapshot = (ds, sm) => new Snapshot(ds, sm)\n\nexport const emptySnapshot = createSnapshot(createDeleteSet(), new Map())\n\n/**\n * @param {Doc} doc\n * @return {Snapshot}\n */\nexport const snapshot = doc => createSnapshot(createDeleteSetFromStructStore(doc.store), getStateVector(doc.store))\n\n/**\n * @param {Item} item\n * @param {Snapshot|undefined} snapshot\n *\n * @protected\n * @function\n */\nexport const isVisible = (item, snapshot) => snapshot === undefined\n ? !item.deleted\n : snapshot.sv.has(item.id.client) && (snapshot.sv.get(item.id.client) || 0) > item.id.clock && !isDeleted(snapshot.ds, item.id)\n\n/**\n * @param {Transaction} transaction\n * @param {Snapshot} snapshot\n */\nexport const splitSnapshotAffectedStructs = (transaction, snapshot) => {\n const meta = map.setIfUndefined(transaction.meta, splitSnapshotAffectedStructs, set.create)\n const store = transaction.doc.store\n // check if we already split for this snapshot\n if (!meta.has(snapshot)) {\n snapshot.sv.forEach((clock, client) => {\n if (clock < getState(store, client)) {\n getItemCleanStart(transaction, createID(client, clock))\n }\n })\n iterateDeletedStructs(transaction, snapshot.ds, _item => {})\n meta.add(snapshot)\n }\n}\n\n/**\n * @example\n * const ydoc = new Y.Doc({ gc: false })\n * ydoc.getText().insert(0, 'world!')\n * const snapshot = Y.snapshot(ydoc)\n * ydoc.getText().insert(0, 'hello ')\n * const restored = Y.createDocFromSnapshot(ydoc, snapshot)\n * assert(restored.getText().toString() === 'world!')\n *\n * @param {Doc} originDoc\n * @param {Snapshot} snapshot\n * @param {Doc} [newDoc] Optionally, you may define the Yjs document that receives the data from originDoc\n * @return {Doc}\n */\nexport const createDocFromSnapshot = (originDoc, snapshot, newDoc = new Doc()) => {\n if (originDoc.gc) {\n // we should not try to restore a GC-ed document, because some of the restored items might have their content deleted\n throw new Error('Garbage-collection must be disabled in `originDoc`!')\n }\n const { sv, ds } = snapshot\n\n const encoder = new UpdateEncoderV2()\n originDoc.transact(transaction => {\n let size = 0\n sv.forEach(clock => {\n if (clock > 0) {\n size++\n }\n })\n encoding.writeVarUint(encoder.restEncoder, size)\n // splitting the structs before writing them to the encoder\n for (const [client, clock] of sv) {\n if (clock === 0) {\n continue\n }\n if (clock < getState(originDoc.store, client)) {\n getItemCleanStart(transaction, createID(client, clock))\n }\n const structs = originDoc.store.clients.get(client) || []\n const lastStructIndex = findIndexSS(structs, clock - 1)\n // write # encoded structs\n encoding.writeVarUint(encoder.restEncoder, lastStructIndex + 1)\n encoder.writeClient(client)\n // first clock written is 0\n encoding.writeVarUint(encoder.restEncoder, 0)\n for (let i = 0; i <= lastStructIndex; i++) {\n structs[i].write(encoder, 0)\n }\n }\n writeDeleteSet(encoder, ds)\n })\n\n applyUpdateV2(newDoc, encoder.toUint8Array(), 'snapshot')\n return newDoc\n}\n\n/**\n * @param {Snapshot} snapshot\n * @param {Uint8Array} update\n * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder]\n */\nexport const snapshotContainsUpdateV2 = (snapshot, update, YDecoder = UpdateDecoderV2) => {\n const structs = []\n const updateDecoder = new YDecoder(decoding.createDecoder(update))\n const lazyDecoder = new LazyStructReader(updateDecoder, false)\n for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) {\n structs.push(curr)\n if ((snapshot.sv.get(curr.id.client) || 0) < curr.id.clock + curr.length) {\n return false\n }\n }\n const mergedDS = mergeDeleteSets([snapshot.ds, readDeleteSet(updateDecoder)])\n return equalDeleteSets(snapshot.ds, mergedDS)\n}\n\n/**\n * @param {Snapshot} snapshot\n * @param {Uint8Array} update\n */\nexport const snapshotContainsUpdate = (snapshot, update) => snapshotContainsUpdateV2(snapshot, update, UpdateDecoderV1)\n","import {\n GC,\n splitItem,\n Transaction, ID, Item, DSDecoderV2 // eslint-disable-line\n} from '../internals.js'\n\nimport * as math from 'lib0/math'\nimport * as error from 'lib0/error'\n\nexport class StructStore {\n constructor () {\n /**\n * @type {Map>}\n */\n this.clients = new Map()\n /**\n * @type {null | { missing: Map, update: Uint8Array }}\n */\n this.pendingStructs = null\n /**\n * @type {null | Uint8Array}\n */\n this.pendingDs = null\n }\n}\n\n/**\n * Return the states as a Map.\n * Note that clock refers to the next expected clock id.\n *\n * @param {StructStore} store\n * @return {Map}\n *\n * @public\n * @function\n */\nexport const getStateVector = store => {\n const sm = new Map()\n store.clients.forEach((structs, client) => {\n const struct = structs[structs.length - 1]\n sm.set(client, struct.id.clock + struct.length)\n })\n return sm\n}\n\n/**\n * @param {StructStore} store\n * @param {number} client\n * @return {number}\n *\n * @public\n * @function\n */\nexport const getState = (store, client) => {\n const structs = store.clients.get(client)\n if (structs === undefined) {\n return 0\n }\n const lastStruct = structs[structs.length - 1]\n return lastStruct.id.clock + lastStruct.length\n}\n\n/**\n * @param {StructStore} store\n *\n * @private\n * @function\n */\nexport const integrityCheck = store => {\n store.clients.forEach(structs => {\n for (let i = 1; i < structs.length; i++) {\n const l = structs[i - 1]\n const r = structs[i]\n if (l.id.clock + l.length !== r.id.clock) {\n throw new Error('StructStore failed integrity check')\n }\n }\n })\n}\n\n/**\n * @param {StructStore} store\n * @param {GC|Item} struct\n *\n * @private\n * @function\n */\nexport const addStruct = (store, struct) => {\n let structs = store.clients.get(struct.id.client)\n if (structs === undefined) {\n structs = []\n store.clients.set(struct.id.client, structs)\n } else {\n const lastStruct = structs[structs.length - 1]\n if (lastStruct.id.clock + lastStruct.length !== struct.id.clock) {\n throw error.unexpectedCase()\n }\n }\n structs.push(struct)\n}\n\n/**\n * Perform a binary search on a sorted array\n * @param {Array} structs\n * @param {number} clock\n * @return {number}\n *\n * @private\n * @function\n */\nexport const findIndexSS = (structs, clock) => {\n let left = 0\n let right = structs.length - 1\n let mid = structs[right]\n let midclock = mid.id.clock\n if (midclock === clock) {\n return right\n }\n // @todo does it even make sense to pivot the search?\n // If a good split misses, it might actually increase the time to find the correct item.\n // Currently, the only advantage is that search with pivoting might find the item on the first try.\n let midindex = math.floor((clock / (midclock + mid.length - 1)) * right) // pivoting the search\n while (left <= right) {\n mid = structs[midindex]\n midclock = mid.id.clock\n if (midclock <= clock) {\n if (clock < midclock + mid.length) {\n return midindex\n }\n left = midindex + 1\n } else {\n right = midindex - 1\n }\n midindex = math.floor((left + right) / 2)\n }\n // Always check state before looking for a struct in StructStore\n // Therefore the case of not finding a struct is unexpected\n throw error.unexpectedCase()\n}\n\n/**\n * Expects that id is actually in store. This function throws or is an infinite loop otherwise.\n *\n * @param {StructStore} store\n * @param {ID} id\n * @return {GC|Item}\n *\n * @private\n * @function\n */\nexport const find = (store, id) => {\n /**\n * @type {Array}\n */\n // @ts-ignore\n const structs = store.clients.get(id.client)\n return structs[findIndexSS(structs, id.clock)]\n}\n\n/**\n * Expects that id is actually in store. This function throws or is an infinite loop otherwise.\n * @private\n * @function\n */\nexport const getItem = /** @type {function(StructStore,ID):Item} */ (find)\n\n/**\n * @param {Transaction} transaction\n * @param {Array} structs\n * @param {number} clock\n */\nexport const findIndexCleanStart = (transaction, structs, clock) => {\n const index = findIndexSS(structs, clock)\n const struct = structs[index]\n if (struct.id.clock < clock && struct instanceof Item) {\n structs.splice(index + 1, 0, splitItem(transaction, struct, clock - struct.id.clock))\n return index + 1\n }\n return index\n}\n\n/**\n * Expects that id is actually in store. This function throws or is an infinite loop otherwise.\n *\n * @param {Transaction} transaction\n * @param {ID} id\n * @return {Item}\n *\n * @private\n * @function\n */\nexport const getItemCleanStart = (transaction, id) => {\n const structs = /** @type {Array} */ (transaction.doc.store.clients.get(id.client))\n return structs[findIndexCleanStart(transaction, structs, id.clock)]\n}\n\n/**\n * Expects that id is actually in store. This function throws or is an infinite loop otherwise.\n *\n * @param {Transaction} transaction\n * @param {StructStore} store\n * @param {ID} id\n * @return {Item}\n *\n * @private\n * @function\n */\nexport const getItemCleanEnd = (transaction, store, id) => {\n /**\n * @type {Array}\n */\n // @ts-ignore\n const structs = store.clients.get(id.client)\n const index = findIndexSS(structs, id.clock)\n const struct = structs[index]\n if (id.clock !== struct.id.clock + struct.length - 1 && struct.constructor !== GC) {\n structs.splice(index + 1, 0, splitItem(transaction, struct, id.clock - struct.id.clock + 1))\n }\n return struct\n}\n\n/**\n * Replace `item` with `newitem` in store\n * @param {StructStore} store\n * @param {GC|Item} struct\n * @param {GC|Item} newStruct\n *\n * @private\n * @function\n */\nexport const replaceStruct = (store, struct, newStruct) => {\n const structs = /** @type {Array} */ (store.clients.get(struct.id.client))\n structs[findIndexSS(structs, struct.id.clock)] = newStruct\n}\n\n/**\n * Iterate over a range of structs\n *\n * @param {Transaction} transaction\n * @param {Array} structs\n * @param {number} clockStart Inclusive start\n * @param {number} len\n * @param {function(GC|Item):void} f\n *\n * @function\n */\nexport const iterateStructs = (transaction, structs, clockStart, len, f) => {\n if (len === 0) {\n return\n }\n const clockEnd = clockStart + len\n let index = findIndexCleanStart(transaction, structs, clockStart)\n let struct\n do {\n struct = structs[index++]\n if (clockEnd < struct.id.clock + struct.length) {\n findIndexCleanStart(transaction, structs, clockEnd)\n }\n f(struct)\n } while (index < structs.length && structs[index].id.clock < clockEnd)\n}\n","import {\n getState,\n writeStructsFromTransaction,\n writeDeleteSet,\n DeleteSet,\n sortAndMergeDeleteSet,\n getStateVector,\n findIndexSS,\n callEventHandlerListeners,\n Item,\n generateNewClientId,\n createID,\n cleanupYTextAfterTransaction,\n UpdateEncoderV1, UpdateEncoderV2, GC, StructStore, AbstractType, AbstractStruct, YEvent, Doc // eslint-disable-line\n} from '../internals.js'\n\nimport * as map from 'lib0/map'\nimport * as math from 'lib0/math'\nimport * as set from 'lib0/set'\nimport * as logging from 'lib0/logging'\nimport { callAll } from 'lib0/function'\n\n/**\n * A transaction is created for every change on the Yjs model. It is possible\n * to bundle changes on the Yjs model in a single transaction to\n * minimize the number on messages sent and the number of observer calls.\n * If possible the user of this library should bundle as many changes as\n * possible. Here is an example to illustrate the advantages of bundling:\n *\n * @example\n * const ydoc = new Y.Doc()\n * const map = ydoc.getMap('map')\n * // Log content when change is triggered\n * map.observe(() => {\n * console.log('change triggered')\n * })\n * // Each change on the map type triggers a log message:\n * map.set('a', 0) // => \"change triggered\"\n * map.set('b', 0) // => \"change triggered\"\n * // When put in a transaction, it will trigger the log after the transaction:\n * ydoc.transact(() => {\n * map.set('a', 1)\n * map.set('b', 1)\n * }) // => \"change triggered\"\n *\n * @public\n */\nexport class Transaction {\n /**\n * @param {Doc} doc\n * @param {any} origin\n * @param {boolean} local\n */\n constructor (doc, origin, local) {\n /**\n * The Yjs instance.\n * @type {Doc}\n */\n this.doc = doc\n /**\n * Describes the set of deleted items by ids\n * @type {DeleteSet}\n */\n this.deleteSet = new DeleteSet()\n /**\n * Holds the state before the transaction started.\n * @type {Map}\n */\n this.beforeState = getStateVector(doc.store)\n /**\n * Holds the state after the transaction.\n * @type {Map}\n */\n this.afterState = new Map()\n /**\n * All types that were directly modified (property added or child\n * inserted/deleted). New types are not included in this Set.\n * Maps from type to parentSubs (`item.parentSub = null` for YArray)\n * @type {Map>,Set>}\n */\n this.changed = new Map()\n /**\n * Stores the events for the types that observe also child elements.\n * It is mainly used by `observeDeep`.\n * @type {Map>,Array>>}\n */\n this.changedParentTypes = new Map()\n /**\n * @type {Array}\n */\n this._mergeStructs = []\n /**\n * @type {any}\n */\n this.origin = origin\n /**\n * Stores meta information on the transaction\n * @type {Map}\n */\n this.meta = new Map()\n /**\n * Whether this change originates from this doc.\n * @type {boolean}\n */\n this.local = local\n /**\n * @type {Set}\n */\n this.subdocsAdded = new Set()\n /**\n * @type {Set}\n */\n this.subdocsRemoved = new Set()\n /**\n * @type {Set}\n */\n this.subdocsLoaded = new Set()\n /**\n * @type {boolean}\n */\n this._needFormattingCleanup = false\n }\n}\n\n/**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {Transaction} transaction\n * @return {boolean} Whether data was written.\n */\nexport const writeUpdateMessageFromTransaction = (encoder, transaction) => {\n if (transaction.deleteSet.clients.size === 0 && !map.any(transaction.afterState, (clock, client) => transaction.beforeState.get(client) !== clock)) {\n return false\n }\n sortAndMergeDeleteSet(transaction.deleteSet)\n writeStructsFromTransaction(encoder, transaction)\n writeDeleteSet(encoder, transaction.deleteSet)\n return true\n}\n\n/**\n * @param {Transaction} transaction\n *\n * @private\n * @function\n */\nexport const nextID = transaction => {\n const y = transaction.doc\n return createID(y.clientID, getState(y.store, y.clientID))\n}\n\n/**\n * If `type.parent` was added in current transaction, `type` technically\n * did not change, it was just added and we should not fire events for `type`.\n *\n * @param {Transaction} transaction\n * @param {AbstractType>} type\n * @param {string|null} parentSub\n */\nexport const addChangedTypeToTransaction = (transaction, type, parentSub) => {\n const item = type._item\n if (item === null || (item.id.clock < (transaction.beforeState.get(item.id.client) || 0) && !item.deleted)) {\n map.setIfUndefined(transaction.changed, type, set.create).add(parentSub)\n }\n}\n\n/**\n * @param {Array} structs\n * @param {number} pos\n * @return {number} # of merged structs\n */\nconst tryToMergeWithLefts = (structs, pos) => {\n let right = structs[pos]\n let left = structs[pos - 1]\n let i = pos\n for (; i > 0; right = left, left = structs[--i - 1]) {\n if (left.deleted === right.deleted && left.constructor === right.constructor) {\n if (left.mergeWith(right)) {\n if (right instanceof Item && right.parentSub !== null && /** @type {AbstractType} */ (right.parent)._map.get(right.parentSub) === right) {\n /** @type {AbstractType} */ (right.parent)._map.set(right.parentSub, /** @type {Item} */ (left))\n }\n continue\n }\n }\n break\n }\n const merged = pos - i\n if (merged) {\n // remove all merged structs from the array\n structs.splice(pos + 1 - merged, merged)\n }\n return merged\n}\n\n/**\n * @param {DeleteSet} ds\n * @param {StructStore} store\n * @param {function(Item):boolean} gcFilter\n */\nconst tryGcDeleteSet = (ds, store, gcFilter) => {\n for (const [client, deleteItems] of ds.clients.entries()) {\n const structs = /** @type {Array} */ (store.clients.get(client))\n for (let di = deleteItems.length - 1; di >= 0; di--) {\n const deleteItem = deleteItems[di]\n const endDeleteItemClock = deleteItem.clock + deleteItem.len\n for (\n let si = findIndexSS(structs, deleteItem.clock), struct = structs[si];\n si < structs.length && struct.id.clock < endDeleteItemClock;\n struct = structs[++si]\n ) {\n const struct = structs[si]\n if (deleteItem.clock + deleteItem.len <= struct.id.clock) {\n break\n }\n if (struct instanceof Item && struct.deleted && !struct.keep && gcFilter(struct)) {\n struct.gc(store, false)\n }\n }\n }\n }\n}\n\n/**\n * @param {DeleteSet} ds\n * @param {StructStore} store\n */\nconst tryMergeDeleteSet = (ds, store) => {\n // try to merge deleted / gc'd items\n // merge from right to left for better efficiency and so we don't miss any merge targets\n ds.clients.forEach((deleteItems, client) => {\n const structs = /** @type {Array} */ (store.clients.get(client))\n for (let di = deleteItems.length - 1; di >= 0; di--) {\n const deleteItem = deleteItems[di]\n // start with merging the item next to the last deleted item\n const mostRightIndexToCheck = math.min(structs.length - 1, 1 + findIndexSS(structs, deleteItem.clock + deleteItem.len - 1))\n for (\n let si = mostRightIndexToCheck, struct = structs[si];\n si > 0 && struct.id.clock >= deleteItem.clock;\n struct = structs[si]\n ) {\n si -= 1 + tryToMergeWithLefts(structs, si)\n }\n }\n })\n}\n\n/**\n * @param {DeleteSet} ds\n * @param {StructStore} store\n * @param {function(Item):boolean} gcFilter\n */\nexport const tryGc = (ds, store, gcFilter) => {\n tryGcDeleteSet(ds, store, gcFilter)\n tryMergeDeleteSet(ds, store)\n}\n\n/**\n * @param {Array} transactionCleanups\n * @param {number} i\n */\nconst cleanupTransactions = (transactionCleanups, i) => {\n if (i < transactionCleanups.length) {\n const transaction = transactionCleanups[i]\n const doc = transaction.doc\n const store = doc.store\n const ds = transaction.deleteSet\n const mergeStructs = transaction._mergeStructs\n try {\n sortAndMergeDeleteSet(ds)\n transaction.afterState = getStateVector(transaction.doc.store)\n doc.emit('beforeObserverCalls', [transaction, doc])\n /**\n * An array of event callbacks.\n *\n * Each callback is called even if the other ones throw errors.\n *\n * @type {Array}\n */\n const fs = []\n // observe events on changed types\n transaction.changed.forEach((subs, itemtype) =>\n fs.push(() => {\n if (itemtype._item === null || !itemtype._item.deleted) {\n itemtype._callObserver(transaction, subs)\n }\n })\n )\n fs.push(() => {\n // deep observe events\n transaction.changedParentTypes.forEach((events, type) => {\n // We need to think about the possibility that the user transforms the\n // Y.Doc in the event.\n if (type._dEH.l.length > 0 && (type._item === null || !type._item.deleted)) {\n events = events\n .filter(event =>\n event.target._item === null || !event.target._item.deleted\n )\n events\n .forEach(event => {\n event.currentTarget = type\n // path is relative to the current target\n event._path = null\n })\n // sort events by path length so that top-level events are fired first.\n events\n .sort((event1, event2) => event1.path.length - event2.path.length)\n fs.push(() => {\n // We don't need to check for events.length\n // because we know it has at least one element\n callEventHandlerListeners(type._dEH, events, transaction)\n })\n }\n })\n fs.push(() => doc.emit('afterTransaction', [transaction, doc]))\n fs.push(() => {\n if (transaction._needFormattingCleanup) {\n cleanupYTextAfterTransaction(transaction)\n }\n })\n })\n callAll(fs, [])\n } finally {\n // Replace deleted items with ItemDeleted / GC.\n // This is where content is actually remove from the Yjs Doc.\n if (doc.gc) {\n tryGcDeleteSet(ds, store, doc.gcFilter)\n }\n tryMergeDeleteSet(ds, store)\n\n // on all affected store.clients props, try to merge\n transaction.afterState.forEach((clock, client) => {\n const beforeClock = transaction.beforeState.get(client) || 0\n if (beforeClock !== clock) {\n const structs = /** @type {Array} */ (store.clients.get(client))\n // we iterate from right to left so we can safely remove entries\n const firstChangePos = math.max(findIndexSS(structs, beforeClock), 1)\n for (let i = structs.length - 1; i >= firstChangePos;) {\n i -= 1 + tryToMergeWithLefts(structs, i)\n }\n }\n })\n // try to merge mergeStructs\n // @todo: it makes more sense to transform mergeStructs to a DS, sort it, and merge from right to left\n // but at the moment DS does not handle duplicates\n for (let i = mergeStructs.length - 1; i >= 0; i--) {\n const { client, clock } = mergeStructs[i].id\n const structs = /** @type {Array} */ (store.clients.get(client))\n const replacedStructPos = findIndexSS(structs, clock)\n if (replacedStructPos + 1 < structs.length) {\n if (tryToMergeWithLefts(structs, replacedStructPos + 1) > 1) {\n continue // no need to perform next check, both are already merged\n }\n }\n if (replacedStructPos > 0) {\n tryToMergeWithLefts(structs, replacedStructPos)\n }\n }\n if (!transaction.local && transaction.afterState.get(doc.clientID) !== transaction.beforeState.get(doc.clientID)) {\n logging.print(logging.ORANGE, logging.BOLD, '[yjs] ', logging.UNBOLD, logging.RED, 'Changed the client-id because another client seems to be using it.')\n doc.clientID = generateNewClientId()\n }\n // @todo Merge all the transactions into one and provide send the data as a single update message\n doc.emit('afterTransactionCleanup', [transaction, doc])\n if (doc._observers.has('update')) {\n const encoder = new UpdateEncoderV1()\n const hasContent = writeUpdateMessageFromTransaction(encoder, transaction)\n if (hasContent) {\n doc.emit('update', [encoder.toUint8Array(), transaction.origin, doc, transaction])\n }\n }\n if (doc._observers.has('updateV2')) {\n const encoder = new UpdateEncoderV2()\n const hasContent = writeUpdateMessageFromTransaction(encoder, transaction)\n if (hasContent) {\n doc.emit('updateV2', [encoder.toUint8Array(), transaction.origin, doc, transaction])\n }\n }\n const { subdocsAdded, subdocsLoaded, subdocsRemoved } = transaction\n if (subdocsAdded.size > 0 || subdocsRemoved.size > 0 || subdocsLoaded.size > 0) {\n subdocsAdded.forEach(subdoc => {\n subdoc.clientID = doc.clientID\n if (subdoc.collectionid == null) {\n subdoc.collectionid = doc.collectionid\n }\n doc.subdocs.add(subdoc)\n })\n subdocsRemoved.forEach(subdoc => doc.subdocs.delete(subdoc))\n doc.emit('subdocs', [{ loaded: subdocsLoaded, added: subdocsAdded, removed: subdocsRemoved }, doc, transaction])\n subdocsRemoved.forEach(subdoc => subdoc.destroy())\n }\n\n if (transactionCleanups.length <= i + 1) {\n doc._transactionCleanups = []\n doc.emit('afterAllTransactions', [doc, transactionCleanups])\n } else {\n cleanupTransactions(transactionCleanups, i + 1)\n }\n }\n }\n}\n\n/**\n * Implements the functionality of `y.transact(()=>{..})`\n *\n * @template T\n * @param {Doc} doc\n * @param {function(Transaction):T} f\n * @param {any} [origin=true]\n * @return {T}\n *\n * @function\n */\nexport const transact = (doc, f, origin = null, local = true) => {\n const transactionCleanups = doc._transactionCleanups\n let initialCall = false\n /**\n * @type {any}\n */\n let result = null\n if (doc._transaction === null) {\n initialCall = true\n doc._transaction = new Transaction(doc, origin, local)\n transactionCleanups.push(doc._transaction)\n if (transactionCleanups.length === 1) {\n doc.emit('beforeAllTransactions', [doc])\n }\n doc.emit('beforeTransaction', [doc._transaction, doc])\n }\n try {\n result = f(doc._transaction)\n } finally {\n if (initialCall) {\n const finishCleanup = doc._transaction === transactionCleanups[0]\n doc._transaction = null\n if (finishCleanup) {\n // The first transaction ended, now process observer calls.\n // Observer call may create new transactions for which we need to call the observers and do cleanup.\n // We don't want to nest these calls, so we execute these calls one after\n // another.\n // Also we need to ensure that all cleanups are called, even if the\n // observes throw errors.\n // This file is full of hacky try {} finally {} blocks to ensure that an\n // event can throw errors and also that the cleanup is called.\n cleanupTransactions(transactionCleanups, 0)\n }\n }\n }\n return result\n}\n","import {\n mergeDeleteSets,\n iterateDeletedStructs,\n keepItem,\n transact,\n createID,\n redoItem,\n isParentOf,\n followRedone,\n getItemCleanStart,\n isDeleted,\n addToDeleteSet,\n YEvent, Transaction, Doc, Item, GC, DeleteSet, AbstractType // eslint-disable-line\n} from '../internals.js'\n\nimport * as time from 'lib0/time'\nimport * as array from 'lib0/array'\nimport * as logging from 'lib0/logging'\nimport { ObservableV2 } from 'lib0/observable'\n\nexport class StackItem {\n /**\n * @param {DeleteSet} deletions\n * @param {DeleteSet} insertions\n */\n constructor (deletions, insertions) {\n this.insertions = insertions\n this.deletions = deletions\n /**\n * Use this to save and restore metadata like selection range\n */\n this.meta = new Map()\n }\n}\n/**\n * @param {Transaction} tr\n * @param {UndoManager} um\n * @param {StackItem} stackItem\n */\nconst clearUndoManagerStackItem = (tr, um, stackItem) => {\n iterateDeletedStructs(tr, stackItem.deletions, item => {\n if (item instanceof Item && um.scope.some(type => type === tr.doc || isParentOf(/** @type {AbstractType} */ (type), item))) {\n keepItem(item, false)\n }\n })\n}\n\n/**\n * @param {UndoManager} undoManager\n * @param {Array} stack\n * @param {'undo'|'redo'} eventType\n * @return {StackItem?}\n */\nconst popStackItem = (undoManager, stack, eventType) => {\n /**\n * Keep a reference to the transaction so we can fire the event with the changedParentTypes\n * @type {any}\n */\n let _tr = null\n const doc = undoManager.doc\n const scope = undoManager.scope\n transact(doc, transaction => {\n while (stack.length > 0 && undoManager.currStackItem === null) {\n const store = doc.store\n const stackItem = /** @type {StackItem} */ (stack.pop())\n /**\n * @type {Set}\n */\n const itemsToRedo = new Set()\n /**\n * @type {Array}\n */\n const itemsToDelete = []\n let performedChange = false\n iterateDeletedStructs(transaction, stackItem.insertions, struct => {\n if (struct instanceof Item) {\n if (struct.redone !== null) {\n let { item, diff } = followRedone(store, struct.id)\n if (diff > 0) {\n item = getItemCleanStart(transaction, createID(item.id.client, item.id.clock + diff))\n }\n struct = item\n }\n if (!struct.deleted && scope.some(type => type === transaction.doc || isParentOf(/** @type {AbstractType} */ (type), /** @type {Item} */ (struct)))) {\n itemsToDelete.push(struct)\n }\n }\n })\n iterateDeletedStructs(transaction, stackItem.deletions, struct => {\n if (\n struct instanceof Item &&\n scope.some(type => type === transaction.doc || isParentOf(/** @type {AbstractType} */ (type), struct)) &&\n // Never redo structs in stackItem.insertions because they were created and deleted in the same capture interval.\n !isDeleted(stackItem.insertions, struct.id)\n ) {\n itemsToRedo.add(struct)\n }\n })\n itemsToRedo.forEach(struct => {\n performedChange = redoItem(transaction, struct, itemsToRedo, stackItem.insertions, undoManager.ignoreRemoteMapChanges, undoManager) !== null || performedChange\n })\n // We want to delete in reverse order so that children are deleted before\n // parents, so we have more information available when items are filtered.\n for (let i = itemsToDelete.length - 1; i >= 0; i--) {\n const item = itemsToDelete[i]\n if (undoManager.deleteFilter(item)) {\n item.delete(transaction)\n performedChange = true\n }\n }\n undoManager.currStackItem = performedChange ? stackItem : null\n }\n transaction.changed.forEach((subProps, type) => {\n // destroy search marker if necessary\n if (subProps.has(null) && type._searchMarker) {\n type._searchMarker.length = 0\n }\n })\n _tr = transaction\n }, undoManager)\n const res = undoManager.currStackItem\n if (res != null) {\n const changedParentTypes = _tr.changedParentTypes\n undoManager.emit('stack-item-popped', [{ stackItem: res, type: eventType, changedParentTypes, origin: undoManager }, undoManager])\n undoManager.currStackItem = null\n }\n return res\n}\n\n/**\n * @typedef {Object} UndoManagerOptions\n * @property {number} [UndoManagerOptions.captureTimeout=500]\n * @property {function(Transaction):boolean} [UndoManagerOptions.captureTransaction] Do not capture changes of a Transaction if result false.\n * @property {function(Item):boolean} [UndoManagerOptions.deleteFilter=()=>true] Sometimes\n * it is necessary to filter what an Undo/Redo operation can delete. If this\n * filter returns false, the type/item won't be deleted even it is in the\n * undo/redo scope.\n * @property {Set} [UndoManagerOptions.trackedOrigins=new Set([null])]\n * @property {boolean} [ignoreRemoteMapChanges] Experimental. By default, the UndoManager will never overwrite remote changes. Enable this property to enable overwriting remote changes on key-value changes (Y.Map, properties on Y.Xml, etc..).\n * @property {Doc} [doc] The document that this UndoManager operates on. Only needed if typeScope is empty.\n */\n\n/**\n * @typedef {Object} StackItemEvent\n * @property {StackItem} StackItemEvent.stackItem\n * @property {any} StackItemEvent.origin\n * @property {'undo'|'redo'} StackItemEvent.type\n * @property {Map>,Array>>} StackItemEvent.changedParentTypes\n */\n\n/**\n * Fires 'stack-item-added' event when a stack item was added to either the undo- or\n * the redo-stack. You may store additional stack information via the\n * metadata property on `event.stackItem.meta` (it is a `Map` of metadata properties).\n * Fires 'stack-item-popped' event when a stack item was popped from either the\n * undo- or the redo-stack. You may restore the saved stack information from `event.stackItem.meta`.\n *\n * @extends {ObservableV2<{'stack-item-added':function(StackItemEvent, UndoManager):void, 'stack-item-popped': function(StackItemEvent, UndoManager):void, 'stack-cleared': function({ undoStackCleared: boolean, redoStackCleared: boolean }):void, 'stack-item-updated': function(StackItemEvent, UndoManager):void }>}\n */\nexport class UndoManager extends ObservableV2 {\n /**\n * @param {Doc|AbstractType|Array>} typeScope Limits the scope of the UndoManager. If this is set to a ydoc instance, all changes on that ydoc will be undone. If set to a specific type, only changes on that type or its children will be undone. Also accepts an array of types.\n * @param {UndoManagerOptions} options\n */\n constructor (typeScope, {\n captureTimeout = 500,\n captureTransaction = _tr => true,\n deleteFilter = () => true,\n trackedOrigins = new Set([null]),\n ignoreRemoteMapChanges = false,\n doc = /** @type {Doc} */ (array.isArray(typeScope) ? typeScope[0].doc : typeScope instanceof Doc ? typeScope : typeScope.doc)\n } = {}) {\n super()\n /**\n * @type {Array | Doc>}\n */\n this.scope = []\n this.doc = doc\n this.addToScope(typeScope)\n this.deleteFilter = deleteFilter\n trackedOrigins.add(this)\n this.trackedOrigins = trackedOrigins\n this.captureTransaction = captureTransaction\n /**\n * @type {Array}\n */\n this.undoStack = []\n /**\n * @type {Array}\n */\n this.redoStack = []\n /**\n * Whether the client is currently undoing (calling UndoManager.undo)\n *\n * @type {boolean}\n */\n this.undoing = false\n this.redoing = false\n /**\n * The currently popped stack item if UndoManager.undoing or UndoManager.redoing\n *\n * @type {StackItem|null}\n */\n this.currStackItem = null\n this.lastChange = 0\n this.ignoreRemoteMapChanges = ignoreRemoteMapChanges\n this.captureTimeout = captureTimeout\n /**\n * @param {Transaction} transaction\n */\n this.afterTransactionHandler = transaction => {\n // Only track certain transactions\n if (\n !this.captureTransaction(transaction) ||\n !this.scope.some(type => transaction.changedParentTypes.has(/** @type {AbstractType} */ (type)) || type === this.doc) ||\n (!this.trackedOrigins.has(transaction.origin) && (!transaction.origin || !this.trackedOrigins.has(transaction.origin.constructor)))\n ) {\n return\n }\n const undoing = this.undoing\n const redoing = this.redoing\n const stack = undoing ? this.redoStack : this.undoStack\n if (undoing) {\n this.stopCapturing() // next undo should not be appended to last stack item\n } else if (!redoing) {\n // neither undoing nor redoing: delete redoStack\n this.clear(false, true)\n }\n const insertions = new DeleteSet()\n transaction.afterState.forEach((endClock, client) => {\n const startClock = transaction.beforeState.get(client) || 0\n const len = endClock - startClock\n if (len > 0) {\n addToDeleteSet(insertions, client, startClock, len)\n }\n })\n const now = time.getUnixTime()\n let didAdd = false\n if (this.lastChange > 0 && now - this.lastChange < this.captureTimeout && stack.length > 0 && !undoing && !redoing) {\n // append change to last stack op\n const lastOp = stack[stack.length - 1]\n lastOp.deletions = mergeDeleteSets([lastOp.deletions, transaction.deleteSet])\n lastOp.insertions = mergeDeleteSets([lastOp.insertions, insertions])\n } else {\n // create a new stack op\n stack.push(new StackItem(transaction.deleteSet, insertions))\n didAdd = true\n }\n if (!undoing && !redoing) {\n this.lastChange = now\n }\n // make sure that deleted structs are not gc'd\n iterateDeletedStructs(transaction, transaction.deleteSet, /** @param {Item|GC} item */ item => {\n if (item instanceof Item && this.scope.some(type => type === transaction.doc || isParentOf(/** @type {AbstractType} */ (type), item))) {\n keepItem(item, true)\n }\n })\n /**\n * @type {[StackItemEvent, UndoManager]}\n */\n const changeEvent = [{ stackItem: stack[stack.length - 1], origin: transaction.origin, type: undoing ? 'redo' : 'undo', changedParentTypes: transaction.changedParentTypes }, this]\n if (didAdd) {\n this.emit('stack-item-added', changeEvent)\n } else {\n this.emit('stack-item-updated', changeEvent)\n }\n }\n this.doc.on('afterTransaction', this.afterTransactionHandler)\n this.doc.on('destroy', () => {\n this.destroy()\n })\n }\n\n /**\n * Extend the scope.\n *\n * @param {Array | Doc> | AbstractType | Doc} ytypes\n */\n addToScope (ytypes) {\n const tmpSet = new Set(this.scope)\n ytypes = array.isArray(ytypes) ? ytypes : [ytypes]\n ytypes.forEach(ytype => {\n if (!tmpSet.has(ytype)) {\n tmpSet.add(ytype)\n if (ytype instanceof AbstractType ? ytype.doc !== this.doc : ytype !== this.doc) logging.warn('[yjs#509] Not same Y.Doc') // use MultiDocUndoManager instead. also see https://github.com/yjs/yjs/issues/509\n this.scope.push(ytype)\n }\n })\n }\n\n /**\n * @param {any} origin\n */\n addTrackedOrigin (origin) {\n this.trackedOrigins.add(origin)\n }\n\n /**\n * @param {any} origin\n */\n removeTrackedOrigin (origin) {\n this.trackedOrigins.delete(origin)\n }\n\n clear (clearUndoStack = true, clearRedoStack = true) {\n if ((clearUndoStack && this.canUndo()) || (clearRedoStack && this.canRedo())) {\n this.doc.transact(tr => {\n if (clearUndoStack) {\n this.undoStack.forEach(item => clearUndoManagerStackItem(tr, this, item))\n this.undoStack = []\n }\n if (clearRedoStack) {\n this.redoStack.forEach(item => clearUndoManagerStackItem(tr, this, item))\n this.redoStack = []\n }\n this.emit('stack-cleared', [{ undoStackCleared: clearUndoStack, redoStackCleared: clearRedoStack }])\n })\n }\n }\n\n /**\n * UndoManager merges Undo-StackItem if they are created within time-gap\n * smaller than `options.captureTimeout`. Call `um.stopCapturing()` so that the next\n * StackItem won't be merged.\n *\n *\n * @example\n * // without stopCapturing\n * ytext.insert(0, 'a')\n * ytext.insert(1, 'b')\n * um.undo()\n * ytext.toString() // => '' (note that 'ab' was removed)\n * // with stopCapturing\n * ytext.insert(0, 'a')\n * um.stopCapturing()\n * ytext.insert(0, 'b')\n * um.undo()\n * ytext.toString() // => 'a' (note that only 'b' was removed)\n *\n */\n stopCapturing () {\n this.lastChange = 0\n }\n\n /**\n * Undo last changes on type.\n *\n * @return {StackItem?} Returns StackItem if a change was applied\n */\n undo () {\n this.undoing = true\n let res\n try {\n res = popStackItem(this, this.undoStack, 'undo')\n } finally {\n this.undoing = false\n }\n return res\n }\n\n /**\n * Redo last undo operation.\n *\n * @return {StackItem?} Returns StackItem if a change was applied\n */\n redo () {\n this.redoing = true\n let res\n try {\n res = popStackItem(this, this.redoStack, 'redo')\n } finally {\n this.redoing = false\n }\n return res\n }\n\n /**\n * Are undo steps available?\n *\n * @return {boolean} `true` if undo is possible\n */\n canUndo () {\n return this.undoStack.length > 0\n }\n\n /**\n * Are redo steps available?\n *\n * @return {boolean} `true` if redo is possible\n */\n canRedo () {\n return this.redoStack.length > 0\n }\n\n destroy () {\n this.trackedOrigins.delete(this)\n this.doc.off('afterTransaction', this.afterTransactionHandler)\n super.destroy()\n }\n}\n","import * as binary from 'lib0/binary'\nimport * as decoding from 'lib0/decoding'\nimport * as encoding from 'lib0/encoding'\nimport * as error from 'lib0/error'\nimport * as f from 'lib0/function'\nimport * as logging from 'lib0/logging'\nimport * as map from 'lib0/map'\nimport * as math from 'lib0/math'\nimport * as string from 'lib0/string'\n\nimport {\n ContentAny,\n ContentBinary,\n ContentDeleted,\n ContentDoc,\n ContentEmbed,\n ContentFormat,\n ContentJSON,\n ContentString,\n ContentType,\n createID,\n decodeStateVector,\n DSEncoderV1,\n DSEncoderV2,\n GC,\n Item,\n mergeDeleteSets,\n readDeleteSet,\n readItemContent,\n Skip,\n UpdateDecoderV1,\n UpdateDecoderV2,\n UpdateEncoderV1,\n UpdateEncoderV2,\n writeDeleteSet,\n YXmlElement,\n YXmlHook\n} from '../internals.js'\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n */\nfunction * lazyStructReaderGenerator (decoder) {\n const numOfStateUpdates = decoding.readVarUint(decoder.restDecoder)\n for (let i = 0; i < numOfStateUpdates; i++) {\n const numberOfStructs = decoding.readVarUint(decoder.restDecoder)\n const client = decoder.readClient()\n let clock = decoding.readVarUint(decoder.restDecoder)\n for (let i = 0; i < numberOfStructs; i++) {\n const info = decoder.readInfo()\n // @todo use switch instead of ifs\n if (info === 10) {\n const len = decoding.readVarUint(decoder.restDecoder)\n yield new Skip(createID(client, clock), len)\n clock += len\n } else if ((binary.BITS5 & info) !== 0) {\n const cantCopyParentInfo = (info & (binary.BIT7 | binary.BIT8)) === 0\n // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y`\n // and we read the next string as parentYKey.\n // It indicates how we store/retrieve parent from `y.share`\n // @type {string|null}\n const struct = new Item(\n createID(client, clock),\n null, // left\n (info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null, // origin\n null, // right\n (info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null, // right origin\n // @ts-ignore Force writing a string here.\n cantCopyParentInfo ? (decoder.readParentInfo() ? decoder.readString() : decoder.readLeftID()) : null, // parent\n cantCopyParentInfo && (info & binary.BIT6) === binary.BIT6 ? decoder.readString() : null, // parentSub\n readItemContent(decoder, info) // item content\n )\n yield struct\n clock += struct.length\n } else {\n const len = decoder.readLen()\n yield new GC(createID(client, clock), len)\n clock += len\n }\n }\n }\n}\n\nexport class LazyStructReader {\n /**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @param {boolean} filterSkips\n */\n constructor (decoder, filterSkips) {\n this.gen = lazyStructReaderGenerator(decoder)\n /**\n * @type {null | Item | Skip | GC}\n */\n this.curr = null\n this.done = false\n this.filterSkips = filterSkips\n this.next()\n }\n\n /**\n * @return {Item | GC | Skip |null}\n */\n next () {\n // ignore \"Skip\" structs\n do {\n this.curr = this.gen.next().value || null\n } while (this.filterSkips && this.curr !== null && this.curr.constructor === Skip)\n return this.curr\n }\n}\n\n/**\n * @param {Uint8Array} update\n *\n */\nexport const logUpdate = update => logUpdateV2(update, UpdateDecoderV1)\n\n/**\n * @param {Uint8Array} update\n * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder]\n *\n */\nexport const logUpdateV2 = (update, YDecoder = UpdateDecoderV2) => {\n const structs = []\n const updateDecoder = new YDecoder(decoding.createDecoder(update))\n const lazyDecoder = new LazyStructReader(updateDecoder, false)\n for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) {\n structs.push(curr)\n }\n logging.print('Structs: ', structs)\n const ds = readDeleteSet(updateDecoder)\n logging.print('DeleteSet: ', ds)\n}\n\n/**\n * @param {Uint8Array} update\n *\n */\nexport const decodeUpdate = (update) => decodeUpdateV2(update, UpdateDecoderV1)\n\n/**\n * @param {Uint8Array} update\n * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder]\n *\n */\nexport const decodeUpdateV2 = (update, YDecoder = UpdateDecoderV2) => {\n const structs = []\n const updateDecoder = new YDecoder(decoding.createDecoder(update))\n const lazyDecoder = new LazyStructReader(updateDecoder, false)\n for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) {\n structs.push(curr)\n }\n return {\n structs,\n ds: readDeleteSet(updateDecoder)\n }\n}\n\nexport class LazyStructWriter {\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n */\n constructor (encoder) {\n this.currClient = 0\n this.startClock = 0\n this.written = 0\n this.encoder = encoder\n /**\n * We want to write operations lazily, but also we need to know beforehand how many operations we want to write for each client.\n *\n * This kind of meta-information (#clients, #structs-per-client-written) is written to the restEncoder.\n *\n * We fragment the restEncoder and store a slice of it per-client until we know how many clients there are.\n * When we flush (toUint8Array) we write the restEncoder using the fragments and the meta-information.\n *\n * @type {Array<{ written: number, restEncoder: Uint8Array }>}\n */\n this.clientStructs = []\n }\n}\n\n/**\n * @param {Array} updates\n * @return {Uint8Array}\n */\nexport const mergeUpdates = updates => mergeUpdatesV2(updates, UpdateDecoderV1, UpdateEncoderV1)\n\n/**\n * @param {Uint8Array} update\n * @param {typeof DSEncoderV1 | typeof DSEncoderV2} YEncoder\n * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} YDecoder\n * @return {Uint8Array}\n */\nexport const encodeStateVectorFromUpdateV2 = (update, YEncoder = DSEncoderV2, YDecoder = UpdateDecoderV2) => {\n const encoder = new YEncoder()\n const updateDecoder = new LazyStructReader(new YDecoder(decoding.createDecoder(update)), false)\n let curr = updateDecoder.curr\n if (curr !== null) {\n let size = 0\n let currClient = curr.id.client\n let stopCounting = curr.id.clock !== 0 // must start at 0\n let currClock = stopCounting ? 0 : curr.id.clock + curr.length\n for (; curr !== null; curr = updateDecoder.next()) {\n if (currClient !== curr.id.client) {\n if (currClock !== 0) {\n size++\n // We found a new client\n // write what we have to the encoder\n encoding.writeVarUint(encoder.restEncoder, currClient)\n encoding.writeVarUint(encoder.restEncoder, currClock)\n }\n currClient = curr.id.client\n currClock = 0\n stopCounting = curr.id.clock !== 0\n }\n // we ignore skips\n if (curr.constructor === Skip) {\n stopCounting = true\n }\n if (!stopCounting) {\n currClock = curr.id.clock + curr.length\n }\n }\n // write what we have\n if (currClock !== 0) {\n size++\n encoding.writeVarUint(encoder.restEncoder, currClient)\n encoding.writeVarUint(encoder.restEncoder, currClock)\n }\n // prepend the size of the state vector\n const enc = encoding.createEncoder()\n encoding.writeVarUint(enc, size)\n encoding.writeBinaryEncoder(enc, encoder.restEncoder)\n encoder.restEncoder = enc\n return encoder.toUint8Array()\n } else {\n encoding.writeVarUint(encoder.restEncoder, 0)\n return encoder.toUint8Array()\n }\n}\n\n/**\n * @param {Uint8Array} update\n * @return {Uint8Array}\n */\nexport const encodeStateVectorFromUpdate = update => encodeStateVectorFromUpdateV2(update, DSEncoderV1, UpdateDecoderV1)\n\n/**\n * @param {Uint8Array} update\n * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} YDecoder\n * @return {{ from: Map, to: Map }}\n */\nexport const parseUpdateMetaV2 = (update, YDecoder = UpdateDecoderV2) => {\n /**\n * @type {Map}\n */\n const from = new Map()\n /**\n * @type {Map}\n */\n const to = new Map()\n const updateDecoder = new LazyStructReader(new YDecoder(decoding.createDecoder(update)), false)\n let curr = updateDecoder.curr\n if (curr !== null) {\n let currClient = curr.id.client\n let currClock = curr.id.clock\n // write the beginning to `from`\n from.set(currClient, currClock)\n for (; curr !== null; curr = updateDecoder.next()) {\n if (currClient !== curr.id.client) {\n // We found a new client\n // write the end to `to`\n to.set(currClient, currClock)\n // write the beginning to `from`\n from.set(curr.id.client, curr.id.clock)\n // update currClient\n currClient = curr.id.client\n }\n currClock = curr.id.clock + curr.length\n }\n // write the end to `to`\n to.set(currClient, currClock)\n }\n return { from, to }\n}\n\n/**\n * @param {Uint8Array} update\n * @return {{ from: Map, to: Map }}\n */\nexport const parseUpdateMeta = update => parseUpdateMetaV2(update, UpdateDecoderV1)\n\n/**\n * This method is intended to slice any kind of struct and retrieve the right part.\n * It does not handle side-effects, so it should only be used by the lazy-encoder.\n *\n * @param {Item | GC | Skip} left\n * @param {number} diff\n * @return {Item | GC}\n */\nconst sliceStruct = (left, diff) => {\n if (left.constructor === GC) {\n const { client, clock } = left.id\n return new GC(createID(client, clock + diff), left.length - diff)\n } else if (left.constructor === Skip) {\n const { client, clock } = left.id\n return new Skip(createID(client, clock + diff), left.length - diff)\n } else {\n const leftItem = /** @type {Item} */ (left)\n const { client, clock } = leftItem.id\n return new Item(\n createID(client, clock + diff),\n null,\n createID(client, clock + diff - 1),\n null,\n leftItem.rightOrigin,\n leftItem.parent,\n leftItem.parentSub,\n leftItem.content.splice(diff)\n )\n }\n}\n\n/**\n *\n * This function works similarly to `readUpdateV2`.\n *\n * @param {Array} updates\n * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder]\n * @param {typeof UpdateEncoderV1 | typeof UpdateEncoderV2} [YEncoder]\n * @return {Uint8Array}\n */\nexport const mergeUpdatesV2 = (updates, YDecoder = UpdateDecoderV2, YEncoder = UpdateEncoderV2) => {\n if (updates.length === 1) {\n return updates[0]\n }\n const updateDecoders = updates.map(update => new YDecoder(decoding.createDecoder(update)))\n let lazyStructDecoders = updateDecoders.map(decoder => new LazyStructReader(decoder, true))\n\n /**\n * @todo we don't need offset because we always slice before\n * @type {null | { struct: Item | GC | Skip, offset: number }}\n */\n let currWrite = null\n\n const updateEncoder = new YEncoder()\n // write structs lazily\n const lazyStructEncoder = new LazyStructWriter(updateEncoder)\n\n // Note: We need to ensure that all lazyStructDecoders are fully consumed\n // Note: Should merge document updates whenever possible - even from different updates\n // Note: Should handle that some operations cannot be applied yet ()\n\n while (true) {\n // Write higher clients first ⇒ sort by clientID & clock and remove decoders without content\n lazyStructDecoders = lazyStructDecoders.filter(dec => dec.curr !== null)\n lazyStructDecoders.sort(\n /** @type {function(any,any):number} */ (dec1, dec2) => {\n if (dec1.curr.id.client === dec2.curr.id.client) {\n const clockDiff = dec1.curr.id.clock - dec2.curr.id.clock\n if (clockDiff === 0) {\n // @todo remove references to skip since the structDecoders must filter Skips.\n return dec1.curr.constructor === dec2.curr.constructor\n ? 0\n : dec1.curr.constructor === Skip ? 1 : -1 // we are filtering skips anyway.\n } else {\n return clockDiff\n }\n } else {\n return dec2.curr.id.client - dec1.curr.id.client\n }\n }\n )\n if (lazyStructDecoders.length === 0) {\n break\n }\n const currDecoder = lazyStructDecoders[0]\n // write from currDecoder until the next operation is from another client or if filler-struct\n // then we need to reorder the decoders and find the next operation to write\n const firstClient = /** @type {Item | GC} */ (currDecoder.curr).id.client\n\n if (currWrite !== null) {\n let curr = /** @type {Item | GC | null} */ (currDecoder.curr)\n let iterated = false\n\n // iterate until we find something that we haven't written already\n // remember: first the high client-ids are written\n while (curr !== null && curr.id.clock + curr.length <= currWrite.struct.id.clock + currWrite.struct.length && curr.id.client >= currWrite.struct.id.client) {\n curr = currDecoder.next()\n iterated = true\n }\n if (\n curr === null || // current decoder is empty\n curr.id.client !== firstClient || // check whether there is another decoder that has has updates from `firstClient`\n (iterated && curr.id.clock > currWrite.struct.id.clock + currWrite.struct.length) // the above while loop was used and we are potentially missing updates\n ) {\n continue\n }\n\n if (firstClient !== currWrite.struct.id.client) {\n writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset)\n currWrite = { struct: curr, offset: 0 }\n currDecoder.next()\n } else {\n if (currWrite.struct.id.clock + currWrite.struct.length < curr.id.clock) {\n // @todo write currStruct & set currStruct = Skip(clock = currStruct.id.clock + currStruct.length, length = curr.id.clock - self.clock)\n if (currWrite.struct.constructor === Skip) {\n // extend existing skip\n currWrite.struct.length = curr.id.clock + curr.length - currWrite.struct.id.clock\n } else {\n writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset)\n const diff = curr.id.clock - currWrite.struct.id.clock - currWrite.struct.length\n /**\n * @type {Skip}\n */\n const struct = new Skip(createID(firstClient, currWrite.struct.id.clock + currWrite.struct.length), diff)\n currWrite = { struct, offset: 0 }\n }\n } else { // if (currWrite.struct.id.clock + currWrite.struct.length >= curr.id.clock) {\n const diff = currWrite.struct.id.clock + currWrite.struct.length - curr.id.clock\n if (diff > 0) {\n if (currWrite.struct.constructor === Skip) {\n // prefer to slice Skip because the other struct might contain more information\n currWrite.struct.length -= diff\n } else {\n curr = sliceStruct(curr, diff)\n }\n }\n if (!currWrite.struct.mergeWith(/** @type {any} */ (curr))) {\n writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset)\n currWrite = { struct: curr, offset: 0 }\n currDecoder.next()\n }\n }\n }\n } else {\n currWrite = { struct: /** @type {Item | GC} */ (currDecoder.curr), offset: 0 }\n currDecoder.next()\n }\n for (\n let next = currDecoder.curr;\n next !== null && next.id.client === firstClient && next.id.clock === currWrite.struct.id.clock + currWrite.struct.length && next.constructor !== Skip;\n next = currDecoder.next()\n ) {\n writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset)\n currWrite = { struct: next, offset: 0 }\n }\n }\n if (currWrite !== null) {\n writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset)\n currWrite = null\n }\n finishLazyStructWriting(lazyStructEncoder)\n\n const dss = updateDecoders.map(decoder => readDeleteSet(decoder))\n const ds = mergeDeleteSets(dss)\n writeDeleteSet(updateEncoder, ds)\n return updateEncoder.toUint8Array()\n}\n\n/**\n * @param {Uint8Array} update\n * @param {Uint8Array} sv\n * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder]\n * @param {typeof UpdateEncoderV1 | typeof UpdateEncoderV2} [YEncoder]\n */\nexport const diffUpdateV2 = (update, sv, YDecoder = UpdateDecoderV2, YEncoder = UpdateEncoderV2) => {\n const state = decodeStateVector(sv)\n const encoder = new YEncoder()\n const lazyStructWriter = new LazyStructWriter(encoder)\n const decoder = new YDecoder(decoding.createDecoder(update))\n const reader = new LazyStructReader(decoder, false)\n while (reader.curr) {\n const curr = reader.curr\n const currClient = curr.id.client\n const svClock = state.get(currClient) || 0\n if (reader.curr.constructor === Skip) {\n // the first written struct shouldn't be a skip\n reader.next()\n continue\n }\n if (curr.id.clock + curr.length > svClock) {\n writeStructToLazyStructWriter(lazyStructWriter, curr, math.max(svClock - curr.id.clock, 0))\n reader.next()\n while (reader.curr && reader.curr.id.client === currClient) {\n writeStructToLazyStructWriter(lazyStructWriter, reader.curr, 0)\n reader.next()\n }\n } else {\n // read until something new comes up\n while (reader.curr && reader.curr.id.client === currClient && reader.curr.id.clock + reader.curr.length <= svClock) {\n reader.next()\n }\n }\n }\n finishLazyStructWriting(lazyStructWriter)\n // write ds\n const ds = readDeleteSet(decoder)\n writeDeleteSet(encoder, ds)\n return encoder.toUint8Array()\n}\n\n/**\n * @param {Uint8Array} update\n * @param {Uint8Array} sv\n */\nexport const diffUpdate = (update, sv) => diffUpdateV2(update, sv, UpdateDecoderV1, UpdateEncoderV1)\n\n/**\n * @param {LazyStructWriter} lazyWriter\n */\nconst flushLazyStructWriter = lazyWriter => {\n if (lazyWriter.written > 0) {\n lazyWriter.clientStructs.push({ written: lazyWriter.written, restEncoder: encoding.toUint8Array(lazyWriter.encoder.restEncoder) })\n lazyWriter.encoder.restEncoder = encoding.createEncoder()\n lazyWriter.written = 0\n }\n}\n\n/**\n * @param {LazyStructWriter} lazyWriter\n * @param {Item | GC} struct\n * @param {number} offset\n */\nconst writeStructToLazyStructWriter = (lazyWriter, struct, offset) => {\n // flush curr if we start another client\n if (lazyWriter.written > 0 && lazyWriter.currClient !== struct.id.client) {\n flushLazyStructWriter(lazyWriter)\n }\n if (lazyWriter.written === 0) {\n lazyWriter.currClient = struct.id.client\n // write next client\n lazyWriter.encoder.writeClient(struct.id.client)\n // write startClock\n encoding.writeVarUint(lazyWriter.encoder.restEncoder, struct.id.clock + offset)\n }\n struct.write(lazyWriter.encoder, offset)\n lazyWriter.written++\n}\n/**\n * Call this function when we collected all parts and want to\n * put all the parts together. After calling this method,\n * you can continue using the UpdateEncoder.\n *\n * @param {LazyStructWriter} lazyWriter\n */\nconst finishLazyStructWriting = (lazyWriter) => {\n flushLazyStructWriter(lazyWriter)\n\n // this is a fresh encoder because we called flushCurr\n const restEncoder = lazyWriter.encoder.restEncoder\n\n /**\n * Now we put all the fragments together.\n * This works similarly to `writeClientsStructs`\n */\n\n // write # states that were updated - i.e. the clients\n encoding.writeVarUint(restEncoder, lazyWriter.clientStructs.length)\n\n for (let i = 0; i < lazyWriter.clientStructs.length; i++) {\n const partStructs = lazyWriter.clientStructs[i]\n /**\n * Works similarly to `writeStructs`\n */\n // write # encoded structs\n encoding.writeVarUint(restEncoder, partStructs.written)\n // write the rest of the fragment\n encoding.writeUint8Array(restEncoder, partStructs.restEncoder)\n }\n}\n\n/**\n * @param {Uint8Array} update\n * @param {function(Item|GC|Skip):Item|GC|Skip} blockTransformer\n * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} YDecoder\n * @param {typeof UpdateEncoderV2 | typeof UpdateEncoderV1 } YEncoder\n */\nexport const convertUpdateFormat = (update, blockTransformer, YDecoder, YEncoder) => {\n const updateDecoder = new YDecoder(decoding.createDecoder(update))\n const lazyDecoder = new LazyStructReader(updateDecoder, false)\n const updateEncoder = new YEncoder()\n const lazyWriter = new LazyStructWriter(updateEncoder)\n for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) {\n writeStructToLazyStructWriter(lazyWriter, blockTransformer(curr), 0)\n }\n finishLazyStructWriting(lazyWriter)\n const ds = readDeleteSet(updateDecoder)\n writeDeleteSet(updateEncoder, ds)\n return updateEncoder.toUint8Array()\n}\n\n/**\n * @typedef {Object} ObfuscatorOptions\n * @property {boolean} [ObfuscatorOptions.formatting=true]\n * @property {boolean} [ObfuscatorOptions.subdocs=true]\n * @property {boolean} [ObfuscatorOptions.yxml=true] Whether to obfuscate nodeName / hookName\n */\n\n/**\n * @param {ObfuscatorOptions} obfuscator\n */\nconst createObfuscator = ({ formatting = true, subdocs = true, yxml = true } = {}) => {\n let i = 0\n const mapKeyCache = map.create()\n const nodeNameCache = map.create()\n const formattingKeyCache = map.create()\n const formattingValueCache = map.create()\n formattingValueCache.set(null, null) // end of a formatting range should always be the end of a formatting range\n /**\n * @param {Item|GC|Skip} block\n * @return {Item|GC|Skip}\n */\n return block => {\n switch (block.constructor) {\n case GC:\n case Skip:\n return block\n case Item: {\n const item = /** @type {Item} */ (block)\n const content = item.content\n switch (content.constructor) {\n case ContentDeleted:\n break\n case ContentType: {\n if (yxml) {\n const type = /** @type {ContentType} */ (content).type\n if (type instanceof YXmlElement) {\n type.nodeName = map.setIfUndefined(nodeNameCache, type.nodeName, () => 'node-' + i)\n }\n if (type instanceof YXmlHook) {\n type.hookName = map.setIfUndefined(nodeNameCache, type.hookName, () => 'hook-' + i)\n }\n }\n break\n }\n case ContentAny: {\n const c = /** @type {ContentAny} */ (content)\n c.arr = c.arr.map(() => i)\n break\n }\n case ContentBinary: {\n const c = /** @type {ContentBinary} */ (content)\n c.content = new Uint8Array([i])\n break\n }\n case ContentDoc: {\n const c = /** @type {ContentDoc} */ (content)\n if (subdocs) {\n c.opts = {}\n c.doc.guid = i + ''\n }\n break\n }\n case ContentEmbed: {\n const c = /** @type {ContentEmbed} */ (content)\n c.embed = {}\n break\n }\n case ContentFormat: {\n const c = /** @type {ContentFormat} */ (content)\n if (formatting) {\n c.key = map.setIfUndefined(formattingKeyCache, c.key, () => i + '')\n c.value = map.setIfUndefined(formattingValueCache, c.value, () => ({ i }))\n }\n break\n }\n case ContentJSON: {\n const c = /** @type {ContentJSON} */ (content)\n c.arr = c.arr.map(() => i)\n break\n }\n case ContentString: {\n const c = /** @type {ContentString} */ (content)\n c.str = string.repeat((i % 10) + '', c.str.length)\n break\n }\n default:\n // unknown content type\n error.unexpectedCase()\n }\n if (item.parentSub) {\n item.parentSub = map.setIfUndefined(mapKeyCache, item.parentSub, () => i + '')\n }\n i++\n return block\n }\n default:\n // unknown block-type\n error.unexpectedCase()\n }\n }\n}\n\n/**\n * This function obfuscates the content of a Yjs update. This is useful to share\n * buggy Yjs documents while significantly limiting the possibility that a\n * developer can on the user. Note that it might still be possible to deduce\n * some information by analyzing the \"structure\" of the document or by analyzing\n * the typing behavior using the CRDT-related metadata that is still kept fully\n * intact.\n *\n * @param {Uint8Array} update\n * @param {ObfuscatorOptions} [opts]\n */\nexport const obfuscateUpdate = (update, opts) => convertUpdateFormat(update, createObfuscator(opts), UpdateDecoderV1, UpdateEncoderV1)\n\n/**\n * @param {Uint8Array} update\n * @param {ObfuscatorOptions} [opts]\n */\nexport const obfuscateUpdateV2 = (update, opts) => convertUpdateFormat(update, createObfuscator(opts), UpdateDecoderV2, UpdateEncoderV2)\n\n/**\n * @param {Uint8Array} update\n */\nexport const convertUpdateFormatV1ToV2 = update => convertUpdateFormat(update, f.id, UpdateDecoderV1, UpdateEncoderV2)\n\n/**\n * @param {Uint8Array} update\n */\nexport const convertUpdateFormatV2ToV1 = update => convertUpdateFormat(update, f.id, UpdateDecoderV2, UpdateEncoderV1)\n","import {\n isDeleted,\n Item, AbstractType, Transaction, AbstractStruct // eslint-disable-line\n} from '../internals.js'\n\nimport * as set from 'lib0/set'\nimport * as array from 'lib0/array'\nimport * as error from 'lib0/error'\n\nconst errorComputeChanges = 'You must not compute changes after the event-handler fired.'\n\n/**\n * @template {AbstractType} T\n * YEvent describes the changes on a YType.\n */\nexport class YEvent {\n /**\n * @param {T} target The changed type.\n * @param {Transaction} transaction\n */\n constructor (target, transaction) {\n /**\n * The type on which this event was created on.\n * @type {T}\n */\n this.target = target\n /**\n * The current target on which the observe callback is called.\n * @type {AbstractType}\n */\n this.currentTarget = target\n /**\n * The transaction that triggered this event.\n * @type {Transaction}\n */\n this.transaction = transaction\n /**\n * @type {Object|null}\n */\n this._changes = null\n /**\n * @type {null | Map}\n */\n this._keys = null\n /**\n * @type {null | Array<{ insert?: string | Array | object | AbstractType, retain?: number, delete?: number, attributes?: Object }>}\n */\n this._delta = null\n /**\n * @type {Array|null}\n */\n this._path = null\n }\n\n /**\n * Computes the path from `y` to the changed type.\n *\n * @todo v14 should standardize on path: Array<{parent, index}> because that is easier to work with.\n *\n * The following property holds:\n * @example\n * let type = y\n * event.path.forEach(dir => {\n * type = type.get(dir)\n * })\n * type === event.target // => true\n */\n get path () {\n return this._path || (this._path = getPathTo(this.currentTarget, this.target))\n }\n\n /**\n * Check if a struct is deleted by this event.\n *\n * In contrast to change.deleted, this method also returns true if the struct was added and then deleted.\n *\n * @param {AbstractStruct} struct\n * @return {boolean}\n */\n deletes (struct) {\n return isDeleted(this.transaction.deleteSet, struct.id)\n }\n\n /**\n * @type {Map}\n */\n get keys () {\n if (this._keys === null) {\n if (this.transaction.doc._transactionCleanups.length === 0) {\n throw error.create(errorComputeChanges)\n }\n const keys = new Map()\n const target = this.target\n const changed = /** @type Set */ (this.transaction.changed.get(target))\n changed.forEach(key => {\n if (key !== null) {\n const item = /** @type {Item} */ (target._map.get(key))\n /**\n * @type {'delete' | 'add' | 'update'}\n */\n let action\n let oldValue\n if (this.adds(item)) {\n let prev = item.left\n while (prev !== null && this.adds(prev)) {\n prev = prev.left\n }\n if (this.deletes(item)) {\n if (prev !== null && this.deletes(prev)) {\n action = 'delete'\n oldValue = array.last(prev.content.getContent())\n } else {\n return\n }\n } else {\n if (prev !== null && this.deletes(prev)) {\n action = 'update'\n oldValue = array.last(prev.content.getContent())\n } else {\n action = 'add'\n oldValue = undefined\n }\n }\n } else {\n if (this.deletes(item)) {\n action = 'delete'\n oldValue = array.last(/** @type {Item} */ item.content.getContent())\n } else {\n return // nop\n }\n }\n keys.set(key, { action, oldValue })\n }\n })\n this._keys = keys\n }\n return this._keys\n }\n\n /**\n * This is a computed property. Note that this can only be safely computed during the\n * event call. Computing this property after other changes happened might result in\n * unexpected behavior (incorrect computation of deltas). A safe way to collect changes\n * is to store the `changes` or the `delta` object. Avoid storing the `transaction` object.\n *\n * @type {Array<{insert?: string | Array | object | AbstractType, retain?: number, delete?: number, attributes?: Object}>}\n */\n get delta () {\n return this.changes.delta\n }\n\n /**\n * Check if a struct is added by this event.\n *\n * In contrast to change.deleted, this method also returns true if the struct was added and then deleted.\n *\n * @param {AbstractStruct} struct\n * @return {boolean}\n */\n adds (struct) {\n return struct.id.clock >= (this.transaction.beforeState.get(struct.id.client) || 0)\n }\n\n /**\n * This is a computed property. Note that this can only be safely computed during the\n * event call. Computing this property after other changes happened might result in\n * unexpected behavior (incorrect computation of deltas). A safe way to collect changes\n * is to store the `changes` or the `delta` object. Avoid storing the `transaction` object.\n *\n * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string, delete?:number, retain?:number}>}}\n */\n get changes () {\n let changes = this._changes\n if (changes === null) {\n if (this.transaction.doc._transactionCleanups.length === 0) {\n throw error.create(errorComputeChanges)\n }\n const target = this.target\n const added = set.create()\n const deleted = set.create()\n /**\n * @type {Array<{insert:Array}|{delete:number}|{retain:number}>}\n */\n const delta = []\n changes = {\n added,\n deleted,\n delta,\n keys: this.keys\n }\n const changed = /** @type Set */ (this.transaction.changed.get(target))\n if (changed.has(null)) {\n /**\n * @type {any}\n */\n let lastOp = null\n const packOp = () => {\n if (lastOp) {\n delta.push(lastOp)\n }\n }\n for (let item = target._start; item !== null; item = item.right) {\n if (item.deleted) {\n if (this.deletes(item) && !this.adds(item)) {\n if (lastOp === null || lastOp.delete === undefined) {\n packOp()\n lastOp = { delete: 0 }\n }\n lastOp.delete += item.length\n deleted.add(item)\n } // else nop\n } else {\n if (this.adds(item)) {\n if (lastOp === null || lastOp.insert === undefined) {\n packOp()\n lastOp = { insert: [] }\n }\n lastOp.insert = lastOp.insert.concat(item.content.getContent())\n added.add(item)\n } else {\n if (lastOp === null || lastOp.retain === undefined) {\n packOp()\n lastOp = { retain: 0 }\n }\n lastOp.retain += item.length\n }\n }\n }\n if (lastOp !== null && lastOp.retain === undefined) {\n packOp()\n }\n }\n this._changes = changes\n }\n return /** @type {any} */ (changes)\n }\n}\n\n/**\n * Compute the path from this type to the specified target.\n *\n * @example\n * // `child` should be accessible via `type.get(path[0]).get(path[1])..`\n * const path = type.getPathTo(child)\n * // assuming `type instanceof YArray`\n * console.log(path) // might look like => [2, 'key1']\n * child === type.get(path[0]).get(path[1])\n *\n * @param {AbstractType} parent\n * @param {AbstractType} child target\n * @return {Array} Path to the target\n *\n * @private\n * @function\n */\nconst getPathTo = (parent, child) => {\n const path = []\n while (child._item !== null && child !== parent) {\n if (child._item.parentSub !== null) {\n // parent is map-ish\n path.unshift(child._item.parentSub)\n } else {\n // parent is array-ish\n let i = 0\n let c = /** @type {AbstractType} */ (child._item.parent)._start\n while (c !== child._item && c !== null) {\n if (!c.deleted && c.countable) {\n i += c.length\n }\n c = c.right\n }\n path.unshift(i)\n }\n child = /** @type {AbstractType} */ (child._item.parent)\n }\n return path\n}\n","import {\n removeEventHandlerListener,\n callEventHandlerListeners,\n addEventHandlerListener,\n createEventHandler,\n getState,\n isVisible,\n ContentType,\n createID,\n ContentAny,\n ContentBinary,\n getItemCleanStart,\n ContentDoc, YText, YArray, UpdateEncoderV1, UpdateEncoderV2, Doc, Snapshot, Transaction, EventHandler, YEvent, Item, // eslint-disable-line\n} from '../internals.js'\n\nimport * as map from 'lib0/map'\nimport * as iterator from 'lib0/iterator'\nimport * as error from 'lib0/error'\nimport * as math from 'lib0/math'\nimport * as log from 'lib0/logging'\n\n/**\n * https://docs.yjs.dev/getting-started/working-with-shared-types#caveats\n */\nexport const warnPrematureAccess = () => { log.warn('Invalid access: Add Yjs type to a document before reading data.') }\n\nconst maxSearchMarker = 80\n\n/**\n * A unique timestamp that identifies each marker.\n *\n * Time is relative,.. this is more like an ever-increasing clock.\n *\n * @type {number}\n */\nlet globalSearchMarkerTimestamp = 0\n\nexport class ArraySearchMarker {\n /**\n * @param {Item} p\n * @param {number} index\n */\n constructor (p, index) {\n p.marker = true\n this.p = p\n this.index = index\n this.timestamp = globalSearchMarkerTimestamp++\n }\n}\n\n/**\n * @param {ArraySearchMarker} marker\n */\nconst refreshMarkerTimestamp = marker => { marker.timestamp = globalSearchMarkerTimestamp++ }\n\n/**\n * This is rather complex so this function is the only thing that should overwrite a marker\n *\n * @param {ArraySearchMarker} marker\n * @param {Item} p\n * @param {number} index\n */\nconst overwriteMarker = (marker, p, index) => {\n marker.p.marker = false\n marker.p = p\n p.marker = true\n marker.index = index\n marker.timestamp = globalSearchMarkerTimestamp++\n}\n\n/**\n * @param {Array} searchMarker\n * @param {Item} p\n * @param {number} index\n */\nconst markPosition = (searchMarker, p, index) => {\n if (searchMarker.length >= maxSearchMarker) {\n // override oldest marker (we don't want to create more objects)\n const marker = searchMarker.reduce((a, b) => a.timestamp < b.timestamp ? a : b)\n overwriteMarker(marker, p, index)\n return marker\n } else {\n // create new marker\n const pm = new ArraySearchMarker(p, index)\n searchMarker.push(pm)\n return pm\n }\n}\n\n/**\n * Search marker help us to find positions in the associative array faster.\n *\n * They speed up the process of finding a position without much bookkeeping.\n *\n * A maximum of `maxSearchMarker` objects are created.\n *\n * This function always returns a refreshed marker (updated timestamp)\n *\n * @param {AbstractType} yarray\n * @param {number} index\n */\nexport const findMarker = (yarray, index) => {\n if (yarray._start === null || index === 0 || yarray._searchMarker === null) {\n return null\n }\n const marker = yarray._searchMarker.length === 0 ? null : yarray._searchMarker.reduce((a, b) => math.abs(index - a.index) < math.abs(index - b.index) ? a : b)\n let p = yarray._start\n let pindex = 0\n if (marker !== null) {\n p = marker.p\n pindex = marker.index\n refreshMarkerTimestamp(marker) // we used it, we might need to use it again\n }\n // iterate to right if possible\n while (p.right !== null && pindex < index) {\n if (!p.deleted && p.countable) {\n if (index < pindex + p.length) {\n break\n }\n pindex += p.length\n }\n p = p.right\n }\n // iterate to left if necessary (might be that pindex > index)\n while (p.left !== null && pindex > index) {\n p = p.left\n if (!p.deleted && p.countable) {\n pindex -= p.length\n }\n }\n // we want to make sure that p can't be merged with left, because that would screw up everything\n // in that cas just return what we have (it is most likely the best marker anyway)\n // iterate to left until p can't be merged with left\n while (p.left !== null && p.left.id.client === p.id.client && p.left.id.clock + p.left.length === p.id.clock) {\n p = p.left\n if (!p.deleted && p.countable) {\n pindex -= p.length\n }\n }\n\n // @todo remove!\n // assure position\n // {\n // let start = yarray._start\n // let pos = 0\n // while (start !== p) {\n // if (!start.deleted && start.countable) {\n // pos += start.length\n // }\n // start = /** @type {Item} */ (start.right)\n // }\n // if (pos !== pindex) {\n // debugger\n // throw new Error('Gotcha position fail!')\n // }\n // }\n // if (marker) {\n // if (window.lengths == null) {\n // window.lengths = []\n // window.getLengths = () => window.lengths.sort((a, b) => a - b)\n // }\n // window.lengths.push(marker.index - pindex)\n // console.log('distance', marker.index - pindex, 'len', p && p.parent.length)\n // }\n if (marker !== null && math.abs(marker.index - pindex) < /** @type {YText|YArray} */ (p.parent).length / maxSearchMarker) {\n // adjust existing marker\n overwriteMarker(marker, p, pindex)\n return marker\n } else {\n // create new marker\n return markPosition(yarray._searchMarker, p, pindex)\n }\n}\n\n/**\n * Update markers when a change happened.\n *\n * This should be called before doing a deletion!\n *\n * @param {Array} searchMarker\n * @param {number} index\n * @param {number} len If insertion, len is positive. If deletion, len is negative.\n */\nexport const updateMarkerChanges = (searchMarker, index, len) => {\n for (let i = searchMarker.length - 1; i >= 0; i--) {\n const m = searchMarker[i]\n if (len > 0) {\n /**\n * @type {Item|null}\n */\n let p = m.p\n p.marker = false\n // Ideally we just want to do a simple position comparison, but this will only work if\n // search markers don't point to deleted items for formats.\n // Iterate marker to prev undeleted countable position so we know what to do when updating a position\n while (p && (p.deleted || !p.countable)) {\n p = p.left\n if (p && !p.deleted && p.countable) {\n // adjust position. the loop should break now\n m.index -= p.length\n }\n }\n if (p === null || p.marker === true) {\n // remove search marker if updated position is null or if position is already marked\n searchMarker.splice(i, 1)\n continue\n }\n m.p = p\n p.marker = true\n }\n if (index < m.index || (len > 0 && index === m.index)) { // a simple index <= m.index check would actually suffice\n m.index = math.max(index, m.index + len)\n }\n }\n}\n\n/**\n * Accumulate all (list) children of a type and return them as an Array.\n *\n * @param {AbstractType} t\n * @return {Array}\n */\nexport const getTypeChildren = t => {\n t.doc ?? warnPrematureAccess()\n let s = t._start\n const arr = []\n while (s) {\n arr.push(s)\n s = s.right\n }\n return arr\n}\n\n/**\n * Call event listeners with an event. This will also add an event to all\n * parents (for `.observeDeep` handlers).\n *\n * @template EventType\n * @param {AbstractType} type\n * @param {Transaction} transaction\n * @param {EventType} event\n */\nexport const callTypeObservers = (type, transaction, event) => {\n const changedType = type\n const changedParentTypes = transaction.changedParentTypes\n while (true) {\n // @ts-ignore\n map.setIfUndefined(changedParentTypes, type, () => []).push(event)\n if (type._item === null) {\n break\n }\n type = /** @type {AbstractType} */ (type._item.parent)\n }\n callEventHandlerListeners(changedType._eH, event, transaction)\n}\n\n/**\n * @template EventType\n * Abstract Yjs Type class\n */\nexport class AbstractType {\n constructor () {\n /**\n * @type {Item|null}\n */\n this._item = null\n /**\n * @type {Map}\n */\n this._map = new Map()\n /**\n * @type {Item|null}\n */\n this._start = null\n /**\n * @type {Doc|null}\n */\n this.doc = null\n this._length = 0\n /**\n * Event handlers\n * @type {EventHandler}\n */\n this._eH = createEventHandler()\n /**\n * Deep event handlers\n * @type {EventHandler>,Transaction>}\n */\n this._dEH = createEventHandler()\n /**\n * @type {null | Array}\n */\n this._searchMarker = null\n }\n\n /**\n * @return {AbstractType|null}\n */\n get parent () {\n return this._item ? /** @type {AbstractType} */ (this._item.parent) : null\n }\n\n /**\n * Integrate this type into the Yjs instance.\n *\n * * Save this struct in the os\n * * This type is sent to other client\n * * Observer functions are fired\n *\n * @param {Doc} y The Yjs instance\n * @param {Item|null} item\n */\n _integrate (y, item) {\n this.doc = y\n this._item = item\n }\n\n /**\n * @return {AbstractType}\n */\n _copy () {\n throw error.methodUnimplemented()\n }\n\n /**\n * Makes a copy of this data type that can be included somewhere else.\n *\n * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.\n *\n * @return {AbstractType}\n */\n clone () {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} _encoder\n */\n _write (_encoder) { }\n\n /**\n * The first non-deleted item\n */\n get _first () {\n let n = this._start\n while (n !== null && n.deleted) {\n n = n.right\n }\n return n\n }\n\n /**\n * Creates YEvent and calls all type observers.\n * Must be implemented by each type.\n *\n * @param {Transaction} transaction\n * @param {Set} _parentSubs Keys changed on this type. `null` if list was modified.\n */\n _callObserver (transaction, _parentSubs) {\n if (!transaction.local && this._searchMarker) {\n this._searchMarker.length = 0\n }\n }\n\n /**\n * Observe all events that are created on this type.\n *\n * @param {function(EventType, Transaction):void} f Observer function\n */\n observe (f) {\n addEventHandlerListener(this._eH, f)\n }\n\n /**\n * Observe all events that are created by this type and its children.\n *\n * @param {function(Array>,Transaction):void} f Observer function\n */\n observeDeep (f) {\n addEventHandlerListener(this._dEH, f)\n }\n\n /**\n * Unregister an observer function.\n *\n * @param {function(EventType,Transaction):void} f Observer function\n */\n unobserve (f) {\n removeEventHandlerListener(this._eH, f)\n }\n\n /**\n * Unregister an observer function.\n *\n * @param {function(Array>,Transaction):void} f Observer function\n */\n unobserveDeep (f) {\n removeEventHandlerListener(this._dEH, f)\n }\n\n /**\n * @abstract\n * @return {any}\n */\n toJSON () {}\n}\n\n/**\n * @param {AbstractType} type\n * @param {number} start\n * @param {number} end\n * @return {Array}\n *\n * @private\n * @function\n */\nexport const typeListSlice = (type, start, end) => {\n type.doc ?? warnPrematureAccess()\n if (start < 0) {\n start = type._length + start\n }\n if (end < 0) {\n end = type._length + end\n }\n let len = end - start\n const cs = []\n let n = type._start\n while (n !== null && len > 0) {\n if (n.countable && !n.deleted) {\n const c = n.content.getContent()\n if (c.length <= start) {\n start -= c.length\n } else {\n for (let i = start; i < c.length && len > 0; i++) {\n cs.push(c[i])\n len--\n }\n start = 0\n }\n }\n n = n.right\n }\n return cs\n}\n\n/**\n * @param {AbstractType} type\n * @return {Array}\n *\n * @private\n * @function\n */\nexport const typeListToArray = type => {\n type.doc ?? warnPrematureAccess()\n const cs = []\n let n = type._start\n while (n !== null) {\n if (n.countable && !n.deleted) {\n const c = n.content.getContent()\n for (let i = 0; i < c.length; i++) {\n cs.push(c[i])\n }\n }\n n = n.right\n }\n return cs\n}\n\n/**\n * @param {AbstractType} type\n * @param {Snapshot} snapshot\n * @return {Array}\n *\n * @private\n * @function\n */\nexport const typeListToArraySnapshot = (type, snapshot) => {\n const cs = []\n let n = type._start\n while (n !== null) {\n if (n.countable && isVisible(n, snapshot)) {\n const c = n.content.getContent()\n for (let i = 0; i < c.length; i++) {\n cs.push(c[i])\n }\n }\n n = n.right\n }\n return cs\n}\n\n/**\n * Executes a provided function on once on every element of this YArray.\n *\n * @param {AbstractType} type\n * @param {function(any,number,any):void} f A function to execute on every element of this YArray.\n *\n * @private\n * @function\n */\nexport const typeListForEach = (type, f) => {\n let index = 0\n let n = type._start\n type.doc ?? warnPrematureAccess()\n while (n !== null) {\n if (n.countable && !n.deleted) {\n const c = n.content.getContent()\n for (let i = 0; i < c.length; i++) {\n f(c[i], index++, type)\n }\n }\n n = n.right\n }\n}\n\n/**\n * @template C,R\n * @param {AbstractType} type\n * @param {function(C,number,AbstractType):R} f\n * @return {Array}\n *\n * @private\n * @function\n */\nexport const typeListMap = (type, f) => {\n /**\n * @type {Array}\n */\n const result = []\n typeListForEach(type, (c, i) => {\n result.push(f(c, i, type))\n })\n return result\n}\n\n/**\n * @param {AbstractType} type\n * @return {IterableIterator}\n *\n * @private\n * @function\n */\nexport const typeListCreateIterator = type => {\n let n = type._start\n /**\n * @type {Array|null}\n */\n let currentContent = null\n let currentContentIndex = 0\n return {\n [Symbol.iterator] () {\n return this\n },\n next: () => {\n // find some content\n if (currentContent === null) {\n while (n !== null && n.deleted) {\n n = n.right\n }\n // check if we reached the end, no need to check currentContent, because it does not exist\n if (n === null) {\n return {\n done: true,\n value: undefined\n }\n }\n // we found n, so we can set currentContent\n currentContent = n.content.getContent()\n currentContentIndex = 0\n n = n.right // we used the content of n, now iterate to next\n }\n const value = currentContent[currentContentIndex++]\n // check if we need to empty currentContent\n if (currentContent.length <= currentContentIndex) {\n currentContent = null\n }\n return {\n done: false,\n value\n }\n }\n }\n}\n\n/**\n * Executes a provided function on once on every element of this YArray.\n * Operates on a snapshotted state of the document.\n *\n * @param {AbstractType} type\n * @param {function(any,number,AbstractType):void} f A function to execute on every element of this YArray.\n * @param {Snapshot} snapshot\n *\n * @private\n * @function\n */\nexport const typeListForEachSnapshot = (type, f, snapshot) => {\n let index = 0\n let n = type._start\n while (n !== null) {\n if (n.countable && isVisible(n, snapshot)) {\n const c = n.content.getContent()\n for (let i = 0; i < c.length; i++) {\n f(c[i], index++, type)\n }\n }\n n = n.right\n }\n}\n\n/**\n * @param {AbstractType} type\n * @param {number} index\n * @return {any}\n *\n * @private\n * @function\n */\nexport const typeListGet = (type, index) => {\n type.doc ?? warnPrematureAccess()\n const marker = findMarker(type, index)\n let n = type._start\n if (marker !== null) {\n n = marker.p\n index -= marker.index\n }\n for (; n !== null; n = n.right) {\n if (!n.deleted && n.countable) {\n if (index < n.length) {\n return n.content.getContent()[index]\n }\n index -= n.length\n }\n }\n}\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {Item?} referenceItem\n * @param {Array|Array|boolean|number|null|string|Uint8Array>} content\n *\n * @private\n * @function\n */\nexport const typeListInsertGenericsAfter = (transaction, parent, referenceItem, content) => {\n let left = referenceItem\n const doc = transaction.doc\n const ownClientId = doc.clientID\n const store = doc.store\n const right = referenceItem === null ? parent._start : referenceItem.right\n /**\n * @type {Array|number|null>}\n */\n let jsonContent = []\n const packJsonContent = () => {\n if (jsonContent.length > 0) {\n left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentAny(jsonContent))\n left.integrate(transaction, 0)\n jsonContent = []\n }\n }\n content.forEach(c => {\n if (c === null) {\n jsonContent.push(c)\n } else {\n switch (c.constructor) {\n case Number:\n case Object:\n case Boolean:\n case Array:\n case String:\n jsonContent.push(c)\n break\n default:\n packJsonContent()\n switch (c.constructor) {\n case Uint8Array:\n case ArrayBuffer:\n left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentBinary(new Uint8Array(/** @type {Uint8Array} */ (c))))\n left.integrate(transaction, 0)\n break\n case Doc:\n left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentDoc(/** @type {Doc} */ (c)))\n left.integrate(transaction, 0)\n break\n default:\n if (c instanceof AbstractType) {\n left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentType(c))\n left.integrate(transaction, 0)\n } else {\n throw new Error('Unexpected content type in insert operation')\n }\n }\n }\n }\n })\n packJsonContent()\n}\n\nconst lengthExceeded = () => error.create('Length exceeded!')\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {number} index\n * @param {Array|Array|number|null|string|Uint8Array>} content\n *\n * @private\n * @function\n */\nexport const typeListInsertGenerics = (transaction, parent, index, content) => {\n if (index > parent._length) {\n throw lengthExceeded()\n }\n if (index === 0) {\n if (parent._searchMarker) {\n updateMarkerChanges(parent._searchMarker, index, content.length)\n }\n return typeListInsertGenericsAfter(transaction, parent, null, content)\n }\n const startIndex = index\n const marker = findMarker(parent, index)\n let n = parent._start\n if (marker !== null) {\n n = marker.p\n index -= marker.index\n // we need to iterate one to the left so that the algorithm works\n if (index === 0) {\n // @todo refactor this as it actually doesn't consider formats\n n = n.prev // important! get the left undeleted item so that we can actually decrease index\n index += (n && n.countable && !n.deleted) ? n.length : 0\n }\n }\n for (; n !== null; n = n.right) {\n if (!n.deleted && n.countable) {\n if (index <= n.length) {\n if (index < n.length) {\n // insert in-between\n getItemCleanStart(transaction, createID(n.id.client, n.id.clock + index))\n }\n break\n }\n index -= n.length\n }\n }\n if (parent._searchMarker) {\n updateMarkerChanges(parent._searchMarker, startIndex, content.length)\n }\n return typeListInsertGenericsAfter(transaction, parent, n, content)\n}\n\n/**\n * Pushing content is special as we generally want to push after the last item. So we don't have to update\n * the search marker.\n *\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {Array|Array|number|null|string|Uint8Array>} content\n *\n * @private\n * @function\n */\nexport const typeListPushGenerics = (transaction, parent, content) => {\n // Use the marker with the highest index and iterate to the right.\n const marker = (parent._searchMarker || []).reduce((maxMarker, currMarker) => currMarker.index > maxMarker.index ? currMarker : maxMarker, { index: 0, p: parent._start })\n let n = marker.p\n if (n) {\n while (n.right) {\n n = n.right\n }\n }\n return typeListInsertGenericsAfter(transaction, parent, n, content)\n}\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {number} index\n * @param {number} length\n *\n * @private\n * @function\n */\nexport const typeListDelete = (transaction, parent, index, length) => {\n if (length === 0) { return }\n const startIndex = index\n const startLength = length\n const marker = findMarker(parent, index)\n let n = parent._start\n if (marker !== null) {\n n = marker.p\n index -= marker.index\n }\n // compute the first item to be deleted\n for (; n !== null && index > 0; n = n.right) {\n if (!n.deleted && n.countable) {\n if (index < n.length) {\n getItemCleanStart(transaction, createID(n.id.client, n.id.clock + index))\n }\n index -= n.length\n }\n }\n // delete all items until done\n while (length > 0 && n !== null) {\n if (!n.deleted) {\n if (length < n.length) {\n getItemCleanStart(transaction, createID(n.id.client, n.id.clock + length))\n }\n n.delete(transaction)\n length -= n.length\n }\n n = n.right\n }\n if (length > 0) {\n throw lengthExceeded()\n }\n if (parent._searchMarker) {\n updateMarkerChanges(parent._searchMarker, startIndex, -startLength + length /* in case we remove the above exception */)\n }\n}\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {string} key\n *\n * @private\n * @function\n */\nexport const typeMapDelete = (transaction, parent, key) => {\n const c = parent._map.get(key)\n if (c !== undefined) {\n c.delete(transaction)\n }\n}\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {string} key\n * @param {Object|number|null|Array|string|Uint8Array|AbstractType} value\n *\n * @private\n * @function\n */\nexport const typeMapSet = (transaction, parent, key, value) => {\n const left = parent._map.get(key) || null\n const doc = transaction.doc\n const ownClientId = doc.clientID\n let content\n if (value == null) {\n content = new ContentAny([value])\n } else {\n switch (value.constructor) {\n case Number:\n case Object:\n case Boolean:\n case Array:\n case String:\n case Date:\n case BigInt:\n content = new ContentAny([value])\n break\n case Uint8Array:\n content = new ContentBinary(/** @type {Uint8Array} */ (value))\n break\n case Doc:\n content = new ContentDoc(/** @type {Doc} */ (value))\n break\n default:\n if (value instanceof AbstractType) {\n content = new ContentType(value)\n } else {\n throw new Error('Unexpected content type')\n }\n }\n }\n new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, null, null, parent, key, content).integrate(transaction, 0)\n}\n\n/**\n * @param {AbstractType} parent\n * @param {string} key\n * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined}\n *\n * @private\n * @function\n */\nexport const typeMapGet = (parent, key) => {\n parent.doc ?? warnPrematureAccess()\n const val = parent._map.get(key)\n return val !== undefined && !val.deleted ? val.content.getContent()[val.length - 1] : undefined\n}\n\n/**\n * @param {AbstractType} parent\n * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined>}\n *\n * @private\n * @function\n */\nexport const typeMapGetAll = (parent) => {\n /**\n * @type {Object}\n */\n const res = {}\n parent.doc ?? warnPrematureAccess()\n parent._map.forEach((value, key) => {\n if (!value.deleted) {\n res[key] = value.content.getContent()[value.length - 1]\n }\n })\n return res\n}\n\n/**\n * @param {AbstractType} parent\n * @param {string} key\n * @return {boolean}\n *\n * @private\n * @function\n */\nexport const typeMapHas = (parent, key) => {\n parent.doc ?? warnPrematureAccess()\n const val = parent._map.get(key)\n return val !== undefined && !val.deleted\n}\n\n/**\n * @param {AbstractType} parent\n * @param {string} key\n * @param {Snapshot} snapshot\n * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined}\n *\n * @private\n * @function\n */\nexport const typeMapGetSnapshot = (parent, key, snapshot) => {\n let v = parent._map.get(key) || null\n while (v !== null && (!snapshot.sv.has(v.id.client) || v.id.clock >= (snapshot.sv.get(v.id.client) || 0))) {\n v = v.left\n }\n return v !== null && isVisible(v, snapshot) ? v.content.getContent()[v.length - 1] : undefined\n}\n\n/**\n * @param {AbstractType} parent\n * @param {Snapshot} snapshot\n * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined>}\n *\n * @private\n * @function\n */\nexport const typeMapGetAllSnapshot = (parent, snapshot) => {\n /**\n * @type {Object}\n */\n const res = {}\n parent._map.forEach((value, key) => {\n /**\n * @type {Item|null}\n */\n let v = value\n while (v !== null && (!snapshot.sv.has(v.id.client) || v.id.clock >= (snapshot.sv.get(v.id.client) || 0))) {\n v = v.left\n }\n if (v !== null && isVisible(v, snapshot)) {\n res[key] = v.content.getContent()[v.length - 1]\n }\n })\n return res\n}\n\n/**\n * @param {AbstractType & { _map: Map }} type\n * @return {IterableIterator>}\n *\n * @private\n * @function\n */\nexport const createMapIterator = type => {\n type.doc ?? warnPrematureAccess()\n return iterator.iteratorFilter(type._map.entries(), /** @param {any} entry */ entry => !entry[1].deleted)\n}\n","/**\n * @module YArray\n */\n\nimport {\n YEvent,\n AbstractType,\n typeListGet,\n typeListToArray,\n typeListForEach,\n typeListCreateIterator,\n typeListInsertGenerics,\n typeListPushGenerics,\n typeListDelete,\n typeListMap,\n YArrayRefID,\n callTypeObservers,\n transact,\n warnPrematureAccess,\n ArraySearchMarker, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Doc, Transaction, Item // eslint-disable-line\n} from '../internals.js'\nimport { typeListSlice } from './AbstractType.js'\n\n/**\n * Event that describes the changes on a YArray\n * @template T\n * @extends YEvent>\n */\nexport class YArrayEvent extends YEvent {}\n\n/**\n * A shared Array implementation.\n * @template T\n * @extends AbstractType>\n * @implements {Iterable}\n */\nexport class YArray extends AbstractType {\n constructor () {\n super()\n /**\n * @type {Array?}\n * @private\n */\n this._prelimContent = []\n /**\n * @type {Array}\n */\n this._searchMarker = []\n }\n\n /**\n * Construct a new YArray containing the specified items.\n * @template {Object|Array|number|null|string|Uint8Array} T\n * @param {Array} items\n * @return {YArray}\n */\n static from (items) {\n /**\n * @type {YArray}\n */\n const a = new YArray()\n a.push(items)\n return a\n }\n\n /**\n * Integrate this type into the Yjs instance.\n *\n * * Save this struct in the os\n * * This type is sent to other client\n * * Observer functions are fired\n *\n * @param {Doc} y The Yjs instance\n * @param {Item} item\n */\n _integrate (y, item) {\n super._integrate(y, item)\n this.insert(0, /** @type {Array} */ (this._prelimContent))\n this._prelimContent = null\n }\n\n /**\n * @return {YArray}\n */\n _copy () {\n return new YArray()\n }\n\n /**\n * Makes a copy of this data type that can be included somewhere else.\n *\n * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.\n *\n * @return {YArray}\n */\n clone () {\n /**\n * @type {YArray}\n */\n const arr = new YArray()\n arr.insert(0, this.toArray().map(el =>\n el instanceof AbstractType ? /** @type {typeof el} */ (el.clone()) : el\n ))\n return arr\n }\n\n get length () {\n this.doc ?? warnPrematureAccess()\n return this._length\n }\n\n /**\n * Creates YArrayEvent and calls observers.\n *\n * @param {Transaction} transaction\n * @param {Set} parentSubs Keys changed on this type. `null` if list was modified.\n */\n _callObserver (transaction, parentSubs) {\n super._callObserver(transaction, parentSubs)\n callTypeObservers(this, transaction, new YArrayEvent(this, transaction))\n }\n\n /**\n * Inserts new content at an index.\n *\n * Important: This function expects an array of content. Not just a content\n * object. The reason for this \"weirdness\" is that inserting several elements\n * is very efficient when it is done as a single operation.\n *\n * @example\n * // Insert character 'a' at position 0\n * yarray.insert(0, ['a'])\n * // Insert numbers 1, 2 at position 1\n * yarray.insert(1, [1, 2])\n *\n * @param {number} index The index to insert content at.\n * @param {Array} content The array of content\n */\n insert (index, content) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeListInsertGenerics(transaction, this, index, /** @type {any} */ (content))\n })\n } else {\n /** @type {Array} */ (this._prelimContent).splice(index, 0, ...content)\n }\n }\n\n /**\n * Appends content to this YArray.\n *\n * @param {Array} content Array of content to append.\n *\n * @todo Use the following implementation in all types.\n */\n push (content) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeListPushGenerics(transaction, this, /** @type {any} */ (content))\n })\n } else {\n /** @type {Array} */ (this._prelimContent).push(...content)\n }\n }\n\n /**\n * Prepends content to this YArray.\n *\n * @param {Array} content Array of content to prepend.\n */\n unshift (content) {\n this.insert(0, content)\n }\n\n /**\n * Deletes elements starting from an index.\n *\n * @param {number} index Index at which to start deleting elements\n * @param {number} length The number of elements to remove. Defaults to 1.\n */\n delete (index, length = 1) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeListDelete(transaction, this, index, length)\n })\n } else {\n /** @type {Array} */ (this._prelimContent).splice(index, length)\n }\n }\n\n /**\n * Returns the i-th element from a YArray.\n *\n * @param {number} index The index of the element to return from the YArray\n * @return {T}\n */\n get (index) {\n return typeListGet(this, index)\n }\n\n /**\n * Transforms this YArray to a JavaScript Array.\n *\n * @return {Array}\n */\n toArray () {\n return typeListToArray(this)\n }\n\n /**\n * Returns a portion of this YArray into a JavaScript Array selected\n * from start to end (end not included).\n *\n * @param {number} [start]\n * @param {number} [end]\n * @return {Array}\n */\n slice (start = 0, end = this.length) {\n return typeListSlice(this, start, end)\n }\n\n /**\n * Transforms this Shared Type to a JSON object.\n *\n * @return {Array}\n */\n toJSON () {\n return this.map(c => c instanceof AbstractType ? c.toJSON() : c)\n }\n\n /**\n * Returns an Array with the result of calling a provided function on every\n * element of this YArray.\n *\n * @template M\n * @param {function(T,number,YArray):M} f Function that produces an element of the new Array\n * @return {Array} A new array with each element being the result of the\n * callback function\n */\n map (f) {\n return typeListMap(this, /** @type {any} */ (f))\n }\n\n /**\n * Executes a provided function once on every element of this YArray.\n *\n * @param {function(T,number,YArray):void} f A function to execute on every element of this YArray.\n */\n forEach (f) {\n typeListForEach(this, f)\n }\n\n /**\n * @return {IterableIterator}\n */\n [Symbol.iterator] () {\n return typeListCreateIterator(this)\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n */\n _write (encoder) {\n encoder.writeTypeRef(YArrayRefID)\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder\n *\n * @private\n * @function\n */\nexport const readYArray = _decoder => new YArray()\n","/**\n * @module YMap\n */\n\nimport {\n YEvent,\n AbstractType,\n typeMapDelete,\n typeMapSet,\n typeMapGet,\n typeMapHas,\n createMapIterator,\n YMapRefID,\n callTypeObservers,\n transact,\n warnPrematureAccess,\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Doc, Transaction, Item // eslint-disable-line\n} from '../internals.js'\n\nimport * as iterator from 'lib0/iterator'\n\n/**\n * @template T\n * @extends YEvent>\n * Event that describes the changes on a YMap.\n */\nexport class YMapEvent extends YEvent {\n /**\n * @param {YMap} ymap The YArray that changed.\n * @param {Transaction} transaction\n * @param {Set} subs The keys that changed.\n */\n constructor (ymap, transaction, subs) {\n super(ymap, transaction)\n this.keysChanged = subs\n }\n}\n\n/**\n * @template MapType\n * A shared Map implementation.\n *\n * @extends AbstractType>\n * @implements {Iterable<[string, MapType]>}\n */\nexport class YMap extends AbstractType {\n /**\n *\n * @param {Iterable=} entries - an optional iterable to initialize the YMap\n */\n constructor (entries) {\n super()\n /**\n * @type {Map?}\n * @private\n */\n this._prelimContent = null\n\n if (entries === undefined) {\n this._prelimContent = new Map()\n } else {\n this._prelimContent = new Map(entries)\n }\n }\n\n /**\n * Integrate this type into the Yjs instance.\n *\n * * Save this struct in the os\n * * This type is sent to other client\n * * Observer functions are fired\n *\n * @param {Doc} y The Yjs instance\n * @param {Item} item\n */\n _integrate (y, item) {\n super._integrate(y, item)\n ;/** @type {Map} */ (this._prelimContent).forEach((value, key) => {\n this.set(key, value)\n })\n this._prelimContent = null\n }\n\n /**\n * @return {YMap}\n */\n _copy () {\n return new YMap()\n }\n\n /**\n * Makes a copy of this data type that can be included somewhere else.\n *\n * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.\n *\n * @return {YMap}\n */\n clone () {\n /**\n * @type {YMap}\n */\n const map = new YMap()\n this.forEach((value, key) => {\n map.set(key, value instanceof AbstractType ? /** @type {typeof value} */ (value.clone()) : value)\n })\n return map\n }\n\n /**\n * Creates YMapEvent and calls observers.\n *\n * @param {Transaction} transaction\n * @param {Set} parentSubs Keys changed on this type. `null` if list was modified.\n */\n _callObserver (transaction, parentSubs) {\n callTypeObservers(this, transaction, new YMapEvent(this, transaction, parentSubs))\n }\n\n /**\n * Transforms this Shared Type to a JSON object.\n *\n * @return {Object}\n */\n toJSON () {\n this.doc ?? warnPrematureAccess()\n /**\n * @type {Object}\n */\n const map = {}\n this._map.forEach((item, key) => {\n if (!item.deleted) {\n const v = item.content.getContent()[item.length - 1]\n map[key] = v instanceof AbstractType ? v.toJSON() : v\n }\n })\n return map\n }\n\n /**\n * Returns the size of the YMap (count of key/value pairs)\n *\n * @return {number}\n */\n get size () {\n return [...createMapIterator(this)].length\n }\n\n /**\n * Returns the keys for each element in the YMap Type.\n *\n * @return {IterableIterator}\n */\n keys () {\n return iterator.iteratorMap(createMapIterator(this), /** @param {any} v */ v => v[0])\n }\n\n /**\n * Returns the values for each element in the YMap Type.\n *\n * @return {IterableIterator}\n */\n values () {\n return iterator.iteratorMap(createMapIterator(this), /** @param {any} v */ v => v[1].content.getContent()[v[1].length - 1])\n }\n\n /**\n * Returns an Iterator of [key, value] pairs\n *\n * @return {IterableIterator<[string, MapType]>}\n */\n entries () {\n return iterator.iteratorMap(createMapIterator(this), /** @param {any} v */ v => /** @type {any} */ ([v[0], v[1].content.getContent()[v[1].length - 1]]))\n }\n\n /**\n * Executes a provided function on once on every key-value pair.\n *\n * @param {function(MapType,string,YMap):void} f A function to execute on every element of this YArray.\n */\n forEach (f) {\n this.doc ?? warnPrematureAccess()\n this._map.forEach((item, key) => {\n if (!item.deleted) {\n f(item.content.getContent()[item.length - 1], key, this)\n }\n })\n }\n\n /**\n * Returns an Iterator of [key, value] pairs\n *\n * @return {IterableIterator<[string, MapType]>}\n */\n [Symbol.iterator] () {\n return this.entries()\n }\n\n /**\n * Remove a specified element from this YMap.\n *\n * @param {string} key The key of the element to remove.\n */\n delete (key) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeMapDelete(transaction, this, key)\n })\n } else {\n /** @type {Map} */ (this._prelimContent).delete(key)\n }\n }\n\n /**\n * Adds or updates an element with a specified key and value.\n * @template {MapType} VAL\n *\n * @param {string} key The key of the element to add to this YMap\n * @param {VAL} value The value of the element to add\n * @return {VAL}\n */\n set (key, value) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeMapSet(transaction, this, key, /** @type {any} */ (value))\n })\n } else {\n /** @type {Map} */ (this._prelimContent).set(key, value)\n }\n return value\n }\n\n /**\n * Returns a specified element from this YMap.\n *\n * @param {string} key\n * @return {MapType|undefined}\n */\n get (key) {\n return /** @type {any} */ (typeMapGet(this, key))\n }\n\n /**\n * Returns a boolean indicating whether the specified key exists or not.\n *\n * @param {string} key The key to test.\n * @return {boolean}\n */\n has (key) {\n return typeMapHas(this, key)\n }\n\n /**\n * Removes all elements from this YMap.\n */\n clear () {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n this.forEach(function (_value, key, map) {\n typeMapDelete(transaction, map, key)\n })\n })\n } else {\n /** @type {Map} */ (this._prelimContent).clear()\n }\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n */\n _write (encoder) {\n encoder.writeTypeRef(YMapRefID)\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder\n *\n * @private\n * @function\n */\nexport const readYMap = _decoder => new YMap()\n","/**\n * @module YText\n */\n\nimport {\n YEvent,\n AbstractType,\n getItemCleanStart,\n getState,\n isVisible,\n createID,\n YTextRefID,\n callTypeObservers,\n transact,\n ContentEmbed,\n GC,\n ContentFormat,\n ContentString,\n splitSnapshotAffectedStructs,\n iterateDeletedStructs,\n iterateStructs,\n findMarker,\n typeMapDelete,\n typeMapSet,\n typeMapGet,\n typeMapGetAll,\n updateMarkerChanges,\n ContentType,\n warnPrematureAccess,\n ArraySearchMarker, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, ID, Doc, Item, Snapshot, Transaction // eslint-disable-line\n} from '../internals.js'\n\nimport * as object from 'lib0/object'\nimport * as map from 'lib0/map'\nimport * as error from 'lib0/error'\n\n/**\n * @param {any} a\n * @param {any} b\n * @return {boolean}\n */\nconst equalAttrs = (a, b) => a === b || (typeof a === 'object' && typeof b === 'object' && a && b && object.equalFlat(a, b))\n\nexport class ItemTextListPosition {\n /**\n * @param {Item|null} left\n * @param {Item|null} right\n * @param {number} index\n * @param {Map} currentAttributes\n */\n constructor (left, right, index, currentAttributes) {\n this.left = left\n this.right = right\n this.index = index\n this.currentAttributes = currentAttributes\n }\n\n /**\n * Only call this if you know that this.right is defined\n */\n forward () {\n if (this.right === null) {\n error.unexpectedCase()\n }\n switch (this.right.content.constructor) {\n case ContentFormat:\n if (!this.right.deleted) {\n updateCurrentAttributes(this.currentAttributes, /** @type {ContentFormat} */ (this.right.content))\n }\n break\n default:\n if (!this.right.deleted) {\n this.index += this.right.length\n }\n break\n }\n this.left = this.right\n this.right = this.right.right\n }\n}\n\n/**\n * @param {Transaction} transaction\n * @param {ItemTextListPosition} pos\n * @param {number} count steps to move forward\n * @return {ItemTextListPosition}\n *\n * @private\n * @function\n */\nconst findNextPosition = (transaction, pos, count) => {\n while (pos.right !== null && count > 0) {\n switch (pos.right.content.constructor) {\n case ContentFormat:\n if (!pos.right.deleted) {\n updateCurrentAttributes(pos.currentAttributes, /** @type {ContentFormat} */ (pos.right.content))\n }\n break\n default:\n if (!pos.right.deleted) {\n if (count < pos.right.length) {\n // split right\n getItemCleanStart(transaction, createID(pos.right.id.client, pos.right.id.clock + count))\n }\n pos.index += pos.right.length\n count -= pos.right.length\n }\n break\n }\n pos.left = pos.right\n pos.right = pos.right.right\n // pos.forward() - we don't forward because that would halve the performance because we already do the checks above\n }\n return pos\n}\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {number} index\n * @param {boolean} useSearchMarker\n * @return {ItemTextListPosition}\n *\n * @private\n * @function\n */\nconst findPosition = (transaction, parent, index, useSearchMarker) => {\n const currentAttributes = new Map()\n const marker = useSearchMarker ? findMarker(parent, index) : null\n if (marker) {\n const pos = new ItemTextListPosition(marker.p.left, marker.p, marker.index, currentAttributes)\n return findNextPosition(transaction, pos, index - marker.index)\n } else {\n const pos = new ItemTextListPosition(null, parent._start, 0, currentAttributes)\n return findNextPosition(transaction, pos, index)\n }\n}\n\n/**\n * Negate applied formats\n *\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {ItemTextListPosition} currPos\n * @param {Map} negatedAttributes\n *\n * @private\n * @function\n */\nconst insertNegatedAttributes = (transaction, parent, currPos, negatedAttributes) => {\n // check if we really need to remove attributes\n while (\n currPos.right !== null && (\n currPos.right.deleted === true || (\n currPos.right.content.constructor === ContentFormat &&\n equalAttrs(negatedAttributes.get(/** @type {ContentFormat} */ (currPos.right.content).key), /** @type {ContentFormat} */ (currPos.right.content).value)\n )\n )\n ) {\n if (!currPos.right.deleted) {\n negatedAttributes.delete(/** @type {ContentFormat} */ (currPos.right.content).key)\n }\n currPos.forward()\n }\n const doc = transaction.doc\n const ownClientId = doc.clientID\n negatedAttributes.forEach((val, key) => {\n const left = currPos.left\n const right = currPos.right\n const nextFormat = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentFormat(key, val))\n nextFormat.integrate(transaction, 0)\n currPos.right = nextFormat\n currPos.forward()\n })\n}\n\n/**\n * @param {Map} currentAttributes\n * @param {ContentFormat} format\n *\n * @private\n * @function\n */\nconst updateCurrentAttributes = (currentAttributes, format) => {\n const { key, value } = format\n if (value === null) {\n currentAttributes.delete(key)\n } else {\n currentAttributes.set(key, value)\n }\n}\n\n/**\n * @param {ItemTextListPosition} currPos\n * @param {Object} attributes\n *\n * @private\n * @function\n */\nconst minimizeAttributeChanges = (currPos, attributes) => {\n // go right while attributes[right.key] === right.value (or right is deleted)\n while (true) {\n if (currPos.right === null) {\n break\n } else if (currPos.right.deleted || (currPos.right.content.constructor === ContentFormat && equalAttrs(attributes[(/** @type {ContentFormat} */ (currPos.right.content)).key] ?? null, /** @type {ContentFormat} */ (currPos.right.content).value))) {\n //\n } else {\n break\n }\n currPos.forward()\n }\n}\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {ItemTextListPosition} currPos\n * @param {Object} attributes\n * @return {Map}\n *\n * @private\n * @function\n **/\nconst insertAttributes = (transaction, parent, currPos, attributes) => {\n const doc = transaction.doc\n const ownClientId = doc.clientID\n const negatedAttributes = new Map()\n // insert format-start items\n for (const key in attributes) {\n const val = attributes[key]\n const currentVal = currPos.currentAttributes.get(key) ?? null\n if (!equalAttrs(currentVal, val)) {\n // save negated attribute (set null if currentVal undefined)\n negatedAttributes.set(key, currentVal)\n const { left, right } = currPos\n currPos.right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentFormat(key, val))\n currPos.right.integrate(transaction, 0)\n currPos.forward()\n }\n }\n return negatedAttributes\n}\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {ItemTextListPosition} currPos\n * @param {string|object|AbstractType} text\n * @param {Object} attributes\n *\n * @private\n * @function\n **/\nconst insertText = (transaction, parent, currPos, text, attributes) => {\n currPos.currentAttributes.forEach((_val, key) => {\n if (attributes[key] === undefined) {\n attributes[key] = null\n }\n })\n const doc = transaction.doc\n const ownClientId = doc.clientID\n minimizeAttributeChanges(currPos, attributes)\n const negatedAttributes = insertAttributes(transaction, parent, currPos, attributes)\n // insert content\n const content = text.constructor === String ? new ContentString(/** @type {string} */ (text)) : (text instanceof AbstractType ? new ContentType(text) : new ContentEmbed(text))\n let { left, right, index } = currPos\n if (parent._searchMarker) {\n updateMarkerChanges(parent._searchMarker, currPos.index, content.getLength())\n }\n right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, content)\n right.integrate(transaction, 0)\n currPos.right = right\n currPos.index = index\n currPos.forward()\n insertNegatedAttributes(transaction, parent, currPos, negatedAttributes)\n}\n\n/**\n * @param {Transaction} transaction\n * @param {AbstractType} parent\n * @param {ItemTextListPosition} currPos\n * @param {number} length\n * @param {Object} attributes\n *\n * @private\n * @function\n */\nconst formatText = (transaction, parent, currPos, length, attributes) => {\n const doc = transaction.doc\n const ownClientId = doc.clientID\n minimizeAttributeChanges(currPos, attributes)\n const negatedAttributes = insertAttributes(transaction, parent, currPos, attributes)\n // iterate until first non-format or null is found\n // delete all formats with attributes[format.key] != null\n // also check the attributes after the first non-format as we do not want to insert redundant negated attributes there\n // eslint-disable-next-line no-labels\n iterationLoop: while (\n currPos.right !== null &&\n (length > 0 ||\n (\n negatedAttributes.size > 0 &&\n (currPos.right.deleted || currPos.right.content.constructor === ContentFormat)\n )\n )\n ) {\n if (!currPos.right.deleted) {\n switch (currPos.right.content.constructor) {\n case ContentFormat: {\n const { key, value } = /** @type {ContentFormat} */ (currPos.right.content)\n const attr = attributes[key]\n if (attr !== undefined) {\n if (equalAttrs(attr, value)) {\n negatedAttributes.delete(key)\n } else {\n if (length === 0) {\n // no need to further extend negatedAttributes\n // eslint-disable-next-line no-labels\n break iterationLoop\n }\n negatedAttributes.set(key, value)\n }\n currPos.right.delete(transaction)\n } else {\n currPos.currentAttributes.set(key, value)\n }\n break\n }\n default:\n if (length < currPos.right.length) {\n getItemCleanStart(transaction, createID(currPos.right.id.client, currPos.right.id.clock + length))\n }\n length -= currPos.right.length\n break\n }\n }\n currPos.forward()\n }\n // Quill just assumes that the editor starts with a newline and that it always\n // ends with a newline. We only insert that newline when a new newline is\n // inserted - i.e when length is bigger than type.length\n if (length > 0) {\n let newlines = ''\n for (; length > 0; length--) {\n newlines += '\\n'\n }\n currPos.right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), currPos.left, currPos.left && currPos.left.lastId, currPos.right, currPos.right && currPos.right.id, parent, null, new ContentString(newlines))\n currPos.right.integrate(transaction, 0)\n currPos.forward()\n }\n insertNegatedAttributes(transaction, parent, currPos, negatedAttributes)\n}\n\n/**\n * Call this function after string content has been deleted in order to\n * clean up formatting Items.\n *\n * @param {Transaction} transaction\n * @param {Item} start\n * @param {Item|null} curr exclusive end, automatically iterates to the next Content Item\n * @param {Map} startAttributes\n * @param {Map} currAttributes\n * @return {number} The amount of formatting Items deleted.\n *\n * @function\n */\nconst cleanupFormattingGap = (transaction, start, curr, startAttributes, currAttributes) => {\n /**\n * @type {Item|null}\n */\n let end = start\n /**\n * @type {Map}\n */\n const endFormats = map.create()\n while (end && (!end.countable || end.deleted)) {\n if (!end.deleted && end.content.constructor === ContentFormat) {\n const cf = /** @type {ContentFormat} */ (end.content)\n endFormats.set(cf.key, cf)\n }\n end = end.right\n }\n let cleanups = 0\n let reachedCurr = false\n while (start !== end) {\n if (curr === start) {\n reachedCurr = true\n }\n if (!start.deleted) {\n const content = start.content\n switch (content.constructor) {\n case ContentFormat: {\n const { key, value } = /** @type {ContentFormat} */ (content)\n const startAttrValue = startAttributes.get(key) ?? null\n if (endFormats.get(key) !== content || startAttrValue === value) {\n // Either this format is overwritten or it is not necessary because the attribute already existed.\n start.delete(transaction)\n cleanups++\n if (!reachedCurr && (currAttributes.get(key) ?? null) === value && startAttrValue !== value) {\n if (startAttrValue === null) {\n currAttributes.delete(key)\n } else {\n currAttributes.set(key, startAttrValue)\n }\n }\n }\n if (!reachedCurr && !start.deleted) {\n updateCurrentAttributes(currAttributes, /** @type {ContentFormat} */ (content))\n }\n break\n }\n }\n }\n start = /** @type {Item} */ (start.right)\n }\n return cleanups\n}\n\n/**\n * @param {Transaction} transaction\n * @param {Item | null} item\n */\nconst cleanupContextlessFormattingGap = (transaction, item) => {\n // iterate until item.right is null or content\n while (item && item.right && (item.right.deleted || !item.right.countable)) {\n item = item.right\n }\n const attrs = new Set()\n // iterate back until a content item is found\n while (item && (item.deleted || !item.countable)) {\n if (!item.deleted && item.content.constructor === ContentFormat) {\n const key = /** @type {ContentFormat} */ (item.content).key\n if (attrs.has(key)) {\n item.delete(transaction)\n } else {\n attrs.add(key)\n }\n }\n item = item.left\n }\n}\n\n/**\n * This function is experimental and subject to change / be removed.\n *\n * Ideally, we don't need this function at all. Formatting attributes should be cleaned up\n * automatically after each change. This function iterates twice over the complete YText type\n * and removes unnecessary formatting attributes. This is also helpful for testing.\n *\n * This function won't be exported anymore as soon as there is confidence that the YText type works as intended.\n *\n * @param {YText} type\n * @return {number} How many formatting attributes have been cleaned up.\n */\nexport const cleanupYTextFormatting = type => {\n let res = 0\n transact(/** @type {Doc} */ (type.doc), transaction => {\n let start = /** @type {Item} */ (type._start)\n let end = type._start\n let startAttributes = map.create()\n const currentAttributes = map.copy(startAttributes)\n while (end) {\n if (end.deleted === false) {\n switch (end.content.constructor) {\n case ContentFormat:\n updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (end.content))\n break\n default:\n res += cleanupFormattingGap(transaction, start, end, startAttributes, currentAttributes)\n startAttributes = map.copy(currentAttributes)\n start = end\n break\n }\n }\n end = end.right\n }\n })\n return res\n}\n\n/**\n * This will be called by the transaction once the event handlers are called to potentially cleanup\n * formatting attributes.\n *\n * @param {Transaction} transaction\n */\nexport const cleanupYTextAfterTransaction = transaction => {\n /**\n * @type {Set}\n */\n const needFullCleanup = new Set()\n // check if another formatting item was inserted\n const doc = transaction.doc\n for (const [client, afterClock] of transaction.afterState.entries()) {\n const clock = transaction.beforeState.get(client) || 0\n if (afterClock === clock) {\n continue\n }\n iterateStructs(transaction, /** @type {Array} */ (doc.store.clients.get(client)), clock, afterClock, item => {\n if (\n !item.deleted && /** @type {Item} */ (item).content.constructor === ContentFormat && item.constructor !== GC\n ) {\n needFullCleanup.add(/** @type {any} */ (item).parent)\n }\n })\n }\n // cleanup in a new transaction\n transact(doc, (t) => {\n iterateDeletedStructs(transaction, transaction.deleteSet, item => {\n if (item instanceof GC || !(/** @type {YText} */ (item.parent)._hasFormatting) || needFullCleanup.has(/** @type {YText} */ (item.parent))) {\n return\n }\n const parent = /** @type {YText} */ (item.parent)\n if (item.content.constructor === ContentFormat) {\n needFullCleanup.add(parent)\n } else {\n // If no formatting attribute was inserted or deleted, we can make due with contextless\n // formatting cleanups.\n // Contextless: it is not necessary to compute currentAttributes for the affected position.\n cleanupContextlessFormattingGap(t, item)\n }\n })\n // If a formatting item was inserted, we simply clean the whole type.\n // We need to compute currentAttributes for the current position anyway.\n for (const yText of needFullCleanup) {\n cleanupYTextFormatting(yText)\n }\n })\n}\n\n/**\n * @param {Transaction} transaction\n * @param {ItemTextListPosition} currPos\n * @param {number} length\n * @return {ItemTextListPosition}\n *\n * @private\n * @function\n */\nconst deleteText = (transaction, currPos, length) => {\n const startLength = length\n const startAttrs = map.copy(currPos.currentAttributes)\n const start = currPos.right\n while (length > 0 && currPos.right !== null) {\n if (currPos.right.deleted === false) {\n switch (currPos.right.content.constructor) {\n case ContentType:\n case ContentEmbed:\n case ContentString:\n if (length < currPos.right.length) {\n getItemCleanStart(transaction, createID(currPos.right.id.client, currPos.right.id.clock + length))\n }\n length -= currPos.right.length\n currPos.right.delete(transaction)\n break\n }\n }\n currPos.forward()\n }\n if (start) {\n cleanupFormattingGap(transaction, start, currPos.right, startAttrs, currPos.currentAttributes)\n }\n const parent = /** @type {AbstractType} */ (/** @type {Item} */ (currPos.left || currPos.right).parent)\n if (parent._searchMarker) {\n updateMarkerChanges(parent._searchMarker, currPos.index, -startLength + length)\n }\n return currPos\n}\n\n/**\n * The Quill Delta format represents changes on a text document with\n * formatting information. For more information visit {@link https://quilljs.com/docs/delta/|Quill Delta}\n *\n * @example\n * {\n * ops: [\n * { insert: 'Gandalf', attributes: { bold: true } },\n * { insert: ' the ' },\n * { insert: 'Grey', attributes: { color: '#cccccc' } }\n * ]\n * }\n *\n */\n\n/**\n * Attributes that can be assigned to a selection of text.\n *\n * @example\n * {\n * bold: true,\n * font-size: '40px'\n * }\n *\n * @typedef {Object} TextAttributes\n */\n\n/**\n * @extends YEvent\n * Event that describes the changes on a YText type.\n */\nexport class YTextEvent extends YEvent {\n /**\n * @param {YText} ytext\n * @param {Transaction} transaction\n * @param {Set} subs The keys that changed\n */\n constructor (ytext, transaction, subs) {\n super(ytext, transaction)\n /**\n * Whether the children changed.\n * @type {Boolean}\n * @private\n */\n this.childListChanged = false\n /**\n * Set of all changed attributes.\n * @type {Set}\n */\n this.keysChanged = new Set()\n subs.forEach((sub) => {\n if (sub === null) {\n this.childListChanged = true\n } else {\n this.keysChanged.add(sub)\n }\n })\n }\n\n /**\n * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string, delete?:number, retain?:number}>}}\n */\n get changes () {\n if (this._changes === null) {\n /**\n * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string|AbstractType|object, delete?:number, retain?:number}>}}\n */\n const changes = {\n keys: this.keys,\n delta: this.delta,\n added: new Set(),\n deleted: new Set()\n }\n this._changes = changes\n }\n return /** @type {any} */ (this._changes)\n }\n\n /**\n * Compute the changes in the delta format.\n * A {@link https://quilljs.com/docs/delta/|Quill Delta}) that represents the changes on the document.\n *\n * @type {Array<{insert?:string|object|AbstractType, delete?:number, retain?:number, attributes?: Object}>}\n *\n * @public\n */\n get delta () {\n if (this._delta === null) {\n const y = /** @type {Doc} */ (this.target.doc)\n /**\n * @type {Array<{insert?:string|object|AbstractType, delete?:number, retain?:number, attributes?: Object}>}\n */\n const delta = []\n transact(y, transaction => {\n const currentAttributes = new Map() // saves all current attributes for insert\n const oldAttributes = new Map()\n let item = this.target._start\n /**\n * @type {string?}\n */\n let action = null\n /**\n * @type {Object}\n */\n const attributes = {} // counts added or removed new attributes for retain\n /**\n * @type {string|object}\n */\n let insert = ''\n let retain = 0\n let deleteLen = 0\n const addOp = () => {\n if (action !== null) {\n /**\n * @type {any}\n */\n let op = null\n switch (action) {\n case 'delete':\n if (deleteLen > 0) {\n op = { delete: deleteLen }\n }\n deleteLen = 0\n break\n case 'insert':\n if (typeof insert === 'object' || insert.length > 0) {\n op = { insert }\n if (currentAttributes.size > 0) {\n op.attributes = {}\n currentAttributes.forEach((value, key) => {\n if (value !== null) {\n op.attributes[key] = value\n }\n })\n }\n }\n insert = ''\n break\n case 'retain':\n if (retain > 0) {\n op = { retain }\n if (!object.isEmpty(attributes)) {\n op.attributes = object.assign({}, attributes)\n }\n }\n retain = 0\n break\n }\n if (op) delta.push(op)\n action = null\n }\n }\n while (item !== null) {\n switch (item.content.constructor) {\n case ContentType:\n case ContentEmbed:\n if (this.adds(item)) {\n if (!this.deletes(item)) {\n addOp()\n action = 'insert'\n insert = item.content.getContent()[0]\n addOp()\n }\n } else if (this.deletes(item)) {\n if (action !== 'delete') {\n addOp()\n action = 'delete'\n }\n deleteLen += 1\n } else if (!item.deleted) {\n if (action !== 'retain') {\n addOp()\n action = 'retain'\n }\n retain += 1\n }\n break\n case ContentString:\n if (this.adds(item)) {\n if (!this.deletes(item)) {\n if (action !== 'insert') {\n addOp()\n action = 'insert'\n }\n insert += /** @type {ContentString} */ (item.content).str\n }\n } else if (this.deletes(item)) {\n if (action !== 'delete') {\n addOp()\n action = 'delete'\n }\n deleteLen += item.length\n } else if (!item.deleted) {\n if (action !== 'retain') {\n addOp()\n action = 'retain'\n }\n retain += item.length\n }\n break\n case ContentFormat: {\n const { key, value } = /** @type {ContentFormat} */ (item.content)\n if (this.adds(item)) {\n if (!this.deletes(item)) {\n const curVal = currentAttributes.get(key) ?? null\n if (!equalAttrs(curVal, value)) {\n if (action === 'retain') {\n addOp()\n }\n if (equalAttrs(value, (oldAttributes.get(key) ?? null))) {\n delete attributes[key]\n } else {\n attributes[key] = value\n }\n } else if (value !== null) {\n item.delete(transaction)\n }\n }\n } else if (this.deletes(item)) {\n oldAttributes.set(key, value)\n const curVal = currentAttributes.get(key) ?? null\n if (!equalAttrs(curVal, value)) {\n if (action === 'retain') {\n addOp()\n }\n attributes[key] = curVal\n }\n } else if (!item.deleted) {\n oldAttributes.set(key, value)\n const attr = attributes[key]\n if (attr !== undefined) {\n if (!equalAttrs(attr, value)) {\n if (action === 'retain') {\n addOp()\n }\n if (value === null) {\n delete attributes[key]\n } else {\n attributes[key] = value\n }\n } else if (attr !== null) { // this will be cleaned up automatically by the contextless cleanup function\n item.delete(transaction)\n }\n }\n }\n if (!item.deleted) {\n if (action === 'insert') {\n addOp()\n }\n updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (item.content))\n }\n break\n }\n }\n item = item.right\n }\n addOp()\n while (delta.length > 0) {\n const lastOp = delta[delta.length - 1]\n if (lastOp.retain !== undefined && lastOp.attributes === undefined) {\n // retain delta's if they don't assign attributes\n delta.pop()\n } else {\n break\n }\n }\n })\n this._delta = delta\n }\n return /** @type {any} */ (this._delta)\n }\n}\n\n/**\n * Type that represents text with formatting information.\n *\n * This type replaces y-richtext as this implementation is able to handle\n * block formats (format information on a paragraph), embeds (complex elements\n * like pictures and videos), and text formats (**bold**, *italic*).\n *\n * @extends AbstractType\n */\nexport class YText extends AbstractType {\n /**\n * @param {String} [string] The initial value of the YText.\n */\n constructor (string) {\n super()\n /**\n * Array of pending operations on this type\n * @type {Array?}\n */\n this._pending = string !== undefined ? [() => this.insert(0, string)] : []\n /**\n * @type {Array|null}\n */\n this._searchMarker = []\n /**\n * Whether this YText contains formatting attributes.\n * This flag is updated when a formatting item is integrated (see ContentFormat.integrate)\n */\n this._hasFormatting = false\n }\n\n /**\n * Number of characters of this text type.\n *\n * @type {number}\n */\n get length () {\n this.doc ?? warnPrematureAccess()\n return this._length\n }\n\n /**\n * @param {Doc} y\n * @param {Item} item\n */\n _integrate (y, item) {\n super._integrate(y, item)\n try {\n /** @type {Array} */ (this._pending).forEach(f => f())\n } catch (e) {\n console.error(e)\n }\n this._pending = null\n }\n\n _copy () {\n return new YText()\n }\n\n /**\n * Makes a copy of this data type that can be included somewhere else.\n *\n * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.\n *\n * @return {YText}\n */\n clone () {\n const text = new YText()\n text.applyDelta(this.toDelta())\n return text\n }\n\n /**\n * Creates YTextEvent and calls observers.\n *\n * @param {Transaction} transaction\n * @param {Set} parentSubs Keys changed on this type. `null` if list was modified.\n */\n _callObserver (transaction, parentSubs) {\n super._callObserver(transaction, parentSubs)\n const event = new YTextEvent(this, transaction, parentSubs)\n callTypeObservers(this, transaction, event)\n // If a remote change happened, we try to cleanup potential formatting duplicates.\n if (!transaction.local && this._hasFormatting) {\n transaction._needFormattingCleanup = true\n }\n }\n\n /**\n * Returns the unformatted string representation of this YText type.\n *\n * @public\n */\n toString () {\n this.doc ?? warnPrematureAccess()\n let str = ''\n /**\n * @type {Item|null}\n */\n let n = this._start\n while (n !== null) {\n if (!n.deleted && n.countable && n.content.constructor === ContentString) {\n str += /** @type {ContentString} */ (n.content).str\n }\n n = n.right\n }\n return str\n }\n\n /**\n * Returns the unformatted string representation of this YText type.\n *\n * @return {string}\n * @public\n */\n toJSON () {\n return this.toString()\n }\n\n /**\n * Apply a {@link Delta} on this shared YText type.\n *\n * @param {Array} delta The changes to apply on this element.\n * @param {object} opts\n * @param {boolean} [opts.sanitize] Sanitize input delta. Removes ending newlines if set to true.\n *\n *\n * @public\n */\n applyDelta (delta, { sanitize = true } = {}) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n const currPos = new ItemTextListPosition(null, this._start, 0, new Map())\n for (let i = 0; i < delta.length; i++) {\n const op = delta[i]\n if (op.insert !== undefined) {\n // Quill assumes that the content starts with an empty paragraph.\n // Yjs/Y.Text assumes that it starts empty. We always hide that\n // there is a newline at the end of the content.\n // If we omit this step, clients will see a different number of\n // paragraphs, but nothing bad will happen.\n const ins = (!sanitize && typeof op.insert === 'string' && i === delta.length - 1 && currPos.right === null && op.insert.slice(-1) === '\\n') ? op.insert.slice(0, -1) : op.insert\n if (typeof ins !== 'string' || ins.length > 0) {\n insertText(transaction, this, currPos, ins, op.attributes || {})\n }\n } else if (op.retain !== undefined) {\n formatText(transaction, this, currPos, op.retain, op.attributes || {})\n } else if (op.delete !== undefined) {\n deleteText(transaction, currPos, op.delete)\n }\n }\n })\n } else {\n /** @type {Array} */ (this._pending).push(() => this.applyDelta(delta))\n }\n }\n\n /**\n * Returns the Delta representation of this YText type.\n *\n * @param {Snapshot} [snapshot]\n * @param {Snapshot} [prevSnapshot]\n * @param {function('removed' | 'added', ID):any} [computeYChange]\n * @return {any} The Delta representation of this type.\n *\n * @public\n */\n toDelta (snapshot, prevSnapshot, computeYChange) {\n this.doc ?? warnPrematureAccess()\n /**\n * @type{Array}\n */\n const ops = []\n const currentAttributes = new Map()\n const doc = /** @type {Doc} */ (this.doc)\n let str = ''\n let n = this._start\n function packStr () {\n if (str.length > 0) {\n // pack str with attributes to ops\n /**\n * @type {Object}\n */\n const attributes = {}\n let addAttributes = false\n currentAttributes.forEach((value, key) => {\n addAttributes = true\n attributes[key] = value\n })\n /**\n * @type {Object}\n */\n const op = { insert: str }\n if (addAttributes) {\n op.attributes = attributes\n }\n ops.push(op)\n str = ''\n }\n }\n const computeDelta = () => {\n while (n !== null) {\n if (isVisible(n, snapshot) || (prevSnapshot !== undefined && isVisible(n, prevSnapshot))) {\n switch (n.content.constructor) {\n case ContentString: {\n const cur = currentAttributes.get('ychange')\n if (snapshot !== undefined && !isVisible(n, snapshot)) {\n if (cur === undefined || cur.user !== n.id.client || cur.type !== 'removed') {\n packStr()\n currentAttributes.set('ychange', computeYChange ? computeYChange('removed', n.id) : { type: 'removed' })\n }\n } else if (prevSnapshot !== undefined && !isVisible(n, prevSnapshot)) {\n if (cur === undefined || cur.user !== n.id.client || cur.type !== 'added') {\n packStr()\n currentAttributes.set('ychange', computeYChange ? computeYChange('added', n.id) : { type: 'added' })\n }\n } else if (cur !== undefined) {\n packStr()\n currentAttributes.delete('ychange')\n }\n str += /** @type {ContentString} */ (n.content).str\n break\n }\n case ContentType:\n case ContentEmbed: {\n packStr()\n /**\n * @type {Object}\n */\n const op = {\n insert: n.content.getContent()[0]\n }\n if (currentAttributes.size > 0) {\n const attrs = /** @type {Object} */ ({})\n op.attributes = attrs\n currentAttributes.forEach((value, key) => {\n attrs[key] = value\n })\n }\n ops.push(op)\n break\n }\n case ContentFormat:\n if (isVisible(n, snapshot)) {\n packStr()\n updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (n.content))\n }\n break\n }\n }\n n = n.right\n }\n packStr()\n }\n if (snapshot || prevSnapshot) {\n // snapshots are merged again after the transaction, so we need to keep the\n // transaction alive until we are done\n transact(doc, transaction => {\n if (snapshot) {\n splitSnapshotAffectedStructs(transaction, snapshot)\n }\n if (prevSnapshot) {\n splitSnapshotAffectedStructs(transaction, prevSnapshot)\n }\n computeDelta()\n }, 'cleanup')\n } else {\n computeDelta()\n }\n return ops\n }\n\n /**\n * Insert text at a given index.\n *\n * @param {number} index The index at which to start inserting.\n * @param {String} text The text to insert at the specified position.\n * @param {TextAttributes} [attributes] Optionally define some formatting\n * information to apply on the inserted\n * Text.\n * @public\n */\n insert (index, text, attributes) {\n if (text.length <= 0) {\n return\n }\n const y = this.doc\n if (y !== null) {\n transact(y, transaction => {\n const pos = findPosition(transaction, this, index, !attributes)\n if (!attributes) {\n attributes = {}\n // @ts-ignore\n pos.currentAttributes.forEach((v, k) => { attributes[k] = v })\n }\n insertText(transaction, this, pos, text, attributes)\n })\n } else {\n /** @type {Array} */ (this._pending).push(() => this.insert(index, text, attributes))\n }\n }\n\n /**\n * Inserts an embed at a index.\n *\n * @param {number} index The index to insert the embed at.\n * @param {Object | AbstractType} embed The Object that represents the embed.\n * @param {TextAttributes} [attributes] Attribute information to apply on the\n * embed\n *\n * @public\n */\n insertEmbed (index, embed, attributes) {\n const y = this.doc\n if (y !== null) {\n transact(y, transaction => {\n const pos = findPosition(transaction, this, index, !attributes)\n insertText(transaction, this, pos, embed, attributes || {})\n })\n } else {\n /** @type {Array} */ (this._pending).push(() => this.insertEmbed(index, embed, attributes || {}))\n }\n }\n\n /**\n * Deletes text starting from an index.\n *\n * @param {number} index Index at which to start deleting.\n * @param {number} length The number of characters to remove. Defaults to 1.\n *\n * @public\n */\n delete (index, length) {\n if (length === 0) {\n return\n }\n const y = this.doc\n if (y !== null) {\n transact(y, transaction => {\n deleteText(transaction, findPosition(transaction, this, index, true), length)\n })\n } else {\n /** @type {Array} */ (this._pending).push(() => this.delete(index, length))\n }\n }\n\n /**\n * Assigns properties to a range of text.\n *\n * @param {number} index The position where to start formatting.\n * @param {number} length The amount of characters to assign properties to.\n * @param {TextAttributes} attributes Attribute information to apply on the\n * text.\n *\n * @public\n */\n format (index, length, attributes) {\n if (length === 0) {\n return\n }\n const y = this.doc\n if (y !== null) {\n transact(y, transaction => {\n const pos = findPosition(transaction, this, index, false)\n if (pos.right === null) {\n return\n }\n formatText(transaction, this, pos, length, attributes)\n })\n } else {\n /** @type {Array} */ (this._pending).push(() => this.format(index, length, attributes))\n }\n }\n\n /**\n * Removes an attribute.\n *\n * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.\n *\n * @param {String} attributeName The attribute name that is to be removed.\n *\n * @public\n */\n removeAttribute (attributeName) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeMapDelete(transaction, this, attributeName)\n })\n } else {\n /** @type {Array} */ (this._pending).push(() => this.removeAttribute(attributeName))\n }\n }\n\n /**\n * Sets or updates an attribute.\n *\n * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.\n *\n * @param {String} attributeName The attribute name that is to be set.\n * @param {any} attributeValue The attribute value that is to be set.\n *\n * @public\n */\n setAttribute (attributeName, attributeValue) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeMapSet(transaction, this, attributeName, attributeValue)\n })\n } else {\n /** @type {Array} */ (this._pending).push(() => this.setAttribute(attributeName, attributeValue))\n }\n }\n\n /**\n * Returns an attribute value that belongs to the attribute name.\n *\n * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.\n *\n * @param {String} attributeName The attribute name that identifies the\n * queried value.\n * @return {any} The queried attribute value.\n *\n * @public\n */\n getAttribute (attributeName) {\n return /** @type {any} */ (typeMapGet(this, attributeName))\n }\n\n /**\n * Returns all attribute name/value pairs in a JSON Object.\n *\n * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.\n *\n * @return {Object} A JSON Object that describes the attributes.\n *\n * @public\n */\n getAttributes () {\n return typeMapGetAll(this)\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n */\n _write (encoder) {\n encoder.writeTypeRef(YTextRefID)\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder\n * @return {YText}\n *\n * @private\n * @function\n */\nexport const readYText = _decoder => new YText()\n","/**\n * @module YXml\n */\n\nimport {\n YXmlEvent,\n YXmlElement,\n AbstractType,\n typeListMap,\n typeListForEach,\n typeListInsertGenerics,\n typeListInsertGenericsAfter,\n typeListDelete,\n typeListToArray,\n YXmlFragmentRefID,\n callTypeObservers,\n transact,\n typeListGet,\n typeListSlice,\n warnPrematureAccess,\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Doc, ContentType, Transaction, Item, YXmlText, YXmlHook // eslint-disable-line\n} from '../internals.js'\n\nimport * as error from 'lib0/error'\nimport * as array from 'lib0/array'\n\n/**\n * Define the elements to which a set of CSS queries apply.\n * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors|CSS_Selectors}\n *\n * @example\n * query = '.classSelector'\n * query = 'nodeSelector'\n * query = '#idSelector'\n *\n * @typedef {string} CSS_Selector\n */\n\n/**\n * Dom filter function.\n *\n * @callback domFilter\n * @param {string} nodeName The nodeName of the element\n * @param {Map} attributes The map of attributes.\n * @return {boolean} Whether to include the Dom node in the YXmlElement.\n */\n\n/**\n * Represents a subset of the nodes of a YXmlElement / YXmlFragment and a\n * position within them.\n *\n * Can be created with {@link YXmlFragment#createTreeWalker}\n *\n * @public\n * @implements {Iterable}\n */\nexport class YXmlTreeWalker {\n /**\n * @param {YXmlFragment | YXmlElement} root\n * @param {function(AbstractType):boolean} [f]\n */\n constructor (root, f = () => true) {\n this._filter = f\n this._root = root\n /**\n * @type {Item}\n */\n this._currentNode = /** @type {Item} */ (root._start)\n this._firstCall = true\n root.doc ?? warnPrematureAccess()\n }\n\n [Symbol.iterator] () {\n return this\n }\n\n /**\n * Get the next node.\n *\n * @return {IteratorResult} The next node.\n *\n * @public\n */\n next () {\n /**\n * @type {Item|null}\n */\n let n = this._currentNode\n let type = n && n.content && /** @type {any} */ (n.content).type\n if (n !== null && (!this._firstCall || n.deleted || !this._filter(type))) { // if first call, we check if we can use the first item\n do {\n type = /** @type {any} */ (n.content).type\n if (!n.deleted && (type.constructor === YXmlElement || type.constructor === YXmlFragment) && type._start !== null) {\n // walk down in the tree\n n = type._start\n } else {\n // walk right or up in the tree\n while (n !== null) {\n /**\n * @type {Item | null}\n */\n const nxt = n.next\n if (nxt !== null) {\n n = nxt\n break\n } else if (n.parent === this._root) {\n n = null\n } else {\n n = /** @type {AbstractType} */ (n.parent)._item\n }\n }\n }\n } while (n !== null && (n.deleted || !this._filter(/** @type {ContentType} */ (n.content).type)))\n }\n this._firstCall = false\n if (n === null) {\n // @ts-ignore\n return { value: undefined, done: true }\n }\n this._currentNode = n\n return { value: /** @type {any} */ (n.content).type, done: false }\n }\n}\n\n/**\n * Represents a list of {@link YXmlElement}.and {@link YXmlText} types.\n * A YxmlFragment is similar to a {@link YXmlElement}, but it does not have a\n * nodeName and it does not have attributes. Though it can be bound to a DOM\n * element - in this case the attributes and the nodeName are not shared.\n *\n * @public\n * @extends AbstractType\n */\nexport class YXmlFragment extends AbstractType {\n constructor () {\n super()\n /**\n * @type {Array|null}\n */\n this._prelimContent = []\n }\n\n /**\n * @type {YXmlElement|YXmlText|null}\n */\n get firstChild () {\n const first = this._first\n return first ? first.content.getContent()[0] : null\n }\n\n /**\n * Integrate this type into the Yjs instance.\n *\n * * Save this struct in the os\n * * This type is sent to other client\n * * Observer functions are fired\n *\n * @param {Doc} y The Yjs instance\n * @param {Item} item\n */\n _integrate (y, item) {\n super._integrate(y, item)\n this.insert(0, /** @type {Array} */ (this._prelimContent))\n this._prelimContent = null\n }\n\n _copy () {\n return new YXmlFragment()\n }\n\n /**\n * Makes a copy of this data type that can be included somewhere else.\n *\n * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.\n *\n * @return {YXmlFragment}\n */\n clone () {\n const el = new YXmlFragment()\n // @ts-ignore\n el.insert(0, this.toArray().map(item => item instanceof AbstractType ? item.clone() : item))\n return el\n }\n\n get length () {\n this.doc ?? warnPrematureAccess()\n return this._prelimContent === null ? this._length : this._prelimContent.length\n }\n\n /**\n * Create a subtree of childNodes.\n *\n * @example\n * const walker = elem.createTreeWalker(dom => dom.nodeName === 'div')\n * for (let node in walker) {\n * // `node` is a div node\n * nop(node)\n * }\n *\n * @param {function(AbstractType):boolean} filter Function that is called on each child element and\n * returns a Boolean indicating whether the child\n * is to be included in the subtree.\n * @return {YXmlTreeWalker} A subtree and a position within it.\n *\n * @public\n */\n createTreeWalker (filter) {\n return new YXmlTreeWalker(this, filter)\n }\n\n /**\n * Returns the first YXmlElement that matches the query.\n * Similar to DOM's {@link querySelector}.\n *\n * Query support:\n * - tagname\n * TODO:\n * - id\n * - attribute\n *\n * @param {CSS_Selector} query The query on the children.\n * @return {YXmlElement|YXmlText|YXmlHook|null} The first element that matches the query or null.\n *\n * @public\n */\n querySelector (query) {\n query = query.toUpperCase()\n // @ts-ignore\n const iterator = new YXmlTreeWalker(this, element => element.nodeName && element.nodeName.toUpperCase() === query)\n const next = iterator.next()\n if (next.done) {\n return null\n } else {\n return next.value\n }\n }\n\n /**\n * Returns all YXmlElements that match the query.\n * Similar to Dom's {@link querySelectorAll}.\n *\n * @todo Does not yet support all queries. Currently only query by tagName.\n *\n * @param {CSS_Selector} query The query on the children\n * @return {Array} The elements that match this query.\n *\n * @public\n */\n querySelectorAll (query) {\n query = query.toUpperCase()\n // @ts-ignore\n return array.from(new YXmlTreeWalker(this, element => element.nodeName && element.nodeName.toUpperCase() === query))\n }\n\n /**\n * Creates YXmlEvent and calls observers.\n *\n * @param {Transaction} transaction\n * @param {Set} parentSubs Keys changed on this type. `null` if list was modified.\n */\n _callObserver (transaction, parentSubs) {\n callTypeObservers(this, transaction, new YXmlEvent(this, parentSubs, transaction))\n }\n\n /**\n * Get the string representation of all the children of this YXmlFragment.\n *\n * @return {string} The string representation of all children.\n */\n toString () {\n return typeListMap(this, xml => xml.toString()).join('')\n }\n\n /**\n * @return {string}\n */\n toJSON () {\n return this.toString()\n }\n\n /**\n * Creates a Dom Element that mirrors this YXmlElement.\n *\n * @param {Document} [_document=document] The document object (you must define\n * this when calling this method in\n * nodejs)\n * @param {Object} [hooks={}] Optional property to customize how hooks\n * are presented in the DOM\n * @param {any} [binding] You should not set this property. This is\n * used if DomBinding wants to create a\n * association to the created DOM type.\n * @return {Node} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element}\n *\n * @public\n */\n toDOM (_document = document, hooks = {}, binding) {\n const fragment = _document.createDocumentFragment()\n if (binding !== undefined) {\n binding._createAssociation(fragment, this)\n }\n typeListForEach(this, xmlType => {\n fragment.insertBefore(xmlType.toDOM(_document, hooks, binding), null)\n })\n return fragment\n }\n\n /**\n * Inserts new content at an index.\n *\n * @example\n * // Insert character 'a' at position 0\n * xml.insert(0, [new Y.XmlText('text')])\n *\n * @param {number} index The index to insert content at\n * @param {Array} content The array of content\n */\n insert (index, content) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeListInsertGenerics(transaction, this, index, content)\n })\n } else {\n // @ts-ignore _prelimContent is defined because this is not yet integrated\n this._prelimContent.splice(index, 0, ...content)\n }\n }\n\n /**\n * Inserts new content at an index.\n *\n * @example\n * // Insert character 'a' at position 0\n * xml.insert(0, [new Y.XmlText('text')])\n *\n * @param {null|Item|YXmlElement|YXmlText} ref The index to insert content at\n * @param {Array} content The array of content\n */\n insertAfter (ref, content) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n const refItem = (ref && ref instanceof AbstractType) ? ref._item : ref\n typeListInsertGenericsAfter(transaction, this, refItem, content)\n })\n } else {\n const pc = /** @type {Array} */ (this._prelimContent)\n const index = ref === null ? 0 : pc.findIndex(el => el === ref) + 1\n if (index === 0 && ref !== null) {\n throw error.create('Reference item not found')\n }\n pc.splice(index, 0, ...content)\n }\n }\n\n /**\n * Deletes elements starting from an index.\n *\n * @param {number} index Index at which to start deleting elements\n * @param {number} [length=1] The number of elements to remove. Defaults to 1.\n */\n delete (index, length = 1) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeListDelete(transaction, this, index, length)\n })\n } else {\n // @ts-ignore _prelimContent is defined because this is not yet integrated\n this._prelimContent.splice(index, length)\n }\n }\n\n /**\n * Transforms this YArray to a JavaScript Array.\n *\n * @return {Array}\n */\n toArray () {\n return typeListToArray(this)\n }\n\n /**\n * Appends content to this YArray.\n *\n * @param {Array} content Array of content to append.\n */\n push (content) {\n this.insert(this.length, content)\n }\n\n /**\n * Prepends content to this YArray.\n *\n * @param {Array} content Array of content to prepend.\n */\n unshift (content) {\n this.insert(0, content)\n }\n\n /**\n * Returns the i-th element from a YArray.\n *\n * @param {number} index The index of the element to return from the YArray\n * @return {YXmlElement|YXmlText}\n */\n get (index) {\n return typeListGet(this, index)\n }\n\n /**\n * Returns a portion of this YXmlFragment into a JavaScript Array selected\n * from start to end (end not included).\n *\n * @param {number} [start]\n * @param {number} [end]\n * @return {Array}\n */\n slice (start = 0, end = this.length) {\n return typeListSlice(this, start, end)\n }\n\n /**\n * Executes a provided function on once on every child element.\n *\n * @param {function(YXmlElement|YXmlText,number, typeof self):void} f A function to execute on every element of this YArray.\n */\n forEach (f) {\n typeListForEach(this, f)\n }\n\n /**\n * Transform the properties of this type to binary and write it to an\n * BinaryEncoder.\n *\n * This is called when this Item is sent to a remote peer.\n *\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.\n */\n _write (encoder) {\n encoder.writeTypeRef(YXmlFragmentRefID)\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder\n * @return {YXmlFragment}\n *\n * @private\n * @function\n */\nexport const readYXmlFragment = _decoder => new YXmlFragment()\n","import * as object from 'lib0/object'\n\nimport {\n YXmlFragment,\n transact,\n typeMapDelete,\n typeMapHas,\n typeMapSet,\n typeMapGet,\n typeMapGetAll,\n typeMapGetAllSnapshot,\n typeListForEach,\n YXmlElementRefID,\n Snapshot, YXmlText, ContentType, AbstractType, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Doc, Item // eslint-disable-line\n} from '../internals.js'\n\n/**\n * @typedef {Object|number|null|Array|string|Uint8Array|AbstractType} ValueTypes\n */\n\n/**\n * An YXmlElement imitates the behavior of a\n * https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element\n *\n * * An YXmlElement has attributes (key value pairs)\n * * An YXmlElement has childElements that must inherit from YXmlElement\n *\n * @template {{ [key: string]: ValueTypes }} [KV={ [key: string]: string }]\n */\nexport class YXmlElement extends YXmlFragment {\n constructor (nodeName = 'UNDEFINED') {\n super()\n this.nodeName = nodeName\n /**\n * @type {Map|null}\n */\n this._prelimAttrs = new Map()\n }\n\n /**\n * @type {YXmlElement|YXmlText|null}\n */\n get nextSibling () {\n const n = this._item ? this._item.next : null\n return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null\n }\n\n /**\n * @type {YXmlElement|YXmlText|null}\n */\n get prevSibling () {\n const n = this._item ? this._item.prev : null\n return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null\n }\n\n /**\n * Integrate this type into the Yjs instance.\n *\n * * Save this struct in the os\n * * This type is sent to other client\n * * Observer functions are fired\n *\n * @param {Doc} y The Yjs instance\n * @param {Item} item\n */\n _integrate (y, item) {\n super._integrate(y, item)\n ;(/** @type {Map} */ (this._prelimAttrs)).forEach((value, key) => {\n this.setAttribute(key, value)\n })\n this._prelimAttrs = null\n }\n\n /**\n * Creates an Item with the same effect as this Item (without position effect)\n *\n * @return {YXmlElement}\n */\n _copy () {\n return new YXmlElement(this.nodeName)\n }\n\n /**\n * Makes a copy of this data type that can be included somewhere else.\n *\n * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.\n *\n * @return {YXmlElement}\n */\n clone () {\n /**\n * @type {YXmlElement}\n */\n const el = new YXmlElement(this.nodeName)\n const attrs = this.getAttributes()\n object.forEach(attrs, (value, key) => {\n el.setAttribute(key, /** @type {any} */ (value))\n })\n // @ts-ignore\n el.insert(0, this.toArray().map(v => v instanceof AbstractType ? v.clone() : v))\n return el\n }\n\n /**\n * Returns the XML serialization of this YXmlElement.\n * The attributes are ordered by attribute-name, so you can easily use this\n * method to compare YXmlElements\n *\n * @return {string} The string representation of this type.\n *\n * @public\n */\n toString () {\n const attrs = this.getAttributes()\n const stringBuilder = []\n const keys = []\n for (const key in attrs) {\n keys.push(key)\n }\n keys.sort()\n const keysLen = keys.length\n for (let i = 0; i < keysLen; i++) {\n const key = keys[i]\n stringBuilder.push(key + '=\"' + attrs[key] + '\"')\n }\n const nodeName = this.nodeName.toLocaleLowerCase()\n const attrsString = stringBuilder.length > 0 ? ' ' + stringBuilder.join(' ') : ''\n return `<${nodeName}${attrsString}>${super.toString()}`\n }\n\n /**\n * Removes an attribute from this YXmlElement.\n *\n * @param {string} attributeName The attribute name that is to be removed.\n *\n * @public\n */\n removeAttribute (attributeName) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeMapDelete(transaction, this, attributeName)\n })\n } else {\n /** @type {Map} */ (this._prelimAttrs).delete(attributeName)\n }\n }\n\n /**\n * Sets or updates an attribute.\n *\n * @template {keyof KV & string} KEY\n *\n * @param {KEY} attributeName The attribute name that is to be set.\n * @param {KV[KEY]} attributeValue The attribute value that is to be set.\n *\n * @public\n */\n setAttribute (attributeName, attributeValue) {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n typeMapSet(transaction, this, attributeName, attributeValue)\n })\n } else {\n /** @type {Map} */ (this._prelimAttrs).set(attributeName, attributeValue)\n }\n }\n\n /**\n * Returns an attribute value that belongs to the attribute name.\n *\n * @template {keyof KV & string} KEY\n *\n * @param {KEY} attributeName The attribute name that identifies the\n * queried value.\n * @return {KV[KEY]|undefined} The queried attribute value.\n *\n * @public\n */\n getAttribute (attributeName) {\n return /** @type {any} */ (typeMapGet(this, attributeName))\n }\n\n /**\n * Returns whether an attribute exists\n *\n * @param {string} attributeName The attribute name to check for existence.\n * @return {boolean} whether the attribute exists.\n *\n * @public\n */\n hasAttribute (attributeName) {\n return /** @type {any} */ (typeMapHas(this, attributeName))\n }\n\n /**\n * Returns all attribute name/value pairs in a JSON Object.\n *\n * @param {Snapshot} [snapshot]\n * @return {{ [Key in Extract]?: KV[Key]}} A JSON Object that describes the attributes.\n *\n * @public\n */\n getAttributes (snapshot) {\n return /** @type {any} */ (snapshot ? typeMapGetAllSnapshot(this, snapshot) : typeMapGetAll(this))\n }\n\n /**\n * Creates a Dom Element that mirrors this YXmlElement.\n *\n * @param {Document} [_document=document] The document object (you must define\n * this when calling this method in\n * nodejs)\n * @param {Object} [hooks={}] Optional property to customize how hooks\n * are presented in the DOM\n * @param {any} [binding] You should not set this property. This is\n * used if DomBinding wants to create a\n * association to the created DOM type.\n * @return {Node} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element}\n *\n * @public\n */\n toDOM (_document = document, hooks = {}, binding) {\n const dom = _document.createElement(this.nodeName)\n const attrs = this.getAttributes()\n for (const key in attrs) {\n const value = attrs[key]\n if (typeof value === 'string') {\n dom.setAttribute(key, value)\n }\n }\n typeListForEach(this, yxml => {\n dom.appendChild(yxml.toDOM(_document, hooks, binding))\n })\n if (binding !== undefined) {\n binding._createAssociation(dom, this)\n }\n return dom\n }\n\n /**\n * Transform the properties of this type to binary and write it to an\n * BinaryEncoder.\n *\n * This is called when this Item is sent to a remote peer.\n *\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.\n */\n _write (encoder) {\n encoder.writeTypeRef(YXmlElementRefID)\n encoder.writeKey(this.nodeName)\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {YXmlElement}\n *\n * @function\n */\nexport const readYXmlElement = decoder => new YXmlElement(decoder.readKey())\n","import {\n YEvent,\n YXmlText, YXmlElement, YXmlFragment, Transaction // eslint-disable-line\n} from '../internals.js'\n\n/**\n * @extends YEvent\n * An Event that describes changes on a YXml Element or Yxml Fragment\n */\nexport class YXmlEvent extends YEvent {\n /**\n * @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created.\n * @param {Set} subs The set of changed attributes. `null` is included if the\n * child list changed.\n * @param {Transaction} transaction The transaction instance with which the\n * change was created.\n */\n constructor (target, subs, transaction) {\n super(target, transaction)\n /**\n * Whether the children changed.\n * @type {Boolean}\n * @private\n */\n this.childListChanged = false\n /**\n * Set of all changed attributes.\n * @type {Set}\n */\n this.attributesChanged = new Set()\n subs.forEach((sub) => {\n if (sub === null) {\n this.childListChanged = true\n } else {\n this.attributesChanged.add(sub)\n }\n })\n }\n}\n","import {\n YMap,\n YXmlHookRefID,\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2 // eslint-disable-line\n} from '../internals.js'\n\n/**\n * You can manage binding to a custom type with YXmlHook.\n *\n * @extends {YMap}\n */\nexport class YXmlHook extends YMap {\n /**\n * @param {string} hookName nodeName of the Dom Node.\n */\n constructor (hookName) {\n super()\n /**\n * @type {string}\n */\n this.hookName = hookName\n }\n\n /**\n * Creates an Item with the same effect as this Item (without position effect)\n */\n _copy () {\n return new YXmlHook(this.hookName)\n }\n\n /**\n * Makes a copy of this data type that can be included somewhere else.\n *\n * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.\n *\n * @return {YXmlHook}\n */\n clone () {\n const el = new YXmlHook(this.hookName)\n this.forEach((value, key) => {\n el.set(key, value)\n })\n return el\n }\n\n /**\n * Creates a Dom Element that mirrors this YXmlElement.\n *\n * @param {Document} [_document=document] The document object (you must define\n * this when calling this method in\n * nodejs)\n * @param {Object.} [hooks] Optional property to customize how hooks\n * are presented in the DOM\n * @param {any} [binding] You should not set this property. This is\n * used if DomBinding wants to create a\n * association to the created DOM type\n * @return {Element} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element}\n *\n * @public\n */\n toDOM (_document = document, hooks = {}, binding) {\n const hook = hooks[this.hookName]\n let dom\n if (hook !== undefined) {\n dom = hook.createDom(this)\n } else {\n dom = document.createElement(this.hookName)\n }\n dom.setAttribute('data-yjs-hook', this.hookName)\n if (binding !== undefined) {\n binding._createAssociation(dom, this)\n }\n return dom\n }\n\n /**\n * Transform the properties of this type to binary and write it to an\n * BinaryEncoder.\n *\n * This is called when this Item is sent to a remote peer.\n *\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.\n */\n _write (encoder) {\n encoder.writeTypeRef(YXmlHookRefID)\n encoder.writeKey(this.hookName)\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {YXmlHook}\n *\n * @private\n * @function\n */\nexport const readYXmlHook = decoder =>\n new YXmlHook(decoder.readKey())\n","import {\n YText,\n YXmlTextRefID,\n ContentType, YXmlElement, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, // eslint-disable-line\n} from '../internals.js'\n\n/**\n * Represents text in a Dom Element. In the future this type will also handle\n * simple formatting information like bold and italic.\n */\nexport class YXmlText extends YText {\n /**\n * @type {YXmlElement|YXmlText|null}\n */\n get nextSibling () {\n const n = this._item ? this._item.next : null\n return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null\n }\n\n /**\n * @type {YXmlElement|YXmlText|null}\n */\n get prevSibling () {\n const n = this._item ? this._item.prev : null\n return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null\n }\n\n _copy () {\n return new YXmlText()\n }\n\n /**\n * Makes a copy of this data type that can be included somewhere else.\n *\n * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.\n *\n * @return {YXmlText}\n */\n clone () {\n const text = new YXmlText()\n text.applyDelta(this.toDelta())\n return text\n }\n\n /**\n * Creates a Dom Element that mirrors this YXmlText.\n *\n * @param {Document} [_document=document] The document object (you must define\n * this when calling this method in\n * nodejs)\n * @param {Object} [hooks] Optional property to customize how hooks\n * are presented in the DOM\n * @param {any} [binding] You should not set this property. This is\n * used if DomBinding wants to create a\n * association to the created DOM type.\n * @return {Text} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element}\n *\n * @public\n */\n toDOM (_document = document, hooks, binding) {\n const dom = _document.createTextNode(this.toString())\n if (binding !== undefined) {\n binding._createAssociation(dom, this)\n }\n return dom\n }\n\n toString () {\n // @ts-ignore\n return this.toDelta().map(delta => {\n const nestedNodes = []\n for (const nodeName in delta.attributes) {\n const attrs = []\n for (const key in delta.attributes[nodeName]) {\n attrs.push({ key, value: delta.attributes[nodeName][key] })\n }\n // sort attributes to get a unique order\n attrs.sort((a, b) => a.key < b.key ? -1 : 1)\n nestedNodes.push({ nodeName, attrs })\n }\n // sort node order to get a unique order\n nestedNodes.sort((a, b) => a.nodeName < b.nodeName ? -1 : 1)\n // now convert to dom string\n let str = ''\n for (let i = 0; i < nestedNodes.length; i++) {\n const node = nestedNodes[i]\n str += `<${node.nodeName}`\n for (let j = 0; j < node.attrs.length; j++) {\n const attr = node.attrs[j]\n str += ` ${attr.key}=\"${attr.value}\"`\n }\n str += '>'\n }\n str += delta.insert\n for (let i = nestedNodes.length - 1; i >= 0; i--) {\n str += ``\n }\n return str\n }).join('')\n }\n\n /**\n * @return {string}\n */\n toJSON () {\n return this.toString()\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n */\n _write (encoder) {\n encoder.writeTypeRef(YXmlTextRefID)\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {YXmlText}\n *\n * @private\n * @function\n */\nexport const readYXmlText = decoder => new YXmlText()\n","import {\n UpdateEncoderV1, UpdateEncoderV2, ID, Transaction // eslint-disable-line\n} from '../internals.js'\n\nimport * as error from 'lib0/error'\n\nexport class AbstractStruct {\n /**\n * @param {ID} id\n * @param {number} length\n */\n constructor (id, length) {\n this.id = id\n this.length = length\n }\n\n /**\n * @type {boolean}\n */\n get deleted () {\n throw error.methodUnimplemented()\n }\n\n /**\n * Merge this struct with the item to the right.\n * This method is already assuming that `this.id.clock + this.length === this.id.clock`.\n * Also this method does *not* remove right from StructStore!\n * @param {AbstractStruct} right\n * @return {boolean} whether this merged with right\n */\n mergeWith (right) {\n return false\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.\n * @param {number} offset\n * @param {number} encodingRef\n */\n write (encoder, offset, encodingRef) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {Transaction} transaction\n * @param {number} offset\n */\n integrate (transaction, offset) {\n throw error.methodUnimplemented()\n }\n}\n","import {\n AbstractStruct,\n addStruct,\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, StructStore, Transaction, ID // eslint-disable-line\n} from '../internals.js'\n\nexport const structGCRefNumber = 0\n\n/**\n * @private\n */\nexport class GC extends AbstractStruct {\n get deleted () {\n return true\n }\n\n delete () {}\n\n /**\n * @param {GC} right\n * @return {boolean}\n */\n mergeWith (right) {\n if (this.constructor !== right.constructor) {\n return false\n }\n this.length += right.length\n return true\n }\n\n /**\n * @param {Transaction} transaction\n * @param {number} offset\n */\n integrate (transaction, offset) {\n if (offset > 0) {\n this.id.clock += offset\n this.length -= offset\n }\n addStruct(transaction.doc.store, this)\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeInfo(structGCRefNumber)\n encoder.writeLen(this.length - offset)\n }\n\n /**\n * @param {Transaction} transaction\n * @param {StructStore} store\n * @return {null | number}\n */\n getMissing (transaction, store) {\n return null\n }\n}\n","import {\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, StructStore, Item, Transaction // eslint-disable-line\n} from '../internals.js'\n\nimport * as error from 'lib0/error'\n\nexport class ContentBinary {\n /**\n * @param {Uint8Array} content\n */\n constructor (content) {\n this.content = content\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return 1\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return [this.content]\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentBinary}\n */\n copy () {\n return new ContentBinary(this.content)\n }\n\n /**\n * @param {number} offset\n * @return {ContentBinary}\n */\n splice (offset) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {ContentBinary} right\n * @return {boolean}\n */\n mergeWith (right) {\n return false\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {}\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeBuf(this.content)\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 3\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2 } decoder\n * @return {ContentBinary}\n */\nexport const readContentBinary = decoder => new ContentBinary(decoder.readBuf())\n","import {\n addToDeleteSet,\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, StructStore, Item, Transaction // eslint-disable-line\n} from '../internals.js'\n\nexport class ContentDeleted {\n /**\n * @param {number} len\n */\n constructor (len) {\n this.len = len\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return this.len\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return []\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return false\n }\n\n /**\n * @return {ContentDeleted}\n */\n copy () {\n return new ContentDeleted(this.len)\n }\n\n /**\n * @param {number} offset\n * @return {ContentDeleted}\n */\n splice (offset) {\n const right = new ContentDeleted(this.len - offset)\n this.len = offset\n return right\n }\n\n /**\n * @param {ContentDeleted} right\n * @return {boolean}\n */\n mergeWith (right) {\n this.len += right.len\n return true\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {\n addToDeleteSet(transaction.deleteSet, item.id.client, item.id.clock, this.len)\n item.markDeleted()\n }\n\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeLen(this.len - offset)\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 1\n }\n}\n\n/**\n * @private\n *\n * @param {UpdateDecoderV1 | UpdateDecoderV2 } decoder\n * @return {ContentDeleted}\n */\nexport const readContentDeleted = decoder => new ContentDeleted(decoder.readLen())\n","import {\n Doc, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, StructStore, Transaction, Item // eslint-disable-line\n} from '../internals.js'\n\nimport * as error from 'lib0/error'\n\n/**\n * @param {string} guid\n * @param {Object} opts\n */\nconst createDocFromOpts = (guid, opts) => new Doc({ guid, ...opts, shouldLoad: opts.shouldLoad || opts.autoLoad || false })\n\n/**\n * @private\n */\nexport class ContentDoc {\n /**\n * @param {Doc} doc\n */\n constructor (doc) {\n if (doc._item) {\n console.error('This document was already integrated as a sub-document. You should create a second instance instead with the same guid.')\n }\n /**\n * @type {Doc}\n */\n this.doc = doc\n /**\n * @type {any}\n */\n const opts = {}\n this.opts = opts\n if (!doc.gc) {\n opts.gc = false\n }\n if (doc.autoLoad) {\n opts.autoLoad = true\n }\n if (doc.meta !== null) {\n opts.meta = doc.meta\n }\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return 1\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return [this.doc]\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentDoc}\n */\n copy () {\n return new ContentDoc(createDocFromOpts(this.doc.guid, this.opts))\n }\n\n /**\n * @param {number} offset\n * @return {ContentDoc}\n */\n splice (offset) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {ContentDoc} right\n * @return {boolean}\n */\n mergeWith (right) {\n return false\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {\n // this needs to be reflected in doc.destroy as well\n this.doc._item = item\n transaction.subdocsAdded.add(this.doc)\n if (this.doc.shouldLoad) {\n transaction.subdocsLoaded.add(this.doc)\n }\n }\n\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {\n if (transaction.subdocsAdded.has(this.doc)) {\n transaction.subdocsAdded.delete(this.doc)\n } else {\n transaction.subdocsRemoved.add(this.doc)\n }\n }\n\n /**\n * @param {StructStore} store\n */\n gc (store) { }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeString(this.doc.guid)\n encoder.writeAny(this.opts)\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 9\n }\n}\n\n/**\n * @private\n *\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentDoc}\n */\nexport const readContentDoc = decoder => new ContentDoc(createDocFromOpts(decoder.readString(), decoder.readAny()))\n","import {\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, StructStore, Item, Transaction // eslint-disable-line\n} from '../internals.js'\n\nimport * as error from 'lib0/error'\n\n/**\n * @private\n */\nexport class ContentEmbed {\n /**\n * @param {Object} embed\n */\n constructor (embed) {\n this.embed = embed\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return 1\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return [this.embed]\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentEmbed}\n */\n copy () {\n return new ContentEmbed(this.embed)\n }\n\n /**\n * @param {number} offset\n * @return {ContentEmbed}\n */\n splice (offset) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {ContentEmbed} right\n * @return {boolean}\n */\n mergeWith (right) {\n return false\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {}\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeJSON(this.embed)\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 5\n }\n}\n\n/**\n * @private\n *\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentEmbed}\n */\nexport const readContentEmbed = decoder => new ContentEmbed(decoder.readJSON())\n","import {\n YText, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Item, StructStore, Transaction // eslint-disable-line\n} from '../internals.js'\n\nimport * as error from 'lib0/error'\n\n/**\n * @private\n */\nexport class ContentFormat {\n /**\n * @param {string} key\n * @param {Object} value\n */\n constructor (key, value) {\n this.key = key\n this.value = value\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return 1\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return []\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return false\n }\n\n /**\n * @return {ContentFormat}\n */\n copy () {\n return new ContentFormat(this.key, this.value)\n }\n\n /**\n * @param {number} _offset\n * @return {ContentFormat}\n */\n splice (_offset) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {ContentFormat} _right\n * @return {boolean}\n */\n mergeWith (_right) {\n return false\n }\n\n /**\n * @param {Transaction} _transaction\n * @param {Item} item\n */\n integrate (_transaction, item) {\n // @todo searchmarker are currently unsupported for rich text documents\n const p = /** @type {YText} */ (item.parent)\n p._searchMarker = null\n p._hasFormatting = true\n }\n\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeKey(this.key)\n encoder.writeJSON(this.value)\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 6\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentFormat}\n */\nexport const readContentFormat = decoder => new ContentFormat(decoder.readKey(), decoder.readJSON())\n","import {\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Transaction, Item, StructStore // eslint-disable-line\n} from '../internals.js'\n\n/**\n * @private\n */\nexport class ContentJSON {\n /**\n * @param {Array} arr\n */\n constructor (arr) {\n /**\n * @type {Array}\n */\n this.arr = arr\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return this.arr.length\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return this.arr\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentJSON}\n */\n copy () {\n return new ContentJSON(this.arr)\n }\n\n /**\n * @param {number} offset\n * @return {ContentJSON}\n */\n splice (offset) {\n const right = new ContentJSON(this.arr.slice(offset))\n this.arr = this.arr.slice(0, offset)\n return right\n }\n\n /**\n * @param {ContentJSON} right\n * @return {boolean}\n */\n mergeWith (right) {\n this.arr = this.arr.concat(right.arr)\n return true\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {}\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n const len = this.arr.length\n encoder.writeLen(len - offset)\n for (let i = offset; i < len; i++) {\n const c = this.arr[i]\n encoder.writeString(c === undefined ? 'undefined' : JSON.stringify(c))\n }\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 2\n }\n}\n\n/**\n * @private\n *\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentJSON}\n */\nexport const readContentJSON = decoder => {\n const len = decoder.readLen()\n const cs = []\n for (let i = 0; i < len; i++) {\n const c = decoder.readString()\n if (c === 'undefined') {\n cs.push(undefined)\n } else {\n cs.push(JSON.parse(c))\n }\n }\n return new ContentJSON(cs)\n}\n","import {\n UpdateEncoderV1, UpdateEncoderV2, UpdateDecoderV1, UpdateDecoderV2, Transaction, Item, StructStore // eslint-disable-line\n} from '../internals.js'\n\nimport * as env from 'lib0/environment'\nimport * as object from 'lib0/object'\n\nconst isDevMode = env.getVariable('node_env') === 'development'\n\nexport class ContentAny {\n /**\n * @param {Array} arr\n */\n constructor (arr) {\n /**\n * @type {Array}\n */\n this.arr = arr\n isDevMode && object.deepFreeze(arr)\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return this.arr.length\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return this.arr\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentAny}\n */\n copy () {\n return new ContentAny(this.arr)\n }\n\n /**\n * @param {number} offset\n * @return {ContentAny}\n */\n splice (offset) {\n const right = new ContentAny(this.arr.slice(offset))\n this.arr = this.arr.slice(0, offset)\n return right\n }\n\n /**\n * @param {ContentAny} right\n * @return {boolean}\n */\n mergeWith (right) {\n this.arr = this.arr.concat(right.arr)\n return true\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {}\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n const len = this.arr.length\n encoder.writeLen(len - offset)\n for (let i = offset; i < len; i++) {\n const c = this.arr[i]\n encoder.writeAny(c)\n }\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 8\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentAny}\n */\nexport const readContentAny = decoder => {\n const len = decoder.readLen()\n const cs = []\n for (let i = 0; i < len; i++) {\n cs.push(decoder.readAny())\n }\n return new ContentAny(cs)\n}\n","import {\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Transaction, Item, StructStore // eslint-disable-line\n} from '../internals.js'\n\n/**\n * @private\n */\nexport class ContentString {\n /**\n * @param {string} str\n */\n constructor (str) {\n /**\n * @type {string}\n */\n this.str = str\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return this.str.length\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return this.str.split('')\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentString}\n */\n copy () {\n return new ContentString(this.str)\n }\n\n /**\n * @param {number} offset\n * @return {ContentString}\n */\n splice (offset) {\n const right = new ContentString(this.str.slice(offset))\n this.str = this.str.slice(0, offset)\n\n // Prevent encoding invalid documents because of splitting of surrogate pairs: https://github.com/yjs/yjs/issues/248\n const firstCharCode = this.str.charCodeAt(offset - 1)\n if (firstCharCode >= 0xD800 && firstCharCode <= 0xDBFF) {\n // Last character of the left split is the start of a surrogate utf16/ucs2 pair.\n // We don't support splitting of surrogate pairs because this may lead to invalid documents.\n // Replace the invalid character with a unicode replacement character (� / U+FFFD)\n this.str = this.str.slice(0, offset - 1) + '�'\n // replace right as well\n right.str = '�' + right.str.slice(1)\n }\n return right\n }\n\n /**\n * @param {ContentString} right\n * @return {boolean}\n */\n mergeWith (right) {\n this.str += right.str\n return true\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {}\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {}\n /**\n * @param {StructStore} store\n */\n gc (store) {}\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeString(offset === 0 ? this.str : this.str.slice(offset))\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 4\n }\n}\n\n/**\n * @private\n *\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentString}\n */\nexport const readContentString = decoder => new ContentString(decoder.readString())\n","import {\n readYArray,\n readYMap,\n readYText,\n readYXmlElement,\n readYXmlFragment,\n readYXmlHook,\n readYXmlText,\n UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, StructStore, Transaction, Item, YEvent, AbstractType // eslint-disable-line\n} from '../internals.js'\n\nimport * as error from 'lib0/error'\n\n/**\n * @type {Array>}\n * @private\n */\nexport const typeRefs = [\n readYArray,\n readYMap,\n readYText,\n readYXmlElement,\n readYXmlFragment,\n readYXmlHook,\n readYXmlText\n]\n\nexport const YArrayRefID = 0\nexport const YMapRefID = 1\nexport const YTextRefID = 2\nexport const YXmlElementRefID = 3\nexport const YXmlFragmentRefID = 4\nexport const YXmlHookRefID = 5\nexport const YXmlTextRefID = 6\n\n/**\n * @private\n */\nexport class ContentType {\n /**\n * @param {AbstractType} type\n */\n constructor (type) {\n /**\n * @type {AbstractType}\n */\n this.type = type\n }\n\n /**\n * @return {number}\n */\n getLength () {\n return 1\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n return [this.type]\n }\n\n /**\n * @return {boolean}\n */\n isCountable () {\n return true\n }\n\n /**\n * @return {ContentType}\n */\n copy () {\n return new ContentType(this.type._copy())\n }\n\n /**\n * @param {number} offset\n * @return {ContentType}\n */\n splice (offset) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {ContentType} right\n * @return {boolean}\n */\n mergeWith (right) {\n return false\n }\n\n /**\n * @param {Transaction} transaction\n * @param {Item} item\n */\n integrate (transaction, item) {\n this.type._integrate(transaction.doc, item)\n }\n\n /**\n * @param {Transaction} transaction\n */\n delete (transaction) {\n let item = this.type._start\n while (item !== null) {\n if (!item.deleted) {\n item.delete(transaction)\n } else if (item.id.clock < (transaction.beforeState.get(item.id.client) || 0)) {\n // This will be gc'd later and we want to merge it if possible\n // We try to merge all deleted items after each transaction,\n // but we have no knowledge about that this needs to be merged\n // since it is not in transaction.ds. Hence we add it to transaction._mergeStructs\n transaction._mergeStructs.push(item)\n }\n item = item.right\n }\n this.type._map.forEach(item => {\n if (!item.deleted) {\n item.delete(transaction)\n } else if (item.id.clock < (transaction.beforeState.get(item.id.client) || 0)) {\n // same as above\n transaction._mergeStructs.push(item)\n }\n })\n transaction.changed.delete(this.type)\n }\n\n /**\n * @param {StructStore} store\n */\n gc (store) {\n let item = this.type._start\n while (item !== null) {\n item.gc(store, true)\n item = item.right\n }\n this.type._start = null\n this.type._map.forEach(/** @param {Item | null} item */ (item) => {\n while (item !== null) {\n item.gc(store, true)\n item = item.left\n }\n })\n this.type._map = new Map()\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n this.type._write(encoder)\n }\n\n /**\n * @return {number}\n */\n getRef () {\n return 7\n }\n}\n\n/**\n * @private\n *\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @return {ContentType}\n */\nexport const readContentType = decoder => new ContentType(typeRefs[decoder.readTypeRef()](decoder))\n","import {\n GC,\n getState,\n AbstractStruct,\n replaceStruct,\n addStruct,\n addToDeleteSet,\n findRootTypeKey,\n compareIDs,\n getItem,\n getItemCleanEnd,\n getItemCleanStart,\n readContentDeleted,\n readContentBinary,\n readContentJSON,\n readContentAny,\n readContentString,\n readContentEmbed,\n readContentDoc,\n createID,\n readContentFormat,\n readContentType,\n addChangedTypeToTransaction,\n isDeleted,\n StackItem, DeleteSet, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, ContentType, ContentDeleted, StructStore, ID, AbstractType, Transaction // eslint-disable-line\n} from '../internals.js'\n\nimport * as error from 'lib0/error'\nimport * as binary from 'lib0/binary'\nimport * as array from 'lib0/array'\n\n/**\n * @todo This should return several items\n *\n * @param {StructStore} store\n * @param {ID} id\n * @return {{item:Item, diff:number}}\n */\nexport const followRedone = (store, id) => {\n /**\n * @type {ID|null}\n */\n let nextID = id\n let diff = 0\n let item\n do {\n if (diff > 0) {\n nextID = createID(nextID.client, nextID.clock + diff)\n }\n item = getItem(store, nextID)\n diff = nextID.clock - item.id.clock\n nextID = item.redone\n } while (nextID !== null && item instanceof Item)\n return {\n item, diff\n }\n}\n\n/**\n * Make sure that neither item nor any of its parents is ever deleted.\n *\n * This property does not persist when storing it into a database or when\n * sending it to other peers\n *\n * @param {Item|null} item\n * @param {boolean} keep\n */\nexport const keepItem = (item, keep) => {\n while (item !== null && item.keep !== keep) {\n item.keep = keep\n item = /** @type {AbstractType} */ (item.parent)._item\n }\n}\n\n/**\n * Split leftItem into two items\n * @param {Transaction} transaction\n * @param {Item} leftItem\n * @param {number} diff\n * @return {Item}\n *\n * @function\n * @private\n */\nexport const splitItem = (transaction, leftItem, diff) => {\n // create rightItem\n const { client, clock } = leftItem.id\n const rightItem = new Item(\n createID(client, clock + diff),\n leftItem,\n createID(client, clock + diff - 1),\n leftItem.right,\n leftItem.rightOrigin,\n leftItem.parent,\n leftItem.parentSub,\n leftItem.content.splice(diff)\n )\n if (leftItem.deleted) {\n rightItem.markDeleted()\n }\n if (leftItem.keep) {\n rightItem.keep = true\n }\n if (leftItem.redone !== null) {\n rightItem.redone = createID(leftItem.redone.client, leftItem.redone.clock + diff)\n }\n // update left (do not set leftItem.rightOrigin as it will lead to problems when syncing)\n leftItem.right = rightItem\n // update right\n if (rightItem.right !== null) {\n rightItem.right.left = rightItem\n }\n // right is more specific.\n transaction._mergeStructs.push(rightItem)\n // update parent._map\n if (rightItem.parentSub !== null && rightItem.right === null) {\n /** @type {AbstractType} */ (rightItem.parent)._map.set(rightItem.parentSub, rightItem)\n }\n leftItem.length = diff\n return rightItem\n}\n\n/**\n * @param {Array} stack\n * @param {ID} id\n */\nconst isDeletedByUndoStack = (stack, id) => array.some(stack, /** @param {StackItem} s */ s => isDeleted(s.deletions, id))\n\n/**\n * Redoes the effect of this operation.\n *\n * @param {Transaction} transaction The Yjs instance.\n * @param {Item} item\n * @param {Set} redoitems\n * @param {DeleteSet} itemsToDelete\n * @param {boolean} ignoreRemoteMapChanges\n * @param {import('../utils/UndoManager.js').UndoManager} um\n *\n * @return {Item|null}\n *\n * @private\n */\nexport const redoItem = (transaction, item, redoitems, itemsToDelete, ignoreRemoteMapChanges, um) => {\n const doc = transaction.doc\n const store = doc.store\n const ownClientID = doc.clientID\n const redone = item.redone\n if (redone !== null) {\n return getItemCleanStart(transaction, redone)\n }\n let parentItem = /** @type {AbstractType} */ (item.parent)._item\n /**\n * @type {Item|null}\n */\n let left = null\n /**\n * @type {Item|null}\n */\n let right\n // make sure that parent is redone\n if (parentItem !== null && parentItem.deleted === true) {\n // try to undo parent if it will be undone anyway\n if (parentItem.redone === null && (!redoitems.has(parentItem) || redoItem(transaction, parentItem, redoitems, itemsToDelete, ignoreRemoteMapChanges, um) === null)) {\n return null\n }\n while (parentItem.redone !== null) {\n parentItem = getItemCleanStart(transaction, parentItem.redone)\n }\n }\n const parentType = parentItem === null ? /** @type {AbstractType} */ (item.parent) : /** @type {ContentType} */ (parentItem.content).type\n\n if (item.parentSub === null) {\n // Is an array item. Insert at the old position\n left = item.left\n right = item\n // find next cloned_redo items\n while (left !== null) {\n /**\n * @type {Item|null}\n */\n let leftTrace = left\n // trace redone until parent matches\n while (leftTrace !== null && /** @type {AbstractType} */ (leftTrace.parent)._item !== parentItem) {\n leftTrace = leftTrace.redone === null ? null : getItemCleanStart(transaction, leftTrace.redone)\n }\n if (leftTrace !== null && /** @type {AbstractType} */ (leftTrace.parent)._item === parentItem) {\n left = leftTrace\n break\n }\n left = left.left\n }\n while (right !== null) {\n /**\n * @type {Item|null}\n */\n let rightTrace = right\n // trace redone until parent matches\n while (rightTrace !== null && /** @type {AbstractType} */ (rightTrace.parent)._item !== parentItem) {\n rightTrace = rightTrace.redone === null ? null : getItemCleanStart(transaction, rightTrace.redone)\n }\n if (rightTrace !== null && /** @type {AbstractType} */ (rightTrace.parent)._item === parentItem) {\n right = rightTrace\n break\n }\n right = right.right\n }\n } else {\n right = null\n if (item.right && !ignoreRemoteMapChanges) {\n left = item\n // Iterate right while right is in itemsToDelete\n // If it is intended to delete right while item is redone, we can expect that item should replace right.\n while (left !== null && left.right !== null && (left.right.redone || isDeleted(itemsToDelete, left.right.id) || isDeletedByUndoStack(um.undoStack, left.right.id) || isDeletedByUndoStack(um.redoStack, left.right.id))) {\n left = left.right\n // follow redone\n while (left.redone) left = getItemCleanStart(transaction, left.redone)\n }\n if (left && left.right !== null) {\n // It is not possible to redo this item because it conflicts with a\n // change from another client\n return null\n }\n } else {\n left = parentType._map.get(item.parentSub) || null\n }\n }\n const nextClock = getState(store, ownClientID)\n const nextId = createID(ownClientID, nextClock)\n const redoneItem = new Item(\n nextId,\n left, left && left.lastId,\n right, right && right.id,\n parentType,\n item.parentSub,\n item.content.copy()\n )\n item.redone = nextId\n keepItem(redoneItem, true)\n redoneItem.integrate(transaction, 0)\n return redoneItem\n}\n\n/**\n * Abstract class that represents any content.\n */\nexport class Item extends AbstractStruct {\n /**\n * @param {ID} id\n * @param {Item | null} left\n * @param {ID | null} origin\n * @param {Item | null} right\n * @param {ID | null} rightOrigin\n * @param {AbstractType|ID|null} parent Is a type if integrated, is null if it is possible to copy parent from left or right, is ID before integration to search for it.\n * @param {string | null} parentSub\n * @param {AbstractContent} content\n */\n constructor (id, left, origin, right, rightOrigin, parent, parentSub, content) {\n super(id, content.getLength())\n /**\n * The item that was originally to the left of this item.\n * @type {ID | null}\n */\n this.origin = origin\n /**\n * The item that is currently to the left of this item.\n * @type {Item | null}\n */\n this.left = left\n /**\n * The item that is currently to the right of this item.\n * @type {Item | null}\n */\n this.right = right\n /**\n * The item that was originally to the right of this item.\n * @type {ID | null}\n */\n this.rightOrigin = rightOrigin\n /**\n * @type {AbstractType|ID|null}\n */\n this.parent = parent\n /**\n * If the parent refers to this item with some kind of key (e.g. YMap, the\n * key is specified here. The key is then used to refer to the list in which\n * to insert this item. If `parentSub = null` type._start is the list in\n * which to insert to. Otherwise it is `parent._map`.\n * @type {String | null}\n */\n this.parentSub = parentSub\n /**\n * If this type's effect is redone this type refers to the type that undid\n * this operation.\n * @type {ID | null}\n */\n this.redone = null\n /**\n * @type {AbstractContent}\n */\n this.content = content\n /**\n * bit1: keep\n * bit2: countable\n * bit3: deleted\n * bit4: mark - mark node as fast-search-marker\n * @type {number} byte\n */\n this.info = this.content.isCountable() ? binary.BIT2 : 0\n }\n\n /**\n * This is used to mark the item as an indexed fast-search marker\n *\n * @type {boolean}\n */\n set marker (isMarked) {\n if (((this.info & binary.BIT4) > 0) !== isMarked) {\n this.info ^= binary.BIT4\n }\n }\n\n get marker () {\n return (this.info & binary.BIT4) > 0\n }\n\n /**\n * If true, do not garbage collect this Item.\n */\n get keep () {\n return (this.info & binary.BIT1) > 0\n }\n\n set keep (doKeep) {\n if (this.keep !== doKeep) {\n this.info ^= binary.BIT1\n }\n }\n\n get countable () {\n return (this.info & binary.BIT2) > 0\n }\n\n /**\n * Whether this item was deleted or not.\n * @type {Boolean}\n */\n get deleted () {\n return (this.info & binary.BIT3) > 0\n }\n\n set deleted (doDelete) {\n if (this.deleted !== doDelete) {\n this.info ^= binary.BIT3\n }\n }\n\n markDeleted () {\n this.info |= binary.BIT3\n }\n\n /**\n * Return the creator clientID of the missing op or define missing items and return null.\n *\n * @param {Transaction} transaction\n * @param {StructStore} store\n * @return {null | number}\n */\n getMissing (transaction, store) {\n if (this.origin && this.origin.client !== this.id.client && this.origin.clock >= getState(store, this.origin.client)) {\n return this.origin.client\n }\n if (this.rightOrigin && this.rightOrigin.client !== this.id.client && this.rightOrigin.clock >= getState(store, this.rightOrigin.client)) {\n return this.rightOrigin.client\n }\n if (this.parent && this.parent.constructor === ID && this.id.client !== this.parent.client && this.parent.clock >= getState(store, this.parent.client)) {\n return this.parent.client\n }\n\n // We have all missing ids, now find the items\n\n if (this.origin) {\n this.left = getItemCleanEnd(transaction, store, this.origin)\n this.origin = this.left.lastId\n }\n if (this.rightOrigin) {\n this.right = getItemCleanStart(transaction, this.rightOrigin)\n this.rightOrigin = this.right.id\n }\n if ((this.left && this.left.constructor === GC) || (this.right && this.right.constructor === GC)) {\n this.parent = null\n } else if (!this.parent) {\n // only set parent if this shouldn't be garbage collected\n if (this.left && this.left.constructor === Item) {\n this.parent = this.left.parent\n this.parentSub = this.left.parentSub\n } else if (this.right && this.right.constructor === Item) {\n this.parent = this.right.parent\n this.parentSub = this.right.parentSub\n }\n } else if (this.parent.constructor === ID) {\n const parentItem = getItem(store, this.parent)\n if (parentItem.constructor === GC) {\n this.parent = null\n } else {\n this.parent = /** @type {ContentType} */ (parentItem.content).type\n }\n }\n return null\n }\n\n /**\n * @param {Transaction} transaction\n * @param {number} offset\n */\n integrate (transaction, offset) {\n if (offset > 0) {\n this.id.clock += offset\n this.left = getItemCleanEnd(transaction, transaction.doc.store, createID(this.id.client, this.id.clock - 1))\n this.origin = this.left.lastId\n this.content = this.content.splice(offset)\n this.length -= offset\n }\n\n if (this.parent) {\n if ((!this.left && (!this.right || this.right.left !== null)) || (this.left && this.left.right !== this.right)) {\n /**\n * @type {Item|null}\n */\n let left = this.left\n\n /**\n * @type {Item|null}\n */\n let o\n // set o to the first conflicting item\n if (left !== null) {\n o = left.right\n } else if (this.parentSub !== null) {\n o = /** @type {AbstractType} */ (this.parent)._map.get(this.parentSub) || null\n while (o !== null && o.left !== null) {\n o = o.left\n }\n } else {\n o = /** @type {AbstractType} */ (this.parent)._start\n }\n // TODO: use something like DeleteSet here (a tree implementation would be best)\n // @todo use global set definitions\n /**\n * @type {Set}\n */\n const conflictingItems = new Set()\n /**\n * @type {Set}\n */\n const itemsBeforeOrigin = new Set()\n // Let c in conflictingItems, b in itemsBeforeOrigin\n // ***{origin}bbbb{this}{c,b}{c,b}{o}***\n // Note that conflictingItems is a subset of itemsBeforeOrigin\n while (o !== null && o !== this.right) {\n itemsBeforeOrigin.add(o)\n conflictingItems.add(o)\n if (compareIDs(this.origin, o.origin)) {\n // case 1\n if (o.id.client < this.id.client) {\n left = o\n conflictingItems.clear()\n } else if (compareIDs(this.rightOrigin, o.rightOrigin)) {\n // this and o are conflicting and point to the same integration points. The id decides which item comes first.\n // Since this is to the left of o, we can break here\n break\n } // else, o might be integrated before an item that this conflicts with. If so, we will find it in the next iterations\n } else if (o.origin !== null && itemsBeforeOrigin.has(getItem(transaction.doc.store, o.origin))) { // use getItem instead of getItemCleanEnd because we don't want / need to split items.\n // case 2\n if (!conflictingItems.has(getItem(transaction.doc.store, o.origin))) {\n left = o\n conflictingItems.clear()\n }\n } else {\n break\n }\n o = o.right\n }\n this.left = left\n }\n // reconnect left/right + update parent map/start if necessary\n if (this.left !== null) {\n const right = this.left.right\n this.right = right\n this.left.right = this\n } else {\n let r\n if (this.parentSub !== null) {\n r = /** @type {AbstractType} */ (this.parent)._map.get(this.parentSub) || null\n while (r !== null && r.left !== null) {\n r = r.left\n }\n } else {\n r = /** @type {AbstractType} */ (this.parent)._start\n ;/** @type {AbstractType} */ (this.parent)._start = this\n }\n this.right = r\n }\n if (this.right !== null) {\n this.right.left = this\n } else if (this.parentSub !== null) {\n // set as current parent value if right === null and this is parentSub\n /** @type {AbstractType} */ (this.parent)._map.set(this.parentSub, this)\n if (this.left !== null) {\n // this is the current attribute value of parent. delete right\n this.left.delete(transaction)\n }\n }\n // adjust length of parent\n if (this.parentSub === null && this.countable && !this.deleted) {\n /** @type {AbstractType} */ (this.parent)._length += this.length\n }\n addStruct(transaction.doc.store, this)\n this.content.integrate(transaction, this)\n // add parent to transaction.changed\n addChangedTypeToTransaction(transaction, /** @type {AbstractType} */ (this.parent), this.parentSub)\n if ((/** @type {AbstractType} */ (this.parent)._item !== null && /** @type {AbstractType} */ (this.parent)._item.deleted) || (this.parentSub !== null && this.right !== null)) {\n // delete if parent is deleted or if this is not the current attribute value of parent\n this.delete(transaction)\n }\n } else {\n // parent is not defined. Integrate GC struct instead\n new GC(this.id, this.length).integrate(transaction, 0)\n }\n }\n\n /**\n * Returns the next non-deleted item\n */\n get next () {\n let n = this.right\n while (n !== null && n.deleted) {\n n = n.right\n }\n return n\n }\n\n /**\n * Returns the previous non-deleted item\n */\n get prev () {\n let n = this.left\n while (n !== null && n.deleted) {\n n = n.left\n }\n return n\n }\n\n /**\n * Computes the last content address of this Item.\n */\n get lastId () {\n // allocating ids is pretty costly because of the amount of ids created, so we try to reuse whenever possible\n return this.length === 1 ? this.id : createID(this.id.client, this.id.clock + this.length - 1)\n }\n\n /**\n * Try to merge two items\n *\n * @param {Item} right\n * @return {boolean}\n */\n mergeWith (right) {\n if (\n this.constructor === right.constructor &&\n compareIDs(right.origin, this.lastId) &&\n this.right === right &&\n compareIDs(this.rightOrigin, right.rightOrigin) &&\n this.id.client === right.id.client &&\n this.id.clock + this.length === right.id.clock &&\n this.deleted === right.deleted &&\n this.redone === null &&\n right.redone === null &&\n this.content.constructor === right.content.constructor &&\n this.content.mergeWith(right.content)\n ) {\n const searchMarker = /** @type {AbstractType} */ (this.parent)._searchMarker\n if (searchMarker) {\n searchMarker.forEach(marker => {\n if (marker.p === right) {\n // right is going to be \"forgotten\" so we need to update the marker\n marker.p = this\n // adjust marker index\n if (!this.deleted && this.countable) {\n marker.index -= this.length\n }\n }\n })\n }\n if (right.keep) {\n this.keep = true\n }\n this.right = right.right\n if (this.right !== null) {\n this.right.left = this\n }\n this.length += right.length\n return true\n }\n return false\n }\n\n /**\n * Mark this Item as deleted.\n *\n * @param {Transaction} transaction\n */\n delete (transaction) {\n if (!this.deleted) {\n const parent = /** @type {AbstractType} */ (this.parent)\n // adjust the length of parent\n if (this.countable && this.parentSub === null) {\n parent._length -= this.length\n }\n this.markDeleted()\n addToDeleteSet(transaction.deleteSet, this.id.client, this.id.clock, this.length)\n addChangedTypeToTransaction(transaction, parent, this.parentSub)\n this.content.delete(transaction)\n }\n }\n\n /**\n * @param {StructStore} store\n * @param {boolean} parentGCd\n */\n gc (store, parentGCd) {\n if (!this.deleted) {\n throw error.unexpectedCase()\n }\n this.content.gc(store)\n if (parentGCd) {\n replaceStruct(store, this, new GC(this.id, this.length))\n } else {\n this.content = new ContentDeleted(this.length)\n }\n }\n\n /**\n * Transform the properties of this type to binary and write it to an\n * BinaryEncoder.\n *\n * This is called when this Item is sent to a remote peer.\n *\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.\n * @param {number} offset\n */\n write (encoder, offset) {\n const origin = offset > 0 ? createID(this.id.client, this.id.clock + offset - 1) : this.origin\n const rightOrigin = this.rightOrigin\n const parentSub = this.parentSub\n const info = (this.content.getRef() & binary.BITS5) |\n (origin === null ? 0 : binary.BIT8) | // origin is defined\n (rightOrigin === null ? 0 : binary.BIT7) | // right origin is defined\n (parentSub === null ? 0 : binary.BIT6) // parentSub is non-null\n encoder.writeInfo(info)\n if (origin !== null) {\n encoder.writeLeftID(origin)\n }\n if (rightOrigin !== null) {\n encoder.writeRightID(rightOrigin)\n }\n if (origin === null && rightOrigin === null) {\n const parent = /** @type {AbstractType} */ (this.parent)\n if (parent._item !== undefined) {\n const parentItem = parent._item\n if (parentItem === null) {\n // parent type on y._map\n // find the correct key\n const ykey = findRootTypeKey(parent)\n encoder.writeParentInfo(true) // write parentYKey\n encoder.writeString(ykey)\n } else {\n encoder.writeParentInfo(false) // write parent id\n encoder.writeLeftID(parentItem.id)\n }\n } else if (parent.constructor === String) { // this edge case was added by differential updates\n encoder.writeParentInfo(true) // write parentYKey\n encoder.writeString(parent)\n } else if (parent.constructor === ID) {\n encoder.writeParentInfo(false) // write parent id\n encoder.writeLeftID(parent)\n } else {\n error.unexpectedCase()\n }\n if (parentSub !== null) {\n encoder.writeString(parentSub)\n }\n }\n this.content.write(encoder, offset)\n }\n}\n\n/**\n * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder\n * @param {number} info\n */\nexport const readItemContent = (decoder, info) => contentRefs[info & binary.BITS5](decoder)\n\n/**\n * A lookup map for reading Item content.\n *\n * @type {Array}\n */\nexport const contentRefs = [\n () => { error.unexpectedCase() }, // GC is not ItemContent\n readContentDeleted, // 1\n readContentJSON, // 2\n readContentBinary, // 3\n readContentString, // 4\n readContentEmbed, // 5\n readContentFormat, // 6\n readContentType, // 7\n readContentAny, // 8\n readContentDoc, // 9\n () => { error.unexpectedCase() } // 10 - Skip is not ItemContent\n]\n\n/**\n * Do not implement this class!\n */\nexport class AbstractContent {\n /**\n * @return {number}\n */\n getLength () {\n throw error.methodUnimplemented()\n }\n\n /**\n * @return {Array}\n */\n getContent () {\n throw error.methodUnimplemented()\n }\n\n /**\n * Should return false if this Item is some kind of meta information\n * (e.g. format information).\n *\n * * Whether this Item should be addressable via `yarray.get(i)`\n * * Whether this Item should be counted when computing yarray.length\n *\n * @return {boolean}\n */\n isCountable () {\n throw error.methodUnimplemented()\n }\n\n /**\n * @return {AbstractContent}\n */\n copy () {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {number} _offset\n * @return {AbstractContent}\n */\n splice (_offset) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {AbstractContent} _right\n * @return {boolean}\n */\n mergeWith (_right) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {Transaction} _transaction\n * @param {Item} _item\n */\n integrate (_transaction, _item) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {Transaction} _transaction\n */\n delete (_transaction) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {StructStore} _store\n */\n gc (_store) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} _encoder\n * @param {number} _offset\n */\n write (_encoder, _offset) {\n throw error.methodUnimplemented()\n }\n\n /**\n * @return {number}\n */\n getRef () {\n throw error.methodUnimplemented()\n }\n}\n","import {\n AbstractStruct,\n UpdateEncoderV1, UpdateEncoderV2, StructStore, Transaction, ID // eslint-disable-line\n} from '../internals.js'\nimport * as error from 'lib0/error'\nimport * as encoding from 'lib0/encoding'\n\nexport const structSkipRefNumber = 10\n\n/**\n * @private\n */\nexport class Skip extends AbstractStruct {\n get deleted () {\n return true\n }\n\n delete () {}\n\n /**\n * @param {Skip} right\n * @return {boolean}\n */\n mergeWith (right) {\n if (this.constructor !== right.constructor) {\n return false\n }\n this.length += right.length\n return true\n }\n\n /**\n * @param {Transaction} transaction\n * @param {number} offset\n */\n integrate (transaction, offset) {\n // skip structs cannot be integrated\n error.unexpectedCase()\n }\n\n /**\n * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder\n * @param {number} offset\n */\n write (encoder, offset) {\n encoder.writeInfo(structSkipRefNumber)\n // write as VarUint because Skips can't make use of predictable length-encoding\n encoding.writeVarUint(encoder.restEncoder, this.length - offset)\n }\n\n /**\n * @param {Transaction} transaction\n * @param {StructStore} store\n * @return {null | number}\n */\n getMissing (transaction, store) {\n return null\n }\n}\n","/** eslint-env browser */\n\nexport {\n Doc,\n Transaction,\n YArray as Array,\n YMap as Map,\n YText as Text,\n YXmlText as XmlText,\n YXmlHook as XmlHook,\n YXmlElement as XmlElement,\n YXmlFragment as XmlFragment,\n YXmlEvent,\n YMapEvent,\n YArrayEvent,\n YTextEvent,\n YEvent,\n Item,\n AbstractStruct,\n GC,\n Skip,\n ContentBinary,\n ContentDeleted,\n ContentDoc,\n ContentEmbed,\n ContentFormat,\n ContentJSON,\n ContentAny,\n ContentString,\n ContentType,\n AbstractType,\n getTypeChildren,\n createRelativePositionFromTypeIndex,\n createRelativePositionFromJSON,\n createAbsolutePositionFromRelativePosition,\n compareRelativePositions,\n AbsolutePosition,\n RelativePosition,\n ID,\n createID,\n compareIDs,\n getState,\n Snapshot,\n createSnapshot,\n createDeleteSet,\n createDeleteSetFromStructStore,\n cleanupYTextFormatting,\n snapshot,\n emptySnapshot,\n findRootTypeKey,\n findIndexSS,\n getItem,\n getItemCleanStart,\n getItemCleanEnd,\n typeListToArraySnapshot,\n typeMapGetSnapshot,\n typeMapGetAllSnapshot,\n createDocFromSnapshot,\n iterateDeletedStructs,\n applyUpdate,\n applyUpdateV2,\n readUpdate,\n readUpdateV2,\n encodeStateAsUpdate,\n encodeStateAsUpdateV2,\n encodeStateVector,\n UndoManager,\n decodeSnapshot,\n encodeSnapshot,\n decodeSnapshotV2,\n encodeSnapshotV2,\n decodeStateVector,\n logUpdate,\n logUpdateV2,\n decodeUpdate,\n decodeUpdateV2,\n relativePositionToJSON,\n isDeleted,\n isParentOf,\n equalSnapshots,\n PermanentUserData, // @TODO experimental\n tryGc,\n transact,\n AbstractConnector,\n logType,\n mergeUpdates,\n mergeUpdatesV2,\n parseUpdateMeta,\n parseUpdateMetaV2,\n encodeStateVectorFromUpdate,\n encodeStateVectorFromUpdateV2,\n encodeRelativePosition,\n decodeRelativePosition,\n diffUpdate,\n diffUpdateV2,\n convertUpdateFormatV1ToV2,\n convertUpdateFormatV2ToV1,\n obfuscateUpdate,\n obfuscateUpdateV2,\n UpdateEncoderV1,\n UpdateEncoderV2,\n UpdateDecoderV1,\n UpdateDecoderV2,\n equalDeleteSets,\n mergeDeleteSets,\n snapshotContainsUpdate\n} from './internals.js'\n\nconst glo = /** @type {any} */ (typeof globalThis !== 'undefined'\n ? globalThis\n : typeof window !== 'undefined'\n ? window\n // @ts-ignore\n : typeof global !== 'undefined' ? global : {})\n\nconst importIdentifier = '__ $YJS$ __'\n\nif (glo[importIdentifier] === true) {\n /**\n * Dear reader of this message. Please take this seriously.\n *\n * If you see this message, make sure that you only import one version of Yjs. In many cases,\n * your package manager installs two versions of Yjs that are used by different packages within your project.\n * Another reason for this message is that some parts of your project use the commonjs version of Yjs\n * and others use the EcmaScript version of Yjs.\n *\n * This often leads to issues that are hard to debug. We often need to perform constructor checks,\n * e.g. `struct instanceof GC`. If you imported different versions of Yjs, it is impossible for us to\n * do the constructor checks anymore - which might break the CRDT algorithm.\n *\n * https://github.com/yjs/yjs/issues/438\n */\n console.error('Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438')\n}\nglo[importIdentifier] = true\n"],"names":["log"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,iBAAiB,SAAS,YAAY,CAAC;AACpD;AACA;AACA;AACA;AACA,EAAE,WAAW,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE;AAChC,IAAI,KAAK,GAAE;AACX,IAAI,IAAI,CAAC,GAAG,GAAG,KAAI;AACnB,IAAI,IAAI,CAAC,SAAS,GAAG,UAAS;AAC9B,GAAG;AACH;;ACTO,MAAM,UAAU,CAAC;AACxB;AACA;AACA;AACA;AACA,EAAE,WAAW,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE;AAC3B;AACA;AACA;AACA,IAAI,IAAI,CAAC,KAAK,GAAG,MAAK;AACtB;AACA;AACA;AACA,IAAI,IAAI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CAAC,WAAW,EAAE;AAChD,MAAM,OAAO,KAAK;AAClB,KAAK;AACL,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,OAAM;AAC/B,IAAI,OAAO,IAAI;AACf,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,CAAC,CAAC,WAAW,EAAE,MAAM,EAAE;AAClC;AACA,IAAI,KAAK,CAAC,cAAc,GAAE;AAC1B,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE;AAC1B,IAAI,OAAO,CAAC,SAAS,CAAC,mBAAmB,EAAC;AAC1C;AACA,IAAI,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,GAAG,MAAM,EAAC;AACpE,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,UAAU,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE;AAClC,IAAI,OAAO,IAAI;AACf,GAAG;AACH;;AC1DA;AACA;AA0GA;AACA,MAAM,GAAG,uBAAuB,OAAO,UAAU,KAAK,WAAW;AACjE,IAAI,UAAU;AACd,IAAI,OAAO,MAAM,KAAK,WAAW;AACjC,MAAM,MAAM;AACZ;AACA,MAAM,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,GAAG,EAAE,EAAC;AAClD;AACA,MAAM,gBAAgB,GAAG,cAAa;AACtC;AACA,IAAI,GAAG,CAAC,gBAAgB,CAAC,KAAK,IAAI,EAAE;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,OAAO,CAAC,KAAK,CAAC,2HAA2H,EAAC;AAC5I,CAAC;AACD,GAAG,CAAC,gBAAgB,CAAC,GAAG;;;;"} \ No newline at end of file diff --git a/yjs-poll/node_modules/yjs/package.json b/yjs-poll/node_modules/yjs/package.json deleted file mode 100644 index 1055d53..0000000 --- a/yjs-poll/node_modules/yjs/package.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "name": "yjs", - "version": "13.6.29", - "description": "Shared Editing Library", - "main": "./dist/yjs.cjs", - "module": "./dist/yjs.mjs", - "types": "./dist/src/index.d.ts", - "type": "module", - "sideEffects": false, - "funding": { - "type": "GitHub Sponsors ❤", - "url": "https://github.com/sponsors/dmonad" - }, - "scripts": { - "clean": "rm -rf dist docs", - "test": "npm run dist && NODE_ENV=development node ./dist/tests.cjs --repetition-time 50", - "test-extensive": "npm run lint && npm run dist && node ./dist/tests.cjs --production --repetition-time 10000", - "dist": "npm run clean && rollup -c && tsc", - "watch": "rollup -wc", - "lint": "markdownlint README.md && standard && tsc", - "docs": "rm -rf docs; jsdoc --configure ./.jsdoc.json --verbose --readme ./README.md --package ./package.json || true", - "serve-docs": "npm run docs && http-server ./docs/", - "preversion": "npm run lint && PRODUCTION=1 npm run dist && npm run docs && node ./dist/tests.cjs --repetition-time 1000 && test -e dist/src/index.d.ts && test -e dist/yjs.cjs && test -e dist/yjs.cjs", - "debug": "concurrently 'http-server -o test.html' 'npm run watch'", - "trace-deopt": "clear && rollup -c && node --trace-deopt dist/test.cjs", - "trace-opt": "clear && rollup -c && node --trace-opt dist/test.cjs" - }, - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "module": "./dist/yjs.mjs", - "import": "./dist/yjs.mjs", - "require": "./dist/yjs.cjs" - }, - "./src/index.js": "./src/index.js", - "./tests/testHelper.js": "./tests/testHelper.js", - "./testHelper": "./dist/testHelper.mjs", - "./package.json": "./package.json" - }, - "files": [ - "dist/yjs.*", - "dist/src", - "src", - "tests/testHelper.js", - "dist/testHelper.mjs", - "sponsor-y.js" - ], - "dictionaries": { - "test": "tests" - }, - "standard": { - "ignore": [ - "/dist", - "/node_modules", - "/docs" - ] - }, - "repository": { - "type": "git", - "url": "https://github.com/yjs/yjs.git" - }, - "keywords": [ - "Yjs", - "CRDT", - "offline", - "offline-first", - "shared-editing", - "concurrency", - "collaboration" - ], - "author": "Kevin Jahns", - "email": "kevin.jahns@protonmail.com", - "license": "MIT", - "bugs": { - "url": "https://github.com/yjs/yjs/issues" - }, - "homepage": "https://docs.yjs.dev", - "dependencies": { - "lib0": "^0.2.99" - }, - "devDependencies": { - "@rollup/plugin-commonjs": "^24.0.1", - "@rollup/plugin-node-resolve": "^15.0.1", - "@types/node": "^18.15.5", - "concurrently": "^3.6.1", - "http-server": "^0.12.3", - "jsdoc": "^3.6.7", - "markdownlint-cli": "^0.41.0", - "rollup": "^3.20.0", - "standard": "^16.0.4", - "tui-jsdoc-template": "^1.2.2", - "typescript": "^4.9.5", - "y-protocols": "^1.0.5" - }, - "engines": { - "npm": ">=8.0.0", - "node": ">=16.0.0" - } -} diff --git a/yjs-poll/node_modules/yjs/src/index.js b/yjs-poll/node_modules/yjs/src/index.js deleted file mode 100644 index 5382e37..0000000 --- a/yjs-poll/node_modules/yjs/src/index.js +++ /dev/null @@ -1,135 +0,0 @@ -/** eslint-env browser */ - -export { - Doc, - Transaction, - YArray as Array, - YMap as Map, - YText as Text, - YXmlText as XmlText, - YXmlHook as XmlHook, - YXmlElement as XmlElement, - YXmlFragment as XmlFragment, - YXmlEvent, - YMapEvent, - YArrayEvent, - YTextEvent, - YEvent, - Item, - AbstractStruct, - GC, - Skip, - ContentBinary, - ContentDeleted, - ContentDoc, - ContentEmbed, - ContentFormat, - ContentJSON, - ContentAny, - ContentString, - ContentType, - AbstractType, - getTypeChildren, - createRelativePositionFromTypeIndex, - createRelativePositionFromJSON, - createAbsolutePositionFromRelativePosition, - compareRelativePositions, - AbsolutePosition, - RelativePosition, - ID, - createID, - compareIDs, - getState, - Snapshot, - createSnapshot, - createDeleteSet, - createDeleteSetFromStructStore, - cleanupYTextFormatting, - snapshot, - emptySnapshot, - findRootTypeKey, - findIndexSS, - getItem, - getItemCleanStart, - getItemCleanEnd, - typeListToArraySnapshot, - typeMapGetSnapshot, - typeMapGetAllSnapshot, - createDocFromSnapshot, - iterateDeletedStructs, - applyUpdate, - applyUpdateV2, - readUpdate, - readUpdateV2, - encodeStateAsUpdate, - encodeStateAsUpdateV2, - encodeStateVector, - UndoManager, - decodeSnapshot, - encodeSnapshot, - decodeSnapshotV2, - encodeSnapshotV2, - decodeStateVector, - logUpdate, - logUpdateV2, - decodeUpdate, - decodeUpdateV2, - relativePositionToJSON, - isDeleted, - isParentOf, - equalSnapshots, - PermanentUserData, // @TODO experimental - tryGc, - transact, - AbstractConnector, - logType, - mergeUpdates, - mergeUpdatesV2, - parseUpdateMeta, - parseUpdateMetaV2, - encodeStateVectorFromUpdate, - encodeStateVectorFromUpdateV2, - encodeRelativePosition, - decodeRelativePosition, - diffUpdate, - diffUpdateV2, - convertUpdateFormatV1ToV2, - convertUpdateFormatV2ToV1, - obfuscateUpdate, - obfuscateUpdateV2, - UpdateEncoderV1, - UpdateEncoderV2, - UpdateDecoderV1, - UpdateDecoderV2, - equalDeleteSets, - mergeDeleteSets, - snapshotContainsUpdate -} from './internals.js' - -const glo = /** @type {any} */ (typeof globalThis !== 'undefined' - ? globalThis - : typeof window !== 'undefined' - ? window - // @ts-ignore - : typeof global !== 'undefined' ? global : {}) - -const importIdentifier = '__ $YJS$ __' - -if (glo[importIdentifier] === true) { - /** - * Dear reader of this message. Please take this seriously. - * - * If you see this message, make sure that you only import one version of Yjs. In many cases, - * your package manager installs two versions of Yjs that are used by different packages within your project. - * Another reason for this message is that some parts of your project use the commonjs version of Yjs - * and others use the EcmaScript version of Yjs. - * - * This often leads to issues that are hard to debug. We often need to perform constructor checks, - * e.g. `struct instanceof GC`. If you imported different versions of Yjs, it is impossible for us to - * do the constructor checks anymore - which might break the CRDT algorithm. - * - * https://github.com/yjs/yjs/issues/438 - */ - console.error('Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438') -} -glo[importIdentifier] = true diff --git a/yjs-poll/node_modules/yjs/src/internals.js b/yjs-poll/node_modules/yjs/src/internals.js deleted file mode 100644 index cb2fcac..0000000 --- a/yjs-poll/node_modules/yjs/src/internals.js +++ /dev/null @@ -1,42 +0,0 @@ -export * from './utils/AbstractConnector.js' -export * from './utils/DeleteSet.js' -export * from './utils/Doc.js' -export * from './utils/UpdateDecoder.js' -export * from './utils/UpdateEncoder.js' -export * from './utils/encoding.js' -export * from './utils/EventHandler.js' -export * from './utils/ID.js' -export * from './utils/isParentOf.js' -export * from './utils/logging.js' -export * from './utils/PermanentUserData.js' -export * from './utils/RelativePosition.js' -export * from './utils/Snapshot.js' -export * from './utils/StructStore.js' -export * from './utils/Transaction.js' -export * from './utils/UndoManager.js' -export * from './utils/updates.js' -export * from './utils/YEvent.js' - -export * from './types/AbstractType.js' -export * from './types/YArray.js' -export * from './types/YMap.js' -export * from './types/YText.js' -export * from './types/YXmlFragment.js' -export * from './types/YXmlElement.js' -export * from './types/YXmlEvent.js' -export * from './types/YXmlHook.js' -export * from './types/YXmlText.js' - -export * from './structs/AbstractStruct.js' -export * from './structs/GC.js' -export * from './structs/ContentBinary.js' -export * from './structs/ContentDeleted.js' -export * from './structs/ContentDoc.js' -export * from './structs/ContentEmbed.js' -export * from './structs/ContentFormat.js' -export * from './structs/ContentJSON.js' -export * from './structs/ContentAny.js' -export * from './structs/ContentString.js' -export * from './structs/ContentType.js' -export * from './structs/Item.js' -export * from './structs/Skip.js' diff --git a/yjs-poll/node_modules/yjs/src/structs/AbstractStruct.js b/yjs-poll/node_modules/yjs/src/structs/AbstractStruct.js deleted file mode 100644 index 52773eb..0000000 --- a/yjs-poll/node_modules/yjs/src/structs/AbstractStruct.js +++ /dev/null @@ -1,51 +0,0 @@ -import { - UpdateEncoderV1, UpdateEncoderV2, ID, Transaction // eslint-disable-line -} from '../internals.js' - -import * as error from 'lib0/error' - -export class AbstractStruct { - /** - * @param {ID} id - * @param {number} length - */ - constructor (id, length) { - this.id = id - this.length = length - } - - /** - * @type {boolean} - */ - get deleted () { - throw error.methodUnimplemented() - } - - /** - * Merge this struct with the item to the right. - * This method is already assuming that `this.id.clock + this.length === this.id.clock`. - * Also this method does *not* remove right from StructStore! - * @param {AbstractStruct} right - * @return {boolean} whether this merged with right - */ - mergeWith (right) { - return false - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - * @param {number} offset - * @param {number} encodingRef - */ - write (encoder, offset, encodingRef) { - throw error.methodUnimplemented() - } - - /** - * @param {Transaction} transaction - * @param {number} offset - */ - integrate (transaction, offset) { - throw error.methodUnimplemented() - } -} diff --git a/yjs-poll/node_modules/yjs/src/structs/ContentAny.js b/yjs-poll/node_modules/yjs/src/structs/ContentAny.js deleted file mode 100644 index 3ab2dc5..0000000 --- a/yjs-poll/node_modules/yjs/src/structs/ContentAny.js +++ /dev/null @@ -1,114 +0,0 @@ -import { - UpdateEncoderV1, UpdateEncoderV2, UpdateDecoderV1, UpdateDecoderV2, Transaction, Item, StructStore // eslint-disable-line -} from '../internals.js' - -import * as env from 'lib0/environment' -import * as object from 'lib0/object' - -const isDevMode = env.getVariable('node_env') === 'development' - -export class ContentAny { - /** - * @param {Array} arr - */ - constructor (arr) { - /** - * @type {Array} - */ - this.arr = arr - isDevMode && object.deepFreeze(arr) - } - - /** - * @return {number} - */ - getLength () { - return this.arr.length - } - - /** - * @return {Array} - */ - getContent () { - return this.arr - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentAny} - */ - copy () { - return new ContentAny(this.arr) - } - - /** - * @param {number} offset - * @return {ContentAny} - */ - splice (offset) { - const right = new ContentAny(this.arr.slice(offset)) - this.arr = this.arr.slice(0, offset) - return right - } - - /** - * @param {ContentAny} right - * @return {boolean} - */ - mergeWith (right) { - this.arr = this.arr.concat(right.arr) - return true - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) {} - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - const len = this.arr.length - encoder.writeLen(len - offset) - for (let i = offset; i < len; i++) { - const c = this.arr[i] - encoder.writeAny(c) - } - } - - /** - * @return {number} - */ - getRef () { - return 8 - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentAny} - */ -export const readContentAny = decoder => { - const len = decoder.readLen() - const cs = [] - for (let i = 0; i < len; i++) { - cs.push(decoder.readAny()) - } - return new ContentAny(cs) -} diff --git a/yjs-poll/node_modules/yjs/src/structs/ContentBinary.js b/yjs-poll/node_modules/yjs/src/structs/ContentBinary.js deleted file mode 100644 index 2708f53..0000000 --- a/yjs-poll/node_modules/yjs/src/structs/ContentBinary.js +++ /dev/null @@ -1,92 +0,0 @@ -import { - UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, StructStore, Item, Transaction // eslint-disable-line -} from '../internals.js' - -import * as error from 'lib0/error' - -export class ContentBinary { - /** - * @param {Uint8Array} content - */ - constructor (content) { - this.content = content - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [this.content] - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentBinary} - */ - copy () { - return new ContentBinary(this.content) - } - - /** - * @param {number} offset - * @return {ContentBinary} - */ - splice (offset) { - throw error.methodUnimplemented() - } - - /** - * @param {ContentBinary} right - * @return {boolean} - */ - mergeWith (right) { - return false - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) {} - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeBuf(this.content) - } - - /** - * @return {number} - */ - getRef () { - return 3 - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2 } decoder - * @return {ContentBinary} - */ -export const readContentBinary = decoder => new ContentBinary(decoder.readBuf()) diff --git a/yjs-poll/node_modules/yjs/src/structs/ContentDeleted.js b/yjs-poll/node_modules/yjs/src/structs/ContentDeleted.js deleted file mode 100644 index 917ba24..0000000 --- a/yjs-poll/node_modules/yjs/src/structs/ContentDeleted.js +++ /dev/null @@ -1,100 +0,0 @@ -import { - addToDeleteSet, - UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, StructStore, Item, Transaction // eslint-disable-line -} from '../internals.js' - -export class ContentDeleted { - /** - * @param {number} len - */ - constructor (len) { - this.len = len - } - - /** - * @return {number} - */ - getLength () { - return this.len - } - - /** - * @return {Array} - */ - getContent () { - return [] - } - - /** - * @return {boolean} - */ - isCountable () { - return false - } - - /** - * @return {ContentDeleted} - */ - copy () { - return new ContentDeleted(this.len) - } - - /** - * @param {number} offset - * @return {ContentDeleted} - */ - splice (offset) { - const right = new ContentDeleted(this.len - offset) - this.len = offset - return right - } - - /** - * @param {ContentDeleted} right - * @return {boolean} - */ - mergeWith (right) { - this.len += right.len - return true - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) { - addToDeleteSet(transaction.deleteSet, item.id.client, item.id.clock, this.len) - item.markDeleted() - } - - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeLen(this.len - offset) - } - - /** - * @return {number} - */ - getRef () { - return 1 - } -} - -/** - * @private - * - * @param {UpdateDecoderV1 | UpdateDecoderV2 } decoder - * @return {ContentDeleted} - */ -export const readContentDeleted = decoder => new ContentDeleted(decoder.readLen()) diff --git a/yjs-poll/node_modules/yjs/src/structs/ContentDoc.js b/yjs-poll/node_modules/yjs/src/structs/ContentDoc.js deleted file mode 100644 index 15836f5..0000000 --- a/yjs-poll/node_modules/yjs/src/structs/ContentDoc.js +++ /dev/null @@ -1,140 +0,0 @@ -import { - Doc, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, StructStore, Transaction, Item // eslint-disable-line -} from '../internals.js' - -import * as error from 'lib0/error' - -/** - * @param {string} guid - * @param {Object} opts - */ -const createDocFromOpts = (guid, opts) => new Doc({ guid, ...opts, shouldLoad: opts.shouldLoad || opts.autoLoad || false }) - -/** - * @private - */ -export class ContentDoc { - /** - * @param {Doc} doc - */ - constructor (doc) { - if (doc._item) { - console.error('This document was already integrated as a sub-document. You should create a second instance instead with the same guid.') - } - /** - * @type {Doc} - */ - this.doc = doc - /** - * @type {any} - */ - const opts = {} - this.opts = opts - if (!doc.gc) { - opts.gc = false - } - if (doc.autoLoad) { - opts.autoLoad = true - } - if (doc.meta !== null) { - opts.meta = doc.meta - } - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [this.doc] - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentDoc} - */ - copy () { - return new ContentDoc(createDocFromOpts(this.doc.guid, this.opts)) - } - - /** - * @param {number} offset - * @return {ContentDoc} - */ - splice (offset) { - throw error.methodUnimplemented() - } - - /** - * @param {ContentDoc} right - * @return {boolean} - */ - mergeWith (right) { - return false - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) { - // this needs to be reflected in doc.destroy as well - this.doc._item = item - transaction.subdocsAdded.add(this.doc) - if (this.doc.shouldLoad) { - transaction.subdocsLoaded.add(this.doc) - } - } - - /** - * @param {Transaction} transaction - */ - delete (transaction) { - if (transaction.subdocsAdded.has(this.doc)) { - transaction.subdocsAdded.delete(this.doc) - } else { - transaction.subdocsRemoved.add(this.doc) - } - } - - /** - * @param {StructStore} store - */ - gc (store) { } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeString(this.doc.guid) - encoder.writeAny(this.opts) - } - - /** - * @return {number} - */ - getRef () { - return 9 - } -} - -/** - * @private - * - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentDoc} - */ -export const readContentDoc = decoder => new ContentDoc(createDocFromOpts(decoder.readString(), decoder.readAny())) diff --git a/yjs-poll/node_modules/yjs/src/structs/ContentEmbed.js b/yjs-poll/node_modules/yjs/src/structs/ContentEmbed.js deleted file mode 100644 index 46fba37..0000000 --- a/yjs-poll/node_modules/yjs/src/structs/ContentEmbed.js +++ /dev/null @@ -1,97 +0,0 @@ -import { - UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, StructStore, Item, Transaction // eslint-disable-line -} from '../internals.js' - -import * as error from 'lib0/error' - -/** - * @private - */ -export class ContentEmbed { - /** - * @param {Object} embed - */ - constructor (embed) { - this.embed = embed - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [this.embed] - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentEmbed} - */ - copy () { - return new ContentEmbed(this.embed) - } - - /** - * @param {number} offset - * @return {ContentEmbed} - */ - splice (offset) { - throw error.methodUnimplemented() - } - - /** - * @param {ContentEmbed} right - * @return {boolean} - */ - mergeWith (right) { - return false - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) {} - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeJSON(this.embed) - } - - /** - * @return {number} - */ - getRef () { - return 5 - } -} - -/** - * @private - * - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentEmbed} - */ -export const readContentEmbed = decoder => new ContentEmbed(decoder.readJSON()) diff --git a/yjs-poll/node_modules/yjs/src/structs/ContentFormat.js b/yjs-poll/node_modules/yjs/src/structs/ContentFormat.js deleted file mode 100644 index eb2bd0e..0000000 --- a/yjs-poll/node_modules/yjs/src/structs/ContentFormat.js +++ /dev/null @@ -1,104 +0,0 @@ -import { - YText, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Item, StructStore, Transaction // eslint-disable-line -} from '../internals.js' - -import * as error from 'lib0/error' - -/** - * @private - */ -export class ContentFormat { - /** - * @param {string} key - * @param {Object} value - */ - constructor (key, value) { - this.key = key - this.value = value - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [] - } - - /** - * @return {boolean} - */ - isCountable () { - return false - } - - /** - * @return {ContentFormat} - */ - copy () { - return new ContentFormat(this.key, this.value) - } - - /** - * @param {number} _offset - * @return {ContentFormat} - */ - splice (_offset) { - throw error.methodUnimplemented() - } - - /** - * @param {ContentFormat} _right - * @return {boolean} - */ - mergeWith (_right) { - return false - } - - /** - * @param {Transaction} _transaction - * @param {Item} item - */ - integrate (_transaction, item) { - // @todo searchmarker are currently unsupported for rich text documents - const p = /** @type {YText} */ (item.parent) - p._searchMarker = null - p._hasFormatting = true - } - - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeKey(this.key) - encoder.writeJSON(this.value) - } - - /** - * @return {number} - */ - getRef () { - return 6 - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentFormat} - */ -export const readContentFormat = decoder => new ContentFormat(decoder.readKey(), decoder.readJSON()) diff --git a/yjs-poll/node_modules/yjs/src/structs/ContentJSON.js b/yjs-poll/node_modules/yjs/src/structs/ContentJSON.js deleted file mode 100644 index 29b2f75..0000000 --- a/yjs-poll/node_modules/yjs/src/structs/ContentJSON.js +++ /dev/null @@ -1,118 +0,0 @@ -import { - UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Transaction, Item, StructStore // eslint-disable-line -} from '../internals.js' - -/** - * @private - */ -export class ContentJSON { - /** - * @param {Array} arr - */ - constructor (arr) { - /** - * @type {Array} - */ - this.arr = arr - } - - /** - * @return {number} - */ - getLength () { - return this.arr.length - } - - /** - * @return {Array} - */ - getContent () { - return this.arr - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentJSON} - */ - copy () { - return new ContentJSON(this.arr) - } - - /** - * @param {number} offset - * @return {ContentJSON} - */ - splice (offset) { - const right = new ContentJSON(this.arr.slice(offset)) - this.arr = this.arr.slice(0, offset) - return right - } - - /** - * @param {ContentJSON} right - * @return {boolean} - */ - mergeWith (right) { - this.arr = this.arr.concat(right.arr) - return true - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) {} - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - const len = this.arr.length - encoder.writeLen(len - offset) - for (let i = offset; i < len; i++) { - const c = this.arr[i] - encoder.writeString(c === undefined ? 'undefined' : JSON.stringify(c)) - } - } - - /** - * @return {number} - */ - getRef () { - return 2 - } -} - -/** - * @private - * - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentJSON} - */ -export const readContentJSON = decoder => { - const len = decoder.readLen() - const cs = [] - for (let i = 0; i < len; i++) { - const c = decoder.readString() - if (c === 'undefined') { - cs.push(undefined) - } else { - cs.push(JSON.parse(c)) - } - } - return new ContentJSON(cs) -} diff --git a/yjs-poll/node_modules/yjs/src/structs/ContentString.js b/yjs-poll/node_modules/yjs/src/structs/ContentString.js deleted file mode 100644 index fa023ef..0000000 --- a/yjs-poll/node_modules/yjs/src/structs/ContentString.js +++ /dev/null @@ -1,112 +0,0 @@ -import { - UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Transaction, Item, StructStore // eslint-disable-line -} from '../internals.js' - -/** - * @private - */ -export class ContentString { - /** - * @param {string} str - */ - constructor (str) { - /** - * @type {string} - */ - this.str = str - } - - /** - * @return {number} - */ - getLength () { - return this.str.length - } - - /** - * @return {Array} - */ - getContent () { - return this.str.split('') - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentString} - */ - copy () { - return new ContentString(this.str) - } - - /** - * @param {number} offset - * @return {ContentString} - */ - splice (offset) { - const right = new ContentString(this.str.slice(offset)) - this.str = this.str.slice(0, offset) - - // Prevent encoding invalid documents because of splitting of surrogate pairs: https://github.com/yjs/yjs/issues/248 - const firstCharCode = this.str.charCodeAt(offset - 1) - if (firstCharCode >= 0xD800 && firstCharCode <= 0xDBFF) { - // Last character of the left split is the start of a surrogate utf16/ucs2 pair. - // We don't support splitting of surrogate pairs because this may lead to invalid documents. - // Replace the invalid character with a unicode replacement character (� / U+FFFD) - this.str = this.str.slice(0, offset - 1) + '�' - // replace right as well - right.str = '�' + right.str.slice(1) - } - return right - } - - /** - * @param {ContentString} right - * @return {boolean} - */ - mergeWith (right) { - this.str += right.str - return true - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) {} - /** - * @param {Transaction} transaction - */ - delete (transaction) {} - /** - * @param {StructStore} store - */ - gc (store) {} - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeString(offset === 0 ? this.str : this.str.slice(offset)) - } - - /** - * @return {number} - */ - getRef () { - return 4 - } -} - -/** - * @private - * - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentString} - */ -export const readContentString = decoder => new ContentString(decoder.readString()) diff --git a/yjs-poll/node_modules/yjs/src/structs/ContentType.js b/yjs-poll/node_modules/yjs/src/structs/ContentType.js deleted file mode 100644 index 630efeb..0000000 --- a/yjs-poll/node_modules/yjs/src/structs/ContentType.js +++ /dev/null @@ -1,171 +0,0 @@ -import { - readYArray, - readYMap, - readYText, - readYXmlElement, - readYXmlFragment, - readYXmlHook, - readYXmlText, - UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, StructStore, Transaction, Item, YEvent, AbstractType // eslint-disable-line -} from '../internals.js' - -import * as error from 'lib0/error' - -/** - * @type {Array>} - * @private - */ -export const typeRefs = [ - readYArray, - readYMap, - readYText, - readYXmlElement, - readYXmlFragment, - readYXmlHook, - readYXmlText -] - -export const YArrayRefID = 0 -export const YMapRefID = 1 -export const YTextRefID = 2 -export const YXmlElementRefID = 3 -export const YXmlFragmentRefID = 4 -export const YXmlHookRefID = 5 -export const YXmlTextRefID = 6 - -/** - * @private - */ -export class ContentType { - /** - * @param {AbstractType} type - */ - constructor (type) { - /** - * @type {AbstractType} - */ - this.type = type - } - - /** - * @return {number} - */ - getLength () { - return 1 - } - - /** - * @return {Array} - */ - getContent () { - return [this.type] - } - - /** - * @return {boolean} - */ - isCountable () { - return true - } - - /** - * @return {ContentType} - */ - copy () { - return new ContentType(this.type._copy()) - } - - /** - * @param {number} offset - * @return {ContentType} - */ - splice (offset) { - throw error.methodUnimplemented() - } - - /** - * @param {ContentType} right - * @return {boolean} - */ - mergeWith (right) { - return false - } - - /** - * @param {Transaction} transaction - * @param {Item} item - */ - integrate (transaction, item) { - this.type._integrate(transaction.doc, item) - } - - /** - * @param {Transaction} transaction - */ - delete (transaction) { - let item = this.type._start - while (item !== null) { - if (!item.deleted) { - item.delete(transaction) - } else if (item.id.clock < (transaction.beforeState.get(item.id.client) || 0)) { - // This will be gc'd later and we want to merge it if possible - // We try to merge all deleted items after each transaction, - // but we have no knowledge about that this needs to be merged - // since it is not in transaction.ds. Hence we add it to transaction._mergeStructs - transaction._mergeStructs.push(item) - } - item = item.right - } - this.type._map.forEach(item => { - if (!item.deleted) { - item.delete(transaction) - } else if (item.id.clock < (transaction.beforeState.get(item.id.client) || 0)) { - // same as above - transaction._mergeStructs.push(item) - } - }) - transaction.changed.delete(this.type) - } - - /** - * @param {StructStore} store - */ - gc (store) { - let item = this.type._start - while (item !== null) { - item.gc(store, true) - item = item.right - } - this.type._start = null - this.type._map.forEach(/** @param {Item | null} item */ (item) => { - while (item !== null) { - item.gc(store, true) - item = item.left - } - }) - this.type._map = new Map() - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - this.type._write(encoder) - } - - /** - * @return {number} - */ - getRef () { - return 7 - } -} - -/** - * @private - * - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {ContentType} - */ -export const readContentType = decoder => new ContentType(typeRefs[decoder.readTypeRef()](decoder)) diff --git a/yjs-poll/node_modules/yjs/src/structs/GC.js b/yjs-poll/node_modules/yjs/src/structs/GC.js deleted file mode 100644 index 3c7cec0..0000000 --- a/yjs-poll/node_modules/yjs/src/structs/GC.js +++ /dev/null @@ -1,60 +0,0 @@ -import { - AbstractStruct, - addStruct, - UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, StructStore, Transaction, ID // eslint-disable-line -} from '../internals.js' - -export const structGCRefNumber = 0 - -/** - * @private - */ -export class GC extends AbstractStruct { - get deleted () { - return true - } - - delete () {} - - /** - * @param {GC} right - * @return {boolean} - */ - mergeWith (right) { - if (this.constructor !== right.constructor) { - return false - } - this.length += right.length - return true - } - - /** - * @param {Transaction} transaction - * @param {number} offset - */ - integrate (transaction, offset) { - if (offset > 0) { - this.id.clock += offset - this.length -= offset - } - addStruct(transaction.doc.store, this) - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeInfo(structGCRefNumber) - encoder.writeLen(this.length - offset) - } - - /** - * @param {Transaction} transaction - * @param {StructStore} store - * @return {null | number} - */ - getMissing (transaction, store) { - return null - } -} diff --git a/yjs-poll/node_modules/yjs/src/structs/Item.js b/yjs-poll/node_modules/yjs/src/structs/Item.js deleted file mode 100644 index 2d2b1bb..0000000 --- a/yjs-poll/node_modules/yjs/src/structs/Item.js +++ /dev/null @@ -1,812 +0,0 @@ -import { - GC, - getState, - AbstractStruct, - replaceStruct, - addStruct, - addToDeleteSet, - findRootTypeKey, - compareIDs, - getItem, - getItemCleanEnd, - getItemCleanStart, - readContentDeleted, - readContentBinary, - readContentJSON, - readContentAny, - readContentString, - readContentEmbed, - readContentDoc, - createID, - readContentFormat, - readContentType, - addChangedTypeToTransaction, - isDeleted, - StackItem, DeleteSet, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, ContentType, ContentDeleted, StructStore, ID, AbstractType, Transaction // eslint-disable-line -} from '../internals.js' - -import * as error from 'lib0/error' -import * as binary from 'lib0/binary' -import * as array from 'lib0/array' - -/** - * @todo This should return several items - * - * @param {StructStore} store - * @param {ID} id - * @return {{item:Item, diff:number}} - */ -export const followRedone = (store, id) => { - /** - * @type {ID|null} - */ - let nextID = id - let diff = 0 - let item - do { - if (diff > 0) { - nextID = createID(nextID.client, nextID.clock + diff) - } - item = getItem(store, nextID) - diff = nextID.clock - item.id.clock - nextID = item.redone - } while (nextID !== null && item instanceof Item) - return { - item, diff - } -} - -/** - * Make sure that neither item nor any of its parents is ever deleted. - * - * This property does not persist when storing it into a database or when - * sending it to other peers - * - * @param {Item|null} item - * @param {boolean} keep - */ -export const keepItem = (item, keep) => { - while (item !== null && item.keep !== keep) { - item.keep = keep - item = /** @type {AbstractType} */ (item.parent)._item - } -} - -/** - * Split leftItem into two items - * @param {Transaction} transaction - * @param {Item} leftItem - * @param {number} diff - * @return {Item} - * - * @function - * @private - */ -export const splitItem = (transaction, leftItem, diff) => { - // create rightItem - const { client, clock } = leftItem.id - const rightItem = new Item( - createID(client, clock + diff), - leftItem, - createID(client, clock + diff - 1), - leftItem.right, - leftItem.rightOrigin, - leftItem.parent, - leftItem.parentSub, - leftItem.content.splice(diff) - ) - if (leftItem.deleted) { - rightItem.markDeleted() - } - if (leftItem.keep) { - rightItem.keep = true - } - if (leftItem.redone !== null) { - rightItem.redone = createID(leftItem.redone.client, leftItem.redone.clock + diff) - } - // update left (do not set leftItem.rightOrigin as it will lead to problems when syncing) - leftItem.right = rightItem - // update right - if (rightItem.right !== null) { - rightItem.right.left = rightItem - } - // right is more specific. - transaction._mergeStructs.push(rightItem) - // update parent._map - if (rightItem.parentSub !== null && rightItem.right === null) { - /** @type {AbstractType} */ (rightItem.parent)._map.set(rightItem.parentSub, rightItem) - } - leftItem.length = diff - return rightItem -} - -/** - * @param {Array} stack - * @param {ID} id - */ -const isDeletedByUndoStack = (stack, id) => array.some(stack, /** @param {StackItem} s */ s => isDeleted(s.deletions, id)) - -/** - * Redoes the effect of this operation. - * - * @param {Transaction} transaction The Yjs instance. - * @param {Item} item - * @param {Set} redoitems - * @param {DeleteSet} itemsToDelete - * @param {boolean} ignoreRemoteMapChanges - * @param {import('../utils/UndoManager.js').UndoManager} um - * - * @return {Item|null} - * - * @private - */ -export const redoItem = (transaction, item, redoitems, itemsToDelete, ignoreRemoteMapChanges, um) => { - const doc = transaction.doc - const store = doc.store - const ownClientID = doc.clientID - const redone = item.redone - if (redone !== null) { - return getItemCleanStart(transaction, redone) - } - let parentItem = /** @type {AbstractType} */ (item.parent)._item - /** - * @type {Item|null} - */ - let left = null - /** - * @type {Item|null} - */ - let right - // make sure that parent is redone - if (parentItem !== null && parentItem.deleted === true) { - // try to undo parent if it will be undone anyway - if (parentItem.redone === null && (!redoitems.has(parentItem) || redoItem(transaction, parentItem, redoitems, itemsToDelete, ignoreRemoteMapChanges, um) === null)) { - return null - } - while (parentItem.redone !== null) { - parentItem = getItemCleanStart(transaction, parentItem.redone) - } - } - const parentType = parentItem === null ? /** @type {AbstractType} */ (item.parent) : /** @type {ContentType} */ (parentItem.content).type - - if (item.parentSub === null) { - // Is an array item. Insert at the old position - left = item.left - right = item - // find next cloned_redo items - while (left !== null) { - /** - * @type {Item|null} - */ - let leftTrace = left - // trace redone until parent matches - while (leftTrace !== null && /** @type {AbstractType} */ (leftTrace.parent)._item !== parentItem) { - leftTrace = leftTrace.redone === null ? null : getItemCleanStart(transaction, leftTrace.redone) - } - if (leftTrace !== null && /** @type {AbstractType} */ (leftTrace.parent)._item === parentItem) { - left = leftTrace - break - } - left = left.left - } - while (right !== null) { - /** - * @type {Item|null} - */ - let rightTrace = right - // trace redone until parent matches - while (rightTrace !== null && /** @type {AbstractType} */ (rightTrace.parent)._item !== parentItem) { - rightTrace = rightTrace.redone === null ? null : getItemCleanStart(transaction, rightTrace.redone) - } - if (rightTrace !== null && /** @type {AbstractType} */ (rightTrace.parent)._item === parentItem) { - right = rightTrace - break - } - right = right.right - } - } else { - right = null - if (item.right && !ignoreRemoteMapChanges) { - left = item - // Iterate right while right is in itemsToDelete - // If it is intended to delete right while item is redone, we can expect that item should replace right. - while (left !== null && left.right !== null && (left.right.redone || isDeleted(itemsToDelete, left.right.id) || isDeletedByUndoStack(um.undoStack, left.right.id) || isDeletedByUndoStack(um.redoStack, left.right.id))) { - left = left.right - // follow redone - while (left.redone) left = getItemCleanStart(transaction, left.redone) - } - if (left && left.right !== null) { - // It is not possible to redo this item because it conflicts with a - // change from another client - return null - } - } else { - left = parentType._map.get(item.parentSub) || null - } - } - const nextClock = getState(store, ownClientID) - const nextId = createID(ownClientID, nextClock) - const redoneItem = new Item( - nextId, - left, left && left.lastId, - right, right && right.id, - parentType, - item.parentSub, - item.content.copy() - ) - item.redone = nextId - keepItem(redoneItem, true) - redoneItem.integrate(transaction, 0) - return redoneItem -} - -/** - * Abstract class that represents any content. - */ -export class Item extends AbstractStruct { - /** - * @param {ID} id - * @param {Item | null} left - * @param {ID | null} origin - * @param {Item | null} right - * @param {ID | null} rightOrigin - * @param {AbstractType|ID|null} parent Is a type if integrated, is null if it is possible to copy parent from left or right, is ID before integration to search for it. - * @param {string | null} parentSub - * @param {AbstractContent} content - */ - constructor (id, left, origin, right, rightOrigin, parent, parentSub, content) { - super(id, content.getLength()) - /** - * The item that was originally to the left of this item. - * @type {ID | null} - */ - this.origin = origin - /** - * The item that is currently to the left of this item. - * @type {Item | null} - */ - this.left = left - /** - * The item that is currently to the right of this item. - * @type {Item | null} - */ - this.right = right - /** - * The item that was originally to the right of this item. - * @type {ID | null} - */ - this.rightOrigin = rightOrigin - /** - * @type {AbstractType|ID|null} - */ - this.parent = parent - /** - * If the parent refers to this item with some kind of key (e.g. YMap, the - * key is specified here. The key is then used to refer to the list in which - * to insert this item. If `parentSub = null` type._start is the list in - * which to insert to. Otherwise it is `parent._map`. - * @type {String | null} - */ - this.parentSub = parentSub - /** - * If this type's effect is redone this type refers to the type that undid - * this operation. - * @type {ID | null} - */ - this.redone = null - /** - * @type {AbstractContent} - */ - this.content = content - /** - * bit1: keep - * bit2: countable - * bit3: deleted - * bit4: mark - mark node as fast-search-marker - * @type {number} byte - */ - this.info = this.content.isCountable() ? binary.BIT2 : 0 - } - - /** - * This is used to mark the item as an indexed fast-search marker - * - * @type {boolean} - */ - set marker (isMarked) { - if (((this.info & binary.BIT4) > 0) !== isMarked) { - this.info ^= binary.BIT4 - } - } - - get marker () { - return (this.info & binary.BIT4) > 0 - } - - /** - * If true, do not garbage collect this Item. - */ - get keep () { - return (this.info & binary.BIT1) > 0 - } - - set keep (doKeep) { - if (this.keep !== doKeep) { - this.info ^= binary.BIT1 - } - } - - get countable () { - return (this.info & binary.BIT2) > 0 - } - - /** - * Whether this item was deleted or not. - * @type {Boolean} - */ - get deleted () { - return (this.info & binary.BIT3) > 0 - } - - set deleted (doDelete) { - if (this.deleted !== doDelete) { - this.info ^= binary.BIT3 - } - } - - markDeleted () { - this.info |= binary.BIT3 - } - - /** - * Return the creator clientID of the missing op or define missing items and return null. - * - * @param {Transaction} transaction - * @param {StructStore} store - * @return {null | number} - */ - getMissing (transaction, store) { - if (this.origin && this.origin.client !== this.id.client && this.origin.clock >= getState(store, this.origin.client)) { - return this.origin.client - } - if (this.rightOrigin && this.rightOrigin.client !== this.id.client && this.rightOrigin.clock >= getState(store, this.rightOrigin.client)) { - return this.rightOrigin.client - } - if (this.parent && this.parent.constructor === ID && this.id.client !== this.parent.client && this.parent.clock >= getState(store, this.parent.client)) { - return this.parent.client - } - - // We have all missing ids, now find the items - - if (this.origin) { - this.left = getItemCleanEnd(transaction, store, this.origin) - this.origin = this.left.lastId - } - if (this.rightOrigin) { - this.right = getItemCleanStart(transaction, this.rightOrigin) - this.rightOrigin = this.right.id - } - if ((this.left && this.left.constructor === GC) || (this.right && this.right.constructor === GC)) { - this.parent = null - } else if (!this.parent) { - // only set parent if this shouldn't be garbage collected - if (this.left && this.left.constructor === Item) { - this.parent = this.left.parent - this.parentSub = this.left.parentSub - } else if (this.right && this.right.constructor === Item) { - this.parent = this.right.parent - this.parentSub = this.right.parentSub - } - } else if (this.parent.constructor === ID) { - const parentItem = getItem(store, this.parent) - if (parentItem.constructor === GC) { - this.parent = null - } else { - this.parent = /** @type {ContentType} */ (parentItem.content).type - } - } - return null - } - - /** - * @param {Transaction} transaction - * @param {number} offset - */ - integrate (transaction, offset) { - if (offset > 0) { - this.id.clock += offset - this.left = getItemCleanEnd(transaction, transaction.doc.store, createID(this.id.client, this.id.clock - 1)) - this.origin = this.left.lastId - this.content = this.content.splice(offset) - this.length -= offset - } - - if (this.parent) { - if ((!this.left && (!this.right || this.right.left !== null)) || (this.left && this.left.right !== this.right)) { - /** - * @type {Item|null} - */ - let left = this.left - - /** - * @type {Item|null} - */ - let o - // set o to the first conflicting item - if (left !== null) { - o = left.right - } else if (this.parentSub !== null) { - o = /** @type {AbstractType} */ (this.parent)._map.get(this.parentSub) || null - while (o !== null && o.left !== null) { - o = o.left - } - } else { - o = /** @type {AbstractType} */ (this.parent)._start - } - // TODO: use something like DeleteSet here (a tree implementation would be best) - // @todo use global set definitions - /** - * @type {Set} - */ - const conflictingItems = new Set() - /** - * @type {Set} - */ - const itemsBeforeOrigin = new Set() - // Let c in conflictingItems, b in itemsBeforeOrigin - // ***{origin}bbbb{this}{c,b}{c,b}{o}*** - // Note that conflictingItems is a subset of itemsBeforeOrigin - while (o !== null && o !== this.right) { - itemsBeforeOrigin.add(o) - conflictingItems.add(o) - if (compareIDs(this.origin, o.origin)) { - // case 1 - if (o.id.client < this.id.client) { - left = o - conflictingItems.clear() - } else if (compareIDs(this.rightOrigin, o.rightOrigin)) { - // this and o are conflicting and point to the same integration points. The id decides which item comes first. - // Since this is to the left of o, we can break here - break - } // else, o might be integrated before an item that this conflicts with. If so, we will find it in the next iterations - } else if (o.origin !== null && itemsBeforeOrigin.has(getItem(transaction.doc.store, o.origin))) { // use getItem instead of getItemCleanEnd because we don't want / need to split items. - // case 2 - if (!conflictingItems.has(getItem(transaction.doc.store, o.origin))) { - left = o - conflictingItems.clear() - } - } else { - break - } - o = o.right - } - this.left = left - } - // reconnect left/right + update parent map/start if necessary - if (this.left !== null) { - const right = this.left.right - this.right = right - this.left.right = this - } else { - let r - if (this.parentSub !== null) { - r = /** @type {AbstractType} */ (this.parent)._map.get(this.parentSub) || null - while (r !== null && r.left !== null) { - r = r.left - } - } else { - r = /** @type {AbstractType} */ (this.parent)._start - ;/** @type {AbstractType} */ (this.parent)._start = this - } - this.right = r - } - if (this.right !== null) { - this.right.left = this - } else if (this.parentSub !== null) { - // set as current parent value if right === null and this is parentSub - /** @type {AbstractType} */ (this.parent)._map.set(this.parentSub, this) - if (this.left !== null) { - // this is the current attribute value of parent. delete right - this.left.delete(transaction) - } - } - // adjust length of parent - if (this.parentSub === null && this.countable && !this.deleted) { - /** @type {AbstractType} */ (this.parent)._length += this.length - } - addStruct(transaction.doc.store, this) - this.content.integrate(transaction, this) - // add parent to transaction.changed - addChangedTypeToTransaction(transaction, /** @type {AbstractType} */ (this.parent), this.parentSub) - if ((/** @type {AbstractType} */ (this.parent)._item !== null && /** @type {AbstractType} */ (this.parent)._item.deleted) || (this.parentSub !== null && this.right !== null)) { - // delete if parent is deleted or if this is not the current attribute value of parent - this.delete(transaction) - } - } else { - // parent is not defined. Integrate GC struct instead - new GC(this.id, this.length).integrate(transaction, 0) - } - } - - /** - * Returns the next non-deleted item - */ - get next () { - let n = this.right - while (n !== null && n.deleted) { - n = n.right - } - return n - } - - /** - * Returns the previous non-deleted item - */ - get prev () { - let n = this.left - while (n !== null && n.deleted) { - n = n.left - } - return n - } - - /** - * Computes the last content address of this Item. - */ - get lastId () { - // allocating ids is pretty costly because of the amount of ids created, so we try to reuse whenever possible - return this.length === 1 ? this.id : createID(this.id.client, this.id.clock + this.length - 1) - } - - /** - * Try to merge two items - * - * @param {Item} right - * @return {boolean} - */ - mergeWith (right) { - if ( - this.constructor === right.constructor && - compareIDs(right.origin, this.lastId) && - this.right === right && - compareIDs(this.rightOrigin, right.rightOrigin) && - this.id.client === right.id.client && - this.id.clock + this.length === right.id.clock && - this.deleted === right.deleted && - this.redone === null && - right.redone === null && - this.content.constructor === right.content.constructor && - this.content.mergeWith(right.content) - ) { - const searchMarker = /** @type {AbstractType} */ (this.parent)._searchMarker - if (searchMarker) { - searchMarker.forEach(marker => { - if (marker.p === right) { - // right is going to be "forgotten" so we need to update the marker - marker.p = this - // adjust marker index - if (!this.deleted && this.countable) { - marker.index -= this.length - } - } - }) - } - if (right.keep) { - this.keep = true - } - this.right = right.right - if (this.right !== null) { - this.right.left = this - } - this.length += right.length - return true - } - return false - } - - /** - * Mark this Item as deleted. - * - * @param {Transaction} transaction - */ - delete (transaction) { - if (!this.deleted) { - const parent = /** @type {AbstractType} */ (this.parent) - // adjust the length of parent - if (this.countable && this.parentSub === null) { - parent._length -= this.length - } - this.markDeleted() - addToDeleteSet(transaction.deleteSet, this.id.client, this.id.clock, this.length) - addChangedTypeToTransaction(transaction, parent, this.parentSub) - this.content.delete(transaction) - } - } - - /** - * @param {StructStore} store - * @param {boolean} parentGCd - */ - gc (store, parentGCd) { - if (!this.deleted) { - throw error.unexpectedCase() - } - this.content.gc(store) - if (parentGCd) { - replaceStruct(store, this, new GC(this.id, this.length)) - } else { - this.content = new ContentDeleted(this.length) - } - } - - /** - * Transform the properties of this type to binary and write it to an - * BinaryEncoder. - * - * This is called when this Item is sent to a remote peer. - * - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - * @param {number} offset - */ - write (encoder, offset) { - const origin = offset > 0 ? createID(this.id.client, this.id.clock + offset - 1) : this.origin - const rightOrigin = this.rightOrigin - const parentSub = this.parentSub - const info = (this.content.getRef() & binary.BITS5) | - (origin === null ? 0 : binary.BIT8) | // origin is defined - (rightOrigin === null ? 0 : binary.BIT7) | // right origin is defined - (parentSub === null ? 0 : binary.BIT6) // parentSub is non-null - encoder.writeInfo(info) - if (origin !== null) { - encoder.writeLeftID(origin) - } - if (rightOrigin !== null) { - encoder.writeRightID(rightOrigin) - } - if (origin === null && rightOrigin === null) { - const parent = /** @type {AbstractType} */ (this.parent) - if (parent._item !== undefined) { - const parentItem = parent._item - if (parentItem === null) { - // parent type on y._map - // find the correct key - const ykey = findRootTypeKey(parent) - encoder.writeParentInfo(true) // write parentYKey - encoder.writeString(ykey) - } else { - encoder.writeParentInfo(false) // write parent id - encoder.writeLeftID(parentItem.id) - } - } else if (parent.constructor === String) { // this edge case was added by differential updates - encoder.writeParentInfo(true) // write parentYKey - encoder.writeString(parent) - } else if (parent.constructor === ID) { - encoder.writeParentInfo(false) // write parent id - encoder.writeLeftID(parent) - } else { - error.unexpectedCase() - } - if (parentSub !== null) { - encoder.writeString(parentSub) - } - } - this.content.write(encoder, offset) - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @param {number} info - */ -export const readItemContent = (decoder, info) => contentRefs[info & binary.BITS5](decoder) - -/** - * A lookup map for reading Item content. - * - * @type {Array} - */ -export const contentRefs = [ - () => { error.unexpectedCase() }, // GC is not ItemContent - readContentDeleted, // 1 - readContentJSON, // 2 - readContentBinary, // 3 - readContentString, // 4 - readContentEmbed, // 5 - readContentFormat, // 6 - readContentType, // 7 - readContentAny, // 8 - readContentDoc, // 9 - () => { error.unexpectedCase() } // 10 - Skip is not ItemContent -] - -/** - * Do not implement this class! - */ -export class AbstractContent { - /** - * @return {number} - */ - getLength () { - throw error.methodUnimplemented() - } - - /** - * @return {Array} - */ - getContent () { - throw error.methodUnimplemented() - } - - /** - * Should return false if this Item is some kind of meta information - * (e.g. format information). - * - * * Whether this Item should be addressable via `yarray.get(i)` - * * Whether this Item should be counted when computing yarray.length - * - * @return {boolean} - */ - isCountable () { - throw error.methodUnimplemented() - } - - /** - * @return {AbstractContent} - */ - copy () { - throw error.methodUnimplemented() - } - - /** - * @param {number} _offset - * @return {AbstractContent} - */ - splice (_offset) { - throw error.methodUnimplemented() - } - - /** - * @param {AbstractContent} _right - * @return {boolean} - */ - mergeWith (_right) { - throw error.methodUnimplemented() - } - - /** - * @param {Transaction} _transaction - * @param {Item} _item - */ - integrate (_transaction, _item) { - throw error.methodUnimplemented() - } - - /** - * @param {Transaction} _transaction - */ - delete (_transaction) { - throw error.methodUnimplemented() - } - - /** - * @param {StructStore} _store - */ - gc (_store) { - throw error.methodUnimplemented() - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} _encoder - * @param {number} _offset - */ - write (_encoder, _offset) { - throw error.methodUnimplemented() - } - - /** - * @return {number} - */ - getRef () { - throw error.methodUnimplemented() - } -} diff --git a/yjs-poll/node_modules/yjs/src/structs/Skip.js b/yjs-poll/node_modules/yjs/src/structs/Skip.js deleted file mode 100644 index 3f7caaf..0000000 --- a/yjs-poll/node_modules/yjs/src/structs/Skip.js +++ /dev/null @@ -1,59 +0,0 @@ -import { - AbstractStruct, - UpdateEncoderV1, UpdateEncoderV2, StructStore, Transaction, ID // eslint-disable-line -} from '../internals.js' -import * as error from 'lib0/error' -import * as encoding from 'lib0/encoding' - -export const structSkipRefNumber = 10 - -/** - * @private - */ -export class Skip extends AbstractStruct { - get deleted () { - return true - } - - delete () {} - - /** - * @param {Skip} right - * @return {boolean} - */ - mergeWith (right) { - if (this.constructor !== right.constructor) { - return false - } - this.length += right.length - return true - } - - /** - * @param {Transaction} transaction - * @param {number} offset - */ - integrate (transaction, offset) { - // skip structs cannot be integrated - error.unexpectedCase() - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {number} offset - */ - write (encoder, offset) { - encoder.writeInfo(structSkipRefNumber) - // write as VarUint because Skips can't make use of predictable length-encoding - encoding.writeVarUint(encoder.restEncoder, this.length - offset) - } - - /** - * @param {Transaction} transaction - * @param {StructStore} store - * @return {null | number} - */ - getMissing (transaction, store) { - return null - } -} diff --git a/yjs-poll/node_modules/yjs/src/types/AbstractType.js b/yjs-poll/node_modules/yjs/src/types/AbstractType.js deleted file mode 100644 index a83f3a5..0000000 --- a/yjs-poll/node_modules/yjs/src/types/AbstractType.js +++ /dev/null @@ -1,985 +0,0 @@ -import { - removeEventHandlerListener, - callEventHandlerListeners, - addEventHandlerListener, - createEventHandler, - getState, - isVisible, - ContentType, - createID, - ContentAny, - ContentBinary, - getItemCleanStart, - ContentDoc, YText, YArray, UpdateEncoderV1, UpdateEncoderV2, Doc, Snapshot, Transaction, EventHandler, YEvent, Item, // eslint-disable-line -} from '../internals.js' - -import * as map from 'lib0/map' -import * as iterator from 'lib0/iterator' -import * as error from 'lib0/error' -import * as math from 'lib0/math' -import * as log from 'lib0/logging' - -/** - * https://docs.yjs.dev/getting-started/working-with-shared-types#caveats - */ -export const warnPrematureAccess = () => { log.warn('Invalid access: Add Yjs type to a document before reading data.') } - -const maxSearchMarker = 80 - -/** - * A unique timestamp that identifies each marker. - * - * Time is relative,.. this is more like an ever-increasing clock. - * - * @type {number} - */ -let globalSearchMarkerTimestamp = 0 - -export class ArraySearchMarker { - /** - * @param {Item} p - * @param {number} index - */ - constructor (p, index) { - p.marker = true - this.p = p - this.index = index - this.timestamp = globalSearchMarkerTimestamp++ - } -} - -/** - * @param {ArraySearchMarker} marker - */ -const refreshMarkerTimestamp = marker => { marker.timestamp = globalSearchMarkerTimestamp++ } - -/** - * This is rather complex so this function is the only thing that should overwrite a marker - * - * @param {ArraySearchMarker} marker - * @param {Item} p - * @param {number} index - */ -const overwriteMarker = (marker, p, index) => { - marker.p.marker = false - marker.p = p - p.marker = true - marker.index = index - marker.timestamp = globalSearchMarkerTimestamp++ -} - -/** - * @param {Array} searchMarker - * @param {Item} p - * @param {number} index - */ -const markPosition = (searchMarker, p, index) => { - if (searchMarker.length >= maxSearchMarker) { - // override oldest marker (we don't want to create more objects) - const marker = searchMarker.reduce((a, b) => a.timestamp < b.timestamp ? a : b) - overwriteMarker(marker, p, index) - return marker - } else { - // create new marker - const pm = new ArraySearchMarker(p, index) - searchMarker.push(pm) - return pm - } -} - -/** - * Search marker help us to find positions in the associative array faster. - * - * They speed up the process of finding a position without much bookkeeping. - * - * A maximum of `maxSearchMarker` objects are created. - * - * This function always returns a refreshed marker (updated timestamp) - * - * @param {AbstractType} yarray - * @param {number} index - */ -export const findMarker = (yarray, index) => { - if (yarray._start === null || index === 0 || yarray._searchMarker === null) { - return null - } - const marker = yarray._searchMarker.length === 0 ? null : yarray._searchMarker.reduce((a, b) => math.abs(index - a.index) < math.abs(index - b.index) ? a : b) - let p = yarray._start - let pindex = 0 - if (marker !== null) { - p = marker.p - pindex = marker.index - refreshMarkerTimestamp(marker) // we used it, we might need to use it again - } - // iterate to right if possible - while (p.right !== null && pindex < index) { - if (!p.deleted && p.countable) { - if (index < pindex + p.length) { - break - } - pindex += p.length - } - p = p.right - } - // iterate to left if necessary (might be that pindex > index) - while (p.left !== null && pindex > index) { - p = p.left - if (!p.deleted && p.countable) { - pindex -= p.length - } - } - // we want to make sure that p can't be merged with left, because that would screw up everything - // in that cas just return what we have (it is most likely the best marker anyway) - // iterate to left until p can't be merged with left - while (p.left !== null && p.left.id.client === p.id.client && p.left.id.clock + p.left.length === p.id.clock) { - p = p.left - if (!p.deleted && p.countable) { - pindex -= p.length - } - } - - // @todo remove! - // assure position - // { - // let start = yarray._start - // let pos = 0 - // while (start !== p) { - // if (!start.deleted && start.countable) { - // pos += start.length - // } - // start = /** @type {Item} */ (start.right) - // } - // if (pos !== pindex) { - // debugger - // throw new Error('Gotcha position fail!') - // } - // } - // if (marker) { - // if (window.lengths == null) { - // window.lengths = [] - // window.getLengths = () => window.lengths.sort((a, b) => a - b) - // } - // window.lengths.push(marker.index - pindex) - // console.log('distance', marker.index - pindex, 'len', p && p.parent.length) - // } - if (marker !== null && math.abs(marker.index - pindex) < /** @type {YText|YArray} */ (p.parent).length / maxSearchMarker) { - // adjust existing marker - overwriteMarker(marker, p, pindex) - return marker - } else { - // create new marker - return markPosition(yarray._searchMarker, p, pindex) - } -} - -/** - * Update markers when a change happened. - * - * This should be called before doing a deletion! - * - * @param {Array} searchMarker - * @param {number} index - * @param {number} len If insertion, len is positive. If deletion, len is negative. - */ -export const updateMarkerChanges = (searchMarker, index, len) => { - for (let i = searchMarker.length - 1; i >= 0; i--) { - const m = searchMarker[i] - if (len > 0) { - /** - * @type {Item|null} - */ - let p = m.p - p.marker = false - // Ideally we just want to do a simple position comparison, but this will only work if - // search markers don't point to deleted items for formats. - // Iterate marker to prev undeleted countable position so we know what to do when updating a position - while (p && (p.deleted || !p.countable)) { - p = p.left - if (p && !p.deleted && p.countable) { - // adjust position. the loop should break now - m.index -= p.length - } - } - if (p === null || p.marker === true) { - // remove search marker if updated position is null or if position is already marked - searchMarker.splice(i, 1) - continue - } - m.p = p - p.marker = true - } - if (index < m.index || (len > 0 && index === m.index)) { // a simple index <= m.index check would actually suffice - m.index = math.max(index, m.index + len) - } - } -} - -/** - * Accumulate all (list) children of a type and return them as an Array. - * - * @param {AbstractType} t - * @return {Array} - */ -export const getTypeChildren = t => { - t.doc ?? warnPrematureAccess() - let s = t._start - const arr = [] - while (s) { - arr.push(s) - s = s.right - } - return arr -} - -/** - * Call event listeners with an event. This will also add an event to all - * parents (for `.observeDeep` handlers). - * - * @template EventType - * @param {AbstractType} type - * @param {Transaction} transaction - * @param {EventType} event - */ -export const callTypeObservers = (type, transaction, event) => { - const changedType = type - const changedParentTypes = transaction.changedParentTypes - while (true) { - // @ts-ignore - map.setIfUndefined(changedParentTypes, type, () => []).push(event) - if (type._item === null) { - break - } - type = /** @type {AbstractType} */ (type._item.parent) - } - callEventHandlerListeners(changedType._eH, event, transaction) -} - -/** - * @template EventType - * Abstract Yjs Type class - */ -export class AbstractType { - constructor () { - /** - * @type {Item|null} - */ - this._item = null - /** - * @type {Map} - */ - this._map = new Map() - /** - * @type {Item|null} - */ - this._start = null - /** - * @type {Doc|null} - */ - this.doc = null - this._length = 0 - /** - * Event handlers - * @type {EventHandler} - */ - this._eH = createEventHandler() - /** - * Deep event handlers - * @type {EventHandler>,Transaction>} - */ - this._dEH = createEventHandler() - /** - * @type {null | Array} - */ - this._searchMarker = null - } - - /** - * @return {AbstractType|null} - */ - get parent () { - return this._item ? /** @type {AbstractType} */ (this._item.parent) : null - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item|null} item - */ - _integrate (y, item) { - this.doc = y - this._item = item - } - - /** - * @return {AbstractType} - */ - _copy () { - throw error.methodUnimplemented() - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {AbstractType} - */ - clone () { - throw error.methodUnimplemented() - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} _encoder - */ - _write (_encoder) { } - - /** - * The first non-deleted item - */ - get _first () { - let n = this._start - while (n !== null && n.deleted) { - n = n.right - } - return n - } - - /** - * Creates YEvent and calls all type observers. - * Must be implemented by each type. - * - * @param {Transaction} transaction - * @param {Set} _parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, _parentSubs) { - if (!transaction.local && this._searchMarker) { - this._searchMarker.length = 0 - } - } - - /** - * Observe all events that are created on this type. - * - * @param {function(EventType, Transaction):void} f Observer function - */ - observe (f) { - addEventHandlerListener(this._eH, f) - } - - /** - * Observe all events that are created by this type and its children. - * - * @param {function(Array>,Transaction):void} f Observer function - */ - observeDeep (f) { - addEventHandlerListener(this._dEH, f) - } - - /** - * Unregister an observer function. - * - * @param {function(EventType,Transaction):void} f Observer function - */ - unobserve (f) { - removeEventHandlerListener(this._eH, f) - } - - /** - * Unregister an observer function. - * - * @param {function(Array>,Transaction):void} f Observer function - */ - unobserveDeep (f) { - removeEventHandlerListener(this._dEH, f) - } - - /** - * @abstract - * @return {any} - */ - toJSON () {} -} - -/** - * @param {AbstractType} type - * @param {number} start - * @param {number} end - * @return {Array} - * - * @private - * @function - */ -export const typeListSlice = (type, start, end) => { - type.doc ?? warnPrematureAccess() - if (start < 0) { - start = type._length + start - } - if (end < 0) { - end = type._length + end - } - let len = end - start - const cs = [] - let n = type._start - while (n !== null && len > 0) { - if (n.countable && !n.deleted) { - const c = n.content.getContent() - if (c.length <= start) { - start -= c.length - } else { - for (let i = start; i < c.length && len > 0; i++) { - cs.push(c[i]) - len-- - } - start = 0 - } - } - n = n.right - } - return cs -} - -/** - * @param {AbstractType} type - * @return {Array} - * - * @private - * @function - */ -export const typeListToArray = type => { - type.doc ?? warnPrematureAccess() - const cs = [] - let n = type._start - while (n !== null) { - if (n.countable && !n.deleted) { - const c = n.content.getContent() - for (let i = 0; i < c.length; i++) { - cs.push(c[i]) - } - } - n = n.right - } - return cs -} - -/** - * @param {AbstractType} type - * @param {Snapshot} snapshot - * @return {Array} - * - * @private - * @function - */ -export const typeListToArraySnapshot = (type, snapshot) => { - const cs = [] - let n = type._start - while (n !== null) { - if (n.countable && isVisible(n, snapshot)) { - const c = n.content.getContent() - for (let i = 0; i < c.length; i++) { - cs.push(c[i]) - } - } - n = n.right - } - return cs -} - -/** - * Executes a provided function on once on every element of this YArray. - * - * @param {AbstractType} type - * @param {function(any,number,any):void} f A function to execute on every element of this YArray. - * - * @private - * @function - */ -export const typeListForEach = (type, f) => { - let index = 0 - let n = type._start - type.doc ?? warnPrematureAccess() - while (n !== null) { - if (n.countable && !n.deleted) { - const c = n.content.getContent() - for (let i = 0; i < c.length; i++) { - f(c[i], index++, type) - } - } - n = n.right - } -} - -/** - * @template C,R - * @param {AbstractType} type - * @param {function(C,number,AbstractType):R} f - * @return {Array} - * - * @private - * @function - */ -export const typeListMap = (type, f) => { - /** - * @type {Array} - */ - const result = [] - typeListForEach(type, (c, i) => { - result.push(f(c, i, type)) - }) - return result -} - -/** - * @param {AbstractType} type - * @return {IterableIterator} - * - * @private - * @function - */ -export const typeListCreateIterator = type => { - let n = type._start - /** - * @type {Array|null} - */ - let currentContent = null - let currentContentIndex = 0 - return { - [Symbol.iterator] () { - return this - }, - next: () => { - // find some content - if (currentContent === null) { - while (n !== null && n.deleted) { - n = n.right - } - // check if we reached the end, no need to check currentContent, because it does not exist - if (n === null) { - return { - done: true, - value: undefined - } - } - // we found n, so we can set currentContent - currentContent = n.content.getContent() - currentContentIndex = 0 - n = n.right // we used the content of n, now iterate to next - } - const value = currentContent[currentContentIndex++] - // check if we need to empty currentContent - if (currentContent.length <= currentContentIndex) { - currentContent = null - } - return { - done: false, - value - } - } - } -} - -/** - * Executes a provided function on once on every element of this YArray. - * Operates on a snapshotted state of the document. - * - * @param {AbstractType} type - * @param {function(any,number,AbstractType):void} f A function to execute on every element of this YArray. - * @param {Snapshot} snapshot - * - * @private - * @function - */ -export const typeListForEachSnapshot = (type, f, snapshot) => { - let index = 0 - let n = type._start - while (n !== null) { - if (n.countable && isVisible(n, snapshot)) { - const c = n.content.getContent() - for (let i = 0; i < c.length; i++) { - f(c[i], index++, type) - } - } - n = n.right - } -} - -/** - * @param {AbstractType} type - * @param {number} index - * @return {any} - * - * @private - * @function - */ -export const typeListGet = (type, index) => { - type.doc ?? warnPrematureAccess() - const marker = findMarker(type, index) - let n = type._start - if (marker !== null) { - n = marker.p - index -= marker.index - } - for (; n !== null; n = n.right) { - if (!n.deleted && n.countable) { - if (index < n.length) { - return n.content.getContent()[index] - } - index -= n.length - } - } -} - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {Item?} referenceItem - * @param {Array|Array|boolean|number|null|string|Uint8Array>} content - * - * @private - * @function - */ -export const typeListInsertGenericsAfter = (transaction, parent, referenceItem, content) => { - let left = referenceItem - const doc = transaction.doc - const ownClientId = doc.clientID - const store = doc.store - const right = referenceItem === null ? parent._start : referenceItem.right - /** - * @type {Array|number|null>} - */ - let jsonContent = [] - const packJsonContent = () => { - if (jsonContent.length > 0) { - left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentAny(jsonContent)) - left.integrate(transaction, 0) - jsonContent = [] - } - } - content.forEach(c => { - if (c === null) { - jsonContent.push(c) - } else { - switch (c.constructor) { - case Number: - case Object: - case Boolean: - case Array: - case String: - jsonContent.push(c) - break - default: - packJsonContent() - switch (c.constructor) { - case Uint8Array: - case ArrayBuffer: - left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentBinary(new Uint8Array(/** @type {Uint8Array} */ (c)))) - left.integrate(transaction, 0) - break - case Doc: - left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentDoc(/** @type {Doc} */ (c))) - left.integrate(transaction, 0) - break - default: - if (c instanceof AbstractType) { - left = new Item(createID(ownClientId, getState(store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentType(c)) - left.integrate(transaction, 0) - } else { - throw new Error('Unexpected content type in insert operation') - } - } - } - } - }) - packJsonContent() -} - -const lengthExceeded = () => error.create('Length exceeded!') - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {number} index - * @param {Array|Array|number|null|string|Uint8Array>} content - * - * @private - * @function - */ -export const typeListInsertGenerics = (transaction, parent, index, content) => { - if (index > parent._length) { - throw lengthExceeded() - } - if (index === 0) { - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, index, content.length) - } - return typeListInsertGenericsAfter(transaction, parent, null, content) - } - const startIndex = index - const marker = findMarker(parent, index) - let n = parent._start - if (marker !== null) { - n = marker.p - index -= marker.index - // we need to iterate one to the left so that the algorithm works - if (index === 0) { - // @todo refactor this as it actually doesn't consider formats - n = n.prev // important! get the left undeleted item so that we can actually decrease index - index += (n && n.countable && !n.deleted) ? n.length : 0 - } - } - for (; n !== null; n = n.right) { - if (!n.deleted && n.countable) { - if (index <= n.length) { - if (index < n.length) { - // insert in-between - getItemCleanStart(transaction, createID(n.id.client, n.id.clock + index)) - } - break - } - index -= n.length - } - } - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, startIndex, content.length) - } - return typeListInsertGenericsAfter(transaction, parent, n, content) -} - -/** - * Pushing content is special as we generally want to push after the last item. So we don't have to update - * the search marker. - * - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {Array|Array|number|null|string|Uint8Array>} content - * - * @private - * @function - */ -export const typeListPushGenerics = (transaction, parent, content) => { - // Use the marker with the highest index and iterate to the right. - const marker = (parent._searchMarker || []).reduce((maxMarker, currMarker) => currMarker.index > maxMarker.index ? currMarker : maxMarker, { index: 0, p: parent._start }) - let n = marker.p - if (n) { - while (n.right) { - n = n.right - } - } - return typeListInsertGenericsAfter(transaction, parent, n, content) -} - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {number} index - * @param {number} length - * - * @private - * @function - */ -export const typeListDelete = (transaction, parent, index, length) => { - if (length === 0) { return } - const startIndex = index - const startLength = length - const marker = findMarker(parent, index) - let n = parent._start - if (marker !== null) { - n = marker.p - index -= marker.index - } - // compute the first item to be deleted - for (; n !== null && index > 0; n = n.right) { - if (!n.deleted && n.countable) { - if (index < n.length) { - getItemCleanStart(transaction, createID(n.id.client, n.id.clock + index)) - } - index -= n.length - } - } - // delete all items until done - while (length > 0 && n !== null) { - if (!n.deleted) { - if (length < n.length) { - getItemCleanStart(transaction, createID(n.id.client, n.id.clock + length)) - } - n.delete(transaction) - length -= n.length - } - n = n.right - } - if (length > 0) { - throw lengthExceeded() - } - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, startIndex, -startLength + length /* in case we remove the above exception */) - } -} - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {string} key - * - * @private - * @function - */ -export const typeMapDelete = (transaction, parent, key) => { - const c = parent._map.get(key) - if (c !== undefined) { - c.delete(transaction) - } -} - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {string} key - * @param {Object|number|null|Array|string|Uint8Array|AbstractType} value - * - * @private - * @function - */ -export const typeMapSet = (transaction, parent, key, value) => { - const left = parent._map.get(key) || null - const doc = transaction.doc - const ownClientId = doc.clientID - let content - if (value == null) { - content = new ContentAny([value]) - } else { - switch (value.constructor) { - case Number: - case Object: - case Boolean: - case Array: - case String: - case Date: - case BigInt: - content = new ContentAny([value]) - break - case Uint8Array: - content = new ContentBinary(/** @type {Uint8Array} */ (value)) - break - case Doc: - content = new ContentDoc(/** @type {Doc} */ (value)) - break - default: - if (value instanceof AbstractType) { - content = new ContentType(value) - } else { - throw new Error('Unexpected content type') - } - } - } - new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, null, null, parent, key, content).integrate(transaction, 0) -} - -/** - * @param {AbstractType} parent - * @param {string} key - * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined} - * - * @private - * @function - */ -export const typeMapGet = (parent, key) => { - parent.doc ?? warnPrematureAccess() - const val = parent._map.get(key) - return val !== undefined && !val.deleted ? val.content.getContent()[val.length - 1] : undefined -} - -/** - * @param {AbstractType} parent - * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined>} - * - * @private - * @function - */ -export const typeMapGetAll = (parent) => { - /** - * @type {Object} - */ - const res = {} - parent.doc ?? warnPrematureAccess() - parent._map.forEach((value, key) => { - if (!value.deleted) { - res[key] = value.content.getContent()[value.length - 1] - } - }) - return res -} - -/** - * @param {AbstractType} parent - * @param {string} key - * @return {boolean} - * - * @private - * @function - */ -export const typeMapHas = (parent, key) => { - parent.doc ?? warnPrematureAccess() - const val = parent._map.get(key) - return val !== undefined && !val.deleted -} - -/** - * @param {AbstractType} parent - * @param {string} key - * @param {Snapshot} snapshot - * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined} - * - * @private - * @function - */ -export const typeMapGetSnapshot = (parent, key, snapshot) => { - let v = parent._map.get(key) || null - while (v !== null && (!snapshot.sv.has(v.id.client) || v.id.clock >= (snapshot.sv.get(v.id.client) || 0))) { - v = v.left - } - return v !== null && isVisible(v, snapshot) ? v.content.getContent()[v.length - 1] : undefined -} - -/** - * @param {AbstractType} parent - * @param {Snapshot} snapshot - * @return {Object|number|null|Array|string|Uint8Array|AbstractType|undefined>} - * - * @private - * @function - */ -export const typeMapGetAllSnapshot = (parent, snapshot) => { - /** - * @type {Object} - */ - const res = {} - parent._map.forEach((value, key) => { - /** - * @type {Item|null} - */ - let v = value - while (v !== null && (!snapshot.sv.has(v.id.client) || v.id.clock >= (snapshot.sv.get(v.id.client) || 0))) { - v = v.left - } - if (v !== null && isVisible(v, snapshot)) { - res[key] = v.content.getContent()[v.length - 1] - } - }) - return res -} - -/** - * @param {AbstractType & { _map: Map }} type - * @return {IterableIterator>} - * - * @private - * @function - */ -export const createMapIterator = type => { - type.doc ?? warnPrematureAccess() - return iterator.iteratorFilter(type._map.entries(), /** @param {any} entry */ entry => !entry[1].deleted) -} diff --git a/yjs-poll/node_modules/yjs/src/types/YArray.js b/yjs-poll/node_modules/yjs/src/types/YArray.js deleted file mode 100644 index 8fd5c21..0000000 --- a/yjs-poll/node_modules/yjs/src/types/YArray.js +++ /dev/null @@ -1,274 +0,0 @@ -/** - * @module YArray - */ - -import { - YEvent, - AbstractType, - typeListGet, - typeListToArray, - typeListForEach, - typeListCreateIterator, - typeListInsertGenerics, - typeListPushGenerics, - typeListDelete, - typeListMap, - YArrayRefID, - callTypeObservers, - transact, - warnPrematureAccess, - ArraySearchMarker, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Doc, Transaction, Item // eslint-disable-line -} from '../internals.js' -import { typeListSlice } from './AbstractType.js' - -/** - * Event that describes the changes on a YArray - * @template T - * @extends YEvent> - */ -export class YArrayEvent extends YEvent {} - -/** - * A shared Array implementation. - * @template T - * @extends AbstractType> - * @implements {Iterable} - */ -export class YArray extends AbstractType { - constructor () { - super() - /** - * @type {Array?} - * @private - */ - this._prelimContent = [] - /** - * @type {Array} - */ - this._searchMarker = [] - } - - /** - * Construct a new YArray containing the specified items. - * @template {Object|Array|number|null|string|Uint8Array} T - * @param {Array} items - * @return {YArray} - */ - static from (items) { - /** - * @type {YArray} - */ - const a = new YArray() - a.push(items) - return a - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item) - this.insert(0, /** @type {Array} */ (this._prelimContent)) - this._prelimContent = null - } - - /** - * @return {YArray} - */ - _copy () { - return new YArray() - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YArray} - */ - clone () { - /** - * @type {YArray} - */ - const arr = new YArray() - arr.insert(0, this.toArray().map(el => - el instanceof AbstractType ? /** @type {typeof el} */ (el.clone()) : el - )) - return arr - } - - get length () { - this.doc ?? warnPrematureAccess() - return this._length - } - - /** - * Creates YArrayEvent and calls observers. - * - * @param {Transaction} transaction - * @param {Set} parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, parentSubs) { - super._callObserver(transaction, parentSubs) - callTypeObservers(this, transaction, new YArrayEvent(this, transaction)) - } - - /** - * Inserts new content at an index. - * - * Important: This function expects an array of content. Not just a content - * object. The reason for this "weirdness" is that inserting several elements - * is very efficient when it is done as a single operation. - * - * @example - * // Insert character 'a' at position 0 - * yarray.insert(0, ['a']) - * // Insert numbers 1, 2 at position 1 - * yarray.insert(1, [1, 2]) - * - * @param {number} index The index to insert content at. - * @param {Array} content The array of content - */ - insert (index, content) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListInsertGenerics(transaction, this, index, /** @type {any} */ (content)) - }) - } else { - /** @type {Array} */ (this._prelimContent).splice(index, 0, ...content) - } - } - - /** - * Appends content to this YArray. - * - * @param {Array} content Array of content to append. - * - * @todo Use the following implementation in all types. - */ - push (content) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListPushGenerics(transaction, this, /** @type {any} */ (content)) - }) - } else { - /** @type {Array} */ (this._prelimContent).push(...content) - } - } - - /** - * Prepends content to this YArray. - * - * @param {Array} content Array of content to prepend. - */ - unshift (content) { - this.insert(0, content) - } - - /** - * Deletes elements starting from an index. - * - * @param {number} index Index at which to start deleting elements - * @param {number} length The number of elements to remove. Defaults to 1. - */ - delete (index, length = 1) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListDelete(transaction, this, index, length) - }) - } else { - /** @type {Array} */ (this._prelimContent).splice(index, length) - } - } - - /** - * Returns the i-th element from a YArray. - * - * @param {number} index The index of the element to return from the YArray - * @return {T} - */ - get (index) { - return typeListGet(this, index) - } - - /** - * Transforms this YArray to a JavaScript Array. - * - * @return {Array} - */ - toArray () { - return typeListToArray(this) - } - - /** - * Returns a portion of this YArray into a JavaScript Array selected - * from start to end (end not included). - * - * @param {number} [start] - * @param {number} [end] - * @return {Array} - */ - slice (start = 0, end = this.length) { - return typeListSlice(this, start, end) - } - - /** - * Transforms this Shared Type to a JSON object. - * - * @return {Array} - */ - toJSON () { - return this.map(c => c instanceof AbstractType ? c.toJSON() : c) - } - - /** - * Returns an Array with the result of calling a provided function on every - * element of this YArray. - * - * @template M - * @param {function(T,number,YArray):M} f Function that produces an element of the new Array - * @return {Array} A new array with each element being the result of the - * callback function - */ - map (f) { - return typeListMap(this, /** @type {any} */ (f)) - } - - /** - * Executes a provided function once on every element of this YArray. - * - * @param {function(T,number,YArray):void} f A function to execute on every element of this YArray. - */ - forEach (f) { - typeListForEach(this, f) - } - - /** - * @return {IterableIterator} - */ - [Symbol.iterator] () { - return typeListCreateIterator(this) - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - */ - _write (encoder) { - encoder.writeTypeRef(YArrayRefID) - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder - * - * @private - * @function - */ -export const readYArray = _decoder => new YArray() diff --git a/yjs-poll/node_modules/yjs/src/types/YMap.js b/yjs-poll/node_modules/yjs/src/types/YMap.js deleted file mode 100644 index 22b94af..0000000 --- a/yjs-poll/node_modules/yjs/src/types/YMap.js +++ /dev/null @@ -1,281 +0,0 @@ -/** - * @module YMap - */ - -import { - YEvent, - AbstractType, - typeMapDelete, - typeMapSet, - typeMapGet, - typeMapHas, - createMapIterator, - YMapRefID, - callTypeObservers, - transact, - warnPrematureAccess, - UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Doc, Transaction, Item // eslint-disable-line -} from '../internals.js' - -import * as iterator from 'lib0/iterator' - -/** - * @template T - * @extends YEvent> - * Event that describes the changes on a YMap. - */ -export class YMapEvent extends YEvent { - /** - * @param {YMap} ymap The YArray that changed. - * @param {Transaction} transaction - * @param {Set} subs The keys that changed. - */ - constructor (ymap, transaction, subs) { - super(ymap, transaction) - this.keysChanged = subs - } -} - -/** - * @template MapType - * A shared Map implementation. - * - * @extends AbstractType> - * @implements {Iterable<[string, MapType]>} - */ -export class YMap extends AbstractType { - /** - * - * @param {Iterable=} entries - an optional iterable to initialize the YMap - */ - constructor (entries) { - super() - /** - * @type {Map?} - * @private - */ - this._prelimContent = null - - if (entries === undefined) { - this._prelimContent = new Map() - } else { - this._prelimContent = new Map(entries) - } - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item) - ;/** @type {Map} */ (this._prelimContent).forEach((value, key) => { - this.set(key, value) - }) - this._prelimContent = null - } - - /** - * @return {YMap} - */ - _copy () { - return new YMap() - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YMap} - */ - clone () { - /** - * @type {YMap} - */ - const map = new YMap() - this.forEach((value, key) => { - map.set(key, value instanceof AbstractType ? /** @type {typeof value} */ (value.clone()) : value) - }) - return map - } - - /** - * Creates YMapEvent and calls observers. - * - * @param {Transaction} transaction - * @param {Set} parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, parentSubs) { - callTypeObservers(this, transaction, new YMapEvent(this, transaction, parentSubs)) - } - - /** - * Transforms this Shared Type to a JSON object. - * - * @return {Object} - */ - toJSON () { - this.doc ?? warnPrematureAccess() - /** - * @type {Object} - */ - const map = {} - this._map.forEach((item, key) => { - if (!item.deleted) { - const v = item.content.getContent()[item.length - 1] - map[key] = v instanceof AbstractType ? v.toJSON() : v - } - }) - return map - } - - /** - * Returns the size of the YMap (count of key/value pairs) - * - * @return {number} - */ - get size () { - return [...createMapIterator(this)].length - } - - /** - * Returns the keys for each element in the YMap Type. - * - * @return {IterableIterator} - */ - keys () { - return iterator.iteratorMap(createMapIterator(this), /** @param {any} v */ v => v[0]) - } - - /** - * Returns the values for each element in the YMap Type. - * - * @return {IterableIterator} - */ - values () { - return iterator.iteratorMap(createMapIterator(this), /** @param {any} v */ v => v[1].content.getContent()[v[1].length - 1]) - } - - /** - * Returns an Iterator of [key, value] pairs - * - * @return {IterableIterator<[string, MapType]>} - */ - entries () { - return iterator.iteratorMap(createMapIterator(this), /** @param {any} v */ v => /** @type {any} */ ([v[0], v[1].content.getContent()[v[1].length - 1]])) - } - - /** - * Executes a provided function on once on every key-value pair. - * - * @param {function(MapType,string,YMap):void} f A function to execute on every element of this YArray. - */ - forEach (f) { - this.doc ?? warnPrematureAccess() - this._map.forEach((item, key) => { - if (!item.deleted) { - f(item.content.getContent()[item.length - 1], key, this) - } - }) - } - - /** - * Returns an Iterator of [key, value] pairs - * - * @return {IterableIterator<[string, MapType]>} - */ - [Symbol.iterator] () { - return this.entries() - } - - /** - * Remove a specified element from this YMap. - * - * @param {string} key The key of the element to remove. - */ - delete (key) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapDelete(transaction, this, key) - }) - } else { - /** @type {Map} */ (this._prelimContent).delete(key) - } - } - - /** - * Adds or updates an element with a specified key and value. - * @template {MapType} VAL - * - * @param {string} key The key of the element to add to this YMap - * @param {VAL} value The value of the element to add - * @return {VAL} - */ - set (key, value) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapSet(transaction, this, key, /** @type {any} */ (value)) - }) - } else { - /** @type {Map} */ (this._prelimContent).set(key, value) - } - return value - } - - /** - * Returns a specified element from this YMap. - * - * @param {string} key - * @return {MapType|undefined} - */ - get (key) { - return /** @type {any} */ (typeMapGet(this, key)) - } - - /** - * Returns a boolean indicating whether the specified key exists or not. - * - * @param {string} key The key to test. - * @return {boolean} - */ - has (key) { - return typeMapHas(this, key) - } - - /** - * Removes all elements from this YMap. - */ - clear () { - if (this.doc !== null) { - transact(this.doc, transaction => { - this.forEach(function (_value, key, map) { - typeMapDelete(transaction, map, key) - }) - }) - } else { - /** @type {Map} */ (this._prelimContent).clear() - } - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - */ - _write (encoder) { - encoder.writeTypeRef(YMapRefID) - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder - * - * @private - * @function - */ -export const readYMap = _decoder => new YMap() diff --git a/yjs-poll/node_modules/yjs/src/types/YText.js b/yjs-poll/node_modules/yjs/src/types/YText.js deleted file mode 100644 index 75bf5dd..0000000 --- a/yjs-poll/node_modules/yjs/src/types/YText.js +++ /dev/null @@ -1,1298 +0,0 @@ -/** - * @module YText - */ - -import { - YEvent, - AbstractType, - getItemCleanStart, - getState, - isVisible, - createID, - YTextRefID, - callTypeObservers, - transact, - ContentEmbed, - GC, - ContentFormat, - ContentString, - splitSnapshotAffectedStructs, - iterateDeletedStructs, - iterateStructs, - findMarker, - typeMapDelete, - typeMapSet, - typeMapGet, - typeMapGetAll, - updateMarkerChanges, - ContentType, - warnPrematureAccess, - ArraySearchMarker, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, ID, Doc, Item, Snapshot, Transaction // eslint-disable-line -} from '../internals.js' - -import * as object from 'lib0/object' -import * as map from 'lib0/map' -import * as error from 'lib0/error' - -/** - * @param {any} a - * @param {any} b - * @return {boolean} - */ -const equalAttrs = (a, b) => a === b || (typeof a === 'object' && typeof b === 'object' && a && b && object.equalFlat(a, b)) - -export class ItemTextListPosition { - /** - * @param {Item|null} left - * @param {Item|null} right - * @param {number} index - * @param {Map} currentAttributes - */ - constructor (left, right, index, currentAttributes) { - this.left = left - this.right = right - this.index = index - this.currentAttributes = currentAttributes - } - - /** - * Only call this if you know that this.right is defined - */ - forward () { - if (this.right === null) { - error.unexpectedCase() - } - switch (this.right.content.constructor) { - case ContentFormat: - if (!this.right.deleted) { - updateCurrentAttributes(this.currentAttributes, /** @type {ContentFormat} */ (this.right.content)) - } - break - default: - if (!this.right.deleted) { - this.index += this.right.length - } - break - } - this.left = this.right - this.right = this.right.right - } -} - -/** - * @param {Transaction} transaction - * @param {ItemTextListPosition} pos - * @param {number} count steps to move forward - * @return {ItemTextListPosition} - * - * @private - * @function - */ -const findNextPosition = (transaction, pos, count) => { - while (pos.right !== null && count > 0) { - switch (pos.right.content.constructor) { - case ContentFormat: - if (!pos.right.deleted) { - updateCurrentAttributes(pos.currentAttributes, /** @type {ContentFormat} */ (pos.right.content)) - } - break - default: - if (!pos.right.deleted) { - if (count < pos.right.length) { - // split right - getItemCleanStart(transaction, createID(pos.right.id.client, pos.right.id.clock + count)) - } - pos.index += pos.right.length - count -= pos.right.length - } - break - } - pos.left = pos.right - pos.right = pos.right.right - // pos.forward() - we don't forward because that would halve the performance because we already do the checks above - } - return pos -} - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {number} index - * @param {boolean} useSearchMarker - * @return {ItemTextListPosition} - * - * @private - * @function - */ -const findPosition = (transaction, parent, index, useSearchMarker) => { - const currentAttributes = new Map() - const marker = useSearchMarker ? findMarker(parent, index) : null - if (marker) { - const pos = new ItemTextListPosition(marker.p.left, marker.p, marker.index, currentAttributes) - return findNextPosition(transaction, pos, index - marker.index) - } else { - const pos = new ItemTextListPosition(null, parent._start, 0, currentAttributes) - return findNextPosition(transaction, pos, index) - } -} - -/** - * Negate applied formats - * - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {ItemTextListPosition} currPos - * @param {Map} negatedAttributes - * - * @private - * @function - */ -const insertNegatedAttributes = (transaction, parent, currPos, negatedAttributes) => { - // check if we really need to remove attributes - while ( - currPos.right !== null && ( - currPos.right.deleted === true || ( - currPos.right.content.constructor === ContentFormat && - equalAttrs(negatedAttributes.get(/** @type {ContentFormat} */ (currPos.right.content).key), /** @type {ContentFormat} */ (currPos.right.content).value) - ) - ) - ) { - if (!currPos.right.deleted) { - negatedAttributes.delete(/** @type {ContentFormat} */ (currPos.right.content).key) - } - currPos.forward() - } - const doc = transaction.doc - const ownClientId = doc.clientID - negatedAttributes.forEach((val, key) => { - const left = currPos.left - const right = currPos.right - const nextFormat = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentFormat(key, val)) - nextFormat.integrate(transaction, 0) - currPos.right = nextFormat - currPos.forward() - }) -} - -/** - * @param {Map} currentAttributes - * @param {ContentFormat} format - * - * @private - * @function - */ -const updateCurrentAttributes = (currentAttributes, format) => { - const { key, value } = format - if (value === null) { - currentAttributes.delete(key) - } else { - currentAttributes.set(key, value) - } -} - -/** - * @param {ItemTextListPosition} currPos - * @param {Object} attributes - * - * @private - * @function - */ -const minimizeAttributeChanges = (currPos, attributes) => { - // go right while attributes[right.key] === right.value (or right is deleted) - while (true) { - if (currPos.right === null) { - break - } else if (currPos.right.deleted || (currPos.right.content.constructor === ContentFormat && equalAttrs(attributes[(/** @type {ContentFormat} */ (currPos.right.content)).key] ?? null, /** @type {ContentFormat} */ (currPos.right.content).value))) { - // - } else { - break - } - currPos.forward() - } -} - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {ItemTextListPosition} currPos - * @param {Object} attributes - * @return {Map} - * - * @private - * @function - **/ -const insertAttributes = (transaction, parent, currPos, attributes) => { - const doc = transaction.doc - const ownClientId = doc.clientID - const negatedAttributes = new Map() - // insert format-start items - for (const key in attributes) { - const val = attributes[key] - const currentVal = currPos.currentAttributes.get(key) ?? null - if (!equalAttrs(currentVal, val)) { - // save negated attribute (set null if currentVal undefined) - negatedAttributes.set(key, currentVal) - const { left, right } = currPos - currPos.right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentFormat(key, val)) - currPos.right.integrate(transaction, 0) - currPos.forward() - } - } - return negatedAttributes -} - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {ItemTextListPosition} currPos - * @param {string|object|AbstractType} text - * @param {Object} attributes - * - * @private - * @function - **/ -const insertText = (transaction, parent, currPos, text, attributes) => { - currPos.currentAttributes.forEach((_val, key) => { - if (attributes[key] === undefined) { - attributes[key] = null - } - }) - const doc = transaction.doc - const ownClientId = doc.clientID - minimizeAttributeChanges(currPos, attributes) - const negatedAttributes = insertAttributes(transaction, parent, currPos, attributes) - // insert content - const content = text.constructor === String ? new ContentString(/** @type {string} */ (text)) : (text instanceof AbstractType ? new ContentType(text) : new ContentEmbed(text)) - let { left, right, index } = currPos - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, currPos.index, content.getLength()) - } - right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, content) - right.integrate(transaction, 0) - currPos.right = right - currPos.index = index - currPos.forward() - insertNegatedAttributes(transaction, parent, currPos, negatedAttributes) -} - -/** - * @param {Transaction} transaction - * @param {AbstractType} parent - * @param {ItemTextListPosition} currPos - * @param {number} length - * @param {Object} attributes - * - * @private - * @function - */ -const formatText = (transaction, parent, currPos, length, attributes) => { - const doc = transaction.doc - const ownClientId = doc.clientID - minimizeAttributeChanges(currPos, attributes) - const negatedAttributes = insertAttributes(transaction, parent, currPos, attributes) - // iterate until first non-format or null is found - // delete all formats with attributes[format.key] != null - // also check the attributes after the first non-format as we do not want to insert redundant negated attributes there - // eslint-disable-next-line no-labels - iterationLoop: while ( - currPos.right !== null && - (length > 0 || - ( - negatedAttributes.size > 0 && - (currPos.right.deleted || currPos.right.content.constructor === ContentFormat) - ) - ) - ) { - if (!currPos.right.deleted) { - switch (currPos.right.content.constructor) { - case ContentFormat: { - const { key, value } = /** @type {ContentFormat} */ (currPos.right.content) - const attr = attributes[key] - if (attr !== undefined) { - if (equalAttrs(attr, value)) { - negatedAttributes.delete(key) - } else { - if (length === 0) { - // no need to further extend negatedAttributes - // eslint-disable-next-line no-labels - break iterationLoop - } - negatedAttributes.set(key, value) - } - currPos.right.delete(transaction) - } else { - currPos.currentAttributes.set(key, value) - } - break - } - default: - if (length < currPos.right.length) { - getItemCleanStart(transaction, createID(currPos.right.id.client, currPos.right.id.clock + length)) - } - length -= currPos.right.length - break - } - } - currPos.forward() - } - // Quill just assumes that the editor starts with a newline and that it always - // ends with a newline. We only insert that newline when a new newline is - // inserted - i.e when length is bigger than type.length - if (length > 0) { - let newlines = '' - for (; length > 0; length--) { - newlines += '\n' - } - currPos.right = new Item(createID(ownClientId, getState(doc.store, ownClientId)), currPos.left, currPos.left && currPos.left.lastId, currPos.right, currPos.right && currPos.right.id, parent, null, new ContentString(newlines)) - currPos.right.integrate(transaction, 0) - currPos.forward() - } - insertNegatedAttributes(transaction, parent, currPos, negatedAttributes) -} - -/** - * Call this function after string content has been deleted in order to - * clean up formatting Items. - * - * @param {Transaction} transaction - * @param {Item} start - * @param {Item|null} curr exclusive end, automatically iterates to the next Content Item - * @param {Map} startAttributes - * @param {Map} currAttributes - * @return {number} The amount of formatting Items deleted. - * - * @function - */ -const cleanupFormattingGap = (transaction, start, curr, startAttributes, currAttributes) => { - /** - * @type {Item|null} - */ - let end = start - /** - * @type {Map} - */ - const endFormats = map.create() - while (end && (!end.countable || end.deleted)) { - if (!end.deleted && end.content.constructor === ContentFormat) { - const cf = /** @type {ContentFormat} */ (end.content) - endFormats.set(cf.key, cf) - } - end = end.right - } - let cleanups = 0 - let reachedCurr = false - while (start !== end) { - if (curr === start) { - reachedCurr = true - } - if (!start.deleted) { - const content = start.content - switch (content.constructor) { - case ContentFormat: { - const { key, value } = /** @type {ContentFormat} */ (content) - const startAttrValue = startAttributes.get(key) ?? null - if (endFormats.get(key) !== content || startAttrValue === value) { - // Either this format is overwritten or it is not necessary because the attribute already existed. - start.delete(transaction) - cleanups++ - if (!reachedCurr && (currAttributes.get(key) ?? null) === value && startAttrValue !== value) { - if (startAttrValue === null) { - currAttributes.delete(key) - } else { - currAttributes.set(key, startAttrValue) - } - } - } - if (!reachedCurr && !start.deleted) { - updateCurrentAttributes(currAttributes, /** @type {ContentFormat} */ (content)) - } - break - } - } - } - start = /** @type {Item} */ (start.right) - } - return cleanups -} - -/** - * @param {Transaction} transaction - * @param {Item | null} item - */ -const cleanupContextlessFormattingGap = (transaction, item) => { - // iterate until item.right is null or content - while (item && item.right && (item.right.deleted || !item.right.countable)) { - item = item.right - } - const attrs = new Set() - // iterate back until a content item is found - while (item && (item.deleted || !item.countable)) { - if (!item.deleted && item.content.constructor === ContentFormat) { - const key = /** @type {ContentFormat} */ (item.content).key - if (attrs.has(key)) { - item.delete(transaction) - } else { - attrs.add(key) - } - } - item = item.left - } -} - -/** - * This function is experimental and subject to change / be removed. - * - * Ideally, we don't need this function at all. Formatting attributes should be cleaned up - * automatically after each change. This function iterates twice over the complete YText type - * and removes unnecessary formatting attributes. This is also helpful for testing. - * - * This function won't be exported anymore as soon as there is confidence that the YText type works as intended. - * - * @param {YText} type - * @return {number} How many formatting attributes have been cleaned up. - */ -export const cleanupYTextFormatting = type => { - let res = 0 - transact(/** @type {Doc} */ (type.doc), transaction => { - let start = /** @type {Item} */ (type._start) - let end = type._start - let startAttributes = map.create() - const currentAttributes = map.copy(startAttributes) - while (end) { - if (end.deleted === false) { - switch (end.content.constructor) { - case ContentFormat: - updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (end.content)) - break - default: - res += cleanupFormattingGap(transaction, start, end, startAttributes, currentAttributes) - startAttributes = map.copy(currentAttributes) - start = end - break - } - } - end = end.right - } - }) - return res -} - -/** - * This will be called by the transaction once the event handlers are called to potentially cleanup - * formatting attributes. - * - * @param {Transaction} transaction - */ -export const cleanupYTextAfterTransaction = transaction => { - /** - * @type {Set} - */ - const needFullCleanup = new Set() - // check if another formatting item was inserted - const doc = transaction.doc - for (const [client, afterClock] of transaction.afterState.entries()) { - const clock = transaction.beforeState.get(client) || 0 - if (afterClock === clock) { - continue - } - iterateStructs(transaction, /** @type {Array} */ (doc.store.clients.get(client)), clock, afterClock, item => { - if ( - !item.deleted && /** @type {Item} */ (item).content.constructor === ContentFormat && item.constructor !== GC - ) { - needFullCleanup.add(/** @type {any} */ (item).parent) - } - }) - } - // cleanup in a new transaction - transact(doc, (t) => { - iterateDeletedStructs(transaction, transaction.deleteSet, item => { - if (item instanceof GC || !(/** @type {YText} */ (item.parent)._hasFormatting) || needFullCleanup.has(/** @type {YText} */ (item.parent))) { - return - } - const parent = /** @type {YText} */ (item.parent) - if (item.content.constructor === ContentFormat) { - needFullCleanup.add(parent) - } else { - // If no formatting attribute was inserted or deleted, we can make due with contextless - // formatting cleanups. - // Contextless: it is not necessary to compute currentAttributes for the affected position. - cleanupContextlessFormattingGap(t, item) - } - }) - // If a formatting item was inserted, we simply clean the whole type. - // We need to compute currentAttributes for the current position anyway. - for (const yText of needFullCleanup) { - cleanupYTextFormatting(yText) - } - }) -} - -/** - * @param {Transaction} transaction - * @param {ItemTextListPosition} currPos - * @param {number} length - * @return {ItemTextListPosition} - * - * @private - * @function - */ -const deleteText = (transaction, currPos, length) => { - const startLength = length - const startAttrs = map.copy(currPos.currentAttributes) - const start = currPos.right - while (length > 0 && currPos.right !== null) { - if (currPos.right.deleted === false) { - switch (currPos.right.content.constructor) { - case ContentType: - case ContentEmbed: - case ContentString: - if (length < currPos.right.length) { - getItemCleanStart(transaction, createID(currPos.right.id.client, currPos.right.id.clock + length)) - } - length -= currPos.right.length - currPos.right.delete(transaction) - break - } - } - currPos.forward() - } - if (start) { - cleanupFormattingGap(transaction, start, currPos.right, startAttrs, currPos.currentAttributes) - } - const parent = /** @type {AbstractType} */ (/** @type {Item} */ (currPos.left || currPos.right).parent) - if (parent._searchMarker) { - updateMarkerChanges(parent._searchMarker, currPos.index, -startLength + length) - } - return currPos -} - -/** - * The Quill Delta format represents changes on a text document with - * formatting information. For more information visit {@link https://quilljs.com/docs/delta/|Quill Delta} - * - * @example - * { - * ops: [ - * { insert: 'Gandalf', attributes: { bold: true } }, - * { insert: ' the ' }, - * { insert: 'Grey', attributes: { color: '#cccccc' } } - * ] - * } - * - */ - -/** - * Attributes that can be assigned to a selection of text. - * - * @example - * { - * bold: true, - * font-size: '40px' - * } - * - * @typedef {Object} TextAttributes - */ - -/** - * @extends YEvent - * Event that describes the changes on a YText type. - */ -export class YTextEvent extends YEvent { - /** - * @param {YText} ytext - * @param {Transaction} transaction - * @param {Set} subs The keys that changed - */ - constructor (ytext, transaction, subs) { - super(ytext, transaction) - /** - * Whether the children changed. - * @type {Boolean} - * @private - */ - this.childListChanged = false - /** - * Set of all changed attributes. - * @type {Set} - */ - this.keysChanged = new Set() - subs.forEach((sub) => { - if (sub === null) { - this.childListChanged = true - } else { - this.keysChanged.add(sub) - } - }) - } - - /** - * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string, delete?:number, retain?:number}>}} - */ - get changes () { - if (this._changes === null) { - /** - * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string|AbstractType|object, delete?:number, retain?:number}>}} - */ - const changes = { - keys: this.keys, - delta: this.delta, - added: new Set(), - deleted: new Set() - } - this._changes = changes - } - return /** @type {any} */ (this._changes) - } - - /** - * Compute the changes in the delta format. - * A {@link https://quilljs.com/docs/delta/|Quill Delta}) that represents the changes on the document. - * - * @type {Array<{insert?:string|object|AbstractType, delete?:number, retain?:number, attributes?: Object}>} - * - * @public - */ - get delta () { - if (this._delta === null) { - const y = /** @type {Doc} */ (this.target.doc) - /** - * @type {Array<{insert?:string|object|AbstractType, delete?:number, retain?:number, attributes?: Object}>} - */ - const delta = [] - transact(y, transaction => { - const currentAttributes = new Map() // saves all current attributes for insert - const oldAttributes = new Map() - let item = this.target._start - /** - * @type {string?} - */ - let action = null - /** - * @type {Object} - */ - const attributes = {} // counts added or removed new attributes for retain - /** - * @type {string|object} - */ - let insert = '' - let retain = 0 - let deleteLen = 0 - const addOp = () => { - if (action !== null) { - /** - * @type {any} - */ - let op = null - switch (action) { - case 'delete': - if (deleteLen > 0) { - op = { delete: deleteLen } - } - deleteLen = 0 - break - case 'insert': - if (typeof insert === 'object' || insert.length > 0) { - op = { insert } - if (currentAttributes.size > 0) { - op.attributes = {} - currentAttributes.forEach((value, key) => { - if (value !== null) { - op.attributes[key] = value - } - }) - } - } - insert = '' - break - case 'retain': - if (retain > 0) { - op = { retain } - if (!object.isEmpty(attributes)) { - op.attributes = object.assign({}, attributes) - } - } - retain = 0 - break - } - if (op) delta.push(op) - action = null - } - } - while (item !== null) { - switch (item.content.constructor) { - case ContentType: - case ContentEmbed: - if (this.adds(item)) { - if (!this.deletes(item)) { - addOp() - action = 'insert' - insert = item.content.getContent()[0] - addOp() - } - } else if (this.deletes(item)) { - if (action !== 'delete') { - addOp() - action = 'delete' - } - deleteLen += 1 - } else if (!item.deleted) { - if (action !== 'retain') { - addOp() - action = 'retain' - } - retain += 1 - } - break - case ContentString: - if (this.adds(item)) { - if (!this.deletes(item)) { - if (action !== 'insert') { - addOp() - action = 'insert' - } - insert += /** @type {ContentString} */ (item.content).str - } - } else if (this.deletes(item)) { - if (action !== 'delete') { - addOp() - action = 'delete' - } - deleteLen += item.length - } else if (!item.deleted) { - if (action !== 'retain') { - addOp() - action = 'retain' - } - retain += item.length - } - break - case ContentFormat: { - const { key, value } = /** @type {ContentFormat} */ (item.content) - if (this.adds(item)) { - if (!this.deletes(item)) { - const curVal = currentAttributes.get(key) ?? null - if (!equalAttrs(curVal, value)) { - if (action === 'retain') { - addOp() - } - if (equalAttrs(value, (oldAttributes.get(key) ?? null))) { - delete attributes[key] - } else { - attributes[key] = value - } - } else if (value !== null) { - item.delete(transaction) - } - } - } else if (this.deletes(item)) { - oldAttributes.set(key, value) - const curVal = currentAttributes.get(key) ?? null - if (!equalAttrs(curVal, value)) { - if (action === 'retain') { - addOp() - } - attributes[key] = curVal - } - } else if (!item.deleted) { - oldAttributes.set(key, value) - const attr = attributes[key] - if (attr !== undefined) { - if (!equalAttrs(attr, value)) { - if (action === 'retain') { - addOp() - } - if (value === null) { - delete attributes[key] - } else { - attributes[key] = value - } - } else if (attr !== null) { // this will be cleaned up automatically by the contextless cleanup function - item.delete(transaction) - } - } - } - if (!item.deleted) { - if (action === 'insert') { - addOp() - } - updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (item.content)) - } - break - } - } - item = item.right - } - addOp() - while (delta.length > 0) { - const lastOp = delta[delta.length - 1] - if (lastOp.retain !== undefined && lastOp.attributes === undefined) { - // retain delta's if they don't assign attributes - delta.pop() - } else { - break - } - } - }) - this._delta = delta - } - return /** @type {any} */ (this._delta) - } -} - -/** - * Type that represents text with formatting information. - * - * This type replaces y-richtext as this implementation is able to handle - * block formats (format information on a paragraph), embeds (complex elements - * like pictures and videos), and text formats (**bold**, *italic*). - * - * @extends AbstractType - */ -export class YText extends AbstractType { - /** - * @param {String} [string] The initial value of the YText. - */ - constructor (string) { - super() - /** - * Array of pending operations on this type - * @type {Array?} - */ - this._pending = string !== undefined ? [() => this.insert(0, string)] : [] - /** - * @type {Array|null} - */ - this._searchMarker = [] - /** - * Whether this YText contains formatting attributes. - * This flag is updated when a formatting item is integrated (see ContentFormat.integrate) - */ - this._hasFormatting = false - } - - /** - * Number of characters of this text type. - * - * @type {number} - */ - get length () { - this.doc ?? warnPrematureAccess() - return this._length - } - - /** - * @param {Doc} y - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item) - try { - /** @type {Array} */ (this._pending).forEach(f => f()) - } catch (e) { - console.error(e) - } - this._pending = null - } - - _copy () { - return new YText() - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YText} - */ - clone () { - const text = new YText() - text.applyDelta(this.toDelta()) - return text - } - - /** - * Creates YTextEvent and calls observers. - * - * @param {Transaction} transaction - * @param {Set} parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, parentSubs) { - super._callObserver(transaction, parentSubs) - const event = new YTextEvent(this, transaction, parentSubs) - callTypeObservers(this, transaction, event) - // If a remote change happened, we try to cleanup potential formatting duplicates. - if (!transaction.local && this._hasFormatting) { - transaction._needFormattingCleanup = true - } - } - - /** - * Returns the unformatted string representation of this YText type. - * - * @public - */ - toString () { - this.doc ?? warnPrematureAccess() - let str = '' - /** - * @type {Item|null} - */ - let n = this._start - while (n !== null) { - if (!n.deleted && n.countable && n.content.constructor === ContentString) { - str += /** @type {ContentString} */ (n.content).str - } - n = n.right - } - return str - } - - /** - * Returns the unformatted string representation of this YText type. - * - * @return {string} - * @public - */ - toJSON () { - return this.toString() - } - - /** - * Apply a {@link Delta} on this shared YText type. - * - * @param {Array} delta The changes to apply on this element. - * @param {object} opts - * @param {boolean} [opts.sanitize] Sanitize input delta. Removes ending newlines if set to true. - * - * - * @public - */ - applyDelta (delta, { sanitize = true } = {}) { - if (this.doc !== null) { - transact(this.doc, transaction => { - const currPos = new ItemTextListPosition(null, this._start, 0, new Map()) - for (let i = 0; i < delta.length; i++) { - const op = delta[i] - if (op.insert !== undefined) { - // Quill assumes that the content starts with an empty paragraph. - // Yjs/Y.Text assumes that it starts empty. We always hide that - // there is a newline at the end of the content. - // If we omit this step, clients will see a different number of - // paragraphs, but nothing bad will happen. - const ins = (!sanitize && typeof op.insert === 'string' && i === delta.length - 1 && currPos.right === null && op.insert.slice(-1) === '\n') ? op.insert.slice(0, -1) : op.insert - if (typeof ins !== 'string' || ins.length > 0) { - insertText(transaction, this, currPos, ins, op.attributes || {}) - } - } else if (op.retain !== undefined) { - formatText(transaction, this, currPos, op.retain, op.attributes || {}) - } else if (op.delete !== undefined) { - deleteText(transaction, currPos, op.delete) - } - } - }) - } else { - /** @type {Array} */ (this._pending).push(() => this.applyDelta(delta)) - } - } - - /** - * Returns the Delta representation of this YText type. - * - * @param {Snapshot} [snapshot] - * @param {Snapshot} [prevSnapshot] - * @param {function('removed' | 'added', ID):any} [computeYChange] - * @return {any} The Delta representation of this type. - * - * @public - */ - toDelta (snapshot, prevSnapshot, computeYChange) { - this.doc ?? warnPrematureAccess() - /** - * @type{Array} - */ - const ops = [] - const currentAttributes = new Map() - const doc = /** @type {Doc} */ (this.doc) - let str = '' - let n = this._start - function packStr () { - if (str.length > 0) { - // pack str with attributes to ops - /** - * @type {Object} - */ - const attributes = {} - let addAttributes = false - currentAttributes.forEach((value, key) => { - addAttributes = true - attributes[key] = value - }) - /** - * @type {Object} - */ - const op = { insert: str } - if (addAttributes) { - op.attributes = attributes - } - ops.push(op) - str = '' - } - } - const computeDelta = () => { - while (n !== null) { - if (isVisible(n, snapshot) || (prevSnapshot !== undefined && isVisible(n, prevSnapshot))) { - switch (n.content.constructor) { - case ContentString: { - const cur = currentAttributes.get('ychange') - if (snapshot !== undefined && !isVisible(n, snapshot)) { - if (cur === undefined || cur.user !== n.id.client || cur.type !== 'removed') { - packStr() - currentAttributes.set('ychange', computeYChange ? computeYChange('removed', n.id) : { type: 'removed' }) - } - } else if (prevSnapshot !== undefined && !isVisible(n, prevSnapshot)) { - if (cur === undefined || cur.user !== n.id.client || cur.type !== 'added') { - packStr() - currentAttributes.set('ychange', computeYChange ? computeYChange('added', n.id) : { type: 'added' }) - } - } else if (cur !== undefined) { - packStr() - currentAttributes.delete('ychange') - } - str += /** @type {ContentString} */ (n.content).str - break - } - case ContentType: - case ContentEmbed: { - packStr() - /** - * @type {Object} - */ - const op = { - insert: n.content.getContent()[0] - } - if (currentAttributes.size > 0) { - const attrs = /** @type {Object} */ ({}) - op.attributes = attrs - currentAttributes.forEach((value, key) => { - attrs[key] = value - }) - } - ops.push(op) - break - } - case ContentFormat: - if (isVisible(n, snapshot)) { - packStr() - updateCurrentAttributes(currentAttributes, /** @type {ContentFormat} */ (n.content)) - } - break - } - } - n = n.right - } - packStr() - } - if (snapshot || prevSnapshot) { - // snapshots are merged again after the transaction, so we need to keep the - // transaction alive until we are done - transact(doc, transaction => { - if (snapshot) { - splitSnapshotAffectedStructs(transaction, snapshot) - } - if (prevSnapshot) { - splitSnapshotAffectedStructs(transaction, prevSnapshot) - } - computeDelta() - }, 'cleanup') - } else { - computeDelta() - } - return ops - } - - /** - * Insert text at a given index. - * - * @param {number} index The index at which to start inserting. - * @param {String} text The text to insert at the specified position. - * @param {TextAttributes} [attributes] Optionally define some formatting - * information to apply on the inserted - * Text. - * @public - */ - insert (index, text, attributes) { - if (text.length <= 0) { - return - } - const y = this.doc - if (y !== null) { - transact(y, transaction => { - const pos = findPosition(transaction, this, index, !attributes) - if (!attributes) { - attributes = {} - // @ts-ignore - pos.currentAttributes.forEach((v, k) => { attributes[k] = v }) - } - insertText(transaction, this, pos, text, attributes) - }) - } else { - /** @type {Array} */ (this._pending).push(() => this.insert(index, text, attributes)) - } - } - - /** - * Inserts an embed at a index. - * - * @param {number} index The index to insert the embed at. - * @param {Object | AbstractType} embed The Object that represents the embed. - * @param {TextAttributes} [attributes] Attribute information to apply on the - * embed - * - * @public - */ - insertEmbed (index, embed, attributes) { - const y = this.doc - if (y !== null) { - transact(y, transaction => { - const pos = findPosition(transaction, this, index, !attributes) - insertText(transaction, this, pos, embed, attributes || {}) - }) - } else { - /** @type {Array} */ (this._pending).push(() => this.insertEmbed(index, embed, attributes || {})) - } - } - - /** - * Deletes text starting from an index. - * - * @param {number} index Index at which to start deleting. - * @param {number} length The number of characters to remove. Defaults to 1. - * - * @public - */ - delete (index, length) { - if (length === 0) { - return - } - const y = this.doc - if (y !== null) { - transact(y, transaction => { - deleteText(transaction, findPosition(transaction, this, index, true), length) - }) - } else { - /** @type {Array} */ (this._pending).push(() => this.delete(index, length)) - } - } - - /** - * Assigns properties to a range of text. - * - * @param {number} index The position where to start formatting. - * @param {number} length The amount of characters to assign properties to. - * @param {TextAttributes} attributes Attribute information to apply on the - * text. - * - * @public - */ - format (index, length, attributes) { - if (length === 0) { - return - } - const y = this.doc - if (y !== null) { - transact(y, transaction => { - const pos = findPosition(transaction, this, index, false) - if (pos.right === null) { - return - } - formatText(transaction, this, pos, length, attributes) - }) - } else { - /** @type {Array} */ (this._pending).push(() => this.format(index, length, attributes)) - } - } - - /** - * Removes an attribute. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @param {String} attributeName The attribute name that is to be removed. - * - * @public - */ - removeAttribute (attributeName) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapDelete(transaction, this, attributeName) - }) - } else { - /** @type {Array} */ (this._pending).push(() => this.removeAttribute(attributeName)) - } - } - - /** - * Sets or updates an attribute. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @param {String} attributeName The attribute name that is to be set. - * @param {any} attributeValue The attribute value that is to be set. - * - * @public - */ - setAttribute (attributeName, attributeValue) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapSet(transaction, this, attributeName, attributeValue) - }) - } else { - /** @type {Array} */ (this._pending).push(() => this.setAttribute(attributeName, attributeValue)) - } - } - - /** - * Returns an attribute value that belongs to the attribute name. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @param {String} attributeName The attribute name that identifies the - * queried value. - * @return {any} The queried attribute value. - * - * @public - */ - getAttribute (attributeName) { - return /** @type {any} */ (typeMapGet(this, attributeName)) - } - - /** - * Returns all attribute name/value pairs in a JSON Object. - * - * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks. - * - * @return {Object} A JSON Object that describes the attributes. - * - * @public - */ - getAttributes () { - return typeMapGetAll(this) - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - */ - _write (encoder) { - encoder.writeTypeRef(YTextRefID) - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder - * @return {YText} - * - * @private - * @function - */ -export const readYText = _decoder => new YText() diff --git a/yjs-poll/node_modules/yjs/src/types/YXmlElement.js b/yjs-poll/node_modules/yjs/src/types/YXmlElement.js deleted file mode 100644 index b54df49..0000000 --- a/yjs-poll/node_modules/yjs/src/types/YXmlElement.js +++ /dev/null @@ -1,260 +0,0 @@ -import * as object from 'lib0/object' - -import { - YXmlFragment, - transact, - typeMapDelete, - typeMapHas, - typeMapSet, - typeMapGet, - typeMapGetAll, - typeMapGetAllSnapshot, - typeListForEach, - YXmlElementRefID, - Snapshot, YXmlText, ContentType, AbstractType, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Doc, Item // eslint-disable-line -} from '../internals.js' - -/** - * @typedef {Object|number|null|Array|string|Uint8Array|AbstractType} ValueTypes - */ - -/** - * An YXmlElement imitates the behavior of a - * https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element - * - * * An YXmlElement has attributes (key value pairs) - * * An YXmlElement has childElements that must inherit from YXmlElement - * - * @template {{ [key: string]: ValueTypes }} [KV={ [key: string]: string }] - */ -export class YXmlElement extends YXmlFragment { - constructor (nodeName = 'UNDEFINED') { - super() - this.nodeName = nodeName - /** - * @type {Map|null} - */ - this._prelimAttrs = new Map() - } - - /** - * @type {YXmlElement|YXmlText|null} - */ - get nextSibling () { - const n = this._item ? this._item.next : null - return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null - } - - /** - * @type {YXmlElement|YXmlText|null} - */ - get prevSibling () { - const n = this._item ? this._item.prev : null - return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item) - ;(/** @type {Map} */ (this._prelimAttrs)).forEach((value, key) => { - this.setAttribute(key, value) - }) - this._prelimAttrs = null - } - - /** - * Creates an Item with the same effect as this Item (without position effect) - * - * @return {YXmlElement} - */ - _copy () { - return new YXmlElement(this.nodeName) - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YXmlElement} - */ - clone () { - /** - * @type {YXmlElement} - */ - const el = new YXmlElement(this.nodeName) - const attrs = this.getAttributes() - object.forEach(attrs, (value, key) => { - el.setAttribute(key, /** @type {any} */ (value)) - }) - // @ts-ignore - el.insert(0, this.toArray().map(v => v instanceof AbstractType ? v.clone() : v)) - return el - } - - /** - * Returns the XML serialization of this YXmlElement. - * The attributes are ordered by attribute-name, so you can easily use this - * method to compare YXmlElements - * - * @return {string} The string representation of this type. - * - * @public - */ - toString () { - const attrs = this.getAttributes() - const stringBuilder = [] - const keys = [] - for (const key in attrs) { - keys.push(key) - } - keys.sort() - const keysLen = keys.length - for (let i = 0; i < keysLen; i++) { - const key = keys[i] - stringBuilder.push(key + '="' + attrs[key] + '"') - } - const nodeName = this.nodeName.toLocaleLowerCase() - const attrsString = stringBuilder.length > 0 ? ' ' + stringBuilder.join(' ') : '' - return `<${nodeName}${attrsString}>${super.toString()}` - } - - /** - * Removes an attribute from this YXmlElement. - * - * @param {string} attributeName The attribute name that is to be removed. - * - * @public - */ - removeAttribute (attributeName) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapDelete(transaction, this, attributeName) - }) - } else { - /** @type {Map} */ (this._prelimAttrs).delete(attributeName) - } - } - - /** - * Sets or updates an attribute. - * - * @template {keyof KV & string} KEY - * - * @param {KEY} attributeName The attribute name that is to be set. - * @param {KV[KEY]} attributeValue The attribute value that is to be set. - * - * @public - */ - setAttribute (attributeName, attributeValue) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeMapSet(transaction, this, attributeName, attributeValue) - }) - } else { - /** @type {Map} */ (this._prelimAttrs).set(attributeName, attributeValue) - } - } - - /** - * Returns an attribute value that belongs to the attribute name. - * - * @template {keyof KV & string} KEY - * - * @param {KEY} attributeName The attribute name that identifies the - * queried value. - * @return {KV[KEY]|undefined} The queried attribute value. - * - * @public - */ - getAttribute (attributeName) { - return /** @type {any} */ (typeMapGet(this, attributeName)) - } - - /** - * Returns whether an attribute exists - * - * @param {string} attributeName The attribute name to check for existence. - * @return {boolean} whether the attribute exists. - * - * @public - */ - hasAttribute (attributeName) { - return /** @type {any} */ (typeMapHas(this, attributeName)) - } - - /** - * Returns all attribute name/value pairs in a JSON Object. - * - * @param {Snapshot} [snapshot] - * @return {{ [Key in Extract]?: KV[Key]}} A JSON Object that describes the attributes. - * - * @public - */ - getAttributes (snapshot) { - return /** @type {any} */ (snapshot ? typeMapGetAllSnapshot(this, snapshot) : typeMapGetAll(this)) - } - - /** - * Creates a Dom Element that mirrors this YXmlElement. - * - * @param {Document} [_document=document] The document object (you must define - * this when calling this method in - * nodejs) - * @param {Object} [hooks={}] Optional property to customize how hooks - * are presented in the DOM - * @param {any} [binding] You should not set this property. This is - * used if DomBinding wants to create a - * association to the created DOM type. - * @return {Node} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element} - * - * @public - */ - toDOM (_document = document, hooks = {}, binding) { - const dom = _document.createElement(this.nodeName) - const attrs = this.getAttributes() - for (const key in attrs) { - const value = attrs[key] - if (typeof value === 'string') { - dom.setAttribute(key, value) - } - } - typeListForEach(this, yxml => { - dom.appendChild(yxml.toDOM(_document, hooks, binding)) - }) - if (binding !== undefined) { - binding._createAssociation(dom, this) - } - return dom - } - - /** - * Transform the properties of this type to binary and write it to an - * BinaryEncoder. - * - * This is called when this Item is sent to a remote peer. - * - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - */ - _write (encoder) { - encoder.writeTypeRef(YXmlElementRefID) - encoder.writeKey(this.nodeName) - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {YXmlElement} - * - * @function - */ -export const readYXmlElement = decoder => new YXmlElement(decoder.readKey()) diff --git a/yjs-poll/node_modules/yjs/src/types/YXmlEvent.js b/yjs-poll/node_modules/yjs/src/types/YXmlEvent.js deleted file mode 100644 index f18a06e..0000000 --- a/yjs-poll/node_modules/yjs/src/types/YXmlEvent.js +++ /dev/null @@ -1,39 +0,0 @@ -import { - YEvent, - YXmlText, YXmlElement, YXmlFragment, Transaction // eslint-disable-line -} from '../internals.js' - -/** - * @extends YEvent - * An Event that describes changes on a YXml Element or Yxml Fragment - */ -export class YXmlEvent extends YEvent { - /** - * @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created. - * @param {Set} subs The set of changed attributes. `null` is included if the - * child list changed. - * @param {Transaction} transaction The transaction instance with which the - * change was created. - */ - constructor (target, subs, transaction) { - super(target, transaction) - /** - * Whether the children changed. - * @type {Boolean} - * @private - */ - this.childListChanged = false - /** - * Set of all changed attributes. - * @type {Set} - */ - this.attributesChanged = new Set() - subs.forEach((sub) => { - if (sub === null) { - this.childListChanged = true - } else { - this.attributesChanged.add(sub) - } - }) - } -} diff --git a/yjs-poll/node_modules/yjs/src/types/YXmlFragment.js b/yjs-poll/node_modules/yjs/src/types/YXmlFragment.js deleted file mode 100644 index 544a18c..0000000 --- a/yjs-poll/node_modules/yjs/src/types/YXmlFragment.js +++ /dev/null @@ -1,449 +0,0 @@ -/** - * @module YXml - */ - -import { - YXmlEvent, - YXmlElement, - AbstractType, - typeListMap, - typeListForEach, - typeListInsertGenerics, - typeListInsertGenericsAfter, - typeListDelete, - typeListToArray, - YXmlFragmentRefID, - callTypeObservers, - transact, - typeListGet, - typeListSlice, - warnPrematureAccess, - UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Doc, ContentType, Transaction, Item, YXmlText, YXmlHook // eslint-disable-line -} from '../internals.js' - -import * as error from 'lib0/error' -import * as array from 'lib0/array' - -/** - * Define the elements to which a set of CSS queries apply. - * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors|CSS_Selectors} - * - * @example - * query = '.classSelector' - * query = 'nodeSelector' - * query = '#idSelector' - * - * @typedef {string} CSS_Selector - */ - -/** - * Dom filter function. - * - * @callback domFilter - * @param {string} nodeName The nodeName of the element - * @param {Map} attributes The map of attributes. - * @return {boolean} Whether to include the Dom node in the YXmlElement. - */ - -/** - * Represents a subset of the nodes of a YXmlElement / YXmlFragment and a - * position within them. - * - * Can be created with {@link YXmlFragment#createTreeWalker} - * - * @public - * @implements {Iterable} - */ -export class YXmlTreeWalker { - /** - * @param {YXmlFragment | YXmlElement} root - * @param {function(AbstractType):boolean} [f] - */ - constructor (root, f = () => true) { - this._filter = f - this._root = root - /** - * @type {Item} - */ - this._currentNode = /** @type {Item} */ (root._start) - this._firstCall = true - root.doc ?? warnPrematureAccess() - } - - [Symbol.iterator] () { - return this - } - - /** - * Get the next node. - * - * @return {IteratorResult} The next node. - * - * @public - */ - next () { - /** - * @type {Item|null} - */ - let n = this._currentNode - let type = n && n.content && /** @type {any} */ (n.content).type - if (n !== null && (!this._firstCall || n.deleted || !this._filter(type))) { // if first call, we check if we can use the first item - do { - type = /** @type {any} */ (n.content).type - if (!n.deleted && (type.constructor === YXmlElement || type.constructor === YXmlFragment) && type._start !== null) { - // walk down in the tree - n = type._start - } else { - // walk right or up in the tree - while (n !== null) { - /** - * @type {Item | null} - */ - const nxt = n.next - if (nxt !== null) { - n = nxt - break - } else if (n.parent === this._root) { - n = null - } else { - n = /** @type {AbstractType} */ (n.parent)._item - } - } - } - } while (n !== null && (n.deleted || !this._filter(/** @type {ContentType} */ (n.content).type))) - } - this._firstCall = false - if (n === null) { - // @ts-ignore - return { value: undefined, done: true } - } - this._currentNode = n - return { value: /** @type {any} */ (n.content).type, done: false } - } -} - -/** - * Represents a list of {@link YXmlElement}.and {@link YXmlText} types. - * A YxmlFragment is similar to a {@link YXmlElement}, but it does not have a - * nodeName and it does not have attributes. Though it can be bound to a DOM - * element - in this case the attributes and the nodeName are not shared. - * - * @public - * @extends AbstractType - */ -export class YXmlFragment extends AbstractType { - constructor () { - super() - /** - * @type {Array|null} - */ - this._prelimContent = [] - } - - /** - * @type {YXmlElement|YXmlText|null} - */ - get firstChild () { - const first = this._first - return first ? first.content.getContent()[0] : null - } - - /** - * Integrate this type into the Yjs instance. - * - * * Save this struct in the os - * * This type is sent to other client - * * Observer functions are fired - * - * @param {Doc} y The Yjs instance - * @param {Item} item - */ - _integrate (y, item) { - super._integrate(y, item) - this.insert(0, /** @type {Array} */ (this._prelimContent)) - this._prelimContent = null - } - - _copy () { - return new YXmlFragment() - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YXmlFragment} - */ - clone () { - const el = new YXmlFragment() - // @ts-ignore - el.insert(0, this.toArray().map(item => item instanceof AbstractType ? item.clone() : item)) - return el - } - - get length () { - this.doc ?? warnPrematureAccess() - return this._prelimContent === null ? this._length : this._prelimContent.length - } - - /** - * Create a subtree of childNodes. - * - * @example - * const walker = elem.createTreeWalker(dom => dom.nodeName === 'div') - * for (let node in walker) { - * // `node` is a div node - * nop(node) - * } - * - * @param {function(AbstractType):boolean} filter Function that is called on each child element and - * returns a Boolean indicating whether the child - * is to be included in the subtree. - * @return {YXmlTreeWalker} A subtree and a position within it. - * - * @public - */ - createTreeWalker (filter) { - return new YXmlTreeWalker(this, filter) - } - - /** - * Returns the first YXmlElement that matches the query. - * Similar to DOM's {@link querySelector}. - * - * Query support: - * - tagname - * TODO: - * - id - * - attribute - * - * @param {CSS_Selector} query The query on the children. - * @return {YXmlElement|YXmlText|YXmlHook|null} The first element that matches the query or null. - * - * @public - */ - querySelector (query) { - query = query.toUpperCase() - // @ts-ignore - const iterator = new YXmlTreeWalker(this, element => element.nodeName && element.nodeName.toUpperCase() === query) - const next = iterator.next() - if (next.done) { - return null - } else { - return next.value - } - } - - /** - * Returns all YXmlElements that match the query. - * Similar to Dom's {@link querySelectorAll}. - * - * @todo Does not yet support all queries. Currently only query by tagName. - * - * @param {CSS_Selector} query The query on the children - * @return {Array} The elements that match this query. - * - * @public - */ - querySelectorAll (query) { - query = query.toUpperCase() - // @ts-ignore - return array.from(new YXmlTreeWalker(this, element => element.nodeName && element.nodeName.toUpperCase() === query)) - } - - /** - * Creates YXmlEvent and calls observers. - * - * @param {Transaction} transaction - * @param {Set} parentSubs Keys changed on this type. `null` if list was modified. - */ - _callObserver (transaction, parentSubs) { - callTypeObservers(this, transaction, new YXmlEvent(this, parentSubs, transaction)) - } - - /** - * Get the string representation of all the children of this YXmlFragment. - * - * @return {string} The string representation of all children. - */ - toString () { - return typeListMap(this, xml => xml.toString()).join('') - } - - /** - * @return {string} - */ - toJSON () { - return this.toString() - } - - /** - * Creates a Dom Element that mirrors this YXmlElement. - * - * @param {Document} [_document=document] The document object (you must define - * this when calling this method in - * nodejs) - * @param {Object} [hooks={}] Optional property to customize how hooks - * are presented in the DOM - * @param {any} [binding] You should not set this property. This is - * used if DomBinding wants to create a - * association to the created DOM type. - * @return {Node} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element} - * - * @public - */ - toDOM (_document = document, hooks = {}, binding) { - const fragment = _document.createDocumentFragment() - if (binding !== undefined) { - binding._createAssociation(fragment, this) - } - typeListForEach(this, xmlType => { - fragment.insertBefore(xmlType.toDOM(_document, hooks, binding), null) - }) - return fragment - } - - /** - * Inserts new content at an index. - * - * @example - * // Insert character 'a' at position 0 - * xml.insert(0, [new Y.XmlText('text')]) - * - * @param {number} index The index to insert content at - * @param {Array} content The array of content - */ - insert (index, content) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListInsertGenerics(transaction, this, index, content) - }) - } else { - // @ts-ignore _prelimContent is defined because this is not yet integrated - this._prelimContent.splice(index, 0, ...content) - } - } - - /** - * Inserts new content at an index. - * - * @example - * // Insert character 'a' at position 0 - * xml.insert(0, [new Y.XmlText('text')]) - * - * @param {null|Item|YXmlElement|YXmlText} ref The index to insert content at - * @param {Array} content The array of content - */ - insertAfter (ref, content) { - if (this.doc !== null) { - transact(this.doc, transaction => { - const refItem = (ref && ref instanceof AbstractType) ? ref._item : ref - typeListInsertGenericsAfter(transaction, this, refItem, content) - }) - } else { - const pc = /** @type {Array} */ (this._prelimContent) - const index = ref === null ? 0 : pc.findIndex(el => el === ref) + 1 - if (index === 0 && ref !== null) { - throw error.create('Reference item not found') - } - pc.splice(index, 0, ...content) - } - } - - /** - * Deletes elements starting from an index. - * - * @param {number} index Index at which to start deleting elements - * @param {number} [length=1] The number of elements to remove. Defaults to 1. - */ - delete (index, length = 1) { - if (this.doc !== null) { - transact(this.doc, transaction => { - typeListDelete(transaction, this, index, length) - }) - } else { - // @ts-ignore _prelimContent is defined because this is not yet integrated - this._prelimContent.splice(index, length) - } - } - - /** - * Transforms this YArray to a JavaScript Array. - * - * @return {Array} - */ - toArray () { - return typeListToArray(this) - } - - /** - * Appends content to this YArray. - * - * @param {Array} content Array of content to append. - */ - push (content) { - this.insert(this.length, content) - } - - /** - * Prepends content to this YArray. - * - * @param {Array} content Array of content to prepend. - */ - unshift (content) { - this.insert(0, content) - } - - /** - * Returns the i-th element from a YArray. - * - * @param {number} index The index of the element to return from the YArray - * @return {YXmlElement|YXmlText} - */ - get (index) { - return typeListGet(this, index) - } - - /** - * Returns a portion of this YXmlFragment into a JavaScript Array selected - * from start to end (end not included). - * - * @param {number} [start] - * @param {number} [end] - * @return {Array} - */ - slice (start = 0, end = this.length) { - return typeListSlice(this, start, end) - } - - /** - * Executes a provided function on once on every child element. - * - * @param {function(YXmlElement|YXmlText,number, typeof self):void} f A function to execute on every element of this YArray. - */ - forEach (f) { - typeListForEach(this, f) - } - - /** - * Transform the properties of this type to binary and write it to an - * BinaryEncoder. - * - * This is called when this Item is sent to a remote peer. - * - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - */ - _write (encoder) { - encoder.writeTypeRef(YXmlFragmentRefID) - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder - * @return {YXmlFragment} - * - * @private - * @function - */ -export const readYXmlFragment = _decoder => new YXmlFragment() diff --git a/yjs-poll/node_modules/yjs/src/types/YXmlHook.js b/yjs-poll/node_modules/yjs/src/types/YXmlHook.js deleted file mode 100644 index 1bf2484..0000000 --- a/yjs-poll/node_modules/yjs/src/types/YXmlHook.js +++ /dev/null @@ -1,98 +0,0 @@ -import { - YMap, - YXmlHookRefID, - UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2 // eslint-disable-line -} from '../internals.js' - -/** - * You can manage binding to a custom type with YXmlHook. - * - * @extends {YMap} - */ -export class YXmlHook extends YMap { - /** - * @param {string} hookName nodeName of the Dom Node. - */ - constructor (hookName) { - super() - /** - * @type {string} - */ - this.hookName = hookName - } - - /** - * Creates an Item with the same effect as this Item (without position effect) - */ - _copy () { - return new YXmlHook(this.hookName) - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YXmlHook} - */ - clone () { - const el = new YXmlHook(this.hookName) - this.forEach((value, key) => { - el.set(key, value) - }) - return el - } - - /** - * Creates a Dom Element that mirrors this YXmlElement. - * - * @param {Document} [_document=document] The document object (you must define - * this when calling this method in - * nodejs) - * @param {Object.} [hooks] Optional property to customize how hooks - * are presented in the DOM - * @param {any} [binding] You should not set this property. This is - * used if DomBinding wants to create a - * association to the created DOM type - * @return {Element} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element} - * - * @public - */ - toDOM (_document = document, hooks = {}, binding) { - const hook = hooks[this.hookName] - let dom - if (hook !== undefined) { - dom = hook.createDom(this) - } else { - dom = document.createElement(this.hookName) - } - dom.setAttribute('data-yjs-hook', this.hookName) - if (binding !== undefined) { - binding._createAssociation(dom, this) - } - return dom - } - - /** - * Transform the properties of this type to binary and write it to an - * BinaryEncoder. - * - * This is called when this Item is sent to a remote peer. - * - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to. - */ - _write (encoder) { - encoder.writeTypeRef(YXmlHookRefID) - encoder.writeKey(this.hookName) - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {YXmlHook} - * - * @private - * @function - */ -export const readYXmlHook = decoder => - new YXmlHook(decoder.readKey()) diff --git a/yjs-poll/node_modules/yjs/src/types/YXmlText.js b/yjs-poll/node_modules/yjs/src/types/YXmlText.js deleted file mode 100644 index ab02dbf..0000000 --- a/yjs-poll/node_modules/yjs/src/types/YXmlText.js +++ /dev/null @@ -1,124 +0,0 @@ -import { - YText, - YXmlTextRefID, - ContentType, YXmlElement, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, // eslint-disable-line -} from '../internals.js' - -/** - * Represents text in a Dom Element. In the future this type will also handle - * simple formatting information like bold and italic. - */ -export class YXmlText extends YText { - /** - * @type {YXmlElement|YXmlText|null} - */ - get nextSibling () { - const n = this._item ? this._item.next : null - return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null - } - - /** - * @type {YXmlElement|YXmlText|null} - */ - get prevSibling () { - const n = this._item ? this._item.prev : null - return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null - } - - _copy () { - return new YXmlText() - } - - /** - * Makes a copy of this data type that can be included somewhere else. - * - * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. - * - * @return {YXmlText} - */ - clone () { - const text = new YXmlText() - text.applyDelta(this.toDelta()) - return text - } - - /** - * Creates a Dom Element that mirrors this YXmlText. - * - * @param {Document} [_document=document] The document object (you must define - * this when calling this method in - * nodejs) - * @param {Object} [hooks] Optional property to customize how hooks - * are presented in the DOM - * @param {any} [binding] You should not set this property. This is - * used if DomBinding wants to create a - * association to the created DOM type. - * @return {Text} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element} - * - * @public - */ - toDOM (_document = document, hooks, binding) { - const dom = _document.createTextNode(this.toString()) - if (binding !== undefined) { - binding._createAssociation(dom, this) - } - return dom - } - - toString () { - // @ts-ignore - return this.toDelta().map(delta => { - const nestedNodes = [] - for (const nodeName in delta.attributes) { - const attrs = [] - for (const key in delta.attributes[nodeName]) { - attrs.push({ key, value: delta.attributes[nodeName][key] }) - } - // sort attributes to get a unique order - attrs.sort((a, b) => a.key < b.key ? -1 : 1) - nestedNodes.push({ nodeName, attrs }) - } - // sort node order to get a unique order - nestedNodes.sort((a, b) => a.nodeName < b.nodeName ? -1 : 1) - // now convert to dom string - let str = '' - for (let i = 0; i < nestedNodes.length; i++) { - const node = nestedNodes[i] - str += `<${node.nodeName}` - for (let j = 0; j < node.attrs.length; j++) { - const attr = node.attrs[j] - str += ` ${attr.key}="${attr.value}"` - } - str += '>' - } - str += delta.insert - for (let i = nestedNodes.length - 1; i >= 0; i--) { - str += `` - } - return str - }).join('') - } - - /** - * @return {string} - */ - toJSON () { - return this.toString() - } - - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - */ - _write (encoder) { - encoder.writeTypeRef(YXmlTextRefID) - } -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @return {YXmlText} - * - * @private - * @function - */ -export const readYXmlText = decoder => new YXmlText() diff --git a/yjs-poll/node_modules/yjs/src/utils/AbstractConnector.js b/yjs-poll/node_modules/yjs/src/utils/AbstractConnector.js deleted file mode 100644 index f5c0566..0000000 --- a/yjs-poll/node_modules/yjs/src/utils/AbstractConnector.js +++ /dev/null @@ -1,25 +0,0 @@ -import { ObservableV2 } from 'lib0/observable' - -import { - Doc // eslint-disable-line -} from '../internals.js' - -/** - * This is an abstract interface that all Connectors should implement to keep them interchangeable. - * - * @note This interface is experimental and it is not advised to actually inherit this class. - * It just serves as typing information. - * - * @extends {ObservableV2} - */ -export class AbstractConnector extends ObservableV2 { - /** - * @param {Doc} ydoc - * @param {any} awareness - */ - constructor (ydoc, awareness) { - super() - this.doc = ydoc - this.awareness = awareness - } -} diff --git a/yjs-poll/node_modules/yjs/src/utils/DeleteSet.js b/yjs-poll/node_modules/yjs/src/utils/DeleteSet.js deleted file mode 100644 index 94e32dd..0000000 --- a/yjs-poll/node_modules/yjs/src/utils/DeleteSet.js +++ /dev/null @@ -1,352 +0,0 @@ -import { - findIndexSS, - getState, - splitItem, - iterateStructs, - UpdateEncoderV2, - DSDecoderV1, DSEncoderV1, DSDecoderV2, DSEncoderV2, Item, GC, StructStore, Transaction, ID // eslint-disable-line -} from '../internals.js' - -import * as array from 'lib0/array' -import * as math from 'lib0/math' -import * as map from 'lib0/map' -import * as encoding from 'lib0/encoding' -import * as decoding from 'lib0/decoding' - -export class DeleteItem { - /** - * @param {number} clock - * @param {number} len - */ - constructor (clock, len) { - /** - * @type {number} - */ - this.clock = clock - /** - * @type {number} - */ - this.len = len - } -} - -/** - * We no longer maintain a DeleteStore. DeleteSet is a temporary object that is created when needed. - * - When created in a transaction, it must only be accessed after sorting, and merging - * - This DeleteSet is send to other clients - * - We do not create a DeleteSet when we send a sync message. The DeleteSet message is created directly from StructStore - * - We read a DeleteSet as part of a sync/update message. In this case the DeleteSet is already sorted and merged. - */ -export class DeleteSet { - constructor () { - /** - * @type {Map>} - */ - this.clients = new Map() - } -} - -/** - * Iterate over all structs that the DeleteSet gc's. - * - * @param {Transaction} transaction - * @param {DeleteSet} ds - * @param {function(GC|Item):void} f - * - * @function - */ -export const iterateDeletedStructs = (transaction, ds, f) => - ds.clients.forEach((deletes, clientid) => { - const structs = /** @type {Array} */ (transaction.doc.store.clients.get(clientid)) - if (structs != null) { - const lastStruct = structs[structs.length - 1] - const clockState = lastStruct.id.clock + lastStruct.length - for (let i = 0, del = deletes[i]; i < deletes.length && del.clock < clockState; del = deletes[++i]) { - iterateStructs(transaction, structs, del.clock, del.len, f) - } - } - }) - -/** - * @param {Array} dis - * @param {number} clock - * @return {number|null} - * - * @private - * @function - */ -export const findIndexDS = (dis, clock) => { - let left = 0 - let right = dis.length - 1 - while (left <= right) { - const midindex = math.floor((left + right) / 2) - const mid = dis[midindex] - const midclock = mid.clock - if (midclock <= clock) { - if (clock < midclock + mid.len) { - return midindex - } - left = midindex + 1 - } else { - right = midindex - 1 - } - } - return null -} - -/** - * @param {DeleteSet} ds - * @param {ID} id - * @return {boolean} - * - * @private - * @function - */ -export const isDeleted = (ds, id) => { - const dis = ds.clients.get(id.client) - return dis !== undefined && findIndexDS(dis, id.clock) !== null -} - -/** - * @param {DeleteSet} ds - * - * @private - * @function - */ -export const sortAndMergeDeleteSet = ds => { - ds.clients.forEach(dels => { - dels.sort((a, b) => a.clock - b.clock) - // merge items without filtering or splicing the array - // i is the current pointer - // j refers to the current insert position for the pointed item - // try to merge dels[i] into dels[j-1] or set dels[j]=dels[i] - let i, j - for (i = 1, j = 1; i < dels.length; i++) { - const left = dels[j - 1] - const right = dels[i] - if (left.clock + left.len >= right.clock) { - left.len = math.max(left.len, right.clock + right.len - left.clock) - } else { - if (j < i) { - dels[j] = right - } - j++ - } - } - dels.length = j - }) -} - -/** - * @param {Array} dss - * @return {DeleteSet} A fresh DeleteSet - */ -export const mergeDeleteSets = dss => { - const merged = new DeleteSet() - for (let dssI = 0; dssI < dss.length; dssI++) { - dss[dssI].clients.forEach((delsLeft, client) => { - if (!merged.clients.has(client)) { - // Write all missing keys from current ds and all following. - // If merged already contains `client` current ds has already been added. - /** - * @type {Array} - */ - const dels = delsLeft.slice() - for (let i = dssI + 1; i < dss.length; i++) { - array.appendTo(dels, dss[i].clients.get(client) || []) - } - merged.clients.set(client, dels) - } - }) - } - sortAndMergeDeleteSet(merged) - return merged -} - -/** - * @param {DeleteSet} ds - * @param {number} client - * @param {number} clock - * @param {number} length - * - * @private - * @function - */ -export const addToDeleteSet = (ds, client, clock, length) => { - map.setIfUndefined(ds.clients, client, () => /** @type {Array} */ ([])).push(new DeleteItem(clock, length)) -} - -export const createDeleteSet = () => new DeleteSet() - -/** - * @param {StructStore} ss - * @return {DeleteSet} Merged and sorted DeleteSet - * - * @private - * @function - */ -export const createDeleteSetFromStructStore = ss => { - const ds = createDeleteSet() - ss.clients.forEach((structs, client) => { - /** - * @type {Array} - */ - const dsitems = [] - for (let i = 0; i < structs.length; i++) { - const struct = structs[i] - if (struct.deleted) { - const clock = struct.id.clock - let len = struct.length - if (i + 1 < structs.length) { - for (let next = structs[i + 1]; i + 1 < structs.length && next.deleted; next = structs[++i + 1]) { - len += next.length - } - } - dsitems.push(new DeleteItem(clock, len)) - } - } - if (dsitems.length > 0) { - ds.clients.set(client, dsitems) - } - }) - return ds -} - -/** - * @param {DSEncoderV1 | DSEncoderV2} encoder - * @param {DeleteSet} ds - * - * @private - * @function - */ -export const writeDeleteSet = (encoder, ds) => { - encoding.writeVarUint(encoder.restEncoder, ds.clients.size) - - // Ensure that the delete set is written in a deterministic order - array.from(ds.clients.entries()) - .sort((a, b) => b[0] - a[0]) - .forEach(([client, dsitems]) => { - encoder.resetDsCurVal() - encoding.writeVarUint(encoder.restEncoder, client) - const len = dsitems.length - encoding.writeVarUint(encoder.restEncoder, len) - for (let i = 0; i < len; i++) { - const item = dsitems[i] - encoder.writeDsClock(item.clock) - encoder.writeDsLen(item.len) - } - }) -} - -/** - * @param {DSDecoderV1 | DSDecoderV2} decoder - * @return {DeleteSet} - * - * @private - * @function - */ -export const readDeleteSet = decoder => { - const ds = new DeleteSet() - const numClients = decoding.readVarUint(decoder.restDecoder) - for (let i = 0; i < numClients; i++) { - decoder.resetDsCurVal() - const client = decoding.readVarUint(decoder.restDecoder) - const numberOfDeletes = decoding.readVarUint(decoder.restDecoder) - if (numberOfDeletes > 0) { - const dsField = map.setIfUndefined(ds.clients, client, () => /** @type {Array} */ ([])) - for (let i = 0; i < numberOfDeletes; i++) { - dsField.push(new DeleteItem(decoder.readDsClock(), decoder.readDsLen())) - } - } - } - return ds -} - -/** - * @todo YDecoder also contains references to String and other Decoders. Would make sense to exchange YDecoder.toUint8Array for YDecoder.DsToUint8Array().. - */ - -/** - * @param {DSDecoderV1 | DSDecoderV2} decoder - * @param {Transaction} transaction - * @param {StructStore} store - * @return {Uint8Array|null} Returns a v2 update containing all deletes that couldn't be applied yet; or null if all deletes were applied successfully. - * - * @private - * @function - */ -export const readAndApplyDeleteSet = (decoder, transaction, store) => { - const unappliedDS = new DeleteSet() - const numClients = decoding.readVarUint(decoder.restDecoder) - for (let i = 0; i < numClients; i++) { - decoder.resetDsCurVal() - const client = decoding.readVarUint(decoder.restDecoder) - const numberOfDeletes = decoding.readVarUint(decoder.restDecoder) - const structs = store.clients.get(client) || [] - const state = getState(store, client) - for (let i = 0; i < numberOfDeletes; i++) { - const clock = decoder.readDsClock() - const clockEnd = clock + decoder.readDsLen() - if (clock < state) { - if (state < clockEnd) { - addToDeleteSet(unappliedDS, client, state, clockEnd - state) - } - let index = findIndexSS(structs, clock) - /** - * We can ignore the case of GC and Delete structs, because we are going to skip them - * @type {Item} - */ - // @ts-ignore - let struct = structs[index] - // split the first item if necessary - if (!struct.deleted && struct.id.clock < clock) { - structs.splice(index + 1, 0, splitItem(transaction, struct, clock - struct.id.clock)) - index++ // increase we now want to use the next struct - } - while (index < structs.length) { - // @ts-ignore - struct = structs[index++] - if (struct.id.clock < clockEnd) { - if (!struct.deleted) { - if (clockEnd < struct.id.clock + struct.length) { - structs.splice(index, 0, splitItem(transaction, struct, clockEnd - struct.id.clock)) - } - struct.delete(transaction) - } - } else { - break - } - } - } else { - addToDeleteSet(unappliedDS, client, clock, clockEnd - clock) - } - } - } - if (unappliedDS.clients.size > 0) { - const ds = new UpdateEncoderV2() - encoding.writeVarUint(ds.restEncoder, 0) // encode 0 structs - writeDeleteSet(ds, unappliedDS) - return ds.toUint8Array() - } - return null -} - -/** - * @param {DeleteSet} ds1 - * @param {DeleteSet} ds2 - */ -export const equalDeleteSets = (ds1, ds2) => { - if (ds1.clients.size !== ds2.clients.size) return false - for (const [client, deleteItems1] of ds1.clients.entries()) { - const deleteItems2 = /** @type {Array} */ (ds2.clients.get(client)) - if (deleteItems2 === undefined || deleteItems1.length !== deleteItems2.length) return false - for (let i = 0; i < deleteItems1.length; i++) { - const di1 = deleteItems1[i] - const di2 = deleteItems2[i] - if (di1.clock !== di2.clock || di1.len !== di2.len) { - return false - } - } - } - return true -} diff --git a/yjs-poll/node_modules/yjs/src/utils/Doc.js b/yjs-poll/node_modules/yjs/src/utils/Doc.js deleted file mode 100644 index 317f8c2..0000000 --- a/yjs-poll/node_modules/yjs/src/utils/Doc.js +++ /dev/null @@ -1,347 +0,0 @@ -/** - * @module Y - */ - -import { - StructStore, - AbstractType, - YArray, - YText, - YMap, - YXmlElement, - YXmlFragment, - transact, - ContentDoc, Item, Transaction, YEvent // eslint-disable-line -} from '../internals.js' - -import { ObservableV2 } from 'lib0/observable' -import * as random from 'lib0/random' -import * as map from 'lib0/map' -import * as array from 'lib0/array' -import * as promise from 'lib0/promise' - -export const generateNewClientId = random.uint32 - -/** - * @typedef {Object} DocOpts - * @property {boolean} [DocOpts.gc=true] Disable garbage collection (default: gc=true) - * @property {function(Item):boolean} [DocOpts.gcFilter] Will be called before an Item is garbage collected. Return false to keep the Item. - * @property {string} [DocOpts.guid] Define a globally unique identifier for this document - * @property {string | null} [DocOpts.collectionid] Associate this document with a collection. This only plays a role if your provider has a concept of collection. - * @property {any} [DocOpts.meta] Any kind of meta information you want to associate with this document. If this is a subdocument, remote peers will store the meta information as well. - * @property {boolean} [DocOpts.autoLoad] If a subdocument, automatically load document. If this is a subdocument, remote peers will load the document as well automatically. - * @property {boolean} [DocOpts.shouldLoad] Whether the document should be synced by the provider now. This is toggled to true when you call ydoc.load() - */ - -/** - * @typedef {Object} DocEvents - * @property {function(Doc):void} DocEvents.destroy - * @property {function(Doc):void} DocEvents.load - * @property {function(boolean, Doc):void} DocEvents.sync - * @property {function(Uint8Array, any, Doc, Transaction):void} DocEvents.update - * @property {function(Uint8Array, any, Doc, Transaction):void} DocEvents.updateV2 - * @property {function(Doc):void} DocEvents.beforeAllTransactions - * @property {function(Transaction, Doc):void} DocEvents.beforeTransaction - * @property {function(Transaction, Doc):void} DocEvents.beforeObserverCalls - * @property {function(Transaction, Doc):void} DocEvents.afterTransaction - * @property {function(Transaction, Doc):void} DocEvents.afterTransactionCleanup - * @property {function(Doc, Array):void} DocEvents.afterAllTransactions - * @property {function({ loaded: Set, added: Set, removed: Set }, Doc, Transaction):void} DocEvents.subdocs - */ - -/** - * A Yjs instance handles the state of shared data. - * @extends ObservableV2 - */ -export class Doc extends ObservableV2 { - /** - * @param {DocOpts} opts configuration - */ - constructor ({ guid = random.uuidv4(), collectionid = null, gc = true, gcFilter = () => true, meta = null, autoLoad = false, shouldLoad = true } = {}) { - super() - this.gc = gc - this.gcFilter = gcFilter - this.clientID = generateNewClientId() - this.guid = guid - this.collectionid = collectionid - /** - * @type {Map>>} - */ - this.share = new Map() - this.store = new StructStore() - /** - * @type {Transaction | null} - */ - this._transaction = null - /** - * @type {Array} - */ - this._transactionCleanups = [] - /** - * @type {Set} - */ - this.subdocs = new Set() - /** - * If this document is a subdocument - a document integrated into another document - then _item is defined. - * @type {Item?} - */ - this._item = null - this.shouldLoad = shouldLoad - this.autoLoad = autoLoad - this.meta = meta - /** - * This is set to true when the persistence provider loaded the document from the database or when the `sync` event fires. - * Note that not all providers implement this feature. Provider authors are encouraged to fire the `load` event when the doc content is loaded from the database. - * - * @type {boolean} - */ - this.isLoaded = false - /** - * This is set to true when the connection provider has successfully synced with a backend. - * Note that when using peer-to-peer providers this event may not provide very useful. - * Also note that not all providers implement this feature. Provider authors are encouraged to fire - * the `sync` event when the doc has been synced (with `true` as a parameter) or if connection is - * lost (with false as a parameter). - */ - this.isSynced = false - this.isDestroyed = false - /** - * Promise that resolves once the document has been loaded from a persistence provider. - */ - this.whenLoaded = promise.create(resolve => { - this.on('load', () => { - this.isLoaded = true - resolve(this) - }) - }) - const provideSyncedPromise = () => promise.create(resolve => { - /** - * @param {boolean} isSynced - */ - const eventHandler = (isSynced) => { - if (isSynced === undefined || isSynced === true) { - this.off('sync', eventHandler) - resolve() - } - } - this.on('sync', eventHandler) - }) - this.on('sync', isSynced => { - if (isSynced === false && this.isSynced) { - this.whenSynced = provideSyncedPromise() - } - this.isSynced = isSynced === undefined || isSynced === true - if (this.isSynced && !this.isLoaded) { - this.emit('load', [this]) - } - }) - /** - * Promise that resolves once the document has been synced with a backend. - * This promise is recreated when the connection is lost. - * Note the documentation about the `isSynced` property. - */ - this.whenSynced = provideSyncedPromise() - } - - /** - * Notify the parent document that you request to load data into this subdocument (if it is a subdocument). - * - * `load()` might be used in the future to request any provider to load the most current data. - * - * It is safe to call `load()` multiple times. - */ - load () { - const item = this._item - if (item !== null && !this.shouldLoad) { - transact(/** @type {any} */ (item.parent).doc, transaction => { - transaction.subdocsLoaded.add(this) - }, null, true) - } - this.shouldLoad = true - } - - getSubdocs () { - return this.subdocs - } - - getSubdocGuids () { - return new Set(array.from(this.subdocs).map(doc => doc.guid)) - } - - /** - * Changes that happen inside of a transaction are bundled. This means that - * the observer fires _after_ the transaction is finished and that all changes - * that happened inside of the transaction are sent as one message to the - * other peers. - * - * @template T - * @param {function(Transaction):T} f The function that should be executed as a transaction - * @param {any} [origin] Origin of who started the transaction. Will be stored on transaction.origin - * @return T - * - * @public - */ - transact (f, origin = null) { - return transact(this, f, origin) - } - - /** - * Define a shared data type. - * - * Multiple calls of `ydoc.get(name, TypeConstructor)` yield the same result - * and do not overwrite each other. I.e. - * `ydoc.get(name, Y.Array) === ydoc.get(name, Y.Array)` - * - * After this method is called, the type is also available on `ydoc.share.get(name)`. - * - * *Best Practices:* - * Define all types right after the Y.Doc instance is created and store them in a separate object. - * Also use the typed methods `getText(name)`, `getArray(name)`, .. - * - * @template {typeof AbstractType} Type - * @example - * const ydoc = new Y.Doc(..) - * const appState = { - * document: ydoc.getText('document') - * comments: ydoc.getArray('comments') - * } - * - * @param {string} name - * @param {Type} TypeConstructor The constructor of the type definition. E.g. Y.Text, Y.Array, Y.Map, ... - * @return {InstanceType} The created type. Constructed with TypeConstructor - * - * @public - */ - get (name, TypeConstructor = /** @type {any} */ (AbstractType)) { - const type = map.setIfUndefined(this.share, name, () => { - // @ts-ignore - const t = new TypeConstructor() - t._integrate(this, null) - return t - }) - const Constr = type.constructor - if (TypeConstructor !== AbstractType && Constr !== TypeConstructor) { - if (Constr === AbstractType) { - // @ts-ignore - const t = new TypeConstructor() - t._map = type._map - type._map.forEach(/** @param {Item?} n */ n => { - for (; n !== null; n = n.left) { - // @ts-ignore - n.parent = t - } - }) - t._start = type._start - for (let n = t._start; n !== null; n = n.right) { - n.parent = t - } - t._length = type._length - this.share.set(name, t) - t._integrate(this, null) - return /** @type {InstanceType} */ (t) - } else { - throw new Error(`Type with the name ${name} has already been defined with a different constructor`) - } - } - return /** @type {InstanceType} */ (type) - } - - /** - * @template T - * @param {string} [name] - * @return {YArray} - * - * @public - */ - getArray (name = '') { - return /** @type {YArray} */ (this.get(name, YArray)) - } - - /** - * @param {string} [name] - * @return {YText} - * - * @public - */ - getText (name = '') { - return this.get(name, YText) - } - - /** - * @template T - * @param {string} [name] - * @return {YMap} - * - * @public - */ - getMap (name = '') { - return /** @type {YMap} */ (this.get(name, YMap)) - } - - /** - * @param {string} [name] - * @return {YXmlElement} - * - * @public - */ - getXmlElement (name = '') { - return /** @type {YXmlElement<{[key:string]:string}>} */ (this.get(name, YXmlElement)) - } - - /** - * @param {string} [name] - * @return {YXmlFragment} - * - * @public - */ - getXmlFragment (name = '') { - return this.get(name, YXmlFragment) - } - - /** - * Converts the entire document into a js object, recursively traversing each yjs type - * Doesn't log types that have not been defined (using ydoc.getType(..)). - * - * @deprecated Do not use this method and rather call toJSON directly on the shared types. - * - * @return {Object} - */ - toJSON () { - /** - * @type {Object} - */ - const doc = {} - - this.share.forEach((value, key) => { - doc[key] = value.toJSON() - }) - - return doc - } - - /** - * Emit `destroy` event and unregister all event handlers. - */ - destroy () { - this.isDestroyed = true - array.from(this.subdocs).forEach(subdoc => subdoc.destroy()) - const item = this._item - if (item !== null) { - this._item = null - const content = /** @type {ContentDoc} */ (item.content) - content.doc = new Doc({ guid: this.guid, ...content.opts, shouldLoad: false }) - content.doc._item = item - transact(/** @type {any} */ (item).parent.doc, transaction => { - const doc = content.doc - if (!item.deleted) { - transaction.subdocsAdded.add(doc) - } - transaction.subdocsRemoved.add(this) - }, null, true) - } - // @ts-ignore - this.emit('destroyed', [true]) // DEPRECATED! - this.emit('destroy', [this]) - super.destroy() - } -} diff --git a/yjs-poll/node_modules/yjs/src/utils/EventHandler.js b/yjs-poll/node_modules/yjs/src/utils/EventHandler.js deleted file mode 100644 index 33fa6f2..0000000 --- a/yjs-poll/node_modules/yjs/src/utils/EventHandler.js +++ /dev/null @@ -1,87 +0,0 @@ -import * as f from 'lib0/function' - -/** - * General event handler implementation. - * - * @template ARG0, ARG1 - * - * @private - */ -export class EventHandler { - constructor () { - /** - * @type {Array} - */ - this.l = [] - } -} - -/** - * @template ARG0,ARG1 - * @returns {EventHandler} - * - * @private - * @function - */ -export const createEventHandler = () => new EventHandler() - -/** - * Adds an event listener that is called when - * {@link EventHandler#callEventListeners} is called. - * - * @template ARG0,ARG1 - * @param {EventHandler} eventHandler - * @param {function(ARG0,ARG1):void} f The event handler. - * - * @private - * @function - */ -export const addEventHandlerListener = (eventHandler, f) => - eventHandler.l.push(f) - -/** - * Removes an event listener. - * - * @template ARG0,ARG1 - * @param {EventHandler} eventHandler - * @param {function(ARG0,ARG1):void} f The event handler that was added with - * {@link EventHandler#addEventListener} - * - * @private - * @function - */ -export const removeEventHandlerListener = (eventHandler, f) => { - const l = eventHandler.l - const len = l.length - eventHandler.l = l.filter(g => f !== g) - if (len === eventHandler.l.length) { - console.error('[yjs] Tried to remove event handler that doesn\'t exist.') - } -} - -/** - * Removes all event listeners. - * @template ARG0,ARG1 - * @param {EventHandler} eventHandler - * - * @private - * @function - */ -export const removeAllEventHandlerListeners = eventHandler => { - eventHandler.l.length = 0 -} - -/** - * Call all event listeners that were added via - * {@link EventHandler#addEventListener}. - * - * @template ARG0,ARG1 - * @param {EventHandler} eventHandler - * @param {ARG0} arg0 - * @param {ARG1} arg1 - * - * @private - * @function - */ -export const callEventHandlerListeners = (eventHandler, arg0, arg1) => - f.callAll(eventHandler.l, [arg0, arg1]) diff --git a/yjs-poll/node_modules/yjs/src/utils/ID.js b/yjs-poll/node_modules/yjs/src/utils/ID.js deleted file mode 100644 index b0cabd8..0000000 --- a/yjs-poll/node_modules/yjs/src/utils/ID.js +++ /dev/null @@ -1,89 +0,0 @@ -import { AbstractType } from '../internals.js' // eslint-disable-line - -import * as decoding from 'lib0/decoding' -import * as encoding from 'lib0/encoding' -import * as error from 'lib0/error' - -export class ID { - /** - * @param {number} client client id - * @param {number} clock unique per client id, continuous number - */ - constructor (client, clock) { - /** - * Client id - * @type {number} - */ - this.client = client - /** - * unique per client id, continuous number - * @type {number} - */ - this.clock = clock - } -} - -/** - * @param {ID | null} a - * @param {ID | null} b - * @return {boolean} - * - * @function - */ -export const compareIDs = (a, b) => a === b || (a !== null && b !== null && a.client === b.client && a.clock === b.clock) - -/** - * @param {number} client - * @param {number} clock - * - * @private - * @function - */ -export const createID = (client, clock) => new ID(client, clock) - -/** - * @param {encoding.Encoder} encoder - * @param {ID} id - * - * @private - * @function - */ -export const writeID = (encoder, id) => { - encoding.writeVarUint(encoder, id.client) - encoding.writeVarUint(encoder, id.clock) -} - -/** - * Read ID. - * * If first varUint read is 0xFFFFFF a RootID is returned. - * * Otherwise an ID is returned - * - * @param {decoding.Decoder} decoder - * @return {ID} - * - * @private - * @function - */ -export const readID = decoder => - createID(decoding.readVarUint(decoder), decoding.readVarUint(decoder)) - -/** - * The top types are mapped from y.share.get(keyname) => type. - * `type` does not store any information about the `keyname`. - * This function finds the correct `keyname` for `type` and throws otherwise. - * - * @param {AbstractType} type - * @return {string} - * - * @private - * @function - */ -export const findRootTypeKey = type => { - // @ts-ignore _y must be defined, otherwise unexpected case - for (const [key, value] of type.doc.share.entries()) { - if (value === type) { - return key - } - } - throw error.unexpectedCase() -} diff --git a/yjs-poll/node_modules/yjs/src/utils/PermanentUserData.js b/yjs-poll/node_modules/yjs/src/utils/PermanentUserData.js deleted file mode 100644 index a5d990b..0000000 --- a/yjs-poll/node_modules/yjs/src/utils/PermanentUserData.js +++ /dev/null @@ -1,141 +0,0 @@ -import { - YArray, - YMap, - readDeleteSet, - writeDeleteSet, - createDeleteSet, - DSEncoderV1, DSDecoderV1, ID, DeleteSet, YArrayEvent, Transaction, Doc // eslint-disable-line -} from '../internals.js' - -import * as decoding from 'lib0/decoding' - -import { mergeDeleteSets, isDeleted } from './DeleteSet.js' - -export class PermanentUserData { - /** - * @param {Doc} doc - * @param {YMap} [storeType] - */ - constructor (doc, storeType = doc.getMap('users')) { - /** - * @type {Map} - */ - const dss = new Map() - this.yusers = storeType - this.doc = doc - /** - * Maps from clientid to userDescription - * - * @type {Map} - */ - this.clients = new Map() - this.dss = dss - /** - * @param {YMap} user - * @param {string} userDescription - */ - const initUser = (user, userDescription) => { - /** - * @type {YArray} - */ - const ds = user.get('ds') - const ids = user.get('ids') - const addClientId = /** @param {number} clientid */ clientid => this.clients.set(clientid, userDescription) - ds.observe(/** @param {YArrayEvent} event */ event => { - event.changes.added.forEach(item => { - item.content.getContent().forEach(encodedDs => { - if (encodedDs instanceof Uint8Array) { - this.dss.set(userDescription, mergeDeleteSets([this.dss.get(userDescription) || createDeleteSet(), readDeleteSet(new DSDecoderV1(decoding.createDecoder(encodedDs)))])) - } - }) - }) - }) - this.dss.set(userDescription, mergeDeleteSets(ds.map(encodedDs => readDeleteSet(new DSDecoderV1(decoding.createDecoder(encodedDs)))))) - ids.observe(/** @param {YArrayEvent} event */ event => - event.changes.added.forEach(item => item.content.getContent().forEach(addClientId)) - ) - ids.forEach(addClientId) - } - // observe users - storeType.observe(event => { - event.keysChanged.forEach(userDescription => - initUser(storeType.get(userDescription), userDescription) - ) - }) - // add initial data - storeType.forEach(initUser) - } - - /** - * @param {Doc} doc - * @param {number} clientid - * @param {string} userDescription - * @param {Object} conf - * @param {function(Transaction, DeleteSet):boolean} [conf.filter] - */ - setUserMapping (doc, clientid, userDescription, { filter = () => true } = {}) { - const users = this.yusers - let user = users.get(userDescription) - if (!user) { - user = new YMap() - user.set('ids', new YArray()) - user.set('ds', new YArray()) - users.set(userDescription, user) - } - user.get('ids').push([clientid]) - users.observe(_event => { - setTimeout(() => { - const userOverwrite = users.get(userDescription) - if (userOverwrite !== user) { - // user was overwritten, port all data over to the next user object - // @todo Experiment with Y.Sets here - user = userOverwrite - // @todo iterate over old type - this.clients.forEach((_userDescription, clientid) => { - if (userDescription === _userDescription) { - user.get('ids').push([clientid]) - } - }) - const encoder = new DSEncoderV1() - const ds = this.dss.get(userDescription) - if (ds) { - writeDeleteSet(encoder, ds) - user.get('ds').push([encoder.toUint8Array()]) - } - } - }, 0) - }) - doc.on('afterTransaction', /** @param {Transaction} transaction */ transaction => { - setTimeout(() => { - const yds = user.get('ds') - const ds = transaction.deleteSet - if (transaction.local && ds.clients.size > 0 && filter(transaction, ds)) { - const encoder = new DSEncoderV1() - writeDeleteSet(encoder, ds) - yds.push([encoder.toUint8Array()]) - } - }) - }) - } - - /** - * @param {number} clientid - * @return {any} - */ - getUserByClientId (clientid) { - return this.clients.get(clientid) || null - } - - /** - * @param {ID} id - * @return {string | null} - */ - getUserByDeletedId (id) { - for (const [userDescription, ds] of this.dss.entries()) { - if (isDeleted(ds, id)) { - return userDescription - } - } - return null - } -} diff --git a/yjs-poll/node_modules/yjs/src/utils/RelativePosition.js b/yjs-poll/node_modules/yjs/src/utils/RelativePosition.js deleted file mode 100644 index 4f6ced7..0000000 --- a/yjs-poll/node_modules/yjs/src/utils/RelativePosition.js +++ /dev/null @@ -1,353 +0,0 @@ -import { - writeID, - readID, - compareIDs, - getState, - findRootTypeKey, - Item, - createID, - ContentType, - followRedone, - getItem, - StructStore, ID, Doc, AbstractType, // eslint-disable-line -} from '../internals.js' - -import * as encoding from 'lib0/encoding' -import * as decoding from 'lib0/decoding' -import * as error from 'lib0/error' - -/** - * A relative position is based on the Yjs model and is not affected by document changes. - * E.g. If you place a relative position before a certain character, it will always point to this character. - * If you place a relative position at the end of a type, it will always point to the end of the type. - * - * A numeric position is often unsuited for user selections, because it does not change when content is inserted - * before or after. - * - * ```Insert(0, 'x')('a|bc') = 'xa|bc'``` Where | is the relative position. - * - * One of the properties must be defined. - * - * @example - * // Current cursor position is at position 10 - * const relativePosition = createRelativePositionFromIndex(yText, 10) - * // modify yText - * yText.insert(0, 'abc') - * yText.delete(3, 10) - * // Compute the cursor position - * const absolutePosition = createAbsolutePositionFromRelativePosition(y, relativePosition) - * absolutePosition.type === yText // => true - * console.log('cursor location is ' + absolutePosition.index) // => cursor location is 3 - * - */ -export class RelativePosition { - /** - * @param {ID|null} type - * @param {string|null} tname - * @param {ID|null} item - * @param {number} assoc - */ - constructor (type, tname, item, assoc = 0) { - /** - * @type {ID|null} - */ - this.type = type - /** - * @type {string|null} - */ - this.tname = tname - /** - * @type {ID | null} - */ - this.item = item - /** - * A relative position is associated to a specific character. By default - * assoc >= 0, the relative position is associated to the character - * after the meant position. - * I.e. position 1 in 'ab' is associated to character 'b'. - * - * If assoc < 0, then the relative position is associated to the character - * before the meant position. - * - * @type {number} - */ - this.assoc = assoc - } -} - -/** - * @param {RelativePosition} rpos - * @return {any} - */ -export const relativePositionToJSON = rpos => { - const json = {} - if (rpos.type) { - json.type = rpos.type - } - if (rpos.tname) { - json.tname = rpos.tname - } - if (rpos.item) { - json.item = rpos.item - } - if (rpos.assoc != null) { - json.assoc = rpos.assoc - } - return json -} - -/** - * @param {any} json - * @return {RelativePosition} - * - * @function - */ -export const createRelativePositionFromJSON = json => new RelativePosition(json.type == null ? null : createID(json.type.client, json.type.clock), json.tname ?? null, json.item == null ? null : createID(json.item.client, json.item.clock), json.assoc == null ? 0 : json.assoc) - -export class AbsolutePosition { - /** - * @param {AbstractType} type - * @param {number} index - * @param {number} [assoc] - */ - constructor (type, index, assoc = 0) { - /** - * @type {AbstractType} - */ - this.type = type - /** - * @type {number} - */ - this.index = index - this.assoc = assoc - } -} - -/** - * @param {AbstractType} type - * @param {number} index - * @param {number} [assoc] - * - * @function - */ -export const createAbsolutePosition = (type, index, assoc = 0) => new AbsolutePosition(type, index, assoc) - -/** - * @param {AbstractType} type - * @param {ID|null} item - * @param {number} [assoc] - * - * @function - */ -export const createRelativePosition = (type, item, assoc) => { - let typeid = null - let tname = null - if (type._item === null) { - tname = findRootTypeKey(type) - } else { - typeid = createID(type._item.id.client, type._item.id.clock) - } - return new RelativePosition(typeid, tname, item, assoc) -} - -/** - * Create a relativePosition based on a absolute position. - * - * @param {AbstractType} type The base type (e.g. YText or YArray). - * @param {number} index The absolute position. - * @param {number} [assoc] - * @return {RelativePosition} - * - * @function - */ -export const createRelativePositionFromTypeIndex = (type, index, assoc = 0) => { - let t = type._start - if (assoc < 0) { - // associated to the left character or the beginning of a type, increment index if possible. - if (index === 0) { - return createRelativePosition(type, null, assoc) - } - index-- - } - while (t !== null) { - if (!t.deleted && t.countable) { - if (t.length > index) { - // case 1: found position somewhere in the linked list - return createRelativePosition(type, createID(t.id.client, t.id.clock + index), assoc) - } - index -= t.length - } - if (t.right === null && assoc < 0) { - // left-associated position, return last available id - return createRelativePosition(type, t.lastId, assoc) - } - t = t.right - } - return createRelativePosition(type, null, assoc) -} - -/** - * @param {encoding.Encoder} encoder - * @param {RelativePosition} rpos - * - * @function - */ -export const writeRelativePosition = (encoder, rpos) => { - const { type, tname, item, assoc } = rpos - if (item !== null) { - encoding.writeVarUint(encoder, 0) - writeID(encoder, item) - } else if (tname !== null) { - // case 2: found position at the end of the list and type is stored in y.share - encoding.writeUint8(encoder, 1) - encoding.writeVarString(encoder, tname) - } else if (type !== null) { - // case 3: found position at the end of the list and type is attached to an item - encoding.writeUint8(encoder, 2) - writeID(encoder, type) - } else { - throw error.unexpectedCase() - } - encoding.writeVarInt(encoder, assoc) - return encoder -} - -/** - * @param {RelativePosition} rpos - * @return {Uint8Array} - */ -export const encodeRelativePosition = rpos => { - const encoder = encoding.createEncoder() - writeRelativePosition(encoder, rpos) - return encoding.toUint8Array(encoder) -} - -/** - * @param {decoding.Decoder} decoder - * @return {RelativePosition} - * - * @function - */ -export const readRelativePosition = decoder => { - let type = null - let tname = null - let itemID = null - switch (decoding.readVarUint(decoder)) { - case 0: - // case 1: found position somewhere in the linked list - itemID = readID(decoder) - break - case 1: - // case 2: found position at the end of the list and type is stored in y.share - tname = decoding.readVarString(decoder) - break - case 2: { - // case 3: found position at the end of the list and type is attached to an item - type = readID(decoder) - } - } - const assoc = decoding.hasContent(decoder) ? decoding.readVarInt(decoder) : 0 - return new RelativePosition(type, tname, itemID, assoc) -} - -/** - * @param {Uint8Array} uint8Array - * @return {RelativePosition} - */ -export const decodeRelativePosition = uint8Array => readRelativePosition(decoding.createDecoder(uint8Array)) - -/** - * @param {StructStore} store - * @param {ID} id - */ -const getItemWithOffset = (store, id) => { - const item = getItem(store, id) - const diff = id.clock - item.id.clock - return { - item, diff - } -} - -/** - * Transform a relative position to an absolute position. - * - * If you want to share the relative position with other users, you should set - * `followUndoneDeletions` to false to get consistent results across all clients. - * - * When calculating the absolute position, we try to follow the "undone deletions". This yields - * better results for the user who performed undo. However, only the user who performed the undo - * will get the better results, the other users don't know which operations recreated a deleted - * range of content. There is more information in this ticket: https://github.com/yjs/yjs/issues/638 - * - * @param {RelativePosition} rpos - * @param {Doc} doc - * @param {boolean} followUndoneDeletions - whether to follow undone deletions - see https://github.com/yjs/yjs/issues/638 - * @return {AbsolutePosition|null} - * - * @function - */ -export const createAbsolutePositionFromRelativePosition = (rpos, doc, followUndoneDeletions = true) => { - const store = doc.store - const rightID = rpos.item - const typeID = rpos.type - const tname = rpos.tname - const assoc = rpos.assoc - let type = null - let index = 0 - if (rightID !== null) { - if (getState(store, rightID.client) <= rightID.clock) { - return null - } - const res = followUndoneDeletions ? followRedone(store, rightID) : getItemWithOffset(store, rightID) - const right = res.item - if (!(right instanceof Item)) { - return null - } - type = /** @type {AbstractType} */ (right.parent) - if (type._item === null || !type._item.deleted) { - index = (right.deleted || !right.countable) ? 0 : (res.diff + (assoc >= 0 ? 0 : 1)) // adjust position based on left association if necessary - let n = right.left - while (n !== null) { - if (!n.deleted && n.countable) { - index += n.length - } - n = n.left - } - } - } else { - if (tname !== null) { - type = doc.get(tname) - } else if (typeID !== null) { - if (getState(store, typeID.client) <= typeID.clock) { - // type does not exist yet - return null - } - const { item } = followUndoneDeletions ? followRedone(store, typeID) : { item: getItem(store, typeID) } - if (item instanceof Item && item.content instanceof ContentType) { - type = item.content.type - } else { - // struct is garbage collected - return null - } - } else { - throw error.unexpectedCase() - } - if (assoc >= 0) { - index = type._length - } else { - index = 0 - } - } - return createAbsolutePosition(type, index, rpos.assoc) -} - -/** - * @param {RelativePosition|null} a - * @param {RelativePosition|null} b - * @return {boolean} - * - * @function - */ -export const compareRelativePositions = (a, b) => a === b || ( - a !== null && b !== null && a.tname === b.tname && compareIDs(a.item, b.item) && compareIDs(a.type, b.type) && a.assoc === b.assoc -) diff --git a/yjs-poll/node_modules/yjs/src/utils/Snapshot.js b/yjs-poll/node_modules/yjs/src/utils/Snapshot.js deleted file mode 100644 index 777cd39..0000000 --- a/yjs-poll/node_modules/yjs/src/utils/Snapshot.js +++ /dev/null @@ -1,236 +0,0 @@ -import { - isDeleted, - createDeleteSetFromStructStore, - getStateVector, - getItemCleanStart, - iterateDeletedStructs, - writeDeleteSet, - writeStateVector, - readDeleteSet, - readStateVector, - createDeleteSet, - createID, - getState, - findIndexSS, - UpdateEncoderV2, - applyUpdateV2, - LazyStructReader, - equalDeleteSets, - UpdateDecoderV1, UpdateDecoderV2, DSEncoderV1, DSEncoderV2, DSDecoderV1, DSDecoderV2, Transaction, Doc, DeleteSet, Item, // eslint-disable-line - mergeDeleteSets -} from '../internals.js' - -import * as map from 'lib0/map' -import * as set from 'lib0/set' -import * as decoding from 'lib0/decoding' -import * as encoding from 'lib0/encoding' - -export class Snapshot { - /** - * @param {DeleteSet} ds - * @param {Map} sv state map - */ - constructor (ds, sv) { - /** - * @type {DeleteSet} - */ - this.ds = ds - /** - * State Map - * @type {Map} - */ - this.sv = sv - } -} - -/** - * @param {Snapshot} snap1 - * @param {Snapshot} snap2 - * @return {boolean} - */ -export const equalSnapshots = (snap1, snap2) => { - const ds1 = snap1.ds.clients - const ds2 = snap2.ds.clients - const sv1 = snap1.sv - const sv2 = snap2.sv - if (sv1.size !== sv2.size || ds1.size !== ds2.size) { - return false - } - for (const [key, value] of sv1.entries()) { - if (sv2.get(key) !== value) { - return false - } - } - for (const [client, dsitems1] of ds1.entries()) { - const dsitems2 = ds2.get(client) || [] - if (dsitems1.length !== dsitems2.length) { - return false - } - for (let i = 0; i < dsitems1.length; i++) { - const dsitem1 = dsitems1[i] - const dsitem2 = dsitems2[i] - if (dsitem1.clock !== dsitem2.clock || dsitem1.len !== dsitem2.len) { - return false - } - } - } - return true -} - -/** - * @param {Snapshot} snapshot - * @param {DSEncoderV1 | DSEncoderV2} [encoder] - * @return {Uint8Array} - */ -export const encodeSnapshotV2 = (snapshot, encoder = new DSEncoderV2()) => { - writeDeleteSet(encoder, snapshot.ds) - writeStateVector(encoder, snapshot.sv) - return encoder.toUint8Array() -} - -/** - * @param {Snapshot} snapshot - * @return {Uint8Array} - */ -export const encodeSnapshot = snapshot => encodeSnapshotV2(snapshot, new DSEncoderV1()) - -/** - * @param {Uint8Array} buf - * @param {DSDecoderV1 | DSDecoderV2} [decoder] - * @return {Snapshot} - */ -export const decodeSnapshotV2 = (buf, decoder = new DSDecoderV2(decoding.createDecoder(buf))) => { - return new Snapshot(readDeleteSet(decoder), readStateVector(decoder)) -} - -/** - * @param {Uint8Array} buf - * @return {Snapshot} - */ -export const decodeSnapshot = buf => decodeSnapshotV2(buf, new DSDecoderV1(decoding.createDecoder(buf))) - -/** - * @param {DeleteSet} ds - * @param {Map} sm - * @return {Snapshot} - */ -export const createSnapshot = (ds, sm) => new Snapshot(ds, sm) - -export const emptySnapshot = createSnapshot(createDeleteSet(), new Map()) - -/** - * @param {Doc} doc - * @return {Snapshot} - */ -export const snapshot = doc => createSnapshot(createDeleteSetFromStructStore(doc.store), getStateVector(doc.store)) - -/** - * @param {Item} item - * @param {Snapshot|undefined} snapshot - * - * @protected - * @function - */ -export const isVisible = (item, snapshot) => snapshot === undefined - ? !item.deleted - : snapshot.sv.has(item.id.client) && (snapshot.sv.get(item.id.client) || 0) > item.id.clock && !isDeleted(snapshot.ds, item.id) - -/** - * @param {Transaction} transaction - * @param {Snapshot} snapshot - */ -export const splitSnapshotAffectedStructs = (transaction, snapshot) => { - const meta = map.setIfUndefined(transaction.meta, splitSnapshotAffectedStructs, set.create) - const store = transaction.doc.store - // check if we already split for this snapshot - if (!meta.has(snapshot)) { - snapshot.sv.forEach((clock, client) => { - if (clock < getState(store, client)) { - getItemCleanStart(transaction, createID(client, clock)) - } - }) - iterateDeletedStructs(transaction, snapshot.ds, _item => {}) - meta.add(snapshot) - } -} - -/** - * @example - * const ydoc = new Y.Doc({ gc: false }) - * ydoc.getText().insert(0, 'world!') - * const snapshot = Y.snapshot(ydoc) - * ydoc.getText().insert(0, 'hello ') - * const restored = Y.createDocFromSnapshot(ydoc, snapshot) - * assert(restored.getText().toString() === 'world!') - * - * @param {Doc} originDoc - * @param {Snapshot} snapshot - * @param {Doc} [newDoc] Optionally, you may define the Yjs document that receives the data from originDoc - * @return {Doc} - */ -export const createDocFromSnapshot = (originDoc, snapshot, newDoc = new Doc()) => { - if (originDoc.gc) { - // we should not try to restore a GC-ed document, because some of the restored items might have their content deleted - throw new Error('Garbage-collection must be disabled in `originDoc`!') - } - const { sv, ds } = snapshot - - const encoder = new UpdateEncoderV2() - originDoc.transact(transaction => { - let size = 0 - sv.forEach(clock => { - if (clock > 0) { - size++ - } - }) - encoding.writeVarUint(encoder.restEncoder, size) - // splitting the structs before writing them to the encoder - for (const [client, clock] of sv) { - if (clock === 0) { - continue - } - if (clock < getState(originDoc.store, client)) { - getItemCleanStart(transaction, createID(client, clock)) - } - const structs = originDoc.store.clients.get(client) || [] - const lastStructIndex = findIndexSS(structs, clock - 1) - // write # encoded structs - encoding.writeVarUint(encoder.restEncoder, lastStructIndex + 1) - encoder.writeClient(client) - // first clock written is 0 - encoding.writeVarUint(encoder.restEncoder, 0) - for (let i = 0; i <= lastStructIndex; i++) { - structs[i].write(encoder, 0) - } - } - writeDeleteSet(encoder, ds) - }) - - applyUpdateV2(newDoc, encoder.toUint8Array(), 'snapshot') - return newDoc -} - -/** - * @param {Snapshot} snapshot - * @param {Uint8Array} update - * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder] - */ -export const snapshotContainsUpdateV2 = (snapshot, update, YDecoder = UpdateDecoderV2) => { - const structs = [] - const updateDecoder = new YDecoder(decoding.createDecoder(update)) - const lazyDecoder = new LazyStructReader(updateDecoder, false) - for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) { - structs.push(curr) - if ((snapshot.sv.get(curr.id.client) || 0) < curr.id.clock + curr.length) { - return false - } - } - const mergedDS = mergeDeleteSets([snapshot.ds, readDeleteSet(updateDecoder)]) - return equalDeleteSets(snapshot.ds, mergedDS) -} - -/** - * @param {Snapshot} snapshot - * @param {Uint8Array} update - */ -export const snapshotContainsUpdate = (snapshot, update) => snapshotContainsUpdateV2(snapshot, update, UpdateDecoderV1) diff --git a/yjs-poll/node_modules/yjs/src/utils/StructStore.js b/yjs-poll/node_modules/yjs/src/utils/StructStore.js deleted file mode 100644 index 692743d..0000000 --- a/yjs-poll/node_modules/yjs/src/utils/StructStore.js +++ /dev/null @@ -1,261 +0,0 @@ -import { - GC, - splitItem, - Transaction, ID, Item, DSDecoderV2 // eslint-disable-line -} from '../internals.js' - -import * as math from 'lib0/math' -import * as error from 'lib0/error' - -export class StructStore { - constructor () { - /** - * @type {Map>} - */ - this.clients = new Map() - /** - * @type {null | { missing: Map, update: Uint8Array }} - */ - this.pendingStructs = null - /** - * @type {null | Uint8Array} - */ - this.pendingDs = null - } -} - -/** - * Return the states as a Map. - * Note that clock refers to the next expected clock id. - * - * @param {StructStore} store - * @return {Map} - * - * @public - * @function - */ -export const getStateVector = store => { - const sm = new Map() - store.clients.forEach((structs, client) => { - const struct = structs[structs.length - 1] - sm.set(client, struct.id.clock + struct.length) - }) - return sm -} - -/** - * @param {StructStore} store - * @param {number} client - * @return {number} - * - * @public - * @function - */ -export const getState = (store, client) => { - const structs = store.clients.get(client) - if (structs === undefined) { - return 0 - } - const lastStruct = structs[structs.length - 1] - return lastStruct.id.clock + lastStruct.length -} - -/** - * @param {StructStore} store - * - * @private - * @function - */ -export const integrityCheck = store => { - store.clients.forEach(structs => { - for (let i = 1; i < structs.length; i++) { - const l = structs[i - 1] - const r = structs[i] - if (l.id.clock + l.length !== r.id.clock) { - throw new Error('StructStore failed integrity check') - } - } - }) -} - -/** - * @param {StructStore} store - * @param {GC|Item} struct - * - * @private - * @function - */ -export const addStruct = (store, struct) => { - let structs = store.clients.get(struct.id.client) - if (structs === undefined) { - structs = [] - store.clients.set(struct.id.client, structs) - } else { - const lastStruct = structs[structs.length - 1] - if (lastStruct.id.clock + lastStruct.length !== struct.id.clock) { - throw error.unexpectedCase() - } - } - structs.push(struct) -} - -/** - * Perform a binary search on a sorted array - * @param {Array} structs - * @param {number} clock - * @return {number} - * - * @private - * @function - */ -export const findIndexSS = (structs, clock) => { - let left = 0 - let right = structs.length - 1 - let mid = structs[right] - let midclock = mid.id.clock - if (midclock === clock) { - return right - } - // @todo does it even make sense to pivot the search? - // If a good split misses, it might actually increase the time to find the correct item. - // Currently, the only advantage is that search with pivoting might find the item on the first try. - let midindex = math.floor((clock / (midclock + mid.length - 1)) * right) // pivoting the search - while (left <= right) { - mid = structs[midindex] - midclock = mid.id.clock - if (midclock <= clock) { - if (clock < midclock + mid.length) { - return midindex - } - left = midindex + 1 - } else { - right = midindex - 1 - } - midindex = math.floor((left + right) / 2) - } - // Always check state before looking for a struct in StructStore - // Therefore the case of not finding a struct is unexpected - throw error.unexpectedCase() -} - -/** - * Expects that id is actually in store. This function throws or is an infinite loop otherwise. - * - * @param {StructStore} store - * @param {ID} id - * @return {GC|Item} - * - * @private - * @function - */ -export const find = (store, id) => { - /** - * @type {Array} - */ - // @ts-ignore - const structs = store.clients.get(id.client) - return structs[findIndexSS(structs, id.clock)] -} - -/** - * Expects that id is actually in store. This function throws or is an infinite loop otherwise. - * @private - * @function - */ -export const getItem = /** @type {function(StructStore,ID):Item} */ (find) - -/** - * @param {Transaction} transaction - * @param {Array} structs - * @param {number} clock - */ -export const findIndexCleanStart = (transaction, structs, clock) => { - const index = findIndexSS(structs, clock) - const struct = structs[index] - if (struct.id.clock < clock && struct instanceof Item) { - structs.splice(index + 1, 0, splitItem(transaction, struct, clock - struct.id.clock)) - return index + 1 - } - return index -} - -/** - * Expects that id is actually in store. This function throws or is an infinite loop otherwise. - * - * @param {Transaction} transaction - * @param {ID} id - * @return {Item} - * - * @private - * @function - */ -export const getItemCleanStart = (transaction, id) => { - const structs = /** @type {Array} */ (transaction.doc.store.clients.get(id.client)) - return structs[findIndexCleanStart(transaction, structs, id.clock)] -} - -/** - * Expects that id is actually in store. This function throws or is an infinite loop otherwise. - * - * @param {Transaction} transaction - * @param {StructStore} store - * @param {ID} id - * @return {Item} - * - * @private - * @function - */ -export const getItemCleanEnd = (transaction, store, id) => { - /** - * @type {Array} - */ - // @ts-ignore - const structs = store.clients.get(id.client) - const index = findIndexSS(structs, id.clock) - const struct = structs[index] - if (id.clock !== struct.id.clock + struct.length - 1 && struct.constructor !== GC) { - structs.splice(index + 1, 0, splitItem(transaction, struct, id.clock - struct.id.clock + 1)) - } - return struct -} - -/** - * Replace `item` with `newitem` in store - * @param {StructStore} store - * @param {GC|Item} struct - * @param {GC|Item} newStruct - * - * @private - * @function - */ -export const replaceStruct = (store, struct, newStruct) => { - const structs = /** @type {Array} */ (store.clients.get(struct.id.client)) - structs[findIndexSS(structs, struct.id.clock)] = newStruct -} - -/** - * Iterate over a range of structs - * - * @param {Transaction} transaction - * @param {Array} structs - * @param {number} clockStart Inclusive start - * @param {number} len - * @param {function(GC|Item):void} f - * - * @function - */ -export const iterateStructs = (transaction, structs, clockStart, len, f) => { - if (len === 0) { - return - } - const clockEnd = clockStart + len - let index = findIndexCleanStart(transaction, structs, clockStart) - let struct - do { - struct = structs[index++] - if (clockEnd < struct.id.clock + struct.length) { - findIndexCleanStart(transaction, structs, clockEnd) - } - f(struct) - } while (index < structs.length && structs[index].id.clock < clockEnd) -} diff --git a/yjs-poll/node_modules/yjs/src/utils/Transaction.js b/yjs-poll/node_modules/yjs/src/utils/Transaction.js deleted file mode 100644 index 44771b0..0000000 --- a/yjs-poll/node_modules/yjs/src/utils/Transaction.js +++ /dev/null @@ -1,448 +0,0 @@ -import { - getState, - writeStructsFromTransaction, - writeDeleteSet, - DeleteSet, - sortAndMergeDeleteSet, - getStateVector, - findIndexSS, - callEventHandlerListeners, - Item, - generateNewClientId, - createID, - cleanupYTextAfterTransaction, - UpdateEncoderV1, UpdateEncoderV2, GC, StructStore, AbstractType, AbstractStruct, YEvent, Doc // eslint-disable-line -} from '../internals.js' - -import * as map from 'lib0/map' -import * as math from 'lib0/math' -import * as set from 'lib0/set' -import * as logging from 'lib0/logging' -import { callAll } from 'lib0/function' - -/** - * A transaction is created for every change on the Yjs model. It is possible - * to bundle changes on the Yjs model in a single transaction to - * minimize the number on messages sent and the number of observer calls. - * If possible the user of this library should bundle as many changes as - * possible. Here is an example to illustrate the advantages of bundling: - * - * @example - * const ydoc = new Y.Doc() - * const map = ydoc.getMap('map') - * // Log content when change is triggered - * map.observe(() => { - * console.log('change triggered') - * }) - * // Each change on the map type triggers a log message: - * map.set('a', 0) // => "change triggered" - * map.set('b', 0) // => "change triggered" - * // When put in a transaction, it will trigger the log after the transaction: - * ydoc.transact(() => { - * map.set('a', 1) - * map.set('b', 1) - * }) // => "change triggered" - * - * @public - */ -export class Transaction { - /** - * @param {Doc} doc - * @param {any} origin - * @param {boolean} local - */ - constructor (doc, origin, local) { - /** - * The Yjs instance. - * @type {Doc} - */ - this.doc = doc - /** - * Describes the set of deleted items by ids - * @type {DeleteSet} - */ - this.deleteSet = new DeleteSet() - /** - * Holds the state before the transaction started. - * @type {Map} - */ - this.beforeState = getStateVector(doc.store) - /** - * Holds the state after the transaction. - * @type {Map} - */ - this.afterState = new Map() - /** - * All types that were directly modified (property added or child - * inserted/deleted). New types are not included in this Set. - * Maps from type to parentSubs (`item.parentSub = null` for YArray) - * @type {Map>,Set>} - */ - this.changed = new Map() - /** - * Stores the events for the types that observe also child elements. - * It is mainly used by `observeDeep`. - * @type {Map>,Array>>} - */ - this.changedParentTypes = new Map() - /** - * @type {Array} - */ - this._mergeStructs = [] - /** - * @type {any} - */ - this.origin = origin - /** - * Stores meta information on the transaction - * @type {Map} - */ - this.meta = new Map() - /** - * Whether this change originates from this doc. - * @type {boolean} - */ - this.local = local - /** - * @type {Set} - */ - this.subdocsAdded = new Set() - /** - * @type {Set} - */ - this.subdocsRemoved = new Set() - /** - * @type {Set} - */ - this.subdocsLoaded = new Set() - /** - * @type {boolean} - */ - this._needFormattingCleanup = false - } -} - -/** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {Transaction} transaction - * @return {boolean} Whether data was written. - */ -export const writeUpdateMessageFromTransaction = (encoder, transaction) => { - if (transaction.deleteSet.clients.size === 0 && !map.any(transaction.afterState, (clock, client) => transaction.beforeState.get(client) !== clock)) { - return false - } - sortAndMergeDeleteSet(transaction.deleteSet) - writeStructsFromTransaction(encoder, transaction) - writeDeleteSet(encoder, transaction.deleteSet) - return true -} - -/** - * @param {Transaction} transaction - * - * @private - * @function - */ -export const nextID = transaction => { - const y = transaction.doc - return createID(y.clientID, getState(y.store, y.clientID)) -} - -/** - * If `type.parent` was added in current transaction, `type` technically - * did not change, it was just added and we should not fire events for `type`. - * - * @param {Transaction} transaction - * @param {AbstractType>} type - * @param {string|null} parentSub - */ -export const addChangedTypeToTransaction = (transaction, type, parentSub) => { - const item = type._item - if (item === null || (item.id.clock < (transaction.beforeState.get(item.id.client) || 0) && !item.deleted)) { - map.setIfUndefined(transaction.changed, type, set.create).add(parentSub) - } -} - -/** - * @param {Array} structs - * @param {number} pos - * @return {number} # of merged structs - */ -const tryToMergeWithLefts = (structs, pos) => { - let right = structs[pos] - let left = structs[pos - 1] - let i = pos - for (; i > 0; right = left, left = structs[--i - 1]) { - if (left.deleted === right.deleted && left.constructor === right.constructor) { - if (left.mergeWith(right)) { - if (right instanceof Item && right.parentSub !== null && /** @type {AbstractType} */ (right.parent)._map.get(right.parentSub) === right) { - /** @type {AbstractType} */ (right.parent)._map.set(right.parentSub, /** @type {Item} */ (left)) - } - continue - } - } - break - } - const merged = pos - i - if (merged) { - // remove all merged structs from the array - structs.splice(pos + 1 - merged, merged) - } - return merged -} - -/** - * @param {DeleteSet} ds - * @param {StructStore} store - * @param {function(Item):boolean} gcFilter - */ -const tryGcDeleteSet = (ds, store, gcFilter) => { - for (const [client, deleteItems] of ds.clients.entries()) { - const structs = /** @type {Array} */ (store.clients.get(client)) - for (let di = deleteItems.length - 1; di >= 0; di--) { - const deleteItem = deleteItems[di] - const endDeleteItemClock = deleteItem.clock + deleteItem.len - for ( - let si = findIndexSS(structs, deleteItem.clock), struct = structs[si]; - si < structs.length && struct.id.clock < endDeleteItemClock; - struct = structs[++si] - ) { - const struct = structs[si] - if (deleteItem.clock + deleteItem.len <= struct.id.clock) { - break - } - if (struct instanceof Item && struct.deleted && !struct.keep && gcFilter(struct)) { - struct.gc(store, false) - } - } - } - } -} - -/** - * @param {DeleteSet} ds - * @param {StructStore} store - */ -const tryMergeDeleteSet = (ds, store) => { - // try to merge deleted / gc'd items - // merge from right to left for better efficiency and so we don't miss any merge targets - ds.clients.forEach((deleteItems, client) => { - const structs = /** @type {Array} */ (store.clients.get(client)) - for (let di = deleteItems.length - 1; di >= 0; di--) { - const deleteItem = deleteItems[di] - // start with merging the item next to the last deleted item - const mostRightIndexToCheck = math.min(structs.length - 1, 1 + findIndexSS(structs, deleteItem.clock + deleteItem.len - 1)) - for ( - let si = mostRightIndexToCheck, struct = structs[si]; - si > 0 && struct.id.clock >= deleteItem.clock; - struct = structs[si] - ) { - si -= 1 + tryToMergeWithLefts(structs, si) - } - } - }) -} - -/** - * @param {DeleteSet} ds - * @param {StructStore} store - * @param {function(Item):boolean} gcFilter - */ -export const tryGc = (ds, store, gcFilter) => { - tryGcDeleteSet(ds, store, gcFilter) - tryMergeDeleteSet(ds, store) -} - -/** - * @param {Array} transactionCleanups - * @param {number} i - */ -const cleanupTransactions = (transactionCleanups, i) => { - if (i < transactionCleanups.length) { - const transaction = transactionCleanups[i] - const doc = transaction.doc - const store = doc.store - const ds = transaction.deleteSet - const mergeStructs = transaction._mergeStructs - try { - sortAndMergeDeleteSet(ds) - transaction.afterState = getStateVector(transaction.doc.store) - doc.emit('beforeObserverCalls', [transaction, doc]) - /** - * An array of event callbacks. - * - * Each callback is called even if the other ones throw errors. - * - * @type {Array} - */ - const fs = [] - // observe events on changed types - transaction.changed.forEach((subs, itemtype) => - fs.push(() => { - if (itemtype._item === null || !itemtype._item.deleted) { - itemtype._callObserver(transaction, subs) - } - }) - ) - fs.push(() => { - // deep observe events - transaction.changedParentTypes.forEach((events, type) => { - // We need to think about the possibility that the user transforms the - // Y.Doc in the event. - if (type._dEH.l.length > 0 && (type._item === null || !type._item.deleted)) { - events = events - .filter(event => - event.target._item === null || !event.target._item.deleted - ) - events - .forEach(event => { - event.currentTarget = type - // path is relative to the current target - event._path = null - }) - // sort events by path length so that top-level events are fired first. - events - .sort((event1, event2) => event1.path.length - event2.path.length) - fs.push(() => { - // We don't need to check for events.length - // because we know it has at least one element - callEventHandlerListeners(type._dEH, events, transaction) - }) - } - }) - fs.push(() => doc.emit('afterTransaction', [transaction, doc])) - fs.push(() => { - if (transaction._needFormattingCleanup) { - cleanupYTextAfterTransaction(transaction) - } - }) - }) - callAll(fs, []) - } finally { - // Replace deleted items with ItemDeleted / GC. - // This is where content is actually remove from the Yjs Doc. - if (doc.gc) { - tryGcDeleteSet(ds, store, doc.gcFilter) - } - tryMergeDeleteSet(ds, store) - - // on all affected store.clients props, try to merge - transaction.afterState.forEach((clock, client) => { - const beforeClock = transaction.beforeState.get(client) || 0 - if (beforeClock !== clock) { - const structs = /** @type {Array} */ (store.clients.get(client)) - // we iterate from right to left so we can safely remove entries - const firstChangePos = math.max(findIndexSS(structs, beforeClock), 1) - for (let i = structs.length - 1; i >= firstChangePos;) { - i -= 1 + tryToMergeWithLefts(structs, i) - } - } - }) - // try to merge mergeStructs - // @todo: it makes more sense to transform mergeStructs to a DS, sort it, and merge from right to left - // but at the moment DS does not handle duplicates - for (let i = mergeStructs.length - 1; i >= 0; i--) { - const { client, clock } = mergeStructs[i].id - const structs = /** @type {Array} */ (store.clients.get(client)) - const replacedStructPos = findIndexSS(structs, clock) - if (replacedStructPos + 1 < structs.length) { - if (tryToMergeWithLefts(structs, replacedStructPos + 1) > 1) { - continue // no need to perform next check, both are already merged - } - } - if (replacedStructPos > 0) { - tryToMergeWithLefts(structs, replacedStructPos) - } - } - if (!transaction.local && transaction.afterState.get(doc.clientID) !== transaction.beforeState.get(doc.clientID)) { - logging.print(logging.ORANGE, logging.BOLD, '[yjs] ', logging.UNBOLD, logging.RED, 'Changed the client-id because another client seems to be using it.') - doc.clientID = generateNewClientId() - } - // @todo Merge all the transactions into one and provide send the data as a single update message - doc.emit('afterTransactionCleanup', [transaction, doc]) - if (doc._observers.has('update')) { - const encoder = new UpdateEncoderV1() - const hasContent = writeUpdateMessageFromTransaction(encoder, transaction) - if (hasContent) { - doc.emit('update', [encoder.toUint8Array(), transaction.origin, doc, transaction]) - } - } - if (doc._observers.has('updateV2')) { - const encoder = new UpdateEncoderV2() - const hasContent = writeUpdateMessageFromTransaction(encoder, transaction) - if (hasContent) { - doc.emit('updateV2', [encoder.toUint8Array(), transaction.origin, doc, transaction]) - } - } - const { subdocsAdded, subdocsLoaded, subdocsRemoved } = transaction - if (subdocsAdded.size > 0 || subdocsRemoved.size > 0 || subdocsLoaded.size > 0) { - subdocsAdded.forEach(subdoc => { - subdoc.clientID = doc.clientID - if (subdoc.collectionid == null) { - subdoc.collectionid = doc.collectionid - } - doc.subdocs.add(subdoc) - }) - subdocsRemoved.forEach(subdoc => doc.subdocs.delete(subdoc)) - doc.emit('subdocs', [{ loaded: subdocsLoaded, added: subdocsAdded, removed: subdocsRemoved }, doc, transaction]) - subdocsRemoved.forEach(subdoc => subdoc.destroy()) - } - - if (transactionCleanups.length <= i + 1) { - doc._transactionCleanups = [] - doc.emit('afterAllTransactions', [doc, transactionCleanups]) - } else { - cleanupTransactions(transactionCleanups, i + 1) - } - } - } -} - -/** - * Implements the functionality of `y.transact(()=>{..})` - * - * @template T - * @param {Doc} doc - * @param {function(Transaction):T} f - * @param {any} [origin=true] - * @return {T} - * - * @function - */ -export const transact = (doc, f, origin = null, local = true) => { - const transactionCleanups = doc._transactionCleanups - let initialCall = false - /** - * @type {any} - */ - let result = null - if (doc._transaction === null) { - initialCall = true - doc._transaction = new Transaction(doc, origin, local) - transactionCleanups.push(doc._transaction) - if (transactionCleanups.length === 1) { - doc.emit('beforeAllTransactions', [doc]) - } - doc.emit('beforeTransaction', [doc._transaction, doc]) - } - try { - result = f(doc._transaction) - } finally { - if (initialCall) { - const finishCleanup = doc._transaction === transactionCleanups[0] - doc._transaction = null - if (finishCleanup) { - // The first transaction ended, now process observer calls. - // Observer call may create new transactions for which we need to call the observers and do cleanup. - // We don't want to nest these calls, so we execute these calls one after - // another. - // Also we need to ensure that all cleanups are called, even if the - // observes throw errors. - // This file is full of hacky try {} finally {} blocks to ensure that an - // event can throw errors and also that the cleanup is called. - cleanupTransactions(transactionCleanups, 0) - } - } - } - return result -} diff --git a/yjs-poll/node_modules/yjs/src/utils/UndoManager.js b/yjs-poll/node_modules/yjs/src/utils/UndoManager.js deleted file mode 100644 index 98410e4..0000000 --- a/yjs-poll/node_modules/yjs/src/utils/UndoManager.js +++ /dev/null @@ -1,400 +0,0 @@ -import { - mergeDeleteSets, - iterateDeletedStructs, - keepItem, - transact, - createID, - redoItem, - isParentOf, - followRedone, - getItemCleanStart, - isDeleted, - addToDeleteSet, - YEvent, Transaction, Doc, Item, GC, DeleteSet, AbstractType // eslint-disable-line -} from '../internals.js' - -import * as time from 'lib0/time' -import * as array from 'lib0/array' -import * as logging from 'lib0/logging' -import { ObservableV2 } from 'lib0/observable' - -export class StackItem { - /** - * @param {DeleteSet} deletions - * @param {DeleteSet} insertions - */ - constructor (deletions, insertions) { - this.insertions = insertions - this.deletions = deletions - /** - * Use this to save and restore metadata like selection range - */ - this.meta = new Map() - } -} -/** - * @param {Transaction} tr - * @param {UndoManager} um - * @param {StackItem} stackItem - */ -const clearUndoManagerStackItem = (tr, um, stackItem) => { - iterateDeletedStructs(tr, stackItem.deletions, item => { - if (item instanceof Item && um.scope.some(type => type === tr.doc || isParentOf(/** @type {AbstractType} */ (type), item))) { - keepItem(item, false) - } - }) -} - -/** - * @param {UndoManager} undoManager - * @param {Array} stack - * @param {'undo'|'redo'} eventType - * @return {StackItem?} - */ -const popStackItem = (undoManager, stack, eventType) => { - /** - * Keep a reference to the transaction so we can fire the event with the changedParentTypes - * @type {any} - */ - let _tr = null - const doc = undoManager.doc - const scope = undoManager.scope - transact(doc, transaction => { - while (stack.length > 0 && undoManager.currStackItem === null) { - const store = doc.store - const stackItem = /** @type {StackItem} */ (stack.pop()) - /** - * @type {Set} - */ - const itemsToRedo = new Set() - /** - * @type {Array} - */ - const itemsToDelete = [] - let performedChange = false - iterateDeletedStructs(transaction, stackItem.insertions, struct => { - if (struct instanceof Item) { - if (struct.redone !== null) { - let { item, diff } = followRedone(store, struct.id) - if (diff > 0) { - item = getItemCleanStart(transaction, createID(item.id.client, item.id.clock + diff)) - } - struct = item - } - if (!struct.deleted && scope.some(type => type === transaction.doc || isParentOf(/** @type {AbstractType} */ (type), /** @type {Item} */ (struct)))) { - itemsToDelete.push(struct) - } - } - }) - iterateDeletedStructs(transaction, stackItem.deletions, struct => { - if ( - struct instanceof Item && - scope.some(type => type === transaction.doc || isParentOf(/** @type {AbstractType} */ (type), struct)) && - // Never redo structs in stackItem.insertions because they were created and deleted in the same capture interval. - !isDeleted(stackItem.insertions, struct.id) - ) { - itemsToRedo.add(struct) - } - }) - itemsToRedo.forEach(struct => { - performedChange = redoItem(transaction, struct, itemsToRedo, stackItem.insertions, undoManager.ignoreRemoteMapChanges, undoManager) !== null || performedChange - }) - // We want to delete in reverse order so that children are deleted before - // parents, so we have more information available when items are filtered. - for (let i = itemsToDelete.length - 1; i >= 0; i--) { - const item = itemsToDelete[i] - if (undoManager.deleteFilter(item)) { - item.delete(transaction) - performedChange = true - } - } - undoManager.currStackItem = performedChange ? stackItem : null - } - transaction.changed.forEach((subProps, type) => { - // destroy search marker if necessary - if (subProps.has(null) && type._searchMarker) { - type._searchMarker.length = 0 - } - }) - _tr = transaction - }, undoManager) - const res = undoManager.currStackItem - if (res != null) { - const changedParentTypes = _tr.changedParentTypes - undoManager.emit('stack-item-popped', [{ stackItem: res, type: eventType, changedParentTypes, origin: undoManager }, undoManager]) - undoManager.currStackItem = null - } - return res -} - -/** - * @typedef {Object} UndoManagerOptions - * @property {number} [UndoManagerOptions.captureTimeout=500] - * @property {function(Transaction):boolean} [UndoManagerOptions.captureTransaction] Do not capture changes of a Transaction if result false. - * @property {function(Item):boolean} [UndoManagerOptions.deleteFilter=()=>true] Sometimes - * it is necessary to filter what an Undo/Redo operation can delete. If this - * filter returns false, the type/item won't be deleted even it is in the - * undo/redo scope. - * @property {Set} [UndoManagerOptions.trackedOrigins=new Set([null])] - * @property {boolean} [ignoreRemoteMapChanges] Experimental. By default, the UndoManager will never overwrite remote changes. Enable this property to enable overwriting remote changes on key-value changes (Y.Map, properties on Y.Xml, etc..). - * @property {Doc} [doc] The document that this UndoManager operates on. Only needed if typeScope is empty. - */ - -/** - * @typedef {Object} StackItemEvent - * @property {StackItem} StackItemEvent.stackItem - * @property {any} StackItemEvent.origin - * @property {'undo'|'redo'} StackItemEvent.type - * @property {Map>,Array>>} StackItemEvent.changedParentTypes - */ - -/** - * Fires 'stack-item-added' event when a stack item was added to either the undo- or - * the redo-stack. You may store additional stack information via the - * metadata property on `event.stackItem.meta` (it is a `Map` of metadata properties). - * Fires 'stack-item-popped' event when a stack item was popped from either the - * undo- or the redo-stack. You may restore the saved stack information from `event.stackItem.meta`. - * - * @extends {ObservableV2<{'stack-item-added':function(StackItemEvent, UndoManager):void, 'stack-item-popped': function(StackItemEvent, UndoManager):void, 'stack-cleared': function({ undoStackCleared: boolean, redoStackCleared: boolean }):void, 'stack-item-updated': function(StackItemEvent, UndoManager):void }>} - */ -export class UndoManager extends ObservableV2 { - /** - * @param {Doc|AbstractType|Array>} typeScope Limits the scope of the UndoManager. If this is set to a ydoc instance, all changes on that ydoc will be undone. If set to a specific type, only changes on that type or its children will be undone. Also accepts an array of types. - * @param {UndoManagerOptions} options - */ - constructor (typeScope, { - captureTimeout = 500, - captureTransaction = _tr => true, - deleteFilter = () => true, - trackedOrigins = new Set([null]), - ignoreRemoteMapChanges = false, - doc = /** @type {Doc} */ (array.isArray(typeScope) ? typeScope[0].doc : typeScope instanceof Doc ? typeScope : typeScope.doc) - } = {}) { - super() - /** - * @type {Array | Doc>} - */ - this.scope = [] - this.doc = doc - this.addToScope(typeScope) - this.deleteFilter = deleteFilter - trackedOrigins.add(this) - this.trackedOrigins = trackedOrigins - this.captureTransaction = captureTransaction - /** - * @type {Array} - */ - this.undoStack = [] - /** - * @type {Array} - */ - this.redoStack = [] - /** - * Whether the client is currently undoing (calling UndoManager.undo) - * - * @type {boolean} - */ - this.undoing = false - this.redoing = false - /** - * The currently popped stack item if UndoManager.undoing or UndoManager.redoing - * - * @type {StackItem|null} - */ - this.currStackItem = null - this.lastChange = 0 - this.ignoreRemoteMapChanges = ignoreRemoteMapChanges - this.captureTimeout = captureTimeout - /** - * @param {Transaction} transaction - */ - this.afterTransactionHandler = transaction => { - // Only track certain transactions - if ( - !this.captureTransaction(transaction) || - !this.scope.some(type => transaction.changedParentTypes.has(/** @type {AbstractType} */ (type)) || type === this.doc) || - (!this.trackedOrigins.has(transaction.origin) && (!transaction.origin || !this.trackedOrigins.has(transaction.origin.constructor))) - ) { - return - } - const undoing = this.undoing - const redoing = this.redoing - const stack = undoing ? this.redoStack : this.undoStack - if (undoing) { - this.stopCapturing() // next undo should not be appended to last stack item - } else if (!redoing) { - // neither undoing nor redoing: delete redoStack - this.clear(false, true) - } - const insertions = new DeleteSet() - transaction.afterState.forEach((endClock, client) => { - const startClock = transaction.beforeState.get(client) || 0 - const len = endClock - startClock - if (len > 0) { - addToDeleteSet(insertions, client, startClock, len) - } - }) - const now = time.getUnixTime() - let didAdd = false - if (this.lastChange > 0 && now - this.lastChange < this.captureTimeout && stack.length > 0 && !undoing && !redoing) { - // append change to last stack op - const lastOp = stack[stack.length - 1] - lastOp.deletions = mergeDeleteSets([lastOp.deletions, transaction.deleteSet]) - lastOp.insertions = mergeDeleteSets([lastOp.insertions, insertions]) - } else { - // create a new stack op - stack.push(new StackItem(transaction.deleteSet, insertions)) - didAdd = true - } - if (!undoing && !redoing) { - this.lastChange = now - } - // make sure that deleted structs are not gc'd - iterateDeletedStructs(transaction, transaction.deleteSet, /** @param {Item|GC} item */ item => { - if (item instanceof Item && this.scope.some(type => type === transaction.doc || isParentOf(/** @type {AbstractType} */ (type), item))) { - keepItem(item, true) - } - }) - /** - * @type {[StackItemEvent, UndoManager]} - */ - const changeEvent = [{ stackItem: stack[stack.length - 1], origin: transaction.origin, type: undoing ? 'redo' : 'undo', changedParentTypes: transaction.changedParentTypes }, this] - if (didAdd) { - this.emit('stack-item-added', changeEvent) - } else { - this.emit('stack-item-updated', changeEvent) - } - } - this.doc.on('afterTransaction', this.afterTransactionHandler) - this.doc.on('destroy', () => { - this.destroy() - }) - } - - /** - * Extend the scope. - * - * @param {Array | Doc> | AbstractType | Doc} ytypes - */ - addToScope (ytypes) { - const tmpSet = new Set(this.scope) - ytypes = array.isArray(ytypes) ? ytypes : [ytypes] - ytypes.forEach(ytype => { - if (!tmpSet.has(ytype)) { - tmpSet.add(ytype) - if (ytype instanceof AbstractType ? ytype.doc !== this.doc : ytype !== this.doc) logging.warn('[yjs#509] Not same Y.Doc') // use MultiDocUndoManager instead. also see https://github.com/yjs/yjs/issues/509 - this.scope.push(ytype) - } - }) - } - - /** - * @param {any} origin - */ - addTrackedOrigin (origin) { - this.trackedOrigins.add(origin) - } - - /** - * @param {any} origin - */ - removeTrackedOrigin (origin) { - this.trackedOrigins.delete(origin) - } - - clear (clearUndoStack = true, clearRedoStack = true) { - if ((clearUndoStack && this.canUndo()) || (clearRedoStack && this.canRedo())) { - this.doc.transact(tr => { - if (clearUndoStack) { - this.undoStack.forEach(item => clearUndoManagerStackItem(tr, this, item)) - this.undoStack = [] - } - if (clearRedoStack) { - this.redoStack.forEach(item => clearUndoManagerStackItem(tr, this, item)) - this.redoStack = [] - } - this.emit('stack-cleared', [{ undoStackCleared: clearUndoStack, redoStackCleared: clearRedoStack }]) - }) - } - } - - /** - * UndoManager merges Undo-StackItem if they are created within time-gap - * smaller than `options.captureTimeout`. Call `um.stopCapturing()` so that the next - * StackItem won't be merged. - * - * - * @example - * // without stopCapturing - * ytext.insert(0, 'a') - * ytext.insert(1, 'b') - * um.undo() - * ytext.toString() // => '' (note that 'ab' was removed) - * // with stopCapturing - * ytext.insert(0, 'a') - * um.stopCapturing() - * ytext.insert(0, 'b') - * um.undo() - * ytext.toString() // => 'a' (note that only 'b' was removed) - * - */ - stopCapturing () { - this.lastChange = 0 - } - - /** - * Undo last changes on type. - * - * @return {StackItem?} Returns StackItem if a change was applied - */ - undo () { - this.undoing = true - let res - try { - res = popStackItem(this, this.undoStack, 'undo') - } finally { - this.undoing = false - } - return res - } - - /** - * Redo last undo operation. - * - * @return {StackItem?} Returns StackItem if a change was applied - */ - redo () { - this.redoing = true - let res - try { - res = popStackItem(this, this.redoStack, 'redo') - } finally { - this.redoing = false - } - return res - } - - /** - * Are undo steps available? - * - * @return {boolean} `true` if undo is possible - */ - canUndo () { - return this.undoStack.length > 0 - } - - /** - * Are redo steps available? - * - * @return {boolean} `true` if redo is possible - */ - canRedo () { - return this.redoStack.length > 0 - } - - destroy () { - this.trackedOrigins.delete(this) - this.doc.off('afterTransaction', this.afterTransactionHandler) - super.destroy() - } -} diff --git a/yjs-poll/node_modules/yjs/src/utils/UpdateDecoder.js b/yjs-poll/node_modules/yjs/src/utils/UpdateDecoder.js deleted file mode 100644 index 67a38ce..0000000 --- a/yjs-poll/node_modules/yjs/src/utils/UpdateDecoder.js +++ /dev/null @@ -1,281 +0,0 @@ -import * as buffer from 'lib0/buffer' -import * as decoding from 'lib0/decoding' -import { - ID, createID -} from '../internals.js' - -export class DSDecoderV1 { - /** - * @param {decoding.Decoder} decoder - */ - constructor (decoder) { - this.restDecoder = decoder - } - - resetDsCurVal () { - // nop - } - - /** - * @return {number} - */ - readDsClock () { - return decoding.readVarUint(this.restDecoder) - } - - /** - * @return {number} - */ - readDsLen () { - return decoding.readVarUint(this.restDecoder) - } -} - -export class UpdateDecoderV1 extends DSDecoderV1 { - /** - * @return {ID} - */ - readLeftID () { - return createID(decoding.readVarUint(this.restDecoder), decoding.readVarUint(this.restDecoder)) - } - - /** - * @return {ID} - */ - readRightID () { - return createID(decoding.readVarUint(this.restDecoder), decoding.readVarUint(this.restDecoder)) - } - - /** - * Read the next client id. - * Use this in favor of readID whenever possible to reduce the number of objects created. - */ - readClient () { - return decoding.readVarUint(this.restDecoder) - } - - /** - * @return {number} info An unsigned 8-bit integer - */ - readInfo () { - return decoding.readUint8(this.restDecoder) - } - - /** - * @return {string} - */ - readString () { - return decoding.readVarString(this.restDecoder) - } - - /** - * @return {boolean} isKey - */ - readParentInfo () { - return decoding.readVarUint(this.restDecoder) === 1 - } - - /** - * @return {number} info An unsigned 8-bit integer - */ - readTypeRef () { - return decoding.readVarUint(this.restDecoder) - } - - /** - * Write len of a struct - well suited for Opt RLE encoder. - * - * @return {number} len - */ - readLen () { - return decoding.readVarUint(this.restDecoder) - } - - /** - * @return {any} - */ - readAny () { - return decoding.readAny(this.restDecoder) - } - - /** - * @return {Uint8Array} - */ - readBuf () { - return buffer.copyUint8Array(decoding.readVarUint8Array(this.restDecoder)) - } - - /** - * Legacy implementation uses JSON parse. We use any-decoding in v2. - * - * @return {any} - */ - readJSON () { - return JSON.parse(decoding.readVarString(this.restDecoder)) - } - - /** - * @return {string} - */ - readKey () { - return decoding.readVarString(this.restDecoder) - } -} - -export class DSDecoderV2 { - /** - * @param {decoding.Decoder} decoder - */ - constructor (decoder) { - /** - * @private - */ - this.dsCurrVal = 0 - this.restDecoder = decoder - } - - resetDsCurVal () { - this.dsCurrVal = 0 - } - - /** - * @return {number} - */ - readDsClock () { - this.dsCurrVal += decoding.readVarUint(this.restDecoder) - return this.dsCurrVal - } - - /** - * @return {number} - */ - readDsLen () { - const diff = decoding.readVarUint(this.restDecoder) + 1 - this.dsCurrVal += diff - return diff - } -} - -export class UpdateDecoderV2 extends DSDecoderV2 { - /** - * @param {decoding.Decoder} decoder - */ - constructor (decoder) { - super(decoder) - /** - * List of cached keys. If the keys[id] does not exist, we read a new key - * from stringEncoder and push it to keys. - * - * @type {Array} - */ - this.keys = [] - decoding.readVarUint(decoder) // read feature flag - currently unused - this.keyClockDecoder = new decoding.IntDiffOptRleDecoder(decoding.readVarUint8Array(decoder)) - this.clientDecoder = new decoding.UintOptRleDecoder(decoding.readVarUint8Array(decoder)) - this.leftClockDecoder = new decoding.IntDiffOptRleDecoder(decoding.readVarUint8Array(decoder)) - this.rightClockDecoder = new decoding.IntDiffOptRleDecoder(decoding.readVarUint8Array(decoder)) - this.infoDecoder = new decoding.RleDecoder(decoding.readVarUint8Array(decoder), decoding.readUint8) - this.stringDecoder = new decoding.StringDecoder(decoding.readVarUint8Array(decoder)) - this.parentInfoDecoder = new decoding.RleDecoder(decoding.readVarUint8Array(decoder), decoding.readUint8) - this.typeRefDecoder = new decoding.UintOptRleDecoder(decoding.readVarUint8Array(decoder)) - this.lenDecoder = new decoding.UintOptRleDecoder(decoding.readVarUint8Array(decoder)) - } - - /** - * @return {ID} - */ - readLeftID () { - return new ID(this.clientDecoder.read(), this.leftClockDecoder.read()) - } - - /** - * @return {ID} - */ - readRightID () { - return new ID(this.clientDecoder.read(), this.rightClockDecoder.read()) - } - - /** - * Read the next client id. - * Use this in favor of readID whenever possible to reduce the number of objects created. - */ - readClient () { - return this.clientDecoder.read() - } - - /** - * @return {number} info An unsigned 8-bit integer - */ - readInfo () { - return /** @type {number} */ (this.infoDecoder.read()) - } - - /** - * @return {string} - */ - readString () { - return this.stringDecoder.read() - } - - /** - * @return {boolean} - */ - readParentInfo () { - return this.parentInfoDecoder.read() === 1 - } - - /** - * @return {number} An unsigned 8-bit integer - */ - readTypeRef () { - return this.typeRefDecoder.read() - } - - /** - * Write len of a struct - well suited for Opt RLE encoder. - * - * @return {number} - */ - readLen () { - return this.lenDecoder.read() - } - - /** - * @return {any} - */ - readAny () { - return decoding.readAny(this.restDecoder) - } - - /** - * @return {Uint8Array} - */ - readBuf () { - return decoding.readVarUint8Array(this.restDecoder) - } - - /** - * This is mainly here for legacy purposes. - * - * Initial we incoded objects using JSON. Now we use the much faster lib0/any-encoder. This method mainly exists for legacy purposes for the v1 encoder. - * - * @return {any} - */ - readJSON () { - return decoding.readAny(this.restDecoder) - } - - /** - * @return {string} - */ - readKey () { - const keyClock = this.keyClockDecoder.read() - if (keyClock < this.keys.length) { - return this.keys[keyClock] - } else { - const key = this.stringDecoder.read() - this.keys.push(key) - return key - } - } -} diff --git a/yjs-poll/node_modules/yjs/src/utils/UpdateEncoder.js b/yjs-poll/node_modules/yjs/src/utils/UpdateEncoder.js deleted file mode 100644 index 2b742be..0000000 --- a/yjs-poll/node_modules/yjs/src/utils/UpdateEncoder.js +++ /dev/null @@ -1,320 +0,0 @@ -import * as error from 'lib0/error' -import * as encoding from 'lib0/encoding' - -import { - ID // eslint-disable-line -} from '../internals.js' - -export class DSEncoderV1 { - constructor () { - this.restEncoder = encoding.createEncoder() - } - - toUint8Array () { - return encoding.toUint8Array(this.restEncoder) - } - - resetDsCurVal () { - // nop - } - - /** - * @param {number} clock - */ - writeDsClock (clock) { - encoding.writeVarUint(this.restEncoder, clock) - } - - /** - * @param {number} len - */ - writeDsLen (len) { - encoding.writeVarUint(this.restEncoder, len) - } -} - -export class UpdateEncoderV1 extends DSEncoderV1 { - /** - * @param {ID} id - */ - writeLeftID (id) { - encoding.writeVarUint(this.restEncoder, id.client) - encoding.writeVarUint(this.restEncoder, id.clock) - } - - /** - * @param {ID} id - */ - writeRightID (id) { - encoding.writeVarUint(this.restEncoder, id.client) - encoding.writeVarUint(this.restEncoder, id.clock) - } - - /** - * Use writeClient and writeClock instead of writeID if possible. - * @param {number} client - */ - writeClient (client) { - encoding.writeVarUint(this.restEncoder, client) - } - - /** - * @param {number} info An unsigned 8-bit integer - */ - writeInfo (info) { - encoding.writeUint8(this.restEncoder, info) - } - - /** - * @param {string} s - */ - writeString (s) { - encoding.writeVarString(this.restEncoder, s) - } - - /** - * @param {boolean} isYKey - */ - writeParentInfo (isYKey) { - encoding.writeVarUint(this.restEncoder, isYKey ? 1 : 0) - } - - /** - * @param {number} info An unsigned 8-bit integer - */ - writeTypeRef (info) { - encoding.writeVarUint(this.restEncoder, info) - } - - /** - * Write len of a struct - well suited for Opt RLE encoder. - * - * @param {number} len - */ - writeLen (len) { - encoding.writeVarUint(this.restEncoder, len) - } - - /** - * @param {any} any - */ - writeAny (any) { - encoding.writeAny(this.restEncoder, any) - } - - /** - * @param {Uint8Array} buf - */ - writeBuf (buf) { - encoding.writeVarUint8Array(this.restEncoder, buf) - } - - /** - * @param {any} embed - */ - writeJSON (embed) { - encoding.writeVarString(this.restEncoder, JSON.stringify(embed)) - } - - /** - * @param {string} key - */ - writeKey (key) { - encoding.writeVarString(this.restEncoder, key) - } -} - -export class DSEncoderV2 { - constructor () { - this.restEncoder = encoding.createEncoder() // encodes all the rest / non-optimized - this.dsCurrVal = 0 - } - - toUint8Array () { - return encoding.toUint8Array(this.restEncoder) - } - - resetDsCurVal () { - this.dsCurrVal = 0 - } - - /** - * @param {number} clock - */ - writeDsClock (clock) { - const diff = clock - this.dsCurrVal - this.dsCurrVal = clock - encoding.writeVarUint(this.restEncoder, diff) - } - - /** - * @param {number} len - */ - writeDsLen (len) { - if (len === 0) { - error.unexpectedCase() - } - encoding.writeVarUint(this.restEncoder, len - 1) - this.dsCurrVal += len - } -} - -export class UpdateEncoderV2 extends DSEncoderV2 { - constructor () { - super() - /** - * @type {Map} - */ - this.keyMap = new Map() - /** - * Refers to the next unique key-identifier to me used. - * See writeKey method for more information. - * - * @type {number} - */ - this.keyClock = 0 - this.keyClockEncoder = new encoding.IntDiffOptRleEncoder() - this.clientEncoder = new encoding.UintOptRleEncoder() - this.leftClockEncoder = new encoding.IntDiffOptRleEncoder() - this.rightClockEncoder = new encoding.IntDiffOptRleEncoder() - this.infoEncoder = new encoding.RleEncoder(encoding.writeUint8) - this.stringEncoder = new encoding.StringEncoder() - this.parentInfoEncoder = new encoding.RleEncoder(encoding.writeUint8) - this.typeRefEncoder = new encoding.UintOptRleEncoder() - this.lenEncoder = new encoding.UintOptRleEncoder() - } - - toUint8Array () { - const encoder = encoding.createEncoder() - encoding.writeVarUint(encoder, 0) // this is a feature flag that we might use in the future - encoding.writeVarUint8Array(encoder, this.keyClockEncoder.toUint8Array()) - encoding.writeVarUint8Array(encoder, this.clientEncoder.toUint8Array()) - encoding.writeVarUint8Array(encoder, this.leftClockEncoder.toUint8Array()) - encoding.writeVarUint8Array(encoder, this.rightClockEncoder.toUint8Array()) - encoding.writeVarUint8Array(encoder, encoding.toUint8Array(this.infoEncoder)) - encoding.writeVarUint8Array(encoder, this.stringEncoder.toUint8Array()) - encoding.writeVarUint8Array(encoder, encoding.toUint8Array(this.parentInfoEncoder)) - encoding.writeVarUint8Array(encoder, this.typeRefEncoder.toUint8Array()) - encoding.writeVarUint8Array(encoder, this.lenEncoder.toUint8Array()) - // @note The rest encoder is appended! (note the missing var) - encoding.writeUint8Array(encoder, encoding.toUint8Array(this.restEncoder)) - return encoding.toUint8Array(encoder) - } - - /** - * @param {ID} id - */ - writeLeftID (id) { - this.clientEncoder.write(id.client) - this.leftClockEncoder.write(id.clock) - } - - /** - * @param {ID} id - */ - writeRightID (id) { - this.clientEncoder.write(id.client) - this.rightClockEncoder.write(id.clock) - } - - /** - * @param {number} client - */ - writeClient (client) { - this.clientEncoder.write(client) - } - - /** - * @param {number} info An unsigned 8-bit integer - */ - writeInfo (info) { - this.infoEncoder.write(info) - } - - /** - * @param {string} s - */ - writeString (s) { - this.stringEncoder.write(s) - } - - /** - * @param {boolean} isYKey - */ - writeParentInfo (isYKey) { - this.parentInfoEncoder.write(isYKey ? 1 : 0) - } - - /** - * @param {number} info An unsigned 8-bit integer - */ - writeTypeRef (info) { - this.typeRefEncoder.write(info) - } - - /** - * Write len of a struct - well suited for Opt RLE encoder. - * - * @param {number} len - */ - writeLen (len) { - this.lenEncoder.write(len) - } - - /** - * @param {any} any - */ - writeAny (any) { - encoding.writeAny(this.restEncoder, any) - } - - /** - * @param {Uint8Array} buf - */ - writeBuf (buf) { - encoding.writeVarUint8Array(this.restEncoder, buf) - } - - /** - * This is mainly here for legacy purposes. - * - * Initial we incoded objects using JSON. Now we use the much faster lib0/any-encoder. This method mainly exists for legacy purposes for the v1 encoder. - * - * @param {any} embed - */ - writeJSON (embed) { - encoding.writeAny(this.restEncoder, embed) - } - - /** - * Property keys are often reused. For example, in y-prosemirror the key `bold` might - * occur very often. For a 3d application, the key `position` might occur very often. - * - * We cache these keys in a Map and refer to them via a unique number. - * - * @param {string} key - */ - writeKey (key) { - const clock = this.keyMap.get(key) - if (clock === undefined) { - /** - * @todo uncomment to introduce this feature finally - * - * Background. The ContentFormat object was always encoded using writeKey, but the decoder used to use readString. - * Furthermore, I forgot to set the keyclock. So everything was working fine. - * - * However, this feature here is basically useless as it is not being used (it actually only consumes extra memory). - * - * I don't know yet how to reintroduce this feature.. - * - * Older clients won't be able to read updates when we reintroduce this feature. So this should probably be done using a flag. - * - */ - // this.keyMap.set(key, this.keyClock) - this.keyClockEncoder.write(this.keyClock++) - this.stringEncoder.write(key) - } else { - this.keyClockEncoder.write(clock) - } - } -} diff --git a/yjs-poll/node_modules/yjs/src/utils/YEvent.js b/yjs-poll/node_modules/yjs/src/utils/YEvent.js deleted file mode 100644 index 61bc284..0000000 --- a/yjs-poll/node_modules/yjs/src/utils/YEvent.js +++ /dev/null @@ -1,277 +0,0 @@ -import { - isDeleted, - Item, AbstractType, Transaction, AbstractStruct // eslint-disable-line -} from '../internals.js' - -import * as set from 'lib0/set' -import * as array from 'lib0/array' -import * as error from 'lib0/error' - -const errorComputeChanges = 'You must not compute changes after the event-handler fired.' - -/** - * @template {AbstractType} T - * YEvent describes the changes on a YType. - */ -export class YEvent { - /** - * @param {T} target The changed type. - * @param {Transaction} transaction - */ - constructor (target, transaction) { - /** - * The type on which this event was created on. - * @type {T} - */ - this.target = target - /** - * The current target on which the observe callback is called. - * @type {AbstractType} - */ - this.currentTarget = target - /** - * The transaction that triggered this event. - * @type {Transaction} - */ - this.transaction = transaction - /** - * @type {Object|null} - */ - this._changes = null - /** - * @type {null | Map} - */ - this._keys = null - /** - * @type {null | Array<{ insert?: string | Array | object | AbstractType, retain?: number, delete?: number, attributes?: Object }>} - */ - this._delta = null - /** - * @type {Array|null} - */ - this._path = null - } - - /** - * Computes the path from `y` to the changed type. - * - * @todo v14 should standardize on path: Array<{parent, index}> because that is easier to work with. - * - * The following property holds: - * @example - * let type = y - * event.path.forEach(dir => { - * type = type.get(dir) - * }) - * type === event.target // => true - */ - get path () { - return this._path || (this._path = getPathTo(this.currentTarget, this.target)) - } - - /** - * Check if a struct is deleted by this event. - * - * In contrast to change.deleted, this method also returns true if the struct was added and then deleted. - * - * @param {AbstractStruct} struct - * @return {boolean} - */ - deletes (struct) { - return isDeleted(this.transaction.deleteSet, struct.id) - } - - /** - * @type {Map} - */ - get keys () { - if (this._keys === null) { - if (this.transaction.doc._transactionCleanups.length === 0) { - throw error.create(errorComputeChanges) - } - const keys = new Map() - const target = this.target - const changed = /** @type Set */ (this.transaction.changed.get(target)) - changed.forEach(key => { - if (key !== null) { - const item = /** @type {Item} */ (target._map.get(key)) - /** - * @type {'delete' | 'add' | 'update'} - */ - let action - let oldValue - if (this.adds(item)) { - let prev = item.left - while (prev !== null && this.adds(prev)) { - prev = prev.left - } - if (this.deletes(item)) { - if (prev !== null && this.deletes(prev)) { - action = 'delete' - oldValue = array.last(prev.content.getContent()) - } else { - return - } - } else { - if (prev !== null && this.deletes(prev)) { - action = 'update' - oldValue = array.last(prev.content.getContent()) - } else { - action = 'add' - oldValue = undefined - } - } - } else { - if (this.deletes(item)) { - action = 'delete' - oldValue = array.last(/** @type {Item} */ item.content.getContent()) - } else { - return // nop - } - } - keys.set(key, { action, oldValue }) - } - }) - this._keys = keys - } - return this._keys - } - - /** - * This is a computed property. Note that this can only be safely computed during the - * event call. Computing this property after other changes happened might result in - * unexpected behavior (incorrect computation of deltas). A safe way to collect changes - * is to store the `changes` or the `delta` object. Avoid storing the `transaction` object. - * - * @type {Array<{insert?: string | Array | object | AbstractType, retain?: number, delete?: number, attributes?: Object}>} - */ - get delta () { - return this.changes.delta - } - - /** - * Check if a struct is added by this event. - * - * In contrast to change.deleted, this method also returns true if the struct was added and then deleted. - * - * @param {AbstractStruct} struct - * @return {boolean} - */ - adds (struct) { - return struct.id.clock >= (this.transaction.beforeState.get(struct.id.client) || 0) - } - - /** - * This is a computed property. Note that this can only be safely computed during the - * event call. Computing this property after other changes happened might result in - * unexpected behavior (incorrect computation of deltas). A safe way to collect changes - * is to store the `changes` or the `delta` object. Avoid storing the `transaction` object. - * - * @type {{added:Set,deleted:Set,keys:Map,delta:Array<{insert?:Array|string, delete?:number, retain?:number}>}} - */ - get changes () { - let changes = this._changes - if (changes === null) { - if (this.transaction.doc._transactionCleanups.length === 0) { - throw error.create(errorComputeChanges) - } - const target = this.target - const added = set.create() - const deleted = set.create() - /** - * @type {Array<{insert:Array}|{delete:number}|{retain:number}>} - */ - const delta = [] - changes = { - added, - deleted, - delta, - keys: this.keys - } - const changed = /** @type Set */ (this.transaction.changed.get(target)) - if (changed.has(null)) { - /** - * @type {any} - */ - let lastOp = null - const packOp = () => { - if (lastOp) { - delta.push(lastOp) - } - } - for (let item = target._start; item !== null; item = item.right) { - if (item.deleted) { - if (this.deletes(item) && !this.adds(item)) { - if (lastOp === null || lastOp.delete === undefined) { - packOp() - lastOp = { delete: 0 } - } - lastOp.delete += item.length - deleted.add(item) - } // else nop - } else { - if (this.adds(item)) { - if (lastOp === null || lastOp.insert === undefined) { - packOp() - lastOp = { insert: [] } - } - lastOp.insert = lastOp.insert.concat(item.content.getContent()) - added.add(item) - } else { - if (lastOp === null || lastOp.retain === undefined) { - packOp() - lastOp = { retain: 0 } - } - lastOp.retain += item.length - } - } - } - if (lastOp !== null && lastOp.retain === undefined) { - packOp() - } - } - this._changes = changes - } - return /** @type {any} */ (changes) - } -} - -/** - * Compute the path from this type to the specified target. - * - * @example - * // `child` should be accessible via `type.get(path[0]).get(path[1])..` - * const path = type.getPathTo(child) - * // assuming `type instanceof YArray` - * console.log(path) // might look like => [2, 'key1'] - * child === type.get(path[0]).get(path[1]) - * - * @param {AbstractType} parent - * @param {AbstractType} child target - * @return {Array} Path to the target - * - * @private - * @function - */ -const getPathTo = (parent, child) => { - const path = [] - while (child._item !== null && child !== parent) { - if (child._item.parentSub !== null) { - // parent is map-ish - path.unshift(child._item.parentSub) - } else { - // parent is array-ish - let i = 0 - let c = /** @type {AbstractType} */ (child._item.parent)._start - while (c !== child._item && c !== null) { - if (!c.deleted && c.countable) { - i += c.length - } - c = c.right - } - path.unshift(i) - } - child = /** @type {AbstractType} */ (child._item.parent) - } - return path -} diff --git a/yjs-poll/node_modules/yjs/src/utils/encoding.js b/yjs-poll/node_modules/yjs/src/utils/encoding.js deleted file mode 100644 index b195ccc..0000000 --- a/yjs-poll/node_modules/yjs/src/utils/encoding.js +++ /dev/null @@ -1,644 +0,0 @@ -/** - * @module encoding - */ -/* - * We use the first five bits in the info flag for determining the type of the struct. - * - * 0: GC - * 1: Item with Deleted content - * 2: Item with JSON content - * 3: Item with Binary content - * 4: Item with String content - * 5: Item with Embed content (for richtext content) - * 6: Item with Format content (a formatting marker for richtext content) - * 7: Item with Type - */ - -import { - findIndexSS, - getState, - createID, - getStateVector, - readAndApplyDeleteSet, - writeDeleteSet, - createDeleteSetFromStructStore, - transact, - readItemContent, - UpdateDecoderV1, - UpdateDecoderV2, - UpdateEncoderV1, - UpdateEncoderV2, - DSEncoderV2, - DSDecoderV1, - DSEncoderV1, - mergeUpdates, - mergeUpdatesV2, - Skip, - diffUpdateV2, - convertUpdateFormatV2ToV1, - DSDecoderV2, Doc, Transaction, GC, Item, StructStore // eslint-disable-line -} from '../internals.js' - -import * as encoding from 'lib0/encoding' -import * as decoding from 'lib0/decoding' -import * as binary from 'lib0/binary' -import * as map from 'lib0/map' -import * as math from 'lib0/math' -import * as array from 'lib0/array' - -/** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {Array} structs All structs by `client` - * @param {number} client - * @param {number} clock write structs starting with `ID(client,clock)` - * - * @function - */ -const writeStructs = (encoder, structs, client, clock) => { - // write first id - clock = math.max(clock, structs[0].id.clock) // make sure the first id exists - const startNewStructs = findIndexSS(structs, clock) - // write # encoded structs - encoding.writeVarUint(encoder.restEncoder, structs.length - startNewStructs) - encoder.writeClient(client) - encoding.writeVarUint(encoder.restEncoder, clock) - const firstStruct = structs[startNewStructs] - // write first struct with an offset - firstStruct.write(encoder, clock - firstStruct.id.clock) - for (let i = startNewStructs + 1; i < structs.length; i++) { - structs[i].write(encoder, 0) - } -} - -/** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {StructStore} store - * @param {Map} _sm - * - * @private - * @function - */ -export const writeClientsStructs = (encoder, store, _sm) => { - // we filter all valid _sm entries into sm - const sm = new Map() - _sm.forEach((clock, client) => { - // only write if new structs are available - if (getState(store, client) > clock) { - sm.set(client, clock) - } - }) - getStateVector(store).forEach((_clock, client) => { - if (!_sm.has(client)) { - sm.set(client, 0) - } - }) - // write # states that were updated - encoding.writeVarUint(encoder.restEncoder, sm.size) - // Write items with higher client ids first - // This heavily improves the conflict algorithm. - array.from(sm.entries()).sort((a, b) => b[0] - a[0]).forEach(([client, clock]) => { - writeStructs(encoder, /** @type {Array} */ (store.clients.get(client)), client, clock) - }) -} - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder The decoder object to read data from. - * @param {Doc} doc - * @return {Map }>} - * - * @private - * @function - */ -export const readClientsStructRefs = (decoder, doc) => { - /** - * @type {Map }>} - */ - const clientRefs = map.create() - const numOfStateUpdates = decoding.readVarUint(decoder.restDecoder) - for (let i = 0; i < numOfStateUpdates; i++) { - const numberOfStructs = decoding.readVarUint(decoder.restDecoder) - /** - * @type {Array} - */ - const refs = new Array(numberOfStructs) - const client = decoder.readClient() - let clock = decoding.readVarUint(decoder.restDecoder) - // const start = performance.now() - clientRefs.set(client, { i: 0, refs }) - for (let i = 0; i < numberOfStructs; i++) { - const info = decoder.readInfo() - switch (binary.BITS5 & info) { - case 0: { // GC - const len = decoder.readLen() - refs[i] = new GC(createID(client, clock), len) - clock += len - break - } - case 10: { // Skip Struct (nothing to apply) - // @todo we could reduce the amount of checks by adding Skip struct to clientRefs so we know that something is missing. - const len = decoding.readVarUint(decoder.restDecoder) - refs[i] = new Skip(createID(client, clock), len) - clock += len - break - } - default: { // Item with content - /** - * The optimized implementation doesn't use any variables because inlining variables is faster. - * Below a non-optimized version is shown that implements the basic algorithm with - * a few comments - */ - const cantCopyParentInfo = (info & (binary.BIT7 | binary.BIT8)) === 0 - // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y` - // and we read the next string as parentYKey. - // It indicates how we store/retrieve parent from `y.share` - // @type {string|null} - const struct = new Item( - createID(client, clock), - null, // left - (info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null, // origin - null, // right - (info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null, // right origin - cantCopyParentInfo ? (decoder.readParentInfo() ? doc.get(decoder.readString()) : decoder.readLeftID()) : null, // parent - cantCopyParentInfo && (info & binary.BIT6) === binary.BIT6 ? decoder.readString() : null, // parentSub - readItemContent(decoder, info) // item content - ) - /* A non-optimized implementation of the above algorithm: - - // The item that was originally to the left of this item. - const origin = (info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null - // The item that was originally to the right of this item. - const rightOrigin = (info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null - const cantCopyParentInfo = (info & (binary.BIT7 | binary.BIT8)) === 0 - const hasParentYKey = cantCopyParentInfo ? decoder.readParentInfo() : false - // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y` - // and we read the next string as parentYKey. - // It indicates how we store/retrieve parent from `y.share` - // @type {string|null} - const parentYKey = cantCopyParentInfo && hasParentYKey ? decoder.readString() : null - - const struct = new Item( - createID(client, clock), - null, // left - origin, // origin - null, // right - rightOrigin, // right origin - cantCopyParentInfo && !hasParentYKey ? decoder.readLeftID() : (parentYKey !== null ? doc.get(parentYKey) : null), // parent - cantCopyParentInfo && (info & binary.BIT6) === binary.BIT6 ? decoder.readString() : null, // parentSub - readItemContent(decoder, info) // item content - ) - */ - refs[i] = struct - clock += struct.length - } - } - } - // console.log('time to read: ', performance.now() - start) // @todo remove - } - return clientRefs -} - -/** - * Resume computing structs generated by struct readers. - * - * While there is something to do, we integrate structs in this order - * 1. top element on stack, if stack is not empty - * 2. next element from current struct reader (if empty, use next struct reader) - * - * If struct causally depends on another struct (ref.missing), we put next reader of - * `ref.id.client` on top of stack. - * - * At some point we find a struct that has no causal dependencies, - * then we start emptying the stack. - * - * It is not possible to have circles: i.e. struct1 (from client1) depends on struct2 (from client2) - * depends on struct3 (from client1). Therefore the max stack size is equal to `structReaders.length`. - * - * This method is implemented in a way so that we can resume computation if this update - * causally depends on another update. - * - * @param {Transaction} transaction - * @param {StructStore} store - * @param {Map} clientsStructRefs - * @return { null | { update: Uint8Array, missing: Map } } - * - * @private - * @function - */ -const integrateStructs = (transaction, store, clientsStructRefs) => { - /** - * @type {Array} - */ - const stack = [] - // sort them so that we take the higher id first, in case of conflicts the lower id will probably not conflict with the id from the higher user. - let clientsStructRefsIds = array.from(clientsStructRefs.keys()).sort((a, b) => a - b) - if (clientsStructRefsIds.length === 0) { - return null - } - const getNextStructTarget = () => { - if (clientsStructRefsIds.length === 0) { - return null - } - let nextStructsTarget = /** @type {{i:number,refs:Array}} */ (clientsStructRefs.get(clientsStructRefsIds[clientsStructRefsIds.length - 1])) - while (nextStructsTarget.refs.length === nextStructsTarget.i) { - clientsStructRefsIds.pop() - if (clientsStructRefsIds.length > 0) { - nextStructsTarget = /** @type {{i:number,refs:Array}} */ (clientsStructRefs.get(clientsStructRefsIds[clientsStructRefsIds.length - 1])) - } else { - return null - } - } - return nextStructsTarget - } - let curStructsTarget = getNextStructTarget() - if (curStructsTarget === null) { - return null - } - - /** - * @type {StructStore} - */ - const restStructs = new StructStore() - const missingSV = new Map() - /** - * @param {number} client - * @param {number} clock - */ - const updateMissingSv = (client, clock) => { - const mclock = missingSV.get(client) - if (mclock == null || mclock > clock) { - missingSV.set(client, clock) - } - } - /** - * @type {GC|Item} - */ - let stackHead = /** @type {any} */ (curStructsTarget).refs[/** @type {any} */ (curStructsTarget).i++] - // caching the state because it is used very often - const state = new Map() - - const addStackToRestSS = () => { - for (const item of stack) { - const client = item.id.client - const inapplicableItems = clientsStructRefs.get(client) - if (inapplicableItems) { - // decrement because we weren't able to apply previous operation - inapplicableItems.i-- - restStructs.clients.set(client, inapplicableItems.refs.slice(inapplicableItems.i)) - clientsStructRefs.delete(client) - inapplicableItems.i = 0 - inapplicableItems.refs = [] - } else { - // item was the last item on clientsStructRefs and the field was already cleared. Add item to restStructs and continue - restStructs.clients.set(client, [item]) - } - // remove client from clientsStructRefsIds to prevent users from applying the same update again - clientsStructRefsIds = clientsStructRefsIds.filter(c => c !== client) - } - stack.length = 0 - } - - // iterate over all struct readers until we are done - while (true) { - if (stackHead.constructor !== Skip) { - const localClock = map.setIfUndefined(state, stackHead.id.client, () => getState(store, stackHead.id.client)) - const offset = localClock - stackHead.id.clock - if (offset < 0) { - // update from the same client is missing - stack.push(stackHead) - updateMissingSv(stackHead.id.client, stackHead.id.clock - 1) - // hid a dead wall, add all items from stack to restSS - addStackToRestSS() - } else { - const missing = stackHead.getMissing(transaction, store) - if (missing !== null) { - stack.push(stackHead) - // get the struct reader that has the missing struct - /** - * @type {{ refs: Array, i: number }} - */ - const structRefs = clientsStructRefs.get(/** @type {number} */ (missing)) || { refs: [], i: 0 } - if (structRefs.refs.length === structRefs.i) { - // This update message causally depends on another update message that doesn't exist yet - updateMissingSv(/** @type {number} */ (missing), getState(store, missing)) - addStackToRestSS() - } else { - stackHead = structRefs.refs[structRefs.i++] - continue - } - } else if (offset === 0 || offset < stackHead.length) { - // all fine, apply the stackhead - stackHead.integrate(transaction, offset) - state.set(stackHead.id.client, stackHead.id.clock + stackHead.length) - } - } - } - // iterate to next stackHead - if (stack.length > 0) { - stackHead = /** @type {GC|Item} */ (stack.pop()) - } else if (curStructsTarget !== null && curStructsTarget.i < curStructsTarget.refs.length) { - stackHead = /** @type {GC|Item} */ (curStructsTarget.refs[curStructsTarget.i++]) - } else { - curStructsTarget = getNextStructTarget() - if (curStructsTarget === null) { - // we are done! - break - } else { - stackHead = /** @type {GC|Item} */ (curStructsTarget.refs[curStructsTarget.i++]) - } - } - } - if (restStructs.clients.size > 0) { - const encoder = new UpdateEncoderV2() - writeClientsStructs(encoder, restStructs, new Map()) - // write empty deleteset - // writeDeleteSet(encoder, new DeleteSet()) - encoding.writeVarUint(encoder.restEncoder, 0) // => no need for an extra function call, just write 0 deletes - return { missing: missingSV, update: encoder.toUint8Array() } - } - return null -} - -/** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {Transaction} transaction - * - * @private - * @function - */ -export const writeStructsFromTransaction = (encoder, transaction) => writeClientsStructs(encoder, transaction.doc.store, transaction.beforeState) - -/** - * Read and apply a document update. - * - * This function has the same effect as `applyUpdate` but accepts a decoder. - * - * @param {decoding.Decoder} decoder - * @param {Doc} ydoc - * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))` - * @param {UpdateDecoderV1 | UpdateDecoderV2} [structDecoder] - * - * @function - */ -export const readUpdateV2 = (decoder, ydoc, transactionOrigin, structDecoder = new UpdateDecoderV2(decoder)) => - transact(ydoc, transaction => { - // force that transaction.local is set to non-local - transaction.local = false - let retry = false - const doc = transaction.doc - const store = doc.store - // let start = performance.now() - const ss = readClientsStructRefs(structDecoder, doc) - // console.log('time to read structs: ', performance.now() - start) // @todo remove - // start = performance.now() - // console.log('time to merge: ', performance.now() - start) // @todo remove - // start = performance.now() - const restStructs = integrateStructs(transaction, store, ss) - const pending = store.pendingStructs - if (pending) { - // check if we can apply something - for (const [client, clock] of pending.missing) { - if (clock < getState(store, client)) { - retry = true - break - } - } - if (restStructs) { - // merge restStructs into store.pending - for (const [client, clock] of restStructs.missing) { - const mclock = pending.missing.get(client) - if (mclock == null || mclock > clock) { - pending.missing.set(client, clock) - } - } - pending.update = mergeUpdatesV2([pending.update, restStructs.update]) - } - } else { - store.pendingStructs = restStructs - } - // console.log('time to integrate: ', performance.now() - start) // @todo remove - // start = performance.now() - const dsRest = readAndApplyDeleteSet(structDecoder, transaction, store) - if (store.pendingDs) { - // @todo we could make a lower-bound state-vector check as we do above - const pendingDSUpdate = new UpdateDecoderV2(decoding.createDecoder(store.pendingDs)) - decoding.readVarUint(pendingDSUpdate.restDecoder) // read 0 structs, because we only encode deletes in pendingdsupdate - const dsRest2 = readAndApplyDeleteSet(pendingDSUpdate, transaction, store) - if (dsRest && dsRest2) { - // case 1: ds1 != null && ds2 != null - store.pendingDs = mergeUpdatesV2([dsRest, dsRest2]) - } else { - // case 2: ds1 != null - // case 3: ds2 != null - // case 4: ds1 == null && ds2 == null - store.pendingDs = dsRest || dsRest2 - } - } else { - // Either dsRest == null && pendingDs == null OR dsRest != null - store.pendingDs = dsRest - } - // console.log('time to cleanup: ', performance.now() - start) // @todo remove - // start = performance.now() - - // console.log('time to resume delete readers: ', performance.now() - start) // @todo remove - // start = performance.now() - if (retry) { - const update = /** @type {{update: Uint8Array}} */ (store.pendingStructs).update - store.pendingStructs = null - applyUpdateV2(transaction.doc, update) - } - }, transactionOrigin, false) - -/** - * Read and apply a document update. - * - * This function has the same effect as `applyUpdate` but accepts a decoder. - * - * @param {decoding.Decoder} decoder - * @param {Doc} ydoc - * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))` - * - * @function - */ -export const readUpdate = (decoder, ydoc, transactionOrigin) => readUpdateV2(decoder, ydoc, transactionOrigin, new UpdateDecoderV1(decoder)) - -/** - * Apply a document update created by, for example, `y.on('update', update => ..)` or `update = encodeStateAsUpdate()`. - * - * This function has the same effect as `readUpdate` but accepts an Uint8Array instead of a Decoder. - * - * @param {Doc} ydoc - * @param {Uint8Array} update - * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))` - * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder] - * - * @function - */ -export const applyUpdateV2 = (ydoc, update, transactionOrigin, YDecoder = UpdateDecoderV2) => { - const decoder = decoding.createDecoder(update) - readUpdateV2(decoder, ydoc, transactionOrigin, new YDecoder(decoder)) -} - -/** - * Apply a document update created by, for example, `y.on('update', update => ..)` or `update = encodeStateAsUpdate()`. - * - * This function has the same effect as `readUpdate` but accepts an Uint8Array instead of a Decoder. - * - * @param {Doc} ydoc - * @param {Uint8Array} update - * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))` - * - * @function - */ -export const applyUpdate = (ydoc, update, transactionOrigin) => applyUpdateV2(ydoc, update, transactionOrigin, UpdateDecoderV1) - -/** - * Write all the document as a single update message. If you specify the state of the remote client (`targetStateVector`) it will - * only write the operations that are missing. - * - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - * @param {Doc} doc - * @param {Map} [targetStateVector] The state of the target that receives the update. Leave empty to write all known structs - * - * @function - */ -export const writeStateAsUpdate = (encoder, doc, targetStateVector = new Map()) => { - writeClientsStructs(encoder, doc.store, targetStateVector) - writeDeleteSet(encoder, createDeleteSetFromStructStore(doc.store)) -} - -/** - * Write all the document as a single update message that can be applied on the remote document. If you specify the state of the remote client (`targetState`) it will - * only write the operations that are missing. - * - * Use `writeStateAsUpdate` instead if you are working with lib0/encoding.js#Encoder - * - * @param {Doc} doc - * @param {Uint8Array} [encodedTargetStateVector] The state of the target that receives the update. Leave empty to write all known structs - * @param {UpdateEncoderV1 | UpdateEncoderV2} [encoder] - * @return {Uint8Array} - * - * @function - */ -export const encodeStateAsUpdateV2 = (doc, encodedTargetStateVector = new Uint8Array([0]), encoder = new UpdateEncoderV2()) => { - const targetStateVector = decodeStateVector(encodedTargetStateVector) - writeStateAsUpdate(encoder, doc, targetStateVector) - const updates = [encoder.toUint8Array()] - // also add the pending updates (if there are any) - if (doc.store.pendingDs) { - updates.push(doc.store.pendingDs) - } - if (doc.store.pendingStructs) { - updates.push(diffUpdateV2(doc.store.pendingStructs.update, encodedTargetStateVector)) - } - if (updates.length > 1) { - if (encoder.constructor === UpdateEncoderV1) { - return mergeUpdates(updates.map((update, i) => i === 0 ? update : convertUpdateFormatV2ToV1(update))) - } else if (encoder.constructor === UpdateEncoderV2) { - return mergeUpdatesV2(updates) - } - } - return updates[0] -} - -/** - * Write all the document as a single update message that can be applied on the remote document. If you specify the state of the remote client (`targetState`) it will - * only write the operations that are missing. - * - * Use `writeStateAsUpdate` instead if you are working with lib0/encoding.js#Encoder - * - * @param {Doc} doc - * @param {Uint8Array} [encodedTargetStateVector] The state of the target that receives the update. Leave empty to write all known structs - * @return {Uint8Array} - * - * @function - */ -export const encodeStateAsUpdate = (doc, encodedTargetStateVector) => encodeStateAsUpdateV2(doc, encodedTargetStateVector, new UpdateEncoderV1()) - -/** - * Read state vector from Decoder and return as Map - * - * @param {DSDecoderV1 | DSDecoderV2} decoder - * @return {Map} Maps `client` to the number next expected `clock` from that client. - * - * @function - */ -export const readStateVector = decoder => { - const ss = new Map() - const ssLength = decoding.readVarUint(decoder.restDecoder) - for (let i = 0; i < ssLength; i++) { - const client = decoding.readVarUint(decoder.restDecoder) - const clock = decoding.readVarUint(decoder.restDecoder) - ss.set(client, clock) - } - return ss -} - -/** - * Read decodedState and return State as Map. - * - * @param {Uint8Array} decodedState - * @return {Map} Maps `client` to the number next expected `clock` from that client. - * - * @function - */ -// export const decodeStateVectorV2 = decodedState => readStateVector(new DSDecoderV2(decoding.createDecoder(decodedState))) - -/** - * Read decodedState and return State as Map. - * - * @param {Uint8Array} decodedState - * @return {Map} Maps `client` to the number next expected `clock` from that client. - * - * @function - */ -export const decodeStateVector = decodedState => readStateVector(new DSDecoderV1(decoding.createDecoder(decodedState))) - -/** - * @param {DSEncoderV1 | DSEncoderV2} encoder - * @param {Map} sv - * @function - */ -export const writeStateVector = (encoder, sv) => { - encoding.writeVarUint(encoder.restEncoder, sv.size) - array.from(sv.entries()).sort((a, b) => b[0] - a[0]).forEach(([client, clock]) => { - encoding.writeVarUint(encoder.restEncoder, client) // @todo use a special client decoder that is based on mapping - encoding.writeVarUint(encoder.restEncoder, clock) - }) - return encoder -} - -/** - * @param {DSEncoderV1 | DSEncoderV2} encoder - * @param {Doc} doc - * - * @function - */ -export const writeDocumentStateVector = (encoder, doc) => writeStateVector(encoder, getStateVector(doc.store)) - -/** - * Encode State as Uint8Array. - * - * @param {Doc|Map} doc - * @param {DSEncoderV1 | DSEncoderV2} [encoder] - * @return {Uint8Array} - * - * @function - */ -export const encodeStateVectorV2 = (doc, encoder = new DSEncoderV2()) => { - if (doc instanceof Map) { - writeStateVector(encoder, doc) - } else { - writeDocumentStateVector(encoder, doc) - } - return encoder.toUint8Array() -} - -/** - * Encode State as Uint8Array. - * - * @param {Doc|Map} doc - * @return {Uint8Array} - * - * @function - */ -export const encodeStateVector = doc => encodeStateVectorV2(doc, new DSEncoderV1()) diff --git a/yjs-poll/node_modules/yjs/src/utils/isParentOf.js b/yjs-poll/node_modules/yjs/src/utils/isParentOf.js deleted file mode 100644 index d8f5a61..0000000 --- a/yjs-poll/node_modules/yjs/src/utils/isParentOf.js +++ /dev/null @@ -1,21 +0,0 @@ -import { AbstractType, Item } from '../internals.js' // eslint-disable-line - -/** - * Check if `parent` is a parent of `child`. - * - * @param {AbstractType} parent - * @param {Item|null} child - * @return {Boolean} Whether `parent` is a parent of `child`. - * - * @private - * @function - */ -export const isParentOf = (parent, child) => { - while (child !== null) { - if (child.parent === parent) { - return true - } - child = /** @type {AbstractType} */ (child.parent)._item - } - return false -} diff --git a/yjs-poll/node_modules/yjs/src/utils/logging.js b/yjs-poll/node_modules/yjs/src/utils/logging.js deleted file mode 100644 index 989ac48..0000000 --- a/yjs-poll/node_modules/yjs/src/utils/logging.js +++ /dev/null @@ -1,21 +0,0 @@ -import { - AbstractType // eslint-disable-line -} from '../internals.js' - -/** - * Convenient helper to log type information. - * - * Do not use in productive systems as the output can be immense! - * - * @param {AbstractType} type - */ -export const logType = type => { - const res = [] - let n = type._start - while (n) { - res.push(n) - n = n.right - } - console.log('Children: ', res) - console.log('Children content: ', res.filter(m => !m.deleted).map(m => m.content)) -} diff --git a/yjs-poll/node_modules/yjs/src/utils/updates.js b/yjs-poll/node_modules/yjs/src/utils/updates.js deleted file mode 100644 index fc40cd5..0000000 --- a/yjs-poll/node_modules/yjs/src/utils/updates.js +++ /dev/null @@ -1,722 +0,0 @@ -import * as binary from 'lib0/binary' -import * as decoding from 'lib0/decoding' -import * as encoding from 'lib0/encoding' -import * as error from 'lib0/error' -import * as f from 'lib0/function' -import * as logging from 'lib0/logging' -import * as map from 'lib0/map' -import * as math from 'lib0/math' -import * as string from 'lib0/string' - -import { - ContentAny, - ContentBinary, - ContentDeleted, - ContentDoc, - ContentEmbed, - ContentFormat, - ContentJSON, - ContentString, - ContentType, - createID, - decodeStateVector, - DSEncoderV1, - DSEncoderV2, - GC, - Item, - mergeDeleteSets, - readDeleteSet, - readItemContent, - Skip, - UpdateDecoderV1, - UpdateDecoderV2, - UpdateEncoderV1, - UpdateEncoderV2, - writeDeleteSet, - YXmlElement, - YXmlHook -} from '../internals.js' - -/** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - */ -function * lazyStructReaderGenerator (decoder) { - const numOfStateUpdates = decoding.readVarUint(decoder.restDecoder) - for (let i = 0; i < numOfStateUpdates; i++) { - const numberOfStructs = decoding.readVarUint(decoder.restDecoder) - const client = decoder.readClient() - let clock = decoding.readVarUint(decoder.restDecoder) - for (let i = 0; i < numberOfStructs; i++) { - const info = decoder.readInfo() - // @todo use switch instead of ifs - if (info === 10) { - const len = decoding.readVarUint(decoder.restDecoder) - yield new Skip(createID(client, clock), len) - clock += len - } else if ((binary.BITS5 & info) !== 0) { - const cantCopyParentInfo = (info & (binary.BIT7 | binary.BIT8)) === 0 - // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y` - // and we read the next string as parentYKey. - // It indicates how we store/retrieve parent from `y.share` - // @type {string|null} - const struct = new Item( - createID(client, clock), - null, // left - (info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null, // origin - null, // right - (info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null, // right origin - // @ts-ignore Force writing a string here. - cantCopyParentInfo ? (decoder.readParentInfo() ? decoder.readString() : decoder.readLeftID()) : null, // parent - cantCopyParentInfo && (info & binary.BIT6) === binary.BIT6 ? decoder.readString() : null, // parentSub - readItemContent(decoder, info) // item content - ) - yield struct - clock += struct.length - } else { - const len = decoder.readLen() - yield new GC(createID(client, clock), len) - clock += len - } - } - } -} - -export class LazyStructReader { - /** - * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder - * @param {boolean} filterSkips - */ - constructor (decoder, filterSkips) { - this.gen = lazyStructReaderGenerator(decoder) - /** - * @type {null | Item | Skip | GC} - */ - this.curr = null - this.done = false - this.filterSkips = filterSkips - this.next() - } - - /** - * @return {Item | GC | Skip |null} - */ - next () { - // ignore "Skip" structs - do { - this.curr = this.gen.next().value || null - } while (this.filterSkips && this.curr !== null && this.curr.constructor === Skip) - return this.curr - } -} - -/** - * @param {Uint8Array} update - * - */ -export const logUpdate = update => logUpdateV2(update, UpdateDecoderV1) - -/** - * @param {Uint8Array} update - * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder] - * - */ -export const logUpdateV2 = (update, YDecoder = UpdateDecoderV2) => { - const structs = [] - const updateDecoder = new YDecoder(decoding.createDecoder(update)) - const lazyDecoder = new LazyStructReader(updateDecoder, false) - for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) { - structs.push(curr) - } - logging.print('Structs: ', structs) - const ds = readDeleteSet(updateDecoder) - logging.print('DeleteSet: ', ds) -} - -/** - * @param {Uint8Array} update - * - */ -export const decodeUpdate = (update) => decodeUpdateV2(update, UpdateDecoderV1) - -/** - * @param {Uint8Array} update - * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder] - * - */ -export const decodeUpdateV2 = (update, YDecoder = UpdateDecoderV2) => { - const structs = [] - const updateDecoder = new YDecoder(decoding.createDecoder(update)) - const lazyDecoder = new LazyStructReader(updateDecoder, false) - for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) { - structs.push(curr) - } - return { - structs, - ds: readDeleteSet(updateDecoder) - } -} - -export class LazyStructWriter { - /** - * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder - */ - constructor (encoder) { - this.currClient = 0 - this.startClock = 0 - this.written = 0 - this.encoder = encoder - /** - * We want to write operations lazily, but also we need to know beforehand how many operations we want to write for each client. - * - * This kind of meta-information (#clients, #structs-per-client-written) is written to the restEncoder. - * - * We fragment the restEncoder and store a slice of it per-client until we know how many clients there are. - * When we flush (toUint8Array) we write the restEncoder using the fragments and the meta-information. - * - * @type {Array<{ written: number, restEncoder: Uint8Array }>} - */ - this.clientStructs = [] - } -} - -/** - * @param {Array} updates - * @return {Uint8Array} - */ -export const mergeUpdates = updates => mergeUpdatesV2(updates, UpdateDecoderV1, UpdateEncoderV1) - -/** - * @param {Uint8Array} update - * @param {typeof DSEncoderV1 | typeof DSEncoderV2} YEncoder - * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} YDecoder - * @return {Uint8Array} - */ -export const encodeStateVectorFromUpdateV2 = (update, YEncoder = DSEncoderV2, YDecoder = UpdateDecoderV2) => { - const encoder = new YEncoder() - const updateDecoder = new LazyStructReader(new YDecoder(decoding.createDecoder(update)), false) - let curr = updateDecoder.curr - if (curr !== null) { - let size = 0 - let currClient = curr.id.client - let stopCounting = curr.id.clock !== 0 // must start at 0 - let currClock = stopCounting ? 0 : curr.id.clock + curr.length - for (; curr !== null; curr = updateDecoder.next()) { - if (currClient !== curr.id.client) { - if (currClock !== 0) { - size++ - // We found a new client - // write what we have to the encoder - encoding.writeVarUint(encoder.restEncoder, currClient) - encoding.writeVarUint(encoder.restEncoder, currClock) - } - currClient = curr.id.client - currClock = 0 - stopCounting = curr.id.clock !== 0 - } - // we ignore skips - if (curr.constructor === Skip) { - stopCounting = true - } - if (!stopCounting) { - currClock = curr.id.clock + curr.length - } - } - // write what we have - if (currClock !== 0) { - size++ - encoding.writeVarUint(encoder.restEncoder, currClient) - encoding.writeVarUint(encoder.restEncoder, currClock) - } - // prepend the size of the state vector - const enc = encoding.createEncoder() - encoding.writeVarUint(enc, size) - encoding.writeBinaryEncoder(enc, encoder.restEncoder) - encoder.restEncoder = enc - return encoder.toUint8Array() - } else { - encoding.writeVarUint(encoder.restEncoder, 0) - return encoder.toUint8Array() - } -} - -/** - * @param {Uint8Array} update - * @return {Uint8Array} - */ -export const encodeStateVectorFromUpdate = update => encodeStateVectorFromUpdateV2(update, DSEncoderV1, UpdateDecoderV1) - -/** - * @param {Uint8Array} update - * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} YDecoder - * @return {{ from: Map, to: Map }} - */ -export const parseUpdateMetaV2 = (update, YDecoder = UpdateDecoderV2) => { - /** - * @type {Map} - */ - const from = new Map() - /** - * @type {Map} - */ - const to = new Map() - const updateDecoder = new LazyStructReader(new YDecoder(decoding.createDecoder(update)), false) - let curr = updateDecoder.curr - if (curr !== null) { - let currClient = curr.id.client - let currClock = curr.id.clock - // write the beginning to `from` - from.set(currClient, currClock) - for (; curr !== null; curr = updateDecoder.next()) { - if (currClient !== curr.id.client) { - // We found a new client - // write the end to `to` - to.set(currClient, currClock) - // write the beginning to `from` - from.set(curr.id.client, curr.id.clock) - // update currClient - currClient = curr.id.client - } - currClock = curr.id.clock + curr.length - } - // write the end to `to` - to.set(currClient, currClock) - } - return { from, to } -} - -/** - * @param {Uint8Array} update - * @return {{ from: Map, to: Map }} - */ -export const parseUpdateMeta = update => parseUpdateMetaV2(update, UpdateDecoderV1) - -/** - * This method is intended to slice any kind of struct and retrieve the right part. - * It does not handle side-effects, so it should only be used by the lazy-encoder. - * - * @param {Item | GC | Skip} left - * @param {number} diff - * @return {Item | GC} - */ -const sliceStruct = (left, diff) => { - if (left.constructor === GC) { - const { client, clock } = left.id - return new GC(createID(client, clock + diff), left.length - diff) - } else if (left.constructor === Skip) { - const { client, clock } = left.id - return new Skip(createID(client, clock + diff), left.length - diff) - } else { - const leftItem = /** @type {Item} */ (left) - const { client, clock } = leftItem.id - return new Item( - createID(client, clock + diff), - null, - createID(client, clock + diff - 1), - null, - leftItem.rightOrigin, - leftItem.parent, - leftItem.parentSub, - leftItem.content.splice(diff) - ) - } -} - -/** - * - * This function works similarly to `readUpdateV2`. - * - * @param {Array} updates - * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder] - * @param {typeof UpdateEncoderV1 | typeof UpdateEncoderV2} [YEncoder] - * @return {Uint8Array} - */ -export const mergeUpdatesV2 = (updates, YDecoder = UpdateDecoderV2, YEncoder = UpdateEncoderV2) => { - if (updates.length === 1) { - return updates[0] - } - const updateDecoders = updates.map(update => new YDecoder(decoding.createDecoder(update))) - let lazyStructDecoders = updateDecoders.map(decoder => new LazyStructReader(decoder, true)) - - /** - * @todo we don't need offset because we always slice before - * @type {null | { struct: Item | GC | Skip, offset: number }} - */ - let currWrite = null - - const updateEncoder = new YEncoder() - // write structs lazily - const lazyStructEncoder = new LazyStructWriter(updateEncoder) - - // Note: We need to ensure that all lazyStructDecoders are fully consumed - // Note: Should merge document updates whenever possible - even from different updates - // Note: Should handle that some operations cannot be applied yet () - - while (true) { - // Write higher clients first ⇒ sort by clientID & clock and remove decoders without content - lazyStructDecoders = lazyStructDecoders.filter(dec => dec.curr !== null) - lazyStructDecoders.sort( - /** @type {function(any,any):number} */ (dec1, dec2) => { - if (dec1.curr.id.client === dec2.curr.id.client) { - const clockDiff = dec1.curr.id.clock - dec2.curr.id.clock - if (clockDiff === 0) { - // @todo remove references to skip since the structDecoders must filter Skips. - return dec1.curr.constructor === dec2.curr.constructor - ? 0 - : dec1.curr.constructor === Skip ? 1 : -1 // we are filtering skips anyway. - } else { - return clockDiff - } - } else { - return dec2.curr.id.client - dec1.curr.id.client - } - } - ) - if (lazyStructDecoders.length === 0) { - break - } - const currDecoder = lazyStructDecoders[0] - // write from currDecoder until the next operation is from another client or if filler-struct - // then we need to reorder the decoders and find the next operation to write - const firstClient = /** @type {Item | GC} */ (currDecoder.curr).id.client - - if (currWrite !== null) { - let curr = /** @type {Item | GC | null} */ (currDecoder.curr) - let iterated = false - - // iterate until we find something that we haven't written already - // remember: first the high client-ids are written - while (curr !== null && curr.id.clock + curr.length <= currWrite.struct.id.clock + currWrite.struct.length && curr.id.client >= currWrite.struct.id.client) { - curr = currDecoder.next() - iterated = true - } - if ( - curr === null || // current decoder is empty - curr.id.client !== firstClient || // check whether there is another decoder that has has updates from `firstClient` - (iterated && curr.id.clock > currWrite.struct.id.clock + currWrite.struct.length) // the above while loop was used and we are potentially missing updates - ) { - continue - } - - if (firstClient !== currWrite.struct.id.client) { - writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset) - currWrite = { struct: curr, offset: 0 } - currDecoder.next() - } else { - if (currWrite.struct.id.clock + currWrite.struct.length < curr.id.clock) { - // @todo write currStruct & set currStruct = Skip(clock = currStruct.id.clock + currStruct.length, length = curr.id.clock - self.clock) - if (currWrite.struct.constructor === Skip) { - // extend existing skip - currWrite.struct.length = curr.id.clock + curr.length - currWrite.struct.id.clock - } else { - writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset) - const diff = curr.id.clock - currWrite.struct.id.clock - currWrite.struct.length - /** - * @type {Skip} - */ - const struct = new Skip(createID(firstClient, currWrite.struct.id.clock + currWrite.struct.length), diff) - currWrite = { struct, offset: 0 } - } - } else { // if (currWrite.struct.id.clock + currWrite.struct.length >= curr.id.clock) { - const diff = currWrite.struct.id.clock + currWrite.struct.length - curr.id.clock - if (diff > 0) { - if (currWrite.struct.constructor === Skip) { - // prefer to slice Skip because the other struct might contain more information - currWrite.struct.length -= diff - } else { - curr = sliceStruct(curr, diff) - } - } - if (!currWrite.struct.mergeWith(/** @type {any} */ (curr))) { - writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset) - currWrite = { struct: curr, offset: 0 } - currDecoder.next() - } - } - } - } else { - currWrite = { struct: /** @type {Item | GC} */ (currDecoder.curr), offset: 0 } - currDecoder.next() - } - for ( - let next = currDecoder.curr; - next !== null && next.id.client === firstClient && next.id.clock === currWrite.struct.id.clock + currWrite.struct.length && next.constructor !== Skip; - next = currDecoder.next() - ) { - writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset) - currWrite = { struct: next, offset: 0 } - } - } - if (currWrite !== null) { - writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset) - currWrite = null - } - finishLazyStructWriting(lazyStructEncoder) - - const dss = updateDecoders.map(decoder => readDeleteSet(decoder)) - const ds = mergeDeleteSets(dss) - writeDeleteSet(updateEncoder, ds) - return updateEncoder.toUint8Array() -} - -/** - * @param {Uint8Array} update - * @param {Uint8Array} sv - * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder] - * @param {typeof UpdateEncoderV1 | typeof UpdateEncoderV2} [YEncoder] - */ -export const diffUpdateV2 = (update, sv, YDecoder = UpdateDecoderV2, YEncoder = UpdateEncoderV2) => { - const state = decodeStateVector(sv) - const encoder = new YEncoder() - const lazyStructWriter = new LazyStructWriter(encoder) - const decoder = new YDecoder(decoding.createDecoder(update)) - const reader = new LazyStructReader(decoder, false) - while (reader.curr) { - const curr = reader.curr - const currClient = curr.id.client - const svClock = state.get(currClient) || 0 - if (reader.curr.constructor === Skip) { - // the first written struct shouldn't be a skip - reader.next() - continue - } - if (curr.id.clock + curr.length > svClock) { - writeStructToLazyStructWriter(lazyStructWriter, curr, math.max(svClock - curr.id.clock, 0)) - reader.next() - while (reader.curr && reader.curr.id.client === currClient) { - writeStructToLazyStructWriter(lazyStructWriter, reader.curr, 0) - reader.next() - } - } else { - // read until something new comes up - while (reader.curr && reader.curr.id.client === currClient && reader.curr.id.clock + reader.curr.length <= svClock) { - reader.next() - } - } - } - finishLazyStructWriting(lazyStructWriter) - // write ds - const ds = readDeleteSet(decoder) - writeDeleteSet(encoder, ds) - return encoder.toUint8Array() -} - -/** - * @param {Uint8Array} update - * @param {Uint8Array} sv - */ -export const diffUpdate = (update, sv) => diffUpdateV2(update, sv, UpdateDecoderV1, UpdateEncoderV1) - -/** - * @param {LazyStructWriter} lazyWriter - */ -const flushLazyStructWriter = lazyWriter => { - if (lazyWriter.written > 0) { - lazyWriter.clientStructs.push({ written: lazyWriter.written, restEncoder: encoding.toUint8Array(lazyWriter.encoder.restEncoder) }) - lazyWriter.encoder.restEncoder = encoding.createEncoder() - lazyWriter.written = 0 - } -} - -/** - * @param {LazyStructWriter} lazyWriter - * @param {Item | GC} struct - * @param {number} offset - */ -const writeStructToLazyStructWriter = (lazyWriter, struct, offset) => { - // flush curr if we start another client - if (lazyWriter.written > 0 && lazyWriter.currClient !== struct.id.client) { - flushLazyStructWriter(lazyWriter) - } - if (lazyWriter.written === 0) { - lazyWriter.currClient = struct.id.client - // write next client - lazyWriter.encoder.writeClient(struct.id.client) - // write startClock - encoding.writeVarUint(lazyWriter.encoder.restEncoder, struct.id.clock + offset) - } - struct.write(lazyWriter.encoder, offset) - lazyWriter.written++ -} -/** - * Call this function when we collected all parts and want to - * put all the parts together. After calling this method, - * you can continue using the UpdateEncoder. - * - * @param {LazyStructWriter} lazyWriter - */ -const finishLazyStructWriting = (lazyWriter) => { - flushLazyStructWriter(lazyWriter) - - // this is a fresh encoder because we called flushCurr - const restEncoder = lazyWriter.encoder.restEncoder - - /** - * Now we put all the fragments together. - * This works similarly to `writeClientsStructs` - */ - - // write # states that were updated - i.e. the clients - encoding.writeVarUint(restEncoder, lazyWriter.clientStructs.length) - - for (let i = 0; i < lazyWriter.clientStructs.length; i++) { - const partStructs = lazyWriter.clientStructs[i] - /** - * Works similarly to `writeStructs` - */ - // write # encoded structs - encoding.writeVarUint(restEncoder, partStructs.written) - // write the rest of the fragment - encoding.writeUint8Array(restEncoder, partStructs.restEncoder) - } -} - -/** - * @param {Uint8Array} update - * @param {function(Item|GC|Skip):Item|GC|Skip} blockTransformer - * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} YDecoder - * @param {typeof UpdateEncoderV2 | typeof UpdateEncoderV1 } YEncoder - */ -export const convertUpdateFormat = (update, blockTransformer, YDecoder, YEncoder) => { - const updateDecoder = new YDecoder(decoding.createDecoder(update)) - const lazyDecoder = new LazyStructReader(updateDecoder, false) - const updateEncoder = new YEncoder() - const lazyWriter = new LazyStructWriter(updateEncoder) - for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) { - writeStructToLazyStructWriter(lazyWriter, blockTransformer(curr), 0) - } - finishLazyStructWriting(lazyWriter) - const ds = readDeleteSet(updateDecoder) - writeDeleteSet(updateEncoder, ds) - return updateEncoder.toUint8Array() -} - -/** - * @typedef {Object} ObfuscatorOptions - * @property {boolean} [ObfuscatorOptions.formatting=true] - * @property {boolean} [ObfuscatorOptions.subdocs=true] - * @property {boolean} [ObfuscatorOptions.yxml=true] Whether to obfuscate nodeName / hookName - */ - -/** - * @param {ObfuscatorOptions} obfuscator - */ -const createObfuscator = ({ formatting = true, subdocs = true, yxml = true } = {}) => { - let i = 0 - const mapKeyCache = map.create() - const nodeNameCache = map.create() - const formattingKeyCache = map.create() - const formattingValueCache = map.create() - formattingValueCache.set(null, null) // end of a formatting range should always be the end of a formatting range - /** - * @param {Item|GC|Skip} block - * @return {Item|GC|Skip} - */ - return block => { - switch (block.constructor) { - case GC: - case Skip: - return block - case Item: { - const item = /** @type {Item} */ (block) - const content = item.content - switch (content.constructor) { - case ContentDeleted: - break - case ContentType: { - if (yxml) { - const type = /** @type {ContentType} */ (content).type - if (type instanceof YXmlElement) { - type.nodeName = map.setIfUndefined(nodeNameCache, type.nodeName, () => 'node-' + i) - } - if (type instanceof YXmlHook) { - type.hookName = map.setIfUndefined(nodeNameCache, type.hookName, () => 'hook-' + i) - } - } - break - } - case ContentAny: { - const c = /** @type {ContentAny} */ (content) - c.arr = c.arr.map(() => i) - break - } - case ContentBinary: { - const c = /** @type {ContentBinary} */ (content) - c.content = new Uint8Array([i]) - break - } - case ContentDoc: { - const c = /** @type {ContentDoc} */ (content) - if (subdocs) { - c.opts = {} - c.doc.guid = i + '' - } - break - } - case ContentEmbed: { - const c = /** @type {ContentEmbed} */ (content) - c.embed = {} - break - } - case ContentFormat: { - const c = /** @type {ContentFormat} */ (content) - if (formatting) { - c.key = map.setIfUndefined(formattingKeyCache, c.key, () => i + '') - c.value = map.setIfUndefined(formattingValueCache, c.value, () => ({ i })) - } - break - } - case ContentJSON: { - const c = /** @type {ContentJSON} */ (content) - c.arr = c.arr.map(() => i) - break - } - case ContentString: { - const c = /** @type {ContentString} */ (content) - c.str = string.repeat((i % 10) + '', c.str.length) - break - } - default: - // unknown content type - error.unexpectedCase() - } - if (item.parentSub) { - item.parentSub = map.setIfUndefined(mapKeyCache, item.parentSub, () => i + '') - } - i++ - return block - } - default: - // unknown block-type - error.unexpectedCase() - } - } -} - -/** - * This function obfuscates the content of a Yjs update. This is useful to share - * buggy Yjs documents while significantly limiting the possibility that a - * developer can on the user. Note that it might still be possible to deduce - * some information by analyzing the "structure" of the document or by analyzing - * the typing behavior using the CRDT-related metadata that is still kept fully - * intact. - * - * @param {Uint8Array} update - * @param {ObfuscatorOptions} [opts] - */ -export const obfuscateUpdate = (update, opts) => convertUpdateFormat(update, createObfuscator(opts), UpdateDecoderV1, UpdateEncoderV1) - -/** - * @param {Uint8Array} update - * @param {ObfuscatorOptions} [opts] - */ -export const obfuscateUpdateV2 = (update, opts) => convertUpdateFormat(update, createObfuscator(opts), UpdateDecoderV2, UpdateEncoderV2) - -/** - * @param {Uint8Array} update - */ -export const convertUpdateFormatV1ToV2 = update => convertUpdateFormat(update, f.id, UpdateDecoderV1, UpdateEncoderV2) - -/** - * @param {Uint8Array} update - */ -export const convertUpdateFormatV2ToV1 = update => convertUpdateFormat(update, f.id, UpdateDecoderV2, UpdateEncoderV1) diff --git a/yjs-poll/node_modules/yjs/tests/testHelper.js b/yjs-poll/node_modules/yjs/tests/testHelper.js deleted file mode 100644 index 0fa651d..0000000 --- a/yjs-poll/node_modules/yjs/tests/testHelper.js +++ /dev/null @@ -1,454 +0,0 @@ -import * as t from 'lib0/testing' -import * as prng from 'lib0/prng' -import * as encoding from 'lib0/encoding' -import * as decoding from 'lib0/decoding' -import * as syncProtocol from 'y-protocols/sync' -import * as object from 'lib0/object' -import * as map from 'lib0/map' -import * as Y from '../src/index.js' -export * from '../src/index.js' - -if (typeof window !== 'undefined') { - // @ts-ignore - window.Y = Y // eslint-disable-line -} - -/** - * @param {TestYInstance} y // publish message created by `y` to all other online clients - * @param {Uint8Array} m - */ -const broadcastMessage = (y, m) => { - if (y.tc.onlineConns.has(y)) { - y.tc.onlineConns.forEach(remoteYInstance => { - if (remoteYInstance !== y) { - remoteYInstance._receive(m, y) - } - }) - } -} - -export let useV2 = false - -export const encV1 = { - encodeStateAsUpdate: Y.encodeStateAsUpdate, - mergeUpdates: Y.mergeUpdates, - applyUpdate: Y.applyUpdate, - logUpdate: Y.logUpdate, - updateEventName: /** @type {'update'} */ ('update'), - diffUpdate: Y.diffUpdate -} - -export const encV2 = { - encodeStateAsUpdate: Y.encodeStateAsUpdateV2, - mergeUpdates: Y.mergeUpdatesV2, - applyUpdate: Y.applyUpdateV2, - logUpdate: Y.logUpdateV2, - updateEventName: /** @type {'updateV2'} */ ('updateV2'), - diffUpdate: Y.diffUpdateV2 -} - -export let enc = encV1 - -const useV1Encoding = () => { - useV2 = false - enc = encV1 -} - -const useV2Encoding = () => { - console.error('sync protocol doesnt support v2 protocol yet, fallback to v1 encoding') // @Todo - useV2 = false - enc = encV1 -} - -export class TestYInstance extends Y.Doc { - /** - * @param {TestConnector} testConnector - * @param {number} clientID - */ - constructor (testConnector, clientID) { - super() - this.userID = clientID // overwriting clientID - /** - * @type {TestConnector} - */ - this.tc = testConnector - /** - * @type {Map>} - */ - this.receiving = new Map() - testConnector.allConns.add(this) - /** - * The list of received updates. - * We are going to merge them later using Y.mergeUpdates and check if the resulting document is correct. - * @type {Array} - */ - this.updates = [] - // set up observe on local model - this.on(enc.updateEventName, /** @param {Uint8Array} update @param {any} origin */ (update, origin) => { - if (origin !== testConnector) { - const encoder = encoding.createEncoder() - syncProtocol.writeUpdate(encoder, update) - broadcastMessage(this, encoding.toUint8Array(encoder)) - } - this.updates.push(update) - }) - this.connect() - } - - /** - * Disconnect from TestConnector. - */ - disconnect () { - this.receiving = new Map() - this.tc.onlineConns.delete(this) - } - - /** - * Append yourself to the list of known Y instances in testconnector. - * Also initiate sync with all clients. - */ - connect () { - if (!this.tc.onlineConns.has(this)) { - this.tc.onlineConns.add(this) - const encoder = encoding.createEncoder() - syncProtocol.writeSyncStep1(encoder, this) - // publish SyncStep1 - broadcastMessage(this, encoding.toUint8Array(encoder)) - this.tc.onlineConns.forEach(remoteYInstance => { - if (remoteYInstance !== this) { - // remote instance sends instance to this instance - const encoder = encoding.createEncoder() - syncProtocol.writeSyncStep1(encoder, remoteYInstance) - this._receive(encoding.toUint8Array(encoder), remoteYInstance) - } - }) - } - } - - /** - * Receive a message from another client. This message is only appended to the list of receiving messages. - * TestConnector decides when this client actually reads this message. - * - * @param {Uint8Array} message - * @param {TestYInstance} remoteClient - */ - _receive (message, remoteClient) { - map.setIfUndefined(this.receiving, remoteClient, () => /** @type {Array} */ ([])).push(message) - } -} - -/** - * Keeps track of TestYInstances. - * - * The TestYInstances add/remove themselves from the list of connections maiained in this object. - * I think it makes sense. Deal with it. - */ -export class TestConnector { - /** - * @param {prng.PRNG} gen - */ - constructor (gen) { - /** - * @type {Set} - */ - this.allConns = new Set() - /** - * @type {Set} - */ - this.onlineConns = new Set() - /** - * @type {prng.PRNG} - */ - this.prng = gen - } - - /** - * Create a new Y instance and add it to the list of connections - * @param {number} clientID - */ - createY (clientID) { - return new TestYInstance(this, clientID) - } - - /** - * Choose random connection and flush a random message from a random sender. - * - * If this function was unable to flush a message, because there are no more messages to flush, it returns false. true otherwise. - * @return {boolean} - */ - flushRandomMessage () { - const gen = this.prng - const conns = Array.from(this.onlineConns).filter(conn => conn.receiving.size > 0) - if (conns.length > 0) { - const receiver = prng.oneOf(gen, conns) - const [sender, messages] = prng.oneOf(gen, Array.from(receiver.receiving)) - const m = messages.shift() - if (messages.length === 0) { - receiver.receiving.delete(sender) - } - if (m === undefined) { - return this.flushRandomMessage() - } - const encoder = encoding.createEncoder() - // console.log('receive (' + sender.userID + '->' + receiver.userID + '):\n', syncProtocol.stringifySyncMessage(decoding.createDecoder(m), receiver)) - // do not publish data created when this function is executed (could be ss2 or update message) - syncProtocol.readSyncMessage(decoding.createDecoder(m), encoder, receiver, receiver.tc) - if (encoding.length(encoder) > 0) { - // send reply message - sender._receive(encoding.toUint8Array(encoder), receiver) - } - return true - } - return false - } - - /** - * @return {boolean} True iff this function actually flushed something - */ - flushAllMessages () { - let didSomething = false - while (this.flushRandomMessage()) { - didSomething = true - } - return didSomething - } - - reconnectAll () { - this.allConns.forEach(conn => conn.connect()) - } - - disconnectAll () { - this.allConns.forEach(conn => conn.disconnect()) - } - - syncAll () { - this.reconnectAll() - this.flushAllMessages() - } - - /** - * @return {boolean} Whether it was possible to disconnect a random connection. - */ - disconnectRandom () { - if (this.onlineConns.size === 0) { - return false - } - prng.oneOf(this.prng, Array.from(this.onlineConns)).disconnect() - return true - } - - /** - * @return {boolean} Whether it was possible to reconnect a random connection. - */ - reconnectRandom () { - /** - * @type {Array} - */ - const reconnectable = [] - this.allConns.forEach(conn => { - if (!this.onlineConns.has(conn)) { - reconnectable.push(conn) - } - }) - if (reconnectable.length === 0) { - return false - } - prng.oneOf(this.prng, reconnectable).connect() - return true - } -} - -/** - * @template T - * @param {t.TestCase} tc - * @param {{users?:number}} conf - * @param {InitTestObjectCallback} [initTestObject] - * @return {{testObjects:Array,testConnector:TestConnector,users:Array,array0:Y.Array,array1:Y.Array,array2:Y.Array,map0:Y.Map,map1:Y.Map,map2:Y.Map,map3:Y.Map,text0:Y.Text,text1:Y.Text,text2:Y.Text,xml0:Y.XmlElement,xml1:Y.XmlElement,xml2:Y.XmlElement}} - */ -export const init = (tc, { users = 5 } = {}, initTestObject) => { - /** - * @type {Object} - */ - const result = { - users: [] - } - const gen = tc.prng - // choose an encoding approach at random - if (prng.bool(gen)) { - useV2Encoding() - } else { - useV1Encoding() - } - - const testConnector = new TestConnector(gen) - result.testConnector = testConnector - for (let i = 0; i < users; i++) { - const y = testConnector.createY(i) - y.clientID = i - result.users.push(y) - result['array' + i] = y.getArray('array') - result['map' + i] = y.getMap('map') - result['xml' + i] = y.get('xml', Y.XmlElement) - result['text' + i] = y.getText('text') - } - testConnector.syncAll() - result.testObjects = result.users.map(initTestObject || (() => null)) - useV1Encoding() - return /** @type {any} */ (result) -} - -/** - * 1. reconnect and flush all - * 2. user 0 gc - * 3. get type content - * 4. disconnect & reconnect all (so gc is propagated) - * 5. compare os, ds, ss - * - * @param {Array} users - */ -export const compare = users => { - users.forEach(u => u.connect()) - while (users[0].tc.flushAllMessages()) {} // eslint-disable-line - // For each document, merge all received document updates with Y.mergeUpdates and create a new document which will be added to the list of "users" - // This ensures that mergeUpdates works correctly - const mergedDocs = users.map(user => { - const ydoc = new Y.Doc() - enc.applyUpdate(ydoc, enc.mergeUpdates(user.updates)) - return ydoc - }) - users.push(.../** @type {any} */(mergedDocs)) - const userArrayValues = users.map(u => u.getArray('array').toJSON()) - const userMapValues = users.map(u => u.getMap('map').toJSON()) - const userXmlValues = users.map(u => u.get('xml', Y.XmlElement).toString()) - const userTextValues = users.map(u => u.getText('text').toDelta()) - for (const u of users) { - t.assert(u.store.pendingDs === null) - t.assert(u.store.pendingStructs === null) - } - // Test Array iterator - t.compare(users[0].getArray('array').toArray(), Array.from(users[0].getArray('array'))) - // Test Map iterator - const ymapkeys = Array.from(users[0].getMap('map').keys()) - t.assert(ymapkeys.length === Object.keys(userMapValues[0]).length) - ymapkeys.forEach(key => t.assert(object.hasProperty(userMapValues[0], key))) - /** - * @type {Object} - */ - const mapRes = {} - for (const [k, v] of users[0].getMap('map')) { - mapRes[k] = v instanceof Y.AbstractType ? v.toJSON() : v - } - t.compare(userMapValues[0], mapRes) - // Compare all users - for (let i = 0; i < users.length - 1; i++) { - t.compare(userArrayValues[i].length, users[i].getArray('array').length) - t.compare(userArrayValues[i], userArrayValues[i + 1]) - t.compare(userMapValues[i], userMapValues[i + 1]) - t.compare(userXmlValues[i], userXmlValues[i + 1]) - t.compare(userTextValues[i].map(/** @param {any} a */ a => typeof a.insert === 'string' ? a.insert : ' ').join('').length, users[i].getText('text').length) - t.compare(userTextValues[i], userTextValues[i + 1], '', (_constructor, a, b) => { - if (a instanceof Y.AbstractType) { - t.compare(a.toJSON(), b.toJSON()) - } else if (a !== b) { - t.fail('Deltas dont match') - } - return true - }) - t.compare(Y.encodeStateVector(users[i]), Y.encodeStateVector(users[i + 1])) - Y.equalDeleteSets(Y.createDeleteSetFromStructStore(users[i].store), Y.createDeleteSetFromStructStore(users[i + 1].store)) - compareStructStores(users[i].store, users[i + 1].store) - t.compare(Y.encodeSnapshot(Y.snapshot(users[i])), Y.encodeSnapshot(Y.snapshot(users[i + 1]))) - } - users.map(u => u.destroy()) -} - -/** - * @param {Y.Item?} a - * @param {Y.Item?} b - * @return {boolean} - */ -export const compareItemIDs = (a, b) => a === b || (a !== null && b != null && Y.compareIDs(a.id, b.id)) - -/** - * @param {import('../src/internals.js').StructStore} ss1 - * @param {import('../src/internals.js').StructStore} ss2 - */ -export const compareStructStores = (ss1, ss2) => { - t.assert(ss1.clients.size === ss2.clients.size) - for (const [client, structs1] of ss1.clients) { - const structs2 = /** @type {Array} */ (ss2.clients.get(client)) - t.assert(structs2 !== undefined && structs1.length === structs2.length) - for (let i = 0; i < structs1.length; i++) { - const s1 = structs1[i] - const s2 = structs2[i] - // checks for abstract struct - if ( - s1.constructor !== s2.constructor || - !Y.compareIDs(s1.id, s2.id) || - s1.deleted !== s2.deleted || - // @ts-ignore - s1.length !== s2.length - ) { - t.fail('Structs dont match') - } - if (s1 instanceof Y.Item) { - if ( - !(s2 instanceof Y.Item) || - !((s1.left === null && s2.left === null) || (s1.left !== null && s2.left !== null && Y.compareIDs(s1.left.lastId, s2.left.lastId))) || - !compareItemIDs(s1.right, s2.right) || - !Y.compareIDs(s1.origin, s2.origin) || - !Y.compareIDs(s1.rightOrigin, s2.rightOrigin) || - s1.parentSub !== s2.parentSub - ) { - return t.fail('Items dont match') - } - // make sure that items are connected correctly - t.assert(s1.left === null || s1.left.right === s1) - t.assert(s1.right === null || s1.right.left === s1) - t.assert(s2.left === null || s2.left.right === s2) - t.assert(s2.right === null || s2.right.left === s2) - } - } - } -} - -/** - * @template T - * @callback InitTestObjectCallback - * @param {TestYInstance} y - * @return {T} - */ - -/** - * @template T - * @param {t.TestCase} tc - * @param {Array} mods - * @param {number} iterations - * @param {InitTestObjectCallback} [initTestObject] - */ -export const applyRandomTests = (tc, mods, iterations, initTestObject) => { - const gen = tc.prng - const result = init(tc, { users: 5 }, initTestObject) - const { testConnector, users } = result - for (let i = 0; i < iterations; i++) { - if (prng.int32(gen, 0, 100) <= 2) { - // 2% chance to disconnect/reconnect a random user - if (prng.bool(gen)) { - testConnector.disconnectRandom() - } else { - testConnector.reconnectRandom() - } - } else if (prng.int32(gen, 0, 100) <= 1) { - // 1% chance to flush all - testConnector.flushAllMessages() - } else if (prng.int32(gen, 0, 100) <= 50) { - // 50% chance to flush a random message - testConnector.flushRandomMessage() - } - const user = prng.int32(gen, 0, users.length - 1) - const test = prng.oneOf(gen, mods) - test(users[user], gen, result.testObjects[user]) - } - compare(users) - return result -} diff --git a/yjs-poll/run_yjs_server.sh b/yjs-poll/run_yjs_server.sh deleted file mode 100644 index a8503ee..0000000 --- a/yjs-poll/run_yjs_server.sh +++ /dev/null @@ -1,3 +0,0 @@ -# The following is suggested in the Yjs docs (https://docs.yjs.dev/ecosystem/connection-provider/y-websocket) -# However, it does not work across a range of NPM versions... -HOST=localhost PORT=1000 npx y-websocket
-
y-utility
-
-Library with YMultiDocUndoManager (undo/redo across Yjs docs) and -YKeyValue (optimized key-value store). -
-
- yjs-orderedtree 🌳 -
-
-Class for ordered trees via Y.Map. Handles insert, -delete, and move operations for folder-like -hierarchies. -
- -