/* This needs an entire rewrite using the FSM code. Most of this is hacked on garbage that is unreliable at the best of times. The documentation here is mostly give what I have a bit of help, and I keep this _mostly_ as an example of how to work with an older API. In the future I want to rewrite this--or write an alternative--that uses the `client/fsm.js` library similar to how `HLSVideo.svelte` works. */ const seedTimeout = 60000; import { webtorrent, base_host } from '$/client/config.js'; import assert from "$/client/assert.js"; import { log } from "$/client/logging.js"; let LAZY_CLIENT; // this is lazy loaded by getClient /* Load the massive WebTorrent client javascript. ___WARNING___: having svelte build the webtorrent client into the script makes it slow to load and massive. it's much faster to set it as a script variable in the index.html but that might cause loading problems WebTorrent then comes from the public/index.html file, not from an import in here */ const getClient = () => { // super hacks! if(LAZY_CLIENT) { return LAZY_CLIENT; } else { // eslint will complain but webtorrent is loaded by