leafrelay 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -4
- package/README.zh-CN.md +30 -4
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +45 -49
- package/dist/cli.js.map +1 -1
- package/dist/daemon.d.ts +1 -0
- package/dist/daemon.js +866 -934
- package/dist/daemon.js.map +1 -1
- package/dist/dist-JyfvbgjD.js +2923 -0
- package/dist/dist-JyfvbgjD.js.map +1 -0
- package/dist/index.d.ts +15 -16
- package/dist/index.js +1 -8
- package/dist/serve-CQnCOCAM.js +6823 -0
- package/dist/serve-CQnCOCAM.js.map +1 -0
- package/package.json +10 -10
- package/dist/chunk-3TTRDNHP.js +0 -3333
- package/dist/chunk-3TTRDNHP.js.map +0 -1
- package/dist/chunk-4EHEWM7N.js +0 -7393
- package/dist/chunk-4EHEWM7N.js.map +0 -1
- package/dist/chunk-5WRI5ZAA.js +0 -31
- package/dist/chunk-5WRI5ZAA.js.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dist-JyfvbgjD.js","names":[],"sources":["../../core/dist/index.js"],"sourcesContent":["import { Blob as Blob$1 } from \"node:buffer\";\nimport mime from \"mime\";\nimport { EventEmitter } from \"node:events\";\nimport { v4 } from \"uuid\";\nimport { promisify } from \"node:util\";\nimport { chmod, lstat, mkdir, readFile, readdir, rename, rm, writeFile } from \"node:fs/promises\";\nimport { homedir } from \"node:os\";\nimport { dirname, join, posix, relative, resolve, sep } from \"node:path\";\nimport { watch } from \"chokidar\";\nimport { minimatch } from \"minimatch\";\nimport { createHash, randomUUID } from \"node:crypto\";\nimport DiffMatchPatch from \"diff-match-patch\";\nimport { diff3Merge } from \"node-diff3\";\n// src/api/overleafRealtimeSocket.ts\nconst PACKET_TYPES = [\n\t\"disconnect\",\n\t\"connect\",\n\t\"heartbeat\",\n\t\"message\",\n\t\"json\",\n\t\"event\",\n\t\"ack\",\n\t\"error\",\n\t\"noop\"\n];\nfunction encodePacket(packet) {\n\tconst type = PACKET_TYPES.indexOf(packet.type ?? \"noop\");\n\tconst id = packet.id ?? \"\";\n\tlet data;\n\tswitch (packet.type) {\n\t\tcase \"event\":\n\t\t\tdata = JSON.stringify({\n\t\t\t\tname: packet.name,\n\t\t\t\targs: packet.args ?? []\n\t\t\t});\n\t\t\tbreak;\n\t\tcase \"ack\":\n\t\t\tdata = `${packet.ackId ?? \"\"}${packet.args?.length ? `+${JSON.stringify(packet.args)}` : \"\"}`;\n\t\t\tbreak;\n\t\tcase \"message\":\n\t\t\tdata = String(packet.data ?? \"\");\n\t\t\tbreak;\n\t\tcase \"json\": data = JSON.stringify(packet.data);\n\t}\n\tconst fields = [\n\t\tString(type),\n\t\t`${id}${packet.ack === \"data\" ? \"+\" : \"\"}`,\n\t\tpacket.endpoint ?? \"\"\n\t];\n\tif (data !== void 0) fields.push(data);\n\treturn fields.join(\":\");\n}\nfunction decodePacket(value) {\n\tconst match = value.match(/([^:]+):([0-9]+)?(\\+)?:([^:]+)?:?([\\s\\S]*)?/);\n\tif (!match) return {};\n\tconst packet = {\n\t\ttype: PACKET_TYPES[Number(match[1])],\n\t\tendpoint: match[4] || \"\"\n\t};\n\tif (match[2]) {\n\t\tpacket.id = match[2];\n\t\tpacket.ack = match[3] ? \"data\" : true;\n\t}\n\tconst data = match[5] || \"\";\n\tswitch (packet.type) {\n\t\tcase \"event\": {\n\t\t\tconst event = JSON.parse(data);\n\t\t\tpacket.name = event.name;\n\t\t\tpacket.args = event.args ?? [];\n\t\t\tbreak;\n\t\t}\n\t\tcase \"ack\": {\n\t\t\tconst ack = data.match(/^([0-9]+)(\\+)?([\\s\\S]*)/);\n\t\t\tif (ack) {\n\t\t\t\tpacket.ackId = ack[1];\n\t\t\t\tpacket.args = ack[3] ? JSON.parse(ack[3]) : [];\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"error\": {\n\t\t\tconst [reason, advice] = data.split(\"+\");\n\t\t\tpacket.reason = [\n\t\t\t\t\"transport not supported\",\n\t\t\t\t\"client not handshaken\",\n\t\t\t\t\"unauthorized\"\n\t\t\t][Number(reason)] ?? \"\";\n\t\t\tpacket.advice = [\"reconnect\"][Number(advice)] ?? \"\";\n\t\t\tbreak;\n\t\t}\n\t\tcase \"json\":\n\t\t\tpacket.data = JSON.parse(data);\n\t\t\tbreak;\n\t\tcase \"message\": packet.data = data;\n\t}\n\treturn packet;\n}\nfunction decodePayload(value) {\n\tif (!value.startsWith(\"�\")) return [decodePacket(value)];\n\tconst packets = [];\n\tlet offset = 1;\n\twhile (offset < value.length) {\n\t\tconst separator = value.indexOf(\"�\", offset);\n\t\tif (separator === -1) break;\n\t\tconst length = Number(value.slice(offset, separator));\n\t\tconst start = separator + 1;\n\t\tpackets.push(decodePacket(value.slice(start, start + length)));\n\t\toffset = start + length + 1;\n\t}\n\treturn packets;\n}\nfunction mergeCookies(current, additions) {\n\tconst cookies = /* @__PURE__ */ new Map();\n\tfor (const value of [current, ...additions.map((cookie) => cookie.split(\";\", 1)[0])]) for (const part of value.split(\";\")) {\n\t\tconst separator = part.indexOf(\"=\");\n\t\tif (separator === -1) continue;\n\t\tcookies.set(part.slice(0, separator).trim(), part.slice(separator + 1).trim());\n\t}\n\treturn [...cookies].map(([name, value]) => `${name}=${value}`).join(\"; \");\n}\nvar OverleafRealtimeSocket = class {\n\toptions;\n\tevents = new EventEmitter();\n\tendpoint;\n\torigin;\n\tcookie;\n\tsocket;\n\tconnected = false;\n\tprojectJoined = false;\n\texplicitlyDisconnected = false;\n\treconnectEnabled;\n\treconnectAttempts = 0;\n\treconnectTimer;\n\tinactivityTimer;\n\tconnectionAbort;\n\tcloseTimeoutMs = 6e4;\n\tacknowledgementId = 0;\n\tacknowledgements = /* @__PURE__ */ new Map();\n\tio = { reconnect: (enabled) => {\n\t\tthis.reconnectEnabled = enabled;\n\t\tif (!enabled && this.reconnectTimer) {\n\t\t\tclearTimeout(this.reconnectTimer);\n\t\t\tthis.reconnectTimer = void 0;\n\t\t}\n\t} };\n\tconstructor(url, options) {\n\t\tthis.options = options;\n\t\tthis.endpoint = new URL(url);\n\t\tthis.origin = options.origin;\n\t\tthis.cookie = options.cookie;\n\t\tthis.reconnectEnabled = options.reconnect ?? true;\n\t\tthis.connect();\n\t}\n\ton(event, handler) {\n\t\tthis.events.on(event, handler);\n\t\treturn this;\n\t}\n\tonce(event, handler) {\n\t\tthis.events.once(event, handler);\n\t\treturn this;\n\t}\n\tremoveListener(event, handler) {\n\t\tthis.events.removeListener(event, handler);\n\t\treturn this;\n\t}\n\tremoveAllListeners(event) {\n\t\tthis.events.removeAllListeners(event);\n\t\treturn this;\n\t}\n\temit(event, ...args) {\n\t\tconst callback = typeof args.at(-1) === \"function\" ? args.pop() : void 0;\n\t\tconst id = callback ? String(++this.acknowledgementId) : void 0;\n\t\tif (id && callback) this.acknowledgements.set(id, callback);\n\t\tconst packet = encodePacket({\n\t\t\ttype: \"event\",\n\t\t\tid,\n\t\t\tack: callback ? \"data\" : void 0,\n\t\t\tname: event,\n\t\t\targs\n\t\t});\n\t\tif (!this.sendApplicationEvent(packet) && callback) {\n\t\t\tif (id) this.acknowledgements.delete(id);\n\t\t\tqueueMicrotask(() => callback(/* @__PURE__ */ new Error(\"The Overleaf project session is not connected.\")));\n\t\t}\n\t\treturn this;\n\t}\n\tmarkProjectJoined() {\n\t\tthis.projectJoined = true;\n\t}\n\tdisconnect() {\n\t\tthis.explicitlyDisconnected = true;\n\t\tthis.reconnectEnabled = false;\n\t\tif (this.reconnectTimer) clearTimeout(this.reconnectTimer);\n\t\tif (this.connected) this.send(encodePacket({ type: \"disconnect\" }));\n\t\tthis.closeSocket(\"booted\");\n\t\treturn this;\n\t}\n\tasync connect() {\n\t\tif (this.explicitlyDisconnected) return;\n\t\tconst controller = new AbortController();\n\t\tthis.connectionAbort?.abort();\n\t\tthis.connectionAbort = controller;\n\t\ttry {\n\t\t\tthis.projectJoined = false;\n\t\t\tconst handshakeUrl = new URL(\"/socket.io/1/\", this.endpoint.origin);\n\t\t\tfor (const [name, value] of this.endpoint.searchParams) handshakeUrl.searchParams.set(name, value);\n\t\t\thandshakeUrl.searchParams.set(\"t\", String(Date.now()));\n\t\t\tconst response = await (this.options.fetch ?? fetch)(handshakeUrl, {\n\t\t\t\theaders: {\n\t\t\t\t\torigin: this.origin,\n\t\t\t\t\tcookie: this.cookie\n\t\t\t\t},\n\t\t\t\tredirect: \"manual\",\n\t\t\t\tsignal: AbortSignal.any([controller.signal, AbortSignal.timeout(15e3)])\n\t\t\t});\n\t\t\tif (!response.ok) throw new Error(`Socket.IO handshake failed: HTTP ${response.status} ${await response.text()}`);\n\t\t\tconst setCookies = response.headers.getSetCookie?.() ?? [];\n\t\t\tthis.cookie = mergeCookies(this.cookie, setCookies);\n\t\t\tconst [sessionId, heartbeatTimeout, closeTimeout, transports] = (await response.text()).split(\":\");\n\t\t\tif (!sessionId || !transports?.split(\",\").includes(\"websocket\")) throw new Error(\"Overleaf did not offer a Socket.IO WebSocket transport.\");\n\t\t\tthis.closeTimeoutMs = Math.max(Number(heartbeatTimeout), Number(closeTimeout), 10) * 1e3;\n\t\t\tconst websocketUrl = new URL(`/socket.io/1/websocket/${sessionId}`, this.endpoint.origin);\n\t\t\twebsocketUrl.protocol = websocketUrl.protocol === \"https:\" ? \"wss:\" : \"ws:\";\n\t\t\twebsocketUrl.search = this.endpoint.search;\n\t\t\tif (controller.signal.aborted) return;\n\t\t\tconst socket = new WebSocket(websocketUrl, { headers: {\n\t\t\t\torigin: this.origin,\n\t\t\t\tcookie: this.cookie\n\t\t\t} });\n\t\t\tthis.socket = socket;\n\t\t\tsocket.addEventListener(\"open\", () => {\n\t\t\t\tif (this.socket !== socket) return;\n\t\t\t\tthis.resetInactivityTimer();\n\t\t\t\tthis.events.emit(\"connecting\", \"websocket\");\n\t\t\t});\n\t\t\tsocket.addEventListener(\"message\", (event) => {\n\t\t\t\tif (this.socket === socket) this.receive(event.data, socket);\n\t\t\t});\n\t\t\tsocket.addEventListener(\"error\", (error) => {\n\t\t\t\tif (this.socket === socket) this.events.emit(\"error\", error);\n\t\t\t});\n\t\t\tsocket.addEventListener(\"close\", (event) => {\n\t\t\t\tif (this.socket === socket) this.handleClose(event);\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (controller.signal.aborted) return;\n\t\t\tthis.events.emit(\"connect_failed\", error);\n\t\t\tthis.events.emit(\"error\", error);\n\t\t\tthis.scheduleReconnect();\n\t\t}\n\t}\n\tasync receive(data, socket) {\n\t\tthis.resetInactivityTimer();\n\t\tconst value = typeof data === \"string\" ? data : data instanceof Blob ? await data.text() : Buffer.from(data).toString(\"utf8\");\n\t\tif (this.socket !== socket) return;\n\t\tfor (const packet of decodePayload(value)) this.handlePacket(packet);\n\t}\n\thandlePacket(packet) {\n\t\tswitch (packet.type) {\n\t\t\tcase \"connect\": {\n\t\t\t\tconst wasReconnecting = this.reconnectAttempts > 0;\n\t\t\t\tthis.connected = true;\n\t\t\t\tthis.events.emit(\"connect\");\n\t\t\t\tif (wasReconnecting) {\n\t\t\t\t\tthis.events.emit(\"reconnect\", \"websocket\", this.reconnectAttempts);\n\t\t\t\t\tthis.reconnectAttempts = 0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"heartbeat\":\n\t\t\t\tthis.send(encodePacket({ type: \"heartbeat\" }));\n\t\t\t\tbreak;\n\t\t\tcase \"event\": {\n\t\t\t\tconst args = [...packet.args ?? []];\n\t\t\t\tif (packet.ack === \"data\" && packet.id) args.push((...acknowledgement) => {\n\t\t\t\t\tthis.send(encodePacket({\n\t\t\t\t\t\ttype: \"ack\",\n\t\t\t\t\t\tackId: packet.id,\n\t\t\t\t\t\targs: acknowledgement\n\t\t\t\t\t}));\n\t\t\t\t});\n\t\t\t\tthis.events.emit(packet.name ?? \"\", ...args);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"ack\": {\n\t\t\t\tconst callback = packet.ackId && this.acknowledgements.get(packet.ackId);\n\t\t\t\tif (callback && packet.ackId) {\n\t\t\t\t\tthis.acknowledgements.delete(packet.ackId);\n\t\t\t\t\tcallback(...packet.args ?? []);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"disconnect\":\n\t\t\t\tthis.closeSocket(\"booted\");\n\t\t\t\tbreak;\n\t\t\tcase \"error\":\n\t\t\t\tthis.events.emit(\"error\", packet.reason || \"Socket.IO protocol error\");\n\t\t\t\tif (packet.advice === \"reconnect\") this.closeSocket(\"server error\");\n\t\t\t\tbreak;\n\t\t\tcase \"message\":\n\t\t\tcase \"json\": this.events.emit(\"message\", packet.data);\n\t\t}\n\t}\n\tsend(packet) {\n\t\tif (this.connected && this.socket?.readyState === WebSocket.OPEN) this.socket.send(packet);\n\t}\n\tsendApplicationEvent(packet) {\n\t\tif (!this.connected || !this.projectJoined || this.socket?.readyState !== WebSocket.OPEN) return false;\n\t\tthis.socket.send(packet);\n\t\treturn true;\n\t}\n\tresetInactivityTimer() {\n\t\tif (this.inactivityTimer) clearTimeout(this.inactivityTimer);\n\t\tthis.inactivityTimer = setTimeout(() => this.closeSocket(\"timeout\"), this.closeTimeoutMs);\n\t}\n\thandleClose(event) {\n\t\tconst wasConnected = this.connected;\n\t\tthis.socket = void 0;\n\t\tthis.connected = false;\n\t\tthis.projectJoined = false;\n\t\tif (this.inactivityTimer) clearTimeout(this.inactivityTimer);\n\t\tif (wasConnected) {\n\t\t\tconst detail = event.reason ? `: ${event.reason}` : \"\";\n\t\t\tconst reason = `transport close (code ${event.code})${detail}`;\n\t\t\tthis.failAcknowledgements(reason);\n\t\t\tthis.events.emit(\"disconnect\", reason);\n\t\t}\n\t\tthis.scheduleReconnect();\n\t}\n\tcloseSocket(reason) {\n\t\tthis.connectionAbort?.abort();\n\t\tthis.connectionAbort = void 0;\n\t\tconst wasConnected = this.connected;\n\t\tthis.connected = false;\n\t\tthis.projectJoined = false;\n\t\tif (this.inactivityTimer) clearTimeout(this.inactivityTimer);\n\t\tconst socket = this.socket;\n\t\tthis.socket = void 0;\n\t\tsocket?.close();\n\t\tif (wasConnected) {\n\t\t\tthis.failAcknowledgements(reason);\n\t\t\tthis.events.emit(\"disconnect\", reason);\n\t\t}\n\t\tif (!this.explicitlyDisconnected) this.scheduleReconnect();\n\t}\n\tfailAcknowledgements(reason) {\n\t\tconst error = /* @__PURE__ */ new Error(`Overleaf realtime connection closed: ${reason}`);\n\t\tfor (const callback of this.acknowledgements.values()) callback(error);\n\t\tthis.acknowledgements.clear();\n\t}\n\tscheduleReconnect() {\n\t\tif (!this.reconnectEnabled || this.explicitlyDisconnected || this.reconnectTimer) return;\n\t\tconst maxAttempts = this.options.maxReconnectionAttempts ?? Infinity;\n\t\tif (this.reconnectAttempts >= maxAttempts) {\n\t\t\tthis.events.emit(\"reconnect_failed\");\n\t\t\treturn;\n\t\t}\n\t\tthis.reconnectAttempts += 1;\n\t\tconst initial = this.options.reconnectionDelay ?? 1e3;\n\t\tconst limit = this.options.reconnectionLimit ?? 16e3;\n\t\tconst delay = Math.min(initial * 2 ** (this.reconnectAttempts - 1), limit);\n\t\tthis.events.emit(\"reconnecting\", delay, this.reconnectAttempts);\n\t\tthis.reconnectTimer = setTimeout(() => {\n\t\t\tthis.reconnectTimer = void 0;\n\t\t\tthis.connect();\n\t\t}, delay);\n\t}\n};\nconst overleafSocketProtocol = {\n\tencodePacket,\n\tdecodePacket,\n\tdecodePayload\n};\n// src/core/logger.ts\nlet sink;\nfunction setLogSink(nextSink) {\n\tsink = nextSink;\n}\nfunction write(level, args) {\n\tif (sink !== void 0) {\n\t\tsink(level, args);\n\t\treturn;\n\t}\n\t(level === \"error\" ? console.error : level === \"warn\" ? console.warn : console.log)(...args);\n}\nfunction log(...args) {\n\twrite(\"info\", args);\n}\nfunction warn(...args) {\n\twrite(\"warn\", args);\n}\nfunction error(...args) {\n\twrite(\"error\", args);\n}\n// src/api/requestScheduler.ts\nfunction retryAfterMilliseconds(response, now) {\n\tconst retryAfter = response.headers.get(\"retry-after\");\n\tif (retryAfter) {\n\t\tconst seconds = Number(retryAfter);\n\t\tif (Number.isFinite(seconds)) return Math.max(1e3, seconds * 1e3);\n\t\tconst retryAt = Date.parse(retryAfter);\n\t\tif (Number.isFinite(retryAt)) return Math.max(1e3, retryAt - now);\n\t}\n\treturn 5e3;\n}\nvar HttpRequestScheduler = class {\n\toptions;\n\tchain = Promise.resolve();\n\tnextRequestAt = 0;\n\thistoryNextRequestAt = 0;\n\trateLimitedUntil = 0;\n\tminimumIntervalMs;\n\thistoryIntervalMs;\n\tfetchImplementation;\n\tnow;\n\twait;\n\tconstructor(options = {}) {\n\t\tthis.options = options;\n\t\tthis.minimumIntervalMs = options.minimumIntervalMs ?? 300;\n\t\tthis.historyIntervalMs = options.historyIntervalMs ?? 3e3;\n\t\tthis.fetchImplementation = options.fetch ?? fetch;\n\t\tthis.now = options.now ?? Date.now;\n\t\tthis.wait = options.wait ?? ((milliseconds) => new Promise((resolveWait) => setTimeout(resolveWait, milliseconds)));\n\t}\n\tfetch(input, init, timeoutMs = this.options.requestTimeoutMs ?? 6e4) {\n\t\tconst url = input instanceof Request ? input.url : String(input);\n\t\tconst history = url.includes(\"/updates?\") || url.includes(\"/filetree/diff?\") || url.includes(\"/diff?\");\n\t\treturn this.enqueue(async () => {\n\t\t\tconst now = this.now();\n\t\t\tconst readyAt = Math.max(this.nextRequestAt, this.rateLimitedUntil, history ? this.historyNextRequestAt : 0);\n\t\t\tif (readyAt > now) await this.wait(readyAt - now);\n\t\t\tconst requestAt = this.now();\n\t\t\tthis.nextRequestAt = requestAt + this.minimumIntervalMs;\n\t\t\tif (history) this.historyNextRequestAt = requestAt + this.historyIntervalMs;\n\t\t\tconst signals = [\n\t\t\t\tAbortSignal.timeout(timeoutMs),\n\t\t\t\tinit?.signal,\n\t\t\t\tinput instanceof Request ? input.signal : void 0\n\t\t\t].filter((signal) => Boolean(signal));\n\t\t\tlet response;\n\t\t\ttry {\n\t\t\t\tresponse = await this.fetchImplementation(input, {\n\t\t\t\t\t...init,\n\t\t\t\t\tsignal: AbortSignal.any(signals)\n\t\t\t\t});\n\t\t\t} catch (error$1) {\n\t\t\t\tconst destination = new URL(url);\n\t\t\t\terror(\"HTTP request failed\", {\n\t\t\t\t\tmethod: init?.method ?? (input instanceof Request ? input.method : \"GET\"),\n\t\t\t\t\turl: `${destination.origin}${destination.pathname}`,\n\t\t\t\t\terror: error$1\n\t\t\t\t});\n\t\t\t\tthrow error$1;\n\t\t\t}\n\t\t\tif (response.status === 429) {\n\t\t\t\tthis.rateLimitedUntil = Math.max(this.rateLimitedUntil, this.now() + retryAfterMilliseconds(response, this.now()));\n\t\t\t\tthis.options.onRateLimit?.(this.rateLimitedUntil);\n\t\t\t\tlog(`HTTP request scheduler entered rate-limit cooldown until ${new Date(this.rateLimitedUntil).toISOString()}.`);\n\t\t\t}\n\t\t\treturn response;\n\t\t});\n\t}\n\tenqueue(operation) {\n\t\tconst result = this.chain.then(operation);\n\t\tthis.chain = result.then(() => void 0, () => void 0);\n\t\treturn result;\n\t}\n};\nconst sharedHttpRequestScheduler = new HttpRequestScheduler();\n// src/api/base.ts\n/** Extract set-cookie headers from an undici/Response object. */\nfunction getSetCookie(res) {\n\tif (typeof res.headers?.getSetCookie === \"function\") return res.headers.getSetCookie();\n\tconst raw = res.headers?.raw?.()?.[\"set-cookie\"];\n\tif (raw) return raw;\n\treturn [];\n}\nvar BaseAPI = class {\n\tscheduler;\n\turl;\n\tidentity;\n\tretryAfterMs(response, attempt) {\n\t\tconst retryAfter = response.headers?.get?.(\"retry-after\");\n\t\tif (retryAfter !== void 0 && retryAfter !== null) {\n\t\t\tconst seconds = Number(retryAfter);\n\t\t\tif (Number.isFinite(seconds)) return Math.max(1e3, seconds * 1e3);\n\t\t\tconst retryAt = Date.parse(retryAfter);\n\t\t\tif (Number.isFinite(retryAt)) return Math.max(1e3, retryAt - Date.now());\n\t\t}\n\t\treturn 5e3 * Math.pow(2, attempt);\n\t}\n\tconstructor(url, scheduler = sharedHttpRequestScheduler) {\n\t\tthis.scheduler = scheduler;\n\t\tthis.url = url;\n\t}\n\tasync getCsrfToken() {\n\t\tconst res = await this.scheduler.fetch(this.url + \"login\", {\n\t\t\tmethod: \"GET\",\n\t\t\tredirect: \"manual\"\n\t\t});\n\t\tconst match = (await res.text()).match(/<input.*name=\"_csrf\".*value=\"([^\"]*)\">/);\n\t\tif (!match) throw new Error(\"Failed to get CSRF token.\");\n\t\telse return {\n\t\t\tcsrfToken: match[1],\n\t\t\tcookies: getSetCookie(res)[0]?.split(\";\")[0] ?? \"\"\n\t\t};\n\t}\n\tasync getUserId(cookies) {\n\t\tconst body = await (await this.scheduler.fetch(this.url + \"project\", {\n\t\t\tmethod: \"GET\",\n\t\t\tredirect: \"manual\",\n\t\t\theaders: {\n\t\t\t\tConnection: \"keep-alive\",\n\t\t\t\tCookie: cookies\n\t\t\t}\n\t\t})).text();\n\t\tconst userIDMatch = body.match(/<meta\\s+name=\"ol-user_id\"\\s+content=\"([^\"]*)\">/);\n\t\tconst userEmailMatch = body.match(/<meta\\s+name=\"ol-usersEmail\"\\s+content=\"([^\"]*)\">/);\n\t\tconst csrfTokenMatch = body.match(/<meta\\s+name=\"ol-csrfToken\"\\s+content=\"([^\"]*)\">/);\n\t\tif (userIDMatch !== null && csrfTokenMatch !== null) {\n\t\t\tconst userId = userIDMatch[1];\n\t\t\tconst csrfToken = csrfTokenMatch[1];\n\t\t\treturn {\n\t\t\t\tuserId,\n\t\t\t\tuserEmail: userEmailMatch ? userEmailMatch[1] : \"\",\n\t\t\t\tcsrfToken\n\t\t\t};\n\t\t} else return;\n\t}\n\t_initSocketV0(identity, query) {\n\t\treturn new OverleafRealtimeSocket(new URL(this.url).origin + (query ?? \"\"), {\n\t\t\torigin: new URL(this.url).origin,\n\t\t\tcookie: identity.cookies,\n\t\t\treconnect: true,\n\t\t\treconnectionDelay: 1e3,\n\t\t\treconnectionLimit: 16e3,\n\t\t\tmaxReconnectionAttempts: 10,\n\t\t\tfetch: (input, init) => this.scheduler.fetch(input, init)\n\t\t});\n\t}\n\tasync passportLogin(email, password) {\n\t\tconst identity = await this.getCsrfToken();\n\t\tconst res = await this.scheduler.fetch(this.url + \"login\", {\n\t\t\tmethod: \"POST\",\n\t\t\tredirect: \"manual\",\n\t\t\theaders: {\n\t\t\t\tAccept: \"*/*\",\n\t\t\t\t\"Accept-Encoding\": \"gzip, deflate, br\",\n\t\t\t\tConnection: \"keep-alive\",\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\tCookie: identity.cookies,\n\t\t\t\t\"X-Csrf-Token\": identity.csrfToken\n\t\t\t},\n\t\t\tbody: JSON.stringify({\n\t\t\t\t_csrf: identity.csrfToken,\n\t\t\t\temail,\n\t\t\t\tpassword\n\t\t\t})\n\t\t});\n\t\tif (res.status === 302) {\n\t\t\tconst redirect = (await res.text()).match(/Found. Redirecting to (.*)/)[1];\n\t\t\tif (redirect === \"/project\") {\n\t\t\t\tconst cookies = getSetCookie(res)[0] ?? \"\";\n\t\t\t\treturn await this.cookiesLogin(cookies);\n\t\t\t} else return {\n\t\t\t\ttype: \"error\",\n\t\t\t\tmessage: `Redirecting to /${redirect}`\n\t\t\t};\n\t\t} else if (res.status === 200) return {\n\t\t\ttype: \"error\",\n\t\t\tmessage: (await res.json()).message.message\n\t\t};\n\t\telse if (res.status === 401) return {\n\t\t\ttype: \"error\",\n\t\t\tmessage: (await res.json()).message.text\n\t\t};\n\t\telse return {\n\t\t\ttype: \"error\",\n\t\t\tmessage: `${res.status}: ` + await res.text()\n\t\t};\n\t}\n\tasync cookiesLogin(cookies) {\n\t\tconst res = await this.getUserId(cookies);\n\t\tif (res) {\n\t\t\tconst { userId, userEmail, csrfToken } = res;\n\t\t\tconst identity = await this.updateCookies({\n\t\t\t\tcookies,\n\t\t\t\tcsrfToken\n\t\t\t});\n\t\t\treturn {\n\t\t\t\ttype: \"success\",\n\t\t\t\tuserInfo: {\n\t\t\t\t\tuserId,\n\t\t\t\t\tuserEmail\n\t\t\t\t},\n\t\t\t\tidentity\n\t\t\t};\n\t\t} else return {\n\t\t\ttype: \"error\",\n\t\t\tmessage: \"Failed to get User ID.\"\n\t\t};\n\t}\n\tasync updateCookies(identity) {\n\t\tconst cookies = getSetCookie(await this.scheduler.fetch(this.url + \"socket.io/socket.io.js\", {\n\t\t\tmethod: \"GET\",\n\t\t\tredirect: \"manual\",\n\t\t\theaders: {\n\t\t\t\tConnection: \"keep-alive\",\n\t\t\t\tCookie: identity.cookies\n\t\t\t}\n\t\t}))[0]?.split(\";\")[0];\n\t\tif (cookies) identity.cookies = `${identity.cookies}; ${cookies}`;\n\t\treturn identity;\n\t}\n\tsetIdentity(identity) {\n\t\tthis.identity = identity;\n\t\treturn this;\n\t}\n\t/**\n\t* Check if an HTTP error is transient (worth retrying).\n\t* Retries on: 5xx server errors, network errors (fetch failures), and 429 rate limiting.\n\t*/\n\tisTransientError(statusCode, errorMessage) {\n\t\tif (statusCode === void 0) return true;\n\t\tif (statusCode >= 500 || statusCode === 429) return true;\n\t\tif (errorMessage && (errorMessage.includes(\"ECONNRESET\") || errorMessage.includes(\"ETIMEDOUT\") || errorMessage.includes(\"ECONNREFUSED\") || errorMessage.includes(\"ENOTFOUND\") || errorMessage.includes(\"socket hang up\"))) return true;\n\t\treturn false;\n\t}\n\tasync request(type, route, body, callback, extraHeaders, timeoutMs) {\n\t\tif (this.identity === void 0) return Promise.reject();\n\t\tconst MAX_HTTP_RETRIES = 2;\n\t\tlet lastError = {};\n\t\tfor (let attempt = 0; attempt <= MAX_HTTP_RETRIES; attempt++) try {\n\t\t\tlet res = void 0;\n\t\t\tswitch (type) {\n\t\t\t\tcase \"GET\":\n\t\t\t\t\tres = await this.scheduler.fetch(this.url + route, {\n\t\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t\t\tredirect: \"manual\",\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\tConnection: \"keep-alive\",\n\t\t\t\t\t\t\tCookie: this.identity.cookies,\n\t\t\t\t\t\t\t...extraHeaders\n\t\t\t\t\t\t}\n\t\t\t\t\t}, timeoutMs);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"POST\":\n\t\t\t\t\tconst content_type = body instanceof FormData ? void 0 : { \"Content-Type\": \"application/json\" };\n\t\t\t\t\tconst raw_body = body instanceof FormData ? body : JSON.stringify({\n\t\t\t\t\t\t_csrf: this.identity.csrfToken,\n\t\t\t\t\t\t...body\n\t\t\t\t\t});\n\t\t\t\t\tres = await this.scheduler.fetch(this.url + route, {\n\t\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\t\tredirect: \"manual\",\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\tConnection: \"keep-alive\",\n\t\t\t\t\t\t\tCookie: this.identity.cookies,\n\t\t\t\t\t\t\t...content_type,\n\t\t\t\t\t\t\t...extraHeaders\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: raw_body\n\t\t\t\t\t}, timeoutMs);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"PUT\": break;\n\t\t\t\tcase \"DELETE\": res = await this.scheduler.fetch(this.url + route, {\n\t\t\t\t\tmethod: \"DELETE\",\n\t\t\t\t\tredirect: \"manual\",\n\t\t\t\t\theaders: {\n\t\t\t\t\t\tConnection: \"keep-alive\",\n\t\t\t\t\t\tCookie: this.identity.cookies,\n\t\t\t\t\t\t\"X-Csrf-Token\": this.identity.csrfToken,\n\t\t\t\t\t\t...extraHeaders\n\t\t\t\t\t}\n\t\t\t\t}, timeoutMs);\n\t\t\t}\n\t\t\tif (res && (res.status === 200 || res.status === 204)) {\n\t\t\t\tconst _res = res.status === 200 ? await res.text() : void 0;\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"success\",\n\t\t\t\t\t...callback && callback(_res)\n\t\t\t\t};\n\t\t\t} else if (res && this.isTransientError(res.status) && attempt < MAX_HTTP_RETRIES) {\n\t\t\t\tconst delayMs = res.status === 429 ? this.retryAfterMs(res, attempt) : Math.min(1e3 * Math.pow(2, attempt), 4e3);\n\t\t\t\tlog(`HTTP ${res.status} on ${route}, retrying in ${delayMs}ms (attempt ${attempt + 1}/${MAX_HTTP_RETRIES})`);\n\t\t\t\tlastError = {\n\t\t\t\t\tstatusCode: res.status,\n\t\t\t\t\tmessage: await res.text().catch(() => \"\")\n\t\t\t\t};\n\t\t\t\tawait new Promise((r) => setTimeout(r, delayMs));\n\t\t\t\tcontinue;\n\t\t\t} else {\n\t\t\t\tconst resOrFallback = res || {\n\t\t\t\t\tstatus: \"undefined\",\n\t\t\t\t\ttext: async () => \"\"\n\t\t\t\t};\n\t\t\t\tlet errorBody = \"\";\n\t\t\t\ttry {\n\t\t\t\t\terrorBody = await resOrFallback.text();\n\t\t\t\t} catch {\n\t\t\t\t\terrorBody = \"\";\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\tstatusCode: typeof resOrFallback.status === \"number\" ? resOrFallback.status : void 0,\n\t\t\t\t\tmessage: `${resOrFallback.status}: ${errorBody}`\n\t\t\t\t};\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tconst errMsg = err?.message || String(err);\n\t\t\tif (this.isTransientError(void 0, errMsg) && attempt < MAX_HTTP_RETRIES) {\n\t\t\t\tconst delayMs = Math.min(1e3 * Math.pow(2, attempt), 4e3);\n\t\t\t\tlog(`HTTP fetch error on ${route}: ${errMsg}, retrying in ${delayMs}ms (attempt ${attempt + 1}/${MAX_HTTP_RETRIES})`);\n\t\t\t\tawait new Promise((r) => setTimeout(r, delayMs));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttype: \"error\",\n\t\t\t\tstatusCode: void 0,\n\t\t\t\tmessage: errMsg\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\ttype: \"error\",\n\t\t\tstatusCode: lastError.statusCode,\n\t\t\tmessage: lastError.message || `Request failed after 3 attempts`\n\t\t};\n\t}\n\tasync download(route) {\n\t\tif (this.identity === void 0) return Promise.reject();\n\t\tlet content = [];\n\t\twhile (true) {\n\t\t\tconst res = await this.scheduler.fetch(this.url + route, {\n\t\t\t\tmethod: \"GET\",\n\t\t\t\tredirect: \"manual\",\n\t\t\t\theaders: {\n\t\t\t\t\tConnection: \"keep-alive\",\n\t\t\t\t\tCookie: this.identity.cookies\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (res.status === 200) {\n\t\t\t\tcontent.push(Buffer.from(await res.arrayBuffer()));\n\t\t\t\tbreak;\n\t\t\t} else if (res.status === 206) content.push(Buffer.from(await res.arrayBuffer()));\n\t\t\telse break;\n\t\t}\n\t\treturn Buffer.concat(content);\n\t}\n\tasync logout(identity) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", \"logout\");\n\t}\n\tasync userProjectsJson(identity) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"GET\", \"user/projects\", void 0, (res) => {\n\t\t\tconst projects = JSON.parse(res).projects;\n\t\t\tprojects.forEach((project) => {\n\t\t\t\tproject.id = project._id;\n\t\t\t\tdelete project._id;\n\t\t\t});\n\t\t\treturn { projects };\n\t\t});\n\t}\n\tasync getProjectsJson(identity) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", \"api/project\", {}, (res) => {\n\t\t\treturn { projects: JSON.parse(res).projects };\n\t\t});\n\t}\n\tasync projectEntitiesJson(identity, projectId) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"GET\", `project/${projectId}/entities`, void 0, (res) => {\n\t\t\treturn { entities: JSON.parse(res).entities };\n\t\t});\n\t}\n\tasync newProject(identity, projectName, template) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", \"project/new\", {\n\t\t\tprojectName,\n\t\t\ttemplate\n\t\t}, (res) => {\n\t\t\treturn { message: JSON.parse(res).project_id };\n\t\t});\n\t}\n\tasync cloneProject(identity, projectId, projectName) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", `project/${projectId}/clone`, { projectName }, (res) => {\n\t\t\treturn { message: JSON.parse(res).project_id };\n\t\t});\n\t}\n\tasync renameProject(identity, projectId, newProjectName) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", `project/${projectId}/rename`, { newProjectName });\n\t}\n\tasync deleteProject(identity, projectId) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"DELETE\", `project/${projectId}`);\n\t}\n\tasync archiveProject(identity, projectId) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", `project/${projectId}/archive`, void 0, void 0, { \"X-Csrf-Token\": identity.csrfToken });\n\t}\n\tasync unarchiveProject(identity, projectId) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"DELETE\", `project/${projectId}/archive`);\n\t}\n\tasync trashProject(identity, projectId) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", `project/${projectId}/trash`, void 0, void 0, { \"X-Csrf-Token\": identity.csrfToken });\n\t}\n\tasync untrashProject(identity, projectId) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"DELETE\", `project/${projectId}/trash`);\n\t}\n\tasync getFile(identity, projectId, fileId) {\n\t\tthis.setIdentity(identity);\n\t\tconst content = await this.download(`project/${projectId}/file/${fileId}`);\n\t\treturn {\n\t\t\ttype: \"success\",\n\t\t\tcontent: new Uint8Array(content)\n\t\t};\n\t}\n\tasync addDoc(identity, projectId, parentFolderId, filename) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", `project/${projectId}/doc`, {\n\t\t\tparent_folder_id: parentFolderId,\n\t\t\tname: filename\n\t\t}, (res) => {\n\t\t\tconst { _id } = JSON.parse(res);\n\t\t\treturn { entity: {\n\t\t\t\t_type: \"doc\",\n\t\t\t\t_id,\n\t\t\t\tname: filename\n\t\t\t} };\n\t\t}, { \"X-Csrf-Token\": identity.csrfToken });\n\t}\n\tasync uploadFile(identity, projectId, parentFolderId, filename, fileContent) {\n\t\tconst formData = new FormData();\n\t\tconst mimeType = mime.getType(filename);\n\t\tformData.append(\"targetFolderId\", parentFolderId);\n\t\tformData.append(\"name\", filename);\n\t\tformData.append(\"type\", mimeType ? mimeType : \"text/plain\");\n\t\tformData.append(\"qqfile\", new Blob$1([Buffer.from(fileContent)], { type: mimeType ? mimeType : \"application/octet-stream\" }), filename);\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", `project/${projectId}/upload?folder_id=${parentFolderId}`, formData, (res) => {\n\t\t\tconst { entity_id, entity_type } = JSON.parse(res);\n\t\t\treturn { entity: {\n\t\t\t\t_type: entity_type,\n\t\t\t\t_id: entity_id,\n\t\t\t\tname: filename\n\t\t\t} };\n\t\t}, { \"X-Csrf-Token\": identity.csrfToken });\n\t}\n\tasync uploadProject(identity, filename, fileContent) {\n\t\tconst uuid = v4();\n\t\tconst formData = new FormData();\n\t\tformData.append(\"qqfile\", new Blob$1([Buffer.from(fileContent)], { type: \"application/zip\" }), filename);\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", `project/new/upload?_csrf=${identity.csrfToken}&qquuid=${uuid}&qqfilename=${filename}&qqtotalfilesize=${fileContent.length}`, formData, (res) => {\n\t\t\treturn { message: JSON.parse(res).project_id };\n\t\t});\n\t}\n\tasync addFolder(identity, projectId, folderName, parentFolderId) {\n\t\tconst body = {\n\t\t\tname: folderName,\n\t\t\tparent_folder_id: parentFolderId\n\t\t};\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", `project/${projectId}/folder`, body, (res) => {\n\t\t\treturn { entity: JSON.parse(res) };\n\t\t}, { \"X-Csrf-Token\": identity.csrfToken });\n\t}\n\tasync deleteEntity(identity, projectId, fileType, fileId) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"DELETE\", `project/${projectId}/${fileType}/${fileId}`);\n\t}\n\tasync deleteAuxFiles(identity, projectId) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"DELETE\", `project/${projectId}/output`);\n\t}\n\tasync renameEntity(identity, projectId, entityType, entityId, name) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", `project/${projectId}/${entityType}/${entityId}/rename`, { name }, void 0, { \"X-Csrf-Token\": identity.csrfToken });\n\t}\n\tasync moveEntity(identity, projectId, entityType, entityId, newParentFolderId) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", `project/${projectId}/${entityType}/${entityId}/move`, { folder_id: newParentFolderId }, void 0, { \"X-Csrf-Token\": identity.csrfToken });\n\t}\n\tasync compile(identity, projectId, rootResourcePath, draft = false, stopOnFirstError = false) {\n\t\tconst body = {\n\t\t\tcheck: \"silent\",\n\t\t\tdraft,\n\t\t\tincrementalCompilesEnabled: true,\n\t\t\trootResourcePath,\n\t\t\tstopOnFirstError\n\t\t};\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", `project/${projectId}/compile?auto_compile=true`, body, (res) => {\n\t\t\treturn { compile: JSON.parse(res) };\n\t\t}, { \"X-Csrf-Token\": identity.csrfToken }, 3e5);\n\t}\n\tasync stopCompile(identity, projectId) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", `project/${projectId}/compile/stop`, void 0, void 0, { \"X-Csrf-Token\": identity.csrfToken });\n\t}\n\tasync indexAll(identity, projectId) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", `project/${projectId}/references/indexAll`, { shouldBroadcast: false }, void 0);\n\t}\n\tasync getMetadata(identity, projectId) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"GET\", `project/${projectId}/metadata`, void 0, (res) => {\n\t\t\treturn { meta: JSON.parse(res) };\n\t\t});\n\t}\n\tasync proxyRequestToSpellingApi(identity, language, userId, words) {\n\t\tconst body = {\n\t\t\tlanguage,\n\t\t\tskipLearnedWords: true,\n\t\t\ttoken: userId,\n\t\t\twords\n\t\t};\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", \"spelling/check\", body, (res) => {\n\t\t\treturn { misspellings: JSON.parse(res).misspellings };\n\t\t});\n\t}\n\tasync spellingControllerLearn(identity, userId, word) {\n\t\tconst body = {\n\t\t\ttoken: userId,\n\t\t\tword\n\t\t};\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", \"spelling/learn\", body);\n\t}\n\tasync spellingControllerUnlearn(identity, word) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", \"spelling/unlearn\", { word }, void 0, { \"X-Csrf-Token\": identity.csrfToken });\n\t}\n\tasync getProjectSettings(identity, projectId) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"GET\", `project/${projectId}`, void 0, (res) => {\n\t\t\tconst body = res || \"\";\n\t\t\tconst learnedWordsMatch = /<meta\\s+name=\"ol-learnedWords\"\\s+data-type=\"json\"\\s+content=\"(\\[.*?\\])\">/.exec(body);\n\t\t\tconst learnedWords = learnedWordsMatch !== null ? JSON.parse(learnedWordsMatch[1].replace(/"/g, \"\\\"\")) : [];\n\t\t\tconst languagesMatch = /<meta\\s+name=\"ol-languages\"\\s+data-type=\"json\"\\s+content=\"(\\[.*?\\])\">/.exec(body);\n\t\t\tconst languages = languagesMatch !== null ? JSON.parse(languagesMatch[1].replace(/"/g, \"\\\"\")) : [];\n\t\t\tif (languages.length) languages.unshift({\n\t\t\t\tname: \"Off\",\n\t\t\t\tcode: \"\"\n\t\t\t});\n\t\t\treturn { settings: {\n\t\t\t\tlearnedWords,\n\t\t\t\tlanguages,\n\t\t\t\tcompilers: [\n\t\t\t\t\t{\n\t\t\t\t\t\tcode: \"pdflatex\",\n\t\t\t\t\t\tname: \"pdfLaTex\"\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tcode: \"latex\",\n\t\t\t\t\t\tname: \"LaTex\"\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tcode: \"xelatex\",\n\t\t\t\t\t\tname: \"XeLaTex\"\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tcode: \"lualatex\",\n\t\t\t\t\t\tname: \"LuaLaTex\"\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t} };\n\t\t});\n\t}\n\tasync updateProjectSettings(identity, projectId, setting) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", `project/${projectId}/settings`, setting);\n\t}\n\tasync getFileFromClsi(identity, url, compileGroup, clsiServerId, pdfDownloadDomain) {\n\t\tif (pdfDownloadDomain && clsiServerId) {\n\t\t\tconst cdnUrl = `${pdfDownloadDomain.replace(/\\/+$/, \"\")}/${url.replace(/^\\/+/g, \"\")}?compileGroup=${encodeURIComponent(compileGroup)}&clsiserverid=${encodeURIComponent(clsiServerId)}&enable_pdf_caching=true`;\n\t\t\tconst content = await this._downloadAbsolute(cdnUrl, false);\n\t\t\treturn {\n\t\t\t\ttype: \"success\",\n\t\t\t\tcontent: new Uint8Array(content)\n\t\t\t};\n\t\t}\n\t\turl = url.replace(/^\\/+/g, \"\");\n\t\tthis.setIdentity(identity);\n\t\tconst content = await this.download(url);\n\t\treturn {\n\t\t\ttype: \"success\",\n\t\t\tcontent: new Uint8Array(content)\n\t\t};\n\t}\n\t/** Download from an absolute URL, optionally including web frontend cookies. */\n\tasync _downloadAbsolute(absoluteUrl, includeCookies) {\n\t\tconst headers = { Connection: \"keep-alive\" };\n\t\tif (includeCookies && this.identity) headers[\"Cookie\"] = this.identity.cookies;\n\t\tlet content = [];\n\t\twhile (true) {\n\t\t\tconst res = await this.scheduler.fetch(absoluteUrl, {\n\t\t\t\tmethod: \"GET\",\n\t\t\t\tredirect: \"manual\",\n\t\t\t\theaders\n\t\t\t});\n\t\t\tif (res.status === 200) {\n\t\t\t\tcontent.push(Buffer.from(await res.arrayBuffer()));\n\t\t\t\tbreak;\n\t\t\t} else if (res.status === 206) content.push(Buffer.from(await res.arrayBuffer()));\n\t\t\telse break;\n\t\t}\n\t\treturn Buffer.concat(content);\n\t}\n\tasync proxySyncPdf(identity, projectId, page, h, v, buildId) {\n\t\tthis.setIdentity(identity);\n\t\tconst request = `project/${projectId}/sync/pdf?page=${page}&h=${h.toFixed(2)}&v=${v.toFixed(2)}&editorId=${v4()}&buildId=${buildId}`;\n\t\treturn this.request(\"GET\", request, void 0, (res) => {\n\t\t\treturn { syncPdf: JSON.parse(res).code[0] };\n\t\t});\n\t}\n\tasync proxySyncCode(identity, projectId, file, line, column, buildId) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"GET\", `project/${projectId}/sync/code?file=${file}&line=${line}&column=${column}&editorId=${v4()}&buildId=${buildId}`, void 0, (res) => {\n\t\t\treturn { syncCode: JSON.parse(res).pdf };\n\t\t});\n\t}\n\tasync getAllTags(identity) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"GET\", \"tag\", void 0, (res) => {\n\t\t\treturn { tags: JSON.parse(res) };\n\t\t});\n\t}\n\tasync createTag(identity, name) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", \"tag\", { name }, (res) => {\n\t\t\treturn { tags: JSON.parse(res) };\n\t\t});\n\t}\n\tasync renameTag(identity, tagId, name) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", `tag/${tagId}/rename`, { name });\n\t}\n\tasync deleteTag(identity, tagId) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"DELETE\", `tag/${tagId}`);\n\t}\n\tasync addProjectToTag(identity, tagId, projectId) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", `tag/${tagId}/project/${projectId}`);\n\t}\n\tasync removeProjectFromTag(identity, tagId, projectId) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"DELETE\", `tag/${tagId}/project/${projectId}`);\n\t}\n\tasync proxyToHistoryApiAndGetUpdates(identity, projectId, before) {\n\t\tconst beforeQuery = before ? `&before=${before}` : \"\";\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"GET\", `project/${projectId}/updates?min_count=10${beforeQuery}`, void 0, (res) => {\n\t\t\treturn { updates: JSON.parse(res) };\n\t\t});\n\t}\n\tasync proxyToHistoryApiAndGetFileDiff(identity, projectId, pathname, from, to) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"GET\", `project/${projectId}/diff?pathname=${pathname}&from=${from}&to=${to}`, void 0, (res) => {\n\t\t\treturn { diff: JSON.parse(res) };\n\t\t});\n\t}\n\tasync proxyToHistoryApiAndGetFileTreeDiff(identity, projectId, from, to) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"GET\", `project/${projectId}/filetree/diff?from=${from}&to=${to}`, void 0, (res) => {\n\t\t\treturn { treeDiff: JSON.parse(res) };\n\t\t});\n\t}\n\tasync downloadZipOfVersion(identity, projectId, version) {\n\t\tthis.setIdentity(identity);\n\t\tconst content = await this.download(`project/${projectId}/version/${version}/zip`);\n\t\treturn {\n\t\t\ttype: \"success\",\n\t\t\tcontent: new Uint8Array(content)\n\t\t};\n\t}\n\tasync getLabels(identity, projectId) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"GET\", `project/${projectId}/labels`, void 0, (res) => {\n\t\t\treturn { labels: JSON.parse(res) };\n\t\t});\n\t}\n\tasync createLabel(identity, projectId, comment, version) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", `project/${projectId}/labels`, {\n\t\t\tcomment,\n\t\t\tversion\n\t\t}, (res) => {\n\t\t\treturn { labels: [JSON.parse(res)] };\n\t\t});\n\t}\n\tasync deleteLabel(identity, projectId, labelId) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"DELETE\", `project/${projectId}/labels/${labelId}`);\n\t}\n\tasync getMessages(identity, projectId, limit = 50) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"GET\", `project/${projectId}/messages?limit=${limit}`, void 0, (res) => {\n\t\t\treturn { messages: JSON.parse(res) };\n\t\t}, { \"X-Csrf-Token\": identity.csrfToken });\n\t}\n\tasync sendMessage(identity, projectId, client_id, content) {\n\t\tthis.setIdentity(identity);\n\t\treturn this.request(\"POST\", `project/${projectId}/messages`, {\n\t\t\tclient_id,\n\t\t\tcontent\n\t\t}, void 0, { \"X-Csrf-Token\": identity.csrfToken });\n\t}\n};\n// src/api/extendedBase.ts\nvar ExtendedBaseAPI = class extends BaseAPI {\n\tasync refreshLinkedFile(identity, project_id, file_id) {\n\t\tthis.setIdentity(identity);\n\t\treturn await this.request(\"POST\", `project/${project_id}/linked_file/${file_id}/refresh`, { shouldReindexReferences: false }, (res) => {\n\t\t\treturn { message: JSON.parse(res).new_file_id };\n\t\t}, { \"X-Csrf-Token\": identity.csrfToken });\n\t}\n\tasync createLinkedFile(identity, project_id, parent_folder_id, name, provider, data) {\n\t\tthis.setIdentity(identity);\n\t\treturn await this.request(\"POST\", `project/${project_id}/linked_file`, {\n\t\t\tname,\n\t\t\tparent_folder_id,\n\t\t\tprovider,\n\t\t\tdata\n\t\t}, (res) => {\n\t\t\treturn { message: JSON.parse(res).new_file_id };\n\t\t}, { \"X-Csrf-Token\": identity.csrfToken });\n\t}\n};\n// src/api/socketio.ts\nconst SOCKET_OPERATION_TIMEOUT_MS = 15e3;\nfunction decodePackedUtf8(text) {\n\treturn Buffer.from(text, \"latin1\").toString(\"utf-8\");\n}\nvar SocketIOAPI = class SocketIOAPI {\n\turl;\n\tapi;\n\tidentity;\n\tprojectId;\n\tstatic alternativeSocketFactory;\n\tscheme;\n\trecord;\n\tjoinedProject;\n\tpendingProjectJoin;\n\t_handlers = [];\n\tconnectedPublicId;\n\tsocket;\n\temit;\n\t/** Track the scheme used when the socket was last initialized */\n\t_socketInitScheme;\n\tconstructor(url, api, identity, projectId) {\n\t\tthis.url = url;\n\t\tthis.api = api;\n\t\tthis.identity = identity;\n\t\tthis.projectId = projectId;\n\t\tthis.scheme = \"realtime\";\n\t\tthis.init();\n\t}\n\tstatic setAlternativeSocketFactory(factory) {\n\t\tSocketIOAPI.alternativeSocketFactory = factory;\n\t}\n\tinit() {\n\t\tif (this.socket) try {\n\t\t\tif (typeof this.socket.removeAllListeners === \"function\") this.socket.removeAllListeners();\n\t\t\tif (typeof this.socket.disconnect === \"function\") this.socket.disconnect();\n\t\t} catch {}\n\t\tswitch (this.scheme) {\n\t\t\tcase \"Alt\":\n\t\t\t\tif (!SocketIOAPI.alternativeSocketFactory) throw new Error(\"The alternative Overleaf connection is not available in this runtime.\");\n\t\t\t\tthis.socket = SocketIOAPI.alternativeSocketFactory(this.url, this.api, this.identity, this.projectId, this.record);\n\t\t\t\tbreak;\n\t\t\tcase \"realtime\":\n\t\t\t\tthis.record = void 0;\n\t\t\t\tthis.joinedProject = void 0;\n\t\t\t\tthis.resetProjectJoin(/* @__PURE__ */ new Error(\"The realtime connection was replaced.\"));\n\t\t\t\tconst query = `?projectId=${this.projectId}&t=${Date.now()}`;\n\t\t\t\tthis.socket = this.api._initSocketV0(this.identity, query);\n\t\t}\n\t\tthis.socket.emit[promisify.custom] = (event, ...args) => {\n\t\t\tconst timeoutPromise = new Promise((_, reject) => {\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\treject(\"timeout\");\n\t\t\t\t}, SOCKET_OPERATION_TIMEOUT_MS);\n\t\t\t});\n\t\t\tconst waitPromise = new Promise((resolve, reject) => {\n\t\t\t\tthis.socket.emit(event, ...args, (err, ...data) => {\n\t\t\t\t\tif (err) reject(err);\n\t\t\t\t\telse resolve(data);\n\t\t\t\t});\n\t\t\t});\n\t\t\treturn Promise.race([waitPromise, timeoutPromise]);\n\t\t};\n\t\tthis.emit = promisify(this.socket.emit).bind(this.socket);\n\t\tthis.initInternalHandlers();\n\t\tthis.resumeEventHandlers(this._handlers);\n\t\tthis._socketInitScheme = this.scheme;\n\t}\n\t/** Returns true if the socket needs re-initialization (scheme changed, or socket was never init'd) */\n\tget needsReinit() {\n\t\treturn this._socketInitScheme !== this.scheme || !this.socket;\n\t}\n\tget connectionScheme() {\n\t\treturn this.scheme;\n\t}\n\tinitInternalHandlers() {\n\t\tthis.socket.on(\"connect\", () => {\n\t\t\tlog(\"SocketIOAPI: connected\", {\n\t\t\t\tscheme: this.scheme,\n\t\t\t\tprojectId: this.projectId\n\t\t\t});\n\t\t});\n\t\tthis.socket.on(\"connect_failed\", (connectionError) => {\n\t\t\tlog(\"SocketIOAPI: connect_failed\", {\n\t\t\t\tscheme: this.scheme,\n\t\t\t\tprojectId: this.projectId,\n\t\t\t\terror: connectionError\n\t\t\t});\n\t\t});\n\t\tthis.socket.on(\"disconnect\", (reason) => {\n\t\t\tlog(\"SocketIOAPI: disconnect event\", {\n\t\t\t\tscheme: this.scheme,\n\t\t\t\tprojectId: this.projectId,\n\t\t\t\treason\n\t\t\t});\n\t\t\tif (this.scheme === \"realtime\") {\n\t\t\t\tthis.joinedProject = void 0;\n\t\t\t\tthis.connectedPublicId = void 0;\n\t\t\t\tthis.resetProjectJoin(/* @__PURE__ */ new Error(`Overleaf realtime connection closed: ${String(reason ?? \"unknown\")}`));\n\t\t\t}\n\t\t});\n\t\tthis.socket.on(\"reconnecting\", (delay, attempt) => {\n\t\t\tlog(\"SocketIOAPI: reconnecting\", {\n\t\t\t\tscheme: this.scheme,\n\t\t\t\tprojectId: this.projectId,\n\t\t\t\tdelay,\n\t\t\t\tattempt\n\t\t\t});\n\t\t});\n\t\tthis.socket.on(\"reconnect\", (transport, attempts) => {\n\t\t\tlog(\"SocketIOAPI: reconnected\", {\n\t\t\t\tscheme: this.scheme,\n\t\t\t\tprojectId: this.projectId,\n\t\t\t\ttransport,\n\t\t\t\tattempts\n\t\t\t});\n\t\t});\n\t\tthis.socket.on(\"reconnect_failed\", (error) => {\n\t\t\tlog(\"SocketIOAPI: reconnect_failed\", {\n\t\t\t\tscheme: this.scheme,\n\t\t\t\tprojectId: this.projectId,\n\t\t\t\terror\n\t\t\t});\n\t\t});\n\t\tthis.socket.on(\"forceDisconnect\", (message, delay = 10) => {\n\t\t\tlog(\"SocketIOAPI: forceDisconnect\", {\n\t\t\t\tmessage,\n\t\t\t\tdelay,\n\t\t\t\tprojectId: this.projectId\n\t\t\t});\n\t\t});\n\t\tthis.socket.on(\"connectionRejected\", (err) => {\n\t\t\tlog(\"SocketIOAPI: connectionRejected\", {\n\t\t\t\tscheme: this.scheme,\n\t\t\t\tprojectId: this.projectId,\n\t\t\t\terror: err\n\t\t\t});\n\t\t\tif (this.socket.io && typeof this.socket.io.reconnect === \"function\") this.socket.io.reconnect(false);\n\t\t});\n\t\tthis.socket.on(\"error\", (err) => {\n\t\t\terror(`Overleaf connection error: ${err?.message || String(err)}`);\n\t\t});\n\t\tif (this.scheme === \"realtime\") {\n\t\t\tthis.pendingProjectJoin ??= this.createProjectJoin();\n\t\t\tthis.socket.on(\"joinProjectResponse\", (res) => {\n\t\t\t\tconst publicId = res.publicId;\n\t\t\t\tconst project = res.project;\n\t\t\t\tthis.socket.markProjectJoined?.();\n\t\t\t\tlog(\"SocketIOAPI: project joined\", {\n\t\t\t\t\tscheme: this.scheme,\n\t\t\t\t\tprojectId: this.projectId,\n\t\t\t\t\tpublicId\n\t\t\t\t});\n\t\t\t\tthis.connectedPublicId = publicId;\n\t\t\t\tthis.joinedProject = project;\n\t\t\t\tthis.pendingProjectJoin?.resolve(project);\n\t\t\t\tfor (const handler of this._handlers) {\n\t\t\t\t\thandler.onProjectJoined?.(project);\n\t\t\t\t\thandler.onConnectionAccepted?.(publicId);\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.socket.on(\"connectionRejected\", (err) => {\n\t\t\t\tthis.pendingProjectJoin?.reject(err?.message || err);\n\t\t\t});\n\t\t}\n\t}\n\tcreateProjectJoin() {\n\t\tlet resolve;\n\t\tlet reject;\n\t\tconst promise = new Promise((resolveProject, rejectProject) => {\n\t\t\tresolve = resolveProject;\n\t\t\treject = rejectProject;\n\t\t});\n\t\tpromise.catch(() => void 0);\n\t\treturn {\n\t\t\tpromise,\n\t\t\tresolve,\n\t\t\treject\n\t\t};\n\t}\n\tresetProjectJoin(reason) {\n\t\tif (reason !== void 0) this.pendingProjectJoin?.reject(reason);\n\t\tthis.pendingProjectJoin = this.createProjectJoin();\n\t}\n\twaitForRealtimeProject() {\n\t\treturn this.joinedProject ? Promise.resolve(this.joinedProject) : this.pendingProjectJoin.promise;\n\t}\n\tasync emitProjectEvent(event, ...args) {\n\t\tif (this.scheme === \"realtime\") await this.waitForRealtimeProject();\n\t\treturn this.emit(event, ...args);\n\t}\n\tdisconnect() {\n\t\tthis.socket.disconnect();\n\t}\n\tget handlers() {\n\t\treturn this._handlers;\n\t}\n\tget isUsingAlternativeConnectionScheme() {\n\t\treturn this.scheme === \"Alt\";\n\t}\n\ttoggleAlternativeConnectionScheme(url, updatedRecord) {\n\t\tthis.scheme = this.scheme === \"Alt\" ? \"realtime\" : \"Alt\";\n\t\tif (updatedRecord) {\n\t\t\tthis.url = url;\n\t\t\tthis.record = Promise.resolve(updatedRecord);\n\t\t}\n\t}\n\tresumeEventHandlers(handlers) {\n\t\tthis._handlers = [];\n\t\thandlers.forEach((handler) => {\n\t\t\tthis.updateEventHandlers(handler);\n\t\t});\n\t}\n\tupdateEventHandlers(handlers) {\n\t\tthis._handlers.push(handlers);\n\t\tObject.values(handlers).forEach((handler) => {\n\t\t\tswitch (handler) {\n\t\t\t\tcase handlers.onFileCreated:\n\t\t\t\t\tthis.socket.on(\"reciveNewDoc\", (parentFolderId, doc) => {\n\t\t\t\t\t\thandler(parentFolderId, \"doc\", doc);\n\t\t\t\t\t});\n\t\t\t\t\tthis.socket.on(\"reciveNewFile\", (parentFolderId, file) => {\n\t\t\t\t\t\thandler(parentFolderId, \"file\", file);\n\t\t\t\t\t});\n\t\t\t\t\tthis.socket.on(\"reciveNewFolder\", (parentFolderId, folder) => {\n\t\t\t\t\t\thandler(parentFolderId, \"folder\", folder);\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase handlers.onFileRenamed:\n\t\t\t\t\tthis.socket.on(\"reciveEntityRename\", (entityId, newName) => {\n\t\t\t\t\t\thandler(entityId, newName);\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase handlers.onFileRemoved:\n\t\t\t\t\tthis.socket.on(\"removeEntity\", (entityId) => {\n\t\t\t\t\t\thandler(entityId);\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase handlers.onFileMoved:\n\t\t\t\t\tthis.socket.on(\"reciveEntityMove\", (entityId, folderId) => {\n\t\t\t\t\t\thandler(entityId, folderId);\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase handlers.onFileChanged:\n\t\t\t\t\tthis.socket.on(\"otUpdateApplied\", (update) => {\n\t\t\t\t\t\thandler(update);\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase handlers.onDisconnected:\n\t\t\t\t\tthis.socket.on(\"disconnect\", (reason) => {\n\t\t\t\t\t\thandler(reason);\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase handlers.onProjectJoined: break;\n\t\t\t\tcase handlers.onConnectionAccepted:\n\t\t\t\t\tthis.socket.on(\"connectionAccepted\", (_, publicId) => {\n\t\t\t\t\t\thandler(publicId);\n\t\t\t\t\t});\n\t\t\t\t\tif (this.connectedPublicId !== void 0) queueMicrotask(() => handler(this.connectedPublicId));\n\t\t\t\t\tbreak;\n\t\t\t\tcase handlers.onClientUpdated:\n\t\t\t\t\tthis.socket.on(\"clientTracking.clientUpdated\", (user) => {\n\t\t\t\t\t\thandler(user);\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase handlers.onClientDisconnected:\n\t\t\t\t\tthis.socket.on(\"clientTracking.clientDisconnected\", (id) => {\n\t\t\t\t\t\thandler(id);\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase handlers.onReceivedMessage:\n\t\t\t\t\tthis.socket.on(\"new-chat-message\", (message) => {\n\t\t\t\t\t\thandler(message);\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase handlers.onSpellCheckLanguageUpdated:\n\t\t\t\t\tthis.socket.on(\"spellCheckLanguageUpdated\", (language) => {\n\t\t\t\t\t\thandler(language);\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase handlers.onCompilerUpdated:\n\t\t\t\t\tthis.socket.on(\"compilerUpdated\", (compiler) => {\n\t\t\t\t\t\thandler(compiler);\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase handlers.onRootDocUpdated: this.socket.on(\"rootDocUpdated\", (rootDocId) => {\n\t\t\t\t\thandler(rootDocId);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\tget unSyncFileChanges() {\n\t\treturn this.scheme === \"Alt\" ? this.socket.unSyncedChanges : 0;\n\t}\n\tasync syncFileChanges() {\n\t\tif (this.scheme === \"Alt\") return await this.socket.uploadToVFS();\n\t}\n\t/**\n\t* Reference: services/web/frontend/js/ide/connection/ConnectionManager.js#L427\n\t* @param {string} projectId - The project id.\n\t* @returns {Promise}\n\t*/\n\tasync joinProject(project_id) {\n\t\tconst timeoutPromise = new Promise((_, reject) => {\n\t\t\tsetTimeout(() => {\n\t\t\t\treject(\"timeout\");\n\t\t\t}, SOCKET_OPERATION_TIMEOUT_MS);\n\t\t});\n\t\tswitch (this.scheme) {\n\t\t\tcase \"Alt\": return Promise.race([this.emit(\"joinProject\", { project_id }).then((returns) => returns[0]), timeoutPromise]);\n\t\t\tcase \"realtime\": return Promise.race([this.waitForRealtimeProject(), timeoutPromise]);\n\t\t}\n\t}\n\t/**\n\t* Reference: services/web/frontend/js/ide/editor/Document.js#L500\n\t* @param {string} docId - The document id.\n\t* @returns {Promise}\n\t*/\n\tasync joinDoc(docId) {\n\t\treturn this.emitProjectEvent(\"joinDoc\", docId, { encodeRanges: true }).then((returns) => {\n\t\t\tconst [docLinesAscii, version, updates, ranges] = returns;\n\t\t\treturn {\n\t\t\t\tdocLines: docLinesAscii.map((line) => decodePackedUtf8(line)),\n\t\t\t\tversion,\n\t\t\t\tupdates,\n\t\t\t\tranges\n\t\t\t};\n\t\t});\n\t}\n\t/**\n\t* Reference: services/web/frontend/js/ide/editor/Document.js#L591\n\t* @param {string} docId - The document id.\n\t* @returns {Promise}\n\t*/\n\tasync leaveDoc(docId) {\n\t\treturn this.emitProjectEvent(\"leaveDoc\", docId).then(() => {});\n\t}\n\t/**\n\t* Reference: services/web/frontend/js/ide/editor/ShareJsDocs.js#L78\n\t* @param {string} docId - The document id.\n\t* @param {any} update - The changes.\n\t* @returns {Promise}\n\t*/\n\tasync applyOtUpdate(docId, update) {\n\t\ttry {\n\t\t\tawait this.emitProjectEvent(\"applyOtUpdate\", docId, update);\n\t\t} catch (error) {\n\t\t\tlet detail;\n\t\t\tif (error instanceof Error) detail = error.message;\n\t\t\telse if (typeof error === \"string\") detail = error;\n\t\t\telse try {\n\t\t\t\tdetail = JSON.stringify(error);\n\t\t\t} catch {\n\t\t\t\tdetail = String(error);\n\t\t\t}\n\t\t\tthrow new Error(`Overleaf document update rejected: ${detail}`);\n\t\t}\n\t}\n\t/**\n\t* Reference: services/web/frontend/js/ide/online-users/OnlineUserManager.js#L42\n\t* @returns {Promise}\n\t*/\n\tasync getConnectedUsers() {\n\t\treturn this.emitProjectEvent(\"clientTracking.getConnectedUsers\").then((returns) => {\n\t\t\tconst [connectedUsers] = returns;\n\t\t\treturn connectedUsers;\n\t\t});\n\t}\n\t/**\n\t* Reference: services/web/frontend/js/ide/online-users/OnlineUserManager.js#L150\n\t* @param {string} docId - The document id.\n\t* @returns {Promise}\n\t*/\n\tasync updatePosition(doc_id, row, column) {\n\t\treturn this.emitProjectEvent(\"clientTracking.updatePosition\", {\n\t\t\trow,\n\t\t\tcolumn,\n\t\t\tdoc_id\n\t\t}).then(() => {});\n\t}\n};\n// src/core/projectTypes.ts\nconst FolderKeys = {\n\tfolder: \"folders\",\n\tdoc: \"docs\",\n\tfile: \"fileRefs\",\n\toutputs: \"outputs\"\n};\n// src/node/config.ts\nfunction configPath(environment = process.env) {\n\treturn environment.LEAFRELAY_CONFIG ? resolve(environment.LEAFRELAY_CONFIG) : join(environment.LEAFRELAY_HOME ? resolve(environment.LEAFRELAY_HOME) : join(homedir(), \".leafrelay\"), \"config.json\");\n}\nfunction normalizeServerUrl(value) {\n\tconst url = new URL(value.includes(\"://\") ? value : `https://${value}`);\n\turl.pathname = \"/\";\n\turl.search = \"\";\n\turl.hash = \"\";\n\treturn url.href;\n}\nfunction serverKey(value) {\n\treturn new URL(normalizeServerUrl(value)).host;\n}\nasync function readConfig(path = configPath()) {\n\ttry {\n\t\tconst parsed = JSON.parse(await readFile(path, \"utf8\"));\n\t\tif (parsed.version !== 1 || typeof parsed.servers !== \"object\" || parsed.servers === null) throw new Error(`Unsupported LeafRelay configuration in ${path}`);\n\t\treturn parsed;\n\t} catch (error) {\n\t\tif (error.code === \"ENOENT\") return {\n\t\t\tversion: 1,\n\t\t\tservers: {},\n\t\t\tknownServers: {}\n\t\t};\n\t\tthrow error;\n\t}\n}\nasync function writeConfig(config, path = configPath()) {\n\tawait mkdir(dirname(path), {\n\t\trecursive: true,\n\t\tmode: 448\n\t});\n\tawait writeFile(path, `${JSON.stringify(config, null, 2)}\\n`, {\n\t\tencoding: \"utf8\",\n\t\tmode: 384\n\t});\n\tawait chmod(path, 384);\n}\nasync function saveServerSession(session, path = configPath()) {\n\tconst config = await readConfig(path);\n\tconst key = serverKey(session.url);\n\tconfig.servers[key] = session;\n\tconfig.knownServers ??= {};\n\tconfig.knownServers[key] ??= {\n\t\tname: key,\n\t\turl: session.url\n\t};\n\tawait writeConfig(config, path);\n}\nasync function saveKnownServer(name, url, path = configPath()) {\n\tconst config = await readConfig(path);\n\tconst key = serverKey(url);\n\tconfig.knownServers ??= {};\n\tconfig.knownServers[key] = {\n\t\tname,\n\t\turl: normalizeServerUrl(url)\n\t};\n\tawait writeConfig(config, path);\n}\nasync function removeKnownServer(server, path = configPath()) {\n\tconst config = await readConfig(path);\n\tconst key = serverKey(server);\n\tdelete config.servers[key];\n\tdelete config.knownServers?.[key];\n\tawait writeConfig(config, path);\n}\nasync function removeServerSession(server, path = configPath()) {\n\tconst config = await readConfig(path);\n\tdelete config.servers[serverKey(server)];\n\tawait writeConfig(config, path);\n}\nasync function getServerSession(server, environment = process.env, path = configPath(environment)) {\n\tconst key = serverKey(server);\n\tconst stored = (await readConfig(path)).servers[key];\n\tconst cookie = environment.LEAFRELAY_COOKIE;\n\tif (!cookie) return stored;\n\treturn {\n\t\turl: stored?.url ?? normalizeServerUrl(server),\n\t\tuserId: stored?.userId ?? \"\",\n\t\tuserEmail: stored?.userEmail ?? \"\",\n\t\tidentity: {\n\t\t\tcookies: cookie,\n\t\t\tcsrfToken: stored?.identity.csrfToken ?? \"\"\n\t\t},\n\t\tupdatedAt: stored?.updatedAt ?? (/* @__PURE__ */ new Date(0)).toISOString()\n\t};\n}\n// src/node/localFileSystem.ts\nfunction projectPath(root, path) {\n\tconst target = resolve(root, path.replace(/^\\/+/, \"\"));\n\tconst relativePath = relative(root, target);\n\tif (relativePath.startsWith(\"..\") || relativePath === \"..\") throw new Error(`Path escapes the local project: ${path}`);\n\treturn target;\n}\nfunction syncPath(root, path) {\n\treturn `/${relative(root, path).split(sep).join(\"/\")}`;\n}\nvar NodeReplicaFileSystem = class {\n\troot;\n\tignore;\n\twatcher;\n\tconstructor(root, ignore) {\n\t\tthis.root = root;\n\t\tthis.ignore = ignore;\n\t}\n\tasync listFiles() {\n\t\tconst files = [];\n\t\tconst visit = async (directory) => {\n\t\t\tfor (const entry of await readdir(directory, { withFileTypes: true })) {\n\t\t\t\tconst absolute = resolve(directory, entry.name);\n\t\t\t\tconst path = syncPath(this.root, absolute);\n\t\t\t\tif (this.ignore(path) || entry.name.startsWith(\".\") || entry.isSymbolicLink()) continue;\n\t\t\t\tif (entry.isDirectory()) await visit(absolute);\n\t\t\t\telse if (entry.isFile()) files.push(path);\n\t\t\t}\n\t\t};\n\t\tawait visit(this.root);\n\t\treturn files.sort();\n\t}\n\tasync read(path) {\n\t\tconst target = projectPath(this.root, path);\n\t\ttry {\n\t\t\tconst stat = await lstat(target);\n\t\t\tif (!stat.isFile() || stat.isSymbolicLink()) return;\n\t\t\treturn new Uint8Array(await readFile(target));\n\t\t} catch (error) {\n\t\t\tif (error.code === \"ENOENT\") return;\n\t\t\tthrow error;\n\t\t}\n\t}\n\tasync write(path, content) {\n\t\tconst target = projectPath(this.root, path);\n\t\tawait mkdir(dirname(target), { recursive: true });\n\t\tawait writeFile(target, content);\n\t}\n\tasync remove(path) {\n\t\tawait rm(projectPath(this.root, path), {\n\t\t\tforce: true,\n\t\t\trecursive: true\n\t\t});\n\t}\n\tasync watch(onChange) {\n\t\tthis.watcher = watch(this.root, {\n\t\t\tignoreInitial: true,\n\t\t\tfollowSymlinks: false,\n\t\t\tignored: (path) => {\n\t\t\t\tconst relativePath = relative(this.root, path);\n\t\t\t\tif (!relativePath) return false;\n\t\t\t\tconst normalized = `/${relativePath.split(sep).join(\"/\")}`;\n\t\t\t\treturn this.ignore(normalized) || normalized.split(\"/\").some((part) => part.startsWith(\".\"));\n\t\t\t},\n\t\t\tawaitWriteFinish: {\n\t\t\t\tstabilityThreshold: 200,\n\t\t\t\tpollInterval: 50\n\t\t\t}\n\t\t});\n\t\tconst handler = (path) => onChange(syncPath(this.root, path));\n\t\tthis.watcher.on(\"add\", handler).on(\"change\", handler).on(\"unlink\", handler);\n\t\tawait new Promise((resolveReady, reject) => {\n\t\t\tthis.watcher.once(\"ready\", resolveReady).once(\"error\", reject);\n\t\t});\n\t\treturn async () => {\n\t\t\tawait this.watcher?.close();\n\t\t};\n\t}\n};\n// src/node/projectSettings.ts\nfunction parseProjectUri(value) {\n\tconst uri = new URL(value);\n\tconst decodedQuery = decodeURIComponent(uri.search.slice(1));\n\tconst query = new URLSearchParams(decodedQuery);\n\tconst projectId = query.get(\"project\");\n\tif (!projectId) throw new Error(\"The project URI in .overleaf/settings.json does not contain a project ID.\");\n\treturn {\n\t\tserverName: uri.host,\n\t\tprojectId,\n\t\tprojectName: decodeURIComponent(uri.pathname.split(\"/\").filter(Boolean)[0] ?? \"\"),\n\t\tuserId: query.get(\"user\") ?? void 0\n\t};\n}\nasync function readProjectSettings(directory) {\n\tconst settingsPath = resolve(directory, \".overleaf\", \"settings.json\");\n\tconst raw = JSON.parse(await readFile(settingsPath, \"utf8\"));\n\tif (typeof raw.uri !== \"string\") throw new Error(`${settingsPath} does not contain a valid project URI.`);\n\tconst parsed = parseProjectUri(raw.uri);\n\tconst serverName = typeof raw.serverName === \"string\" ? raw.serverName : parsed.serverName;\n\tconst localReplica = raw.localReplica;\n\treturn {\n\t\turi: raw.uri,\n\t\tserverName,\n\t\tserverUrl: typeof raw.serverUrl === \"string\" ? raw.serverUrl : `https://${serverName}/`,\n\t\tprojectId: parsed.projectId,\n\t\tprojectName: typeof raw.projectName === \"string\" ? raw.projectName : parsed.projectName,\n\t\tuserId: parsed.userId,\n\t\tlocalReplica: { settings: localReplica?.settings ?? {} }\n\t};\n}\n// src/sync/ignore.ts\nconst DEFAULT_IGNORE_PATTERNS = [\n\t\"**/.*\",\n\t\"**/.*/**\",\n\t\"**/*.aux\",\n\t\"**/__latexindent*\",\n\t\"**/*.bbl\",\n\t\"**/*.bcf\",\n\t\"**/*.blg\",\n\t\"**/*.fdb_latexmk\",\n\t\"**/*.fls\",\n\t\"**/*.lof\",\n\t\"**/*.log\",\n\t\"**/*.lot\",\n\t\"**/*.out\",\n\t\"**/*.run.xml\",\n\t\"**/*.synctex(busy)\",\n\t\"**/*.synctex.gz\",\n\t\"**/*.toc\",\n\t\"**/*.xdv\",\n\t\"**/main.pdf\",\n\t\"**/output.pdf\"\n];\nfunction createIgnoreMatcher(patterns) {\n\tconst configured = Array.isArray(patterns) ? patterns.filter((pattern) => typeof pattern === \"string\") : [];\n\tconst allPatterns = [...DEFAULT_IGNORE_PATTERNS, ...configured];\n\treturn (path) => {\n\t\tconst normalized = path.replace(/^\\/+/, \"\");\n\t\treturn normalized.split(\"/\").some((part) => part.startsWith(\".\")) || allPatterns.some((pattern) => minimatch(normalized, pattern, { dot: true }));\n\t};\n}\n// src/sync/remoteProject.ts\nfunction normalizePath$1(path) {\n\tconst normalized = `/${posix.normalize(path).replace(/^\\/+/, \"\")}`;\n\tif (normalized.includes(\"/../\") || normalized.endsWith(\"/..\")) throw new Error(`Invalid project path: ${path}`);\n\treturn normalized;\n}\nfunction textContent(content) {\n\tif (content.includes(0)) return;\n\ttry {\n\t\treturn new TextDecoder(\"utf-8\", { fatal: true }).decode(content);\n\t} catch {\n\t\treturn;\n\t}\n}\nvar RemoteProject = class {\n\turl;\n\tprojectId;\n\tcookies;\n\tapi;\n\tidentity;\n\tsocket;\n\tproject;\n\tentries = /* @__PURE__ */ new Map();\n\tidToPath = /* @__PURE__ */ new Map();\n\tcollaboratorNames = /* @__PURE__ */ new Map();\n\tchangeHandler;\n\treconnectHandler;\n\texternalTransport;\n\tconstructor(url, projectId, cookies, transport) {\n\t\tthis.url = url;\n\t\tthis.projectId = projectId;\n\t\tthis.cookies = cookies;\n\t\tthis.externalTransport = transport;\n\t\tthis.api = transport?.api ?? new BaseAPI(url);\n\t}\n\tasync connect() {\n\t\tif (this.externalTransport) {\n\t\t\tthis.identity = this.externalTransport.identity;\n\t\t\tthis.socket = this.externalTransport.socket;\n\t\t} else {\n\t\t\tconst login = await this.api.cookiesLogin(this.cookies);\n\t\t\tif (login.type !== \"success\" || !login.identity) throw new Error(login.message || `Authentication to ${this.url} failed.`);\n\t\t\tthis.identity = login.identity;\n\t\t\tthis.socket = new SocketIOAPI(this.url, this.api, this.identity, this.projectId);\n\t\t}\n\t\tthis.project = await this.socket.joinProject(this.projectId);\n\t\tthis.indexCollaborators();\n\t\tthis.reindex();\n\t\tthis.registerEvents();\n\t}\n\tdisconnect() {\n\t\tif (!this.externalTransport) this.socket?.disconnect();\n\t}\n\tonChange(handler) {\n\t\tthis.changeHandler = handler;\n\t\treturn () => {\n\t\t\tif (this.changeHandler === handler) this.changeHandler = void 0;\n\t\t};\n\t}\n\tonReconnect(handler) {\n\t\tthis.reconnectHandler = handler;\n\t\treturn () => {\n\t\t\tif (this.reconnectHandler === handler) this.reconnectHandler = void 0;\n\t\t};\n\t}\n\tlistEntries() {\n\t\treturn [...this.entries.values()];\n\t}\n\tentry(path) {\n\t\treturn this.entries.get(normalizePath$1(path));\n\t}\n\tasync read(path) {\n\t\tconst entry = this.requireEntry(path);\n\t\tif (entry.type === \"doc\") {\n\t\t\tconst result = await this.socket.joinDoc(entry.entity._id);\n\t\t\treturn new TextEncoder().encode(result.docLines.join(\"\\n\"));\n\t\t}\n\t\tif (entry.type === \"file\") {\n\t\t\tconst result = await this.api.getFile(this.identity, this.projectId, entry.entity._id);\n\t\t\tif (result.type === \"success\" && result.content) return result.content;\n\t\t\tthrow new Error(`Could not download ${path}.`);\n\t\t}\n\t\tthrow new Error(`${path} is not a file.`);\n\t}\n\tasync mkdir(path) {\n\t\tconst normalized = normalizePath$1(path);\n\t\tif (this.entries.has(normalized)) return;\n\t\tconst { parent, name } = await this.ensureParent(normalized);\n\t\tconst result = await this.api.addFolder(this.identity, this.projectId, name, parent._id);\n\t\tif (result.type !== \"success\" || !result.entity) throw new Error(result.message || `Could not create ${normalized}.`);\n\t\tconst folder = result.entity;\n\t\tfolder._type = \"folder\";\n\t\tfolder.docs ??= [];\n\t\tfolder.fileRefs ??= [];\n\t\tfolder.folders ??= [];\n\t\tparent.folders.push(folder);\n\t\tthis.reindex();\n\t}\n\tasync write(path, content) {\n\t\tconst normalized = normalizePath$1(path);\n\t\tconst existing = this.entries.get(normalized);\n\t\tif (existing?.type === \"folder\") throw new Error(`${normalized} is a directory.`);\n\t\tif (existing?.type === \"doc\") {\n\t\t\tawait this.writeDocument(existing.entity, content);\n\t\t\treturn;\n\t\t}\n\t\tif (existing) await this.remove(normalized);\n\t\tconst { parent, name } = await this.ensureParent(normalized);\n\t\tif (textContent(content) !== void 0) {\n\t\t\tconst created = await this.api.addDoc(this.identity, this.projectId, parent._id, name);\n\t\t\tif (created.type !== \"success\" || !created.entity) throw new Error(created.message || `Could not create ${normalized}.`);\n\t\t\tconst entity = created.entity;\n\t\t\tentity._type = \"doc\";\n\t\t\tparent.docs.push(entity);\n\t\t\tthis.reindex();\n\t\t\tif (content.length !== 0) await this.writeDocument(entity, content);\n\t\t\treturn;\n\t\t}\n\t\tconst uploaded = await this.api.uploadFile(this.identity, this.projectId, parent._id, name, content);\n\t\tif (uploaded.type !== \"success\" || !uploaded.entity) throw new Error(uploaded.message || `Could not upload ${normalized}.`);\n\t\tconst entity = uploaded.entity;\n\t\tentity._type = \"file\";\n\t\tparent.fileRefs.push(entity);\n\t\tthis.reindex();\n\t}\n\tasync remove(path) {\n\t\tconst normalized = normalizePath$1(path);\n\t\tconst entry = this.requireEntry(normalized);\n\t\tif (!entry.parent) throw new Error(\"The project root cannot be removed.\");\n\t\tconst result = await this.api.deleteEntity(this.identity, this.projectId, entry.type, entry.entity._id);\n\t\tif (result.type !== \"success\") throw new Error(result.message || `Could not remove ${normalized}.`);\n\t\tthis.removeFromParent(entry);\n\t\tthis.reindex();\n\t}\n\tasync getCurrentVersion() {\n\t\tconst response = await this.api.proxyToHistoryApiAndGetUpdates(this.identity, this.projectId);\n\t\tconst version = response.updates?.updates.at(0)?.toV ?? 0;\n\t\tif (response.type !== \"success\" || !Number.isInteger(version)) throw new Error(response.message || \"Could not determine the current Overleaf project version.\");\n\t\treturn version;\n\t}\n\tasync getFileTreeDiff(from, to) {\n\t\tif (from >= to) return { diff: [] };\n\t\tconst response = await this.api.proxyToHistoryApiAndGetFileTreeDiff(this.identity, this.projectId, from, to);\n\t\tif (response.type === \"success\") return response.treeDiff;\n\t\tif (response.statusCode === 404) return;\n\t\tthrow new Error(response.message || \"Could not load the Overleaf file-tree history.\");\n\t}\n\tasync writeDocument(entity, content) {\n\t\tconst text = textContent(content);\n\t\tif (text === void 0) {\n\t\t\tconst path = this.idToPath.get(entity._id);\n\t\t\tawait this.remove(path);\n\t\t\tawait this.write(path, content);\n\t\t\treturn;\n\t\t}\n\t\tconst remote = await this.socket.joinDoc(entity._id);\n\t\tconst previous = remote.docLines.join(\"\\n\");\n\t\tif (previous === text) return;\n\t\tlet position = 0;\n\t\tconst operations = [];\n\t\tfor (const part of new DiffMatchPatch().diff_main(previous, text)) {\n\t\t\tconst start = position;\n\t\t\tif (part[0] !== -1) position += part[1].length;\n\t\t\tif (part[0] === 1) operations.push({\n\t\t\t\tp: start,\n\t\t\t\ti: part[1]\n\t\t\t});\n\t\t\tif (part[0] === -1) operations.push({\n\t\t\t\tp: start,\n\t\t\t\td: part[1]\n\t\t\t});\n\t\t}\n\t\tconst update = {\n\t\t\tdoc: entity._id,\n\t\t\tv: remote.version,\n\t\t\thash: createHash(\"sha1\").update(`blob ${text.length}\\x00${text}`).digest(\"hex\"),\n\t\t\top: operations\n\t\t};\n\t\tawait this.socket.applyOtUpdate(entity._id, update);\n\t}\n\tasync ensureParent(path) {\n\t\tconst name = posix.basename(path);\n\t\tconst parentPath = posix.dirname(path);\n\t\tif (parentPath !== \"/\" && !this.entries.has(parentPath)) await this.mkdir(parentPath);\n\t\tconst parentEntry = parentPath === \"/\" ? this.entries.get(\"/\") : this.entries.get(parentPath);\n\t\tif (!parentEntry || parentEntry.type !== \"folder\") throw new Error(`Parent directory ${parentPath} does not exist.`);\n\t\treturn {\n\t\t\tparent: parentEntry.entity,\n\t\t\tname\n\t\t};\n\t}\n\trequireEntry(path) {\n\t\tconst normalized = normalizePath$1(path);\n\t\tconst entry = this.entries.get(normalized);\n\t\tif (!entry) throw new Error(`Remote path not found: ${normalized}`);\n\t\treturn entry;\n\t}\n\treindex() {\n\t\tthis.entries.clear();\n\t\tthis.idToPath.clear();\n\t\tconst root = this.project.rootFolder[0];\n\t\troot._type = \"folder\";\n\t\tthis.indexFolder(root, \"/\");\n\t}\n\tindexFolder(folder, path, parent) {\n\t\tthis.entries.set(path, {\n\t\t\tpath,\n\t\t\ttype: \"folder\",\n\t\t\tentity: folder,\n\t\t\tparent\n\t\t});\n\t\tthis.idToPath.set(folder._id, path);\n\t\tfor (const child of folder.folders ?? []) {\n\t\t\tchild._type = \"folder\";\n\t\t\tthis.indexFolder(child, normalizePath$1(posix.join(path, child.name)), folder);\n\t\t}\n\t\tfor (const child of folder.docs ?? []) {\n\t\t\tchild._type = \"doc\";\n\t\t\tconst childPath = normalizePath$1(posix.join(path, child.name));\n\t\t\tthis.entries.set(childPath, {\n\t\t\t\tpath: childPath,\n\t\t\t\ttype: \"doc\",\n\t\t\t\tentity: child,\n\t\t\t\tparent: folder\n\t\t\t});\n\t\t\tthis.idToPath.set(child._id, childPath);\n\t\t}\n\t\tfor (const child of folder.fileRefs ?? []) {\n\t\t\tchild._type = \"file\";\n\t\t\tconst childPath = normalizePath$1(posix.join(path, child.name));\n\t\t\tthis.entries.set(childPath, {\n\t\t\t\tpath: childPath,\n\t\t\t\ttype: \"file\",\n\t\t\t\tentity: child,\n\t\t\t\tparent: folder\n\t\t\t});\n\t\t\tthis.idToPath.set(child._id, childPath);\n\t\t}\n\t}\n\tfolderById(id) {\n\t\tconst path = this.idToPath.get(id);\n\t\tconst entry = path ? this.entries.get(path) : void 0;\n\t\treturn entry?.type === \"folder\" ? entry.entity : void 0;\n\t}\n\tremoveFromParent(entry) {\n\t\tif (!entry.parent) return;\n\t\tconst collection = entry.type === \"folder\" ? entry.parent.folders : entry.type === \"doc\" ? entry.parent.docs : entry.parent.fileRefs;\n\t\tconst index = collection.findIndex((item) => item._id === entry.entity._id);\n\t\tif (index !== -1) collection.splice(index, 1);\n\t}\n\temitChange(path, previousPath, actor) {\n\t\tthis.changeHandler?.({\n\t\t\tpath: normalizePath$1(path),\n\t\t\tpreviousPath,\n\t\t\tactor\n\t\t});\n\t}\n\tindexCollaborators() {\n\t\tfor (const member of [this.project.owner, ...this.project.members]) {\n\t\t\tif (!member?._id) continue;\n\t\t\tconst name = [member.first_name, member.last_name].filter(Boolean).join(\" \").trim();\n\t\t\tif (name) this.collaboratorNames.set(member._id, name);\n\t\t}\n\t}\n\tactor(userId) {\n\t\tif (!userId) return;\n\t\tconst name = this.collaboratorNames.get(userId);\n\t\treturn name ? `${name} (Overleaf)` : `Overleaf user ${userId}`;\n\t}\n\tregisterEvents() {\n\t\tthis.socket.updateEventHandlers({\n\t\t\tonProjectJoined: (project) => {\n\t\t\t\tthis.project = project;\n\t\t\t\tthis.indexCollaborators();\n\t\t\t\tthis.reindex();\n\t\t\t\tthis.reconnectHandler?.();\n\t\t\t},\n\t\t\tonClientUpdated: (user) => {\n\t\t\t\tif (user.user_id && user.name) this.collaboratorNames.set(user.user_id, user.name);\n\t\t\t},\n\t\t\tonFileCreated: (parentId, type, entity) => {\n\t\t\t\tconst parent = this.folderById(parentId);\n\t\t\t\tif (!parent || type === \"outputs\") return;\n\t\t\t\tif (this.idToPath.has(entity._id)) return;\n\t\t\t\tentity._type = type;\n\t\t\t\tif (type === \"folder\") {\n\t\t\t\t\tconst folder = entity;\n\t\t\t\t\tfolder.docs ??= [];\n\t\t\t\t\tfolder.fileRefs ??= [];\n\t\t\t\t\tfolder.folders ??= [];\n\t\t\t\t\tparent.folders.push(folder);\n\t\t\t\t} else if (type === \"doc\") parent.docs.push(entity);\n\t\t\t\telse parent.fileRefs.push(entity);\n\t\t\t\tconst parentPath = this.idToPath.get(parentId) ?? \"/\";\n\t\t\t\tthis.reindex();\n\t\t\t\tthis.emitChange(posix.join(parentPath, entity.name));\n\t\t\t},\n\t\t\tonFileRenamed: (entityId, newName) => {\n\t\t\t\tconst previousPath = this.idToPath.get(entityId);\n\t\t\t\tif (!previousPath) return;\n\t\t\t\tthis.entries.get(previousPath).entity.name = newName;\n\t\t\t\tthis.reindex();\n\t\t\t\tthis.emitChange(this.idToPath.get(entityId), previousPath);\n\t\t\t},\n\t\t\tonFileRemoved: (entityId) => {\n\t\t\t\tconst previousPath = this.idToPath.get(entityId);\n\t\t\t\tif (!previousPath) return;\n\t\t\t\tconst entry = this.entries.get(previousPath);\n\t\t\t\tthis.removeFromParent(entry);\n\t\t\t\tthis.reindex();\n\t\t\t\tthis.emitChange(previousPath);\n\t\t\t},\n\t\t\tonFileMoved: (entityId, parentId) => {\n\t\t\t\tconst previousPath = this.idToPath.get(entityId);\n\t\t\t\tconst nextParent = this.folderById(parentId);\n\t\t\t\tif (!previousPath || !nextParent) return;\n\t\t\t\tconst entry = this.entries.get(previousPath);\n\t\t\t\tthis.removeFromParent(entry);\n\t\t\t\tif (entry.type === \"folder\") nextParent.folders.push(entry.entity);\n\t\t\t\telse if (entry.type === \"doc\") nextParent.docs.push(entry.entity);\n\t\t\t\telse nextParent.fileRefs.push(entry.entity);\n\t\t\t\tthis.reindex();\n\t\t\t\tthis.emitChange(this.idToPath.get(entityId), previousPath);\n\t\t\t},\n\t\t\tonFileChanged: (update) => {\n\t\t\t\tconst path = this.idToPath.get(update.doc);\n\t\t\t\tif (path) this.emitChange(path, void 0, this.actor(update.meta?.user_id));\n\t\t\t}\n\t\t});\n\t}\n};\n// src/sync/changeSummary.ts\nconst decoder = new TextDecoder(\"utf-8\", { fatal: true });\nfunction decode(content) {\n\tif (content === void 0) return \"\";\n\tif (content.includes(0)) return;\n\ttry {\n\t\treturn decoder.decode(content);\n\t} catch {\n\t\treturn;\n\t}\n}\nfunction lineStarts(content) {\n\tconst starts = [0];\n\tfor (let index = 0; index < content.length; index++) if (content[index] === \"\\n\" && index + 1 < content.length) starts.push(index + 1);\n\treturn starts;\n}\nfunction lineAt(starts, offset) {\n\tlet low = 0;\n\tlet high = starts.length;\n\twhile (low < high) {\n\t\tconst middle = Math.floor((low + high) / 2);\n\t\tif (starts[middle] <= offset) low = middle + 1;\n\t\telse high = middle;\n\t}\n\treturn Math.max(1, low);\n}\nfunction toLineRange(content, start, end) {\n\tconst starts = lineStarts(content);\n\tconst safeStart = Math.min(start, Math.max(0, content.length - 1));\n\tconst safeEnd = Math.min(Math.max(start, end - 1), Math.max(0, content.length - 1));\n\treturn {\n\t\tstart: lineAt(starts, safeStart),\n\t\tend: lineAt(starts, safeEnd)\n\t};\n}\nfunction mergeRanges(ranges) {\n\tconst merged = [];\n\tfor (const range of ranges.sort((a, b) => a.start - b.start)) {\n\t\tconst previous = merged.at(-1);\n\t\tif (previous && range.start <= previous.end + 1) previous.end = Math.max(previous.end, range.end);\n\t\telse merged.push({ ...range });\n\t}\n\treturn merged;\n}\nfunction formatRanges(ranges) {\n\tconst shown = ranges.slice(0, 3).map((range) => range.start === range.end ? String(range.start) : `${range.start}-${range.end}`);\n\treturn `${shown.join(\", \")}${ranges.length > shown.length ? ` (+${ranges.length - shown.length} more)` : \"\"}`;\n}\nfunction describeContentChange(before, after) {\n\tif (before && after && Buffer.from(before).equals(Buffer.from(after))) return;\n\tconst oldText = decode(before);\n\tconst newText = decode(after);\n\tif (oldText === void 0 || newText === void 0) return `binary bytes ${before?.byteLength ?? 0} -> ${after?.byteLength ?? 0}`;\n\tif (oldText.length === 0 && newText.length === 0) return;\n\tif (oldText.length === 0) {\n\t\tconst count = lineStarts(newText).length;\n\t\treturn `added lines ${count === 1 ? \"1\" : `1-${count}`}`;\n\t}\n\tif (newText.length === 0) {\n\t\tconst count = lineStarts(oldText).length;\n\t\treturn `removed lines ${count === 1 ? \"1\" : `1-${count}`}`;\n\t}\n\tconst changes = [];\n\tlet oldOffset = 0;\n\tlet newOffset = 0;\n\tlet current;\n\tconst finish = () => {\n\t\tif (current) {\n\t\t\tchanges.push(current);\n\t\t\tcurrent = void 0;\n\t\t}\n\t};\n\tfor (const [operation, value] of new DiffMatchPatch().diff_main(oldText, newText)) {\n\t\tif (operation === 0) {\n\t\t\tfinish();\n\t\t\toldOffset += value.length;\n\t\t\tnewOffset += value.length;\n\t\t\tcontinue;\n\t\t}\n\t\tcurrent ??= {\n\t\t\toldStart: oldOffset,\n\t\t\toldEnd: oldOffset,\n\t\t\tnewStart: newOffset,\n\t\t\tnewEnd: newOffset\n\t\t};\n\t\tif (operation === -1) oldOffset += value.length;\n\t\tif (operation === 1) newOffset += value.length;\n\t\tcurrent.oldEnd = oldOffset;\n\t\tcurrent.newEnd = newOffset;\n\t}\n\tfinish();\n\tconst ranges = mergeRanges(changes.map((change) => change.newEnd > change.newStart ? toLineRange(newText, change.newStart, change.newEnd) : toLineRange(oldText, change.oldStart, change.oldEnd)));\n\treturn ranges.length === 0 ? void 0 : `lines ${formatRanges(ranges)}`;\n}\n// src/sync/threeWayMerge.ts\nconst textDecoder = new TextDecoder(\"utf-8\", { fatal: true });\nconst textEncoder = new TextEncoder();\nfunction decodeText(content) {\n\tif (content.includes(0)) return;\n\ttry {\n\t\treturn textDecoder.decode(content);\n\t} catch {\n\t\treturn;\n\t}\n}\nfunction splitLines(content) {\n\treturn content.match(/[^\\n]*\\n|[^\\n]+$/g) ?? [];\n}\nfunction encodeTextBase(content) {\n\treturn decodeText(content);\n}\nfunction mergeText(baseContent, localContent, remoteContent) {\n\tconst base = decodeText(baseContent);\n\tconst local = decodeText(localContent);\n\tconst remote = decodeText(remoteContent);\n\tif (base === void 0 || local === void 0 || remote === void 0) return { status: \"binary\" };\n\tconst regions = diff3Merge(splitLines(local), splitLines(base), splitLines(remote), { excludeFalseConflicts: true });\n\tif (regions.some((region) => region.conflict !== void 0)) return { status: \"conflict\" };\n\treturn {\n\t\tstatus: \"merged\",\n\t\tcontent: textEncoder.encode(regions.flatMap((region) => region.ok ?? []).join(\"\"))\n\t};\n}\n// src/sync/checkpoint.ts\nconst SYNC_STATE_SCHEMA_VERSION = 1;\nfunction sha256(content) {\n\treturn createHash(\"sha256\").update(content).digest(\"hex\");\n}\nfunction createSyncState(projectUri, remoteVersion, initialized = true) {\n\treturn {\n\t\tschemaVersion: 1,\n\t\tprojectUri,\n\t\tremoteVersion,\n\t\tinitialized,\n\t\tfiles: {},\n\t\ttextBases: {},\n\t\tconflicts: {}\n\t};\n}\nfunction updateSyncCheckpoint(state, path, content) {\n\tstate.files[path] = sha256(content);\n\tconst textBase = encodeTextBase(content);\n\tif (textBase === void 0) delete state.textBases[path];\n\telse state.textBases[path] = textBase;\n}\nfunction removeSyncCheckpoint(state, path) {\n\tconst checkpointPaths = /* @__PURE__ */ new Set([...Object.keys(state.files), ...Object.keys(state.conflicts)]);\n\tfor (const checkpointPath of checkpointPaths) if (checkpointPath === path || checkpointPath.startsWith(`${path}/`)) {\n\t\tdelete state.files[checkpointPath];\n\t\tdelete state.textBases[checkpointPath];\n\t\tdelete state.conflicts[checkpointPath];\n\t}\n}\nfunction readTextBase(state, path) {\n\tconst textBase = state?.textBases[path];\n\treturn textBase === void 0 ? void 0 : new TextEncoder().encode(textBase);\n}\n// src/sync/syncEngine.ts\nfunction normalizePath(path) {\n\treturn `/${posix.normalize(path).replace(/^\\/+/, \"\")}`;\n}\nfunction isRemoteFile(entry) {\n\treturn entry?.type === \"doc\" || entry?.type === \"file\";\n}\nvar SyncEngine = class {\n\toptions;\n\tstate;\n\tqueue = Promise.resolve();\n\tconflicts = /* @__PURE__ */ new Set();\n\tstopLocalWatch;\n\tstopRemoteChange;\n\tstopRemoteReconnect;\n\teventTimers = /* @__PURE__ */ new Map();\n\tstopped = false;\n\tfailedPaths = /* @__PURE__ */ new Map();\n\tretryTimer;\n\tretryDelayMs = 3e4;\n\tpendingRemoteVersion;\n\tpendingInitialization = false;\n\tget syncError() {\n\t\tif (this.failedPaths.size === 0) return;\n\t\tconst [path, failure] = this.failedPaths.entries().next().value;\n\t\treturn `${this.failedPaths.size} path(s) could not synchronize, including ${path}: ${failure.message}. Other paths remain active; failed paths will retry automatically.`;\n\t}\n\tconstructor(options) {\n\t\tthis.options = options;\n\t}\n\tasync start() {\n\t\tthis.stopped = false;\n\t\tconst startup = this.enqueue(() => this.initialize());\n\t\ttry {\n\t\t\tawait startup;\n\t\t} catch (error) {\n\t\t\tawait this.stop();\n\t\t\tthrow error;\n\t\t}\n\t}\n\tasync initialize() {\n\t\tthis.state = await this.options.stateStore.load();\n\t\tthis.stopLocalWatch = await this.options.local.watch((path) => this.schedule(path, \"local\"));\n\t\tthis.stopRemoteChange = this.options.remote.onChange((change) => {\n\t\t\tif (this.stopped) return;\n\t\t\tif (change.previousPath) this.schedule(change.previousPath, \"remote\", change.actor);\n\t\t\tthis.schedule(change.path, \"remote\", change.actor);\n\t\t});\n\t\tthis.stopRemoteReconnect = this.options.remote.onReconnect?.(() => {\n\t\t\tif (this.stopped) return;\n\t\t\tthis.queue = this.queue.then(() => this.reconcileAfterReconnect()).catch((error) => {\n\t\t\t\tthis.options.log(`Failed to reconcile after reconnecting: ${error instanceof Error ? error.message : String(error)}`);\n\t\t\t});\n\t\t});\n\t\tconst currentVersion = await this.options.remote.getCurrentVersion();\n\t\tconst localFiles = await this.options.local.listFiles();\n\t\tconst remoteFiles = this.remoteFilePaths();\n\t\tthis.options.log(`Checking replica at Overleaf version ${currentVersion}: ${localFiles.length} local file(s), ${remoteFiles.length} remote file(s).`);\n\t\tif (!this.state || !this.state.initialized) await this.initializeState(currentVersion, localFiles, remoteFiles);\n\t\telse {\n\t\t\tthis.restoreConflicts();\n\t\t\tawait this.startupReconcile(currentVersion, localFiles, remoteFiles);\n\t\t}\n\t\tthis.options.log(this.syncError ? `Synchronization active with pending retries. ${this.syncError}` : `Synchronization active at Overleaf version ${this.state.remoteVersion}.`);\n\t}\n\tasync stop() {\n\t\tthis.stopped = true;\n\t\tif (this.retryTimer) {\n\t\t\tclearTimeout(this.retryTimer);\n\t\t\tthis.retryTimer = void 0;\n\t\t}\n\t\tthis.stopRemoteChange?.();\n\t\tthis.stopRemoteChange = void 0;\n\t\tthis.stopRemoteReconnect?.();\n\t\tthis.stopRemoteReconnect = void 0;\n\t\tfor (const pending of this.eventTimers.values()) clearTimeout(pending.timer);\n\t\tthis.eventTimers.clear();\n\t\tawait this.stopLocalWatch?.();\n\t\tthis.stopLocalWatch = void 0;\n\t\tawait this.queue;\n\t}\n\tgetConflicts() {\n\t\treturn [...this.conflicts].sort();\n\t}\n\tasync resolveConflict(path, winner) {\n\t\tconst normalized = normalizePath(path);\n\t\tif (!this.conflicts.has(normalized)) throw new Error(`No unresolved conflict exists for ${normalized}.`);\n\t\tawait this.enqueue(async () => {\n\t\t\tconst remoteEntry = this.options.remote.entry(normalized);\n\t\t\tif (winner === \"local\") {\n\t\t\t\tconst localContent = await this.options.local.read(normalized);\n\t\t\t\tif (localContent) {\n\t\t\t\t\tawait this.options.remote.write(normalized, localContent);\n\t\t\t\t\tconst synchronized = await this.options.remote.read(normalized);\n\t\t\t\t\tif (sha256(synchronized) !== sha256(localContent)) await this.options.local.write(normalized, synchronized);\n\t\t\t\t\tupdateSyncCheckpoint(this.state, normalized, synchronized);\n\t\t\t\t} else {\n\t\t\t\t\tif (remoteEntry) await this.options.remote.remove(normalized);\n\t\t\t\t\tremoveSyncCheckpoint(this.state, normalized);\n\t\t\t\t}\n\t\t\t} else if (isRemoteFile(remoteEntry)) {\n\t\t\t\tconst remoteContent = await this.options.remote.read(normalized);\n\t\t\t\tawait this.options.local.write(normalized, remoteContent);\n\t\t\t\tupdateSyncCheckpoint(this.state, normalized, remoteContent);\n\t\t\t} else {\n\t\t\t\tawait this.options.local.remove(normalized);\n\t\t\t\tremoveSyncCheckpoint(this.state, normalized);\n\t\t\t}\n\t\t\tthis.conflicts.delete(normalized);\n\t\t\tdelete this.state.conflicts[normalized];\n\t\t\tawait this.options.stateStore.save(this.state);\n\t\t\tthis.options.log(`Resolved ${normalized} using ${winner === \"local\" ? \"local\" : \"Overleaf\"} content.`);\n\t\t});\n\t}\n\tasync retry(path) {\n\t\tconst normalized = normalizePath(path);\n\t\tconst reason = this.state.conflicts[normalized];\n\t\tthis.conflicts.delete(normalized);\n\t\tdelete this.state.conflicts[normalized];\n\t\ttry {\n\t\t\tawait this.enqueue(() => this.reconcilePath(normalized, \"local\"));\n\t\t} catch (error) {\n\t\t\tif (reason !== void 0) {\n\t\t\t\tthis.conflicts.add(normalized);\n\t\t\t\tthis.state.conflicts[normalized] = reason;\n\t\t\t\tawait this.options.stateStore.save(this.state);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\tasync initializeState(currentVersion, localFiles, remoteFiles) {\n\t\tif (!this.state) {\n\t\t\tthis.state = createSyncState(this.options.projectUri, currentVersion, false);\n\t\t\tawait this.options.stateStore.save(this.state);\n\t\t}\n\t\tthis.restoreConflicts();\n\t\tthis.pendingRemoteVersion = currentVersion;\n\t\tthis.pendingInitialization = true;\n\t\tconst paths = /* @__PURE__ */ new Set([\n\t\t\t...localFiles,\n\t\t\t...remoteFiles,\n\t\t\t...Object.keys(this.state.files)\n\t\t]);\n\t\tfor (const path of [...paths].sort()) {\n\t\t\tconst normalized = normalizePath(path);\n\t\t\tif (this.conflicts.has(normalized)) continue;\n\t\t\ttry {\n\t\t\t\tif (this.state.files[normalized] !== void 0) await this.synchronizePath(normalized, \"local\");\n\t\t\t\telse await this.initializePath(normalized);\n\t\t\t} catch (error) {\n\t\t\t\tthis.recordFailure(normalized, \"local\", error);\n\t\t\t}\n\t\t}\n\t\tawait this.finishRemoteBatch();\n\t\tif (this.conflicts.size !== 0) this.options.log(`Synchronization remains active; ${this.conflicts.size} conflicting path(s) are paused.`);\n\t}\n\tasync initializePath(path) {\n\t\tconst remoteEntry = this.options.remote.entry(path);\n\t\tif (remoteEntry?.type === \"folder\") return;\n\t\tconst localContent = await this.options.local.read(path);\n\t\tconst remoteContent = isRemoteFile(remoteEntry) ? await this.options.remote.read(path) : void 0;\n\t\tif ((localContent && sha256(localContent)) === (remoteContent && sha256(remoteContent))) {\n\t\t\tif (localContent) {\n\t\t\t\tupdateSyncCheckpoint(this.state, path, localContent);\n\t\t\t\tawait this.options.stateStore.save(this.state);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (!localContent && remoteContent) {\n\t\t\tawait this.options.local.write(path, remoteContent);\n\t\t\tupdateSyncCheckpoint(this.state, path, remoteContent);\n\t\t\tawait this.options.stateStore.save(this.state);\n\t\t\tthis.logChange(\"pull\", \"add\", path, void 0, remoteContent);\n\t\t\treturn;\n\t\t}\n\t\tawait this.recordConflict(path, remoteContent ? \"Local and Overleaf content differ, but no common checkpoint exists.\" : \"The local path has no matching Overleaf file and no common checkpoint exists.\");\n\t}\n\trestoreConflicts() {\n\t\tfor (const [path, reason] of Object.entries(this.state.conflicts)) {\n\t\t\tif (this.conflicts.has(path)) continue;\n\t\t\tthis.conflicts.add(path);\n\t\t\tthis.options.onConflict(path, reason);\n\t\t}\n\t}\n\tasync recordConflict(path, reason) {\n\t\tthis.conflicts.add(path);\n\t\tthis.state.conflicts[path] = reason;\n\t\tawait this.options.stateStore.save(this.state);\n\t\tthis.options.onConflict(path, reason);\n\t}\n\tasync startupReconcile(currentVersion, localFiles, remoteFiles) {\n\t\tconst state = this.state;\n\t\tif (state.remoteVersion > currentVersion) throw new Error(\"Synchronization paused: the local checkpoint is newer than the Overleaf project history.\");\n\t\tconst localHashes = /* @__PURE__ */ new Map();\n\t\tfor (const path of localFiles) {\n\t\t\tconst content = await this.options.local.read(path);\n\t\t\tif (content) localHashes.set(path, sha256(content));\n\t\t}\n\t\tconst localChanged = /* @__PURE__ */ new Set();\n\t\tfor (const path of /* @__PURE__ */ new Set([...Object.keys(state.files), ...localFiles])) if (state.files[path] !== localHashes.get(path)) localChanged.add(path);\n\t\tlet remoteDiff = { diff: [] };\n\t\tif (state.remoteVersion < currentVersion) {\n\t\t\tremoteDiff = await this.options.remote.getFileTreeDiff(state.remoteVersion, currentVersion);\n\t\t\tif (!remoteDiff) throw new Error(\"Synchronization paused: Overleaf history is unavailable, so remote changes cannot be distinguished safely.\");\n\t\t}\n\t\tconst candidates = /* @__PURE__ */ new Set([...localChanged, ...this.failedPaths.keys()]);\n\t\tconst knownFiles = /* @__PURE__ */ new Set([\n\t\t\t...Object.keys(state.files),\n\t\t\t...localFiles,\n\t\t\t...remoteFiles\n\t\t]);\n\t\tfor (const path of [...localFiles, ...remoteFiles]) if (state.files[path] === void 0) candidates.add(path);\n\t\tfor (const change of remoteDiff.diff) {\n\t\t\tif (!change.operation) continue;\n\t\t\tconst paths = [change.pathname, change.newPathname].filter((path) => Boolean(path));\n\t\t\tfor (const changedPath of paths.map(normalizePath)) {\n\t\t\t\tlet matched = false;\n\t\t\t\tfor (const filePath of knownFiles) if (filePath === changedPath || filePath.startsWith(`${changedPath}/`)) {\n\t\t\t\t\tcandidates.add(filePath);\n\t\t\t\t\tmatched = true;\n\t\t\t\t}\n\t\t\t\tif (!matched) candidates.add(changedPath);\n\t\t\t}\n\t\t}\n\t\tthis.pendingRemoteVersion = currentVersion;\n\t\tthis.options.log(`Reconciling ${candidates.size} changed path(s).`);\n\t\tfor (const path of [...candidates].sort()) {\n\t\t\tif (this.stopped) return;\n\t\t\ttry {\n\t\t\t\tawait this.synchronizePath(path, localChanged.has(path) ? \"local\" : \"remote\");\n\t\t\t} catch (error) {\n\t\t\t\tthis.recordFailure(path, localChanged.has(path) ? \"local\" : \"remote\", error);\n\t\t\t}\n\t\t}\n\t\tawait this.finishRemoteBatch();\n\t\tif (this.conflicts.size !== 0) this.options.log(`Synchronization remains active; ${this.conflicts.size} conflicting path(s) are paused.`);\n\t}\n\tasync reconcileAfterReconnect() {\n\t\tif (this.stopped) return;\n\t\tconst currentVersion = await this.options.remote.getCurrentVersion();\n\t\tawait this.startupReconcile(currentVersion, await this.options.local.listFiles(), this.remoteFilePaths());\n\t\tthis.options.log(this.syncError ? `Realtime connection restored; ${this.syncError}` : `Realtime connection restored at Overleaf version ${currentVersion}.`);\n\t}\n\tschedule(path, source, actor) {\n\t\tconst normalized = normalizePath(path);\n\t\tif (this.stopped || this.shouldIgnore(normalized) || this.conflicts.has(normalized)) return;\n\t\tconst previous = this.eventTimers.get(normalized);\n\t\tif (previous) clearTimeout(previous.timer);\n\t\tconst actors = previous?.actors ?? /* @__PURE__ */ new Set();\n\t\tlet unknownRemoteActor = previous?.unknownRemoteActor ?? false;\n\t\tif (source === \"remote\") {\n\t\t\tif (actor) actors.add(actor);\n\t\t\telse unknownRemoteActor = true;\n\t\t}\n\t\tconst pending = {\n\t\t\tsource: previous?.source === \"local\" || source === \"local\" ? \"local\" : \"remote\",\n\t\t\tactors,\n\t\t\tunknownRemoteActor,\n\t\t\ttimer: setTimeout(() => {\n\t\t\t\tthis.eventTimers.delete(normalized);\n\t\t\t\tif (this.stopped) return;\n\t\t\t\tconst remoteActor = pending.unknownRemoteActor ? void 0 : pending.actors.size === 1 ? [...pending.actors][0] : pending.actors.size > 1 ? \"multiple Overleaf collaborators\" : void 0;\n\t\t\t\tthis.queue = this.queue.then(() => this.synchronizePath(normalized, pending.source, remoteActor)).catch((error) => {\n\t\t\t\t\tthis.recordFailure(normalized, pending.source, error, remoteActor);\n\t\t\t\t});\n\t\t\t}, 250)\n\t\t};\n\t\tthis.eventTimers.set(normalized, pending);\n\t}\n\tasync synchronizePath(path, source, actor) {\n\t\tif (this.pendingInitialization && this.state.files[path] === void 0) await this.initializePath(path);\n\t\telse await this.reconcilePath(path, source, actor);\n\t\tif (this.failedPaths.delete(path)) this.options.onSyncError?.(this.syncError);\n\t}\n\trecordFailure(path, source, error, actor) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tthis.failedPaths.set(path, {\n\t\t\tsource,\n\t\t\tactor,\n\t\t\tmessage\n\t\t});\n\t\tthis.options.log(`Failed to synchronize ${path}: ${message}; retrying without stopping other paths.`);\n\t\tthis.options.onSyncError?.(this.syncError);\n\t\tthis.scheduleRetry();\n\t}\n\tscheduleRetry() {\n\t\tif (this.stopped || this.retryTimer || this.failedPaths.size === 0) return;\n\t\tthis.retryTimer = setTimeout(() => {\n\t\t\tthis.retryTimer = void 0;\n\t\t\tthis.enqueue(async () => {\n\t\t\t\tif (this.stopped) return;\n\t\t\t\tfor (const [path, failure] of Array.from(this.failedPaths)) {\n\t\t\t\t\tif (this.stopped) return;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.synchronizePath(path, failure.source, failure.actor);\n\t\t\t\t\t\tthis.options.log(`Recovered synchronization for ${path}.`);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\t\tthis.failedPaths.set(path, {\n\t\t\t\t\t\t\t...failure,\n\t\t\t\t\t\t\tmessage\n\t\t\t\t\t\t});\n\t\t\t\t\t\tthis.options.log(`Retry failed for ${path}: ${message}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tawait this.finishRemoteBatch();\n\t\t\t}).catch((error) => this.options.log(`Could not checkpoint retry batch: ${String(error)}`)).finally(() => {\n\t\t\t\tthis.retryDelayMs = this.failedPaths.size ? Math.min(this.retryDelayMs * 2, 12e4) : 3e4;\n\t\t\t\tthis.scheduleRetry();\n\t\t\t});\n\t\t}, this.retryDelayMs);\n\t}\n\tasync finishRemoteBatch() {\n\t\tif (this.stopped || this.failedPaths.size || this.pendingRemoteVersion === void 0) return;\n\t\tthis.state.remoteVersion = this.pendingRemoteVersion;\n\t\tif (this.pendingInitialization) this.state.initialized = true;\n\t\tawait this.options.stateStore.save(this.state);\n\t\tthis.pendingRemoteVersion = void 0;\n\t\tthis.pendingInitialization = false;\n\t}\n\tenqueue(operation) {\n\t\tconst result = this.queue.then(operation);\n\t\tthis.queue = result.then(() => void 0, () => void 0);\n\t\treturn result;\n\t}\n\tasync reconcilePath(path, source, actor) {\n\t\tconst normalized = normalizePath(path);\n\t\tif (this.stopped || this.shouldIgnore(normalized) || this.conflicts.has(normalized)) return;\n\t\tconst remoteEntry = this.options.remote.entry(normalized);\n\t\tif (remoteEntry?.type === \"folder\") return;\n\t\tconst localContent = await this.options.local.read(normalized);\n\t\tconst remoteContent = isRemoteFile(remoteEntry) ? await this.options.remote.read(normalized) : void 0;\n\t\tconst baseHash = this.state.files[normalized];\n\t\tconst baseContent = readTextBase(this.state, normalized);\n\t\tconst localHash = localContent && sha256(localContent);\n\t\tconst remoteHash = remoteContent && sha256(remoteContent);\n\t\tif (localHash === remoteHash) {\n\t\t\tif (localHash !== baseHash) {\n\t\t\t\tif (localContent) updateSyncCheckpoint(this.state, normalized, localContent);\n\t\t\t\telse removeSyncCheckpoint(this.state, normalized);\n\t\t\t\tawait this.options.stateStore.save(this.state);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tconst localChanged = localHash !== baseHash;\n\t\tconst remoteChanged = remoteHash !== baseHash;\n\t\tif (localChanged && remoteChanged) {\n\t\t\tif (baseContent && localContent && remoteContent) {\n\t\t\t\tconst merged = mergeText(baseContent, localContent, remoteContent);\n\t\t\t\tif (merged.status === \"merged\" && merged.content) {\n\t\t\t\t\tawait this.options.local.write(normalized, merged.content);\n\t\t\t\t\tawait this.options.remote.write(normalized, merged.content);\n\t\t\t\t\tupdateSyncCheckpoint(this.state, normalized, merged.content);\n\t\t\t\t\tawait this.options.stateStore.save(this.state);\n\t\t\t\t\tthis.logChange(\"merge\", \"update\", normalized, baseContent, merged.content, actor);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tawait this.recordConflict(normalized, \"Both local and Overleaf content changed since the last synchronized checkpoint.\");\n\t\t\treturn;\n\t\t}\n\t\tif (source === \"remote\" && localChanged && !remoteChanged) return;\n\t\tif (localChanged || !remoteChanged && source === \"local\") {\n\t\t\tlet pushedContent = localContent;\n\t\t\tif (!localContent) {\n\t\t\t\tif (remoteEntry) await this.options.remote.remove(normalized);\n\t\t\t\tremoveSyncCheckpoint(this.state, normalized);\n\t\t\t} else {\n\t\t\t\tawait this.options.remote.write(normalized, localContent);\n\t\t\t\tconst synchronized = await this.options.remote.read(normalized);\n\t\t\t\tif (sha256(synchronized) !== sha256(localContent)) await this.options.local.write(normalized, synchronized);\n\t\t\t\tpushedContent = synchronized;\n\t\t\t\tupdateSyncCheckpoint(this.state, normalized, synchronized);\n\t\t\t}\n\t\t\tawait this.options.stateStore.save(this.state);\n\t\t\tif (!localContent && remoteEntry) this.logChange(\"push\", \"delete\", normalized, baseContent ?? remoteContent, void 0, actor);\n\t\t\telse if (localContent) this.logChange(\"push\", remoteEntry ? \"update\" : \"add\", normalized, baseContent ?? remoteContent, pushedContent, actor);\n\t\t\treturn;\n\t\t}\n\t\tif (!remoteContent) {\n\t\t\tif (localContent) await this.options.local.remove(normalized);\n\t\t\tremoveSyncCheckpoint(this.state, normalized);\n\t\t} else {\n\t\t\tawait this.options.local.write(normalized, remoteContent);\n\t\t\tupdateSyncCheckpoint(this.state, normalized, remoteContent);\n\t\t}\n\t\tawait this.options.stateStore.save(this.state);\n\t\tif (!remoteContent && localContent) this.logChange(\"pull\", \"delete\", normalized, baseContent ?? localContent, void 0, actor);\n\t\telse if (remoteContent) this.logChange(\"pull\", localContent ? \"update\" : \"add\", normalized, baseContent ?? localContent, remoteContent, actor);\n\t}\n\tlogChange(direction, operation, path, before, after, actor) {\n\t\tconst summary = describeContentChange(before, after);\n\t\tconst source = direction === \"push\" ? \"local filesystem\" : direction === \"pull\" ? actor ?? \"Overleaf\" : `local filesystem + ${actor ?? \"Overleaf\"}`;\n\t\tthis.options.log([\n\t\t\t`[${direction}] ${operation} ${JSON.stringify(path)}`,\n\t\t\tsummary,\n\t\t\t`source=${source}`\n\t\t].filter(Boolean).join(\"; \"));\n\t}\n\tremoteFilePaths() {\n\t\treturn this.options.remote.listEntries().filter((entry) => isRemoteFile(entry) && !this.shouldIgnore(entry.path)).map((entry) => entry.path);\n\t}\n\tshouldIgnore(path) {\n\t\treturn this.options.ignore(path) || path.split(\"/\").some((part) => part.startsWith(\".\"));\n\t}\n};\n// src/node/syncStateStore.ts\nconst HASH_PATTERN = /^[a-f0-9]{64}$/;\nconst encoder = new TextEncoder();\nfunction json(value) {\n\treturn `${JSON.stringify(value, null, 2)}\\n`;\n}\nfunction pathKey(path) {\n\treturn sha256(encoder.encode(path));\n}\nasync function readJson(path) {\n\treturn JSON.parse(await readFile(path, \"utf8\"));\n}\nasync function listFiles(directory) {\n\tconst result = [];\n\tconst visit = async (current) => {\n\t\tlet entries;\n\t\ttry {\n\t\t\tentries = await readdir(current, { withFileTypes: true });\n\t\t} catch (error) {\n\t\t\tif (error.code === \"ENOENT\") return;\n\t\t\tthrow error;\n\t\t}\n\t\tfor (const entry of entries) {\n\t\t\tconst path = join(current, entry.name);\n\t\t\tif (entry.isDirectory()) await visit(path);\n\t\t\telse if (entry.isFile()) result.push(path);\n\t\t}\n\t};\n\tawait visit(directory);\n\treturn result;\n}\nasync function atomicWrite(path, content) {\n\tawait mkdir(dirname(path), { recursive: true });\n\tconst temporary = `${path}.${process.pid}.${randomUUID()}.tmp`;\n\ttry {\n\t\tawait writeFile(temporary, content);\n\t\tawait rename(temporary, path);\n\t} finally {\n\t\tawait rm(temporary, { force: true });\n\t}\n}\nfunction parseFormat(value, projectUri) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst format = value;\n\treturn format.schemaVersion === 1 && format.projectUri === projectUri;\n}\nfunction parseCursor(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst cursor = value;\n\treturn Number.isInteger(cursor.remoteVersion) && cursor.remoteVersion >= 0 && typeof cursor.initialized === \"boolean\";\n}\nfunction parsePathRecord(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst record = value;\n\tif (typeof record.path !== \"string\" || !record.path.startsWith(\"/\")) return false;\n\tif (record.hash !== void 0 && (typeof record.hash !== \"string\" || !HASH_PATTERN.test(record.hash))) return false;\n\tif (record.baseHash !== void 0 && (typeof record.baseHash !== \"string\" || !HASH_PATTERN.test(record.baseHash) || record.hash !== record.baseHash)) return false;\n\tif (record.conflict !== void 0 && typeof record.conflict !== \"string\") return false;\n\treturn record.hash !== void 0 || record.conflict !== void 0;\n}\nfunction createRecord(state, path) {\n\tconst hash = state.files[path];\n\tconst textBase = state.textBases[path];\n\tconst conflict = state.conflicts[path];\n\tif (hash === void 0 && conflict === void 0) return;\n\treturn {\n\t\tpath,\n\t\t...hash === void 0 ? {} : { hash },\n\t\t...textBase === void 0 ? {} : { baseHash: hash },\n\t\t...conflict === void 0 ? {} : { conflict }\n\t};\n}\nvar FileSyncStateStore = class {\n\tprojectUri;\n\tlegacyPath;\n\tsyncDirectory;\n\tformatPath;\n\tcursorPath;\n\tpathsDirectory;\n\tbasesDirectory;\n\tpersistedRecords = /* @__PURE__ */ new Map();\n\tpersistedCursor;\n\tinvalidRecordPaths = /* @__PURE__ */ new Set();\n\tinitialized = false;\n\tconstructor(directory, projectUri) {\n\t\tthis.projectUri = projectUri;\n\t\tconst overleafDirectory = resolve(directory, \".overleaf\");\n\t\tthis.legacyPath = join(overleafDirectory, \"sync-state.json\");\n\t\tthis.syncDirectory = join(overleafDirectory, \"sync\");\n\t\tthis.formatPath = join(this.syncDirectory, \"format.json\");\n\t\tthis.cursorPath = join(this.syncDirectory, \"cursor.json\");\n\t\tthis.pathsDirectory = join(this.syncDirectory, \"paths\");\n\t\tthis.basesDirectory = join(this.syncDirectory, \"bases\");\n\t}\n\tasync load() {\n\t\tthis.invalidRecordPaths.clear();\n\t\ttry {\n\t\t\tconst format = await readJson(this.formatPath);\n\t\t\tconst cursor = await readJson(this.cursorPath);\n\t\t\tif (!parseFormat(format, this.projectUri) || !parseCursor(cursor)) return;\n\t\t\tconst state = {\n\t\t\t\tschemaVersion: 1,\n\t\t\t\tprojectUri: this.projectUri,\n\t\t\t\tremoteVersion: cursor.remoteVersion,\n\t\t\t\tinitialized: cursor.initialized,\n\t\t\t\tfiles: {},\n\t\t\t\ttextBases: {},\n\t\t\t\tconflicts: {}\n\t\t\t};\n\t\t\tconst records = /* @__PURE__ */ new Map();\n\t\t\tconst referencedBases = /* @__PURE__ */ new Set();\n\t\t\tlet stateIncomplete = false;\n\t\t\tfor (const recordPath of await listFiles(this.pathsDirectory)) {\n\t\t\t\tconst record = await this.loadRecord(recordPath);\n\t\t\t\tif (!record) {\n\t\t\t\t\tif (recordPath.endsWith(\".json\")) {\n\t\t\t\t\t\tthis.invalidRecordPaths.add(recordPath);\n\t\t\t\t\t\tstateIncomplete = true;\n\t\t\t\t\t} else await rm(recordPath, { force: true });\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (record.hash !== void 0) state.files[record.path] = record.hash;\n\t\t\t\tif (record.baseHash !== void 0) {\n\t\t\t\t\tlet textBase;\n\t\t\t\t\ttry {\n\t\t\t\t\t\ttextBase = await readFile(this.basePath(record.baseHash), \"utf8\");\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tif (error.code === \"ENOENT\") {\n\t\t\t\t\t\t\tthis.invalidRecordPaths.add(recordPath);\n\t\t\t\t\t\t\tstateIncomplete = true;\n\t\t\t\t\t\t\tdelete state.files[record.path];\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t\tif (sha256(encoder.encode(textBase)) !== record.baseHash) {\n\t\t\t\t\t\tthis.invalidRecordPaths.add(recordPath);\n\t\t\t\t\t\tstateIncomplete = true;\n\t\t\t\t\t\tdelete state.files[record.path];\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tstate.textBases[record.path] = textBase;\n\t\t\t\t\treferencedBases.add(record.baseHash);\n\t\t\t\t}\n\t\t\t\tif (record.conflict !== void 0) state.conflicts[record.path] = record.conflict;\n\t\t\t\trecords.set(record.path, json(record));\n\t\t\t}\n\t\t\tif (stateIncomplete) state.initialized = false;\n\t\t\tawait this.removeOrphanBases(referencedBases);\n\t\t\tthis.persistedRecords = records;\n\t\t\tthis.persistedCursor = json(cursor);\n\t\t\tthis.initialized = true;\n\t\t\treturn state;\n\t\t} catch (error) {\n\t\t\tif (error.code === \"ENOENT\" || error instanceof SyntaxError) return;\n\t\t\tthrow error;\n\t\t}\n\t}\n\tasync save(state) {\n\t\tif (state.projectUri !== this.projectUri || state.schemaVersion !== 1) throw new Error(\"Cannot persist synchronization state for a different project or schema.\");\n\t\tif (!this.initialized) await this.initializeStorage();\n\t\tconst paths = /* @__PURE__ */ new Set([\n\t\t\t...this.persistedRecords.keys(),\n\t\t\t...Object.keys(state.files),\n\t\t\t...Object.keys(state.conflicts)\n\t\t]);\n\t\tconst obsoleteBases = /* @__PURE__ */ new Set();\n\t\tfor (const path of [...paths].sort()) {\n\t\t\tconst record = createRecord(state, path);\n\t\t\tconst serialized = record && json(record);\n\t\t\tconst previous = this.persistedRecords.get(path);\n\t\t\tif (serialized === previous) continue;\n\t\t\tif (previous) {\n\t\t\t\tconst previousRecord = JSON.parse(previous);\n\t\t\t\tif (previousRecord.baseHash) obsoleteBases.add(previousRecord.baseHash);\n\t\t\t}\n\t\t\tif (!record || !serialized) {\n\t\t\t\tawait rm(this.recordPath(path), { force: true });\n\t\t\t\tthis.persistedRecords.delete(path);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (record.baseHash) {\n\t\t\t\tconst textBase = state.textBases[path];\n\t\t\t\tif (textBase === void 0 || sha256(encoder.encode(textBase)) !== record.baseHash) throw new Error(`Text checkpoint does not match its content hash: ${path}`);\n\t\t\t\tawait this.writeBase(record.baseHash, textBase);\n\t\t\t}\n\t\t\tconst destination = this.recordPath(path);\n\t\t\tawait atomicWrite(destination, serialized);\n\t\t\tthis.invalidRecordPaths.delete(destination);\n\t\t\tthis.persistedRecords.set(path, serialized);\n\t\t}\n\t\tconst cursor = json({\n\t\t\tremoteVersion: state.remoteVersion,\n\t\t\tinitialized: state.initialized\n\t\t});\n\t\tif (cursor !== this.persistedCursor) {\n\t\t\tawait atomicWrite(this.cursorPath, cursor);\n\t\t\tthis.persistedCursor = cursor;\n\t\t}\n\t\tif (state.initialized) {\n\t\t\tawait Promise.all([...this.invalidRecordPaths].map((path) => rm(path, { force: true })));\n\t\t\tthis.invalidRecordPaths.clear();\n\t\t}\n\t\tawait rm(this.legacyPath, { force: true });\n\t\tawait this.removeObsoleteBases(state, obsoleteBases);\n\t}\n\tasync initializeStorage() {\n\t\tawait rm(this.syncDirectory, {\n\t\t\trecursive: true,\n\t\t\tforce: true\n\t\t});\n\t\tawait mkdir(this.pathsDirectory, { recursive: true });\n\t\tawait mkdir(this.basesDirectory, { recursive: true });\n\t\tawait atomicWrite(this.formatPath, json({\n\t\t\tschemaVersion: 1,\n\t\t\tprojectUri: this.projectUri\n\t\t}));\n\t\tthis.persistedRecords.clear();\n\t\tthis.persistedCursor = void 0;\n\t\tthis.invalidRecordPaths.clear();\n\t\tthis.initialized = true;\n\t}\n\trecordPath(path) {\n\t\tconst key = pathKey(path);\n\t\treturn join(this.pathsDirectory, key.slice(0, 2), `${key}.json`);\n\t}\n\tasync loadRecord(recordPath) {\n\t\tif (!recordPath.endsWith(\".json\")) return;\n\t\ttry {\n\t\t\tconst record = await readJson(recordPath);\n\t\t\tif (!parsePathRecord(record) || recordPath !== this.recordPath(record.path)) return;\n\t\t\treturn record;\n\t\t} catch (error) {\n\t\t\tif (error.code === \"ENOENT\" || error instanceof SyntaxError) return;\n\t\t\tthrow error;\n\t\t}\n\t}\n\tbasePath(hash) {\n\t\treturn join(this.basesDirectory, hash.slice(0, 2), `${hash}.txt`);\n\t}\n\tasync writeBase(hash, content) {\n\t\tconst path = this.basePath(hash);\n\t\ttry {\n\t\t\tif (sha256(encoder.encode(await readFile(path, \"utf8\"))) === hash) return;\n\t\t} catch (error) {\n\t\t\tif (error.code !== \"ENOENT\") throw error;\n\t\t}\n\t\tawait atomicWrite(path, content);\n\t}\n\tasync removeObsoleteBases(state, candidates) {\n\t\tif (candidates.size === 0) return;\n\t\tconst referenced = /* @__PURE__ */ new Set();\n\t\tfor (const [path, textBase] of Object.entries(state.textBases)) if (textBase !== void 0 && state.files[path] !== void 0) referenced.add(state.files[path]);\n\t\tfor (const hash of candidates) if (!referenced.has(hash)) await rm(this.basePath(hash), { force: true });\n\t}\n\tasync removeOrphanBases(referencedHashes) {\n\t\tconst referencedPaths = new Set([...referencedHashes].map((hash) => this.basePath(hash)));\n\t\tfor (const path of await listFiles(this.basesDirectory)) if (!referencedPaths.has(path)) await rm(path, { force: true });\n\t}\n};\n// src/node/serve.ts\nasync function startServe(directory = process.cwd(), options = {}) {\n\tconst root = resolve(directory);\n\tconst settings = await readProjectSettings(root);\n\tconst session = await getServerSession(settings.serverName);\n\tif (!session) throw new Error(`No login is stored for ${settings.serverName}. Run: leafrelay login ${settings.serverName}`);\n\tconst cookie = options.cookie || process.env.LEAFRELAY_COOKIE || session.identity.cookies;\n\tconst remote = options.remote ?? new RemoteProject(session.url || settings.serverUrl, settings.projectId, cookie);\n\tawait remote.connect();\n\tconst configuredPatterns = settings.localReplica.settings[\"ignore-patterns\"];\n\tconst ignore = createIgnoreMatcher(configuredPatterns);\n\tconst local = new NodeReplicaFileSystem(root, ignore);\n\tconst engine = new SyncEngine({\n\t\tprojectUri: settings.uri,\n\t\tlocal,\n\t\tremote,\n\t\tstateStore: new FileSyncStateStore(root, settings.uri),\n\t\tignore,\n\t\tonSyncError: options.onSyncError,\n\t\tlog: options.log ?? log,\n\t\tonConflict: options.onConflict ?? ((path, reason) => {\n\t\t\t(options.log ?? log)(`Conflict paused for ${path}: ${reason}`);\n\t\t})\n\t});\n\ttry {\n\t\tawait engine.start();\n\t} catch (error) {\n\t\tremote.disconnect();\n\t\tthrow error;\n\t}\n\t(options.log ?? log)(`LeafRelay is serving ${root} (${settings.projectName}).`);\n\treturn {\n\t\troot,\n\t\tserverName: settings.serverName,\n\t\tprojectId: settings.projectId,\n\t\tprojectName: settings.projectName,\n\t\tsyncError: () => engine.syncError,\n\t\tconflicts: () => engine.getConflicts(),\n\t\tresolveConflict: (path, winner) => engine.resolveConflict(path, winner),\n\t\tretry: (path) => engine.retry(path),\n\t\tstop: async () => {\n\t\t\tawait engine.stop();\n\t\t\tremote.disconnect();\n\t\t}\n\t};\n}\nexport { BaseAPI, DEFAULT_IGNORE_PATTERNS, ExtendedBaseAPI, FileSyncStateStore, FolderKeys, HttpRequestScheduler, NodeReplicaFileSystem, OverleafRealtimeSocket, RemoteProject, SYNC_STATE_SCHEMA_VERSION, SocketIOAPI, SyncEngine, configPath, createIgnoreMatcher, createSyncState, encodeTextBase, error, getServerSession, log, mergeText, normalizeServerUrl, overleafSocketProtocol, readConfig, readProjectSettings, readTextBase, removeKnownServer, removeServerSession, removeSyncCheckpoint, saveKnownServer, saveServerSession, serverKey, setLogSink, sha256, sharedHttpRequestScheduler, startServe, updateSyncCheckpoint, warn, writeConfig };\n\n//# sourceMappingURL=index.js.map"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,eAAe;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;AACA,SAAS,aAAa,QAAQ;CAC7B,MAAM,OAAO,aAAa,QAAQ,OAAO,QAAQ,MAAM;CACvD,MAAM,KAAK,OAAO,MAAM;CACxB,IAAI;CACJ,QAAQ,OAAO,MAAf;EACC,KAAK;GACJ,OAAO,KAAK,UAAU;IACrB,MAAM,OAAO;IACb,MAAM,OAAO,QAAQ,CAAC;GACvB,CAAC;GACD;EACD,KAAK;GACJ,OAAO,GAAG,OAAO,SAAS,KAAK,OAAO,MAAM,SAAS,IAAI,KAAK,UAAU,OAAO,IAAI,MAAM;GACzF;EACD,KAAK;GACJ,OAAO,OAAO,OAAO,QAAQ,EAAE;GAC/B;EACD,KAAK,QAAQ,OAAO,KAAK,UAAU,OAAO,IAAI;CAC/C;CACA,MAAM,SAAS;EACd,OAAO,IAAI;EACX,GAAG,KAAK,OAAO,QAAQ,SAAS,MAAM;EACtC,OAAO,YAAY;CACpB;CACA,IAAI,SAAS,KAAK,GAAG,OAAO,KAAK,IAAI;CACrC,OAAO,OAAO,KAAK,GAAG;AACvB;AACA,SAAS,aAAa,OAAO;CAC5B,MAAM,QAAQ,MAAM,MAAM,6CAA6C;CACvE,IAAI,CAAC,OAAO,OAAO,CAAC;CACpB,MAAM,SAAS;EACd,MAAM,aAAa,OAAO,MAAM,EAAE;EAClC,UAAU,MAAM,MAAM;CACvB;CACA,IAAI,MAAM,IAAI;EACb,OAAO,KAAK,MAAM;EAClB,OAAO,MAAM,MAAM,KAAK,SAAS;CAClC;CACA,MAAM,OAAO,MAAM,MAAM;CACzB,QAAQ,OAAO,MAAf;EACC,KAAK,SAAS;GACb,MAAM,QAAQ,KAAK,MAAM,IAAI;GA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;CACD,CAAC;CACD,IAAI;EACH,MAAM,OAAO,MAAM;CACpB,SAAS,OAAO;EACf,OAAO,WAAW;EAClB,MAAM;CACP;CACA,CAAC,QAAQ,OAAO,IAAA,CAAK,wBAAwB,KAAK,IAAI,SAAS,YAAY,GAAG;CAC9E,OAAO;EACN;EACA,YAAY,SAAS;EACrB,WAAW,SAAS;EACpB,aAAa,SAAS;EACtB,iBAAiB,OAAO;EACxB,iBAAiB,OAAO,aAAa;EACrC,kBAAkB,MAAM,WAAW,OAAO,gBAAgB,MAAM,MAAM;EACtE,QAAQ,SAAS,OAAO,MAAM,IAAI;EAClC,MAAM,YAAY;GACjB,MAAM,OAAO,KAAK;GAClB,OAAO,WAAW;EACnB;CACD;AACD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
type ReplicaState = 'starting' | 'syncing' | 'active' | 'paused' | 'stopping' | 'error';
|
|
2
2
|
interface ReplicaStatus {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
state: ReplicaState;
|
|
4
|
+
message?: string;
|
|
5
5
|
}
|
|
6
6
|
interface ReplicaAttachResult {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
replicaId: string;
|
|
8
|
+
root: string;
|
|
9
|
+
serverName: string;
|
|
10
|
+
projectId: string;
|
|
11
|
+
projectName: string;
|
|
12
|
+
shared: boolean;
|
|
13
|
+
status: ReplicaStatus;
|
|
14
|
+
conflicts: string[];
|
|
15
15
|
}
|
|
16
|
-
|
|
17
16
|
interface RunningServe {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
readonly replica: ReplicaAttachResult;
|
|
18
|
+
stop(): Promise<void>;
|
|
20
19
|
}
|
|
21
|
-
declare function startServe(directory?: string): Promise<RunningServe>;
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
export declare function startServe(directory?: string): Promise<RunningServe>;
|
|
21
|
+
export type { RunningServe };
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|