diff --git a/greenhouse/.dockerignore b/greenhouse/.dockerignore new file mode 100644 index 0000000..7448b49 --- /dev/null +++ b/greenhouse/.dockerignore @@ -0,0 +1,3 @@ +**/__pycache__ +*.pyc +.git diff --git a/greenhouse/.gitignore b/greenhouse/.gitignore new file mode 100644 index 0000000..93fcd87 --- /dev/null +++ b/greenhouse/.gitignore @@ -0,0 +1,2 @@ +**/__pycache__/ +*.pyc diff --git a/greenhouse/.goctf-compose b/greenhouse/.goctf-compose new file mode 100644 index 0000000..e69de29 diff --git a/greenhouse/Dockerfile b/greenhouse/Dockerfile new file mode 100644 index 0000000..f1d29ed --- /dev/null +++ b/greenhouse/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.12-slim +WORKDIR /greenhouse +COPY native/greenhouse-console /greenhouse/greenhouse-console +COPY app/ /greenhouse/app/ +COPY frontend/ /greenhouse/frontend/ +COPY start.sh /greenhouse/start.sh +RUN chmod +x /greenhouse/greenhouse-console /greenhouse/start.sh && mkdir -p /data && useradd -m -u 10001 greenhouse && chown greenhouse:greenhouse /data +USER greenhouse +ENV GREENHOUSE_DATA=/data PORT=8080 +VOLUME ["/data"] +EXPOSE 8080 +CMD ["/greenhouse/start.sh"] diff --git a/greenhouse/app/server.py b/greenhouse/app/server.py new file mode 100644 index 0000000..9217004 --- /dev/null +++ b/greenhouse/app/server.py @@ -0,0 +1,299 @@ +import hashlib +import json +import mimetypes +import os +import re +import secrets +import socket +import sqlite3 +import threading +import time +from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer +from pathlib import Path +from urllib.parse import parse_qs, urlsplit + +ROOT = Path(__file__).resolve().parent.parent +DATA = Path(os.environ.get("GREENHOUSE_DATA", "/data")) +DATA.mkdir(parents=True, exist_ok=True) +DB = DATA / "greenhouse.sqlite3" +PUBLIC_ID = "public" +PUBLIC_TOKEN = "visitor" +CONSOLE_SOCKET = DATA / "console.sock" +CONSOLE_SESSIONS = {} +CONSOLE_LOCK = threading.Lock() +CONSOLE_IDLE_SECONDS = 300 +CONSOLE_LIMIT = 64 + + +class ConsoleSession: + def __init__(self): + self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + try: + self.socket.settimeout(4) + self.socket.connect(str(CONSOLE_SOCKET)) + self.stream = self.socket.makefile("rwb", buffering=0) + self.lock = threading.Lock() + self.last_used = time.monotonic() + self.closed = False + self.banner = [self.read_line(), self.read_line()] + except Exception: + if hasattr(self, "stream"): + self.stream.close() + self.socket.close() + raise + + def read_line(self): + line = self.stream.readline(65537) + if not line or len(line) > 65536 or not line.endswith(b"\n"): + raise ConnectionError("specimen console disconnected") + return line.decode("utf-8", errors="replace").rstrip("\r\n") + + def command(self, line): + with self.lock: + if self.closed: + raise ConnectionError("operator session closed") + self.last_used = time.monotonic() + self.stream.write((line + "\n").encode()) + reply = self.read_line() + self.last_used = time.monotonic() + return reply + + def close(self): + with self.lock: + if self.closed: + return + self.closed = True + try: + self.stream.close() + finally: + self.socket.close() + + +def prune_consoles(): + now = time.monotonic() + for session_id, session in list(CONSOLE_SESSIONS.items()): + if now - session.last_used > CONSOLE_IDLE_SECONDS: + CONSOLE_SESSIONS.pop(session_id, None) + session.close() + + +def connection(): + db = sqlite3.connect(DB, timeout=10) + db.row_factory = sqlite3.Row + db.execute("PRAGMA journal_mode=WAL") + db.execute("""CREATE TABLE IF NOT EXISTS plots ( + id TEXT PRIMARY KEY, token TEXT NOT NULL, name TEXT NOT NULL, + cultivar TEXT NOT NULL, note TEXT NOT NULL, archive TEXT NOT NULL, + created INTEGER DEFAULT (unixepoch()))""") + db.execute("""CREATE TABLE IF NOT EXISTS telemetry ( + id INTEGER PRIMARY KEY, plot TEXT NOT NULL, kind TEXT NOT NULL, + value TEXT NOT NULL, created INTEGER DEFAULT (unixepoch()))""") + db.execute("INSERT OR IGNORE INTO plots(id,token,name,cultivar,note,archive) VALUES (?,?,?,?,?,?)", + (PUBLIC_ID, PUBLIC_TOKEN, "Публичный купол", "Helianthus orbitalis", + "Добро пожаловать на станцию ОРБИТА.КВАНТУМ", "Калибровка открытого контура")) + db.commit() + return db + + +def row_public(row): + return {"id": row["id"], "name": row["name"], "cultivar": row["cultivar"], + "created": row["created"]} + + +def mask(id_, n): + out = [] + counter = 0 + while len(out) < n: + out.extend(hashlib.sha256(f"orbita-spectrum:{id_}:{counter}".encode()).digest()) + counter += 1 + return out[:n] + + +class Handler(BaseHTTPRequestHandler): + server_version = "OrbitaOrangery/2126" + + def log_message(self, fmt, *args): + print("%s %s" % (self.address_string(), fmt % args), flush=True) + + def reply(self, code, payload): + body = json.dumps(payload, ensure_ascii=False, separators=(",", ":")).encode() + self.send_response(code) + self.send_header("Content-Type", "application/json; charset=utf-8") + self.send_header("Cache-Control", "no-store") + self.send_header("Content-Length", str(len(body))) + self.end_headers() + self.wfile.write(body) + + def body(self): + length = int(self.headers.get("Content-Length", "0")) + if length > 8192 or length < 0: + raise ValueError("payload too large") + return json.loads(self.rfile.read(length)) + + def token(self, query): + return self.headers.get("X-Greenhouse-Key", "") or query.get("key", [""])[0] + + def do_GET(self): + parts = urlsplit(self.path) + path = parts.path + q = parse_qs(parts.query, keep_blank_values=True) + if path == "/api/status": + return self.reply(200, {"station": "ОРБИТА.КВАНТУМ", "module": "ОРАНЖЕРЕЯ", + "year": 2126, "oxygen": 98.7, "temperature": 23.4, + "state": "nominal"}) + if path.startswith("/api/"): + return self.get_api(path, q) + relative = path.lstrip("/") or "index.html" + if relative.startswith("frontend/"): + relative = relative.removeprefix("frontend/") + frontend = ROOT / "frontend" + target = (frontend / relative).resolve() + if not target.is_relative_to(frontend) or not target.is_file(): + self.send_error(404) + return + content_type = mimetypes.guess_type(target.name)[0] or "application/octet-stream" + if target.suffix == ".js": + content_type = "text/javascript" + content = target.read_bytes() + self.send_response(200) + self.send_header("Content-Type", content_type + ("; charset=utf-8" if content_type.startswith("text/") or content_type in {"image/svg+xml", "application/json"} else "")) + self.send_header("Content-Length", str(len(content))) + self.end_headers() + self.wfile.write(content) + + def get_api(self, path, q): + with connection() as db: + if path == "/api/plots": + rows = db.execute("SELECT * FROM plots ORDER BY created DESC LIMIT 100").fetchall() + return self.reply(200, {"plots": [row_public(r) for r in rows]}) + if path.startswith("/api/plots/"): + id_ = path[len("/api/plots/"):] + row = db.execute("SELECT * FROM plots WHERE id=?", (id_,)).fetchone() + if row is None: + return self.reply(404, {"error": "unknown plot"}) + if self.token(q) != row["token"]: + return self.reply(403, {"error": "capability required"}) + return self.reply(200, {**row_public(row), "note": row["note"]}) + if path == "/api/archive": + id_ = q.get("plot", [""])[0] + row = db.execute("SELECT * FROM plots WHERE id=?", (id_,)).fetchone() + if row is None: + return self.reply(404, {"error": "unknown plot"}) + if self.token(q) != row["token"]: + return self.reply(403, {"error": "capability required"}) + return self.reply(200, {"plot": id_, "archive": row["archive"]}) + if path == "/api/telemetry": + id_ = q.get("plot", [""])[0] + rows = db.execute("SELECT kind,value,created FROM telemetry WHERE plot=? ORDER BY id DESC LIMIT 40", (id_,)).fetchall() + return self.reply(200, {"plot": id_, "telemetry": [dict(r) for r in rows]}) + if path == "/api/projection": + target = q.get("target", [PUBLIC_ID])[0] + anchor = target.split("#", 1)[0] + anchor_row = db.execute("SELECT * FROM plots WHERE id=?", (anchor,)).fetchone() + if anchor_row is None or self.token(q) != anchor_row["token"]: + return self.reply(403, {"error": "lens capability required"}) + focus = target.rsplit("#", 1)[-1] + row = db.execute("SELECT * FROM plots WHERE id=?", (focus,)).fetchone() + if row is None: + return self.reply(404, {"error": "no focus"}) + return self.reply(200, {"anchor": anchor, "focus": focus, + "projection": {**row_public(row), "biometric_note": row["note"]}}) + if path == "/api/spectrum": + id_ = q.get("plot", [""])[0] + row = db.execute("SELECT archive FROM plots WHERE id=?", (id_,)).fetchone() + if row is None: + return self.reply(404, {"error": "unknown plot"}) + raw = row["archive"].encode() + salt = mask(id_, len(raw)) + previous = 0 + samples = [] + for byte, offset in zip(raw, salt): + value = (byte + previous + offset) % 257 + samples.append(value) + previous = value + return self.reply(200, {"plot": id_, "field": 257, "phase": "orbita-spectrum", + "samples": samples}) + return self.reply(404, {"error": "unknown endpoint"}) + + def do_POST(self): + try: + payload = self.body() + if not isinstance(payload, dict): + raise ValueError("object expected") + if self.path == "/api/console/open": + with CONSOLE_LOCK: + prune_consoles() + if len(CONSOLE_SESSIONS) >= CONSOLE_LIMIT: + return self.reply(429, {"error": "operator channels busy"}) + try: + console = ConsoleSession() + except (OSError, ConnectionError) as exc: + return self.reply(503, {"error": f"specimen console unavailable: {exc}"}) + session_id = secrets.token_hex(16) + CONSOLE_SESSIONS[session_id] = console + return self.reply(201, {"session": session_id, "banner": console.banner}) + if self.path == "/api/console/command": + session_id = payload.get("session") + line = payload.get("command") + if not isinstance(session_id, str) or not re.fullmatch(r"[0-9a-f]{32}", session_id): + raise ValueError("invalid operator session") + if not isinstance(line, str) or not line.strip() or len(line) > 1024 or any(c in line for c in "\r\n\x00"): + raise ValueError("invalid console command") + with CONSOLE_LOCK: + console = CONSOLE_SESSIONS.get(session_id) + if console is None: + return self.reply(404, {"error": "operator session expired"}) + try: + result = console.command(line.strip()) + except (OSError, ConnectionError) as exc: + with CONSOLE_LOCK: + CONSOLE_SESSIONS.pop(session_id, None) + console.close() + return self.reply(502, {"error": f"specimen console disconnected: {exc}"}) + return self.reply(200, {"reply": result}) + if self.path == "/api/console/close": + session_id = payload.get("session") + if not isinstance(session_id, str) or not re.fullmatch(r"[0-9a-f]{32}", session_id): + raise ValueError("invalid operator session") + with CONSOLE_LOCK: + console = CONSOLE_SESSIONS.pop(session_id, None) + if console is not None: + console.close() + return self.reply(200, {"ok": True}) + if self.path == "/api/plots": + name = str(payload.get("name", ""))[:160] + cultivar = str(payload.get("cultivar", ""))[:160] + note = str(payload.get("note", ""))[:4000] + archive = str(payload.get("archive", ""))[:512] + if not name or not cultivar: + raise ValueError("name and cultivar required") + id_ = secrets.token_hex(8) + supplied = payload.get("key") + token = str(supplied) if supplied is not None else secrets.token_hex(16) + if not re.fullmatch(r"[0-9a-f]{32}", token): + raise ValueError("invalid capability") + with connection() as db: + db.execute("INSERT INTO plots(id,token,name,cultivar,note,archive) VALUES (?,?,?,?,?,?)", + (id_, token, name, cultivar, note, archive)) + db.commit() + return self.reply(201, {"id": id_, "key": token}) + if self.path == "/api/telemetry": + id_ = str(payload.get("plot", "")) + kind = str(payload.get("kind", ""))[:32] + value = str(payload.get("value", ""))[:128] + if not id_ or not kind: + raise ValueError("invalid telemetry") + with connection() as db: + if not db.execute("SELECT 1 FROM plots WHERE id=?", (id_,)).fetchone(): + return self.reply(404, {"error": "unknown plot"}) + db.execute("INSERT INTO telemetry(plot,kind,value) VALUES (?,?,?)", (id_, kind, value)) + db.commit() + return self.reply(201, {"ok": True}) + return self.reply(404, {"error": "unknown endpoint"}) + except (ValueError, json.JSONDecodeError) as exc: + return self.reply(400, {"error": str(exc)}) + + +if __name__ == "__main__": + connection().close() + ThreadingHTTPServer(("0.0.0.0", int(os.environ.get("PORT", "8080"))), Handler).serve_forever() diff --git a/greenhouse/compose.yml b/greenhouse/compose.yml new file mode 100644 index 0000000..951bc8c --- /dev/null +++ b/greenhouse/compose.yml @@ -0,0 +1,15 @@ +name: greenhouse + +services: + greenhouse: + platform: linux/amd64 + build: . + restart: unless-stopped + ports: + - "8080:8080" + volumes: + - greenhouse_data:/data + pids_limit: 256 + mem_limit: 512m +volumes: + greenhouse_data: diff --git a/greenhouse/frontend/app.js b/greenhouse/frontend/app.js new file mode 100644 index 0000000..1c3e5f6 --- /dev/null +++ b/greenhouse/frontend/app.js @@ -0,0 +1,228 @@ +'use strict'; +(() => { + const $ = selector => document.querySelector(selector); + const state = { plots: [], selected: null, detail: null, selectionVersion: 0, listLoaded: false }; + const keyStorage = 'greenhouse.plot-keys.v1'; + let plotKeys = Object.create(null); + try { const saved = JSON.parse(localStorage.getItem(keyStorage) || '{}'); if (saved && typeof saved === 'object' && !Array.isArray(saved)) Object.assign(plotKeys, saved); } catch {} + const keyFor = id => String(id) === 'public' ? 'visitor' : plotKeys[String(id)]; + function saveKey(id, key) { + plotKeys[String(id)] = key; + try { localStorage.setItem(keyStorage, JSON.stringify(plotKeys)); return true; } catch { return false; } + } + const labels = { temperature: 'Температура', humidity: 'Влажность', oxygen: 'Кислород', biometrics: 'Биометрия', co2: 'Углекислый газ', light: 'Освещённость', ph: 'Кислотность' }; + const text = value => value == null ? '—' : typeof value === 'object' ? JSON.stringify(value, null, 2) : String(value); + const node = (tag, className, content) => { const el = document.createElement(tag); if (className) el.className = className; if (content != null) el.textContent = text(content); return el; }; + const idOf = plot => plot && typeof plot === 'object' ? plot.id ?? plot.plot_id : plot; + const unwrap = (data, key) => data && typeof data === 'object' ? data[key] ?? data.data ?? data : data; + function collection(data, keys) { + if (Array.isArray(data)) return data; + for (const key of [...keys, 'items', 'data']) { + if (Array.isArray(data?.[key])) return data[key]; + if (data?.[key] && typeof data[key] === 'object') return collection(data[key], keys); + } + return data == null ? [] : [data]; + } + async function api(path, payload, capability) { + const controller = new AbortController(); + const timer = setTimeout(() => controller.abort(), 15000); + try { + const response = await fetch(`/api${path}`, { method: payload === undefined ? 'GET' : 'POST', headers: { Accept: 'application/json', ...(capability ? { 'X-Greenhouse-Key': capability } : {}), ...(payload === undefined ? {} : { 'Content-Type': 'application/json' }) }, ...(payload === undefined ? {} : { body: JSON.stringify(payload) }), signal: controller.signal, cache: 'no-store' }); + const raw = await response.text(); + let data; + try { data = raw ? JSON.parse(raw) : null; } catch { if (response.ok) throw new Error('Сервис вернул некорректный JSON.'); } + if (!response.ok) throw new Error(`Ошибка ${response.status}: ${text(data?.error ?? data?.message ?? response.statusText).slice(0, 240)}`); + return data; + } catch (error) { + if (error.name === 'AbortError') throw new Error('Станция не ответила за 15 секунд. Повторите запрос.'); + if (error instanceof TypeError) throw new Error('Нет связи с API. Проверьте подключение к станции.'); + throw error; + } finally { clearTimeout(timer); } + } + let toastTimer; + function toast(message) { $('#toast').textContent = message; $('#toast').hidden = false; clearTimeout(toastTimer); toastTimer = setTimeout(() => { $('#toast').hidden = true; }, 5000); } + function empty(target, message, error = false) { target.replaceChildren(node('p', error ? 'inline-error' : 'empty', message)); } + function renderPlots() { + const query = $('#plot-search').value.trim().toLocaleLowerCase('ru'); + const filtered = state.plots.filter(plot => `${text(plot.name)} ${text(plot.cultivar)} ${text(idOf(plot))}`.toLocaleLowerCase('ru').includes(query)); + const target = $('#plot-list'); target.replaceChildren(); + if (!filtered.length) return empty(target, query ? 'Участки не найдены. Попробуйте другой запрос.' : 'Здесь пока нет участков. Создайте первый, чтобы начать наблюдения.'); + for (const plot of filtered) { + const id = idOf(plot); + const button = node('button', 'plot-card'); button.type = 'button'; button.setAttribute('aria-pressed', String(String(id) === String(state.selected))); button.setAttribute('aria-controls', 'plot-detail'); + const icon = node('span', 'plant-icon', '•'); icon.setAttribute('aria-hidden', 'true'); + const copy = node('span', 'plot-card-copy'); copy.append(node('strong', '', plot.name ?? `Участок ${text(id)}`), node('small', '', plot.cultivar ?? 'Культура не указана')); + button.append(icon, copy, node('span', 'arrow', '↗')); + if (id == null) { button.disabled = true; button.title = 'API не передал идентификатор участка'; } + else button.addEventListener('click', () => selectPlot(id)); + target.append(button); + } + } + function renderDetail(plot) { + const target = $('#plot-detail'); target.replaceChildren(); + const top = node('div', 'detail-top'); top.append(node('span', 'eyebrow', 'Паспорт'), node('span', 'pill', `ID / ${text(idOf(plot) ?? state.selected)}`)); + target.append(top, node('h3', '', plot.name ?? 'Участок')); + const dl = node('dl'); + for (const [label, value] of [['Культура', plot.cultivar], ['Заметка', plot.note ?? 'Заметок пока нет.']]) dl.append(node('dt', '', label), node('dd', '', value)); + target.append(dl); + } + function timestamp(value) { if (value == null) return ''; const date = new Date(typeof value === 'number' && value < 1e12 ? value * 1000 : value); return Number.isNaN(date.getTime()) ? text(value) : date.toLocaleString('ru-RU', { dateStyle: 'short', timeStyle: 'short' }); } + function renderRecords(target, data, archive) { + if (archive && typeof data?.archive === 'string') { + target.replaceChildren(); + if (data.archive) target.append(node('pre', 'raw-data', data.archive)); + else empty(target, 'Архив этого участка пока пуст.'); + return; + } + const rows = collection(data, archive ? ['archive', 'records', 'entries'] : ['telemetry', 'records', 'readings']); + target.replaceChildren(); + if (!rows.length) return empty(target, archive ? 'Архив этого участка пока пуст.' : 'Показаний пока нет. Добавьте первое наблюдение.'); + for (const row of rows) { + if (row == null || typeof row !== 'object' || (!('kind' in row) && !('value' in row) && !('message' in row) && !('note' in row))) { target.append(node('pre', 'raw-data', row)); continue; } + const item = node('div', 'record'), copy = node('div'); + copy.append(node('strong', '', labels[row.kind] ?? row.kind ?? row.title ?? 'Наблюдение')); + const date = timestamp(row.timestamp ?? row.created_at ?? row.created ?? row.time); if (date) copy.append(node('small', '', date)); + item.append(copy, node('span', 'record-value', row.value ?? row.message ?? row.note)); target.append(item); + } + } + async function loadRecords(id, version, archive = false) { + const target = $(archive ? '#archive-content' : '#telemetry-content'); + if (archive && !keyFor(id)) { target.removeAttribute('aria-busy'); empty(target, 'Для чтения архива нужен ключ доступа к этому участку. В этом браузере ключ не сохранён.'); return; } + empty(target, 'Получаем данные станции…'); target.setAttribute('aria-busy', 'true'); + try { + const data = await api(`/${archive ? 'archive' : 'telemetry'}?plot=${encodeURIComponent(id)}`, undefined, archive ? keyFor(id) : undefined); + if (version !== state.selectionVersion) return; + renderRecords(target, data, archive); + } catch (error) { if (version === state.selectionVersion) empty(target, `${error.message} Нажмите «Обновить», чтобы повторить.`, true); } + finally { if (version === state.selectionVersion) target.removeAttribute('aria-busy'); } + } + async function selectPlot(id) { + state.selected = id; state.detail = null; + $('#selected-label').textContent = state.plots.find(plot => String(idOf(plot)) === String(id))?.name ?? `Участок ${id}`; + $('#key-form').hidden = Boolean(keyFor(id)); + const version = ++state.selectionVersion; + renderPlots(); $('#open-telemetry').disabled = false; + empty($('#plot-detail'), 'Загружаем паспорт участка…'); $('#plot-detail').setAttribute('aria-busy', 'true'); + const detailRequest = (async () => { + try { + if (!keyFor(id)) { + empty($('#plot-detail'), 'Нужен ключ доступа. Паспорт этого участка закрыт: создайте собственный участок или откройте его в браузере, где сохранён выданный ключ. Телеметрия доступна без ключа.'); + return; + } + const plot = unwrap(await api(`/plots/${encodeURIComponent(id)}`, undefined, keyFor(id)), 'plot'); + if (version !== state.selectionVersion) return; + if (!plot || typeof plot !== 'object' || Array.isArray(plot)) throw new Error('Сервис не вернул паспорт участка.'); + state.detail = plot; renderDetail(plot); $('#open-telemetry').disabled = false; + } catch (error) { if (version === state.selectionVersion) { empty($('#plot-detail'), `${error.message} Нажмите «Обновить», чтобы повторить.`, true); $('#key-form').hidden = String(id) === 'public'; } } + finally { if (version === state.selectionVersion) $('#plot-detail').removeAttribute('aria-busy'); } + })(); + await Promise.allSettled([detailRequest, loadRecords(id, version), loadRecords(id, version, true)]); + } + async function loadPlots() { + const data = await api('/plots'); + state.plots = collection(data, ['plots']).map(plot => typeof plot === 'object' && plot !== null ? plot : { id: plot }); state.listLoaded = true; + $('#plot-count').textContent = state.plots.length; $('#nav-count').textContent = String(state.plots.length).padStart(2, '0'); $('#metric-plots').textContent = state.plots.length; + renderPlots(); + } + async function loadStatus() { + try { + const data = await api('/status'); const status = data?.data ?? data; + const statusText = typeof status === 'string' ? status : status?.status ?? status?.state ?? (status?.ok === true ? 'ok' : 'На связи'); + $('#metric-status').textContent = ({ nominal: 'В норме', ok: 'В норме', healthy: 'В норме', online: 'На связи', degraded: 'Внимание', error: 'Ошибка', offline: 'Не в сети' })[statusText] ?? text(statusText); + $('#metric-oxygen').textContent = text(status?.oxygen ?? status?.o2 ?? status?.oxygen_regeneration); + $('#metric-temperature').textContent = status?.temperature == null ? '—' : `${text(status.temperature)} °C`; + $('#last-update').textContent = `Обновлено в ${new Date().toLocaleTimeString('ru-RU', { hour: '2-digit', minute: '2-digit' })}`; + } catch (error) { + $('#metric-status').textContent = 'Нет данных'; $('#metric-oxygen').textContent = '—'; $('#metric-temperature').textContent = '—'; + $('#last-update').textContent = 'Нет актуального ответа'; throw error; + } + } + let refreshing = false; + async function refresh() { + if (refreshing) return; refreshing = true; $('#refresh').disabled = true; $('#global-error').hidden = true; + const results = await Promise.allSettled([loadStatus(), loadPlots()]); + const failures = results.filter(result => result.status === 'rejected'); + if (failures.length) { + $('#global-error').textContent = `${failures.map(result => result.reason.message).filter((v, i, a) => a.indexOf(v) === i).join(' ')} Нажмите «Обновить», чтобы повторить.${state.listLoaded && results[1].status === 'rejected' ? ' В реестре показаны ранее загруженные данные.' : ''}`; $('#global-error').hidden = false; + if (!state.listLoaded) empty($('#plot-list'), 'Реестр недоступен. Повторите загрузку кнопкой «Обновить».', true); + } + if (state.selected != null) await selectPlot(state.selected); + else if (state.plots.some(plot => String(idOf(plot)) === 'public')) await selectPlot('public'); + refreshing = false; $('#refresh').disabled = false; + } + function openDialog(selector) { const dialog = $(selector); dialog.querySelector('.form-error').textContent = ''; dialog.showModal(); } + document.querySelectorAll('[data-close]').forEach(button => button.addEventListener('click', () => button.closest('dialog').close())); + document.querySelectorAll('dialog').forEach(dialog => dialog.addEventListener('cancel', event => { if (dialog.dataset.busy === 'true') event.preventDefault(); })); + $('#open-create').addEventListener('click', () => openDialog('#create-dialog')); + $('#open-telemetry').addEventListener('click', () => { if (state.selected == null) return; $('#telemetry-plot-name').textContent = `Участок: ${text(state.detail?.name ?? state.selected)}`; $('#telemetry-form').dataset.plot = state.selected; openDialog('#telemetry-dialog'); }); + async function submit(event, operation) { + event.preventDefault(); const form = event.currentTarget, dialog = form.closest('dialog'); + if (dialog.dataset.busy === 'true') return; + const payload = Object.fromEntries(new FormData(form)); + for (const key of Object.keys(payload)) payload[key] = payload[key].trim(); + const errorTarget = form.querySelector('.form-error'); errorTarget.textContent = ''; + if (Object.entries(payload).some(([key, value]) => key !== 'note' && !value)) { errorTarget.textContent = 'Заполните обязательные поля.'; return; } + dialog.dataset.busy = 'true'; form.setAttribute('aria-busy', 'true'); + const controls = [...form.querySelectorAll('button,input,textarea,select')]; controls.forEach(el => { el.disabled = true; }); + try { await operation(payload, form, dialog); } + catch (error) { errorTarget.textContent = error.message; } + finally { dialog.dataset.busy = 'false'; form.removeAttribute('aria-busy'); controls.forEach(el => { el.disabled = false; }); } + } + $('#create-form').addEventListener('submit', event => submit(event, async (payload, form, dialog) => { + const data = await api('/plots', payload); const id = idOf(unwrap(data, 'plot')); + + const created = unwrap(data, 'plot'); + const key = created?.key ?? data?.key; + const stored = id != null && typeof key === 'string' && key ? saveKey(id, key) : null; + dialog.close(); form.reset(); toast('Участок создан. Ключ доступа сохранён.'); + if (stored === false) { $('#global-error').textContent = 'Участок создан. Браузер запретил localStorage: ключ доступен только до перезагрузки этой страницы.'; $('#global-error').hidden = false; } + if (stored === null) { $('#global-error').textContent = 'Участок создан, но API не вернул ключ доступа. Паспорт и архив недоступны.'; $('#global-error').hidden = false; } + try { await loadPlots(); } catch (error) { $('#global-error').textContent = `Участок создан, но реестр не обновлён. ${error.message}`; $('#global-error').hidden = false; } + if (id != null) { $('#plot-search').value = ''; await selectPlot(id); showTerminal('plots', $('#terminal-launch')); } + else { $('#global-error').textContent = 'Участок создан, но API не вернул его ID. Выберите его в реестре или обновите список.'; $('#global-error').hidden = false; } + })); + $('#telemetry-form').addEventListener('submit', event => submit(event, async (payload, form, dialog) => { + const value = Number(payload.value); if (!Number.isFinite(value)) throw new Error('Введите конечное числовое значение.'); + const plot = state.plots.find(item => String(idOf(item)) === form.dataset.plot); + const id = plot ? idOf(plot) : form.dataset.plot; + await api('/telemetry', { plot: id, kind: payload.kind, value }); dialog.close(); form.reset(); toast('Показание сохранено.'); + if (String(state.selected) === String(id)) await Promise.allSettled([loadRecords(id, state.selectionVersion), loadRecords(id, state.selectionVersion, true)]); + })); + $('#plot-search').addEventListener('input', renderPlots); $('#refresh').addEventListener('click', refresh); + let terminalTrigger = null; + function showTerminal(panel, trigger) { + const terminal = $('#terminal'); + if (trigger && !terminal.contains(trigger)) terminalTrigger = trigger; + terminal.hidden = false; document.body.classList.add('terminal-open'); terminal.dispatchEvent(new Event('greenhouse:raise')); + document.querySelectorAll('[data-panel]').forEach(section => { section.hidden = section.dataset.panel !== panel; }); + document.querySelectorAll('[data-terminal]').forEach(button => { + const active = button.dataset.terminal === panel; + if (button.closest('.terminal-tabs')) button.setAttribute('aria-pressed', String(active)); + else { button.setAttribute('aria-expanded', String(active)); button.setAttribute('aria-controls', 'terminal'); } + }); + $('#terminal-title').textContent = { plots: 'Участки', telemetry: 'Телеметрия', archive: 'Архив наблюдений' }[panel]; + $('#terminal-title').focus({ preventScroll: true }); + } + function hideTerminal() { + $('#terminal').hidden = true; document.body.classList.remove('terminal-open'); + document.querySelectorAll('[data-terminal][aria-expanded]').forEach(button => button.setAttribute('aria-expanded', 'false')); + (terminalTrigger ?? $('#terminal-launch')).focus({ preventScroll: true }); + } + document.querySelectorAll('[data-terminal]').forEach(button => { + button.setAttribute('aria-controls', 'terminal'); + if (!button.closest('.terminal-tabs')) button.setAttribute('aria-expanded', 'false'); + button.addEventListener('click', () => showTerminal(button.dataset.terminal, button)); + }); + $('#terminal-close').addEventListener('click', hideTerminal); + document.addEventListener('keydown', event => { if (event.key === 'Escape' && !document.querySelector('dialog[open]') && !$('#terminal').hidden && !event.target.closest('#operator-console')) { event.preventDefault(); hideTerminal(); } }); + $('#key-form').addEventListener('submit', async event => { + event.preventDefault(); const key = $('#access-key').value.trim(); if (!key || state.selected == null) return; + const stored = saveKey(state.selected, key); $('#access-key').value = ''; + if (!stored) toast('Хранилище браузера недоступно: ключ сохранён только на время сеанса.'); + await selectPlot(state.selected); + }); + setTimeout(() => { + if (!$('#space').dataset.ready) { $('#scene-loading').hidden = true; $('#scene-fallback').hidden = false; } + }, 20000); + refresh(); +})(); diff --git a/greenhouse/frontend/console.js b/greenhouse/frontend/console.js new file mode 100644 index 0000000..8c909b2 --- /dev/null +++ b/greenhouse/frontend/console.js @@ -0,0 +1,136 @@ +'use strict'; +(() => { + const $ = selector => document.querySelector(selector); + const pane = $('#operator-console'), output = $('#console-output'), input = $('#console-input'); + let session = null, busy = false, unloading = false; + const history = []; + let historyIndex = 0, draft = ''; + const stringify = value => typeof value === 'string' ? value : JSON.stringify(value) ?? ''; + + function lines(value, className = '') { + const nearBottom = output.scrollHeight - output.scrollTop - output.clientHeight < 45; + const values = Array.isArray(value) ? value : [value]; + const fragment = document.createDocumentFragment(); + for (const item of values) for (const line of stringify(item).slice(0, 131072).split(/\r?\n/).slice(0, 500)) { + const row = document.createElement('div'); row.className = `console-line ${className}`; + + row.textContent = line.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, '').slice(0, 8192) || ' '; + fragment.append(row); + } + output.append(fragment); + while (output.childElementCount > 1000) output.firstElementChild.remove(); + if (nearBottom) output.scrollTop = output.scrollHeight; + } + function update(message) { + $('#console-state').textContent = message ?? (session ? 'Подключено' : 'Нет сеанса'); + $('#console-indicator').classList.toggle('connected', session !== null); + input.disabled = busy || session === null; + $('#console-send').disabled = busy || session === null; + $('#console-reconnect').disabled = busy; + $('#console-disconnect').disabled = busy || session === null; + $('#console-reconnect').textContent = session ? 'Переподключить' : 'Подключить'; + pane.setAttribute('aria-busy', String(busy)); + } + function error(message) { + $('#console-error').textContent = message; $('#console-error').hidden = !message; + } + async function request(action, payload) { + const controller = new AbortController(); const timeout = setTimeout(() => controller.abort(), 15000); + try { + const response = await fetch(`/api/console/${action}`, { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'application/json' }, body: JSON.stringify(payload), signal: controller.signal, cache: 'no-store' }); + let data; try { data = await response.json(); } catch { const problem = new Error(`Некорректный ответ консоли (HTTP ${response.status}).`); problem.status = response.status; throw problem; } + if (!response.ok) { + const problem = new Error(`HTTP ${response.status}: ${stringify(data?.error ?? data?.message ?? 'запрос отклонён').slice(0, 300)}`); + problem.status = response.status; throw problem; + } + return data; + } catch (problem) { + if (problem.name === 'AbortError') throw new Error('Консоль не ответила за 15 секунд.'); + if (problem instanceof TypeError) throw new Error('Нет связи с консолью. Проверьте соединение.'); + throw problem; + } finally { clearTimeout(timeout); } + } + async function closeSession() { + if (session === null) return; + try { + const result = await request('close', { session }); + if (result?.ok !== true) throw new Error('Сервер не подтвердил закрытие сеанса.'); + } catch (problem) { + if (![404, 410].includes(problem.status)) throw problem; + + } + session = null; lines('Сеанс закрыт.', 'console-system'); + } + async function connect() { + if (busy || unloading) return; + busy = true; error(''); update('Подключение…'); + try { + await closeSession(); + const data = await request('open', {}); + if (data?.session == null || !['string', 'number'].includes(typeof data.session) || String(data.session) === '') throw new Error('Сервер не выдал идентификатор сеанса.'); + session = data.session; + if (unloading) { release(); return; } + lines('Соединение установлено.', 'console-system'); + if (data.banner != null) lines(data.banner); + } catch (problem) { error(`${problem.message} Автоматического повтора не было.`); } + finally { busy = false; update(); if (session !== null && !pane.hidden) input.focus(); } + } + async function disconnect() { + if (busy || session === null) return; + busy = true; error(''); update('Отключение…'); + try { await closeSession(); } + catch (problem) { error(`${problem.message} Сеанс не подтверждён как закрытый; можно повторить отключение.`); } + finally { busy = false; update(); } + } + function show() { + document.body.classList.add('console-open'); + pane.hidden = false; pane.dispatchEvent(new Event('greenhouse:raise')); $('#console-launch').setAttribute('aria-expanded', 'true'); + if (session !== null && !busy) input.focus(); else $('#console-title').focus(); + if (session === null && !busy) connect(); + } + function hide() { document.body.classList.remove('console-open'); pane.hidden = true; $('#console-launch').setAttribute('aria-expanded', 'false'); $('#console-launch').focus(); } + $('#console-launch').addEventListener('click', () => pane.hidden ? show() : hide()); + $('#console-hide').addEventListener('click', hide); + $('#console-reconnect').addEventListener('click', connect); + $('#console-disconnect').addEventListener('click', disconnect); + $('#console-clear').addEventListener('click', () => { output.replaceChildren(); if (!input.disabled) input.focus(); }); + $('#console-form').addEventListener('submit', async event => { + event.preventDefault(); const command = input.value; + if (busy || session === null || !command.trim()) return; + if (command.length > 1024) { error('Команда не должна превышать 1024 символа.'); return; } + const currentSession = session; + busy = true; error(''); update('Выполнение…'); lines(`> ${command}`, 'console-command'); + if (history.at(-1) !== command) { history.push(command); if (history.length > 100) history.shift(); } + historyIndex = history.length; draft = ''; input.value = ''; + try { + const result = await request('command', { session: currentSession, command }); + if (!result || !Object.hasOwn(result, 'reply')) throw new Error('Сервер не передал ответ команды.'); + lines(result.reply); + } catch (problem) { + if ([401, 403, 404, 410].includes(problem.status)) { session = null; error(`${problem.message} Сеанс недоступен. Нажмите «Подключить».`); } + else error(`${problem.message} Результат команды не подтверждён. Повторите её вручную только при необходимости.`); + lines('Ответ не получен.', 'console-system'); + } finally { busy = false; update(); if (session !== null && !pane.hidden) input.focus(); } + }); + input.addEventListener('keydown', event => { + if (event.isComposing) return; + if (event.key === 'ArrowUp' || event.key === 'ArrowDown') { + event.preventDefault(); + if (historyIndex === history.length) draft = input.value; + historyIndex = Math.max(0, Math.min(history.length, historyIndex + (event.key === 'ArrowUp' ? -1 : 1))); + input.value = historyIndex === history.length ? draft : history[historyIndex]; + input.setSelectionRange(input.value.length, input.value.length); + } + if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === 'l') { event.preventDefault(); output.replaceChildren(); } + }); + pane.addEventListener('keydown', event => { if (event.key === 'Escape') { event.stopPropagation(); hide(); } }); + function release() { + if (session === null) return; + const closing = session; session = null; + + fetch('/api/console/close', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ session: closing }), keepalive: true }).catch(() => {}); + } + addEventListener('pagehide', () => { unloading = true; release(); }); + addEventListener('pageshow', event => { if (event.persisted) { unloading = false; busy = false; update(); } }); + update(); +})(); diff --git a/greenhouse/frontend/fonts/DepartureMono-OFL.txt b/greenhouse/frontend/fonts/DepartureMono-OFL.txt new file mode 100644 index 0000000..de52476 --- /dev/null +++ b/greenhouse/frontend/fonts/DepartureMono-OFL.txt @@ -0,0 +1,93 @@ +Copyright 2022–2024 Helena Zhang (helenazhang.com). + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/greenhouse/frontend/fonts/DepartureMono-Regular.woff2 b/greenhouse/frontend/fonts/DepartureMono-Regular.woff2 new file mode 100644 index 0000000..b4a23dc Binary files /dev/null and b/greenhouse/frontend/fonts/DepartureMono-Regular.woff2 differ diff --git a/greenhouse/frontend/fonts/SOURCE.txt b/greenhouse/frontend/fonts/SOURCE.txt new file mode 100644 index 0000000..5e067ac --- /dev/null +++ b/greenhouse/frontend/fonts/SOURCE.txt @@ -0,0 +1,4 @@ +Departure Mono 1.500, unmodified WOFF2 from the official release. +Source: https://github.com/rektdeckard/departure-mono/releases/download/v1.500/DepartureMono-1.500.zip +License: SIL Open Font License 1.1; see DepartureMono-OFL.txt. +DepartureMono-Regular.woff2 SHA256 5b4fed1daa90708aa9c6ee1190abca9dc22164a1c1def0020386e46b61038cfb diff --git a/greenhouse/frontend/index.html b/greenhouse/frontend/index.html new file mode 100644 index 0000000..5793540 --- /dev/null +++ b/greenhouse/frontend/index.html @@ -0,0 +1,37 @@ + + + + +Оранжерея / Орбита.Квантум 2126 + + + + + + +
+ + +
Загрузка 3D-моделиИнструменты оператора доступны во время загрузки.
+ + +
СОСТОЯНИЕ ОРАНЖЕРЕИЗагрузка
O₂ / кислород—
T° / воздух—
Участки—
Нет данных
+
+ + + + + +
+
Регистрация участка

Новый участок

Название и культура обязательны. Ключ доступа сохранится в этом браузере.

+
Телеметрия

Запись телеметрии

+ + + diff --git a/greenhouse/frontend/scene.js b/greenhouse/frontend/scene.js new file mode 100644 index 0000000..a400a8d --- /dev/null +++ b/greenhouse/frontend/scene.js @@ -0,0 +1,554 @@ +import * as THREE from 'three'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +const canvas = document.querySelector('#space'); +const loading = document.querySelector('#scene-loading'); +const fallback = document.querySelector('#scene-fallback'); +const motionButton = document.querySelector('#motion-toggle'); +const reducedMotion = matchMedia('(prefers-reduced-motion: reduce)'); +let renderer; +try { + renderer = new THREE.WebGLRenderer({ canvas, antialias: false, alpha: false, powerPreference: 'high-performance' }); +} catch { + loading.hidden = true; + fallback.hidden = false; + document.querySelectorAll('.camera-controls button').forEach(button => { button.disabled = true; }); +} + +if (renderer) { + const boot = () => setTimeout(initialize, 100); + if (document.readyState === 'complete') boot(); + else window.addEventListener('load', boot, { once: true }); +} + +function initialize() { + const mobile = () => innerWidth < 701; + const gl = renderer.getContext(); + const debug = gl.getExtension('WEBGL_debug_renderer_info'); + const gpu = debug ? gl.getParameter(debug.UNMASKED_RENDERER_WEBGL) : ''; + const software = /swiftshader|llvmpipe|software|softpipe/i.test(gpu); + const pixelRatio = () => software ? .8 : Math.min(devicePixelRatio, mobile() ? 1.2 : 1.5); + renderer.setPixelRatio(pixelRatio()); + renderer.setSize(innerWidth, innerHeight, false); + renderer.outputColorSpace = THREE.SRGBColorSpace; + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1.18; + renderer.shadowMap.enabled = !software; + renderer.shadowMap.type = software ? THREE.PCFShadowMap : THREE.PCFSoftShadowMap; + renderer.shadowMap.autoUpdate = false; + const scene = new THREE.Scene(); + const camera = new THREE.PerspectiveCamera(mobile() ? 50 : 39, innerWidth / innerHeight, .1, 350); + const controls = new OrbitControls(camera, canvas); + controls.enablePan = true; + controls.screenSpacePanning = true; + controls.maxTargetRadius = 4; + controls.enableDamping = !reducedMotion.matches; + controls.dampingFactor = .065; + controls.minPolarAngle = .22; + controls.maxPolarAngle = Math.PI * .61; + controls.minDistance = 2.4; + controls.maxDistance = 48; + controls.rotateSpeed = .5; + controls.zoomSpeed = .65; + controls.target.set(0, .9, 0); + let paused = reducedMotion.matches; + let elapsed = 0; + let previous = 0; + let lastPaint = 0; + let paintCount = 0; + let gpuFence = null; + const frameInterval = 1000 / (software ? 24 : 30); + let frame = 0; + let interacting = false; + let hidden = document.hidden; + let contextLost = false; + const station = new THREE.Group(); scene.add(station); + station.rotation.y = -.2; + + let seed = 212607; + const random = () => { seed = (seed * 1664525 + 1013904223) >>> 0; return seed / 4294967296; }; + function material(color, metalness = .6, roughness = .4, emissive = 0, emissiveIntensity = 0) { + return software ? new THREE.MeshPhongMaterial({ color, shininess: (1 - roughness) * 50, specular: 0x40505a, emissive, emissiveIntensity }) : new THREE.MeshStandardMaterial({ color, metalness, roughness, emissive, emissiveIntensity }); + } + const titanium = material(0x799398, .8, .3); + const darkMetal = material(0x162b36, .8, .38); + const ceramic = material(0xa9bbb4, .5, .36); + const gold = material(0xb49a64, .72, .36); + const black = material(0x0a141c, .55, .52); + const mint = material(0x82ffcf, .2, .25, 0x67ffc1, 3); + const amber = material(0xffc473, .2, .3, 0xffa94f, 2.8); + const blue = material(0x97d9ff, .2, .25, 0x54baff, 2); + const mesh = (geo, mat, parent = station, position = [0, 0, 0]) => { + const object = new THREE.Mesh(geo, mat); object.position.set(...position); parent.add(object); + object.castShadow = true; object.receiveShadow = true; return object; + }; + const box = (size, mat, parent, position) => mesh(new THREE.BoxGeometry(...size), mat, parent, position); + const cylinder = (top, bottom, height, mat, parent, position, segments = 48) => mesh(new THREE.CylinderGeometry(top, bottom, height, segments), mat, parent, position); + function torus(radius, tube, mat, parent = station, y = 0, arc = Math.PI * 2) { + const object = mesh(new THREE.TorusGeometry(radius, tube, 6, 96, arc), mat, parent, [0, y, 0]); object.rotation.x = Math.PI / 2; return object; + } + function beam(start, end, thickness, mat, parent = station) { + const a = new THREE.Vector3(...start), b = new THREE.Vector3(...end), direction = b.clone().sub(a); + const object = mesh(new THREE.CylinderGeometry(thickness, thickness, direction.length(), 6), mat, parent); + object.position.copy(a.add(b).multiplyScalar(.5)); object.quaternion.setFromUnitVectors(new THREE.Vector3(0, 1, 0), direction.normalize()); return object; + } + function glowTexture() { + const c = document.createElement('canvas'); c.width = c.height = 128; + const ctx = c.getContext('2d'), gradient = ctx.createRadialGradient(64, 64, 0, 64, 64, 64); + gradient.addColorStop(0, 'rgba(255,255,255,1)'); gradient.addColorStop(.07, 'rgba(230,255,249,.85)'); gradient.addColorStop(.23, 'rgba(140,233,217,.22)'); gradient.addColorStop(1, 'rgba(90,170,190,0)'); + ctx.fillStyle = gradient; ctx.fillRect(0, 0, 128, 128); + return new THREE.CanvasTexture(c); + } + const glowMap = glowTexture(); + function glow(parent, position, color, size, opacity = .7) { + const object = new THREE.Sprite(new THREE.SpriteMaterial({ map: glowMap, color, transparent: true, opacity, blending: THREE.AdditiveBlending, depthWrite: false })); + object.position.set(...position); object.scale.setScalar(size); parent.add(object); return object; + } + + scene.add(new THREE.HemisphereLight(0x94cfdf, 0x1e3335, 1.5)); + const sun = new THREE.DirectionalLight(0xffe3ad, 4.8); sun.position.set(-8, 13, 7); sun.castShadow = true; + sun.shadow.mapSize.set(software || mobile() ? 512 : 1024, software || mobile() ? 512 : 1024); sun.shadow.camera.left = -10; sun.shadow.camera.right = 10; sun.shadow.camera.top = 10; sun.shadow.camera.bottom = -10; sun.shadow.camera.far = 55; sun.shadow.normalBias = .025; sun.shadow.bias = -.0002; scene.add(sun); + const rim = new THREE.DirectionalLight(0x60c7fa, 3.5); rim.position.set(6, 4, -9); scene.add(rim); + const underlight = new THREE.PointLight(0x31dfc6, 35, 18, 2); underlight.position.set(0, -3, 2); scene.add(underlight); + + const backgroundSeed = seed; + + const skyCanvas = document.createElement('canvas'); skyCanvas.width = 2048; skyCanvas.height = 1024; + const skyContext = skyCanvas.getContext('2d'); skyContext.scale(2, 2); skyContext.fillStyle = '#030914'; skyContext.fillRect(0, 0, 1024, 512); + for (let i = 0; i < 60; i++) { + const x = random() * 1024, y = 180 + Math.sin(x * .007) * 90 + random() * 100, r = 50 + random() * 170; + const gradient = skyContext.createRadialGradient(x, y, 0, x, y, r); + gradient.addColorStop(0, i % 3 ? 'rgba(20,66,70,.15)' : 'rgba(46,33,74,.12)'); gradient.addColorStop(1, 'rgba(0,0,0,0)'); + skyContext.fillStyle = gradient; skyContext.fillRect(x-r, y-r, r*2, r*2); + } + + skyContext.setTransform(1, 0, 0, 1, 0, 0); + for (let i = 0; i < 2800; i++) { + const x = random() * 2048, y = (Math.asin(random()*2-1)/Math.PI+.5) * 1024; + const radius = .45 + random()*.38, opacity = .25 + random()*.55; + skyContext.fillStyle = `rgba(193,210,226,${opacity})`; + skyContext.beginPath(); skyContext.arc(x,y,radius,0,Math.PI*2); skyContext.fill(); + if (i % 55 === 0) { + const halo=skyContext.createRadialGradient(x,y,0,x,y,4.5); + halo.addColorStop(0,'rgba(215,231,242,.72)'); halo.addColorStop(.22,'rgba(155,184,211,.17)'); halo.addColorStop(1,'rgba(130,160,190,0)'); + skyContext.fillStyle=halo;skyContext.fillRect(x-4.5,y-4.5,9,9); + } + } + const skyTexture = new THREE.CanvasTexture(skyCanvas); skyTexture.colorSpace = THREE.SRGBColorSpace; + skyTexture.magFilter = THREE.LinearFilter; skyTexture.minFilter = THREE.LinearMipmapLinearFilter; skyTexture.generateMipmaps = true; + const skyMaterial = new THREE.MeshBasicMaterial({ map: skyTexture, side: THREE.BackSide, depthWrite: false, toneMapped: false }); + const sky = mesh(new THREE.SphereGeometry(140, 32, 20), skyMaterial, scene); sky.castShadow = false; sky.receiveShadow = false; sky.renderOrder = -10; + + const planetCanvas=document.createElement('canvas');planetCanvas.width=1024;planetCanvas.height=512; + const pc=planetCanvas.getContext('2d');pc.fillStyle='#173a50';pc.fillRect(0,0,1024,512); + const elevationCanvas=document.createElement('canvas');elevationCanvas.width=1024;elevationCanvas.height=512; + const elevation=elevationCanvas.getContext('2d');elevation.fillStyle='#151515';elevation.fillRect(0,0,1024,512); + for(let i=0;i<26;i++){ + const cx=random()*1024,cy=50+random()*412,rx=30+random()*95,ry=18+random()*52,phase=random()*6.28; + const outline=new Path2D(); + for(let j=0;j<=54;j++){const a=j/54*Math.PI*2;const r=1+.2*Math.sin(a*3+phase)+.12*Math.cos(a*7-phase);const x=cx+Math.cos(a)*rx*r,y=cy+Math.sin(a)*ry*r;j?outline.lineTo(x,y):outline.moveTo(x,y);}outline.closePath(); + pc.strokeStyle='#355e64';pc.lineWidth=8;pc.stroke(outline); + const land=pc.createLinearGradient(cx-rx,cy-ry,cx+rx,cy+ry);land.addColorStop(0,'#748273');land.addColorStop(.5,'#465f55');land.addColorStop(1,'#263f40');pc.fillStyle=land;pc.fill(outline); + elevation.fillStyle='#929292';elevation.fill(outline); + for(let j=0;j<6;j++){pc.save();pc.clip(outline);pc.beginPath();pc.moveTo(cx-rx,cy+j*4-14);pc.bezierCurveTo(cx-rx*.4,cy-ry*.5+j*4,cx+rx*.3,cy+ry*.4+j*2,cx+rx,cy+j*3);pc.strokeStyle='rgba(183,179,151,.15)';pc.lineWidth=1.5;pc.stroke();pc.restore();} + } + const polar=pc.createLinearGradient(0,0,0,512);polar.addColorStop(0,'rgba(173,196,194,.8)');polar.addColorStop(.1,'rgba(173,196,194,0)');polar.addColorStop(.9,'rgba(173,196,194,0)');polar.addColorStop(1,'rgba(173,196,194,.65)');pc.fillStyle=polar;pc.fillRect(0,0,1024,512); + const planetTexture=new THREE.CanvasTexture(planetCanvas);planetTexture.colorSpace=THREE.SRGBColorSpace; + const reliefTexture=new THREE.CanvasTexture(elevationCanvas); + const planetMaterial=new THREE.MeshPhongMaterial({map:planetTexture,color:0xacc5ce,emissive:0x416071,emissiveMap:planetTexture,emissiveIntensity:.3,bumpMap:reliefTexture,bumpScale:.085,shininess:12,specular:0x294452}); + const planet=mesh(new THREE.SphereGeometry(17,48,32),planetMaterial,scene,[21,-15,-43]);planet.castShadow=false;planet.receiveShadow=false; + const cloudCanvas=document.createElement('canvas');cloudCanvas.width=1024;cloudCanvas.height=512; + const cc=cloudCanvas.getContext('2d'); + for(let i=0;i<230;i++){ + const x=random()*1024,y=random()*512,len=12+random()*100; + cc.beginPath();cc.moveTo(x,y);cc.bezierCurveTo(x+len*.3,y-15,x+len*.65,y+19,x+len,y-3); + cc.strokeStyle=`rgba(203,219,221,${.06+random()*.25})`;cc.lineWidth=1+random()*6;cc.lineCap='round';cc.stroke(); + } + const cloudTexture=new THREE.CanvasTexture(cloudCanvas);cloudTexture.colorSpace=THREE.SRGBColorSpace; + const clouds=mesh(new THREE.SphereGeometry(17.1,48,32),new THREE.MeshLambertMaterial({map:cloudTexture,transparent:true,opacity:.6,depthWrite:false}),scene,[21,-15,-43]);clouds.castShadow=false;clouds.receiveShadow=false; + const atmosphereMaterial = new THREE.ShaderMaterial({ transparent: true, side: THREE.BackSide, blending: THREE.AdditiveBlending, depthWrite: false, + vertexShader: `varying vec3 n;varying vec3 v;void main(){vec4 p=modelViewMatrix*vec4(position,1.);n=normalize(normalMatrix*normal);v=normalize(-p.xyz);gl_Position=projectionMatrix*p;}`, + fragmentShader: `varying vec3 n;varying vec3 v;void main(){float rim=pow(1.-abs(dot(normalize(n),normalize(v))),4.);gl_FragColor=vec4(.08,.46,.62,rim*.52);}` }); + const atmosphere = mesh(new THREE.SphereGeometry(17.22, 48, 32), atmosphereMaterial, scene, [21, -15, -43]); atmosphere.castShadow = false; + + seed = backgroundSeed; + for (let i=0;i<15688;i++) random(); + + cylinder(4.55, 4.08, .55, darkMetal, station, [0, -.25, 0]); + cylinder(4.58, 4.58, .14, ceramic, station, [0, .095, 0]); + cylinder(4.05, 3.45, .42, titanium, station, [0, -.73, 0]); + cylinder(2.75, 2.05, .55, darkMetal, station, [0, -1.15, 0]); + torus(4.48, .045, mint, station, -.13); torus(4.13, .06, gold, station, -.61); torus(3.5, .035, blue, station, -.92); + cylinder(4.33, 4.33, .08, black, station, [0, .23, 0]); + const flooring = material(0x617973, .4, .65); + cylinder(4.2, 4.2, .07, flooring, station, [0, .3, 0]); + torus(4.24, .035, mint, station, .34); + for (let i = 0; i < 64; i++) { + const angle = i / 64 * Math.PI * 2; + const rib = box([.12, .34, .17], i % 8 ? titanium : gold, station, [Math.cos(angle) * 4.35, -.37, Math.sin(angle) * 4.35]); rib.rotation.y = -angle; + if (i % 4 === 0) { const light = box([.25, .09, .065], i % 8 ? amber : mint, station, [Math.cos(angle) * 4.53, -.23, Math.sin(angle) * 4.53]); light.rotation.y = -angle + Math.PI / 2; } + } + for (let i = 0; i < 6; i++) { + const a = i * Math.PI / 3; + beam([Math.cos(a) * .8, .36, Math.sin(a) * .8], [Math.cos(a) * 4.1, .36, Math.sin(a) * 4.1], .026, ceramic); + const stripe = box([.045, .012, 3.1], mint, station, [Math.sin(a) * 2.5, .35, Math.cos(a) * 2.5]); stripe.rotation.y = a; + } + + const fans = []; + for (let i = 0; i < 3; i++) { + const a = i * Math.PI * 2 / 3 + .3, unit = new THREE.Group(); + unit.position.set(Math.cos(a) * 3.45, 1.3, Math.sin(a) * 3.45); unit.rotation.y = -a + Math.PI / 2; station.add(unit); + box([.52, .55, .15], darkMetal, unit); const housing = torus(.205, .03, ceramic, unit); housing.rotation.x = 0; housing.position.z = .09; + const rotor = new THREE.Group(); rotor.position.z = .105; unit.add(rotor); + for (let blade = 0; blade < 4; blade++) { const fin = box([.07, .19, .016], titanium, rotor, [0, .09, 0]); fin.rotation.z = blade * Math.PI / 2; fin.position.set(Math.sin(blade * Math.PI / 2) * .085, Math.cos(blade * Math.PI / 2) * .085, 0); } + fans.push(rotor); + beam([-.24, -.72, 0], [-.24, -.25, 0], .025, titanium, unit); beam([.24, -.72, 0], [.24, -.25, 0], .025, titanium, unit); + } + for (let i = 0; i < 6; i++) { + const a = i * Math.PI / 3 + .12, pipe = new THREE.Group(); pipe.rotation.y = a; station.add(pipe); + beam([1.4, .7, 0], [3.85, .7, 0], .025, darkMetal, pipe); + for (let j = 0; j < 6; j++) { beam([1.55 + j * .39, .69, 0], [1.55 + j * .39, .66, -.15], .012, titanium, pipe); } + beam([3.82, .37, 0], [3.82, 1.65, 0], .026, titanium, pipe); + box([.72, .075, .2], darkMetal, pipe, [3.45, 1.65, 0]); box([.61, .012, .14], mint, pipe, [3.45, 1.603, 0]); + for (let j = 0; j < 4; j++) box([.018, .6, .03], titanium, pipe, [2.05 + j * .25, .94, -.5]); + beam([2.02, 1.2, -.5], [2.85, 1.2, -.5], .012, ceramic, pipe); + } + + const bench = new THREE.Group(); bench.position.set(-1.05, 0, -.9); bench.rotation.y = -.35; station.add(bench); + box([1.05, .065, .7], darkMetal, bench, [0, 1.30, 0]); + for (const x of [-.45, .45]) for (const z of [-.28, .28]) box([.045, .94, .045], titanium, bench, [x, .81, z]); + box([.22, .035, .14], gold, bench, [.23, 1.36, -.13]); + box([.30, .02, .21], ceramic, bench, [-.21, 1.35, .07]); + const packageGroup = new THREE.Group(); packageGroup.position.set(-1.1, .64, -.78); packageGroup.rotation.y = -.35; station.add(packageGroup); + box([.68, .035, .52], ceramic, packageGroup, [0, -.02, 0]); + const cardboard = material(0x9d764b, .02, .86); + const labelCanvas = document.createElement('canvas'); labelCanvas.width = 512; labelCanvas.height = 256; + const lc = labelCanvas.getContext('2d'); lc.fillStyle = '#b49160'; lc.fillRect(0, 0, 512, 256); + lc.fillStyle = '#eadab5'; lc.fillRect(30, 35, 452, 178); lc.strokeStyle = '#705c42'; lc.lineWidth = 3; lc.strokeRect(30,35,452,178); + lc.fillStyle = '#302c25'; lc.font = 'bold 54px sans-serif'; lc.textAlign = 'center'; lc.fillText('ЧАК ЧАК', 256, 139); lc.font = '22px sans-serif'; lc.fillText('к чаю',256,181); + const labelTexture = new THREE.CanvasTexture(labelCanvas); labelTexture.colorSpace = THREE.SRGBColorSpace; + const labelMaterial = new THREE.MeshLambertMaterial({ map: labelTexture }); + box([.56, .04, .42], cardboard, packageGroup, [0, .02, 0]); + for (const x of [-.265, .265]) box([.03, .25, .42], cardboard, packageGroup, [x, .135, 0]); + for (const z of [-.195, .195]) box([.53, .25, .03], cardboard, packageGroup, [0, .135, z]); + mesh(new THREE.PlaneGeometry(.48, .18), labelMaterial, packageGroup, [0, .15, .212]); + const lid = new THREE.Group(); lid.position.set(0, .27, -.21); packageGroup.add(lid); + box([.58, .03, .44], cardboard, lid, [0, 0, .21]); + const topLabel = mesh(new THREE.PlaneGeometry(.53, .36), labelMaterial, lid, [0, .016, .21]); topLabel.rotation.x = -Math.PI / 2; + const bites = new THREE.InstancedMesh(new THREE.CylinderGeometry(.026,.024,.08,5),gold,18); const biteTransform = new THREE.Object3D(); + for(let i=0;i<18;i++){biteTransform.position.set((random()-.5)*.4,.095+random()*.07,(random()-.5)*.28);biteTransform.rotation.set(random()*Math.PI,random()*Math.PI,random()*Math.PI);biteTransform.updateMatrix();bites.setMatrixAt(i,biteTransform.matrix);}packageGroup.add(bites); + let packageOpen = false; + + const soilCanvas = document.createElement('canvas'); soilCanvas.width = soilCanvas.height = 128; const soilContext = soilCanvas.getContext('2d'); + soilContext.fillStyle = '#31271b'; soilContext.fillRect(0, 0, 128, 128); + for (let i = 0; i < 2000; i++) { const b = 25 + random() * 70; soilContext.fillStyle = `rgb(${b + 12},${b},${b * .65})`; soilContext.fillRect(random() * 128, random() * 128, 1 + random() * 2, 1 + random() * 2); } + const soilTexture = new THREE.CanvasTexture(soilCanvas); soilTexture.wrapS = soilTexture.wrapT = THREE.RepeatWrapping; soilTexture.repeat.set(2, 2); soilTexture.colorSpace = THREE.SRGBColorSpace; + const soil = (software ? new THREE.MeshLambertMaterial({ map: soilTexture }) : new THREE.MeshStandardMaterial({ map: soilTexture, roughness: 1 })); + const leafGeometry = new THREE.BufferGeometry(); + const leafVertices = [], leafIndices = []; + for (let i = 0; i <= 8; i++) { const t = i / 8, width = Math.pow(Math.sin(t * Math.PI), .85) * .27; for (const side of [-1, 0, 1]) leafVertices.push(side * width, t * .9, Math.sin(t * Math.PI) * .19 - t * t * .18 + (side === 0 ? .055 : 0)); } + for (let i = 0; i < 8; i++) for (let j = 0; j < 2; j++) { const a = i * 3 + j; leafIndices.push(a, a + 1, a + 3, a + 1, a + 4, a + 3); } + leafGeometry.setAttribute('position', new THREE.Float32BufferAttribute(leafVertices, 3)); leafGeometry.setIndex(leafIndices); leafGeometry.computeVertexNormals(); + const leafMaterials = [0x70b940, 0xa2c866, 0x358251, 0x509847].map(color => software ? new THREE.MeshLambertMaterial({ color, side: THREE.DoubleSide }) : new THREE.MeshStandardMaterial({ color, roughness: .52, metalness: .02, side: THREE.DoubleSide })); + const stemMat = material(0x5e8641, .02, .9); + const vegetation = []; + const fruitMaterials = [material(0xaf482b, .05, .6), material(0xe8a846, .05, .6)]; + function plant(parent, x, z, size, species) { + const plantGroup = new THREE.Group(); plantGroup.position.set(x, .62, z); plantGroup.scale.setScalar(size); parent.add(plantGroup); + cylinder(.024, .037, .9, stemMat, plantGroup, [0, .43, 0], 5); + for (let j = 0; j < 7; j++) { + const leaf = mesh(leafGeometry, leafMaterials[(j + species) % 4], plantGroup, [0, .18 + j * .093, 0]); + leaf.rotation.set(.55 + j * .08, j * 2.4 + species, -.25); leaf.scale.setScalar(1.05 - j * .055); + } + if (species % 3 === 0) for (let j = 0; j < 3; j++) { const a = j * 2.1; mesh(new THREE.SphereGeometry(.09, 8, 6), fruitMaterials[j % 2], plantGroup, [Math.cos(a) * .15, .62 + j * .07, Math.sin(a) * .15]); } + vegetation.push({ group: plantGroup, phase: random() * Math.PI * 2 }); + } + for (let bed = 0; bed < 6; bed++) { + const angle = bed * Math.PI / 3 + .11; + const bedGroup = new THREE.Group(); bedGroup.rotation.y = angle; station.add(bedGroup); + const shape = new THREE.Shape(); const start = .08, end = Math.PI / 3 - .12; + shape.absarc(0, 0, 3.77, start, end, false); shape.lineTo(Math.cos(end) * 1.35, Math.sin(end) * 1.35); shape.absarc(0, 0, 1.35, end, start, true); shape.closePath(); + const bedGeo = new THREE.ExtrudeGeometry(shape, { depth: .23, bevelEnabled: true, bevelSize: .035, bevelThickness: .025, bevelSegments: 1, steps: 1, curveSegments: 12 }); bedGeo.rotateX(-Math.PI / 2); + mesh(bedGeo, ceramic, bedGroup, [0, .35, 0]); + const soilGeo = new THREE.ShapeGeometry(shape, 12); soilGeo.rotateX(-Math.PI / 2); const ground = mesh(soilGeo, soil, bedGroup, [0, .618, 0]); ground.scale.set(.965, 1, .965); + for (let row = 0; row < 3; row++) for (let col = 0; col < 3 + row; col++) { + const a = start + .11 + col / (2 + row) * (end - start - .23), r = 1.8 + row * .75; + plant(bedGroup, Math.cos(a) * r, -Math.sin(a) * r, .63 + random() * .6, bed); + } + } + + cylinder(.7, .85, .32, ceramic, station, [0, .47, 0], 32); + cylinder(.31, .45, 1.55, darkMetal, station, [0, 1.38, 0], 16); + for (let i = 0; i < 6; i++) { const a = i * Math.PI / 3; beam([Math.cos(a) * .33, .7, Math.sin(a) * .33], [Math.cos(a) * .27, 2.12, Math.sin(a) * .27], .027, mint); } + torus(.36, .055, gold, station, 2.13); + const crown = new THREE.Group(); crown.position.y = 1.5; station.add(crown); + for (let i = 0; i < 12; i++) { const leaf = mesh(leafGeometry, leafMaterials[i % 4], crown, [0, .6 + (i % 3) * .18, 0]); leaf.rotation.set(.75 + (i % 4) * .2, i * 2.4, 0); leaf.scale.set(1.5, 1.65, 1.5); } + + const domeRadius = 4.22, domeY = .39; + const ico = new THREE.IcosahedronGeometry(domeRadius, 2); const positions = ico.attributes.position; + const triangles = []; + for (let i = 0; i < positions.count; i += 3) { + let polygon = [0, 1, 2].map(j => new THREE.Vector3().fromBufferAttribute(positions, i + j)); + const clipped = []; + for (let j = 0; j < polygon.length; j++) { + const a = polygon[j], b = polygon[(j + 1) % polygon.length], insideA = a.y >= -.00001, insideB = b.y >= -.00001; + if (insideA) clipped.push(a); + if (insideA !== insideB) clipped.push(a.clone().lerp(b, -a.y / (b.y - a.y))); + } + for (let j = 1; j < clipped.length - 1; j++) for (const vertex of [clipped[0], clipped[j], clipped[j + 1]]) triangles.push(vertex.x, Math.max(0, vertex.y), vertex.z); + } + ico.dispose(); + const domeGeo = new THREE.BufferGeometry(); domeGeo.setAttribute('position', new THREE.Float32BufferAttribute(triangles, 3)); domeGeo.computeVertexNormals(); + const glassMat = software ? new THREE.MeshPhongMaterial({ color: 0x9dcfc6, transparent: true, opacity: .1, shininess: 90, side: THREE.DoubleSide, depthWrite: false }) : new THREE.MeshPhysicalMaterial({ color: 0xa8d9d1, transparent: true, opacity: .095, roughness: .13, metalness: .42, clearcoat: 1, clearcoatRoughness: .15, side: THREE.DoubleSide, depthWrite: false }); + const glass = mesh(domeGeo, glassMat, station, [0, domeY, 0]); glass.castShadow = false; glass.receiveShadow = false; glass.renderOrder = 3; + const edges = new THREE.EdgesGeometry(domeGeo, 1); const edgePos = edges.attributes.position; + const struts = new THREE.InstancedMesh(new THREE.CylinderGeometry(.018, .018, 1, 5), titanium, edgePos.count / 2); + const dummy = new THREE.Object3D(), up = new THREE.Vector3(0, 1, 0), joints = new Map(); + for (let i = 0; i < edgePos.count; i += 2) { + const a = new THREE.Vector3().fromBufferAttribute(edgePos, i), b = new THREE.Vector3().fromBufferAttribute(edgePos, i + 1); + const direction = b.clone().sub(a); dummy.position.copy(a).add(b).multiplyScalar(.5); dummy.position.y += domeY; dummy.quaternion.setFromUnitVectors(up, direction.clone().normalize()); dummy.scale.set(1, direction.length(), 1); dummy.updateMatrix(); struts.setMatrixAt(i / 2, dummy.matrix); + for (const vertex of [a, b]) joints.set(vertex.toArray().map(n => n.toFixed(3)).join(','), vertex); + } + struts.castShadow = true; station.add(struts); + const nodes = new THREE.InstancedMesh(new THREE.SphereGeometry(.043, 6, 5), gold, joints.size); let jointIndex = 0; + for (const vertex of joints.values()) { dummy.position.copy(vertex); dummy.position.y += domeY; dummy.rotation.set(0, 0, 0); dummy.scale.setScalar(1); dummy.updateMatrix(); nodes.setMatrixAt(jointIndex++, dummy.matrix); } station.add(nodes); + edges.dispose(); + torus(4.22, .073, ceramic, station, domeY); + torus(4.28, .025, amber, station, domeY + .02); + cylinder(.19, .25, .2, gold, station, [0, 4.65, 0], 16); beam([0, 4.7, 0], [0, 5.38, 0], .024, titanium); + const beacon = mesh(new THREE.SphereGeometry(.07, 12, 8), amber, station, [0, 5.38, 0]); + const beaconGlow = glow(station, [0, 5.38, 0], 0xffc989, 1.1, .9); + const beaconLight = new THREE.PointLight(0xffc175, 5, 5); beaconLight.position.copy(beacon.position); station.add(beaconLight); + + const ring = new THREE.Group(); ring.position.y = -.42; station.add(ring); + torus(6.03, .095, titanium, ring); torus(6.53, .065, gold, ring); torus(6.5, .022, amber, ring, .1); torus(6.03, .018, mint, ring, -.15); + const ringDeck = mesh(new THREE.RingGeometry(6.07, 6.47, 128), (software ? new THREE.MeshPhongMaterial({ color: 0x43575b, shininess: 30, side: THREE.DoubleSide }) : new THREE.MeshStandardMaterial({ color: 0x43575b, metalness: .8, roughness: .4, side: THREE.DoubleSide })), ring); ringDeck.rotation.x = -Math.PI / 2; + for (let i = 0; i < 48; i++) { + const a = i * Math.PI / 24, b = a + Math.PI / 24; + beam([Math.cos(a) * 6.05, 0, Math.sin(a) * 6.05], [Math.cos(b) * 6.5, 0, Math.sin(b) * 6.5], .026, ceramic, ring); + if (i % 4 === 0) { const lamp = box([.12, .04, .35], i % 8 ? mint : amber, ring, [Math.cos(a) * 6.29, .055, Math.sin(a) * 6.29]); lamp.rotation.y = -a; } + } + const pods = new THREE.Group(); station.add(pods); + for (let i = 0; i < 4; i++) { + const a = i * Math.PI / 2 + Math.PI / 4, pod = new THREE.Group(); pod.rotation.y = a; pods.add(pod); + box([.6, .24, 2.25], titanium, pod, [0, -.5, 5.35]); box([.3, .05, 2.0], black, pod, [0, -.355, 5.4]); + for (const side of [-1, 1]) beam([side * .2, -.8, 4], [side * .32, -.5, 6.2], .045, gold, pod); + const tube = cylinder(.42, .42, 1.55, ceramic, pod, [0, -.35, 6.24], 20); tube.rotation.x = Math.PI / 2; + for (const z of [5.6, 6.0, 6.6, 6.9]) { const collar = torus(.43, .035, titanium, pod); collar.position.set(0, -.35, z); collar.rotation.x = 0; } + const hatch = cylinder(.3, .3, .1, darkMetal, pod, [0, -.35, 7.05], 16); hatch.rotation.x = Math.PI / 2; + glow(pod, [0, -.35, 7.13], 0x72f6d0, .5, .6); + } + + const solarMat = material(0x173c59, .72, .26); + const solarLines = material(0x53838c, .55, .45); + for (const sign of [-1, 1]) { + const wing = new THREE.Group(); wing.position.set(sign * 6.7, -.65, -.65); wing.rotation.z = sign * .1; station.add(wing); + box([3.9, .14, .22], gold, wing, [sign * .35, 0, 0]); + for (const z of [-1.05, 1.05]) { + box([3.0, .09, 1.72], titanium, wing, [sign * .55, 0, z]); box([2.9, .02, 1.62], solarMat, wing, [sign * .55, .058, z]); + for (let i = 0; i < 10; i++) box([.012, .015, 1.6], solarLines, wing, [sign * .55 - 1.4 + i * .31, .074, z]); + for (let j = 0; j < 5; j++) box([2.9, .015, .009], solarLines, wing, [sign * .55, .075, z - .8 + j * .4]); + } + } + + const orbit = new THREE.Group(); orbit.rotation.z = .16; station.add(orbit); + const orbitRail = torus(7.32, .012, material(0x3d6e73, .4, .6), orbit, .15); + const dronePivot = new THREE.Group(); orbit.add(dronePivot); + const drone = new THREE.Group(); drone.position.set(7.32, .15, 0); dronePivot.add(drone); + mesh(new THREE.OctahedronGeometry(.21), ceramic, drone); box([.95, .04, .25], solarMat, drone); glow(drone, [0, 0, .22], 0x8fdfff, 1, .8); + const dish = mesh(new THREE.SphereGeometry(.43, 20, 10, 0, Math.PI * 2, 0, Math.PI / 2), ceramic, station, [-3.5, -.6, 4.5]); dish.rotation.z = -.6; dish.rotation.x = .8; + + const windTime = { value: 0 }; + for (const leafMaterial of leafMaterials) { + leafMaterial.onBeforeCompile = shader => { + shader.uniforms.windTime = windTime; + shader.vertexShader = 'uniform float windTime;\n' + shader.vertexShader; + shader.vertexShader = shader.vertexShader.replace('#include ', '#include \ntransformed.x += sin(windTime*.9+position.x*1.7+position.z)*.035*max(0.,position.y-.65);'); + }; + leafMaterial.customProgramCacheKey = () => 'greenhouse-wind-v1'; + } + function batch(root, excluded = new Set()) { + scene.updateMatrixWorld(true); + const inverse = root.matrixWorld.clone().invert(), groups = new Map(), sources = []; + function visit(object) { + if (excluded.has(object)) return; + if (object.isMesh && !object.isInstancedMesh && !Array.isArray(object.material)) { + const key = object.material.uuid; + if (!groups.has(key)) groups.set(key, { material: object.material, position: [], normal: [], uv: [], cast: false, receive: false }); + const group = groups.get(key), geometry = object.geometry.index ? object.geometry.toNonIndexed() : object.geometry.clone(); + geometry.applyMatrix4(new THREE.Matrix4().multiplyMatrices(inverse, object.matrixWorld)); + const attributes = geometry.attributes; + for (let i = 0; i < attributes.position.array.length; i++) group.position.push(attributes.position.array[i]); + for (let i = 0; i < attributes.normal.array.length; i++) group.normal.push(attributes.normal.array[i]); + if (attributes.uv) for (let i = 0; i < attributes.uv.array.length; i++) group.uv.push(attributes.uv.array[i]); + else for (let i = 0; i < attributes.position.count * 2; i++) group.uv.push(0); + group.cast ||= object.castShadow; group.receive ||= object.receiveShadow; + sources.push(object); geometry.dispose(); + } + for (const child of object.children) visit(child); + } + for (const child of root.children) visit(child); + for (const source of sources) source.removeFromParent(); + for (const group of groups.values()) { + const geometry = new THREE.BufferGeometry(); + geometry.setAttribute('position', new THREE.Float32BufferAttribute(group.position, 3)); geometry.setAttribute('normal', new THREE.Float32BufferAttribute(group.normal, 3)); geometry.setAttribute('uv', new THREE.Float32BufferAttribute(group.uv, 2)); + const merged = new THREE.Mesh(geometry, group.material); merged.castShadow = group.cast; merged.receiveShadow = group.receive; root.add(merged); + } + } + batch(station, new Set([glass, ring, orbit, crown, packageGroup, ...fans])); batch(ring); batch(crown); batch(drone); fans.forEach(fan => batch(fan)); + + let interior = false; + let inspectingPackage = false; + let inspectionTween = null; + const normalMinDistance = 2.4; + const lidOpenAngle = -.65; + function endInspection() { + inspectingPackage = false; inspectionTween = null; + controls.enabled = true; controls.enableDamping = !paused; + controls.minDistance = normalMinDistance; + camera.fov = mobile() ? 50 : 39; camera.updateProjectionMatrix(); + } + function focusPackage() { + interior = true; inspectingPackage = true; + controls.minDistance = .7; + camera.fov = 65; camera.updateProjectionMatrix(); + controls.enableDamping = false; + scene.updateMatrixWorld(true); + const destination = packageGroup.localToWorld(new THREE.Vector3(0, .45, .9)); + const target = packageGroup.localToWorld(new THREE.Vector3(0, .2, 0)); + if (paused || reducedMotion.matches) { + inspectionTween = null; camera.position.copy(destination); controls.target.copy(target); + controls.enabled = true; controls.update(); + } else { + inspectionTween = { from: camera.position.clone(), fromTarget: controls.target.clone(), to: destination, target, start: performance.now() }; + controls.enabled = false; + } + requestRender(); + } + function updateInspection(now) { + if (!inspectionTween) return; + const t = paused || reducedMotion.matches ? 1 : Math.min(1, (now - inspectionTween.start) / 650); + const eased = t*t*(3-2*t); + camera.position.lerpVectors(inspectionTween.from, inspectionTween.to, eased); + controls.target.lerpVectors(inspectionTween.fromTarget, inspectionTween.target, eased); + if(t === 1) { inspectionTween = null; controls.enabled = true; controls.enableDamping = !paused; } + } + function interiorCamera() { + endInspection(); + interior = true; + scene.updateMatrixWorld(true); + controls.target.copy(station.localToWorld(new THREE.Vector3(0, .95, -.15))); + camera.position.copy(station.localToWorld(new THREE.Vector3(2.6, 2.25, 3.2))); + controls.update(); requestRender(); + } + canvas.addEventListener('dblclick', event => { event.preventDefault(); if (!packageHit(pointAt(event))) interiorCamera(); }); + const hint = document.querySelector('#object-hint'), raycaster = new THREE.Raycaster(); + const opaque = []; + station.traverse(object => { if (object.isMesh && object !== glass && !object.material?.transparent) opaque.push(object); }); + function packageHit(point) { + if (camera.position.distanceTo(controls.target) > 16) return false; + scene.updateMatrixWorld(true); camera.updateMatrixWorld(); raycaster.setFromCamera(point, camera); + const candidate = raycaster.intersectObject(packageGroup, true)[0]; + if (!candidate) return false; + raycaster.far = candidate.distance + .02; + const first = raycaster.intersectObjects(opaque, false)[0]; raycaster.far = Infinity; + return !first || first.distance >= candidate.distance - .025; + } + function pointAt(event) { const b=canvas.getBoundingClientRect();return new THREE.Vector2((event.clientX-b.left)/b.width*2-1,-(event.clientY-b.top)/b.height*2+1); } + function inspectPackage() { + packageOpen = !packageOpen; canvas.dataset.discovered = 'true'; + if (paused || reducedMotion.matches) lid.rotation.x = packageOpen ? lidOpenAngle : 0; + if (packageOpen) focusPackage(); + hint.textContent = packageOpen ? 'ЧАК ЧАК. Коробка открыта. К чаю.' : 'ЧАК ЧАК. Коробка закрыта.'; hint.hidden=false; requestRender(); + } + let down = null, hoverTime = 0; + canvas.addEventListener('pointerdown', event => { down={x:event.clientX,y:event.clientY}; }); + canvas.addEventListener('pointerup', event => { if(down && Math.hypot(event.clientX-down.x,event.clientY-down.y)<5 && packageHit(pointAt(event))) inspectPackage(); down=null; }); + canvas.addEventListener('pointercancel',()=>{down=null;}); + canvas.addEventListener('pointermove',event=>{ + if(down || performance.now()-hoverTime<150)return;hoverTime=performance.now(); + const hit=packageHit(pointAt(event)); canvas.style.cursor=hit?'pointer':''; + if(hit){hint.textContent='Коробка под столом · нажмите, чтобы осмотреть';hint.hidden=false;} + else if(!packageOpen)hint.hidden=true; + },{passive:true}); + canvas.addEventListener('pointerleave',()=>{canvas.style.cursor='';if(!packageOpen)hint.hidden=true;}); + canvas.addEventListener('keydown',event=>{if(event.key==='Enter'&&packageHit(new THREE.Vector2(0,0))){event.preventDefault();inspectPackage();}}); + function resetCamera() { + endInspection(); + interior = false; + controls.target.set(0, mobile() ? .2 : .9, 0); + const distance = mobile() ? 42 : (innerWidth / innerHeight < 1.35 ? 26 : 23); + const vector = new THREE.Vector3(10.5, 9, 15.5).normalize().multiplyScalar(distance); + camera.position.copy(controls.target).add(vector); controls.update(); requestRender(); + } + function zoom(factor) { const offset = camera.position.clone().sub(controls.target); offset.setLength(THREE.MathUtils.clamp(offset.length() * factor, controls.minDistance, controls.maxDistance)); camera.position.copy(controls.target).add(offset); controls.update(); requestRender(); } + function rotateCamera(horizontal, vertical) { const spherical = new THREE.Spherical().setFromVector3(camera.position.clone().sub(controls.target)); spherical.theta += horizontal; spherical.phi = THREE.MathUtils.clamp(spherical.phi + vertical, controls.minPolarAngle, controls.maxPolarAngle); camera.position.copy(controls.target).add(new THREE.Vector3().setFromSpherical(spherical)); controls.update(); requestRender(); } + function syncMotion() { + motionButton.setAttribute('aria-pressed', String(paused)); motionButton.textContent = paused ? 'Анимация' : 'Пауза'; + motionButton.setAttribute('aria-label', paused ? 'Включить анимацию' : 'Остановить анимацию'); motionButton.title = paused ? 'Включить анимацию' : 'Остановить анимацию'; + controls.enableDamping = !paused; previous = 0; requestRender(); + } + document.querySelector('#camera-zoom-in').addEventListener('click', () => zoom(.86)); + document.querySelector('#camera-zoom-out').addEventListener('click', () => zoom(1.16)); + motionButton.addEventListener('click', () => { paused = !paused; syncMotion(); }); + reducedMotion.addEventListener('change', () => { paused = reducedMotion.matches; syncMotion(); }); + canvas.addEventListener('keydown', event => { + const orbitStep = event.shiftKey ? .002 : .1; + const actions = { i: interiorCamera, I: interiorCamera, ArrowLeft: () => rotateCamera(-orbitStep, 0), ArrowRight: () => rotateCamera(orbitStep, 0), ArrowUp: () => rotateCamera(0, -.08), ArrowDown: () => rotateCamera(0, .08), '+': () => zoom(.9), '=': () => zoom(.9), '-': () => zoom(1.1), Home: resetCamera, ' ': () => { paused = !paused; syncMotion(); } }; + if (actions[event.key]) { event.preventDefault(); actions[event.key](); } + }); + controls.addEventListener('start', () => { interacting = true; }); + controls.addEventListener('end', () => { interacting = false; }); + controls.addEventListener('change', requestRender); + canvas.addEventListener('webglcontextlost', event => { event.preventDefault(); contextLost = true; gpuFence = null; cancelAnimationFrame(frame); frame = 0; fallback.hidden = false; fallback.querySelector('strong').textContent = 'Визуальный канал приостановлен'; fallback.querySelector('p').textContent = 'Графический контекст потерян. Перезагрузите страницу, чтобы восстановить сцену. Терминал доступен.'; }); + canvas.addEventListener('webglcontextrestored', () => { contextLost = false; fallback.hidden = true; requestRender(); }); + document.addEventListener('visibilitychange', () => { hidden = document.hidden; if (hidden) { cancelAnimationFrame(frame); frame = 0; } else { previous = 0; requestRender(); } }); + let wasMobile = mobile(); + addEventListener('resize', () => { camera.aspect = innerWidth / innerHeight; camera.fov = inspectingPackage ? 65 : (mobile() ? 50 : 39); camera.updateProjectionMatrix(); renderer.setPixelRatio(pixelRatio()); renderer.setSize(innerWidth, innerHeight, false); if (wasMobile !== mobile()) { wasMobile = mobile(); resetCamera(); } requestRender(); }); + function requestRender() { if (!frame && !hidden && !contextLost) frame = requestAnimationFrame(render); } + function render(now) { + frame = 0; + + if (gpuFence) { + const ready = gl.clientWaitSync(gpuFence, 0, 0); + if (ready === gl.TIMEOUT_EXPIRED) { requestRender(); return; } + gl.deleteSync(gpuFence); gpuFence = null; + } + if (!paused && now - lastPaint < frameInterval) { requestRender(); return; } + lastPaint = now; + const delta = previous ? Math.min((now - previous) / 1000, .05) : 0; previous = now; + if (!paused) { + elapsed += delta; + if (!interacting && !interior) station.rotation.y += delta * .019; + if (!inspectingPackage) station.position.y = Math.sin(elapsed * .36) * .06; + dronePivot.rotation.y = elapsed * .13; + ring.rotation.y = -elapsed * .013; + beaconGlow.material.opacity = .42 + (Math.sin(elapsed * 2.2) + 1) * .26; + beaconLight.intensity = 3 + (Math.sin(elapsed * 2.2) + 1) * 2; + windTime.value = elapsed; + fans.forEach((fan, i) => { fan.rotation.z = elapsed * (2.3 + i*.3); }); + lid.rotation.x += ((packageOpen ? lidOpenAngle : 0) - lid.rotation.x) * Math.min(1, delta * 8); + drone.rotation.y = Math.sin(elapsed*.4)*.2; + crown.rotation.y = Math.sin(elapsed * .35) * .06; + planet.rotation.y = elapsed * .003; + clouds.rotation.y = elapsed * .0038; + underlight.intensity = 32 + Math.sin(elapsed * .5) * 4; + } + updateInspection(now); + controls.update(); + if (paintCount++ % 6 === 0 || paused) renderer.shadowMap.needsUpdate = true; + renderer.render(scene, camera); + if (software) { gpuFence = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0); gl.flush(); } + canvas.dataset.ready = 'true'; loading.hidden = true; fallback.hidden = true; + if (!paused) requestRender(); + } + function inspectionView() { + const samples = [[0,.15,.214],[-.19,.09,.214],[.19,.09,.214],[-.19,.21,.214],[.19,.21,.214]]; + const projected = samples.map(point => packageGroup.localToWorld(new THREE.Vector3(...point)).project(camera)); + const corners = projected.slice(1).map(p=>({x:(p.x+1)*innerWidth/2,y:(1-p.y)*innerHeight/2})); + return { focused: inspectingPackage, open: packageOpen, labelCenterVisible: packageHit(new THREE.Vector2(projected[0].x, projected[0].y)), tweening: Boolean(inspectionTween), visibleSamples: projected.filter(p=>Math.abs(p.x)<1 && Math.abs(p.y)<1 && p.z<1 && packageHit(new THREE.Vector2(p.x,p.y))).length, labelWidth: Math.max(...corners.map(p=>p.x))-Math.min(...corners.map(p=>p.x)), labelHeight: Math.max(...corners.map(p=>p.y))-Math.min(...corners.map(p=>p.y)), corners }; + } + + window.greenhouseScene = { getInspectionView: inspectionView, getInspectionPoint: () => { const v=packageGroup.localToWorld(new THREE.Vector3(0,.15,.23)).project(camera);return {x:(v.x+1)*innerWidth/2,y:(1-v.y)*innerHeight/2,visible:packageHit(new THREE.Vector2(v.x,v.y))}; }, getStats: () => ({ revision: THREE.REVISION, starfield: { mode: 'baked-texture', width: skyCanvas.width, height: skyCanvas.height, version: skyTexture.version }, calls: renderer.info.render.calls, triangles: renderer.info.render.triangles, geometries: renderer.info.memory.geometries, paused, software, orbitMinDistance: controls.minDistance, fov: camera.fov, inspectingPackage, pixelRatio: renderer.getPixelRatio(), shadows: renderer.shadowMap.enabled, frameLimit: software ? 24 : 30, frames: paintCount, camera: camera.position.toArray(), rotation: station.rotation.y, contextLost }) }; + resetCamera(); syncMotion(); requestRender(); +} diff --git a/greenhouse/frontend/styles.css b/greenhouse/frontend/styles.css new file mode 100644 index 0000000..82f6a75 --- /dev/null +++ b/greenhouse/frontend/styles.css @@ -0,0 +1,289 @@ +:root{color-scheme:dark;--ink:#e0e6e7;--muted:#a2adb3;--line:#3b464e;--mint:#b7d9c7;--amber:#e3ba79;--mono:ui-monospace,'DejaVu Sans Mono',monospace;font-family:Arial,Helvetica,sans-serif;font-size:13px}*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#070d13;color:var(--ink)}button,input,textarea,select{font:inherit}button{cursor:pointer;touch-action:manipulation}a{color:inherit}button:disabled{opacity:.45;cursor:not-allowed}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,[tabindex]:focus-visible{outline:2px solid #f0cb82;outline-offset:2px}[hidden]{display:none!important}button{border:1px solid var(--line);background:#202a31;color:var(--ink);min-height:34px;padding:6px 12px;border-radius:3px}button:hover:not(:disabled){background:#303c43}button[aria-pressed=true],button[aria-expanded=true]{background:#34483f;border-color:#789a87}input,textarea,select{color:var(--ink);background:#0c141b;border:1px solid #55616b;padding:10px;width:100%;border-radius:2px;min-width:0}input::placeholder,textarea::placeholder{color:#96a0a9}label{display:block;font-size:12px;color:#c5cdd0}textarea{resize:vertical}.skip{position:absolute;top:-80px;left:20px;padding:12px;background:#dae9df;color:#111;z-index:60}.skip:focus{top:12px}#observatory{position:relative;width:100%;height:100%;height:100svh;overflow:hidden;background:#070d13}#space{position:absolute;inset:0;display:block;width:100%;height:100%;touch-action:none;cursor:grab;outline-offset:-5px}#space:active{cursor:grabbing}.vignette{position:absolute;inset:0;pointer-events:none;background:linear-gradient(#070d1333,transparent 18%,transparent 80%,#070d1333)}.vitals{position:absolute;bottom:105px;left:20px;width:213px;padding:14px;background:#101921e8;border:1px solid #3a464e;border-radius:3px;pointer-events:none}.vitals-heading{font-size:12px;display:flex;justify-content:space-between;border-bottom:1px solid var(--line);padding-bottom:10px}.vitals-heading strong{font-size:12px;color:var(--mint);font-weight:400}.vital-line{display:flex;align-items:center;justify-content:space-between;font-size:12px;margin-top:11px}.vital-line>span{color:var(--muted)}.vital-line strong{font:13px var(--mono);font-weight:400}.vitals>small{display:block;font-size:10px;color:var(--muted);margin-top:14px}.camera-controls{position:absolute;right:20px;bottom:105px;display:flex;gap:5px}.camera-controls button{min-width:36px;background:#111c24ed}.command-dock{position:absolute;left:0;right:0;bottom:28px;display:flex;align-items:stretch;gap:6px;padding:9px 20px;background:#111921fa;border-top:1px solid #465059;border-bottom:1px solid #39434a;min-height:56px}.command-dock button{font-size:13px;min-width:105px;white-space:nowrap}.command-dock #open-create{margin-left:auto}.command-dock small{display:inline-block;font-size:11px;color:var(--muted);margin-left:7px}.terminal{position:absolute;z-index:10;right:20px;top:112px;bottom:105px;width:420px;max-height:730px;border:1px solid #69767e;box-shadow:0 12px 40px #0007;background:#121c24;display:flex;flex-direction:column;border-radius:4px;overflow:hidden}.terminal-header{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 16px;background:#26313a;border-bottom:1px solid #54606a}.terminal-header .eyebrow{font-size:10px;color:#b2bdc4}h2{font-size:17px;font-weight:500;margin:4px 0 0}.close{font-size:23px;line-height:1;border:0;background:transparent;min-width:34px;min-height:34px;padding:4px}.terminal-tabs{display:flex;padding:12px 14px 0;gap:5px}.terminal-tabs button{flex:1;font-size:12px;padding:6px}.terminal-tabs span{font-size:10px;margin-left:4px;color:var(--muted)}.terminal-toolbar{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 16px;font-size:11px;border-bottom:1px solid var(--line);color:var(--muted)}#selected-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-button{font-size:11px;padding:4px 8px;min-height:29px;white-space:nowrap}.terminal-body{flex:1;overflow:auto;overscroll-behavior:contain;padding:14px 16px;scrollbar-width:thin;scrollbar-color:#67767b #16212a}.terminal-footer{display:flex;justify-content:space-between;padding:9px 16px;border-top:1px solid var(--line);font-size:10px;color:var(--muted)}.search{display:flex;align-items:center;gap:8px}.search>span{font-size:24px;color:var(--muted)}.search input{font-size:12px;padding:9px}.plot-list{max-height:235px;overflow:auto;margin-top:12px}.plot-card{display:flex;align-items:center;gap:10px;width:100%;border:0;border-bottom:1px solid #38444c;border-radius:0;background:transparent;text-align:left;padding:12px 6px}.plot-card[aria-pressed=true]{background:#243e32;border-left:3px solid #a4c8b4;padding-left:3px}.plant-icon{font-size:18px;color:var(--mint)}.plot-card-copy{flex:1;min-width:0}.plot-card strong{display:block;font-size:13px;font-weight:500;overflow-wrap:anywhere}.plot-card small{display:block;color:var(--muted);font-size:11px;margin-top:5px;overflow-wrap:anywhere}.arrow{color:var(--muted)}.section-divider{display:flex;justify-content:space-between;margin:20px 0 15px;font-size:11px;color:var(--muted);border-top:1px solid var(--line);padding-top:17px}.detail-top{display:flex;align-items:center;justify-content:space-between;gap:10px}.eyebrow{font-size:11px;color:var(--muted)}.pill{font:10px var(--mono);color:#bbcfc2;overflow-wrap:anywhere;max-width:65%}#plot-detail h3{font-size:18px;font-weight:500;margin:15px 0;overflow-wrap:anywhere}dl{margin:12px 0}dt{font-size:11px;color:var(--muted);margin-top:15px}dd{font-size:13px;line-height:1.65;margin:6px 0 0;overflow-wrap:anywhere;white-space:pre-wrap}.empty{font-size:12px;line-height:1.7;color:var(--muted);padding:8px 0}.section-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:15px}.record{display:flex;justify-content:space-between;gap:16px;padding:13px 0;border-bottom:1px solid var(--line)}.record strong{font-size:12px;font-weight:400}.record small{display:block;color:var(--muted);font-size:10px;margin-top:6px}.record-value{font:14px var(--mono);max-width:60%;overflow-wrap:anywhere}.raw-data{font:12px/1.7 var(--mono);white-space:pre-wrap;overflow-wrap:anywhere}.button{font-size:12px}.primary{background:#b7cfc0;color:#142219;border-color:#b7cfc0}.primary:hover:not(:disabled){background:#d2e2d6}#key-form{margin-top:18px}.key-row{display:flex;gap:7px;margin-top:8px}.key-row input{min-width:0}.form-error,.inline-error{color:#e8bda3;font-size:12px;line-height:1.7}.form-error:empty{display:none}.notice{position:absolute;top:110px;left:20px;z-index:20;background:#32281d;color:#f0d5ae;border:1px solid #826442;padding:12px 16px;font-size:12px;line-height:1.6;max-width:min(570px,calc(100% - 40px));max-height:135px;overflow:auto}.toast{position:fixed;left:50%;top:110px;transform:translateX(-50%);background:#dce5df;color:#17211b;border:1px solid #b7cfc0;padding:12px 18px;font-size:12px;line-height:1.5;z-index:50;max-width:calc(100% - 30px);pointer-events:none;box-shadow:0 4px 20px #0006}dialog{width:min(450px,calc(100% - 32px));max-height:calc(100svh - 32px);overflow:auto;padding:24px;background:#15202a;color:var(--ink);border:1px solid #76818a;border-radius:4px;box-shadow:0 16px 70px #0009}dialog::backdrop{background:#010610a6}.dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:10px}dialog h2{font-size:22px;margin:8px 0 12px}dialog p{font-size:12px;line-height:1.7;color:var(--muted)}dialog form>label{margin-top:18px}dialog label input,dialog label textarea,dialog label select{margin-top:8px}dialog form>.button{width:100%;margin-top:20px;min-height:40px}#scene-loading{position:absolute;left:50%;top:45%;transform:translate(-50%,-50%);display:flex;align-items:center;flex-direction:column;gap:13px;color:var(--ink);font-size:13px;pointer-events:none;background:#0e1821dd;padding:20px 28px;border-radius:3px}#scene-loading small{font-size:11px;color:var(--muted);max-width:210px;text-align:center;line-height:1.6}.loading-orbit{width:24px;height:24px;border:2px solid #52616a;border-top-color:#c9ded2;border-radius:50%;animation:spin 1.5s linear infinite}#scene-fallback{position:absolute;left:50%;top:40%;transform:translate(-50%,-50%);width:min(400px,80vw);padding:20px;background:#16212bec;border:1px solid #73818b;line-height:1.7}#scene-fallback p{font-size:12px;color:var(--muted)}.noscript-message{position:fixed;top:40%;left:10%;right:10%;background:#1f2b36;padding:30px;z-index:50}#object-hint{position:absolute;bottom:111px;left:50%;transform:translateX(-50%);max-width:calc(100% - 32px);padding:10px 14px;border:1px solid #998969;background:#29251feb;color:#f3dfb8;font-size:12px;line-height:1.6;pointer-events:none;z-index:9}#console-indicator{display:inline-block;width:6px;height:6px;background:#718088;border-radius:50%;margin-left:6px}#console-indicator.connected{background:#a4d3b3}.operator-console{position:absolute;left:20px;bottom:105px;width:650px;height:365px;max-width:calc(100% - 40px);max-height:calc(100% - 217px);min-width:320px;min-height:230px;background:#0a1117;border:1px solid #77848b;box-shadow:0 12px 40px #0009;z-index:15;display:flex;flex-direction:column;resize:both;overflow:hidden;border-radius:4px}.console-titlebar{background:#29353f;border-bottom:1px solid #58666f;padding:7px 12px;display:flex;align-items:center;gap:15px;flex-shrink:0}.console-titlebar h2{font-size:14px;margin:0}.console-titlebar .close{margin-left:auto}.console-titlebar #console-state{font-size:11px;color:#c0ccc4}.console-tools{display:flex;gap:7px;padding:8px 12px;border-bottom:1px solid #303c45;flex-shrink:0}.console-tools button{font-size:11px;min-height:29px;padding:4px 9px;background:#15212b}.console-tools button:last-child{margin-left:auto}.console-output{flex:1;min-height:35px;overflow:auto;overscroll-behavior:contain;padding:12px 14px;font:12px/1.65 var(--mono);scrollbar-width:thin;scrollbar-color:#667780 #101820}.console-line{white-space:pre-wrap;overflow-wrap:anywhere;color:#d8dfde}.console-command{color:#d8c9a3;margin-top:5px}.console-system{color:#8eaaa0}.console-error{font-size:11px;line-height:1.5;color:#f1bf9f;background:#271b17;border-top:1px solid #794e3b;margin:0;padding:7px 12px;flex-shrink:0;max-height:85px;overflow:auto}#console-form{padding:7px 12px 4px;flex-shrink:0}#console-form label{font-size:10px;color:var(--muted);margin-bottom:5px}.console-input-row{display:flex;gap:7px;align-items:center}.console-input-row>span{font:16px var(--mono);color:#b2c5b5}.console-input-row input{font:12px var(--mono);background:#0b151d;padding:9px;border-color:#526970;flex:1}.console-input-row button{font-size:11px;padding:8px 10px;min-height:34px}.console-footer{padding:6px 12px 9px;font-size:10px;color:var(--muted);flex-shrink:0}@keyframes spin{to{transform:rotate(360deg)}} +@media(max-width:1000px){.operator-console{width:570px}.terminal{width:390px}.camera-controls{bottom:105px}} +@media(max-width:700px){.vitals{left:12px;bottom:125px;width:178px;padding:10px}.vitals-heading{font-size:11px;padding-bottom:7px}.vitals-heading strong{font-size:11px}.vital-line{font-size:11px;margin-top:8px}.vital-line strong{font-size:12px}.vitals>small{font-size:9px;margin-top:10px}.camera-controls{right:12px;bottom:125px;max-width:130px;flex-wrap:wrap;justify-content:flex-end}.camera-controls button{font-size:12px;padding:7px 9px;min-width:34px}.camera-controls button:last-child{flex-basis:100%}.command-dock{bottom:24px;min-height:78px;padding:8px 10px;display:grid;grid-template-columns:repeat(3,1fr);gap:5px}.command-dock button{min-width:0;font-size:11px;min-height:30px;padding:5px 7px}.command-dock #open-create{margin-left:0}.command-dock #console-launch{grid-column:1/3}.command-dock small{font-size:10px;margin-left:3px}.terminal{inset:auto 10px 118px;width:auto;height:57svh;max-height:570px}.terminal-header{padding:10px 13px}.terminal-header h2{font-size:16px}.terminal-tabs{padding:9px 12px 0}.terminal-toolbar{padding:8px 12px;font-size:10px}.terminal-body{padding:12px}.terminal-footer{padding:8px 12px;font-size:9px}.plot-list{max-height:155px}.terminal-open .vitals,.terminal-open .camera-controls{visibility:hidden}.notice{left:12px;top:118px;max-width:calc(100% - 24px);padding:9px 12px;font-size:11px;max-height:105px}.toast{top:116px;font-size:11px}dialog{padding:19px}dialog input,dialog textarea,dialog select{font-size:16px}.operator-console{left:10px;right:10px;bottom:118px;width:auto;height:54svh;max-height:calc(100svh - 235px);max-width:none;min-width:0;min-height:225px;resize:none}.console-titlebar{padding:6px 10px;gap:10px}.console-titlebar h2{font-size:13px}.console-titlebar #console-state{font-size:10px}.console-tools{padding:7px 10px;gap:5px}.console-tools button{font-size:10px;padding:4px 7px}.console-output{font-size:11px;padding:10px}.console-input-row input{font-size:16px;padding:8px;min-width:0}.console-input-row button{font-size:10px;padding:7px}.console-footer{font-size:9px}.console-error{font-size:10px;max-height:70px}#object-hint{bottom:113px;z-index:16;font-size:11px;max-width:calc(100% - 24px)}#scene-loading{padding:15px 18px}} +@media(max-height:600px) and (min-width:701px){.terminal{top:108px;bottom:96px}.operator-console{max-height:calc(100% - 210px);bottom:96px;min-height:200px}.vitals,.camera-controls{bottom:96px}.vitals{padding:9px}.vital-line{margin-top:7px}} +@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}} + +@font-face{font-family:DepartureMono;src:url('./fonts/DepartureMono-Regular.woff2') format('woff2');font-weight:400;font-display:swap} +:root{ + --ink:#e6f1ef;--muted:#b4ced1;--line:#d6f0ed41;--mint:#d8f0e9; + --surface:#0b1b24a8;--surface-solid:#0b1b24;--signal:#d8f0e9; + --sans:DepartureMono,monospace;--mono:DepartureMono,monospace;--display:DepartureMono,monospace; + font-family:var(--sans);font-size:14px; +} +body,#observatory{background:#071017;color:var(--ink)} +button,input,textarea,select{font-family:var(--sans)} +button{border:0;border-radius:0;background:transparent;color:var(--ink);transition:color .18s,background .18s,opacity .18s} +button:hover:not(:disabled),button[aria-pressed=true],button[aria-expanded=true]{background:transparent;color:#dff9f2} +button:active:not(:disabled){background:transparent;color:var(--signal)} +button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,[tabindex]:focus-visible{outline:2px solid var(--signal);outline-offset:3px} +input,textarea,select{border-radius:0;background:#0b1b24;border:0;border-bottom:1px solid #d6f0ed6e;color:var(--ink);font-size:14px} +input::placeholder,textarea::placeholder{color:#a9c5c8} +.vignette{background:linear-gradient(90deg,#071017c9 0,transparent 32%,transparent 74%,#07101736 100%)} + +.vitals{ + left:40px;bottom:246px;width:282px;padding:0;border:0;background:transparent;box-shadow:none; + text-shadow:0 2px 14px #000d;pointer-events:none; +} +.vitals-heading{display:flex;justify-content:space-between;align-items:center;border:0;padding:0 0 23px;margin:0 0 4px;font:10px var(--mono);letter-spacing:.08em;color:#c7dddb} +.vitals-heading strong{font:11px var(--mono);letter-spacing:0;color:var(--signal)} +.vital-line{margin-top:11px;font:12px var(--mono)} +.vital-line>span{color:#a9c5c8}.vital-line strong{font:13px var(--mono);color:#e6f1ef} +.vitals>small{font:10px var(--mono);color:#a9c5c8;margin-top:22px} +.command-dock{ + left:40px;right:auto;bottom:42px;width:282px;min-height:0;padding:0;gap:0; + display:block;background:transparent;border:0;box-shadow:none; + backdrop-filter:none;-webkit-backdrop-filter:none; +} +.command-dock button{ + width:100%;min-width:0;min-height:67px;display:flex;align-items:center;justify-content:space-between; + padding:0 2px;text-align:left;white-space:nowrap;background:transparent;border:0; + border-top:1px solid #d6f0ed60;font-size:23px;font-weight:400;letter-spacing:-.035em; +} +.command-dock button:last-child{border-bottom:1px solid #d6f0ed60} +.command-dock button:hover,.command-dock button[aria-expanded=true]{color:var(--signal);background:transparent} +.command-dock button:hover .dock-label{transform:translateX(4px)} +.command-dock button[aria-expanded=true] .dock-label{color:var(--signal)} +.dock-label{transition:transform .18s,color .18s;line-height:1.1} +.dock-end{display:flex;align-items:center;gap:17px;font:17px var(--sans);color:#c7dddb} +.command-dock small{font:11px var(--mono);color:#c7dddb;margin:0} +#console-indicator{display:inline-block;width:5px;height:5px;border-radius:50%;background:#718e95;margin-left:6px;vertical-align:middle} +#console-indicator.connected{background:var(--signal)} + +.camera-controls{ + right:40px;bottom:43px;display:flex;align-items:center;gap:12px; + padding:0;background:transparent;border:0;border-radius:0;box-shadow:none; + backdrop-filter:none;-webkit-backdrop-filter:none; +} +.camera-controls button{min-width:29px;min-height:34px;padding:0;background:transparent;border:0;border-radius:0;font:19px var(--sans);color:#c7dddb;opacity:.84} +.camera-controls button:hover{background:transparent;color:#dff9f2;opacity:1} +.camera-controls #motion-toggle{min-width:0;padding-left:18px;border-left:1px solid #d6f0ed57;font:12px var(--sans);letter-spacing:.01em} + +.terminal,.operator-console{ + z-index:10;right:0;top:0;bottom:0;left:auto;width:460px;height:auto;max-height:none;max-width:min(100vw,700px);min-width:0;min-height:0; + border:0;border-left:1px solid #d6f0ed5c;border-radius:0;background:var(--surface); + box-shadow:-30px 0 80px #0008;backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px); + animation:surface-in .25s ease-out;overflow:hidden; +} +@keyframes surface-in{from{transform:translateX(16px);opacity:.75}to{transform:translateX(0);opacity:1}} +.terminal-header{display:flex;align-items:flex-start;gap:16px;padding:44px 42px 21px;background:transparent;border:0} +.terminal-header .eyebrow,.eyebrow{font:11px var(--mono);letter-spacing:.055em;color:#a9c5c8} +.terminal-header h2{margin:12px 0 0;font:400 38px/1.1 var(--sans);letter-spacing:-.045em;color:#e6f1ef} +.close{margin:0 0 0 auto;width:34px;min-width:34px;min-height:34px;padding:0;border:0;border-radius:0;background:transparent;font:28px/1 var(--sans);color:#a9c5c8} +.close:hover{background:transparent;color:#dff9f2} +.terminal-tabs{display:flex;gap:27px;padding:0 42px;border-bottom:1px solid #d6f0ed44} +.terminal-tabs button{flex:0 0 auto;min-height:49px;padding:0 0 1px;font:14px var(--sans);border:0;border-bottom:2px solid transparent;border-radius:0;background:transparent;color:#a9c5c8} +.terminal-tabs button:hover{background:transparent;color:#dff9f2} +.terminal-tabs button[aria-pressed=true]{background:transparent;border-color:var(--signal);color:#e6f1ef} +.terminal-tabs span{font:10px var(--mono);color:#a9c5c8;margin-left:4px} +.terminal-toolbar{padding:17px 42px;border:0;background:transparent;color:#a9c5c8;font:11px var(--mono)} +.text-button{min-height:25px;padding:0;border:0;border-bottom:1px solid #d6f0ed81;border-radius:0;background:transparent;font:11px var(--mono);color:#e6f1ef} +.text-button:hover{background:transparent;border-color:#dff9f2} +.terminal-body{padding:21px 42px 34px;background:transparent;scrollbar-color:#718e95 #0b1b24} +.terminal-footer{display:none} +.section-heading{margin:0 0 18px;min-height:30px} +.section-heading .eyebrow{font:11px var(--mono)} +.section-heading .button{min-height:27px;padding:0;border:0;border-bottom:1px solid #d6f0eda3;border-radius:0;background:transparent;color:#e6f1ef;font:12px var(--sans)} +.section-heading .button:hover{background:transparent;color:#dff9f2;border-color:#dff9f2} +.search{display:flex;align-items:center;gap:5px;border:0;border-bottom:1px solid #d6f0ed6d;background:transparent} +.search>span{font-size:22px;color:#a9c5c8}.search input{padding:9px 2px;font:13px var(--sans);background:transparent;border:0;outline-offset:1px} +.plot-list{max-height:235px;margin-top:13px} +.plot-card{border:0;border-bottom:1px solid #d6f0ed42;border-radius:0;padding:14px 4px;background:transparent} +.plot-card:hover{background:transparent;color:#dff9f2} +.plot-card[aria-pressed=true]{background:transparent;border:0;border-bottom:1px solid #d6f0ed42;border-left:0;padding-left:4px;color:var(--signal);box-shadow:none} +.plot-card[aria-pressed=true] .arrow{color:var(--signal)} +.plot-card strong{font:500 15px var(--sans)}.plot-card small{font:11px var(--sans);color:#a9c5c8;margin-top:3px} +.plant-icon{font-size:10px;color:#c7dddb}.arrow{font:16px var(--sans)} +.section-divider{border-top:1px solid #d6f0ed50;margin:29px 0 17px;padding-top:18px;font:11px var(--mono);color:#a9c5c8} +#plot-detail h3{font:400 24px var(--sans);letter-spacing:-.025em;margin:14px 0 19px} +dt{font:11px var(--mono);color:#a9c5c8}dd{font:14px/1.65 var(--sans)} +.record{border-color:#d6f0ed42}.record strong{font:13px var(--sans)}.record-value{font:13px var(--mono)} +.empty{font:13px/1.6 var(--sans);color:#a9c5c8} +.pill{font:11px var(--mono);color:#a9c5c8} +#key-form .button{border:1px solid #d6f0ed66;padding:7px 14px;background:#d6f0ed37;color:#e6f1ef} + +.operator-console{width:600px;resize:none;z-index:15;display:flex;flex-direction:column} +.console-titlebar{display:flex;align-items:flex-start;gap:17px;padding:44px 42px 22px;border:0;background:transparent} +.console-titlebar h2{margin:0;font:400 30px/1.2 var(--sans);letter-spacing:-.04em} +.console-titlebar #console-state{margin-top:11px;font:11px var(--mono);color:#a9c5c8} +.console-titlebar .close{margin-left:auto} +.console-tools{gap:25px;padding:6px 42px 20px;background:transparent;border-bottom:1px solid #d6f0ed44} +.console-tools button{min-height:26px;padding:0;border:0;border-bottom:1px solid transparent;border-radius:0;background:transparent;font:12px var(--sans);color:#a9c5c8} +.console-tools button:hover{background:transparent;border-color:#a9c5c8;color:#dff9f2} +.console-tools button:last-child{margin-left:auto} +.console-output{flex:1;padding:24px 42px;background:transparent;color:#e6f1ef;font:13px/1.7 var(--mono)} +.console-system{color:#a9c5c8}.console-command{color:#e6f1ef} +.console-error{border:0;background:#213642;color:#ffc4a0;padding:9px 42px} +#console-form{padding:16px 42px 7px;background:#0b1b24;border-top:1px solid #d6f0ed44} +#console-form label{font:11px var(--mono);color:#a9c5c8} +.console-input-row{gap:11px;border-bottom:1px solid #d6f0ed93} +.console-input-row>span{font:18px var(--mono);color:var(--signal)} +.console-input-row input{background:transparent;border:0;padding:11px 0;font:14px var(--mono)} +.console-input-row button{min-height:32px;padding:0;border:0;border-radius:0;background:transparent;font:12px var(--sans);color:var(--signal)} +.console-input-row button:hover{background:transparent;color:#dff9f2} +.console-footer{padding:10px 42px 21px;background:#0b1b24;font:10px var(--mono);color:#a9c5c8} +body.console-open .vitals,body.terminal-open .vitals{visibility:hidden} + +dialog{border:1px solid #d6f0ed70;border-radius:0;padding:32px;background:#09202c;box-shadow:0 30px 80px #000b;font-family:var(--sans)} +dialog::backdrop{background:#02080bd1} +dialog h2{font:400 27px var(--sans);letter-spacing:-.025em}dialog p{font:13px/1.65 var(--sans)} +dialog input,dialog textarea,dialog select{background:#0b1b24} +dialog form>.button,.primary{background:var(--signal);border:1px solid var(--signal);color:#09202c;font:500 14px var(--sans);border-radius:0} +dialog form>.button:hover,.primary:hover:not(:disabled){background:#e6f1ef;border-color:#e6f1ef;color:#09202c} +.notice{top:28px;left:40px;border-radius:0;background:#213642}.toast{top:28px;border-radius:0;background:#e9f6f2;color:#09202c} +#object-hint{bottom:43px;border-radius:0;background:#213642} +#scene-loading,#scene-fallback{border-radius:0;background:#09202c} + +:root{font-size:16px} +button,input,textarea,select,label{font-family:var(--sans)} +.vitals-heading,.vitals-heading strong,.vital-line,.vital-line strong,.vitals>small{font-size:16px;letter-spacing:0} +.vitals-heading{padding-bottom:20px}.vital-line{margin-top:8px}.vitals>small{margin-top:16px} +.command-dock button{font:22px var(--display);letter-spacing:0} +.dock-end,.command-dock small{font-size:16px} +.camera-controls button{font:24px var(--display)}.camera-controls #motion-toggle{font:16px var(--sans)} +.terminal{width:500px}.operator-console{width:620px} +.terminal-header .eyebrow,.eyebrow{font-size:16px;letter-spacing:0} +.terminal-header h2{font:33px/1.2 var(--display);letter-spacing:0} +.close{font:22px var(--display)} +.terminal-tabs button,.terminal-tabs span,.terminal-toolbar,.text-button{font-size:16px} +.section-heading .button,.search input,.section-divider,.plot-card strong,.plot-card small,#plot-detail h3,dt,dd,.record strong,.record-value,.empty,.pill,#key-form .button{font-size:16px} +#plot-detail h3{font:22px var(--display);letter-spacing:0} +.plot-card strong{font-family:var(--display)} +.console-titlebar h2{font:33px var(--display);letter-spacing:0} +.console-titlebar #console-state,.console-tools button,.console-output,#console-form label,.console-input-row input,.console-input-row button,.console-footer{font-size:16px} +.console-output{line-height:1.5}.console-input-row>span{font-size:24px} +dialog h2{font:33px var(--display);letter-spacing:0}dialog p,dialog form>.button{font-size:16px} + +@media(max-width:900px){.vitals,.command-dock{left:24px}.terminal{width:430px}.operator-console{width:520px}.camera-controls{right:24px}} +@media(max-width:700px){ + .vitals{left:16px;bottom:153px;width:calc(100% - 32px);padding:0;background:linear-gradient(90deg,#071017e8,transparent)} + .vitals-heading{padding:0 0 4px;font-size:9px}.vitals-heading strong{font-size:9px} + .vital-line{display:inline-flex;gap:5px;margin:8px 12px 0 0;font-size:9px}.vital-line strong{font-size:10px}.vitals>small{font-size:8px;margin-top:7px} + .command-dock{left:16px;right:16px;bottom:max(12px,env(safe-area-inset-bottom));width:auto;display:flex;gap:18px;min-height:0;padding:0;grid-template-columns:none} + .command-dock button{flex:1;width:auto;min-height:49px;padding:0 1px;font-size:17px;border-top:1px solid #d6f0ed60} + .command-dock button:last-child{border-bottom:0}.command-dock #console-launch{grid-column:auto} + .dock-end{font-size:14px;gap:7px}.command-dock small{font-size:9px} + .camera-controls{right:16px;bottom:95px;display:flex;gap:9px;max-width:none;background:transparent;flex-wrap:nowrap;justify-content:initial} + .camera-controls button{min-width:24px;min-height:31px;padding:0;font-size:17px}.camera-controls button:last-child{flex-basis:auto}.camera-controls #motion-toggle{font-size:11px;min-width:0;padding-left:11px} + .terminal,.operator-console{inset:0;width:100%;height:100svh;max-width:none;max-height:none;min-height:0;border-left:0} + .terminal-header{padding:27px 24px 14px}.terminal-header h2{font-size:31px}.terminal-tabs{padding:0 24px;gap:20px}.terminal-tabs button{font-size:13px;min-height:43px} + .terminal-toolbar{padding:12px 24px}.terminal-body{padding:17px 24px 30px}.plot-list{max-height:185px} + .operator-console{width:100%;resize:none}.console-titlebar{padding:27px 24px 17px}.console-titlebar h2{font-size:25px} + .console-tools{padding:7px 24px 16px;gap:13px}.console-tools button{font-size:11px}.console-output{padding:20px 24px;font-size:12px} + #console-form{padding:13px 24px 5px}.console-input-row input{font-size:16px;padding:9px 0}.console-footer{padding:9px 24px 17px;font-size:9px} + .notice{top:14px;left:16px}.toast{top:14px}#object-hint{bottom:114px}dialog{padding:22px} +} +@media(max-height:600px) and (min-width:701px){.vitals{bottom:218px}.terminal-header,.console-titlebar{padding-top:24px}} +@media(prefers-reduced-motion:reduce){.terminal,.operator-console{animation:none}} +@media(prefers-contrast:more),(prefers-reduced-transparency:reduce){.terminal,.operator-console,dialog{background:#0b1b24;backdrop-filter:none;-webkit-backdrop-filter:none}.vitals{background:#071017}} +@supports not (backdrop-filter:blur(1px)){.terminal,.operator-console{background:#0b1b24f5}} + +:root{--ink:#edf8f5;--muted:#b7cece;--line:#e5ffff32;--surface:#0b2330a8;--signal:#d9f3e9} +button{color:var(--ink)}button:hover:not(:disabled),button[aria-pressed=true],button[aria-expanded=true]{color:#fff} +button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,[tabindex]:focus-visible{outline-color:#ecfffb} +input,textarea,select{background:#09212d8a;border-color:#dcfaf680;color:#effbf8} +input::placeholder,textarea::placeholder{color:#abc6c7} +.operator-rail{ + position:absolute;z-index:6;left:24px;bottom:24px;width:330px;padding:24px 24px 17px; + border:1px solid #e1ffff30;border-radius:16px; + background:#1b2d365c; + box-shadow:0 20px 54px #0006,inset 0 1px 0 #ffffff25; + backdrop-filter:blur(28px) saturate(112%);-webkit-backdrop-filter:blur(28px) saturate(112%); +} +.operator-rail .vitals,.operator-rail .command-dock{position:relative;left:auto;right:auto;bottom:auto;width:auto;margin:0;background:transparent;border:0;box-shadow:none;backdrop-filter:none;-webkit-backdrop-filter:none} +.operator-rail .vitals{padding:0 0 22px} +.operator-rail .command-dock{display:block;padding:0} +body.terminal-open .operator-rail .vitals,body.console-open .operator-rail .vitals{visibility:visible} +.vitals-heading,.vital-line>span,.vitals>small{color:#c8dcda}.vitals-heading strong,.vital-line strong{color:#f2fffb} +.command-dock button{border-color:#d8f9f754;min-height:62px}.command-dock button:last-child{border-color:#d8f9f754} +.command-dock button:hover,.command-dock button[aria-expanded=true],.command-dock button[aria-expanded=true] .dock-label{color:#fff} +.dock-end,.command-dock small{color:#d7edeb} +#console-indicator{background:#91acac}#console-indicator.connected{background:#ddfff2;box-shadow:0 0 8px #b4eed9} +.camera-controls{ + right:24px;bottom:24px;gap:11px;padding:5px 17px; + background:#1b2d3666;border:1px solid #e1ffff30;border-radius:12px; + box-shadow:0 14px 36px #0005,inset 0 1px 0 #ffffff20; + backdrop-filter:blur(22px) saturate(110%);-webkit-backdrop-filter:blur(22px) saturate(110%); +} +.camera-controls button{color:#e7f8f5;opacity:1}.camera-controls #motion-toggle{border-color:#dcf9f65c} +.terminal,.operator-console{ + top:18px;right:18px;bottom:18px;height:auto;border:1px solid #e4ffff38;border-radius:16px; + background:#1b2e39a8; + box-shadow:0 26px 76px #0008,inset 0 1px 0 #ffffff27; + backdrop-filter:blur(30px) saturate(112%) brightness(.82);-webkit-backdrop-filter:blur(30px) saturate(112%) brightness(.82); +} +.terminal-header,.terminal-toolbar,.terminal-body,.console-titlebar,.console-tools,.console-output{background:transparent} +.terminal-header .eyebrow,.eyebrow,.terminal-toolbar,.section-divider,dt,.record small,.console-titlebar #console-state{color:#c4dcdb} +.terminal-header h2,#plot-detail h3,.console-titlebar h2{color:#f2fffb} +.terminal-tabs,.console-tools{border-color:#d8f9f744} +.terminal-tabs button{color:#c9dddd}.terminal-tabs button[aria-pressed=true]{border-color:#e1fff3;color:#fff} +.terminal-tabs span,.text-button,.section-heading .button{color:#e1f7f4} +.text-button,.section-heading .button,.search,.console-input-row{border-color:#d8f9f779} +.plot-card,.plot-card[aria-pressed=true],.record,.section-divider{border-color:#d8f9f741} +.plot-card[aria-pressed=true],.plot-card[aria-pressed=true] .arrow{color:#e8fff0} +.plot-card small,.empty,.pill{color:#bfd6d3} +.console-tools button{color:#d0e5e2}.console-output{color:#eefcf7}.console-system{color:#bcd9cf}.console-command{color:#e5f6d7} +#console-form,.console-footer{background:#071e2b72;border-color:#d8f9f741} +.console-input-row input{background:transparent;border:0}.console-input-row>span,.console-input-row button{color:#e7fff0} +.console-footer{color:#bdd6d3} +#key-form .button{background:#d8f5e124;border-color:#d8f5e16e;color:#f0fff6} +dialog{background:#1b2e39c9;border-color:#e4ffff48;border-radius:16px;backdrop-filter:blur(28px);-webkit-backdrop-filter:blur(28px)} +dialog input,dialog textarea,dialog select{background:#081f2bbb} +dialog form>.button,.primary{background:#e0f7ea;border-color:#e0f7ea;color:#12312b} +dialog form>.button:hover,.primary:hover:not(:disabled){background:#fff;border-color:#fff;color:#12312b} +.toast{background:#e8faf5;color:#11302b;border-color:#e8faf5;border-radius:16px} +.notice{background:#263c43d9;border-color:#dff5ed6b;border-radius:16px;color:#f0fff9} +#object-hint{background:#0a2b37ca;border-color:#e2f6e878;border-radius:14px;color:#f5fff3} +#scene-loading,#scene-fallback{background:#0b2936c9;border-color:#e4ffff71;border-radius:20px;backdrop-filter:blur(22px)} +@media(max-width:900px){.operator-rail{left:18px}.terminal{width:440px}.operator-console{width:540px}.camera-controls{right:18px}} +@media(max-width:700px){ + .operator-rail{left:10px;right:10px;bottom:10px;width:auto;padding:13px 16px 9px;border-radius:14px} + .operator-rail .vitals{width:auto;padding:0 0 8px;background:transparent} + .operator-rail .command-dock{display:flex;gap:14px;width:auto} + .command-dock button{min-height:44px}.command-dock button:last-child{border-bottom:0} + .camera-controls{right:12px;bottom:150px;padding:2px 11px;border-radius:12px} + .terminal,.operator-console{inset:0;width:100%;height:100svh;max-width:none;max-height:none;border:0;border-radius:0} +} +@media(prefers-contrast:more),(prefers-reduced-transparency:reduce){ + .operator-rail,.camera-controls,.terminal,.operator-console,dialog{background:#102a35f7;border-color:#e8fffa9c;backdrop-filter:none;-webkit-backdrop-filter:none} + .operator-rail::before{display:none} +} +@supports not (backdrop-filter:blur(1px)){.operator-rail,.camera-controls,.terminal,.operator-console,dialog{background:#102a35ef}} + +.command-dock{ + position:absolute;z-index:8;left:24px;right:auto;top:24px;bottom:auto;width:auto;min-height:0; + display:flex;gap:0;padding:3px 8px; + background:#1b2d3666;border:1px solid #e1ffff30;border-radius:12px; + box-shadow:0 14px 36px #0005,inset 0 1px 0 #ffffff20; + backdrop-filter:blur(22px) saturate(110%);-webkit-backdrop-filter:blur(22px) saturate(110%); +} +.command-dock button{width:auto;min-width:143px;min-height:46px;padding:0 13px;border:0;font-size:16px;gap:17px} +.command-dock button+button{border-left:1px solid #d8f9f73c}.command-dock button:last-child{border-bottom:0} +.command-dock .dock-end{gap:7px;font-size:13px}.command-dock small{font-size:12px} +.operator-rail{left:24px;bottom:24px;width:344px;padding:19px 21px} +.operator-rail .vitals{padding:0} +.camera-controls{top:24px;bottom:auto;right:24px} +.terminal,.operator-console{ + position:absolute;top:87px;right:24px;bottom:auto;left:auto; + width:500px;height:min(680px,calc(100svh - 111px));max-height:calc(100svh - 48px);min-height:270px; +} +.operator-console{top:100px;right:auto;left:max(24px,calc(50% - 430px));width:540px;height:min(500px,calc(100svh - 140px));max-width:calc(100vw - 48px)} +.terminal-header,.console-titlebar{cursor:grab;touch-action:none;user-select:none} +.terminal-header:active,.console-titlebar:active{cursor:grabbing} +.terminal-header button,.console-titlebar button{cursor:pointer} +@media(max-width:900px){ + .command-dock{left:18px;top:18px}.camera-controls{top:18px;right:18px} + .terminal{width:min(450px,calc(100vw - 36px));right:18px} + .operator-console{left:18px;width:min(540px,calc(100vw - 36px))} +} +@media(max-width:700px){ + .command-dock{left:10px;right:auto;top:10px;bottom:auto;width:calc(100% - 115px);padding:1px 3px;gap:0;display:flex} + .command-dock button{flex:1;width:auto;min-width:0;min-height:40px;padding:0 6px;font-size:12px} + .command-dock button+button{border-left:1px solid #d8f9f73c}.command-dock .dock-end{font-size:11px;gap:2px}.command-dock small{font-size:10px} + .camera-controls{top:62px;right:10px;bottom:auto;padding:2px 9px} + .operator-rail{left:10px;right:10px;bottom:10px;width:auto;padding:13px 16px} + .terminal,.operator-console{inset:0;width:100%;height:100svh;max-width:none;max-height:none;min-height:0;border:0;border-radius:0} + .terminal-header,.console-titlebar{cursor:default;touch-action:auto} +} +@media(prefers-contrast:more),(prefers-reduced-transparency:reduce){.command-dock{background:#102a35f7;backdrop-filter:none;-webkit-backdrop-filter:none}} +@supports not (backdrop-filter:blur(1px)){.command-dock{background:#102a35ef}} diff --git a/greenhouse/frontend/vendor/three/LICENSE b/greenhouse/frontend/vendor/three/LICENSE new file mode 100644 index 0000000..cf78143 --- /dev/null +++ b/greenhouse/frontend/vendor/three/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright © 2010-2025 three.js authors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/greenhouse/frontend/vendor/three/OrbitControls.js b/greenhouse/frontend/vendor/three/OrbitControls.js new file mode 100644 index 0000000..316790a --- /dev/null +++ b/greenhouse/frontend/vendor/three/OrbitControls.js @@ -0,0 +1,1490 @@ +import { + Controls, + MOUSE, + Quaternion, + Spherical, + TOUCH, + Vector2, + Vector3, + Plane, + Ray, + MathUtils +} from 'three'; + +const _changeEvent = { type: 'change' }; + +const _startEvent = { type: 'start' }; + +const _endEvent = { type: 'end' }; + +const _ray = new Ray(); +const _plane = new Plane(); +const _TILT_LIMIT = Math.cos( 70 * MathUtils.DEG2RAD ); + +const _v = new Vector3(); +const _twoPI = 2 * Math.PI; + +const _STATE = { + NONE: - 1, + ROTATE: 0, + DOLLY: 1, + PAN: 2, + TOUCH_ROTATE: 3, + TOUCH_PAN: 4, + TOUCH_DOLLY_PAN: 5, + TOUCH_DOLLY_ROTATE: 6 +}; +const _EPS = 0.000001; + +class OrbitControls extends Controls { + + constructor( object, domElement = null ) { + + super( object, domElement ); + + this.state = _STATE.NONE; + + this.target = new Vector3(); + + this.cursor = new Vector3(); + + this.minDistance = 0; + + this.maxDistance = Infinity; + + this.minZoom = 0; + + this.maxZoom = Infinity; + + this.minTargetRadius = 0; + + this.maxTargetRadius = Infinity; + + this.minPolarAngle = 0; + + this.maxPolarAngle = Math.PI; + + this.minAzimuthAngle = - Infinity; + + this.maxAzimuthAngle = Infinity; + + this.enableDamping = false; + + this.dampingFactor = 0.05; + + this.enableZoom = true; + + this.zoomSpeed = 1.0; + + this.enableRotate = true; + + this.rotateSpeed = 1.0; + + this.keyRotateSpeed = 1.0; + + this.enablePan = true; + + this.panSpeed = 1.0; + + this.screenSpacePanning = true; + + this.keyPanSpeed = 7.0; + + this.zoomToCursor = false; + + this.autoRotate = false; + + this.autoRotateSpeed = 2.0; + + this.keys = { LEFT: 'ArrowLeft', UP: 'ArrowUp', RIGHT: 'ArrowRight', BOTTOM: 'ArrowDown' }; + + this.mouseButtons = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.PAN }; + + this.touches = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN }; + + this.target0 = this.target.clone(); + + this.position0 = this.object.position.clone(); + + this.zoom0 = this.object.zoom; + + this._domElementKeyEvents = null; + + this._lastPosition = new Vector3(); + this._lastQuaternion = new Quaternion(); + this._lastTargetPosition = new Vector3(); + + this._quat = new Quaternion().setFromUnitVectors( object.up, new Vector3( 0, 1, 0 ) ); + this._quatInverse = this._quat.clone().invert(); + + this._spherical = new Spherical(); + this._sphericalDelta = new Spherical(); + + this._scale = 1; + this._panOffset = new Vector3(); + + this._rotateStart = new Vector2(); + this._rotateEnd = new Vector2(); + this._rotateDelta = new Vector2(); + + this._panStart = new Vector2(); + this._panEnd = new Vector2(); + this._panDelta = new Vector2(); + + this._dollyStart = new Vector2(); + this._dollyEnd = new Vector2(); + this._dollyDelta = new Vector2(); + + this._dollyDirection = new Vector3(); + this._mouse = new Vector2(); + this._performCursorZoom = false; + + this._pointers = []; + this._pointerPositions = {}; + + this._controlActive = false; + + this._onPointerMove = onPointerMove.bind( this ); + this._onPointerDown = onPointerDown.bind( this ); + this._onPointerUp = onPointerUp.bind( this ); + this._onContextMenu = onContextMenu.bind( this ); + this._onMouseWheel = onMouseWheel.bind( this ); + this._onKeyDown = onKeyDown.bind( this ); + + this._onTouchStart = onTouchStart.bind( this ); + this._onTouchMove = onTouchMove.bind( this ); + + this._onMouseDown = onMouseDown.bind( this ); + this._onMouseMove = onMouseMove.bind( this ); + + this._interceptControlDown = interceptControlDown.bind( this ); + this._interceptControlUp = interceptControlUp.bind( this ); + + if ( this.domElement !== null ) { + + this.connect( this.domElement ); + + } + + this.update(); + + } + + connect( element ) { + + super.connect( element ); + + this.domElement.addEventListener( 'pointerdown', this._onPointerDown ); + this.domElement.addEventListener( 'pointercancel', this._onPointerUp ); + + this.domElement.addEventListener( 'contextmenu', this._onContextMenu ); + this.domElement.addEventListener( 'wheel', this._onMouseWheel, { passive: false } ); + + const document = this.domElement.getRootNode(); + document.addEventListener( 'keydown', this._interceptControlDown, { passive: true, capture: true } ); + + this.domElement.style.touchAction = 'none'; + + } + + disconnect() { + + this.domElement.removeEventListener( 'pointerdown', this._onPointerDown ); + this.domElement.removeEventListener( 'pointermove', this._onPointerMove ); + this.domElement.removeEventListener( 'pointerup', this._onPointerUp ); + this.domElement.removeEventListener( 'pointercancel', this._onPointerUp ); + + this.domElement.removeEventListener( 'wheel', this._onMouseWheel ); + this.domElement.removeEventListener( 'contextmenu', this._onContextMenu ); + + this.stopListenToKeyEvents(); + + const document = this.domElement.getRootNode(); + document.removeEventListener( 'keydown', this._interceptControlDown, { capture: true } ); + + this.domElement.style.touchAction = 'auto'; + + } + + dispose() { + + this.disconnect(); + + } + + getPolarAngle() { + + return this._spherical.phi; + + } + + getAzimuthalAngle() { + + return this._spherical.theta; + + } + + getDistance() { + + return this.object.position.distanceTo( this.target ); + + } + + listenToKeyEvents( domElement ) { + + domElement.addEventListener( 'keydown', this._onKeyDown ); + this._domElementKeyEvents = domElement; + + } + + stopListenToKeyEvents() { + + if ( this._domElementKeyEvents !== null ) { + + this._domElementKeyEvents.removeEventListener( 'keydown', this._onKeyDown ); + this._domElementKeyEvents = null; + + } + + } + + saveState() { + + this.target0.copy( this.target ); + this.position0.copy( this.object.position ); + this.zoom0 = this.object.zoom; + + } + + reset() { + + this.target.copy( this.target0 ); + this.object.position.copy( this.position0 ); + this.object.zoom = this.zoom0; + + this.object.updateProjectionMatrix(); + this.dispatchEvent( _changeEvent ); + + this.update(); + + this.state = _STATE.NONE; + + } + + update( deltaTime = null ) { + + const position = this.object.position; + + _v.copy( position ).sub( this.target ); + + _v.applyQuaternion( this._quat ); + + this._spherical.setFromVector3( _v ); + + if ( this.autoRotate && this.state === _STATE.NONE ) { + + this._rotateLeft( this._getAutoRotationAngle( deltaTime ) ); + + } + + if ( this.enableDamping ) { + + this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor; + this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor; + + } else { + + this._spherical.theta += this._sphericalDelta.theta; + this._spherical.phi += this._sphericalDelta.phi; + + } + + let min = this.minAzimuthAngle; + let max = this.maxAzimuthAngle; + + if ( isFinite( min ) && isFinite( max ) ) { + + if ( min < - Math.PI ) min += _twoPI; else if ( min > Math.PI ) min -= _twoPI; + + if ( max < - Math.PI ) max += _twoPI; else if ( max > Math.PI ) max -= _twoPI; + + if ( min <= max ) { + + this._spherical.theta = Math.max( min, Math.min( max, this._spherical.theta ) ); + + } else { + + this._spherical.theta = ( this._spherical.theta > ( min + max ) / 2 ) ? + Math.max( min, this._spherical.theta ) : + Math.min( max, this._spherical.theta ); + + } + + } + + this._spherical.phi = Math.max( this.minPolarAngle, Math.min( this.maxPolarAngle, this._spherical.phi ) ); + + this._spherical.makeSafe(); + + if ( this.enableDamping === true ) { + + this.target.addScaledVector( this._panOffset, this.dampingFactor ); + + } else { + + this.target.add( this._panOffset ); + + } + + this.target.sub( this.cursor ); + this.target.clampLength( this.minTargetRadius, this.maxTargetRadius ); + this.target.add( this.cursor ); + + let zoomChanged = false; + + if ( this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera ) { + + this._spherical.radius = this._clampDistance( this._spherical.radius ); + + } else { + + const prevRadius = this._spherical.radius; + this._spherical.radius = this._clampDistance( this._spherical.radius * this._scale ); + zoomChanged = prevRadius != this._spherical.radius; + + } + + _v.setFromSpherical( this._spherical ); + + _v.applyQuaternion( this._quatInverse ); + + position.copy( this.target ).add( _v ); + + this.object.lookAt( this.target ); + + if ( this.enableDamping === true ) { + + this._sphericalDelta.theta *= ( 1 - this.dampingFactor ); + this._sphericalDelta.phi *= ( 1 - this.dampingFactor ); + + this._panOffset.multiplyScalar( 1 - this.dampingFactor ); + + } else { + + this._sphericalDelta.set( 0, 0, 0 ); + + this._panOffset.set( 0, 0, 0 ); + + } + + if ( this.zoomToCursor && this._performCursorZoom ) { + + let newRadius = null; + if ( this.object.isPerspectiveCamera ) { + + const prevRadius = _v.length(); + newRadius = this._clampDistance( prevRadius * this._scale ); + + const radiusDelta = prevRadius - newRadius; + this.object.position.addScaledVector( this._dollyDirection, radiusDelta ); + this.object.updateMatrixWorld(); + + zoomChanged = !! radiusDelta; + + } else if ( this.object.isOrthographicCamera ) { + + const mouseBefore = new Vector3( this._mouse.x, this._mouse.y, 0 ); + mouseBefore.unproject( this.object ); + + const prevZoom = this.object.zoom; + this.object.zoom = Math.max( this.minZoom, Math.min( this.maxZoom, this.object.zoom / this._scale ) ); + this.object.updateProjectionMatrix(); + + zoomChanged = prevZoom !== this.object.zoom; + + const mouseAfter = new Vector3( this._mouse.x, this._mouse.y, 0 ); + mouseAfter.unproject( this.object ); + + this.object.position.sub( mouseAfter ).add( mouseBefore ); + this.object.updateMatrixWorld(); + + newRadius = _v.length(); + + } else { + + console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.' ); + this.zoomToCursor = false; + + } + + if ( newRadius !== null ) { + + if ( this.screenSpacePanning ) { + + this.target.set( 0, 0, - 1 ) + .transformDirection( this.object.matrix ) + .multiplyScalar( newRadius ) + .add( this.object.position ); + + } else { + + _ray.origin.copy( this.object.position ); + _ray.direction.set( 0, 0, - 1 ).transformDirection( this.object.matrix ); + + if ( Math.abs( this.object.up.dot( _ray.direction ) ) < _TILT_LIMIT ) { + + this.object.lookAt( this.target ); + + } else { + + _plane.setFromNormalAndCoplanarPoint( this.object.up, this.target ); + _ray.intersectPlane( _plane, this.target ); + + } + + } + + } + + } else if ( this.object.isOrthographicCamera ) { + + const prevZoom = this.object.zoom; + this.object.zoom = Math.max( this.minZoom, Math.min( this.maxZoom, this.object.zoom / this._scale ) ); + + if ( prevZoom !== this.object.zoom ) { + + this.object.updateProjectionMatrix(); + zoomChanged = true; + + } + + } + + this._scale = 1; + this._performCursorZoom = false; + + if ( zoomChanged || + this._lastPosition.distanceToSquared( this.object.position ) > _EPS || + 8 * ( 1 - this._lastQuaternion.dot( this.object.quaternion ) ) > _EPS || + this._lastTargetPosition.distanceToSquared( this.target ) > _EPS ) { + + this.dispatchEvent( _changeEvent ); + + this._lastPosition.copy( this.object.position ); + this._lastQuaternion.copy( this.object.quaternion ); + this._lastTargetPosition.copy( this.target ); + + return true; + + } + + return false; + + } + + _getAutoRotationAngle( deltaTime ) { + + if ( deltaTime !== null ) { + + return ( _twoPI / 60 * this.autoRotateSpeed ) * deltaTime; + + } else { + + return _twoPI / 60 / 60 * this.autoRotateSpeed; + + } + + } + + _getZoomScale( delta ) { + + const normalizedDelta = Math.abs( delta * 0.01 ); + return Math.pow( 0.95, this.zoomSpeed * normalizedDelta ); + + } + + _rotateLeft( angle ) { + + this._sphericalDelta.theta -= angle; + + } + + _rotateUp( angle ) { + + this._sphericalDelta.phi -= angle; + + } + + _panLeft( distance, objectMatrix ) { + + _v.setFromMatrixColumn( objectMatrix, 0 ); + _v.multiplyScalar( - distance ); + + this._panOffset.add( _v ); + + } + + _panUp( distance, objectMatrix ) { + + if ( this.screenSpacePanning === true ) { + + _v.setFromMatrixColumn( objectMatrix, 1 ); + + } else { + + _v.setFromMatrixColumn( objectMatrix, 0 ); + _v.crossVectors( this.object.up, _v ); + + } + + _v.multiplyScalar( distance ); + + this._panOffset.add( _v ); + + } + + _pan( deltaX, deltaY ) { + + const element = this.domElement; + + if ( this.object.isPerspectiveCamera ) { + + const position = this.object.position; + _v.copy( position ).sub( this.target ); + let targetDistance = _v.length(); + + targetDistance *= Math.tan( ( this.object.fov / 2 ) * Math.PI / 180.0 ); + + this._panLeft( 2 * deltaX * targetDistance / element.clientHeight, this.object.matrix ); + this._panUp( 2 * deltaY * targetDistance / element.clientHeight, this.object.matrix ); + + } else if ( this.object.isOrthographicCamera ) { + + this._panLeft( deltaX * ( this.object.right - this.object.left ) / this.object.zoom / element.clientWidth, this.object.matrix ); + this._panUp( deltaY * ( this.object.top - this.object.bottom ) / this.object.zoom / element.clientHeight, this.object.matrix ); + + } else { + + console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' ); + this.enablePan = false; + + } + + } + + _dollyOut( dollyScale ) { + + if ( this.object.isPerspectiveCamera || this.object.isOrthographicCamera ) { + + this._scale /= dollyScale; + + } else { + + console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' ); + this.enableZoom = false; + + } + + } + + _dollyIn( dollyScale ) { + + if ( this.object.isPerspectiveCamera || this.object.isOrthographicCamera ) { + + this._scale *= dollyScale; + + } else { + + console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' ); + this.enableZoom = false; + + } + + } + + _updateZoomParameters( x, y ) { + + if ( ! this.zoomToCursor ) { + + return; + + } + + this._performCursorZoom = true; + + const rect = this.domElement.getBoundingClientRect(); + const dx = x - rect.left; + const dy = y - rect.top; + const w = rect.width; + const h = rect.height; + + this._mouse.x = ( dx / w ) * 2 - 1; + this._mouse.y = - ( dy / h ) * 2 + 1; + + this._dollyDirection.set( this._mouse.x, this._mouse.y, 1 ).unproject( this.object ).sub( this.object.position ).normalize(); + + } + + _clampDistance( dist ) { + + return Math.max( this.minDistance, Math.min( this.maxDistance, dist ) ); + + } + + _handleMouseDownRotate( event ) { + + this._rotateStart.set( event.clientX, event.clientY ); + + } + + _handleMouseDownDolly( event ) { + + this._updateZoomParameters( event.clientX, event.clientX ); + this._dollyStart.set( event.clientX, event.clientY ); + + } + + _handleMouseDownPan( event ) { + + this._panStart.set( event.clientX, event.clientY ); + + } + + _handleMouseMoveRotate( event ) { + + this._rotateEnd.set( event.clientX, event.clientY ); + + this._rotateDelta.subVectors( this._rotateEnd, this._rotateStart ).multiplyScalar( this.rotateSpeed ); + + const element = this.domElement; + + this._rotateLeft( _twoPI * this._rotateDelta.x / element.clientHeight ); + + this._rotateUp( _twoPI * this._rotateDelta.y / element.clientHeight ); + + this._rotateStart.copy( this._rotateEnd ); + + this.update(); + + } + + _handleMouseMoveDolly( event ) { + + this._dollyEnd.set( event.clientX, event.clientY ); + + this._dollyDelta.subVectors( this._dollyEnd, this._dollyStart ); + + if ( this._dollyDelta.y > 0 ) { + + this._dollyOut( this._getZoomScale( this._dollyDelta.y ) ); + + } else if ( this._dollyDelta.y < 0 ) { + + this._dollyIn( this._getZoomScale( this._dollyDelta.y ) ); + + } + + this._dollyStart.copy( this._dollyEnd ); + + this.update(); + + } + + _handleMouseMovePan( event ) { + + this._panEnd.set( event.clientX, event.clientY ); + + this._panDelta.subVectors( this._panEnd, this._panStart ).multiplyScalar( this.panSpeed ); + + this._pan( this._panDelta.x, this._panDelta.y ); + + this._panStart.copy( this._panEnd ); + + this.update(); + + } + + _handleMouseWheel( event ) { + + this._updateZoomParameters( event.clientX, event.clientY ); + + if ( event.deltaY < 0 ) { + + this._dollyIn( this._getZoomScale( event.deltaY ) ); + + } else if ( event.deltaY > 0 ) { + + this._dollyOut( this._getZoomScale( event.deltaY ) ); + + } + + this.update(); + + } + + _handleKeyDown( event ) { + + let needsUpdate = false; + + switch ( event.code ) { + + case this.keys.UP: + + if ( event.ctrlKey || event.metaKey || event.shiftKey ) { + + if ( this.enableRotate ) { + + this._rotateUp( _twoPI * this.keyRotateSpeed / this.domElement.clientHeight ); + + } + + } else { + + if ( this.enablePan ) { + + this._pan( 0, this.keyPanSpeed ); + + } + + } + + needsUpdate = true; + break; + + case this.keys.BOTTOM: + + if ( event.ctrlKey || event.metaKey || event.shiftKey ) { + + if ( this.enableRotate ) { + + this._rotateUp( - _twoPI * this.keyRotateSpeed / this.domElement.clientHeight ); + + } + + } else { + + if ( this.enablePan ) { + + this._pan( 0, - this.keyPanSpeed ); + + } + + } + + needsUpdate = true; + break; + + case this.keys.LEFT: + + if ( event.ctrlKey || event.metaKey || event.shiftKey ) { + + if ( this.enableRotate ) { + + this._rotateLeft( _twoPI * this.keyRotateSpeed / this.domElement.clientHeight ); + + } + + } else { + + if ( this.enablePan ) { + + this._pan( this.keyPanSpeed, 0 ); + + } + + } + + needsUpdate = true; + break; + + case this.keys.RIGHT: + + if ( event.ctrlKey || event.metaKey || event.shiftKey ) { + + if ( this.enableRotate ) { + + this._rotateLeft( - _twoPI * this.keyRotateSpeed / this.domElement.clientHeight ); + + } + + } else { + + if ( this.enablePan ) { + + this._pan( - this.keyPanSpeed, 0 ); + + } + + } + + needsUpdate = true; + break; + + } + + if ( needsUpdate ) { + + event.preventDefault(); + + this.update(); + + } + + } + + _handleTouchStartRotate( event ) { + + if ( this._pointers.length === 1 ) { + + this._rotateStart.set( event.pageX, event.pageY ); + + } else { + + const position = this._getSecondPointerPosition( event ); + + const x = 0.5 * ( event.pageX + position.x ); + const y = 0.5 * ( event.pageY + position.y ); + + this._rotateStart.set( x, y ); + + } + + } + + _handleTouchStartPan( event ) { + + if ( this._pointers.length === 1 ) { + + this._panStart.set( event.pageX, event.pageY ); + + } else { + + const position = this._getSecondPointerPosition( event ); + + const x = 0.5 * ( event.pageX + position.x ); + const y = 0.5 * ( event.pageY + position.y ); + + this._panStart.set( x, y ); + + } + + } + + _handleTouchStartDolly( event ) { + + const position = this._getSecondPointerPosition( event ); + + const dx = event.pageX - position.x; + const dy = event.pageY - position.y; + + const distance = Math.sqrt( dx * dx + dy * dy ); + + this._dollyStart.set( 0, distance ); + + } + + _handleTouchStartDollyPan( event ) { + + if ( this.enableZoom ) this._handleTouchStartDolly( event ); + + if ( this.enablePan ) this._handleTouchStartPan( event ); + + } + + _handleTouchStartDollyRotate( event ) { + + if ( this.enableZoom ) this._handleTouchStartDolly( event ); + + if ( this.enableRotate ) this._handleTouchStartRotate( event ); + + } + + _handleTouchMoveRotate( event ) { + + if ( this._pointers.length == 1 ) { + + this._rotateEnd.set( event.pageX, event.pageY ); + + } else { + + const position = this._getSecondPointerPosition( event ); + + const x = 0.5 * ( event.pageX + position.x ); + const y = 0.5 * ( event.pageY + position.y ); + + this._rotateEnd.set( x, y ); + + } + + this._rotateDelta.subVectors( this._rotateEnd, this._rotateStart ).multiplyScalar( this.rotateSpeed ); + + const element = this.domElement; + + this._rotateLeft( _twoPI * this._rotateDelta.x / element.clientHeight ); + + this._rotateUp( _twoPI * this._rotateDelta.y / element.clientHeight ); + + this._rotateStart.copy( this._rotateEnd ); + + } + + _handleTouchMovePan( event ) { + + if ( this._pointers.length === 1 ) { + + this._panEnd.set( event.pageX, event.pageY ); + + } else { + + const position = this._getSecondPointerPosition( event ); + + const x = 0.5 * ( event.pageX + position.x ); + const y = 0.5 * ( event.pageY + position.y ); + + this._panEnd.set( x, y ); + + } + + this._panDelta.subVectors( this._panEnd, this._panStart ).multiplyScalar( this.panSpeed ); + + this._pan( this._panDelta.x, this._panDelta.y ); + + this._panStart.copy( this._panEnd ); + + } + + _handleTouchMoveDolly( event ) { + + const position = this._getSecondPointerPosition( event ); + + const dx = event.pageX - position.x; + const dy = event.pageY - position.y; + + const distance = Math.sqrt( dx * dx + dy * dy ); + + this._dollyEnd.set( 0, distance ); + + this._dollyDelta.set( 0, Math.pow( this._dollyEnd.y / this._dollyStart.y, this.zoomSpeed ) ); + + this._dollyOut( this._dollyDelta.y ); + + this._dollyStart.copy( this._dollyEnd ); + + const centerX = ( event.pageX + position.x ) * 0.5; + const centerY = ( event.pageY + position.y ) * 0.5; + + this._updateZoomParameters( centerX, centerY ); + + } + + _handleTouchMoveDollyPan( event ) { + + if ( this.enableZoom ) this._handleTouchMoveDolly( event ); + + if ( this.enablePan ) this._handleTouchMovePan( event ); + + } + + _handleTouchMoveDollyRotate( event ) { + + if ( this.enableZoom ) this._handleTouchMoveDolly( event ); + + if ( this.enableRotate ) this._handleTouchMoveRotate( event ); + + } + + _addPointer( event ) { + + this._pointers.push( event.pointerId ); + + } + + _removePointer( event ) { + + delete this._pointerPositions[ event.pointerId ]; + + for ( let i = 0; i < this._pointers.length; i ++ ) { + + if ( this._pointers[ i ] == event.pointerId ) { + + this._pointers.splice( i, 1 ); + return; + + } + + } + + } + + _isTrackingPointer( event ) { + + for ( let i = 0; i < this._pointers.length; i ++ ) { + + if ( this._pointers[ i ] == event.pointerId ) return true; + + } + + return false; + + } + + _trackPointer( event ) { + + let position = this._pointerPositions[ event.pointerId ]; + + if ( position === undefined ) { + + position = new Vector2(); + this._pointerPositions[ event.pointerId ] = position; + + } + + position.set( event.pageX, event.pageY ); + + } + + _getSecondPointerPosition( event ) { + + const pointerId = ( event.pointerId === this._pointers[ 0 ] ) ? this._pointers[ 1 ] : this._pointers[ 0 ]; + + return this._pointerPositions[ pointerId ]; + + } + + _customWheelEvent( event ) { + + const mode = event.deltaMode; + + const newEvent = { + clientX: event.clientX, + clientY: event.clientY, + deltaY: event.deltaY, + }; + + switch ( mode ) { + + case 1: + newEvent.deltaY *= 16; + break; + + case 2: + newEvent.deltaY *= 100; + break; + + } + + if ( event.ctrlKey && ! this._controlActive ) { + + newEvent.deltaY *= 10; + + } + + return newEvent; + + } + +} + +function onPointerDown( event ) { + + if ( this.enabled === false ) return; + + if ( this._pointers.length === 0 ) { + + this.domElement.setPointerCapture( event.pointerId ); + + this.domElement.addEventListener( 'pointermove', this._onPointerMove ); + this.domElement.addEventListener( 'pointerup', this._onPointerUp ); + + } + + if ( this._isTrackingPointer( event ) ) return; + + this._addPointer( event ); + + if ( event.pointerType === 'touch' ) { + + this._onTouchStart( event ); + + } else { + + this._onMouseDown( event ); + + } + +} + +function onPointerMove( event ) { + + if ( this.enabled === false ) return; + + if ( event.pointerType === 'touch' ) { + + this._onTouchMove( event ); + + } else { + + this._onMouseMove( event ); + + } + +} + +function onPointerUp( event ) { + + this._removePointer( event ); + + switch ( this._pointers.length ) { + + case 0: + + this.domElement.releasePointerCapture( event.pointerId ); + + this.domElement.removeEventListener( 'pointermove', this._onPointerMove ); + this.domElement.removeEventListener( 'pointerup', this._onPointerUp ); + + this.dispatchEvent( _endEvent ); + + this.state = _STATE.NONE; + + break; + + case 1: + + const pointerId = this._pointers[ 0 ]; + const position = this._pointerPositions[ pointerId ]; + + this._onTouchStart( { pointerId: pointerId, pageX: position.x, pageY: position.y } ); + + break; + + } + +} + +function onMouseDown( event ) { + + let mouseAction; + + switch ( event.button ) { + + case 0: + + mouseAction = this.mouseButtons.LEFT; + break; + + case 1: + + mouseAction = this.mouseButtons.MIDDLE; + break; + + case 2: + + mouseAction = this.mouseButtons.RIGHT; + break; + + default: + + mouseAction = - 1; + + } + + switch ( mouseAction ) { + + case MOUSE.DOLLY: + + if ( this.enableZoom === false ) return; + + this._handleMouseDownDolly( event ); + + this.state = _STATE.DOLLY; + + break; + + case MOUSE.ROTATE: + + if ( event.ctrlKey || event.metaKey || event.shiftKey ) { + + if ( this.enablePan === false ) return; + + this._handleMouseDownPan( event ); + + this.state = _STATE.PAN; + + } else { + + if ( this.enableRotate === false ) return; + + this._handleMouseDownRotate( event ); + + this.state = _STATE.ROTATE; + + } + + break; + + case MOUSE.PAN: + + if ( event.ctrlKey || event.metaKey || event.shiftKey ) { + + if ( this.enableRotate === false ) return; + + this._handleMouseDownRotate( event ); + + this.state = _STATE.ROTATE; + + } else { + + if ( this.enablePan === false ) return; + + this._handleMouseDownPan( event ); + + this.state = _STATE.PAN; + + } + + break; + + default: + + this.state = _STATE.NONE; + + } + + if ( this.state !== _STATE.NONE ) { + + this.dispatchEvent( _startEvent ); + + } + +} + +function onMouseMove( event ) { + + switch ( this.state ) { + + case _STATE.ROTATE: + + if ( this.enableRotate === false ) return; + + this._handleMouseMoveRotate( event ); + + break; + + case _STATE.DOLLY: + + if ( this.enableZoom === false ) return; + + this._handleMouseMoveDolly( event ); + + break; + + case _STATE.PAN: + + if ( this.enablePan === false ) return; + + this._handleMouseMovePan( event ); + + break; + + } + +} + +function onMouseWheel( event ) { + + if ( this.enabled === false || this.enableZoom === false || this.state !== _STATE.NONE ) return; + + event.preventDefault(); + + this.dispatchEvent( _startEvent ); + + this._handleMouseWheel( this._customWheelEvent( event ) ); + + this.dispatchEvent( _endEvent ); + +} + +function onKeyDown( event ) { + + if ( this.enabled === false ) return; + + this._handleKeyDown( event ); + +} + +function onTouchStart( event ) { + + this._trackPointer( event ); + + switch ( this._pointers.length ) { + + case 1: + + switch ( this.touches.ONE ) { + + case TOUCH.ROTATE: + + if ( this.enableRotate === false ) return; + + this._handleTouchStartRotate( event ); + + this.state = _STATE.TOUCH_ROTATE; + + break; + + case TOUCH.PAN: + + if ( this.enablePan === false ) return; + + this._handleTouchStartPan( event ); + + this.state = _STATE.TOUCH_PAN; + + break; + + default: + + this.state = _STATE.NONE; + + } + + break; + + case 2: + + switch ( this.touches.TWO ) { + + case TOUCH.DOLLY_PAN: + + if ( this.enableZoom === false && this.enablePan === false ) return; + + this._handleTouchStartDollyPan( event ); + + this.state = _STATE.TOUCH_DOLLY_PAN; + + break; + + case TOUCH.DOLLY_ROTATE: + + if ( this.enableZoom === false && this.enableRotate === false ) return; + + this._handleTouchStartDollyRotate( event ); + + this.state = _STATE.TOUCH_DOLLY_ROTATE; + + break; + + default: + + this.state = _STATE.NONE; + + } + + break; + + default: + + this.state = _STATE.NONE; + + } + + if ( this.state !== _STATE.NONE ) { + + this.dispatchEvent( _startEvent ); + + } + +} + +function onTouchMove( event ) { + + this._trackPointer( event ); + + switch ( this.state ) { + + case _STATE.TOUCH_ROTATE: + + if ( this.enableRotate === false ) return; + + this._handleTouchMoveRotate( event ); + + this.update(); + + break; + + case _STATE.TOUCH_PAN: + + if ( this.enablePan === false ) return; + + this._handleTouchMovePan( event ); + + this.update(); + + break; + + case _STATE.TOUCH_DOLLY_PAN: + + if ( this.enableZoom === false && this.enablePan === false ) return; + + this._handleTouchMoveDollyPan( event ); + + this.update(); + + break; + + case _STATE.TOUCH_DOLLY_ROTATE: + + if ( this.enableZoom === false && this.enableRotate === false ) return; + + this._handleTouchMoveDollyRotate( event ); + + this.update(); + + break; + + default: + + this.state = _STATE.NONE; + + } + +} + +function onContextMenu( event ) { + + if ( this.enabled === false ) return; + + event.preventDefault(); + +} + +function interceptControlDown( event ) { + + if ( event.key === 'Control' ) { + + this._controlActive = true; + + const document = this.domElement.getRootNode(); + + document.addEventListener( 'keyup', this._interceptControlUp, { passive: true, capture: true } ); + + } + +} + +function interceptControlUp( event ) { + + if ( event.key === 'Control' ) { + + this._controlActive = false; + + const document = this.domElement.getRootNode(); + + document.removeEventListener( 'keyup', this._interceptControlUp, { passive: true, capture: true } ); + + } + +} + +export { OrbitControls }; diff --git a/greenhouse/frontend/vendor/three/VERSION.txt b/greenhouse/frontend/vendor/three/VERSION.txt new file mode 100644 index 0000000..7190c76 --- /dev/null +++ b/greenhouse/frontend/vendor/three/VERSION.txt @@ -0,0 +1,5 @@ +Three.js 0.180.0 (r180) +https://github.com/mrdoob/three.js +Source: https://registry.npmjs.org/three/-/three-0.180.0.tgz +Archive SHA256: ad66d724565ee29a2467277fa84daa5ed0211d6b8d446e9ef29f6bae0cd14144 +License: MIT; see LICENSE. Unmodified distribution files. diff --git a/greenhouse/frontend/vendor/three/three.core.min.js b/greenhouse/frontend/vendor/three/three.core.min.js new file mode 100644 index 0000000..70c4097 --- /dev/null +++ b/greenhouse/frontend/vendor/three/three.core.min.js @@ -0,0 +1,6 @@ +/** + * @license + * Copyright 2010-2025 Three.js Authors + * SPDX-License-Identifier: MIT + */ +const t="180",e={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},s={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},i=0,r=1,n=2,a=3,o=0,h=1,l=2,c=3,u=0,d=1,p=2,m=0,y=1,g=2,f=3,x=4,b=5,v=100,w=101,M=102,S=103,_=104,A=200,T=201,z=202,C=203,I=204,B=205,k=206,E=207,R=208,P=209,O=210,N=211,V=212,F=213,L=214,j=0,D=1,W=2,U=3,H=4,q=5,J=6,X=7,Y=0,Z=1,G=2,$=0,Q=1,K=2,tt=3,et=4,st=5,it=6,rt=7,nt="attached",at="detached",ot=300,ht=301,lt=302,ct=303,ut=304,dt=306,pt=1e3,mt=1001,yt=1002,gt=1003,ft=1004,xt=1004,bt=1005,vt=1005,wt=1006,Mt=1007,St=1007,_t=1008,At=1008,Tt=1009,zt=1010,Ct=1011,It=1012,Bt=1013,kt=1014,Et=1015,Rt=1016,Pt=1017,Ot=1018,Nt=1020,Vt=35902,Ft=35899,Lt=1021,jt=1022,Dt=1023,Wt=1026,Ut=1027,Ht=1028,qt=1029,Jt=1030,Xt=1031,Yt=1032,Zt=1033,Gt=33776,$t=33777,Qt=33778,Kt=33779,te=35840,ee=35841,se=35842,ie=35843,re=36196,ne=37492,ae=37496,oe=37808,he=37809,le=37810,ce=37811,ue=37812,de=37813,pe=37814,me=37815,ye=37816,ge=37817,fe=37818,xe=37819,be=37820,ve=37821,we=36492,Me=36494,Se=36495,_e=36283,Ae=36284,Te=36285,ze=36286,Ce=2200,Ie=2201,Be=2202,ke=2300,Ee=2301,Re=2302,Pe=2400,Oe=2401,Ne=2402,Ve=2500,Fe=2501,Le=0,je=1,De=2,We=3200,Ue=3201,He=3202,qe=3203,Je=0,Xe=1,Ye="",Ze="srgb",Ge="srgb-linear",$e="linear",Qe="srgb",Ke=0,ts=7680,es=7681,ss=7682,is=7683,rs=34055,ns=34056,as=5386,os=512,hs=513,ls=514,cs=515,us=516,ds=517,ps=518,ms=519,ys=512,gs=513,fs=514,xs=515,bs=516,vs=517,ws=518,Ms=519,Ss=35044,_s=35048,As=35040,Ts=35045,zs=35049,Cs=35041,Is=35046,Bs=35050,ks=35042,Es="100",Rs="300 es",Ps=2e3,Os=2001,Ns={COMPUTE:"compute",RENDER:"render"},Vs={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},Fs={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};class Ls{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const s=this._listeners;void 0===s[t]&&(s[t]=[]),-1===s[t].indexOf(e)&&s[t].push(e)}hasEventListener(t,e){const s=this._listeners;return void 0!==s&&(void 0!==s[t]&&-1!==s[t].indexOf(e))}removeEventListener(t,e){const s=this._listeners;if(void 0===s)return;const i=s[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const s=e[t.type];if(void 0!==s){t.target=this;const e=s.slice(0);for(let s=0,i=e.length;s>8&255]+js[t>>16&255]+js[t>>24&255]+"-"+js[255&e]+js[e>>8&255]+"-"+js[e>>16&15|64]+js[e>>24&255]+"-"+js[63&s|128]+js[s>>8&255]+"-"+js[s>>16&255]+js[s>>24&255]+js[255&i]+js[i>>8&255]+js[i>>16&255]+js[i>>24&255]).toLowerCase()}function qs(t,e,s){return Math.max(e,Math.min(s,t))}function Js(t,e){return(t%e+e)%e}function Xs(t,e,s){return(1-s)*t+s*e}function Ys(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Zs(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const Gs={DEG2RAD:Ws,RAD2DEG:Us,generateUUID:Hs,clamp:qs,euclideanModulo:Js,mapLinear:function(t,e,s,i,r){return i+(t-e)*(r-i)/(s-e)},inverseLerp:function(t,e,s){return t!==e?(s-t)/(e-t):0},lerp:Xs,damp:function(t,e,s,i){return Xs(t,e,1-Math.exp(-s*i))},pingpong:function(t,e=1){return e-Math.abs(Js(t,2*e)-e)},smoothstep:function(t,e,s){return t<=e?0:t>=s?1:(t=(t-e)/(s-e))*t*(3-2*t)},smootherstep:function(t,e,s){return t<=e?0:t>=s?1:(t=(t-e)/(s-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(Ds=t);let e=Ds+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296},degToRad:function(t){return t*Ws},radToDeg:function(t){return t*Us},isPowerOfTwo:function(t){return!(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,s,i,r){const n=Math.cos,a=Math.sin,o=n(s/2),h=a(s/2),l=n((e+i)/2),c=a((e+i)/2),u=n((e-i)/2),d=a((e-i)/2),p=n((i-e)/2),m=a((i-e)/2);switch(r){case"XYX":t.set(o*c,h*u,h*d,o*l);break;case"YZY":t.set(h*d,o*c,h*u,o*l);break;case"ZXZ":t.set(h*u,h*d,o*c,o*l);break;case"XZX":t.set(o*c,h*m,h*p,o*l);break;case"YXY":t.set(h*p,o*c,h*m,o*l);break;case"ZYZ":t.set(h*m,h*p,o*c,o*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:Zs,denormalize:Ys};class $s{constructor(t=0,e=0){$s.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,s=this.y,i=t.elements;return this.x=i[0]*e+i[3]*s+i[6],this.y=i[1]*e+i[4]*s+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=qs(this.x,t.x,e.x),this.y=qs(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=qs(this.x,t,e),this.y=qs(this.y,t,e),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(qs(s,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(qs(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y;return e*e+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const s=Math.cos(e),i=Math.sin(e),r=this.x-t.x,n=this.y-t.y;return this.x=r*s-n*i+t.x,this.y=r*i+n*s+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Qs{constructor(t=0,e=0,s=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=s,this._w=i}static slerpFlat(t,e,s,i,r,n,a){let o=s[i+0],h=s[i+1],l=s[i+2],c=s[i+3];const u=r[n+0],d=r[n+1],p=r[n+2],m=r[n+3];if(0===a)return t[e+0]=o,t[e+1]=h,t[e+2]=l,void(t[e+3]=c);if(1===a)return t[e+0]=u,t[e+1]=d,t[e+2]=p,void(t[e+3]=m);if(c!==m||o!==u||h!==d||l!==p){let t=1-a;const e=o*u+h*d+l*p+c*m,s=e>=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),n=Math.atan2(r,e*s);t=Math.sin(t*n)/r,a=Math.sin(a*n)/r}const r=a*s;if(o=o*t+u*r,h=h*t+d*r,l=l*t+p*r,c=c*t+m*r,t===1-a){const t=1/Math.sqrt(o*o+h*h+l*l+c*c);o*=t,h*=t,l*=t,c*=t}}t[e]=o,t[e+1]=h,t[e+2]=l,t[e+3]=c}static multiplyQuaternionsFlat(t,e,s,i,r,n){const a=s[i],o=s[i+1],h=s[i+2],l=s[i+3],c=r[n],u=r[n+1],d=r[n+2],p=r[n+3];return t[e]=a*p+l*c+o*d-h*u,t[e+1]=o*p+l*u+h*c-a*d,t[e+2]=h*p+l*d+a*u-o*c,t[e+3]=l*p-a*c-o*u-h*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,s,i){return this._x=t,this._y=e,this._z=s,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const s=t._x,i=t._y,r=t._z,n=t._order,a=Math.cos,o=Math.sin,h=a(s/2),l=a(i/2),c=a(r/2),u=o(s/2),d=o(i/2),p=o(r/2);switch(n){case"XYZ":this._x=u*l*c+h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c-u*d*p;break;case"YXZ":this._x=u*l*c+h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c+u*d*p;break;case"ZXY":this._x=u*l*c-h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c-u*d*p;break;case"ZYX":this._x=u*l*c-h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c+u*d*p;break;case"YZX":this._x=u*l*c+h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c-u*d*p;break;case"XZY":this._x=u*l*c-h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+n)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const s=e/2,i=Math.sin(s);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,s=e[0],i=e[4],r=e[8],n=e[1],a=e[5],o=e[9],h=e[2],l=e[6],c=e[10],u=s+a+c;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(l-o)*t,this._y=(r-h)*t,this._z=(n-i)*t}else if(s>a&&s>c){const t=2*Math.sqrt(1+s-a-c);this._w=(l-o)/t,this._x=.25*t,this._y=(i+n)/t,this._z=(r+h)/t}else if(a>c){const t=2*Math.sqrt(1+a-s-c);this._w=(r-h)/t,this._x=(i+n)/t,this._y=.25*t,this._z=(o+l)/t}else{const t=2*Math.sqrt(1+c-s-a);this._w=(n-i)/t,this._x=(r+h)/t,this._y=(o+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let s=t.dot(e)+1;return s<1e-8?(s=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=s):(this._x=0,this._y=-t.z,this._z=t.y,this._w=s)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=s),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(qs(this.dot(t),-1,1)))}rotateTowards(t,e){const s=this.angleTo(t);if(0===s)return this;const i=Math.min(1,e/s);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const s=t._x,i=t._y,r=t._z,n=t._w,a=e._x,o=e._y,h=e._z,l=e._w;return this._x=s*l+n*a+i*h-r*o,this._y=i*l+n*o+r*a-s*h,this._z=r*l+n*h+s*o-i*a,this._w=n*l-s*a-i*o-r*h,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const s=this._x,i=this._y,r=this._z,n=this._w;let a=n*t._w+s*t._x+i*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=n,this._x=s,this._y=i,this._z=r,this;const o=1-a*a;if(o<=Number.EPSILON){const t=1-e;return this._w=t*n+e*this._w,this._x=t*s+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this}const h=Math.sqrt(o),l=Math.atan2(h,a),c=Math.sin((1-e)*l)/h,u=Math.sin(e*l)/h;return this._w=n*c+this._w*u,this._x=s*c+this._x*u,this._y=i*c+this._y*u,this._z=r*c+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,s){return this.copy(t).slerp(e,s)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),s=Math.random(),i=Math.sqrt(1-s),r=Math.sqrt(s);return this.set(i*Math.sin(t),i*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Ks{constructor(t=0,e=0,s=0){Ks.prototype.isVector3=!0,this.x=t,this.y=e,this.z=s}set(t,e,s){return void 0===s&&(s=this.z),this.x=t,this.y=e,this.z=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(ei.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(ei.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,s=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*s+r[6]*i,this.y=r[1]*e+r[4]*s+r[7]*i,this.z=r[2]*e+r[5]*s+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,s=this.y,i=this.z,r=t.elements,n=1/(r[3]*e+r[7]*s+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*s+r[8]*i+r[12])*n,this.y=(r[1]*e+r[5]*s+r[9]*i+r[13])*n,this.z=(r[2]*e+r[6]*s+r[10]*i+r[14])*n,this}applyQuaternion(t){const e=this.x,s=this.y,i=this.z,r=t.x,n=t.y,a=t.z,o=t.w,h=2*(n*i-a*s),l=2*(a*e-r*i),c=2*(r*s-n*e);return this.x=e+o*h+n*c-a*l,this.y=s+o*l+a*h-r*c,this.z=i+o*c+r*l-n*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,s=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*s+r[8]*i,this.y=r[1]*e+r[5]*s+r[9]*i,this.z=r[2]*e+r[6]*s+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=qs(this.x,t.x,e.x),this.y=qs(this.y,t.y,e.y),this.z=qs(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=qs(this.x,t,e),this.y=qs(this.y,t,e),this.z=qs(this.z,t,e),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(qs(s,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const s=t.x,i=t.y,r=t.z,n=e.x,a=e.y,o=e.z;return this.x=i*o-r*a,this.y=r*n-s*o,this.z=s*a-i*n,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const s=t.dot(this)/e;return this.copy(t).multiplyScalar(s)}projectOnPlane(t){return ti.copy(this).projectOnVector(t),this.sub(ti)}reflect(t){return this.sub(ti.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(qs(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y,i=this.z-t.z;return e*e+s*s+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,s){const i=Math.sin(e)*t;return this.x=i*Math.sin(s),this.y=Math.cos(e)*t,this.z=i*Math.cos(s),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,s){return this.x=t*Math.sin(e),this.y=s,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),s=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=s,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,s=Math.sqrt(1-e*e);return this.x=s*Math.cos(t),this.y=e,this.z=s*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const ti=new Ks,ei=new Qs;class si{constructor(t,e,s,i,r,n,a,o,h){si.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,s,i,r,n,a,o,h)}set(t,e,s,i,r,n,a,o,h){const l=this.elements;return l[0]=t,l[1]=i,l[2]=a,l[3]=e,l[4]=r,l[5]=o,l[6]=s,l[7]=n,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],this}extractBasis(t,e,s){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const s=t.elements,i=e.elements,r=this.elements,n=s[0],a=s[3],o=s[6],h=s[1],l=s[4],c=s[7],u=s[2],d=s[5],p=s[8],m=i[0],y=i[3],g=i[6],f=i[1],x=i[4],b=i[7],v=i[2],w=i[5],M=i[8];return r[0]=n*m+a*f+o*v,r[3]=n*y+a*x+o*w,r[6]=n*g+a*b+o*M,r[1]=h*m+l*f+c*v,r[4]=h*y+l*x+c*w,r[7]=h*g+l*b+c*M,r[2]=u*m+d*f+p*v,r[5]=u*y+d*x+p*w,r[8]=u*g+d*b+p*M,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],s=t[1],i=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8];return e*n*l-e*a*h-s*r*l+s*a*o+i*r*h-i*n*o}invert(){const t=this.elements,e=t[0],s=t[1],i=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8],c=l*n-a*h,u=a*o-l*r,d=h*r-n*o,p=e*c+s*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return t[0]=c*m,t[1]=(i*h-l*s)*m,t[2]=(a*s-i*n)*m,t[3]=u*m,t[4]=(l*e-i*o)*m,t[5]=(i*r-a*e)*m,t[6]=d*m,t[7]=(s*o-h*e)*m,t[8]=(n*e-s*r)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,s,i,r,n,a){const o=Math.cos(r),h=Math.sin(r);return this.set(s*o,s*h,-s*(o*n+h*a)+n+t,-i*h,i*o,-i*(-h*n+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(ii.makeScale(t,e)),this}rotate(t){return this.premultiply(ii.makeRotation(-t)),this}translate(t,e){return this.premultiply(ii.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,s,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,s=t.elements;for(let t=0;t<9;t++)if(e[t]!==s[t])return!1;return!0}fromArray(t,e=0){for(let s=0;s<9;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){const s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const ii=new si;function ri(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const ni={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function ai(t,e){return new ni[t](e)}function oi(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function hi(){const t=oi("canvas");return t.style.display="block",t}const li={};function ci(t){t in li||(li[t]=!0,console.warn(t))}function ui(t,e,s){return new Promise(function(i,r){setTimeout(function n(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(n,s);break;default:i()}},s)})}const di=(new si).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),pi=(new si).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function mi(){const t={enabled:!0,workingColorSpace:Ge,spaces:{},convert:function(t,e,s){return!1!==this.enabled&&e!==s&&e&&s?(this.spaces[e].transfer===Qe&&(t.r=gi(t.r),t.g=gi(t.g),t.b=gi(t.b)),this.spaces[e].primaries!==this.spaces[s].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[s].fromXYZ)),this.spaces[s].transfer===Qe&&(t.r=fi(t.r),t.g=fi(t.g),t.b=fi(t.b)),t):t},workingToColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},colorSpaceToWorking:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return""===t?$e:this.spaces[t].transfer},getToneMappingMode:function(t){return this.spaces[t].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,s){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[s].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(e,s){return ci("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(e,s)},toWorkingColorSpace:function(e,s){return ci("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(e,s)}},e=[.64,.33,.3,.6,.15,.06],s=[.2126,.7152,.0722],i=[.3127,.329];return t.define({[Ge]:{primaries:e,whitePoint:i,transfer:$e,toXYZ:di,fromXYZ:pi,luminanceCoefficients:s,workingColorSpaceConfig:{unpackColorSpace:Ze},outputColorSpaceConfig:{drawingBufferColorSpace:Ze}},[Ze]:{primaries:e,whitePoint:i,transfer:Qe,toXYZ:di,fromXYZ:pi,luminanceCoefficients:s,outputColorSpaceConfig:{drawingBufferColorSpace:Ze}}}),t}const yi=mi();function gi(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function fi(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let xi;class bi{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let s;if(t instanceof HTMLCanvasElement)s=t;else{void 0===xi&&(xi=oi("canvas")),xi.width=t.width,xi.height=t.height;const e=xi.getContext("2d");t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0,t.width,t.height),s=xi}return s.toDataURL(e)}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=oi("canvas");e.width=t.width,e.height=t.height;const s=e.getContext("2d");s.drawImage(t,0,0,t.width,t.height);const i=s.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t1),this.pmremVersion=0}get width(){return this.source.getSize(_i).x}get height(){return this.source.getSize(_i).y}get depth(){return this.source.getSize(_i).z}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(const e in t){const s=t[e];if(void 0===s){console.warn(`THREE.Texture.setValues(): parameter '${e}' has value of undefined.`);continue}const i=this[e];void 0!==i?i&&s&&i.isVector2&&s.isVector2||i&&s&&i.isVector3&&s.isVector3||i&&s&&i.isMatrix3&&s.isMatrix3?i.copy(s):this[e]=s:console.warn(`THREE.Texture.setValues(): property '${e}' does not exist.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const s={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(s.userData=this.userData),e||(t.textures[this.uuid]=s),s}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==ot)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case pt:t.x=t.x-Math.floor(t.x);break;case mt:t.x=t.x<0?0:1;break;case yt:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case pt:t.y=t.y-Math.floor(t.y);break;case mt:t.y=t.y<0?0:1;break;case yt:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}Ai.DEFAULT_IMAGE=null,Ai.DEFAULT_MAPPING=ot,Ai.DEFAULT_ANISOTROPY=1;class Ti{constructor(t=0,e=0,s=0,i=1){Ti.prototype.isVector4=!0,this.x=t,this.y=e,this.z=s,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,s,i){return this.x=t,this.y=e,this.z=s,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,s=this.y,i=this.z,r=this.w,n=t.elements;return this.x=n[0]*e+n[4]*s+n[8]*i+n[12]*r,this.y=n[1]*e+n[5]*s+n[9]*i+n[13]*r,this.z=n[2]*e+n[6]*s+n[10]*i+n[14]*r,this.w=n[3]*e+n[7]*s+n[11]*i+n[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,s,i,r;const n=.01,a=.1,o=t.elements,h=o[0],l=o[4],c=o[8],u=o[1],d=o[5],p=o[9],m=o[2],y=o[6],g=o[10];if(Math.abs(l-u)o&&t>f?tf?o1;this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,s=t.textures.length;e=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,Oi),Oi.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,s;return t.normal.x>0?(e=t.normal.x*this.min.x,s=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,s=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,s+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,s+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,s+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,s+=t.normal.z*this.min.z),e<=-t.constant&&s>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Ui),Hi.subVectors(this.max,Ui),Vi.subVectors(t.a,Ui),Fi.subVectors(t.b,Ui),Li.subVectors(t.c,Ui),ji.subVectors(Fi,Vi),Di.subVectors(Li,Fi),Wi.subVectors(Vi,Li);let e=[0,-ji.z,ji.y,0,-Di.z,Di.y,0,-Wi.z,Wi.y,ji.z,0,-ji.x,Di.z,0,-Di.x,Wi.z,0,-Wi.x,-ji.y,ji.x,0,-Di.y,Di.x,0,-Wi.y,Wi.x,0];return!!Xi(e,Vi,Fi,Li,Hi)&&(e=[1,0,0,0,1,0,0,0,1],!!Xi(e,Vi,Fi,Li,Hi)&&(qi.crossVectors(ji,Di),e=[qi.x,qi.y,qi.z],Xi(e,Vi,Fi,Li,Hi)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Oi).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(Oi).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Pi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Pi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Pi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Pi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Pi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Pi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Pi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Pi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Pi)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}}const Pi=[new Ks,new Ks,new Ks,new Ks,new Ks,new Ks,new Ks,new Ks],Oi=new Ks,Ni=new Ri,Vi=new Ks,Fi=new Ks,Li=new Ks,ji=new Ks,Di=new Ks,Wi=new Ks,Ui=new Ks,Hi=new Ks,qi=new Ks,Ji=new Ks;function Xi(t,e,s,i,r){for(let n=0,a=t.length-3;n<=a;n+=3){Ji.fromArray(t,n);const a=r.x*Math.abs(Ji.x)+r.y*Math.abs(Ji.y)+r.z*Math.abs(Ji.z),o=e.dot(Ji),h=s.dot(Ji),l=i.dot(Ji);if(Math.max(-Math.max(o,h,l),Math.min(o,h,l))>a)return!1}return!0}const Yi=new Ri,Zi=new Ks,Gi=new Ks;class $i{constructor(t=new Ks,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const s=this.center;void 0!==e?s.copy(e):Yi.setFromPoints(t).getCenter(s);let i=0;for(let e=0,r=t.length;ethis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Zi.subVectors(t,this.center);const e=Zi.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),s=.5*(t-this.radius);this.center.addScaledVector(Zi,s/t),this.radius+=s}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(Gi.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Zi.copy(t.center).add(Gi)),this.expandByPoint(Zi.copy(t.center).sub(Gi))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}}const Qi=new Ks,Ki=new Ks,tr=new Ks,er=new Ks,sr=new Ks,ir=new Ks,rr=new Ks;class nr{constructor(t=new Ks,e=new Ks(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Qi)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const s=e.dot(this.direction);return s<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,s)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=Qi.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Qi.copy(this.origin).addScaledVector(this.direction,e),Qi.distanceToSquared(t))}distanceSqToSegment(t,e,s,i){Ki.copy(t).add(e).multiplyScalar(.5),tr.copy(e).sub(t).normalize(),er.copy(this.origin).sub(Ki);const r=.5*t.distanceTo(e),n=-this.direction.dot(tr),a=er.dot(this.direction),o=-er.dot(tr),h=er.lengthSq(),l=Math.abs(1-n*n);let c,u,d,p;if(l>0)if(c=n*o-a,u=n*a-o,p=r*l,c>=0)if(u>=-p)if(u<=p){const t=1/l;c*=t,u*=t,d=c*(c+n*u+2*a)+u*(n*c+u+2*o)+h}else u=r,c=Math.max(0,-(n*u+a)),d=-c*c+u*(u+2*o)+h;else u=-r,c=Math.max(0,-(n*u+a)),d=-c*c+u*(u+2*o)+h;else u<=-p?(c=Math.max(0,-(-n*r+a)),u=c>0?-r:Math.min(Math.max(-r,-o),r),d=-c*c+u*(u+2*o)+h):u<=p?(c=0,u=Math.min(Math.max(-r,-o),r),d=u*(u+2*o)+h):(c=Math.max(0,-(n*r+a)),u=c>0?r:Math.min(Math.max(-r,-o),r),d=-c*c+u*(u+2*o)+h);else u=n>0?-r:r,c=Math.max(0,-(n*u+a)),d=-c*c+u*(u+2*o)+h;return s&&s.copy(this.origin).addScaledVector(this.direction,c),i&&i.copy(Ki).addScaledVector(tr,u),d}intersectSphere(t,e){Qi.subVectors(t.center,this.origin);const s=Qi.dot(this.direction),i=Qi.dot(Qi)-s*s,r=t.radius*t.radius;if(i>r)return null;const n=Math.sqrt(r-i),a=s-n,o=s+n;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return!(t.radius<0)&&this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const s=-(this.origin.dot(t.normal)+t.constant)/e;return s>=0?s:null}intersectPlane(t,e){const s=this.distanceToPlane(t);return null===s?null:this.at(s,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let s,i,r,n,a,o;const h=1/this.direction.x,l=1/this.direction.y,c=1/this.direction.z,u=this.origin;return h>=0?(s=(t.min.x-u.x)*h,i=(t.max.x-u.x)*h):(s=(t.max.x-u.x)*h,i=(t.min.x-u.x)*h),l>=0?(r=(t.min.y-u.y)*l,n=(t.max.y-u.y)*l):(r=(t.max.y-u.y)*l,n=(t.min.y-u.y)*l),s>n||r>i?null:((r>s||isNaN(s))&&(s=r),(n=0?(a=(t.min.z-u.z)*c,o=(t.max.z-u.z)*c):(a=(t.max.z-u.z)*c,o=(t.min.z-u.z)*c),s>o||a>i?null:((a>s||s!=s)&&(s=a),(o=0?s:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,Qi)}intersectTriangle(t,e,s,i,r){sr.subVectors(e,t),ir.subVectors(s,t),rr.crossVectors(sr,ir);let n,a=this.direction.dot(rr);if(a>0){if(i)return null;n=1}else{if(!(a<0))return null;n=-1,a=-a}er.subVectors(this.origin,t);const o=n*this.direction.dot(ir.crossVectors(er,ir));if(o<0)return null;const h=n*this.direction.dot(sr.cross(er));if(h<0)return null;if(o+h>a)return null;const l=-n*er.dot(rr);return l<0?null:this.at(l/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class ar{constructor(t,e,s,i,r,n,a,o,h,l,c,u,d,p,m,y){ar.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,s,i,r,n,a,o,h,l,c,u,d,p,m,y)}set(t,e,s,i,r,n,a,o,h,l,c,u,d,p,m,y){const g=this.elements;return g[0]=t,g[4]=e,g[8]=s,g[12]=i,g[1]=r,g[5]=n,g[9]=a,g[13]=o,g[2]=h,g[6]=l,g[10]=c,g[14]=u,g[3]=d,g[7]=p,g[11]=m,g[15]=y,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new ar).fromArray(this.elements)}copy(t){const e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],e[9]=s[9],e[10]=s[10],e[11]=s[11],e[12]=s[12],e[13]=s[13],e[14]=s[14],e[15]=s[15],this}copyPosition(t){const e=this.elements,s=t.elements;return e[12]=s[12],e[13]=s[13],e[14]=s[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,s){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this}makeBasis(t,e,s){return this.set(t.x,e.x,s.x,0,t.y,e.y,s.y,0,t.z,e.z,s.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,s=t.elements,i=1/or.setFromMatrixColumn(t,0).length(),r=1/or.setFromMatrixColumn(t,1).length(),n=1/or.setFromMatrixColumn(t,2).length();return e[0]=s[0]*i,e[1]=s[1]*i,e[2]=s[2]*i,e[3]=0,e[4]=s[4]*r,e[5]=s[5]*r,e[6]=s[6]*r,e[7]=0,e[8]=s[8]*n,e[9]=s[9]*n,e[10]=s[10]*n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,s=t.x,i=t.y,r=t.z,n=Math.cos(s),a=Math.sin(s),o=Math.cos(i),h=Math.sin(i),l=Math.cos(r),c=Math.sin(r);if("XYZ"===t.order){const t=n*l,s=n*c,i=a*l,r=a*c;e[0]=o*l,e[4]=-o*c,e[8]=h,e[1]=s+i*h,e[5]=t-r*h,e[9]=-a*o,e[2]=r-t*h,e[6]=i+s*h,e[10]=n*o}else if("YXZ"===t.order){const t=o*l,s=o*c,i=h*l,r=h*c;e[0]=t+r*a,e[4]=i*a-s,e[8]=n*h,e[1]=n*c,e[5]=n*l,e[9]=-a,e[2]=s*a-i,e[6]=r+t*a,e[10]=n*o}else if("ZXY"===t.order){const t=o*l,s=o*c,i=h*l,r=h*c;e[0]=t-r*a,e[4]=-n*c,e[8]=i+s*a,e[1]=s+i*a,e[5]=n*l,e[9]=r-t*a,e[2]=-n*h,e[6]=a,e[10]=n*o}else if("ZYX"===t.order){const t=n*l,s=n*c,i=a*l,r=a*c;e[0]=o*l,e[4]=i*h-s,e[8]=t*h+r,e[1]=o*c,e[5]=r*h+t,e[9]=s*h-i,e[2]=-h,e[6]=a*o,e[10]=n*o}else if("YZX"===t.order){const t=n*o,s=n*h,i=a*o,r=a*h;e[0]=o*l,e[4]=r-t*c,e[8]=i*c+s,e[1]=c,e[5]=n*l,e[9]=-a*l,e[2]=-h*l,e[6]=s*c+i,e[10]=t-r*c}else if("XZY"===t.order){const t=n*o,s=n*h,i=a*o,r=a*h;e[0]=o*l,e[4]=-c,e[8]=h*l,e[1]=t*c+r,e[5]=n*l,e[9]=s*c-i,e[2]=i*c-s,e[6]=a*l,e[10]=r*c+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(lr,t,cr)}lookAt(t,e,s){const i=this.elements;return pr.subVectors(t,e),0===pr.lengthSq()&&(pr.z=1),pr.normalize(),ur.crossVectors(s,pr),0===ur.lengthSq()&&(1===Math.abs(s.z)?pr.x+=1e-4:pr.z+=1e-4,pr.normalize(),ur.crossVectors(s,pr)),ur.normalize(),dr.crossVectors(pr,ur),i[0]=ur.x,i[4]=dr.x,i[8]=pr.x,i[1]=ur.y,i[5]=dr.y,i[9]=pr.y,i[2]=ur.z,i[6]=dr.z,i[10]=pr.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const s=t.elements,i=e.elements,r=this.elements,n=s[0],a=s[4],o=s[8],h=s[12],l=s[1],c=s[5],u=s[9],d=s[13],p=s[2],m=s[6],y=s[10],g=s[14],f=s[3],x=s[7],b=s[11],v=s[15],w=i[0],M=i[4],S=i[8],_=i[12],A=i[1],T=i[5],z=i[9],C=i[13],I=i[2],B=i[6],k=i[10],E=i[14],R=i[3],P=i[7],O=i[11],N=i[15];return r[0]=n*w+a*A+o*I+h*R,r[4]=n*M+a*T+o*B+h*P,r[8]=n*S+a*z+o*k+h*O,r[12]=n*_+a*C+o*E+h*N,r[1]=l*w+c*A+u*I+d*R,r[5]=l*M+c*T+u*B+d*P,r[9]=l*S+c*z+u*k+d*O,r[13]=l*_+c*C+u*E+d*N,r[2]=p*w+m*A+y*I+g*R,r[6]=p*M+m*T+y*B+g*P,r[10]=p*S+m*z+y*k+g*O,r[14]=p*_+m*C+y*E+g*N,r[3]=f*w+x*A+b*I+v*R,r[7]=f*M+x*T+b*B+v*P,r[11]=f*S+x*z+b*k+v*O,r[15]=f*_+x*C+b*E+v*N,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],s=t[4],i=t[8],r=t[12],n=t[1],a=t[5],o=t[9],h=t[13],l=t[2],c=t[6],u=t[10],d=t[14];return t[3]*(+r*o*c-i*h*c-r*a*u+s*h*u+i*a*d-s*o*d)+t[7]*(+e*o*d-e*h*u+r*n*u-i*n*d+i*h*l-r*o*l)+t[11]*(+e*h*c-e*a*d-r*n*c+s*n*d+r*a*l-s*h*l)+t[15]*(-i*a*l-e*o*c+e*a*u+i*n*c-s*n*u+s*o*l)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,s){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=s),this}invert(){const t=this.elements,e=t[0],s=t[1],i=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8],c=t[9],u=t[10],d=t[11],p=t[12],m=t[13],y=t[14],g=t[15],f=c*y*h-m*u*h+m*o*d-a*y*d-c*o*g+a*u*g,x=p*u*h-l*y*h-p*o*d+n*y*d+l*o*g-n*u*g,b=l*m*h-p*c*h+p*a*d-n*m*d-l*a*g+n*c*g,v=p*c*o-l*m*o-p*a*u+n*m*u+l*a*y-n*c*y,w=e*f+s*x+i*b+r*v;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const M=1/w;return t[0]=f*M,t[1]=(m*u*r-c*y*r-m*i*d+s*y*d+c*i*g-s*u*g)*M,t[2]=(a*y*r-m*o*r+m*i*h-s*y*h-a*i*g+s*o*g)*M,t[3]=(c*o*r-a*u*r-c*i*h+s*u*h+a*i*d-s*o*d)*M,t[4]=x*M,t[5]=(l*y*r-p*u*r+p*i*d-e*y*d-l*i*g+e*u*g)*M,t[6]=(p*o*r-n*y*r-p*i*h+e*y*h+n*i*g-e*o*g)*M,t[7]=(n*u*r-l*o*r+l*i*h-e*u*h-n*i*d+e*o*d)*M,t[8]=b*M,t[9]=(p*c*r-l*m*r-p*s*d+e*m*d+l*s*g-e*c*g)*M,t[10]=(n*m*r-p*a*r+p*s*h-e*m*h-n*s*g+e*a*g)*M,t[11]=(l*a*r-n*c*r-l*s*h+e*c*h+n*s*d-e*a*d)*M,t[12]=v*M,t[13]=(l*m*i-p*c*i+p*s*u-e*m*u-l*s*y+e*c*y)*M,t[14]=(p*a*i-n*m*i-p*s*o+e*m*o+n*s*y-e*a*y)*M,t[15]=(n*c*i-l*a*i+l*s*o-e*c*o-n*s*u+e*a*u)*M,this}scale(t){const e=this.elements,s=t.x,i=t.y,r=t.z;return e[0]*=s,e[4]*=i,e[8]*=r,e[1]*=s,e[5]*=i,e[9]*=r,e[2]*=s,e[6]*=i,e[10]*=r,e[3]*=s,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],s=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,s,i))}makeTranslation(t,e,s){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,s,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),s=Math.sin(t);return this.set(1,0,0,0,0,e,-s,0,0,s,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,0,s,0,0,1,0,0,-s,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,0,s,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const s=Math.cos(e),i=Math.sin(e),r=1-s,n=t.x,a=t.y,o=t.z,h=r*n,l=r*a;return this.set(h*n+s,h*a-i*o,h*o+i*a,0,h*a+i*o,l*a+s,l*o-i*n,0,h*o-i*a,l*o+i*n,r*o*o+s,0,0,0,0,1),this}makeScale(t,e,s){return this.set(t,0,0,0,0,e,0,0,0,0,s,0,0,0,0,1),this}makeShear(t,e,s,i,r,n){return this.set(1,s,r,0,t,1,n,0,e,i,1,0,0,0,0,1),this}compose(t,e,s){const i=this.elements,r=e._x,n=e._y,a=e._z,o=e._w,h=r+r,l=n+n,c=a+a,u=r*h,d=r*l,p=r*c,m=n*l,y=n*c,g=a*c,f=o*h,x=o*l,b=o*c,v=s.x,w=s.y,M=s.z;return i[0]=(1-(m+g))*v,i[1]=(d+b)*v,i[2]=(p-x)*v,i[3]=0,i[4]=(d-b)*w,i[5]=(1-(u+g))*w,i[6]=(y+f)*w,i[7]=0,i[8]=(p+x)*M,i[9]=(y-f)*M,i[10]=(1-(u+m))*M,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,s){const i=this.elements;let r=or.set(i[0],i[1],i[2]).length();const n=or.set(i[4],i[5],i[6]).length(),a=or.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],hr.copy(this);const o=1/r,h=1/n,l=1/a;return hr.elements[0]*=o,hr.elements[1]*=o,hr.elements[2]*=o,hr.elements[4]*=h,hr.elements[5]*=h,hr.elements[6]*=h,hr.elements[8]*=l,hr.elements[9]*=l,hr.elements[10]*=l,e.setFromRotationMatrix(hr),s.x=r,s.y=n,s.z=a,this}makePerspective(t,e,s,i,r,n,a=2e3,o=!1){const h=this.elements,l=2*r/(e-t),c=2*r/(s-i),u=(e+t)/(e-t),d=(s+i)/(s-i);let p,m;if(o)p=r/(n-r),m=n*r/(n-r);else if(a===Ps)p=-(n+r)/(n-r),m=-2*n*r/(n-r);else{if(a!==Os)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);p=-n/(n-r),m=-n*r/(n-r)}return h[0]=l,h[4]=0,h[8]=u,h[12]=0,h[1]=0,h[5]=c,h[9]=d,h[13]=0,h[2]=0,h[6]=0,h[10]=p,h[14]=m,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}makeOrthographic(t,e,s,i,r,n,a=2e3,o=!1){const h=this.elements,l=2/(e-t),c=2/(s-i),u=-(e+t)/(e-t),d=-(s+i)/(s-i);let p,m;if(o)p=1/(n-r),m=n/(n-r);else if(a===Ps)p=-2/(n-r),m=-(n+r)/(n-r);else{if(a!==Os)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);p=-1/(n-r),m=-r/(n-r)}return h[0]=l,h[4]=0,h[8]=0,h[12]=u,h[1]=0,h[5]=c,h[9]=0,h[13]=d,h[2]=0,h[6]=0,h[10]=p,h[14]=m,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(t){const e=this.elements,s=t.elements;for(let t=0;t<16;t++)if(e[t]!==s[t])return!1;return!0}fromArray(t,e=0){for(let s=0;s<16;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){const s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t[e+9]=s[9],t[e+10]=s[10],t[e+11]=s[11],t[e+12]=s[12],t[e+13]=s[13],t[e+14]=s[14],t[e+15]=s[15],t}}const or=new Ks,hr=new ar,lr=new Ks(0,0,0),cr=new Ks(1,1,1),ur=new Ks,dr=new Ks,pr=new Ks,mr=new ar,yr=new Qs;class gr{constructor(t=0,e=0,s=0,i=gr.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=s,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,s,i=this._order){return this._x=t,this._y=e,this._z=s,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,s=!0){const i=t.elements,r=i[0],n=i[4],a=i[8],o=i[1],h=i[5],l=i[9],c=i[2],u=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(qs(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-n,r)):(this._x=Math.atan2(u,h),this._z=0);break;case"YXZ":this._x=Math.asin(-qs(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,h)):(this._y=Math.atan2(-c,r),this._z=0);break;case"ZXY":this._x=Math.asin(qs(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-n,h)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-qs(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-n,h));break;case"YZX":this._z=Math.asin(qs(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-qs(n,-1,1)),Math.abs(n)<.9999999?(this._x=Math.atan2(u,h),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-l,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===s&&this._onChangeCallback(),this}setFromQuaternion(t,e,s){return mr.makeRotationFromQuaternion(t),this.setFromRotationMatrix(mr,e,s)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return yr.setFromEuler(this),this.setFromQuaternion(yr,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}gr.DEFAULT_ORDER="XYZ";class fr{constructor(){this.mask=1}set(t){this.mask=1<>>0}enable(t){this.mask|=1<1){for(let t=0;t1){for(let t=0;t0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox?t.boundingBox.toJSON():void 0,boundingSphere:t.boundingSphere?t.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(t=>({...t})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(t),i.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(i.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(i.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const s=e.shapes;if(Array.isArray(s))for(let e=0,i=s.length;e0){i.children=[];for(let e=0;e0){i.animations=[];for(let e=0;e0&&(s.geometries=e),i.length>0&&(s.materials=i),r.length>0&&(s.textures=r),a.length>0&&(s.images=a),o.length>0&&(s.shapes=o),h.length>0&&(s.skeletons=h),l.length>0&&(s.animations=l),c.length>0&&(s.nodes=c)}return s.object=i,s;function n(t){const e=[];for(const s in t){const i=t[s];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,s,i,r){Pr.subVectors(i,e),Or.subVectors(s,e),Nr.subVectors(t,e);const n=Pr.dot(Pr),a=Pr.dot(Or),o=Pr.dot(Nr),h=Or.dot(Or),l=Or.dot(Nr),c=n*h-a*a;if(0===c)return r.set(0,0,0),null;const u=1/c,d=(h*o-a*l)*u,p=(n*l-a*o)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,s,i){return null!==this.getBarycoord(t,e,s,i,Vr)&&(Vr.x>=0&&Vr.y>=0&&Vr.x+Vr.y<=1)}static getInterpolation(t,e,s,i,r,n,a,o){return null===this.getBarycoord(t,e,s,i,Vr)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,Vr.x),o.addScaledVector(n,Vr.y),o.addScaledVector(a,Vr.z),o)}static getInterpolatedAttribute(t,e,s,i,r,n){return Hr.setScalar(0),qr.setScalar(0),Jr.setScalar(0),Hr.fromBufferAttribute(t,e),qr.fromBufferAttribute(t,s),Jr.fromBufferAttribute(t,i),n.setScalar(0),n.addScaledVector(Hr,r.x),n.addScaledVector(qr,r.y),n.addScaledVector(Jr,r.z),n}static isFrontFacing(t,e,s,i){return Pr.subVectors(s,e),Or.subVectors(t,e),Pr.cross(Or).dot(i)<0}set(t,e,s){return this.a.copy(t),this.b.copy(e),this.c.copy(s),this}setFromPointsAndIndices(t,e,s,i){return this.a.copy(t[e]),this.b.copy(t[s]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,s,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,s),this.c.fromBufferAttribute(t,i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Pr.subVectors(this.c,this.b),Or.subVectors(this.a,this.b),.5*Pr.cross(Or).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Xr.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Xr.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,s,i,r){return Xr.getInterpolation(t,this.a,this.b,this.c,e,s,i,r)}containsPoint(t){return Xr.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Xr.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const s=this.a,i=this.b,r=this.c;let n,a;Fr.subVectors(i,s),Lr.subVectors(r,s),Dr.subVectors(t,s);const o=Fr.dot(Dr),h=Lr.dot(Dr);if(o<=0&&h<=0)return e.copy(s);Wr.subVectors(t,i);const l=Fr.dot(Wr),c=Lr.dot(Wr);if(l>=0&&c<=l)return e.copy(i);const u=o*c-l*h;if(u<=0&&o>=0&&l<=0)return n=o/(o-l),e.copy(s).addScaledVector(Fr,n);Ur.subVectors(t,r);const d=Fr.dot(Ur),p=Lr.dot(Ur);if(p>=0&&d<=p)return e.copy(r);const m=d*h-o*p;if(m<=0&&h>=0&&p<=0)return a=h/(h-p),e.copy(s).addScaledVector(Lr,a);const y=l*p-d*c;if(y<=0&&c-l>=0&&d-p>=0)return jr.subVectors(r,i),a=(c-l)/(c-l+(d-p)),e.copy(i).addScaledVector(jr,a);const g=1/(y+m+u);return n=m*g,a=u*g,e.copy(s).addScaledVector(Fr,n).addScaledVector(Lr,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const Yr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Zr={h:0,s:0,l:0},Gr={h:0,s:0,l:0};function $r(t,e,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+6*(e-t)*(2/3-s):t}class Qr{constructor(t,e,s){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,s)}set(t,e,s){if(void 0===e&&void 0===s){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,s);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Ze){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,yi.colorSpaceToWorking(this,e),this}setRGB(t,e,s,i=yi.workingColorSpace){return this.r=t,this.g=e,this.b=s,yi.colorSpaceToWorking(this,i),this}setHSL(t,e,s,i=yi.workingColorSpace){if(t=Js(t,1),e=qs(e,0,1),s=qs(s,0,1),0===e)this.r=this.g=this.b=s;else{const i=s<=.5?s*(1+e):s+e-s*e,r=2*s-i;this.r=$r(r,i,t+1/3),this.g=$r(r,i,t),this.b=$r(r,i,t-1/3)}return yi.colorSpaceToWorking(this,i),this}setStyle(t,e=Ze){function s(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const n=i[1],a=i[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const s=i[1],r=s.length;if(3===r)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(s,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Ze){const s=Yr[t.toLowerCase()];return void 0!==s?this.setHex(s,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=gi(t.r),this.g=gi(t.g),this.b=gi(t.b),this}copyLinearToSRGB(t){return this.r=fi(t.r),this.g=fi(t.g),this.b=fi(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Ze){return yi.workingToColorSpace(Kr.copy(this),t),65536*Math.round(qs(255*Kr.r,0,255))+256*Math.round(qs(255*Kr.g,0,255))+Math.round(qs(255*Kr.b,0,255))}getHexString(t=Ze){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=yi.workingColorSpace){yi.workingToColorSpace(Kr.copy(this),e);const s=Kr.r,i=Kr.g,r=Kr.b,n=Math.max(s,i,r),a=Math.min(s,i,r);let o,h;const l=(a+n)/2;if(a===n)o=0,h=0;else{const t=n-a;switch(h=l<=.5?t/(n+a):t/(2-n-a),n){case s:o=(i-r)/t+(i0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const s=t[e];if(void 0===s){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(s):i&&i.isVector3&&s&&s.isVector3?i.copy(s):this[e]=s:console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const s={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const s in t){const i=t[s];delete i.metadata,e.push(i)}return e}if(s.uuid=this.uuid,s.type=this.type,""!==this.name&&(s.name=this.name),this.color&&this.color.isColor&&(s.color=this.color.getHex()),void 0!==this.roughness&&(s.roughness=this.roughness),void 0!==this.metalness&&(s.metalness=this.metalness),void 0!==this.sheen&&(s.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(s.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(s.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(s.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(s.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(s.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(s.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(s.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(s.shininess=this.shininess),void 0!==this.clearcoat&&(s.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(s.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(s.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(s.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(s.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,s.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(s.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(s.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),void 0!==this.dispersion&&(s.dispersion=this.dispersion),void 0!==this.iridescence&&(s.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(s.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(s.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(s.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(s.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(s.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(s.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(s.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(s.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(s.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(s.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(s.lightMap=this.lightMap.toJSON(t).uuid,s.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(s.aoMap=this.aoMap.toJSON(t).uuid,s.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(s.bumpMap=this.bumpMap.toJSON(t).uuid,s.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(s.normalMap=this.normalMap.toJSON(t).uuid,s.normalMapType=this.normalMapType,s.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(s.displacementMap=this.displacementMap.toJSON(t).uuid,s.displacementScale=this.displacementScale,s.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(s.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(s.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(s.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(s.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(s.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(s.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(s.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(s.combine=this.combine)),void 0!==this.envMapRotation&&(s.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(s.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(s.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(s.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(s.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(s.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(s.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(s.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(s.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(s.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(s.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(s.size=this.size),null!==this.shadowSide&&(s.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(s.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(s.blending=this.blending),0!==this.side&&(s.side=this.side),!0===this.vertexColors&&(s.vertexColors=!0),this.opacity<1&&(s.opacity=this.opacity),!0===this.transparent&&(s.transparent=!0),204!==this.blendSrc&&(s.blendSrc=this.blendSrc),205!==this.blendDst&&(s.blendDst=this.blendDst),100!==this.blendEquation&&(s.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(s.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(s.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(s.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(s.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(s.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(s.depthFunc=this.depthFunc),!1===this.depthTest&&(s.depthTest=this.depthTest),!1===this.depthWrite&&(s.depthWrite=this.depthWrite),!1===this.colorWrite&&(s.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(s.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(s.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(s.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(s.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ts&&(s.stencilFail=this.stencilFail),this.stencilZFail!==ts&&(s.stencilZFail=this.stencilZFail),this.stencilZPass!==ts&&(s.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(s.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(s.rotation=this.rotation),!0===this.polygonOffset&&(s.polygonOffset=!0),0!==this.polygonOffsetFactor&&(s.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(s.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(s.linewidth=this.linewidth),void 0!==this.dashSize&&(s.dashSize=this.dashSize),void 0!==this.gapSize&&(s.gapSize=this.gapSize),void 0!==this.scale&&(s.scale=this.scale),!0===this.dithering&&(s.dithering=!0),this.alphaTest>0&&(s.alphaTest=this.alphaTest),!0===this.alphaHash&&(s.alphaHash=!0),!0===this.alphaToCoverage&&(s.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(s.premultipliedAlpha=!0),!0===this.forceSinglePass&&(s.forceSinglePass=!0),!0===this.wireframe&&(s.wireframe=!0),this.wireframeLinewidth>1&&(s.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(s.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(s.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(s.flatShading=!0),!1===this.visible&&(s.visible=!1),!1===this.toneMapped&&(s.toneMapped=!1),!1===this.fog&&(s.fog=!1),Object.keys(this.userData).length>0&&(s.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(s.textures=e),r.length>0&&(s.images=r)}return s}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let s=null;if(null!==e){const t=e.length;s=new Array(t);for(let i=0;i!==t;++i)s[i]=e[i].clone()}return this.clippingPlanes=s,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}class sn extends en{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Qr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new gr,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const rn=nn();function nn(){const t=new ArrayBuffer(4),e=new Float32Array(t),s=new Uint32Array(t),i=new Uint32Array(512),r=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(i[t]=0,i[256|t]=32768,r[t]=24,r[256|t]=24):e<-14?(i[t]=1024>>-e-14,i[256|t]=1024>>-e-14|32768,r[t]=-e-1,r[256|t]=-e-1):e<=15?(i[t]=e+15<<10,i[256|t]=e+15<<10|32768,r[t]=13,r[256|t]=13):e<128?(i[t]=31744,i[256|t]=64512,r[t]=24,r[256|t]=24):(i[t]=31744,i[256|t]=64512,r[t]=13,r[256|t]=13)}const n=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,s=0;for(;!(8388608&e);)e<<=1,s-=8388608;e&=-8388609,s+=947912704,n[t]=e|s}for(let t=1024;t<2048;++t)n[t]=939524096+(t-1024<<13);for(let t=1;t<31;++t)a[t]=t<<23;a[31]=1199570944,a[32]=2147483648;for(let t=33;t<63;++t)a[t]=2147483648+(t-32<<23);a[63]=3347054592;for(let t=1;t<64;++t)32!==t&&(o[t]=1024);return{floatView:e,uint32View:s,baseTable:i,shiftTable:r,mantissaTable:n,exponentTable:a,offsetTable:o}}function an(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=qs(t,-65504,65504),rn.floatView[0]=t;const e=rn.uint32View[0],s=e>>23&511;return rn.baseTable[s]+((8388607&e)>>rn.shiftTable[s])}function on(t){const e=t>>10;return rn.uint32View[0]=rn.mantissaTable[rn.offsetTable[e]+(1023&t)]+rn.exponentTable[e],rn.floatView[0]}class hn{static toHalfFloat(t){return an(t)}static fromHalfFloat(t){return on(t)}}const ln=new Ks,cn=new $s;let un=0;class dn{constructor(t,e,s=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:un++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=s,this.usage=Ss,this.updateRanges=[],this.gpuType=Et,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,s){t*=this.itemSize,s*=e.itemSize;for(let i=0,r=this.itemSize;ie.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Ri);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Ks(-1/0,-1/0,-1/0),new Ks(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,s=e.length;t0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const s in e)void 0!==e[s]&&(t[s]=e[s]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const s=this.attributes;for(const e in s){const i=s[e];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const s=this.morphAttributes[e],n=[];for(let e=0,i=s.length;e0&&(i[e]=n,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const n=this.groups;n.length>0&&(t.data.groups=JSON.parse(JSON.stringify(n)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere=a.toJSON()),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const s=t.index;null!==s&&this.setIndex(s.clone());const i=t.attributes;for(const t in i){const s=i[t];this.setAttribute(t,s.clone(e))}const r=t.morphAttributes;for(const t in r){const s=[],i=r[t];for(let t=0,r=i.length;t0){const s=t[e[0]];if(void 0!==s){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=s.length;t(t.far-t.near)**2)return}Bn.copy(r).invert(),kn.copy(t.ray).applyMatrix4(Bn),null!==s.boundingBox&&!1===kn.intersectsBox(s.boundingBox)||this._computeIntersections(t,e,kn)}}_computeIntersections(t,e,s){let i;const r=this.geometry,n=this.material,a=r.index,o=r.attributes.position,h=r.attributes.uv,l=r.attributes.uv1,c=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==a)if(Array.isArray(n))for(let r=0,o=u.length;rs.far?null:{distance:l,point:jn.clone(),object:t}}(t,e,s,i,Pn,On,Nn,Ln);if(c){const t=new Ks;Xr.getBarycoord(Ln,Pn,On,Nn,t),r&&(c.uv=Xr.getInterpolatedAttribute(r,o,h,l,t,new $s)),n&&(c.uv1=Xr.getInterpolatedAttribute(n,o,h,l,t,new $s)),a&&(c.normal=Xr.getInterpolatedAttribute(a,o,h,l,t,new Ks),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));const e={a:o,b:h,c:l,normal:new Ks,materialIndex:0};Xr.getNormal(Pn,On,Nn,e.normal),c.face=e,c.barycoord=t}return c}class Un extends In{constructor(t=1,e=1,s=1,i=1,r=1,n=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:s,widthSegments:i,heightSegments:r,depthSegments:n};const a=this;i=Math.floor(i),r=Math.floor(r),n=Math.floor(n);const o=[],h=[],l=[],c=[];let u=0,d=0;function p(t,e,s,i,r,n,p,m,y,g,f){const x=n/y,b=p/g,v=n/2,w=p/2,M=m/2,S=y+1,_=g+1;let A=0,T=0;const z=new Ks;for(let n=0;n<_;n++){const a=n*b-w;for(let o=0;o0?1:-1,l.push(z.x,z.y,z.z),c.push(o/y),c.push(1-n/g),A+=1}}for(let t=0;t0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const s={};for(const t in this.extensions)!0===this.extensions[t]&&(s[t]=!0);return Object.keys(s).length>0&&(e.extensions=s),e}}class Zn extends Rr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ar,this.projectionMatrix=new ar,this.projectionMatrixInverse=new ar,this.coordinateSystem=Ps,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const Gn=new Ks,$n=new $s,Qn=new $s;class Kn extends Zn{constructor(t=50,e=1,s=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=s,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Us*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*Ws*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*Us*Math.atan(Math.tan(.5*Ws*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,s){Gn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(Gn.x,Gn.y).multiplyScalar(-t/Gn.z),Gn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),s.set(Gn.x,Gn.y).multiplyScalar(-t/Gn.z)}getViewSize(t,e){return this.getViewBounds(t,$n,Qn),e.subVectors(Qn,$n)}setViewOffset(t,e,s,i,r,n){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=s,this.view.offsetY=i,this.view.width=r,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*Ws*this.fov)/this.zoom,s=2*e,i=this.aspect*s,r=-.5*i;const n=this.view;if(null!==this.view&&this.view.enabled){const t=n.fullWidth,a=n.fullHeight;r+=n.offsetX*i/t,e-=n.offsetY*s/a,i*=n.width/t,s*=n.height/a}const a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-s,t,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const ta=-90;class ea extends Rr{constructor(t,e,s){super(),this.type="CubeCamera",this.renderTarget=s,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Kn(ta,1,t,e);i.layers=this.layers,this.add(i);const r=new Kn(ta,1,t,e);r.layers=this.layers,this.add(r);const n=new Kn(ta,1,t,e);n.layers=this.layers,this.add(n);const a=new Kn(ta,1,t,e);a.layers=this.layers,this.add(a);const o=new Kn(ta,1,t,e);o.layers=this.layers,this.add(o);const h=new Kn(ta,1,t,e);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[s,i,r,n,a,o]=e;for(const t of e)this.remove(t);if(t===Ps)s.up.set(0,1,0),s.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),n.up.set(0,0,1),n.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(t!==Os)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);s.up.set(0,-1,0),s.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),n.up.set(0,0,-1),n.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:s,activeMipmapLevel:i}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,n,a,o,h,l]=this.children,c=t.getRenderTarget(),u=t.getActiveCubeFace(),d=t.getActiveMipmapLevel(),p=t.xr.enabled;t.xr.enabled=!1;const m=s.texture.generateMipmaps;s.texture.generateMipmaps=!1,t.setRenderTarget(s,0,i),t.render(e,r),t.setRenderTarget(s,1,i),t.render(e,n),t.setRenderTarget(s,2,i),t.render(e,a),t.setRenderTarget(s,3,i),t.render(e,o),t.setRenderTarget(s,4,i),t.render(e,h),s.texture.generateMipmaps=m,t.setRenderTarget(s,5,i),t.render(e,l),t.setRenderTarget(c,u,d),t.xr.enabled=p,s.texture.needsPMREMUpdate=!0}}class sa extends Ai{constructor(t=[],e=301,s,i,r,n,a,o,h,l){super(t,e,s,i,r,n,a,o,h,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class ia extends Ci{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const s={width:t,height:t,depth:1},i=[s,s,s,s,s,s];this.texture=new sa(i),this._setTextureOptions(e),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const s={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new Un(5,5,5),r=new Yn({name:"CubemapFromEquirect",uniforms:Hn(s.uniforms),vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const n=new Dn(i,r),a=e.minFilter;e.minFilter===_t&&(e.minFilter=wt);return new ea(1,10,this).update(t,n),e.minFilter=a,n.geometry.dispose(),n.material.dispose(),this}clear(t,e=!0,s=!0,i=!0){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,s,i);t.setRenderTarget(r)}}class ra extends Rr{constructor(){super(),this.isGroup=!0,this.type="Group"}}const na={type:"move"};class aa{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new ra,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new ra,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Ks,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Ks),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new ra,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Ks,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Ks),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const s of t.hand.values())this._getHandJoint(e,s)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,s){let i=null,r=null,n=null;const a=this._targetRay,o=this._grip,h=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(h&&t.hand){n=!0;for(const i of t.hand.values()){const t=e.getJointPose(i,s),r=this._getHandJoint(h,i);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=t.radius),r.visible=null!==t}const i=h.joints["index-finger-tip"],r=h.joints["thumb-tip"],a=i.position.distanceTo(r.position),o=.02,l=.005;h.inputState.pinching&&a>o+l?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!h.inputState.pinching&&a<=o-l&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,s),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==a&&(i=e.getPose(t.targetRaySpace,s),null===i&&null!==r&&(i=r),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(na)))}return null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),null!==h&&(h.visible=null!==n),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const s=new ra;s.matrixAutoUpdate=!1,s.visible=!1,t.joints[e.jointName]=s,t.add(s)}return t.joints[e.jointName]}}class oa{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new Qr(t),this.density=e}clone(){return new oa(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class ha{constructor(t,e=1,s=1e3){this.isFog=!0,this.name="",this.color=new Qr(t),this.near=e,this.far=s}clone(){return new ha(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class la extends Rr{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new gr,this.environmentIntensity=1,this.environmentRotation=new gr,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class ca{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=Ss,this.updateRanges=[],this.version=0,this.uuid=Hs()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,s){t*=this.stride,s*=e.stride;for(let i=0,r=this.stride;it.far||e.push({distance:o,point:ya.clone(),uv:Xr.getInterpolation(ya,wa,Ma,Sa,_a,Aa,Ta,new $s),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function Ca(t,e,s,i,r,n){xa.subVectors(t,s).addScalar(.5).multiply(i),void 0!==r?(ba.x=n*xa.x-r*xa.y,ba.y=r*xa.x+n*xa.y):ba.copy(xa),t.copy(e),t.x+=ba.x,t.y+=ba.y,t.applyMatrix4(va)}const Ia=new Ks,Ba=new Ks;class ka extends Rr{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let t=0,s=e.length;t0){let s,i;for(s=1,i=e.length;s0){Ia.setFromMatrixPosition(this.matrixWorld);const s=t.ray.origin.distanceTo(Ia);this.getObjectForDistance(s).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Ia.setFromMatrixPosition(t.matrixWorld),Ba.setFromMatrixPosition(this.matrixWorld);const s=Ia.distanceTo(Ba)/t.zoom;let i,r;for(e[0].object.visible=!0,i=1,r=e.length;i=t))break;e[i-1].object.visible=!1,e[i].object.visible=!0}for(this._currentLevel=i-1;i1?null:e.copy(t.start).addScaledVector(s,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),s=this.distanceToPoint(t.end);return e<0&&s>0||s<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const s=e||ro.getNormalMatrix(t),i=this.coplanarPoint(so).applyMatrix4(t),r=this.normal.applyMatrix3(s).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const ao=new $i,oo=new $s(.5,.5),ho=new Ks;class lo{constructor(t=new no,e=new no,s=new no,i=new no,r=new no,n=new no){this.planes=[t,e,s,i,r,n]}set(t,e,s,i,r,n){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(s),a[3].copy(i),a[4].copy(r),a[5].copy(n),this}copy(t){const e=this.planes;for(let s=0;s<6;s++)e[s].copy(t.planes[s]);return this}setFromProjectionMatrix(t,e=2e3,s=!1){const i=this.planes,r=t.elements,n=r[0],a=r[1],o=r[2],h=r[3],l=r[4],c=r[5],u=r[6],d=r[7],p=r[8],m=r[9],y=r[10],g=r[11],f=r[12],x=r[13],b=r[14],v=r[15];if(i[0].setComponents(h-n,d-l,g-p,v-f).normalize(),i[1].setComponents(h+n,d+l,g+p,v+f).normalize(),i[2].setComponents(h+a,d+c,g+m,v+x).normalize(),i[3].setComponents(h-a,d-c,g-m,v-x).normalize(),s)i[4].setComponents(o,u,y,b).normalize(),i[5].setComponents(h-o,d-u,g-y,v-b).normalize();else if(i[4].setComponents(h-o,d-u,g-y,v-b).normalize(),e===Ps)i[5].setComponents(h+o,d+u,g+y,v+b).normalize();else{if(e!==Os)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);i[5].setComponents(o,u,y,b).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),ao.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),ao.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(ao)}intersectsSprite(t){ao.center.set(0,0,0);const e=oo.distanceTo(t.center);return ao.radius=.7071067811865476+e,ao.applyMatrix4(t.matrixWorld),this.intersectsSphere(ao)}intersectsSphere(t){const e=this.planes,s=t.center,i=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(s)0?t.max.x:t.min.x,ho.y=i.normal.y>0?t.max.y:t.min.y,ho.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(ho)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let s=0;s<6;s++)if(e[s].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}const co=new ar,uo=new lo;class po{constructor(){this.coordinateSystem=Ps}intersectsObject(t,e){if(!e.isArrayCamera||0===e.cameras.length)return!1;for(let s=0;s=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const a=r[this.index];n.push(a),this.index++,a.start=t,a.count=e,a.z=s,a.index=i}reset(){this.list.length=0,this.index=0}}const xo=new ar,bo=new Qr(1,1,1),vo=new lo,wo=new po,Mo=new Ri,So=new $i,_o=new Ks,Ao=new Ks,To=new Ks,zo=new fo,Co=new Dn,Io=[];function Bo(t,e,s=0){const i=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const r=t.count;for(let n=0;n65535?new Uint32Array(i):new Uint16Array(i);e.setIndex(new dn(t,1))}this._geometryInitialized=!0}}_validateGeometry(t){const e=this.geometry;if(Boolean(t.getIndex())!==Boolean(e.getIndex()))throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const s in e.attributes){if(!t.hasAttribute(s))throw new Error(`THREE.BatchedMesh: Added geometry missing "${s}". All geometries must have consistent attributes.`);const i=t.getAttribute(s),r=e.getAttribute(s);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(t){const e=this._instanceInfo;if(t<0||t>=e.length||!1===e[t].active)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`)}validateGeometryId(t){const e=this._geometryInfo;if(t<0||t>=e.length||!1===e[t].active)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`)}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Ri);const t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let s=0,i=e.length;s=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const e={visible:!0,active:!0,geometryIndex:t};let s=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(mo),s=this._availableInstanceIds.shift(),this._instanceInfo[s]=e):(s=this._instanceInfo.length,this._instanceInfo.push(e));const i=this._matricesTexture;xo.identity().toArray(i.image.data,16*s),i.needsUpdate=!0;const r=this._colorsTexture;return r&&(bo.toArray(r.image.data,4*s),r.needsUpdate=!0),this._visibilityChanged=!0,s}addGeometry(t,e=-1,s=-1){this._initializeGeometry(t),this._validateGeometry(t);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=-1===e?t.getAttribute("position").count:e;const n=t.getIndex();if(null!==n&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=-1===s?n.count:s),-1!==i.indexStart&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let a;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(mo),a=this._availableGeometryIds.shift(),r[a]=i):(a=this._geometryCount,this._geometryCount++,r.push(i)),this.setGeometryAt(a,t),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,a}setGeometryAt(t,e){if(t>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);const s=this.geometry,i=null!==s.getIndex(),r=s.getIndex(),n=e.getIndex(),a=this._geometryInfo[t];if(i&&n.count>a.reservedIndexCount||e.attributes.position.count>a.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const o=a.vertexStart,h=a.reservedVertexCount;a.vertexCount=e.getAttribute("position").count;for(const t in s.attributes){const i=e.getAttribute(t),r=s.getAttribute(t);Bo(i,r,o);const n=i.itemSize;for(let t=i.count,e=h;t=e.length||!1===e[t].active)return this;const s=this._instanceInfo;for(let e=0,i=s.length;ee).sort((t,e)=>s[t].vertexStart-s[e].vertexStart),r=this.geometry;for(let n=0,a=s.length;n=this._geometryCount)return null;const s=this.geometry,i=this._geometryInfo[t];if(null===i.boundingBox){const t=new Ri,e=s.index,r=s.attributes.position;for(let s=i.start,n=i.start+i.count;s=this._geometryCount)return null;const s=this.geometry,i=this._geometryInfo[t];if(null===i.boundingSphere){const e=new $i;this.getBoundingBoxAt(t,Mo),Mo.getCenter(e.center);const r=s.index,n=s.attributes.position;let a=0;for(let t=i.start,s=i.start+i.count;tt.active);if(Math.max(...s.map(t=>t.vertexStart+t.reservedVertexCount))>t)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index){if(Math.max(...s.map(t=>t.indexStart+t.reservedIndexCount))>e)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`)}const i=this.geometry;i.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new In,this._initializeGeometry(i));const r=this.geometry;i.index&&ko(i.index.array,r.index.array);for(const t in i.attributes)ko(i.attributes[t].array,r.attributes[t].array)}raycast(t,e){const s=this._instanceInfo,i=this._geometryInfo,r=this.matrixWorld,n=this.geometry;Co.material=this.material,Co.geometry.index=n.index,Co.geometry.attributes=n.attributes,null===Co.geometry.boundingBox&&(Co.geometry.boundingBox=new Ri),null===Co.geometry.boundingSphere&&(Co.geometry.boundingSphere=new $i);for(let n=0,a=s.length;n({...t,boundingBox:null!==t.boundingBox?t.boundingBox.clone():null,boundingSphere:null!==t.boundingSphere?t.boundingSphere.clone():null})),this._instanceInfo=t._instanceInfo.map(t=>({...t})),this._availableInstanceIds=t._availableInstanceIds.slice(),this._availableGeometryIds=t._availableGeometryIds.slice(),this._nextIndexStart=t._nextIndexStart,this._nextVertexStart=t._nextVertexStart,this._geometryCount=t._geometryCount,this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._indirectTexture=t._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(t,e,s,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const n=i.getIndex(),a=null===n?1:n.array.BYTES_PER_ELEMENT,o=this._instanceInfo,h=this._multiDrawStarts,l=this._multiDrawCounts,c=this._geometryInfo,u=this.perObjectFrustumCulled,d=this._indirectTexture,p=d.image.data,m=s.isArrayCamera?wo:vo;u&&!s.isArrayCamera&&(xo.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse).multiply(this.matrixWorld),vo.setFromProjectionMatrix(xo,s.coordinateSystem,s.reversedDepth));let y=0;if(this.sortObjects){xo.copy(this.matrixWorld).invert(),_o.setFromMatrixPosition(s.matrixWorld).applyMatrix4(xo),Ao.set(0,0,-1).transformDirection(s.matrixWorld).transformDirection(xo);for(let t=0,e=o.length;t0){const s=t[e[0]];if(void 0!==s){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=s.length;ti)return;Lo.applyMatrix4(t.matrixWorld);const h=e.ray.origin.distanceTo(Lo);return he.far?void 0:{distance:h,point:jo.clone().applyMatrix4(t.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:t}}const Uo=new Ks,Ho=new Ks;class qo extends Do{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,s=[];for(let t=0,i=e.count;t0){const s=t[e[0]];if(void 0!==s){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=s.length;tr.far)return;n.push({distance:h,distanceToRay:Math.sqrt(o),point:s,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class th extends Ai{constructor(t,e,s,i,r=1006,n=1006,a,o,h){super(t,e,s,i,r,n,a,o,h),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const l=this;"requestVideoFrameCallback"in t&&(this._requestVideoFrameCallbackId=t.requestVideoFrameCallback(function e(){l.needsUpdate=!0,l._requestVideoFrameCallbackId=t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),super.dispose()}}class eh extends th{constructor(t,e,s,i,r,n,a,o){super({},t,e,s,i,r,n,a,o),this.isVideoFrameTexture=!0}update(){}clone(){return(new this.constructor).copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}}class sh extends Ai{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=gt,this.minFilter=gt,this.generateMipmaps=!1,this.needsUpdate=!0}}class ih extends Ai{constructor(t,e,s,i,r,n,a,o,h,l,c,u){super(null,n,a,o,h,l,i,r,c,u),this.isCompressedTexture=!0,this.image={width:e,height:s},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class rh extends ih{constructor(t,e,s,i,r,n){super(t,e,s,r,n),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=mt,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class nh extends ih{constructor(t,e,s){super(void 0,t[0].width,t[0].height,e,s,ht),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class ah extends Ai{constructor(t,e,s,i,r,n,a,o,h){super(t,e,s,i,r,n,a,o,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class oh extends Ai{constructor(t,e,s=1014,i,r,n,a=1003,o=1003,h,l=1026,c=1){if(l!==Wt&&1027!==l)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:t,height:e,depth:c},i,r,n,a,o,l,s,h),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new wi(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class hh extends Ai{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}}class lh extends In{constructor(t=1,e=1,s=4,i=8,r=1){super(),this.type="CapsuleGeometry",this.parameters={radius:t,height:e,capSegments:s,radialSegments:i,heightSegments:r},e=Math.max(0,e),s=Math.max(1,Math.floor(s)),i=Math.max(3,Math.floor(i)),r=Math.max(1,Math.floor(r));const n=[],a=[],o=[],h=[],l=e/2,c=Math.PI/2*t,u=e,d=2*c+u,p=2*s+r,m=i+1,y=new Ks,g=new Ks;for(let f=0;f<=p;f++){let x=0,b=0,v=0,w=0;if(f<=s){const e=f/s,i=e*Math.PI/2;b=-l-t*Math.cos(i),v=t*Math.sin(i),w=-t*Math.cos(i),x=e*c}else if(f<=s+r){const i=(f-s)/r;b=i*e-l,v=t,w=0,x=c+i*u}else{const e=(f-s-r)/s,i=e*Math.PI/2;b=l+t*Math.sin(i),v=t*Math.cos(i),w=t*Math.sin(i),x=c+u+e*c}const M=Math.max(0,Math.min(1,x/d));let S=0;0===f?S=.5/i:f===p&&(S=-.5/i);for(let t=0;t<=i;t++){const e=t/i,s=e*Math.PI*2,r=Math.sin(s),n=Math.cos(s);g.x=-v*n,g.y=b,g.z=v*r,a.push(g.x,g.y,g.z),y.set(-v*n,w,v*r),y.normalize(),o.push(y.x,y.y,y.z),h.push(e+S,M)}if(f>0){const t=(f-1)*m;for(let e=0;e0||0!==i)&&(l.push(n,a,h),x+=3),(e>0||i!==r-1)&&(l.push(a,o,h),x+=3)}h.addGroup(g,x,0),g+=x}(),!1===n&&(t>0&&f(!0),e>0&&f(!1)),this.setIndex(l),this.setAttribute("position",new wn(c,3)),this.setAttribute("normal",new wn(u,3)),this.setAttribute("uv",new wn(d,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new uh(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class dh extends uh{constructor(t=1,e=1,s=32,i=1,r=!1,n=0,a=2*Math.PI){super(0,t,e,s,i,r,n,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:s,heightSegments:i,openEnded:r,thetaStart:n,thetaLength:a}}static fromJSON(t){return new dh(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ph extends In{constructor(t=[],e=[],s=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:s,detail:i};const r=[],n=[];function a(t,e,s,i){const r=i+1,n=[];for(let i=0;i<=r;i++){n[i]=[];const a=t.clone().lerp(s,i/r),o=e.clone().lerp(s,i/r),h=r-i;for(let t=0;t<=h;t++)n[i][t]=0===t&&i===r?a:a.clone().lerp(o,t/h)}for(let t=0;t.9&&a<.1&&(e<.2&&(n[t+0]+=1),s<.2&&(n[t+2]+=1),i<.2&&(n[t+4]+=1))}}()}(),this.setAttribute("position",new wn(r,3)),this.setAttribute("normal",new wn(r.slice(),3)),this.setAttribute("uv",new wn(n,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ph(t.vertices,t.indices,t.radius,t.details)}}class mh extends ph{constructor(t=1,e=0){const s=(1+Math.sqrt(5))/2,i=1/s;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-s,0,-i,s,0,i,-s,0,i,s,-i,-s,0,-i,s,0,i,-s,0,i,s,0,-s,0,-i,s,0,-i,-s,0,i,s,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new mh(t.radius,t.detail)}}const yh=new Ks,gh=new Ks,fh=new Ks,xh=new Xr;class bh extends In{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const s=4,i=Math.pow(10,s),r=Math.cos(Ws*e),n=t.getIndex(),a=t.getAttribute("position"),o=n?n.count:a.count,h=[0,0,0],l=["a","b","c"],c=new Array(3),u={},d=[];for(let t=0;t0)){h=i;break}h=i-1}if(i=h,s[i]===n)return i/(r-1);const l=s[i];return(i+(n-l)/(s[i+1]-l))/(r-1)}getTangent(t,e){const s=1e-4;let i=t-s,r=t+s;i<0&&(i=0),r>1&&(r=1);const n=this.getPoint(i),a=this.getPoint(r),o=e||(n.isVector2?new $s:new Ks);return o.copy(a).sub(n).normalize(),o}getTangentAt(t,e){const s=this.getUtoTmapping(t);return this.getTangent(s,e)}computeFrenetFrames(t,e=!1){const s=new Ks,i=[],r=[],n=[],a=new Ks,o=new ar;for(let e=0;e<=t;e++){const s=e/t;i[e]=this.getTangentAt(s,new Ks)}r[0]=new Ks,n[0]=new Ks;let h=Number.MAX_VALUE;const l=Math.abs(i[0].x),c=Math.abs(i[0].y),u=Math.abs(i[0].z);l<=h&&(h=l,s.set(1,0,0)),c<=h&&(h=c,s.set(0,1,0)),u<=h&&s.set(0,0,1),a.crossVectors(i[0],s).normalize(),r[0].crossVectors(i[0],a),n[0].crossVectors(i[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),n[e]=n[e-1].clone(),a.crossVectors(i[e-1],i[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(qs(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}n[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(qs(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let s=1;s<=t;s++)r[s].applyMatrix4(o.makeRotationAxis(i[s],e*s)),n[s].crossVectors(i[s],r[s])}return{tangents:i,normals:r,binormals:n}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class wh extends vh{constructor(t=0,e=0,s=1,i=1,r=0,n=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=s,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=n,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new $s){const s=e,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const n=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(h)/r)+1)*r:0===l&&h===r-1&&(h=r-2,l=1),this.closed||h>0?a=i[(h-1)%r]:(_h.subVectors(i[0],i[1]).add(i[0]),a=_h);const c=i[h%r],u=i[(h+1)%r];if(this.closed||h+2i.length-2?i.length-1:n+1],c=i[n>i.length-3?i.length-1:n+2];return s.set(Ih(a,o.x,h.x,l.x,c.x),Ih(a,o.y,h.y,l.y,c.y)),s}copy(t){super.copy(t),this.points=[];for(let e=0,s=t.points.length;e=s){const t=i[r]-s,n=this.curves[r],a=n.getLength(),o=0===a?0:1-t/a;return n.getPointAt(o,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let s=0,i=this.curves.length;s1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,s=t.curves.length;e0){const t=h.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(h);const l=h.getPoint(1);return this.currentPoint.copy(l),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class Wh extends Dh{constructor(t){super(t),this.uuid=Hs(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let s=0,i=this.holes.length;s80*s){o=1/0,h=1/0;let e=-1/0,i=-1/0;for(let n=s;ne&&(e=s),r>i&&(i=r)}l=Math.max(e-o,i-h),l=0!==l?32767/l:0}return Jh(n,a,s,o,h,l,0),a}function Hh(t,e,s,i,r){let n;if(r===function(t,e,s,i){let r=0;for(let n=e,a=s-i;n0)for(let r=e;r=e;r-=i)n=dl(r/i|0,t[r],t[r+1],n);return n&&al(n,n.next)&&(pl(n),n=n.next),n}function qh(t,e){if(!t)return t;e||(e=t);let s,i=t;do{if(s=!1,i.steiner||!al(i,i.next)&&0!==nl(i.prev,i,i.next))i=i.next;else{if(pl(i),i=e=i.prev,i===i.next)break;s=!0}}while(s||i!==e);return e}function Jh(t,e,s,i,r,n,a){if(!t)return;!a&&n&&function(t,e,s,i){let r=t;do{0===r.z&&(r.z=tl(r.x,r.y,e,s,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,s=1;do{let i,r=t;t=null;let n=null;for(e=0;r;){e++;let a=r,o=0;for(let t=0;t0||h>0&&a;)0!==o&&(0===h||!a||r.z<=a.z)?(i=r,r=r.nextZ,o--):(i=a,a=a.nextZ,h--),n?n.nextZ=i:t=i,i.prevZ=n,n=i;r=a}n.nextZ=null,s*=2}while(e>1)}(r)}(t,i,r,n);let o=t;for(;t.prev!==t.next;){const h=t.prev,l=t.next;if(n?Yh(t,i,r,n):Xh(t))e.push(h.i,t.i,l.i),pl(t),t=l.next,o=l.next;else if((t=l)===o){a?1===a?Jh(t=Zh(qh(t),e),e,s,i,r,n,2):2===a&&Gh(t,e,s,i,r,n):Jh(qh(t),e,s,i,r,n,1);break}}}function Xh(t){const e=t.prev,s=t,i=t.next;if(nl(e,s,i)>=0)return!1;const r=e.x,n=s.x,a=i.x,o=e.y,h=s.y,l=i.y,c=Math.min(r,n,a),u=Math.min(o,h,l),d=Math.max(r,n,a),p=Math.max(o,h,l);let m=i.next;for(;m!==e;){if(m.x>=c&&m.x<=d&&m.y>=u&&m.y<=p&&il(r,o,n,h,a,l,m.x,m.y)&&nl(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Yh(t,e,s,i){const r=t.prev,n=t,a=t.next;if(nl(r,n,a)>=0)return!1;const o=r.x,h=n.x,l=a.x,c=r.y,u=n.y,d=a.y,p=Math.min(o,h,l),m=Math.min(c,u,d),y=Math.max(o,h,l),g=Math.max(c,u,d),f=tl(p,m,e,s,i),x=tl(y,g,e,s,i);let b=t.prevZ,v=t.nextZ;for(;b&&b.z>=f&&v&&v.z<=x;){if(b.x>=p&&b.x<=y&&b.y>=m&&b.y<=g&&b!==r&&b!==a&&il(o,c,h,u,l,d,b.x,b.y)&&nl(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,v.x>=p&&v.x<=y&&v.y>=m&&v.y<=g&&v!==r&&v!==a&&il(o,c,h,u,l,d,v.x,v.y)&&nl(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;b&&b.z>=f;){if(b.x>=p&&b.x<=y&&b.y>=m&&b.y<=g&&b!==r&&b!==a&&il(o,c,h,u,l,d,b.x,b.y)&&nl(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=x;){if(v.x>=p&&v.x<=y&&v.y>=m&&v.y<=g&&v!==r&&v!==a&&il(o,c,h,u,l,d,v.x,v.y)&&nl(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Zh(t,e){let s=t;do{const i=s.prev,r=s.next.next;!al(i,r)&&ol(i,s,s.next,r)&&cl(i,r)&&cl(r,i)&&(e.push(i.i,s.i,r.i),pl(s),pl(s.next),s=t=r),s=s.next}while(s!==t);return qh(s)}function Gh(t,e,s,i,r,n){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&rl(a,t)){let o=ul(a,t);return a=qh(a,a.next),o=qh(o,o.next),Jh(a,e,s,i,r,n,0),void Jh(o,e,s,i,r,n,0)}t=t.next}a=a.next}while(a!==t)}function $h(t,e){let s=t.x-e.x;if(0===s&&(s=t.y-e.y,0===s)){s=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return s}function Qh(t,e){const s=function(t,e){let s=e;const i=t.x,r=t.y;let n,a=-1/0;if(al(t,s))return s;do{if(al(t,s.next))return s.next;if(r<=s.y&&r>=s.next.y&&s.next.y!==s.y){const t=s.x+(r-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(t<=i&&t>a&&(a=t,n=s.x=s.x&&s.x>=h&&i!==s.x&&sl(rn.x||s.x===n.x&&Kh(n,s)))&&(n=s,c=e)}s=s.next}while(s!==o);return n}(t,e);if(!s)return e;const i=ul(s,t);return qh(i,i.next),qh(s,s.next)}function Kh(t,e){return nl(t.prev,t,e.prev)<0&&nl(e.next,t,t.next)<0}function tl(t,e,s,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function el(t){let e=t,s=t;do{(e.x=(t-a)*(n-o)&&(t-a)*(i-o)>=(s-a)*(e-o)&&(s-a)*(n-o)>=(r-a)*(i-o)}function il(t,e,s,i,r,n,a,o){return!(t===a&&e===o)&&sl(t,e,s,i,r,n,a,o)}function rl(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let s=t;do{if(s.i!==t.i&&s.next.i!==t.i&&s.i!==e.i&&s.next.i!==e.i&&ol(s,s.next,t,e))return!0;s=s.next}while(s!==t);return!1}(t,e)&&(cl(t,e)&&cl(e,t)&&function(t,e){let s=t,i=!1;const r=(t.x+e.x)/2,n=(t.y+e.y)/2;do{s.y>n!=s.next.y>n&&s.next.y!==s.y&&r<(s.next.x-s.x)*(n-s.y)/(s.next.y-s.y)+s.x&&(i=!i),s=s.next}while(s!==t);return i}(t,e)&&(nl(t.prev,t,e.prev)||nl(t,e.prev,e))||al(t,e)&&nl(t.prev,t,t.next)>0&&nl(e.prev,e,e.next)>0)}function nl(t,e,s){return(e.y-t.y)*(s.x-e.x)-(e.x-t.x)*(s.y-e.y)}function al(t,e){return t.x===e.x&&t.y===e.y}function ol(t,e,s,i){const r=ll(nl(t,e,s)),n=ll(nl(t,e,i)),a=ll(nl(s,i,t)),o=ll(nl(s,i,e));return r!==n&&a!==o||(!(0!==r||!hl(t,s,e))||(!(0!==n||!hl(t,i,e))||(!(0!==a||!hl(s,t,i))||!(0!==o||!hl(s,e,i)))))}function hl(t,e,s){return e.x<=Math.max(t.x,s.x)&&e.x>=Math.min(t.x,s.x)&&e.y<=Math.max(t.y,s.y)&&e.y>=Math.min(t.y,s.y)}function ll(t){return t>0?1:t<0?-1:0}function cl(t,e){return nl(t.prev,t,t.next)<0?nl(t,e,t.next)>=0&&nl(t,t.prev,e)>=0:nl(t,e,t.prev)<0||nl(t,t.next,e)<0}function ul(t,e){const s=ml(t.i,t.x,t.y),i=ml(e.i,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,s.next=r,r.prev=s,i.next=s,s.prev=i,n.next=i,i.prev=n,i}function dl(t,e,s,i){const r=ml(t,e,s);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function pl(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function ml(t,e,s){return{i:t,x:e,y:s,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class yl{static triangulate(t,e,s=2){return Uh(t,e,s)}}class gl{static area(t){const e=t.length;let s=0;for(let i=e-1,r=0;r2&&t[e-1].equals(t[0])&&t.pop()}function xl(t,e){for(let s=0;sNumber.EPSILON){const u=Math.sqrt(c),d=Math.sqrt(h*h+l*l),p=e.x-o/u,m=e.y+a/u,y=((s.x-l/d-p)*l-(s.y+h/d-m)*h)/(a*l-o*h);i=p+a*y-t.x,r=m+o*y-t.y;const g=i*i+r*r;if(g<=2)return new $s(i,r);n=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?h>Number.EPSILON&&(t=!0):a<-Number.EPSILON?h<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(l)&&(t=!0),t?(i=-o,r=a,n=Math.sqrt(c)):(i=a,r=o,n=Math.sqrt(c/2))}return new $s(i/n,r/n)}const k=[];for(let t=0,e=z.length,s=e-1,i=t+1;t=0;t--){const e=t/p,s=c*Math.cos(e*Math.PI/2),i=u*Math.sin(e*Math.PI/2)+d;for(let t=0,e=z.length;t=0;){const i=s;let r=s-1;r<0&&(r=t.length-1);for(let t=0,s=o+2*p;t0)&&d.push(e,r,h),(t!==s-1||o0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class Ll extends en{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Qr(16777215),this.specular=new Qr(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Qr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new $s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new gr,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class jl extends en{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Qr(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Qr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new $s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class Dl extends en{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new $s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class Wl extends en{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Qr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Qr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new $s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new gr,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Ul extends en{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class Hl extends en{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}class ql extends en{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Qr(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new $s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Jl extends Ro{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function Xl(t,e){return t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t}function Yl(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Zl(t){const e=t.length,s=new Array(e);for(let t=0;t!==e;++t)s[t]=t;return s.sort(function(e,s){return t[e]-t[s]}),s}function Gl(t,e,s){const i=t.length,r=new t.constructor(i);for(let n=0,a=0;a!==i;++n){const i=s[n]*e;for(let s=0;s!==e;++s)r[a++]=t[i+s]}return r}function $l(t,e,s,i){let r=1,n=t[0];for(;void 0!==n&&void 0===n[i];)n=t[r++];if(void 0===n)return;let a=n[i];if(void 0!==a)if(Array.isArray(a))do{a=n[i],void 0!==a&&(e.push(n.time),s.push(...a)),n=t[r++]}while(void 0!==n);else if(void 0!==a.toArray)do{a=n[i],void 0!==a&&(e.push(n.time),a.toArray(s,s.length)),n=t[r++]}while(void 0!==n);else do{a=n[i],void 0!==a&&(e.push(n.time),s.push(a)),n=t[r++]}while(void 0!==n)}class Ql{static convertArray(t,e){return Xl(t,e)}static isTypedArray(t){return Yl(t)}static getKeyframeOrder(t){return Zl(t)}static sortedArray(t,e,s){return Gl(t,e,s)}static flattenJSON(t,e,s,i){$l(t,e,s,i)}static subclip(t,e,s,i,r=30){return function(t,e,s,i,r=30){const n=t.clone();n.name=e;const a=[];for(let t=0;t=i)){h.push(e.times[t]);for(let s=0;sn.tracks[t].times[0]&&(o=n.tracks[t].times[0]);for(let t=0;t=i.times[u]){const t=u*h+o,e=t+h-o;d=i.values.slice(t,e)}else{const t=i.createInterpolant(),e=o,s=h-o;t.evaluate(n),d=t.resultBuffer.slice(e,s)}"quaternion"===r&&(new Qs).fromArray(d).normalize().conjugate().toArray(d);const p=a.times.length;for(let t=0;t=r)){const a=e[1];t=r)break e}n=s,s=0;break s}break t}for(;s>>1;te;)--n;if(++n,0!==r||n!==i){r>=n&&(n=Math.max(n,1),r=n-1);const t=this.getValueSize();this.times=s.slice(r,n),this.values=this.values.slice(r*t,n*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const s=this.times,i=this.values,r=s.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let n=null;for(let e=0;e!==r;e++){const i=s[e];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==n&&n>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,n),t=!1;break}n=i}if(void 0!==i&&Yl(i))for(let e=0,s=i.length;e!==s;++e){const s=i[e];if(isNaN(s)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,s),t=!1;break}}return t}optimize(){const t=this.times.slice(),e=this.values.slice(),s=this.getValueSize(),i=this.getInterpolation()===Re,r=t.length-1;let n=1;for(let a=1;a0){t[n]=t[r];for(let t=r*s,i=n*s,a=0;a!==s;++a)e[i+a]=e[t+a];++n}return n!==t.length?(this.times=t.slice(0,n),this.values=e.slice(0,n*s)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),s=new(0,this.constructor)(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}}ic.prototype.ValueTypeName="",ic.prototype.TimeBufferType=Float32Array,ic.prototype.ValueBufferType=Float32Array,ic.prototype.DefaultInterpolation=Ee;class rc extends ic{constructor(t,e,s){super(t,e,s)}}rc.prototype.ValueTypeName="bool",rc.prototype.ValueBufferType=Array,rc.prototype.DefaultInterpolation=ke,rc.prototype.InterpolantFactoryMethodLinear=void 0,rc.prototype.InterpolantFactoryMethodSmooth=void 0;class nc extends ic{constructor(t,e,s,i){super(t,e,s,i)}}nc.prototype.ValueTypeName="color";class ac extends ic{constructor(t,e,s,i){super(t,e,s,i)}}ac.prototype.ValueTypeName="number";class oc extends Kl{constructor(t,e,s,i){super(t,e,s,i)}interpolate_(t,e,s,i){const r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=(s-e)/(i-e);let h=t*a;for(let t=h+a;h!==t;h+=4)Qs.slerpFlat(r,0,n,h-a,n,h,o);return r}}class hc extends ic{constructor(t,e,s,i){super(t,e,s,i)}InterpolantFactoryMethodLinear(t){return new oc(this.times,this.values,this.getValueSize(),t)}}hc.prototype.ValueTypeName="quaternion",hc.prototype.InterpolantFactoryMethodSmooth=void 0;class lc extends ic{constructor(t,e,s){super(t,e,s)}}lc.prototype.ValueTypeName="string",lc.prototype.ValueBufferType=Array,lc.prototype.DefaultInterpolation=ke,lc.prototype.InterpolantFactoryMethodLinear=void 0,lc.prototype.InterpolantFactoryMethodSmooth=void 0;class cc extends ic{constructor(t,e,s,i){super(t,e,s,i)}}cc.prototype.ValueTypeName="vector";class uc{constructor(t="",e=-1,s=[],i=2500){this.name=t,this.tracks=s,this.duration=e,this.blendMode=i,this.uuid=Hs(),this.userData={},this.duration<0&&this.resetDuration()}static parse(t){const e=[],s=t.tracks,i=1/(t.fps||1);for(let t=0,r=s.length;t!==r;++t)e.push(dc(s[t]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r.userData=JSON.parse(t.userData||"{}"),r}static toJSON(t){const e=[],s=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode,userData:JSON.stringify(t.userData)};for(let t=0,i=s.length;t!==i;++t)e.push(ic.toJSON(s[t]));return i}static CreateFromMorphTargetSequence(t,e,s,i){const r=e.length,n=[];for(let t=0;t1){const t=n[1];let e=i[t];e||(i[t]=e=[]),e.push(s)}}const n=[];for(const t in i)n.push(this.CreateFromMorphTargetSequence(t,i[t],e,s));return n}static parseAnimation(t,e){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const s=function(t,e,s,i,r){if(0!==s.length){const n=[],a=[];$l(s,n,a,i),0!==n.length&&r.push(new t(e,n,a))}},i=[],r=t.name||"default",n=t.fps||30,a=t.blendMode;let o=t.length||-1;const h=t.hierarchy||[];for(let t=0;t{e&&e(r),this.manager.itemEnd(t)},0),r;if(void 0!==fc[t])return void fc[t].push({onLoad:e,onProgress:s,onError:i});fc[t]=[],fc[t].push({onLoad:e,onProgress:s,onError:i});const n=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,o=this.responseType;fetch(n).then(e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const s=fc[t],i=e.body.getReader(),r=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),n=r?parseInt(r):0,a=0!==n;let o=0;const h=new ReadableStream({start(t){!function e(){i.read().then(({done:i,value:r})=>{if(i)t.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:n});for(let t=0,e=s.length;t{t.error(e)})}()}});return new Response(h)}throw new xc(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)}).then(t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then(t=>(new DOMParser).parseFromString(t,a));case"json":return t.json();default:if(""===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),s=e&&e[1]?e[1].toLowerCase():void 0,i=new TextDecoder(s);return t.arrayBuffer().then(t=>i.decode(t))}}}).then(e=>{pc.add(`file:${t}`,e);const s=fc[t];delete fc[t];for(let t=0,i=s.length;t{const s=fc[t];if(void 0===s)throw this.manager.itemError(t),e;delete fc[t];for(let t=0,i=s.length;t{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class vc extends gc{constructor(t){super(t)}load(t,e,s,i){const r=this,n=new bc(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(s){try{e(r.parse(JSON.parse(s)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}},s,i)}parse(t){const e=[];for(let s=0;s0:i.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const e in t.uniforms){const r=t.uniforms[e];switch(i.uniforms[e]={},r.type){case"t":i.uniforms[e].value=s(r.value);break;case"c":i.uniforms[e].value=(new Qr).setHex(r.value);break;case"v2":i.uniforms[e].value=(new $s).fromArray(r.value);break;case"v3":i.uniforms[e].value=(new Ks).fromArray(r.value);break;case"v4":i.uniforms[e].value=(new Ti).fromArray(r.value);break;case"m3":i.uniforms[e].value=(new si).fromArray(r.value);break;case"m4":i.uniforms[e].value=(new ar).fromArray(r.value);break;default:i.uniforms[e].value=r.value}}if(void 0!==t.defines&&(i.defines=t.defines),void 0!==t.vertexShader&&(i.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(i.fragmentShader=t.fragmentShader),void 0!==t.glslVersion&&(i.glslVersion=t.glslVersion),void 0!==t.extensions)for(const e in t.extensions)i.extensions[e]=t.extensions[e];if(void 0!==t.lights&&(i.lights=t.lights),void 0!==t.clipping&&(i.clipping=t.clipping),void 0!==t.size&&(i.size=t.size),void 0!==t.sizeAttenuation&&(i.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(i.map=s(t.map)),void 0!==t.matcap&&(i.matcap=s(t.matcap)),void 0!==t.alphaMap&&(i.alphaMap=s(t.alphaMap)),void 0!==t.bumpMap&&(i.bumpMap=s(t.bumpMap)),void 0!==t.bumpScale&&(i.bumpScale=t.bumpScale),void 0!==t.normalMap&&(i.normalMap=s(t.normalMap)),void 0!==t.normalMapType&&(i.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),i.normalScale=(new $s).fromArray(e)}return void 0!==t.displacementMap&&(i.displacementMap=s(t.displacementMap)),void 0!==t.displacementScale&&(i.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(i.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(i.roughnessMap=s(t.roughnessMap)),void 0!==t.metalnessMap&&(i.metalnessMap=s(t.metalnessMap)),void 0!==t.emissiveMap&&(i.emissiveMap=s(t.emissiveMap)),void 0!==t.emissiveIntensity&&(i.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(i.specularMap=s(t.specularMap)),void 0!==t.specularIntensityMap&&(i.specularIntensityMap=s(t.specularIntensityMap)),void 0!==t.specularColorMap&&(i.specularColorMap=s(t.specularColorMap)),void 0!==t.envMap&&(i.envMap=s(t.envMap)),void 0!==t.envMapRotation&&i.envMapRotation.fromArray(t.envMapRotation),void 0!==t.envMapIntensity&&(i.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(i.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(i.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(i.lightMap=s(t.lightMap)),void 0!==t.lightMapIntensity&&(i.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(i.aoMap=s(t.aoMap)),void 0!==t.aoMapIntensity&&(i.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(i.gradientMap=s(t.gradientMap)),void 0!==t.clearcoatMap&&(i.clearcoatMap=s(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=s(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(i.clearcoatNormalMap=s(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(i.clearcoatNormalScale=(new $s).fromArray(t.clearcoatNormalScale)),void 0!==t.iridescenceMap&&(i.iridescenceMap=s(t.iridescenceMap)),void 0!==t.iridescenceThicknessMap&&(i.iridescenceThicknessMap=s(t.iridescenceThicknessMap)),void 0!==t.transmissionMap&&(i.transmissionMap=s(t.transmissionMap)),void 0!==t.thicknessMap&&(i.thicknessMap=s(t.thicknessMap)),void 0!==t.anisotropyMap&&(i.anisotropyMap=s(t.anisotropyMap)),void 0!==t.sheenColorMap&&(i.sheenColorMap=s(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(i.sheenRoughnessMap=s(t.sheenRoughnessMap)),i}setTextures(t){return this.textures=t,this}createMaterialFromType(t){return Xc.createMaterialFromType(t)}static createMaterialFromType(t){return new{ShadowMaterial:Ol,SpriteMaterial:pa,RawShaderMaterial:Nl,ShaderMaterial:Yn,PointsMaterial:Xo,MeshPhysicalMaterial:Fl,MeshStandardMaterial:Vl,MeshPhongMaterial:Ll,MeshToonMaterial:jl,MeshNormalMaterial:Dl,MeshLambertMaterial:Wl,MeshDepthMaterial:Ul,MeshDistanceMaterial:Hl,MeshBasicMaterial:sn,MeshMatcapMaterial:ql,LineDashedMaterial:Jl,LineBasicMaterial:Ro,Material:en}[t]}}class Yc{static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}class Zc extends In{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){const t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class Gc extends gc{constructor(t){super(t)}load(t,e,s,i){const r=this,n=new bc(r.manager);n.setPath(r.path),n.setRequestHeader(r.requestHeader),n.setWithCredentials(r.withCredentials),n.load(t,function(s){try{e(r.parse(JSON.parse(s)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}},s,i)}parse(t){const e={},s={};function i(t,i){if(void 0!==e[i])return e[i];const r=t.interleavedBuffers[i],n=function(t,e){if(void 0!==s[e])return s[e];const i=t.arrayBuffers,r=i[e],n=new Uint32Array(r).buffer;return s[e]=n,n}(t,r.buffer),a=ai(r.type,n),o=new ca(a,r.stride);return o.uuid=r.uuid,e[i]=o,o}const r=t.isInstancedBufferGeometry?new Zc:new In,n=t.data.index;if(void 0!==n){const t=ai(n.type,n.array);r.setIndex(new dn(t,1))}const a=t.data.attributes;for(const e in a){const s=a[e];let n;if(s.isInterleavedBufferAttribute){const e=i(t.data,s.data);n=new da(e,s.itemSize,s.offset,s.normalized)}else{const t=ai(s.type,s.array);n=new(s.isInstancedBufferAttribute?Xa:dn)(t,s.itemSize,s.normalized)}void 0!==s.name&&(n.name=s.name),void 0!==s.usage&&n.setUsage(s.usage),r.setAttribute(e,n)}const o=t.data.morphAttributes;if(o)for(const e in o){const s=o[e],n=[];for(let e=0,r=s.length;e0){const s=new mc(e);r=new Sc(s),r.setCrossOrigin(this.crossOrigin);for(let e=0,s=t.length;e0){i=new Sc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e{let e=null,s=null;return void 0!==t.boundingBox&&(e=(new Ri).fromJSON(t.boundingBox)),void 0!==t.boundingSphere&&(s=(new $i).fromJSON(t.boundingSphere)),{...t,boundingBox:e,boundingSphere:s}}),n._instanceInfo=t.instanceInfo,n._availableInstanceIds=t._availableInstanceIds,n._availableGeometryIds=t._availableGeometryIds,n._nextIndexStart=t.nextIndexStart,n._nextVertexStart=t.nextVertexStart,n._geometryCount=t.geometryCount,n._maxInstanceCount=t.maxInstanceCount,n._maxVertexCount=t.maxVertexCount,n._maxIndexCount=t.maxIndexCount,n._geometryInitialized=t.geometryInitialized,n._matricesTexture=c(t.matricesTexture.uuid),n._indirectTexture=c(t.indirectTexture.uuid),void 0!==t.colorsTexture&&(n._colorsTexture=c(t.colorsTexture.uuid)),void 0!==t.boundingSphere&&(n.boundingSphere=(new $i).fromJSON(t.boundingSphere)),void 0!==t.boundingBox&&(n.boundingBox=(new Ri).fromJSON(t.boundingBox));break;case"LOD":n=new ka;break;case"Line":n=new Do(h(t.geometry),l(t.material));break;case"LineLoop":n=new Jo(h(t.geometry),l(t.material));break;case"LineSegments":n=new qo(h(t.geometry),l(t.material));break;case"PointCloud":case"Points":n=new Qo(h(t.geometry),l(t.material));break;case"Sprite":n=new za(l(t.material));break;case"Group":n=new ra;break;case"Bone":n=new Wa;break;default:n=new Rr}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(n.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(n.matrixAutoUpdate=t.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.rotation&&n.rotation.fromArray(t.rotation),void 0!==t.quaternion&&n.quaternion.fromArray(t.quaternion),void 0!==t.scale&&n.scale.fromArray(t.scale)),void 0!==t.up&&n.up.fromArray(t.up),void 0!==t.castShadow&&(n.castShadow=t.castShadow),void 0!==t.receiveShadow&&(n.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.intensity&&(n.shadow.intensity=t.shadow.intensity),void 0!==t.shadow.bias&&(n.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(n.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(n.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&n.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(n.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.frustumCulled&&(n.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(n.renderOrder=t.renderOrder),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.layers&&(n.layers.mask=t.layers),void 0!==t.children){const a=t.children;for(let t=0;t{if(!0!==eu.has(n))return e&&e(s),r.manager.itemEnd(t),s;i&&i(eu.get(n)),r.manager.itemError(t),r.manager.itemEnd(t)}):(setTimeout(function(){e&&e(n),r.manager.itemEnd(t)},0),n);const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,a.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const o=fetch(t,a).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(s){return pc.add(`image-bitmap:${t}`,s),e&&e(s),r.manager.itemEnd(t),s}).catch(function(e){i&&i(e),eu.set(o,e),pc.remove(`image-bitmap:${t}`),r.manager.itemError(t),r.manager.itemEnd(t)});pc.add(`image-bitmap:${t}`,o),r.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let iu;class ru{static getContext(){return void 0===iu&&(iu=new(window.AudioContext||window.webkitAudioContext)),iu}static setContext(t){iu=t}}class nu extends gc{constructor(t){super(t)}load(t,e,s,i){const r=this,n=new bc(this.manager);function a(e){i?i(e):console.error(e),r.manager.itemError(t)}n.setResponseType("arraybuffer"),n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(t){try{const s=t.slice(0);ru.getContext().decodeAudioData(s,function(t){e(t)}).catch(a)}catch(t){a(t)}},s,i)}}const au=new ar,ou=new ar,hu=new ar;class lu{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Kn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Kn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,hu.copy(t.projectionMatrix);const s=e.eyeSep/2,i=s*e.near/e.focus,r=e.near*Math.tan(Ws*e.fov*.5)/e.zoom;let n,a;ou.elements[12]=-s,au.elements[12]=s,n=-r*e.aspect+i,a=r*e.aspect+i,hu.elements[0]=2*e.near/(a-n),hu.elements[8]=(a+n)/(a-n),this.cameraL.projectionMatrix.copy(hu),n=-r*e.aspect-i,a=r*e.aspect-i,hu.elements[0]=2*e.near/(a-n),hu.elements[8]=(a+n)/(a-n),this.cameraR.projectionMatrix.copy(hu)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(ou),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(au)}}class cu extends Kn{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}}class uu{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=performance.now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}const du=new Ks,pu=new Qs,mu=new Ks,yu=new Ks,gu=new Ks;class fu extends Rr{constructor(){super(),this.type="AudioListener",this.context=ru.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new uu}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(du,pu,mu),yu.set(0,0,-1).applyQuaternion(pu),gu.set(0,1,0).applyQuaternion(pu),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(du.x,t),e.positionY.linearRampToValueAtTime(du.y,t),e.positionZ.linearRampToValueAtTime(du.z,t),e.forwardX.linearRampToValueAtTime(yu.x,t),e.forwardY.linearRampToValueAtTime(yu.y,t),e.forwardZ.linearRampToValueAtTime(yu.z,t),e.upX.linearRampToValueAtTime(gu.x,t),e.upY.linearRampToValueAtTime(gu.y,t),e.upZ.linearRampToValueAtTime(gu.z,t)}else e.setPosition(du.x,du.y,du.z),e.setOrientation(yu.x,yu.y,yu.z,gu.x,gu.y,gu.z)}}class xu extends Rr{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(t=0){if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(s,i,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(s[t]!==s[t+e]){a.setValue(s,i);break}}saveOriginalState(){const t=this.binding,e=this.buffer,s=this.valueSize,i=s*this._origIndex;t.getValue(e,i);for(let t=s,r=i;t!==r;++t)e[t]=e[i+t%s];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let s=t;s=.5)for(let i=0;i!==r;++i)t[e+i]=t[s+i]}_slerp(t,e,s,i){Qs.slerpFlat(t,e,t,e,t,s,i)}_slerpAdditive(t,e,s,i,r){const n=this._workIndex*r;Qs.multiplyQuaternionsFlat(t,n,t,e,t,s),Qs.slerpFlat(t,e,t,e,t,n,i)}_lerp(t,e,s,i,r){const n=1-i;for(let a=0;a!==r;++a){const r=e+a;t[r]=t[r]*n+t[s+a]*i}}_lerpAdditive(t,e,s,i,r){for(let n=0;n!==r;++n){const r=e+n;t[r]=t[r]+t[s+n]*i}}}const Tu="\\[\\]\\.:\\/",zu=new RegExp("["+Tu+"]","g"),Cu="[^"+Tu+"]",Iu="[^"+Tu.replace("\\.","")+"]",Bu=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Cu)+/(WCOD+)?/.source.replace("WCOD",Iu)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Cu)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Cu)+"$"),ku=["material","materials","bones","map"];class Eu{constructor(t,e,s){this.path=e,this.parsedPath=s||Eu.parseTrackName(e),this.node=Eu.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,s){return t&&t.isAnimationObjectGroup?new Eu.Composite(t,e,s):new Eu(t,e,s)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(zu,"")}static parseTrackName(t){const e=Bu.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const s={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=s.nodeName&&s.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=s.nodeName.substring(i+1);-1!==ku.indexOf(t)&&(s.nodeName=s.nodeName.substring(0,i),s.objectName=t)}if(null===s.propertyName||0===s.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return s}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const s=t.skeleton.getBoneByName(e);if(void 0!==s)return s}if(t.children){const s=function(t){for(let i=0;i=r){const n=r++,l=t[n];e[l.uuid]=h,t[h]=l,e[o]=n,t[n]=a;for(let t=0,e=i;t!==e;++t){const e=s[t],i=e[n],r=e[h];e[h]=i,e[n]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,s=this._bindings,i=s.length;let r=this.nCachedObjects_,n=t.length;for(let a=0,o=arguments.length;a!==o;++a){const o=arguments[a].uuid,h=e[o];if(void 0!==h)if(delete e[o],h0&&(e[a.uuid]=h),t[h]=a,t.pop();for(let t=0,e=i;t!==e;++t){const e=s[t];e[h]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const s=this._bindingsIndicesByPath;let i=s[t];const r=this._bindings;if(void 0!==i)return r[i];const n=this._paths,a=this._parsedPaths,o=this._objects,h=o.length,l=this.nCachedObjects_,c=new Array(h);i=r.length,s[t]=i,n.push(t),a.push(e),r.push(c);for(let s=l,i=o.length;s!==i;++s){const i=o[s];c[s]=new Eu(i,t,e)}return c}unsubscribe_(t){const e=this._bindingsIndicesByPath,s=e[t];if(void 0!==s){const i=this._paths,r=this._parsedPaths,n=this._bindings,a=n.length-1,o=n[a];e[t[a]]=s,n[s]=o,n.pop(),r[s]=r[a],r.pop(),i[s]=i[a],i.pop()}}}class Pu{constructor(t,e,s=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=s,this.blendMode=i;const r=e.tracks,n=r.length,a=new Array(n),o={endingStart:Pe,endingEnd:Pe};for(let t=0;t!==n;++t){const e=r[t].createInterpolant(null);a[t]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(n),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,s=!1){if(t.fadeOut(e),this.fadeIn(e),!0===s){const s=this._clip.duration,i=t._clip.duration,r=i/s,n=s/i;t.warp(1,r,e),this.warp(n,1,e)}return this}crossFadeTo(t,e,s=!1){return t.crossFadeFrom(this,e,s)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,s){const i=this._mixer,r=i.time,n=this.timeScale;let a=this._timeScaleInterpolant;null===a&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const o=a.parameterPositions,h=a.sampleValues;return o[0]=r,o[1]=r+s,h[0]=t/n,h[1]=e/n,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,s,i){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const i=(t-r)*s;i<0||0===s?e=0:(this._startTime=null,e=s*i)}e*=this._updateTimeScale(t);const n=this._updateTime(e),a=this._updateWeight(t);if(a>0){const t=this._interpolants,e=this._propertyBindings;if(this.blendMode===Fe)for(let s=0,i=t.length;s!==i;++s)t[s].evaluate(n),e[s].accumulateAdditive(a);else for(let s=0,r=t.length;s!==r;++s)t[s].evaluate(n),e[s].accumulate(i,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const s=this._weightInterpolant;if(null!==s){const i=s.evaluate(t)[0];e*=i,t>s.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const s=this._timeScaleInterpolant;if(null!==s){e*=s.evaluate(t)[0],t>s.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,s=this.loop;let i=this.time+t,r=this._loopCount;const n=2202===s;if(0===t)return-1===r||!n||1&~r?i:e-i;if(2200===s){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else{if(!(i<0)){this.time=i;break t}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,n)):this._setEndings(0===this.repetitions,!0,n)),i>=e||i<0){const s=Math.floor(i/e);i-=e*s,r+=Math.abs(s);const a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){const e=t<0;this._setEndings(e,!e,n)}else this._setEndings(!1,!1,n);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:s})}}else this.time=i;if(n&&!(1&~r))return e-i}return i}_setEndings(t,e,s){const i=this._interpolantSettings;s?(i.endingStart=Oe,i.endingEnd=Oe):(i.endingStart=t?this.zeroSlopeAtStart?Oe:Pe:Ne,i.endingEnd=e?this.zeroSlopeAtEnd?Oe:Pe:Ne)}_scheduleFading(t,e,s){const i=this._mixer,r=i.time;let n=this._weightInterpolant;null===n&&(n=i._lendControlInterpolant(),this._weightInterpolant=n);const a=n.parameterPositions,o=n.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=s,this}}const Ou=new Float32Array(1);class Nu extends Ls{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const s=t._localRoot||this._root,i=t._clip.tracks,r=i.length,n=t._propertyBindings,a=t._interpolants,o=s.uuid,h=this._bindingsByRootAndName;let l=h[o];void 0===l&&(l={},h[o]=l);for(let t=0;t!==r;++t){const r=i[t],h=r.name;let c=l[h];if(void 0!==c)++c.referenceCount,n[t]=c;else{if(c=n[t],void 0!==c){null===c._cacheIndex&&(++c.referenceCount,this._addInactiveBinding(c,o,h));continue}const i=e&&e._propertyBindings[t].binding.parsedPath;c=new Au(Eu.create(s,h,i),r.ValueTypeName,r.getValueSize()),++c.referenceCount,this._addInactiveBinding(c,o,h),n[t]=c}a[t].resultBuffer=c.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,s=t._clip.uuid,i=this._actionsByClip[s];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,s,e)}const e=t._propertyBindings;for(let t=0,s=e.length;t!==s;++t){const s=e[t];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,s=e.length;t!==s;++t){const s=e[t];0===--s.useCount&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,s=this._nActiveActions,i=this.time+=t,r=Math.sign(t),n=this._accuIndex^=1;for(let a=0;a!==s;++a){e[a]._update(i,t,r,n)}const a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(n);return this}setTime(t){this.time=0;for(let t=0;t=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Qu).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const td=new Ks,ed=new Ks,sd=new Ks,id=new Ks,rd=new Ks,nd=new Ks,ad=new Ks;class od{constructor(t=new Ks,e=new Ks){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){td.subVectors(t,this.start),ed.subVectors(this.end,this.start);const s=ed.dot(ed);let i=ed.dot(td)/s;return e&&(i=qs(i,0,1)),i}closestPointToPoint(t,e,s){const i=this.closestPointToPointParameter(t,e);return this.delta(s).multiplyScalar(i).add(this.start)}distanceSqToLine3(t,e=nd,s=ad){const i=1e-8*1e-8;let r,n;const a=this.start,o=t.start,h=this.end,l=t.end;sd.subVectors(h,a),id.subVectors(l,o),rd.subVectors(a,o);const c=sd.dot(sd),u=id.dot(id),d=id.dot(rd);if(c<=i&&u<=i)return e.copy(a),s.copy(o),e.sub(s),e.dot(e);if(c<=i)r=0,n=d/u,n=qs(n,0,1);else{const t=sd.dot(rd);if(u<=i)n=0,r=qs(-t/c,0,1);else{const e=sd.dot(id),s=c*u-e*e;r=0!==s?qs((e*d-t*u)/s,0,1):0,n=(e*r+d)/u,n<0?(n=0,r=qs(-t/c,0,1)):n>1&&(n=1,r=qs((e-t)/c,0,1))}}return e.copy(a).add(sd.multiplyScalar(r)),s.copy(o).add(id.multiplyScalar(n)),e.sub(s),e.dot(e)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const hd=new Ks;class ld extends Rr{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const s=new In,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let t=0,e=1,s=32;t1)for(let s=0;s.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{Pd.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(Pd,e)}}setLength(t,e=.2*t,s=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(s,e,s),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class Fd extends qo{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],s=new In;s.setAttribute("position",new wn(e,3)),s.setAttribute("color",new wn([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(s,new Ro({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,s){const i=new Qr,r=this.geometry.attributes.color.array;return i.set(t),i.toArray(r,0),i.toArray(r,3),i.set(e),i.toArray(r,6),i.toArray(r,9),i.set(s),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Ld{constructor(){this.type="ShapePath",this.color=new Qr,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Dh,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,s,i){return this.currentPath.quadraticCurveTo(t,e,s,i),this}bezierCurveTo(t,e,s,i,r,n){return this.currentPath.bezierCurveTo(t,e,s,i,r,n),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(t,e){const s=e.length;let i=!1;for(let r=s-1,n=0;nNumber.EPSILON){if(h<0&&(s=e[n],o=-o,a=e[r],h=-h),t.ya.y)continue;if(t.y===s.y){if(t.x===s.x)return!0}else{const e=h*(t.x-s.x)-o*(t.y-s.y);if(0===e)return!0;if(e<0)continue;i=!i}}else{if(t.y!==s.y)continue;if(a.x<=t.x&&t.x<=s.x||s.x<=t.x&&t.x<=a.x)return!0}}return i}const s=gl.isClockWise,i=this.subPaths;if(0===i.length)return[];let r,n,a;const o=[];if(1===i.length)return n=i[0],a=new Wh,a.curves=n.curves,o.push(a),o;let h=!s(i[0].getPoints());h=t?!h:h;const l=[],c=[];let u,d,p=[],m=0;c[m]=void 0,p[m]=[];for(let e=0,a=i.length;e1){let t=!1,s=0;for(let t=0,e=c.length;t0&&!1===t&&(p=l)}for(let t=0,e=c.length;te?(t.repeat.x=1,t.repeat.y=s/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/s,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t}(t,e)}static cover(t,e){return function(t,e){const s=t.image&&t.image.width?t.image.width/t.image.height:1;return s>e?(t.repeat.x=e/s,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=s/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t}(t,e)}static fill(t){return function(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}(t)}static getByteLength(t,e,s,i){return Dd(t,e,s,i)}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:t}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=t);export{et as ACESFilmicToneMapping,v as AddEquation,G as AddOperation,Fe as AdditiveAnimationBlendMode,g as AdditiveBlending,it as AgXToneMapping,Lt as AlphaFormat,Ms as AlwaysCompare,D as AlwaysDepth,ms as AlwaysStencilFunc,Uc as AmbientLight,Pu as AnimationAction,uc as AnimationClip,vc as AnimationLoader,Nu as AnimationMixer,Ru as AnimationObjectGroup,Ql as AnimationUtils,Mh as ArcCurve,cu as ArrayCamera,Vd as ArrowHelper,nt as AttachedBindMode,xu as Audio,_u as AudioAnalyser,ru as AudioContext,fu as AudioListener,nu as AudioLoader,Fd as AxesHelper,d as BackSide,We as BasicDepthPacking,o as BasicShadowMap,Eo as BatchedMesh,Wa as Bone,rc as BooleanKeyframeTrack,Ku as Box2,Ri as Box3,Ed as Box3Helper,Un as BoxGeometry,kd as BoxHelper,dn as BufferAttribute,In as BufferGeometry,Gc as BufferGeometryLoader,zt as ByteType,pc as Cache,Zn as Camera,Cd as CameraHelper,ah as CanvasTexture,lh as CapsuleGeometry,Ch as CatmullRomCurve3,tt as CineonToneMapping,ch as CircleGeometry,mt as ClampToEdgeWrapping,uu as Clock,Qr as Color,nc as ColorKeyframeTrack,yi as ColorManagement,rh as CompressedArrayTexture,nh as CompressedCubeTexture,ih as CompressedTexture,wc as CompressedTextureLoader,dh as ConeGeometry,F as ConstantAlphaFactor,N as ConstantColorFactor,jd as Controls,ea as CubeCamera,ht as CubeReflectionMapping,lt as CubeRefractionMapping,sa as CubeTexture,_c as CubeTextureLoader,dt as CubeUVReflectionMapping,Eh as CubicBezierCurve,Rh as CubicBezierCurve3,tc as CubicInterpolant,r as CullFaceBack,n as CullFaceFront,a as CullFaceFrontBack,i as CullFaceNone,vh as Curve,jh as CurvePath,b as CustomBlending,st as CustomToneMapping,uh as CylinderGeometry,Gu as Cylindrical,ki as Data3DTexture,Ii as DataArrayTexture,Ua as DataTexture,Ac as DataTextureLoader,hn as DataUtils,is as DecrementStencilOp,ns as DecrementWrapStencilOp,yc as DefaultLoadingManager,Wt as DepthFormat,Ut as DepthStencilFormat,oh as DepthTexture,at as DetachedBindMode,Wc as DirectionalLight,Ad as DirectionalLightHelper,sc as DiscreteInterpolant,mh as DodecahedronGeometry,p as DoubleSide,k as DstAlphaFactor,R as DstColorFactor,Bs as DynamicCopyUsage,_s as DynamicDrawUsage,zs as DynamicReadUsage,bh as EdgesGeometry,wh as EllipseCurve,fs as EqualCompare,H as EqualDepth,ls as EqualStencilFunc,ct as EquirectangularReflectionMapping,ut as EquirectangularRefractionMapping,gr as Euler,Ls as EventDispatcher,hh as ExternalTexture,bl as ExtrudeGeometry,bc as FileLoader,vn as Float16BufferAttribute,wn as Float32BufferAttribute,Et as FloatType,ha as Fog,oa as FogExp2,sh as FramebufferTexture,u as FrontSide,lo as Frustum,po as FrustumArray,Wu as GLBufferAttribute,Es as GLSL1,Rs as GLSL3,bs as GreaterCompare,J as GreaterDepth,ws as GreaterEqualCompare,q as GreaterEqualDepth,ps as GreaterEqualStencilFunc,us as GreaterStencilFunc,vd as GridHelper,ra as Group,Rt as HalfFloatType,Cc as HemisphereLight,bd as HemisphereLightHelper,wl as IcosahedronGeometry,su as ImageBitmapLoader,Sc as ImageLoader,bi as ImageUtils,ss as IncrementStencilOp,rs as IncrementWrapStencilOp,Xa as InstancedBufferAttribute,Zc as InstancedBufferGeometry,Du as InstancedInterleavedBuffer,eo as InstancedMesh,gn as Int16BufferAttribute,xn as Int32BufferAttribute,pn as Int8BufferAttribute,Bt as IntType,ca as InterleavedBuffer,da as InterleavedBufferAttribute,Kl as Interpolant,ke as InterpolateDiscrete,Ee as InterpolateLinear,Re as InterpolateSmooth,Fs as InterpolationSamplingMode,Vs as InterpolationSamplingType,as as InvertStencilOp,ts as KeepStencilOp,ic as KeyframeTrack,ka as LOD,Ml as LatheGeometry,fr as Layers,gs as LessCompare,W as LessDepth,xs as LessEqualCompare,U as LessEqualDepth,cs as LessEqualStencilFunc,hs as LessStencilFunc,zc as Light,Jc as LightProbe,Do as Line,od as Line3,Ro as LineBasicMaterial,Ph as LineCurve,Oh as LineCurve3,Jl as LineDashedMaterial,Jo as LineLoop,qo as LineSegments,wt as LinearFilter,ec as LinearInterpolant,At as LinearMipMapLinearFilter,St as LinearMipMapNearestFilter,_t as LinearMipmapLinearFilter,Mt as LinearMipmapNearestFilter,Ge as LinearSRGBColorSpace,Q as LinearToneMapping,$e as LinearTransfer,gc as Loader,Yc as LoaderUtils,mc as LoadingManager,Ce as LoopOnce,Be as LoopPingPong,Ie as LoopRepeat,e as MOUSE,en as Material,Xc as MaterialLoader,Gs as MathUtils,$u as Matrix2,si as Matrix3,ar as Matrix4,_ as MaxEquation,Dn as Mesh,sn as MeshBasicMaterial,Ul as MeshDepthMaterial,Hl as MeshDistanceMaterial,Wl as MeshLambertMaterial,ql as MeshMatcapMaterial,Dl as MeshNormalMaterial,Ll as MeshPhongMaterial,Fl as MeshPhysicalMaterial,Vl as MeshStandardMaterial,jl as MeshToonMaterial,S as MinEquation,yt as MirroredRepeatWrapping,Z as MixOperation,x as MultiplyBlending,Y as MultiplyOperation,gt as NearestFilter,vt as NearestMipMapLinearFilter,xt as NearestMipMapNearestFilter,bt as NearestMipmapLinearFilter,ft as NearestMipmapNearestFilter,rt as NeutralToneMapping,ys as NeverCompare,j as NeverDepth,os as NeverStencilFunc,m as NoBlending,Ye as NoColorSpace,$ as NoToneMapping,Ve as NormalAnimationBlendMode,y as NormalBlending,vs as NotEqualCompare,X as NotEqualDepth,ds as NotEqualStencilFunc,ac as NumberKeyframeTrack,Rr as Object3D,$c as ObjectLoader,Xe as ObjectSpaceNormalMap,Sl as OctahedronGeometry,T as OneFactor,L as OneMinusConstantAlphaFactor,V as OneMinusConstantColorFactor,E as OneMinusDstAlphaFactor,P as OneMinusDstColorFactor,B as OneMinusSrcAlphaFactor,C as OneMinusSrcColorFactor,jc as OrthographicCamera,h as PCFShadowMap,l as PCFSoftShadowMap,Dh as Path,Kn as PerspectiveCamera,no as Plane,_l as PlaneGeometry,Rd as PlaneHelper,Lc as PointLight,yd as PointLightHelper,Qo as Points,Xo as PointsMaterial,wd as PolarGridHelper,ph as PolyhedronGeometry,Su as PositionalAudio,Eu as PropertyBinding,Au as PropertyMixer,Nh as QuadraticBezierCurve,Vh as QuadraticBezierCurve3,Qs as Quaternion,hc as QuaternionKeyframeTrack,oc as QuaternionLinearInterpolant,Us as RAD2DEG,Te as RED_GREEN_RGTC2_Format,_e as RED_RGTC1_Format,t as REVISION,Ue as RGBADepthPacking,Dt as RGBAFormat,Zt as RGBAIntegerFormat,xe as RGBA_ASTC_10x10_Format,ye as RGBA_ASTC_10x5_Format,ge as RGBA_ASTC_10x6_Format,fe as RGBA_ASTC_10x8_Format,be as RGBA_ASTC_12x10_Format,ve as RGBA_ASTC_12x12_Format,oe as RGBA_ASTC_4x4_Format,he as RGBA_ASTC_5x4_Format,le as RGBA_ASTC_5x5_Format,ce as RGBA_ASTC_6x5_Format,ue as RGBA_ASTC_6x6_Format,de as RGBA_ASTC_8x5_Format,pe as RGBA_ASTC_8x6_Format,me as RGBA_ASTC_8x8_Format,we as RGBA_BPTC_Format,ae as RGBA_ETC2_EAC_Format,ie as RGBA_PVRTC_2BPPV1_Format,se as RGBA_PVRTC_4BPPV1_Format,$t as RGBA_S3TC_DXT1_Format,Qt as RGBA_S3TC_DXT3_Format,Kt as RGBA_S3TC_DXT5_Format,He as RGBDepthPacking,jt as RGBFormat,Yt as RGBIntegerFormat,Me as RGB_BPTC_SIGNED_Format,Se as RGB_BPTC_UNSIGNED_Format,re as RGB_ETC1_Format,ne as RGB_ETC2_Format,ee as RGB_PVRTC_2BPPV1_Format,te as RGB_PVRTC_4BPPV1_Format,Gt as RGB_S3TC_DXT1_Format,qe as RGDepthPacking,Jt as RGFormat,Xt as RGIntegerFormat,Nl as RawShaderMaterial,nr as Ray,Hu as Raycaster,Hc as RectAreaLight,Ht as RedFormat,qt as RedIntegerFormat,K as ReinhardToneMapping,zi as RenderTarget,Vu as RenderTarget3D,pt as RepeatWrapping,es as ReplaceStencilOp,M as ReverseSubtractEquation,Al as RingGeometry,ze as SIGNED_RED_GREEN_RGTC2_Format,Ae as SIGNED_RED_RGTC1_Format,Ze as SRGBColorSpace,Qe as SRGBTransfer,la as Scene,Yn as ShaderMaterial,Ol as ShadowMaterial,Wh as Shape,Tl as ShapeGeometry,Ld as ShapePath,gl as ShapeUtils,Ct as ShortType,Ja as Skeleton,pd as SkeletonHelper,Da as SkinnedMesh,wi as Source,$i as Sphere,zl as SphereGeometry,Zu as Spherical,qc as SphericalHarmonics3,Fh as SplineCurve,Pc as SpotLight,ld as SpotLightHelper,za as Sprite,pa as SpriteMaterial,I as SrcAlphaFactor,O as SrcAlphaSaturateFactor,z as SrcColorFactor,Is as StaticCopyUsage,Ss as StaticDrawUsage,Ts as StaticReadUsage,lu as StereoCamera,ks as StreamCopyUsage,As as StreamDrawUsage,Cs as StreamReadUsage,lc as StringKeyframeTrack,w as SubtractEquation,f as SubtractiveBlending,s as TOUCH,Je as TangentSpaceNormalMap,Cl as TetrahedronGeometry,Ai as Texture,Tc as TextureLoader,Wd as TextureUtils,Xu as Timer,Ns as TimestampQuery,Il as TorusGeometry,Bl as TorusKnotGeometry,Xr as Triangle,De as TriangleFanDrawMode,je as TriangleStripDrawMode,Le as TrianglesDrawMode,kl as TubeGeometry,ot as UVMapping,fn as Uint16BufferAttribute,bn as Uint32BufferAttribute,mn as Uint8BufferAttribute,yn as Uint8ClampedBufferAttribute,Fu as Uniform,ju as UniformsGroup,Xn as UniformsUtils,Tt as UnsignedByteType,Ft as UnsignedInt101111Type,Nt as UnsignedInt248Type,Vt as UnsignedInt5999Type,kt as UnsignedIntType,Pt as UnsignedShort4444Type,Ot as UnsignedShort5551Type,It as UnsignedShortType,c as VSMShadowMap,$s as Vector2,Ks as Vector3,Ti as Vector4,cc as VectorKeyframeTrack,eh as VideoFrameTexture,th as VideoTexture,Ei as WebGL3DRenderTarget,Bi as WebGLArrayRenderTarget,Ps as WebGLCoordinateSystem,ia as WebGLCubeRenderTarget,Ci as WebGLRenderTarget,Os as WebGPUCoordinateSystem,aa as WebXRController,El as WireframeGeometry,Ne as WrapAroundEnding,Pe as ZeroCurvatureEnding,A as ZeroFactor,Oe as ZeroSlopeEnding,Ke as ZeroStencilOp,ri as arrayNeedsUint32,Hn as cloneUniforms,hi as createCanvasElement,oi as createElementNS,Dd as getByteLength,Jn as getUnlitUniformColorSpace,qn as mergeUniforms,ui as probeAsync,ci as warnOnce}; diff --git a/greenhouse/frontend/vendor/three/three.module.min.js b/greenhouse/frontend/vendor/three/three.module.min.js new file mode 100644 index 0000000..20d3c11 --- /dev/null +++ b/greenhouse/frontend/vendor/three/three.module.min.js @@ -0,0 +1,6 @@ +/** + * @license + * Copyright 2010-2025 Three.js Authors + * SPDX-License-Identifier: MIT + */ +import{Matrix3 as e,Vector2 as t,Color as n,mergeUniforms as r,Vector3 as i,CubeUVReflectionMapping as a,Mesh as o,BoxGeometry as s,ShaderMaterial as l,BackSide as c,cloneUniforms as d,Euler as u,Matrix4 as f,ColorManagement as p,SRGBTransfer as m,PlaneGeometry as h,FrontSide as _,getUnlitUniformColorSpace as g,IntType as v,HalfFloatType as E,UnsignedByteType as S,FloatType as T,RGBAFormat as M,Plane as x,EquirectangularReflectionMapping as R,EquirectangularRefractionMapping as A,WebGLCubeRenderTarget as b,CubeReflectionMapping as C,CubeRefractionMapping as L,OrthographicCamera as P,PerspectiveCamera as U,NoToneMapping as D,MeshBasicMaterial as w,NoBlending as I,WebGLRenderTarget as y,BufferGeometry as N,BufferAttribute as O,LinearSRGBColorSpace as F,LinearFilter as B,warnOnce as H,Uint32BufferAttribute as G,Uint16BufferAttribute as V,arrayNeedsUint32 as z,Vector4 as k,DataArrayTexture as W,CubeTexture as X,Data3DTexture as Y,LessEqualCompare as K,DepthTexture as q,Texture as j,GLSL3 as Z,PCFShadowMap as $,PCFSoftShadowMap as Q,VSMShadowMap as J,CustomToneMapping as ee,NeutralToneMapping as te,AgXToneMapping as ne,ACESFilmicToneMapping as re,CineonToneMapping as ie,ReinhardToneMapping as ae,LinearToneMapping as oe,LinearTransfer as se,AddOperation as le,MixOperation as ce,MultiplyOperation as de,UniformsUtils as ue,DoubleSide as fe,NormalBlending as pe,TangentSpaceNormalMap as me,ObjectSpaceNormalMap as he,Layers as _e,Frustum as ge,MeshDepthMaterial as ve,RGBADepthPacking as Ee,MeshDistanceMaterial as Se,NearestFilter as Te,LessEqualDepth as Me,ReverseSubtractEquation as xe,SubtractEquation as Re,AddEquation as Ae,OneMinusConstantAlphaFactor as be,ConstantAlphaFactor as Ce,OneMinusConstantColorFactor as Le,ConstantColorFactor as Pe,OneMinusDstAlphaFactor as Ue,OneMinusDstColorFactor as De,OneMinusSrcAlphaFactor as we,OneMinusSrcColorFactor as Ie,DstAlphaFactor as ye,DstColorFactor as Ne,SrcAlphaSaturateFactor as Oe,SrcAlphaFactor as Fe,SrcColorFactor as Be,OneFactor as He,ZeroFactor as Ge,NotEqualDepth as Ve,GreaterDepth as ze,GreaterEqualDepth as ke,EqualDepth as We,LessDepth as Xe,AlwaysDepth as Ye,NeverDepth as Ke,CullFaceNone as qe,CullFaceBack as je,CullFaceFront as Ze,CustomBlending as $e,MultiplyBlending as Qe,SubtractiveBlending as Je,AdditiveBlending as et,MinEquation as tt,MaxEquation as nt,MirroredRepeatWrapping as rt,ClampToEdgeWrapping as it,RepeatWrapping as at,LinearMipmapLinearFilter as ot,LinearMipmapNearestFilter as st,NearestMipmapLinearFilter as lt,NearestMipmapNearestFilter as ct,NotEqualCompare as dt,GreaterCompare as ut,GreaterEqualCompare as ft,EqualCompare as pt,LessCompare as mt,AlwaysCompare as ht,NeverCompare as _t,NoColorSpace as gt,DepthStencilFormat as vt,getByteLength as Et,DepthFormat as St,UnsignedIntType as Tt,UnsignedInt248Type as Mt,UnsignedShortType as xt,createElementNS as Rt,UnsignedShort4444Type as At,UnsignedShort5551Type as bt,UnsignedInt5999Type as Ct,UnsignedInt101111Type as Lt,ByteType as Pt,ShortType as Ut,AlphaFormat as Dt,RGBFormat as wt,RedFormat as It,RedIntegerFormat as yt,RGFormat as Nt,RGIntegerFormat as Ot,RGBAIntegerFormat as Ft,RGB_S3TC_DXT1_Format as Bt,RGBA_S3TC_DXT1_Format as Ht,RGBA_S3TC_DXT3_Format as Gt,RGBA_S3TC_DXT5_Format as Vt,RGB_PVRTC_4BPPV1_Format as zt,RGB_PVRTC_2BPPV1_Format as kt,RGBA_PVRTC_4BPPV1_Format as Wt,RGBA_PVRTC_2BPPV1_Format as Xt,RGB_ETC1_Format as Yt,RGB_ETC2_Format as Kt,RGBA_ETC2_EAC_Format as qt,RGBA_ASTC_4x4_Format as jt,RGBA_ASTC_5x4_Format as Zt,RGBA_ASTC_5x5_Format as $t,RGBA_ASTC_6x5_Format as Qt,RGBA_ASTC_6x6_Format as Jt,RGBA_ASTC_8x5_Format as en,RGBA_ASTC_8x6_Format as tn,RGBA_ASTC_8x8_Format as nn,RGBA_ASTC_10x5_Format as rn,RGBA_ASTC_10x6_Format as an,RGBA_ASTC_10x8_Format as on,RGBA_ASTC_10x10_Format as sn,RGBA_ASTC_12x10_Format as ln,RGBA_ASTC_12x12_Format as cn,RGBA_BPTC_Format as dn,RGB_BPTC_SIGNED_Format as un,RGB_BPTC_UNSIGNED_Format as fn,RED_RGTC1_Format as pn,SIGNED_RED_RGTC1_Format as mn,RED_GREEN_RGTC2_Format as hn,SIGNED_RED_GREEN_RGTC2_Format as _n,ExternalTexture as gn,EventDispatcher as vn,ArrayCamera as En,WebXRController as Sn,RAD2DEG as Tn,createCanvasElement as Mn,SRGBColorSpace as xn,REVISION as Rn,WebGLCoordinateSystem as An,probeAsync as bn}from"./three.core.min.js";export{AdditiveAnimationBlendMode,AlwaysStencilFunc,AmbientLight,AnimationAction,AnimationClip,AnimationLoader,AnimationMixer,AnimationObjectGroup,AnimationUtils,ArcCurve,ArrowHelper,AttachedBindMode,Audio,AudioAnalyser,AudioContext,AudioListener,AudioLoader,AxesHelper,BasicDepthPacking,BasicShadowMap,BatchedMesh,Bone,BooleanKeyframeTrack,Box2,Box3,Box3Helper,BoxHelper,BufferGeometryLoader,Cache,Camera,CameraHelper,CanvasTexture,CapsuleGeometry,CatmullRomCurve3,CircleGeometry,Clock,ColorKeyframeTrack,CompressedArrayTexture,CompressedCubeTexture,CompressedTexture,CompressedTextureLoader,ConeGeometry,Controls,CubeCamera,CubeTextureLoader,CubicBezierCurve,CubicBezierCurve3,CubicInterpolant,CullFaceFrontBack,Curve,CurvePath,CylinderGeometry,Cylindrical,DataTexture,DataTextureLoader,DataUtils,DecrementStencilOp,DecrementWrapStencilOp,DefaultLoadingManager,DetachedBindMode,DirectionalLight,DirectionalLightHelper,DiscreteInterpolant,DodecahedronGeometry,DynamicCopyUsage,DynamicDrawUsage,DynamicReadUsage,EdgesGeometry,EllipseCurve,EqualStencilFunc,ExtrudeGeometry,FileLoader,Float16BufferAttribute,Float32BufferAttribute,Fog,FogExp2,FramebufferTexture,FrustumArray,GLBufferAttribute,GLSL1,GreaterEqualStencilFunc,GreaterStencilFunc,GridHelper,Group,HemisphereLight,HemisphereLightHelper,IcosahedronGeometry,ImageBitmapLoader,ImageLoader,ImageUtils,IncrementStencilOp,IncrementWrapStencilOp,InstancedBufferAttribute,InstancedBufferGeometry,InstancedInterleavedBuffer,InstancedMesh,Int16BufferAttribute,Int32BufferAttribute,Int8BufferAttribute,InterleavedBuffer,InterleavedBufferAttribute,Interpolant,InterpolateDiscrete,InterpolateLinear,InterpolateSmooth,InterpolationSamplingMode,InterpolationSamplingType,InvertStencilOp,KeepStencilOp,KeyframeTrack,LOD,LatheGeometry,LessEqualStencilFunc,LessStencilFunc,Light,LightProbe,Line,Line3,LineBasicMaterial,LineCurve,LineCurve3,LineDashedMaterial,LineLoop,LineSegments,LinearInterpolant,LinearMipMapLinearFilter,LinearMipMapNearestFilter,Loader,LoaderUtils,LoadingManager,LoopOnce,LoopPingPong,LoopRepeat,MOUSE,Material,MaterialLoader,MathUtils,Matrix2,MeshLambertMaterial,MeshMatcapMaterial,MeshNormalMaterial,MeshPhongMaterial,MeshPhysicalMaterial,MeshStandardMaterial,MeshToonMaterial,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NeverStencilFunc,NormalAnimationBlendMode,NotEqualStencilFunc,NumberKeyframeTrack,Object3D,ObjectLoader,OctahedronGeometry,Path,PlaneHelper,PointLight,PointLightHelper,Points,PointsMaterial,PolarGridHelper,PolyhedronGeometry,PositionalAudio,PropertyBinding,PropertyMixer,QuadraticBezierCurve,QuadraticBezierCurve3,Quaternion,QuaternionKeyframeTrack,QuaternionLinearInterpolant,RGBDepthPacking,RGBIntegerFormat,RGDepthPacking,RawShaderMaterial,Ray,Raycaster,RectAreaLight,RenderTarget,RenderTarget3D,ReplaceStencilOp,RingGeometry,Scene,ShadowMaterial,Shape,ShapeGeometry,ShapePath,ShapeUtils,Skeleton,SkeletonHelper,SkinnedMesh,Source,Sphere,SphereGeometry,Spherical,SphericalHarmonics3,SplineCurve,SpotLight,SpotLightHelper,Sprite,SpriteMaterial,StaticCopyUsage,StaticDrawUsage,StaticReadUsage,StereoCamera,StreamCopyUsage,StreamDrawUsage,StreamReadUsage,StringKeyframeTrack,TOUCH,TetrahedronGeometry,TextureLoader,TextureUtils,Timer,TimestampQuery,TorusGeometry,TorusKnotGeometry,Triangle,TriangleFanDrawMode,TriangleStripDrawMode,TrianglesDrawMode,TubeGeometry,UVMapping,Uint8BufferAttribute,Uint8ClampedBufferAttribute,Uniform,UniformsGroup,VectorKeyframeTrack,VideoFrameTexture,VideoTexture,WebGL3DRenderTarget,WebGLArrayRenderTarget,WebGPUCoordinateSystem,WireframeGeometry,WrapAroundEnding,ZeroCurvatureEnding,ZeroSlopeEnding,ZeroStencilOp}from"./three.core.min.js";function Cn(){let e=null,t=!1,n=null,r=null;function i(t,a){n(t,a),r=e.requestAnimationFrame(i)}return{start:function(){!0!==t&&null!==n&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Ln(e){const t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const r=t.get(n);r&&(e.deleteBuffer(r.buffer),t.delete(n))},update:function(n,r){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){const e=t.get(n);return void((!e||e.versione.start-t.start);let t=0;for(let e=1;e 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\tfloat depth = unpackRGBAToDepth( texture2D( depths, uv ) );\n\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\treturn step( depth, compare );\n\t\t#else\n\t\t\treturn step( compare, depth );\n\t\t#endif\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow( sampler2D shadow, vec2 uv, float compare ) {\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\tfloat hard_shadow = step( distribution.x, compare );\n\t\t#else\n\t\t\tfloat hard_shadow = step( compare, distribution.x );\n\t\t#endif\n\t\tif ( hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n\t#else\n\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n\t#endif\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},Un={common:{diffuse:{value:new n(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new e},alphaMap:{value:null},alphaMapTransform:{value:new e},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new e}},envmap:{envMap:{value:null},envMapRotation:{value:new e},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new e}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new e}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new e},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new e},normalScale:{value:new t(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new e},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new e}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new e}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new e}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new n(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new n(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new e},alphaTest:{value:0},uvTransform:{value:new e}},sprite:{diffuse:{value:new n(16777215)},opacity:{value:1},center:{value:new t(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new e},alphaMap:{value:null},alphaMapTransform:{value:new e},alphaTest:{value:0}}},Dn={basic:{uniforms:r([Un.common,Un.specularmap,Un.envmap,Un.aomap,Un.lightmap,Un.fog]),vertexShader:Pn.meshbasic_vert,fragmentShader:Pn.meshbasic_frag},lambert:{uniforms:r([Un.common,Un.specularmap,Un.envmap,Un.aomap,Un.lightmap,Un.emissivemap,Un.bumpmap,Un.normalmap,Un.displacementmap,Un.fog,Un.lights,{emissive:{value:new n(0)}}]),vertexShader:Pn.meshlambert_vert,fragmentShader:Pn.meshlambert_frag},phong:{uniforms:r([Un.common,Un.specularmap,Un.envmap,Un.aomap,Un.lightmap,Un.emissivemap,Un.bumpmap,Un.normalmap,Un.displacementmap,Un.fog,Un.lights,{emissive:{value:new n(0)},specular:{value:new n(1118481)},shininess:{value:30}}]),vertexShader:Pn.meshphong_vert,fragmentShader:Pn.meshphong_frag},standard:{uniforms:r([Un.common,Un.envmap,Un.aomap,Un.lightmap,Un.emissivemap,Un.bumpmap,Un.normalmap,Un.displacementmap,Un.roughnessmap,Un.metalnessmap,Un.fog,Un.lights,{emissive:{value:new n(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Pn.meshphysical_vert,fragmentShader:Pn.meshphysical_frag},toon:{uniforms:r([Un.common,Un.aomap,Un.lightmap,Un.emissivemap,Un.bumpmap,Un.normalmap,Un.displacementmap,Un.gradientmap,Un.fog,Un.lights,{emissive:{value:new n(0)}}]),vertexShader:Pn.meshtoon_vert,fragmentShader:Pn.meshtoon_frag},matcap:{uniforms:r([Un.common,Un.bumpmap,Un.normalmap,Un.displacementmap,Un.fog,{matcap:{value:null}}]),vertexShader:Pn.meshmatcap_vert,fragmentShader:Pn.meshmatcap_frag},points:{uniforms:r([Un.points,Un.fog]),vertexShader:Pn.points_vert,fragmentShader:Pn.points_frag},dashed:{uniforms:r([Un.common,Un.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Pn.linedashed_vert,fragmentShader:Pn.linedashed_frag},depth:{uniforms:r([Un.common,Un.displacementmap]),vertexShader:Pn.depth_vert,fragmentShader:Pn.depth_frag},normal:{uniforms:r([Un.common,Un.bumpmap,Un.normalmap,Un.displacementmap,{opacity:{value:1}}]),vertexShader:Pn.meshnormal_vert,fragmentShader:Pn.meshnormal_frag},sprite:{uniforms:r([Un.sprite,Un.fog]),vertexShader:Pn.sprite_vert,fragmentShader:Pn.sprite_frag},background:{uniforms:{uvTransform:{value:new e},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Pn.background_vert,fragmentShader:Pn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new e}},vertexShader:Pn.backgroundCube_vert,fragmentShader:Pn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Pn.cube_vert,fragmentShader:Pn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Pn.equirect_vert,fragmentShader:Pn.equirect_frag},distanceRGBA:{uniforms:r([Un.common,Un.displacementmap,{referencePosition:{value:new i},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Pn.distanceRGBA_vert,fragmentShader:Pn.distanceRGBA_frag},shadow:{uniforms:r([Un.lights,Un.fog,{color:{value:new n(0)},opacity:{value:1}}]),vertexShader:Pn.shadow_vert,fragmentShader:Pn.shadow_frag}};Dn.physical={uniforms:r([Dn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new e},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new e},clearcoatNormalScale:{value:new t(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new e},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new e},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new e},sheen:{value:0},sheenColor:{value:new n(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new e},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new e},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new e},transmissionSamplerSize:{value:new t},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new e},attenuationDistance:{value:0},attenuationColor:{value:new n(0)},specularColor:{value:new n(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new e},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new e},anisotropyVector:{value:new t},anisotropyMap:{value:null},anisotropyMapTransform:{value:new e}}]),vertexShader:Pn.meshphysical_vert,fragmentShader:Pn.meshphysical_frag};const wn={r:0,b:0,g:0},In=new u,yn=new f;function Nn(e,t,r,i,u,f,v){const E=new n(0);let S,T,M=!0===f?0:1,x=null,R=0,A=null;function b(e){let n=!0===e.isScene?e.background:null;if(n&&n.isTexture){n=(e.backgroundBlurriness>0?r:t).get(n)}return n}function C(t,n){t.getRGB(wn,g(e)),i.buffers.color.setClear(wn.r,wn.g,wn.b,n,v)}return{getClearColor:function(){return E},setClearColor:function(e,t=1){E.set(e),M=t,C(E,M)},getClearAlpha:function(){return M},setClearAlpha:function(e){M=e,C(E,M)},render:function(t){let n=!1;const r=b(t);null===r?C(E,M):r&&r.isColor&&(C(r,1),n=!0);const a=e.xr.getEnvironmentBlendMode();"additive"===a?i.buffers.color.setClear(0,0,0,1,v):"alpha-blend"===a&&i.buffers.color.setClear(0,0,0,0,v),(e.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){const r=b(n);r&&(r.isCubeTexture||r.mapping===a)?(void 0===T&&(T=new o(new s(1,1,1),new l({name:"BackgroundCubeMaterial",uniforms:d(Dn.backgroundCube.uniforms),vertexShader:Dn.backgroundCube.vertexShader,fragmentShader:Dn.backgroundCube.fragmentShader,side:c,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),T.geometry.deleteAttribute("normal"),T.geometry.deleteAttribute("uv"),T.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(T.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),u.update(T)),In.copy(n.backgroundRotation),In.x*=-1,In.y*=-1,In.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(In.y*=-1,In.z*=-1),T.material.uniforms.envMap.value=r,T.material.uniforms.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,T.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,T.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,T.material.uniforms.backgroundRotation.value.setFromMatrix4(yn.makeRotationFromEuler(In)),T.material.toneMapped=p.getTransfer(r.colorSpace)!==m,x===r&&R===r.version&&A===e.toneMapping||(T.material.needsUpdate=!0,x=r,R=r.version,A=e.toneMapping),T.layers.enableAll(),t.unshift(T,T.geometry,T.material,0,0,null)):r&&r.isTexture&&(void 0===S&&(S=new o(new h(2,2),new l({name:"BackgroundMaterial",uniforms:d(Dn.background.uniforms),vertexShader:Dn.background.vertexShader,fragmentShader:Dn.background.fragmentShader,side:_,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),S.geometry.deleteAttribute("normal"),Object.defineProperty(S.material,"map",{get:function(){return this.uniforms.t2D.value}}),u.update(S)),S.material.uniforms.t2D.value=r,S.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,S.material.toneMapped=p.getTransfer(r.colorSpace)!==m,!0===r.matrixAutoUpdate&&r.updateMatrix(),S.material.uniforms.uvTransform.value.copy(r.matrix),x===r&&R===r.version&&A===e.toneMapping||(S.material.needsUpdate=!0,x=r,R=r.version,A=e.toneMapping),S.layers.enableAll(),t.unshift(S,S.geometry,S.material,0,0,null))},dispose:function(){void 0!==T&&(T.geometry.dispose(),T.material.dispose(),T=void 0),void 0!==S&&(S.geometry.dispose(),S.material.dispose(),S=void 0)}}}function On(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},i=c(null);let a=i,o=!1;function s(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function c(e){const t=[],r=[],i=[];for(let e=0;e=0){const n=i[t];let r=o[t];if(void 0===r&&("instanceMatrix"===t&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(r=e.instanceColor)),void 0===n)return!0;if(n.attribute!==r)return!0;if(r&&n.data!==r.data)return!0;s++}}return a.attributesNum!==s||a.index!==r}(n,h,l,_),g&&function(e,t,n,r){const i={},o=t.attributes;let s=0;const l=n.getAttributes();for(const t in l){if(l[t].location>=0){let n=o[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[t]=r,s++}}a.attributes=i,a.attributesNum=s,a.index=r}(n,h,l,_),null!==_&&t.update(_,e.ELEMENT_ARRAY_BUFFER),(g||o)&&(o=!1,function(n,r,i,a){d();const o=a.attributes,s=i.getAttributes(),l=r.defaultAttributeValues;for(const r in s){const i=s[r];if(i.location>=0){let s=o[r];if(void 0===s&&("instanceMatrix"===r&&n.instanceMatrix&&(s=n.instanceMatrix),"instanceColor"===r&&n.instanceColor&&(s=n.instanceColor)),void 0!==s){const r=s.normalized,o=s.itemSize,l=t.get(s);if(void 0===l)continue;const c=l.buffer,d=l.type,p=l.bytesPerElement,h=d===e.INT||d===e.UNSIGNED_INT||s.gpuType===v;if(s.isInterleavedBufferAttribute){const t=s.data,l=t.stride,_=s.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=void 0!==n.precision?n.precision:"highp";const s=a(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);const l=!0===n.logarithmicDepthBuffer,c=!0===n.reversedDepthBuffer&&t.has("EXT_clip_control"),d=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),u=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:a,textureFormatReadable:function(t){return t===M||r.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const i=n===E&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==S&&r.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==T&&!i)},precision:o,logarithmicDepthBuffer:l,reversedDepthBuffer:c,maxTextures:d,maxVertexTextures:u,maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:u>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function Hn(t){const n=this;let r=null,i=0,a=!1,o=!1;const s=new x,l=new e,c={value:null,needsUpdate:!1};function d(e,t,r,i){const a=null!==e?e.length:0;let o=null;if(0!==a){if(o=c.value,!0!==i||null===o){const n=r+4*a,i=t.matrixWorldInverse;l.getNormalMatrix(i),(null===o||o.length0);n.numPlanes=i,n.numIntersection=0}();else{const e=o?0:i,t=4*e;let n=m.clippingState||null;c.value=n,n=d(u,s,t,l);for(let e=0;e!==t;++e)n[e]=r[e];m.clippingState=n,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=e}}}function Gn(e){let t=new WeakMap;function n(e,t){return t===R?e.mapping=C:t===A&&(e.mapping=L),e}function r(e){const n=e.target;n.removeEventListener("dispose",r);const i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){const a=i.mapping;if(a===R||a===A){if(t.has(i)){return n(t.get(i).texture,i.mapping)}{const a=i.image;if(a&&a.height>0){const o=new b(a.height);return o.fromEquirectangularTexture(e,i),t.set(i,o),i.addEventListener("dispose",r),n(o.texture,i.mapping)}return null}}}return i},dispose:function(){t=new WeakMap}}}const Vn=[.125,.215,.35,.446,.526,.582],zn=20,kn=new P,Wn=new n;let Xn=null,Yn=0,Kn=0,qn=!1;const jn=(1+Math.sqrt(5))/2,Zn=1/jn,$n=[new i(-jn,Zn,0),new i(jn,Zn,0),new i(-Zn,0,jn),new i(Zn,0,jn),new i(0,jn,-Zn),new i(0,jn,Zn),new i(-1,1,-1),new i(1,1,-1),new i(-1,1,1),new i(1,1,1)],Qn=new i;class Jn{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100,i={}){const{size:a=256,position:o=Qn}=i;Xn=this._renderer.getRenderTarget(),Yn=this._renderer.getActiveCubeFace(),Kn=this._renderer.getActiveMipmapLevel(),qn=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s,o),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=rr(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=nr(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?s=Vn[o-e+4-1]:0===o&&(s=0),r.push(s);const l=1/(a-2),c=-l,d=1+l,u=[c,c,d,c,d,d,c,c,d,d,c,d],f=6,p=6,m=3,h=2,_=1,g=new Float32Array(m*p*f),v=new Float32Array(h*p*f),E=new Float32Array(_*p*f);for(let e=0;e2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];g.set(r,m*p*e),v.set(u,h*p*e);const i=[e,e,e,e,e,e];E.set(i,_*p*e)}const S=new N;S.setAttribute("position",new O(g,m)),S.setAttribute("uv",new O(v,h)),S.setAttribute("faceIndex",new O(E,_)),t.push(S),i>4&&i--}return{lodPlanes:t,sizeLods:n,sigmas:r}}(r)),this._blurMaterial=function(e,t,n){const r=new Float32Array(zn),a=new i(0,1,0),o=new l({name:"SphericalGaussianBlur",defines:{n:zn,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:a}},vertexShader:ir(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:I,depthTest:!1,depthWrite:!1});return o}(r,e,t)}return r}_compileMaterial(e){const t=new o(this._lodPlanes[0],e);this._renderer.compile(t,kn)}_sceneToCubeUV(e,t,n,r,i){const a=new U(90,1,t,n),l=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],u=this._renderer,f=u.autoClear,p=u.toneMapping;u.getClearColor(Wn),u.toneMapping=D,u.autoClear=!1;u.state.buffers.depth.getReversed()&&(u.setRenderTarget(r),u.clearDepth(),u.setRenderTarget(null));const m=new w({name:"PMREM.Background",side:c,depthWrite:!1,depthTest:!1}),h=new o(new s,m);let _=!1;const g=e.background;g?g.isColor&&(m.color.copy(g),e.background=null,_=!0):(m.color.copy(Wn),_=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(a.up.set(0,l[t],0),a.position.set(i.x,i.y,i.z),a.lookAt(i.x+d[t],i.y,i.z)):1===n?(a.up.set(0,0,l[t]),a.position.set(i.x,i.y,i.z),a.lookAt(i.x,i.y+d[t],i.z)):(a.up.set(0,l[t],0),a.position.set(i.x,i.y,i.z),a.lookAt(i.x,i.y,i.z+d[t]));const o=this._cubeSize;tr(r,n*o,t>2?o:0,o,o),u.setRenderTarget(r),_&&u.render(h,a),u.render(e,a)}h.geometry.dispose(),h.material.dispose(),u.toneMapping=p,u.autoClear=f,e.background=g}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===C||e.mapping===L;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=rr()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=nr());const i=r?this._cubemapMaterial:this._equirectMaterial,a=new o(this._lodPlanes[0],i);i.uniforms.envMap.value=e;const s=this._cubeSize;tr(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,kn)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let t=1;tzn&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${h} samples when the maximum is set to 20`);const _=[];let g=0;for(let e=0;ev-4?r-v+4:0),4*(this._cubeSize-E),3*E,2*E),l.setRenderTarget(t),l.render(d,kn)}}function er(e,t,n){const r=new y(e,t,n);return r.texture.mapping=a,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function tr(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function nr(){return new l({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ir(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:I,depthTest:!1,depthWrite:!1})}function rr(){return new l({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ir(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:I,depthTest:!1,depthWrite:!1})}function ir(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function ar(e){let t=new WeakMap,n=null;function r(e){const n=e.target;n.removeEventListener("dispose",r);const i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){const a=i.mapping,o=a===R||a===A,s=a===C||a===L;if(o||s){let a=t.get(i);const l=void 0!==a?a.texture.pmremVersion:0;if(i.isRenderTargetTexture&&i.pmremVersion!==l)return null===n&&(n=new Jn(e)),a=o?n.fromEquirectangular(i,a):n.fromCubemap(i,a),a.texture.pmremVersion=i.pmremVersion,t.set(i,a),a.texture;if(void 0!==a)return a.texture;{const l=i.image;return o&&l&&l.height>0||s&&l&&function(e){let t=0;const n=6;for(let r=0;rn.maxTextureSize&&(M=Math.ceil(S/n.maxTextureSize),S=n.maxTextureSize);const x=new Float32Array(S*M*4*u),R=new W(x,S,M,u);R.type=T,R.needsUpdate=!0;const A=4*E;for(let C=0;C0)return e;const i=t*n;let a=gr[i];if(void 0===a&&(a=new Float32Array(i),gr[i]=a),0!==t){r.toArray(a,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(a,i)}return a}function xr(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n":" "} ${i}: ${n[e]}`)}return r.join("\n")}(e.getShaderSource(t),r)}return i}function Ti(e,t){const n=function(e){p._getMatrix(Ei,p.workingColorSpace,e);const t=`mat3( ${Ei.elements.map(e=>e.toFixed(4))} )`;switch(p.getTransfer(e)){case se:return[t,"LinearTransferOETF"];case m:return[t,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(t);return[`vec4 ${e}( vec4 value ) {`,`\treturn ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join("\n")}function Mi(e,t){let n;switch(t){case oe:n="Linear";break;case ae:n="Reinhard";break;case ie:n="Cineon";break;case re:n="ACESFilmic";break;case ne:n="AgX";break;case te:n="Neutral";break;case ee:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const xi=new i;function Ri(){p.getLuminanceCoefficients(xi);return["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${xi.x.toFixed(4)}, ${xi.y.toFixed(4)}, ${xi.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")}function Ai(e){return""!==e}function bi(e,t){const n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Ci(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const Li=/^[ \t]*#include +<([\w\d./]+)>/gm;function Pi(e){return e.replace(Li,Di)}const Ui=new Map;function Di(e,t){let n=Pn[t];if(void 0===n){const e=Ui.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");n=Pn[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return Pi(n)}const wi=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ii(e){return e.replace(wi,yi)}function yi(e,t,n,r){let i="";for(let e=parseInt(t);e0&&(g+="\n"),v=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,h].filter(Ai).join("\n"),v.length>0&&(v+="\n")):(g=[Ni(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,h,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Ai).join("\n"),v=[Ni(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,h,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.envMap?"#define "+u:"",n.envMap?"#define "+f:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==D?"#define TONE_MAPPING":"",n.toneMapping!==D?Pn.tonemapping_pars_fragment:"",n.toneMapping!==D?Mi("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Pn.colorspace_pars_fragment,Ti("linearToOutputTexel",n.outputColorSpace),Ri(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Ai).join("\n")),s=Pi(s),s=bi(s,n),s=Ci(s,n),l=Pi(l),l=bi(l,n),l=Ci(l,n),s=Ii(s),l=Ii(l),!0!==n.isRawShaderMaterial&&(E="#version 300 es\n",g=[m,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in",n.glslVersion===Z?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Z?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+v);const S=E+g+s,T=E+v+l,M=gi(i,i.VERTEX_SHADER,S),x=gi(i,i.FRAGMENT_SHADER,T);function R(t){if(e.debug.checkShaderErrors){const n=i.getProgramInfoLog(_)||"",r=i.getShaderInfoLog(M)||"",a=i.getShaderInfoLog(x)||"",o=n.trim(),s=r.trim(),l=a.trim();let c=!0,d=!0;if(!1===i.getProgramParameter(_,i.LINK_STATUS))if(c=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(i,_,M,x);else{const e=Si(i,M,"vertex"),n=Si(i,x,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+o+"\n"+e+"\n"+n)}else""!==o?console.warn("THREE.WebGLProgram: Program Info Log:",o):""!==s&&""!==l||(d=!1);d&&(t.diagnostics={runnable:c,programLog:o,vertexShader:{log:s,prefix:g},fragmentShader:{log:l,prefix:v}})}i.deleteShader(M),i.deleteShader(x),A=new _i(i,_),b=function(e,t){const n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i0,J=o.clearcoat>0,ee=o.dispersion>0,te=o.iridescence>0,ne=o.sheen>0,re=o.transmission>0,ie=Q&&!!o.anisotropyMap,ae=J&&!!o.clearcoatMap,oe=J&&!!o.clearcoatNormalMap,se=J&&!!o.clearcoatRoughnessMap,le=te&&!!o.iridescenceMap,ce=te&&!!o.iridescenceThicknessMap,de=ne&&!!o.sheenColorMap,ue=ne&&!!o.sheenRoughnessMap,_e=!!o.specularMap,ge=!!o.specularColorMap,ve=!!o.specularIntensityMap,Ee=re&&!!o.transmissionMap,Se=re&&!!o.thicknessMap,Te=!!o.gradientMap,Me=!!o.alphaMap,xe=o.alphaTest>0,Re=!!o.alphaHash,Ae=!!o.extensions;let be=D;o.toneMapped&&(null!==O&&!0!==O.isXRRenderTarget||(be=e.toneMapping));const Ce={shaderID:C,shaderType:o.type,shaderName:o.name,vertexShader:U,fragmentShader:w,defines:o.defines,customVertexShaderID:I,customFragmentShaderID:y,isRawShaderMaterial:!0===o.isRawShaderMaterial,glslVersion:o.glslVersion,precision:g,batching:G,batchingColor:G&&null!==T._colorsTexture,instancing:H,instancingColor:H&&null!==T.instanceColor,instancingMorph:H&&null!==T.morphTexture,supportsVertexTextures:_,outputColorSpace:null===O?e.outputColorSpace:!0===O.isXRRenderTarget?O.texture.colorSpace:F,alphaToCoverage:!!o.alphaToCoverage,map:V,matcap:z,envMap:k,envMapMode:k&&A.mapping,envMapCubeUVHeight:b,aoMap:W,lightMap:X,bumpMap:Y,normalMap:K,displacementMap:_&&q,emissiveMap:j,normalMapObjectSpace:K&&o.normalMapType===he,normalMapTangentSpace:K&&o.normalMapType===me,metalnessMap:Z,roughnessMap:$,anisotropy:Q,anisotropyMap:ie,clearcoat:J,clearcoatMap:ae,clearcoatNormalMap:oe,clearcoatRoughnessMap:se,dispersion:ee,iridescence:te,iridescenceMap:le,iridescenceThicknessMap:ce,sheen:ne,sheenColorMap:de,sheenRoughnessMap:ue,specularMap:_e,specularColorMap:ge,specularIntensityMap:ve,transmission:re,transmissionMap:Ee,thicknessMap:Se,gradientMap:Te,opaque:!1===o.transparent&&o.blending===pe&&!1===o.alphaToCoverage,alphaMap:Me,alphaTest:xe,alphaHash:Re,combine:o.combine,mapUv:V&&E(o.map.channel),aoMapUv:W&&E(o.aoMap.channel),lightMapUv:X&&E(o.lightMap.channel),bumpMapUv:Y&&E(o.bumpMap.channel),normalMapUv:K&&E(o.normalMap.channel),displacementMapUv:q&&E(o.displacementMap.channel),emissiveMapUv:j&&E(o.emissiveMap.channel),metalnessMapUv:Z&&E(o.metalnessMap.channel),roughnessMapUv:$&&E(o.roughnessMap.channel),anisotropyMapUv:ie&&E(o.anisotropyMap.channel),clearcoatMapUv:ae&&E(o.clearcoatMap.channel),clearcoatNormalMapUv:oe&&E(o.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:se&&E(o.clearcoatRoughnessMap.channel),iridescenceMapUv:le&&E(o.iridescenceMap.channel),iridescenceThicknessMapUv:ce&&E(o.iridescenceThicknessMap.channel),sheenColorMapUv:de&&E(o.sheenColorMap.channel),sheenRoughnessMapUv:ue&&E(o.sheenRoughnessMap.channel),specularMapUv:_e&&E(o.specularMap.channel),specularColorMapUv:ge&&E(o.specularColorMap.channel),specularIntensityMapUv:ve&&E(o.specularIntensityMap.channel),transmissionMapUv:Ee&&E(o.transmissionMap.channel),thicknessMapUv:Se&&E(o.thicknessMap.channel),alphaMapUv:Me&&E(o.alphaMap.channel),vertexTangents:!!x.attributes.tangent&&(K||Q),vertexColors:o.vertexColors,vertexAlphas:!0===o.vertexColors&&!!x.attributes.color&&4===x.attributes.color.itemSize,pointsUvs:!0===T.isPoints&&!!x.attributes.uv&&(V||Me),fog:!!M,useFog:!0===o.fog,fogExp2:!!M&&M.isFogExp2,flatShading:!0===o.flatShading&&!1===o.wireframe,sizeAttenuation:!0===o.sizeAttenuation,logarithmicDepthBuffer:h,reversedDepthBuffer:B,skinning:!0===T.isSkinnedMesh,morphTargets:void 0!==x.morphAttributes.position,morphNormals:void 0!==x.morphAttributes.normal,morphColors:void 0!==x.morphAttributes.color,morphTargetsCount:P,morphTextureStride:N,numDirLights:l.directional.length,numPointLights:l.point.length,numSpotLights:l.spot.length,numSpotLightMaps:l.spotLightMap.length,numRectAreaLights:l.rectArea.length,numHemiLights:l.hemi.length,numDirLightShadows:l.directionalShadowMap.length,numPointLightShadows:l.pointShadowMap.length,numSpotLightShadows:l.spotShadowMap.length,numSpotLightShadowsWithMaps:l.numSpotLightShadowsWithMaps,numLightProbes:l.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:o.dithering,shadowMapEnabled:e.shadowMap.enabled&&f.length>0,shadowMapType:e.shadowMap.type,toneMapping:be,decodeVideoTexture:V&&!0===o.map.isVideoTexture&&p.getTransfer(o.map.colorSpace)===m,decodeVideoTextureEmissive:j&&!0===o.emissiveMap.isVideoTexture&&p.getTransfer(o.emissiveMap.colorSpace)===m,premultipliedAlpha:o.premultipliedAlpha,doubleSided:o.side===fe,flipSided:o.side===c,useDepthPacking:o.depthPacking>=0,depthPacking:o.depthPacking||0,index0AttributeName:o.index0AttributeName,extensionClipCullDistance:Ae&&!0===o.extensions.clipCullDistance&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ae&&!0===o.extensions.multiDraw||G)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:o.customProgramCacheKey()};return Ce.vertexUv1s=u.has(1),Ce.vertexUv2s=u.has(2),Ce.vertexUv3s=u.has(3),u.clear(),Ce},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(!function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){l.disableAll(),t.supportsVertexTextures&&l.enable(0);t.instancing&&l.enable(1);t.instancingColor&&l.enable(2);t.instancingMorph&&l.enable(3);t.matcap&&l.enable(4);t.envMap&&l.enable(5);t.normalMapObjectSpace&&l.enable(6);t.normalMapTangentSpace&&l.enable(7);t.clearcoat&&l.enable(8);t.iridescence&&l.enable(9);t.alphaTest&&l.enable(10);t.vertexColors&&l.enable(11);t.vertexAlphas&&l.enable(12);t.vertexUv1s&&l.enable(13);t.vertexUv2s&&l.enable(14);t.vertexUv3s&&l.enable(15);t.vertexTangents&&l.enable(16);t.anisotropy&&l.enable(17);t.alphaHash&&l.enable(18);t.batching&&l.enable(19);t.dispersion&&l.enable(20);t.batchingColor&&l.enable(21);t.gradientMap&&l.enable(22);e.push(l.mask),l.disableAll(),t.fog&&l.enable(0);t.useFog&&l.enable(1);t.flatShading&&l.enable(2);t.logarithmicDepthBuffer&&l.enable(3);t.reversedDepthBuffer&&l.enable(4);t.skinning&&l.enable(5);t.morphTargets&&l.enable(6);t.morphNormals&&l.enable(7);t.morphColors&&l.enable(8);t.premultipliedAlpha&&l.enable(9);t.shadowMapEnabled&&l.enable(10);t.doubleSided&&l.enable(11);t.flipSided&&l.enable(12);t.useDepthPacking&&l.enable(13);t.dithering&&l.enable(14);t.transmission&&l.enable(15);t.sheen&&l.enable(16);t.opaque&&l.enable(17);t.pointsUvs&&l.enable(18);t.decodeVideoTexture&&l.enable(19);t.decodeVideoTextureEmissive&&l.enable(20);t.alphaToCoverage&&l.enable(21);e.push(l.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=v[e.type];let n;if(t){const e=Dn[t];n=ue.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let r;for(let e=0,t=f.length;e0?r.push(d):!0===o.transparent?i.push(d):n.push(d)},unshift:function(e,t,o,s,l,c){const d=a(e,t,o,s,l,c);o.transmission>0?r.unshift(d):!0===o.transparent?i.unshift(d):n.unshift(d)},finish:function(){for(let n=t,r=e.length;n1&&n.sort(e||zi),r.length>1&&r.sort(t||ki),i.length>1&&i.sort(t||ki)}}}function Xi(){let e=new WeakMap;return{get:function(t,n){const r=e.get(t);let i;return void 0===r?(i=new Wi,e.set(t,[i])):n>=r.length?(i=new Wi,r.push(i)):i=r[n],i},dispose:function(){e=new WeakMap}}}function Yi(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let r;switch(t.type){case"DirectionalLight":r={direction:new i,color:new n};break;case"SpotLight":r={position:new i,direction:new i,color:new n,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":r={position:new i,color:new n,distance:0,decay:0};break;case"HemisphereLight":r={direction:new i,skyColor:new n,groundColor:new n};break;case"RectAreaLight":r={color:new n,position:new i,halfWidth:new i,halfHeight:new i}}return e[t.id]=r,r}}}let Ki=0;function qi(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function ji(e){const n=new Yi,r=function(){const e={};return{get:function(n){if(void 0!==e[n.id])return e[n.id];let r;switch(n.type){case"DirectionalLight":case"SpotLight":r={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new t};break;case"PointLight":r={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new t,shadowCameraNear:1,shadowCameraFar:1e3}}return e[n.id]=r,r}}}(),a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)a.probe.push(new i);const o=new i,s=new f,l=new f;return{setup:function(t){let i=0,o=0,s=0;for(let e=0;e<9;e++)a.probe[e].set(0,0,0);let l=0,c=0,d=0,u=0,f=0,p=0,m=0,h=0,_=0,g=0,v=0;t.sort(qi);for(let e=0,E=t.length;e0&&(!0===e.has("OES_texture_float_linear")?(a.rectAreaLTC1=Un.LTC_FLOAT_1,a.rectAreaLTC2=Un.LTC_FLOAT_2):(a.rectAreaLTC1=Un.LTC_HALF_1,a.rectAreaLTC2=Un.LTC_HALF_2)),a.ambient[0]=i,a.ambient[1]=o,a.ambient[2]=s;const E=a.hash;E.directionalLength===l&&E.pointLength===c&&E.spotLength===d&&E.rectAreaLength===u&&E.hemiLength===f&&E.numDirectionalShadows===p&&E.numPointShadows===m&&E.numSpotShadows===h&&E.numSpotMaps===_&&E.numLightProbes===v||(a.directional.length=l,a.spot.length=d,a.rectArea.length=u,a.point.length=c,a.hemi.length=f,a.directionalShadow.length=p,a.directionalShadowMap.length=p,a.pointShadow.length=m,a.pointShadowMap.length=m,a.spotShadow.length=h,a.spotShadowMap.length=h,a.directionalShadowMatrix.length=p,a.pointShadowMatrix.length=m,a.spotLightMatrix.length=h+_-g,a.spotLightMap.length=_,a.numSpotLightShadowsWithMaps=g,a.numLightProbes=v,E.directionalLength=l,E.pointLength=c,E.spotLength=d,E.rectAreaLength=u,E.hemiLength=f,E.numDirectionalShadows=p,E.numPointShadows=m,E.numSpotShadows=h,E.numSpotMaps=_,E.numLightProbes=v,a.version=Ki++)},setupView:function(e,t){let n=0,r=0,i=0,c=0,d=0;const u=t.matrixWorldInverse;for(let t=0,f=e.length;t=i.length?(a=new Zi(e),i.push(a)):a=i[r],a},dispose:function(){t=new WeakMap}}}function Qi(e,n,r){let i=new ge;const a=new t,s=new t,d=new k,u=new ve({depthPacking:Ee}),f=new Se,p={},m=r.maxTextureSize,h={[_]:c,[c]:_,[fe]:fe},g=new l({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new t},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),v=g.clone();v.defines.HORIZONTAL_PASS=1;const E=new N;E.setAttribute("position",new O(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new o(E,g),T=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=$;let M=this.type;function x(t,r){const i=n.update(S);g.defines.VSM_SAMPLES!==t.blurSamples&&(g.defines.VSM_SAMPLES=t.blurSamples,v.defines.VSM_SAMPLES=t.blurSamples,g.needsUpdate=!0,v.needsUpdate=!0),null===t.mapPass&&(t.mapPass=new y(a.x,a.y)),g.uniforms.shadow_pass.value=t.map.texture,g.uniforms.resolution.value=t.mapSize,g.uniforms.radius.value=t.radius,e.setRenderTarget(t.mapPass),e.clear(),e.renderBufferDirect(r,null,i,g,S,null),v.uniforms.shadow_pass.value=t.mapPass.texture,v.uniforms.resolution.value=t.mapSize,v.uniforms.radius.value=t.radius,e.setRenderTarget(t.map),e.clear(),e.renderBufferDirect(r,null,i,v,S,null)}function R(t,n,r,i){let a=null;const o=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==o)a=o;else if(a=!0===r.isPointLight?f:u,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||!0===n.alphaToCoverage){const e=a.uuid,t=n.uuid;let r=p[e];void 0===r&&(r={},p[e]=r);let i=r[t];void 0===i&&(i=a.clone(),r[t]=i,n.addEventListener("dispose",b)),a=i}if(a.visible=n.visible,a.wireframe=n.wireframe,a.side=i===J?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:h[n.side],a.alphaMap=n.alphaMap,a.alphaTest=!0===n.alphaToCoverage?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===r.isPointLight&&!0===a.isMeshDistanceMaterial){e.properties.get(a).light=r}return a}function A(t,r,a,o,s){if(!1===t.visible)return;if(t.layers.test(r.layers)&&(t.isMesh||t.isLine||t.isPoints)&&(t.castShadow||t.receiveShadow&&s===J)&&(!t.frustumCulled||i.intersectsObject(t))){t.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,t.matrixWorld);const i=n.update(t),l=t.material;if(Array.isArray(l)){const n=i.groups;for(let c=0,d=n.length;cm||a.y>m)&&(a.x>m&&(s.x=Math.floor(m/h.x),a.x=s.x*h.x,c.mapSize.x=s.x),a.y>m&&(s.y=Math.floor(m/h.y),a.y=s.y*h.y,c.mapSize.y=s.y)),null===c.map||!0===f||!0===p){const e=this.type!==J?{minFilter:Te,magFilter:Te}:{};null!==c.map&&c.map.dispose(),c.map=new y(a.x,a.y,e),c.map.texture.name=l.name+".shadowMap",c.camera.updateProjectionMatrix()}e.setRenderTarget(c.map),e.clear();const _=c.getViewportCount();for(let e=0;e<_;e++){const t=c.getViewport(e);d.set(s.x*t.x,s.y*t.y,s.x*t.z,s.y*t.w),u.viewport(d),c.updateMatrices(l,e),i=c.getFrustum(),A(n,r,c.camera,l,this.type)}!0!==c.isPointLightShadow&&this.type===J&&x(c,r),c.needsUpdate=!1}M=this.type,T.needsUpdate=!1,e.setRenderTarget(o,l,c)}}const Ji={[Ke]:Ye,[Xe]:ze,[We]:Ve,[Me]:ke,[Ye]:Ke,[ze]:Xe,[Ve]:We,[ke]:Me};function ea(e,t){const r=new function(){let t=!1;const n=new k;let r=null;const i=new k(0,0,0,0);return{setMask:function(n){r===n||t||(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,a,o,s){!0===s&&(t*=o,r*=o,a*=o),n.set(t,r,a,o),!1===i.equals(n)&&(e.clearColor(t,r,a,o),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}},i=new function(){let n=!1,r=!1,i=null,a=null,o=null;return{setReversed:function(e){if(r!==e){const n=t.get("EXT_clip_control");e?n.clipControlEXT(n.LOWER_LEFT_EXT,n.ZERO_TO_ONE_EXT):n.clipControlEXT(n.LOWER_LEFT_EXT,n.NEGATIVE_ONE_TO_ONE_EXT),r=e;const i=o;o=null,this.setClear(i)}},getReversed:function(){return r},setTest:function(t){t?W(e.DEPTH_TEST):X(e.DEPTH_TEST)},setMask:function(t){i===t||n||(e.depthMask(t),i=t)},setFunc:function(t){if(r&&(t=Ji[t]),a!==t){switch(t){case Ke:e.depthFunc(e.NEVER);break;case Ye:e.depthFunc(e.ALWAYS);break;case Xe:e.depthFunc(e.LESS);break;case Me:e.depthFunc(e.LEQUAL);break;case We:e.depthFunc(e.EQUAL);break;case ke:e.depthFunc(e.GEQUAL);break;case ze:e.depthFunc(e.GREATER);break;case Ve:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}a=t}},setLocked:function(e){n=e},setClear:function(t){o!==t&&(r&&(t=1-t),e.clearDepth(t),o=t)},reset:function(){n=!1,i=null,a=null,o=null,r=!1}}},a=new function(){let t=!1,n=null,r=null,i=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(n){t||(n?W(e.STENCIL_TEST):X(e.STENCIL_TEST))},setMask:function(r){n===r||t||(e.stencilMask(r),n=r)},setFunc:function(t,n,o){r===t&&i===n&&a===o||(e.stencilFunc(t,n,o),r=t,i=n,a=o)},setOp:function(t,n,r){o===t&&s===n&&l===r||(e.stencilOp(t,n,r),o=t,s=n,l=r)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,r=null,i=null,a=null,o=null,s=null,l=null,c=null}}},o=new WeakMap,s=new WeakMap;let l={},d={},u=new WeakMap,f=[],p=null,m=!1,h=null,_=null,g=null,v=null,E=null,S=null,T=null,M=new n(0,0,0),x=0,R=!1,A=null,b=null,C=null,L=null,P=null;const U=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let D=!1,w=0;const y=e.getParameter(e.VERSION);-1!==y.indexOf("WebGL")?(w=parseFloat(/^WebGL (\d)/.exec(y)[1]),D=w>=1):-1!==y.indexOf("OpenGL ES")&&(w=parseFloat(/^OpenGL ES (\d)/.exec(y)[1]),D=w>=2);let N=null,O={};const F=e.getParameter(e.SCISSOR_BOX),B=e.getParameter(e.VIEWPORT),H=(new k).fromArray(F),G=(new k).fromArray(B);function V(t,n,r,i){const a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;on||i.height>n)&&(r=n/Math.max(i.width,i.height)),r<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){const n=Math.floor(r*i.width),a=Math.floor(r*i.height);void 0===f&&(f=g(n,a));const o=t?g(n,a):f;o.width=n,o.height=a;return o.getContext("2d").drawImage(e,0,0,n,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+i.width+"x"+i.height+") to ("+n+"x"+a+")."),o}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+i.width+"x"+i.height+")."),e}return e}function E(e){return e.generateMipmaps}function x(t){e.generateMipmap(t)}function R(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function A(t,r,i,a,o=!1){if(null!==t){if(void 0!==e[t])return e[t];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+t+"'")}let s=r;if(r===e.RED&&(i===e.FLOAT&&(s=e.R32F),i===e.HALF_FLOAT&&(s=e.R16F),i===e.UNSIGNED_BYTE&&(s=e.R8)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.R8UI),i===e.UNSIGNED_SHORT&&(s=e.R16UI),i===e.UNSIGNED_INT&&(s=e.R32UI),i===e.BYTE&&(s=e.R8I),i===e.SHORT&&(s=e.R16I),i===e.INT&&(s=e.R32I)),r===e.RG&&(i===e.FLOAT&&(s=e.RG32F),i===e.HALF_FLOAT&&(s=e.RG16F),i===e.UNSIGNED_BYTE&&(s=e.RG8)),r===e.RG_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RG8UI),i===e.UNSIGNED_SHORT&&(s=e.RG16UI),i===e.UNSIGNED_INT&&(s=e.RG32UI),i===e.BYTE&&(s=e.RG8I),i===e.SHORT&&(s=e.RG16I),i===e.INT&&(s=e.RG32I)),r===e.RGB_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGB8UI),i===e.UNSIGNED_SHORT&&(s=e.RGB16UI),i===e.UNSIGNED_INT&&(s=e.RGB32UI),i===e.BYTE&&(s=e.RGB8I),i===e.SHORT&&(s=e.RGB16I),i===e.INT&&(s=e.RGB32I)),r===e.RGBA_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGBA8UI),i===e.UNSIGNED_SHORT&&(s=e.RGBA16UI),i===e.UNSIGNED_INT&&(s=e.RGBA32UI),i===e.BYTE&&(s=e.RGBA8I),i===e.SHORT&&(s=e.RGBA16I),i===e.INT&&(s=e.RGBA32I)),r===e.RGB&&(i===e.UNSIGNED_INT_5_9_9_9_REV&&(s=e.RGB9_E5),i===e.UNSIGNED_INT_10F_11F_11F_REV&&(s=e.R11F_G11F_B10F)),r===e.RGBA){const t=o?se:p.getTransfer(a);i===e.FLOAT&&(s=e.RGBA32F),i===e.HALF_FLOAT&&(s=e.RGBA16F),i===e.UNSIGNED_BYTE&&(s=t===m?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT_4_4_4_4&&(s=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(s=e.RGB5_A1)}return s!==e.R16F&&s!==e.R32F&&s!==e.RG16F&&s!==e.RG32F&&s!==e.RGBA16F&&s!==e.RGBA32F||n.get("EXT_color_buffer_float"),s}function b(t,n){let r;return t?null===n||n===Tt||n===Mt?r=e.DEPTH24_STENCIL8:n===T?r=e.DEPTH32F_STENCIL8:n===xt&&(r=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===Tt||n===Mt?r=e.DEPTH_COMPONENT24:n===T?r=e.DEPTH_COMPONENT32F:n===xt&&(r=e.DEPTH_COMPONENT16),r}function C(e,t){return!0===E(e)||e.isFramebufferTexture&&e.minFilter!==Te&&e.minFilter!==B?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function L(e){const t=e.target;t.removeEventListener("dispose",L),function(e){const t=i.get(e);if(void 0===t.__webglInit)return;const n=e.source,r=h.get(n);if(r){const i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&U(e),0===Object.keys(r).length&&h.delete(n)}i.remove(e)}(t),t.isVideoTexture&&u.delete(t)}function P(t){const n=t.target;n.removeEventListener("dispose",P),function(t){const n=i.get(t);t.depthTexture&&(t.depthTexture.dispose(),i.remove(t.depthTexture));if(t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let r=0;r0&&a.__version!==t.version){const e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void V(a,t,n);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}else t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null);r.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+n)}const I={[at]:e.REPEAT,[it]:e.CLAMP_TO_EDGE,[rt]:e.MIRRORED_REPEAT},y={[Te]:e.NEAREST,[ct]:e.NEAREST_MIPMAP_NEAREST,[lt]:e.NEAREST_MIPMAP_LINEAR,[B]:e.LINEAR,[st]:e.LINEAR_MIPMAP_NEAREST,[ot]:e.LINEAR_MIPMAP_LINEAR},N={[_t]:e.NEVER,[ht]:e.ALWAYS,[mt]:e.LESS,[K]:e.LEQUAL,[pt]:e.EQUAL,[ft]:e.GEQUAL,[ut]:e.GREATER,[dt]:e.NOTEQUAL};function O(t,r){if(r.type!==T||!1!==n.has("OES_texture_float_linear")||r.magFilter!==B&&r.magFilter!==st&&r.magFilter!==lt&&r.magFilter!==ot&&r.minFilter!==B&&r.minFilter!==st&&r.minFilter!==lt&&r.minFilter!==ot||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(t,e.TEXTURE_WRAP_S,I[r.wrapS]),e.texParameteri(t,e.TEXTURE_WRAP_T,I[r.wrapT]),t!==e.TEXTURE_3D&&t!==e.TEXTURE_2D_ARRAY||e.texParameteri(t,e.TEXTURE_WRAP_R,I[r.wrapR]),e.texParameteri(t,e.TEXTURE_MAG_FILTER,y[r.magFilter]),e.texParameteri(t,e.TEXTURE_MIN_FILTER,y[r.minFilter]),r.compareFunction&&(e.texParameteri(t,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(t,e.TEXTURE_COMPARE_FUNC,N[r.compareFunction])),!0===n.has("EXT_texture_filter_anisotropic")){if(r.magFilter===Te)return;if(r.minFilter!==lt&&r.minFilter!==ot)return;if(r.type===T&&!1===n.has("OES_texture_float_linear"))return;if(r.anisotropy>1||i.get(r).__currentAnisotropy){const o=n.get("EXT_texture_filter_anisotropic");e.texParameterf(t,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(r.anisotropy,a.getMaxAnisotropy())),i.get(r).__currentAnisotropy=r.anisotropy}}}function H(t,n){let r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",L));const i=n.source;let a=h.get(i);void 0===a&&(a={},h.set(i,a));const o=function(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(o!==t.__cacheKey){void 0===a[o]&&(a[o]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,r=!0),a[o].usedTimes++;const i=a[t.__cacheKey];void 0!==i&&(a[t.__cacheKey].usedTimes--,0===i.usedTimes&&U(n)),t.__cacheKey=o,t.__webglTexture=a[o].texture}return r}function G(e,t,n){return Math.floor(Math.floor(e/n)/t)}function V(t,n,s){let l=e.TEXTURE_2D;(n.isDataArrayTexture||n.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),n.isData3DTexture&&(l=e.TEXTURE_3D);const c=H(t,n),d=n.source;r.bindTexture(l,t.__webglTexture,e.TEXTURE0+s);const u=i.get(d);if(d.version!==u.__version||!0===c){r.activeTexture(e.TEXTURE0+s);const t=p.getPrimaries(p.workingColorSpace),i=n.colorSpace===gt?null:p.getPrimaries(n.colorSpace),f=n.colorSpace===gt||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,n.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,n.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,f);let m=v(n.image,!1,a.maxTextureSize);m=$(n,m);const h=o.convert(n.format,n.colorSpace),_=o.convert(n.type);let g,S=A(n.internalFormat,h,_,n.colorSpace,n.isVideoTexture);O(l,n);const T=n.mipmaps,R=!0!==n.isVideoTexture,L=void 0===u.__version||!0===c,P=d.dataReady,U=C(n,m);if(n.isDepthTexture)S=b(n.format===vt,n.type),L&&(R?r.texStorage2D(e.TEXTURE_2D,1,S,m.width,m.height):r.texImage2D(e.TEXTURE_2D,0,S,m.width,m.height,0,h,_,null));else if(n.isDataTexture)if(T.length>0){R&&L&&r.texStorage2D(e.TEXTURE_2D,U,S,T[0].width,T[0].height);for(let t=0,n=T.length;te.start-t.start);let s=0;for(let e=1;e0){const i=Et(g.width,g.height,n.format,n.type);for(const a of n.layerUpdates){const n=g.data.subarray(a*i/g.data.BYTES_PER_ELEMENT,(a+1)*i/g.data.BYTES_PER_ELEMENT);r.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,a,g.width,g.height,1,h,n)}n.clearLayerUpdates()}else r.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,g.width,g.height,m.depth,h,g.data)}else r.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,S,g.width,g.height,m.depth,0,g.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else R?P&&r.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,g.width,g.height,m.depth,h,_,g.data):r.texImage3D(e.TEXTURE_2D_ARRAY,t,S,g.width,g.height,m.depth,0,h,_,g.data)}else{R&&L&&r.texStorage2D(e.TEXTURE_2D,U,S,T[0].width,T[0].height);for(let t=0,i=T.length;t0){const t=Et(m.width,m.height,n.format,n.type);for(const i of n.layerUpdates){const n=m.data.subarray(i*t/m.data.BYTES_PER_ELEMENT,(i+1)*t/m.data.BYTES_PER_ELEMENT);r.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,i,m.width,m.height,1,h,_,n)}n.clearLayerUpdates()}else r.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,m.width,m.height,m.depth,h,_,m.data)}else r.texImage3D(e.TEXTURE_2D_ARRAY,0,S,m.width,m.height,m.depth,0,h,_,m.data);else if(n.isData3DTexture)R?(L&&r.texStorage3D(e.TEXTURE_3D,U,S,m.width,m.height,m.depth),P&&r.texSubImage3D(e.TEXTURE_3D,0,0,0,0,m.width,m.height,m.depth,h,_,m.data)):r.texImage3D(e.TEXTURE_3D,0,S,m.width,m.height,m.depth,0,h,_,m.data);else if(n.isFramebufferTexture){if(L)if(R)r.texStorage2D(e.TEXTURE_2D,U,S,m.width,m.height);else{let t=m.width,n=m.height;for(let i=0;i>=1,n>>=1}}else if(T.length>0){if(R&&L){const t=Q(T[0]);r.texStorage2D(e.TEXTURE_2D,U,S,t.width,t.height)}for(let t=0,n=T.length;t>d),i=Math.max(1,n.height>>d);c===e.TEXTURE_3D||c===e.TEXTURE_2D_ARRAY?r.texImage3D(c,d,p,t,i,n.depth,0,u,f,null):r.texImage2D(c,d,p,t,i,0,u,f,null)}r.bindFramebuffer(e.FRAMEBUFFER,t),Z(n)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,s,c,h.__webglTexture,0,j(n)):(c===e.TEXTURE_2D||c>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,s,c,h.__webglTexture,d),r.bindFramebuffer(e.FRAMEBUFFER,null)}function k(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){const i=n.depthTexture,a=i&&i.isDepthTexture?i.type:null,o=b(n.stencilBuffer,a),s=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=j(n);Z(n)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,c,o,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,c,o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,s,e.RENDERBUFFER,t)}else{const t=n.textures;for(let i=0;i{delete n.__boundDepthTexture,delete n.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),n.__depthDisposeCallback=t}n.__boundDepthTexture=e}if(t.depthTexture&&!n.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");const e=t.texture.mipmaps;e&&e.length>0?W(n.__webglFramebuffer[0],t):W(n.__webglFramebuffer,t)}else if(a){n.__webglDepthbuffer=[];for(let i=0;i<6;i++)if(r.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[i]),void 0===n.__webglDepthbuffer[i])n.__webglDepthbuffer[i]=e.createRenderbuffer(),k(n.__webglDepthbuffer[i],t,!1);else{const r=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=n.__webglDepthbuffer[i];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,r,e.RENDERBUFFER,a)}}else{const i=t.texture.mipmaps;if(i&&i.length>0?r.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[0]):r.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer),void 0===n.__webglDepthbuffer)n.__webglDepthbuffer=e.createRenderbuffer(),k(n.__webglDepthbuffer,t,!1);else{const r=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,i=n.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,r,e.RENDERBUFFER,i)}}r.bindFramebuffer(e.FRAMEBUFFER,null)}const Y=[],q=[];function j(e){return Math.min(a.maxSamples,e.samples)}function Z(e){const t=i.get(e);return e.samples>0&&!0===n.has("WEBGL_multisampled_render_to_texture")&&!1!==t.__useRenderToTexture}function $(e,t){const n=e.colorSpace,r=e.format,i=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==F&&n!==gt&&(p.getTransfer(n)===m?r===M&&i===S||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),t}function Q(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(d.width=e.naturalWidth||e.width,d.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(d.width=e.displayWidth,d.height=e.displayHeight):(d.width=e.width,d.height=e.height),d}this.allocateTextureUnit=function(){const e=D;return e>=a.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+a.maxTextures),D+=1,e},this.resetTextureUnits=function(){D=0},this.setTexture2D=w,this.setTexture2DArray=function(t,n){const a=i.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?V(a,t,n):r.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+n)},this.setTexture3D=function(t,n){const a=i.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?V(a,t,n):r.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+n)},this.setTextureCube=function(t,n){const s=i.get(t);t.version>0&&s.__version!==t.version?function(t,n,s){if(6!==n.image.length)return;const l=H(t,n),c=n.source;r.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+s);const d=i.get(c);if(c.version!==d.__version||!0===l){r.activeTexture(e.TEXTURE0+s);const t=p.getPrimaries(p.workingColorSpace),i=n.colorSpace===gt?null:p.getPrimaries(n.colorSpace),u=n.colorSpace===gt||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,n.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,n.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);const f=n.isCompressedTexture||n.image[0].isCompressedTexture,m=n.image[0]&&n.image[0].isDataTexture,h=[];for(let e=0;e<6;e++)h[e]=f||m?m?n.image[e].image:n.image[e]:v(n.image[e],!0,a.maxCubemapSize),h[e]=$(n,h[e]);const _=h[0],g=o.convert(n.format,n.colorSpace),S=o.convert(n.type),T=A(n.internalFormat,g,S,n.colorSpace),R=!0!==n.isVideoTexture,b=void 0===d.__version||!0===l,L=c.dataReady;let P,U=C(n,_);if(O(e.TEXTURE_CUBE_MAP,n),f){R&&b&&r.texStorage2D(e.TEXTURE_CUBE_MAP,U,T,_.width,_.height);for(let t=0;t<6;t++){P=h[t].mipmaps;for(let i=0;i0&&U++;const t=Q(h[0]);r.texStorage2D(e.TEXTURE_CUBE_MAP,U,T,t.width,t.height)}for(let t=0;t<6;t++)if(m){R?L&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,h[t].width,h[t].height,g,S,h[t].data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,T,h[t].width,h[t].height,0,g,S,h[t].data);for(let n=0;n1;if(u||(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=n.version,s.memory.textures++),d){a.__webglFramebuffer=[];for(let t=0;t<6;t++)if(n.mipmaps&&n.mipmaps.length>0){a.__webglFramebuffer[t]=[];for(let r=0;r0){a.__webglFramebuffer=[];for(let t=0;t0&&!1===Z(t)){a.__webglMultisampledFramebuffer=e.createFramebuffer(),a.__webglColorRenderbuffer=[],r.bindFramebuffer(e.FRAMEBUFFER,a.__webglMultisampledFramebuffer);for(let n=0;n0)for(let i=0;i0)for(let r=0;r0)if(!1===Z(t)){const n=t.textures,a=t.width,o=t.height;let s=e.COLOR_BUFFER_BIT;const l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,d=i.get(t),u=n.length>1;if(u)for(let t=0;t0?r.bindFramebuffer(e.DRAW_FRAMEBUFFER,d.__webglFramebuffer[0]):r.bindFramebuffer(e.DRAW_FRAMEBUFFER,d.__webglFramebuffer);for(let r=0;r= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new o(new h(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class ia extends vn{constructor(e,n){super();const r=this;let a=null,o=1,s=null,l="local-floor",c=1,d=null,u=null,f=null,p=null,m=null,h=null;const _="undefined"!=typeof XRWebGLBinding,g=new ra,v={},E=n.getContextAttributes();let T=null,x=null;const R=[],A=[],b=new t;let C=null;const L=new U;L.viewport=new k;const P=new U;P.viewport=new k;const D=[L,P],w=new En;let I=null,N=null;function O(e){const t=A.indexOf(e.inputSource);if(-1===t)return;const n=R[t];void 0!==n&&(n.update(e.inputSource,e.frame,d||s),n.dispatchEvent({type:e.type,data:e.inputSource}))}function F(){a.removeEventListener("select",O),a.removeEventListener("selectstart",O),a.removeEventListener("selectend",O),a.removeEventListener("squeeze",O),a.removeEventListener("squeezestart",O),a.removeEventListener("squeezeend",O),a.removeEventListener("end",F),a.removeEventListener("inputsourceschange",B);for(let e=0;e=0&&(A[r]=null,R[r].disconnect(n))}for(let t=0;t=A.length){A.push(n),r=e;break}if(null===A[e]){A[e]=n,r=e;break}}if(-1===r)break}const i=R[r];i&&i.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=R[e];return void 0===t&&(t=new Sn,R[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=R[e];return void 0===t&&(t=new Sn,R[e]=t),t.getGripSpace()},this.getHand=function(e){let t=R[e];return void 0===t&&(t=new Sn,R[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){o=e,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){l=e,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||s},this.setReferenceSpace=function(e){d=e},this.getBaseLayer=function(){return null!==p?p:m},this.getBinding=function(){return null===f&&_&&(f=new XRWebGLBinding(a,n)),f},this.getFrame=function(){return h},this.getSession=function(){return a},this.setSession=async function(t){if(a=t,null!==a){T=e.getRenderTarget(),a.addEventListener("select",O),a.addEventListener("selectstart",O),a.addEventListener("selectend",O),a.addEventListener("squeeze",O),a.addEventListener("squeezestart",O),a.addEventListener("squeezeend",O),a.addEventListener("end",F),a.addEventListener("inputsourceschange",B),!0!==E.xrCompatible&&await n.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(b);if(_&&"createProjectionLayer"in XRWebGLBinding.prototype){let t=null,r=null,i=null;E.depth&&(i=E.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,t=E.stencil?vt:St,r=E.stencil?Mt:Tt);const s={colorFormat:n.RGBA8,depthFormat:i,scaleFactor:o};f=this.getBinding(),p=f.createProjectionLayer(s),a.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),x=new y(p.textureWidth,p.textureHeight,{format:M,type:S,depthTexture:new q(p.textureWidth,p.textureHeight,r,void 0,void 0,void 0,void 0,void 0,void 0,t),stencilBuffer:E.stencil,colorSpace:e.outputColorSpace,samples:E.antialias?4:0,resolveDepthBuffer:!1===p.ignoreDepthValues,resolveStencilBuffer:!1===p.ignoreDepthValues})}else{const t={antialias:E.antialias,alpha:!0,depth:E.depth,stencil:E.stencil,framebufferScaleFactor:o};m=new XRWebGLLayer(a,n,t),a.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),x=new y(m.framebufferWidth,m.framebufferHeight,{format:M,type:S,colorSpace:e.outputColorSpace,stencilBuffer:E.stencil,resolveDepthBuffer:!1===m.ignoreDepthValues,resolveStencilBuffer:!1===m.ignoreDepthValues})}x.isXRRenderTarget=!0,this.setFoveation(c),d=null,s=await a.requestReferenceSpace(l),W.setContext(a),W.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==a)return a.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};const H=new i,G=new i;function V(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===a)return;let t=e.near,n=e.far;null!==g.texture&&(g.depthNear>0&&(t=g.depthNear),g.depthFar>0&&(n=g.depthFar)),w.near=P.near=L.near=t,w.far=P.far=L.far=n,I===w.near&&N===w.far||(a.updateRenderState({depthNear:w.near,depthFar:w.far}),I=w.near,N=w.far),w.layers.mask=6|e.layers.mask,L.layers.mask=3&w.layers.mask,P.layers.mask=5&w.layers.mask;const r=e.parent,i=w.cameras;V(w,r);for(let e=0;e0&&(e.alphaTest.value=r.alphaTest);const i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,aa.copy(o),aa.x*=-1,aa.y*=-1,aa.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(aa.y*=-1,aa.z*=-1),e.envMapRotation.value.setFromMatrix4(oa.makeRotationFromEuler(aa)),e.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,g(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,i,a,o,s){i.isMeshBasicMaterial||i.isMeshLambertMaterial?r(e,i):i.isMeshToonMaterial?(r(e,i),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,i)):i.isMeshPhongMaterial?(r(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,i)):i.isMeshStandardMaterial?(r(e,i),function(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform));e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform));t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}(e,i),i.isMeshPhysicalMaterial&&function(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform)));t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===c&&e.clearcoatNormalScale.value.negate()));t.dispersion>0&&(e.dispersion.value=t.dispersion);t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform)));t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor));t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform)));e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform));t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,i,s)):i.isMeshMatcapMaterial?(r(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,i)):i.isMeshDepthMaterial?r(e,i):i.isMeshDistanceMaterial?(r(e,i),function(e,n){const r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}(e,i)):i.isMeshNormalMaterial?r(e,i):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=.5*i,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,i,a,o):i.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function la(e,t,n,r){let i={},a={},o=[];const s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e,t,n,r){const i=e.value,a=t+"_"+n;if(void 0===r[a])return r[a]="number"==typeof i||"boolean"==typeof i?i:i.clone(),!0;{const e=r[a];if("number"==typeof i||"boolean"==typeof i){if(e!==i)return r[a]=i,!0}else if(!1===e.equals(i))return e.copy(i),!0}return!1}function c(e){const t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function d(t){const n=t.target;n.removeEventListener("dispose",d);const r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}return{bind:function(e,t){const n=t.program;r.uniformBlockBinding(e,n)},update:function(n,u){let f=i[n.id];void 0===f&&(!function(e){const t=e.uniforms;let n=0;const r=16;for(let e=0,i=t.length;e0&&(n+=r-i);e.__size=n,e.__cache={}}(n),f=function(t){const n=function(){for(let e=0;e0),u=!!n.morphAttributes.position,f=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let m=D;r.toneMapped&&(null!==w&&!0!==w.isXRRenderTarget||(m=C.toneMapping));const h=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=void 0!==h?h.length:0,g=ue.get(r),v=R.state.lights;if(!0===J&&(!0===ee||e!==N)){const t=e===N&&r.id===I;Re.setState(r,e,t)}let E=!1;r.version===g.__version?g.needsLights&&g.lightsStateVersion!==v.state.version||g.outputColorSpace!==s||i.isBatchedMesh&&!1===g.batching?E=!0:i.isBatchedMesh||!0!==g.batching?i.isBatchedMesh&&!0===g.batchingColor&&null===i.colorTexture||i.isBatchedMesh&&!1===g.batchingColor&&null!==i.colorTexture||i.isInstancedMesh&&!1===g.instancing?E=!0:i.isInstancedMesh||!0!==g.instancing?i.isSkinnedMesh&&!1===g.skinning?E=!0:i.isSkinnedMesh||!0!==g.skinning?i.isInstancedMesh&&!0===g.instancingColor&&null===i.instanceColor||i.isInstancedMesh&&!1===g.instancingColor&&null!==i.instanceColor||i.isInstancedMesh&&!0===g.instancingMorph&&null===i.morphTexture||i.isInstancedMesh&&!1===g.instancingMorph&&null!==i.morphTexture||g.envMap!==l||!0===r.fog&&g.fog!==a?E=!0:void 0===g.numClippingPlanes||g.numClippingPlanes===Re.numPlanes&&g.numIntersection===Re.numIntersection?(g.vertexAlphas!==c||g.vertexTangents!==d||g.morphTargets!==u||g.morphNormals!==f||g.morphColors!==p||g.toneMapping!==m||g.morphTargetsCount!==_)&&(E=!0):E=!0:E=!0:E=!0:E=!0:(E=!0,g.__version=r.version);let S=g.currentProgram;!0===E&&(S=$e(r,t,i));let T=!1,M=!1,x=!1;const A=S.getUniforms(),b=g.uniforms;ce.useProgram(S.program)&&(T=!0,M=!0,x=!0);r.id!==I&&(I=r.id,M=!0);if(T||N!==e){ce.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),A.setValue(Ie,"projectionMatrix",e.projectionMatrix),A.setValue(Ie,"viewMatrix",e.matrixWorldInverse);const t=A.map.cameraPosition;void 0!==t&&t.setValue(Ie,ne.setFromMatrixPosition(e.matrixWorld)),le.logarithmicDepthBuffer&&A.setValue(Ie,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&A.setValue(Ie,"isOrthographic",!0===e.isOrthographicCamera),N!==e&&(N=e,M=!0,x=!0)}if(i.isSkinnedMesh){A.setOptional(Ie,i,"bindMatrix"),A.setOptional(Ie,i,"bindMatrixInverse");const e=i.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),A.setValue(Ie,"boneTexture",e.boneTexture,pe))}i.isBatchedMesh&&(A.setOptional(Ie,i,"batchingTexture"),A.setValue(Ie,"batchingTexture",i._matricesTexture,pe),A.setOptional(Ie,i,"batchingIdTexture"),A.setValue(Ie,"batchingIdTexture",i._indirectTexture,pe),A.setOptional(Ie,i,"batchingColorTexture"),null!==i._colorsTexture&&A.setValue(Ie,"batchingColorTexture",i._colorsTexture,pe));const L=n.morphAttributes;void 0===L.position&&void 0===L.normal&&void 0===L.color||Ce.update(i,n,S);(M||g.receiveShadow!==i.receiveShadow)&&(g.receiveShadow=i.receiveShadow,A.setValue(Ie,"receiveShadow",i.receiveShadow));r.isMeshGouraudMaterial&&null!==r.envMap&&(b.envMap.value=l,b.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1);r.isMeshStandardMaterial&&null===r.envMap&&null!==t.environment&&(b.envMapIntensity.value=t.environmentIntensity);M&&(A.setValue(Ie,"toneMappingExposure",C.toneMappingExposure),g.needsLights&&(U=x,(P=b).ambientLightColor.needsUpdate=U,P.lightProbe.needsUpdate=U,P.directionalLights.needsUpdate=U,P.directionalLightShadows.needsUpdate=U,P.pointLights.needsUpdate=U,P.pointLightShadows.needsUpdate=U,P.spotLights.needsUpdate=U,P.spotLightShadows.needsUpdate=U,P.rectAreaLights.needsUpdate=U,P.hemisphereLights.needsUpdate=U),a&&!0===r.fog&&Te.refreshFogUniforms(b,a),Te.refreshMaterialUniforms(b,r,Y,X,R.state.transmissionRenderTarget[e.id]),_i.upload(Ie,Qe(g),b,pe));var P,U;r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(_i.upload(Ie,Qe(g),b,pe),r.uniformsNeedUpdate=!1);r.isSpriteMaterial&&A.setValue(Ie,"center",i.center);if(A.setValue(Ie,"modelViewMatrix",i.modelViewMatrix),A.setValue(Ie,"normalMatrix",i.normalMatrix),A.setValue(Ie,"modelMatrix",i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial){const e=r.uniformsGroups;for(let t=0,n=e.length;t{function n(){r.forEach(function(e){ue.get(e).currentProgram.isReady()&&r.delete(e)}),0!==r.size?setTimeout(n,10):t(e)}null!==se.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)})};let ze=null;function ke(){Xe.stop()}function We(){Xe.start()}const Xe=new Cn;function Ye(e,t,n,r){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)R.pushLight(e),e.castShadow&&R.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||Q.intersectsSprite(e)){r&&re.setFromMatrixPosition(e.matrixWorld).applyMatrix4(te);const t=Ee.update(e),i=e.material;i.visible&&x.push(e,t,i,n,re.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||Q.intersectsObject(e))){const t=Ee.update(e),i=e.material;if(r&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),re.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),re.copy(t.boundingSphere.center)),re.applyMatrix4(e.matrixWorld).applyMatrix4(te)),Array.isArray(i)){const r=t.groups;for(let a=0,o=r.length;a0&&je(i,t,n),a.length>0&&je(a,t,n),o.length>0&&je(o,t,n),ce.buffers.depth.setTest(!0),ce.buffers.depth.setMask(!0),ce.buffers.color.setMask(!0),ce.setPolygonOffset(!1)}function qe(e,t,n,r){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===R.state.transmissionRenderTarget[r.id]&&(R.state.transmissionRenderTarget[r.id]=new y(1,1,{generateMipmaps:!0,type:se.has("EXT_color_buffer_half_float")||se.has("EXT_color_buffer_float")?E:S,minFilter:ot,samples:4,stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:p.workingColorSpace}));const i=R.state.transmissionRenderTarget[r.id],a=r.viewport||O;i.setSize(a.z*C.transmissionResolutionScale,a.w*C.transmissionResolutionScale);const s=C.getRenderTarget(),l=C.getActiveCubeFace(),d=C.getActiveMipmapLevel();C.setRenderTarget(i),C.getClearColor(V),z=C.getClearAlpha(),z<1&&C.setClearColor(16777215,.5),C.clear(),ae&&be.render(n);const u=C.toneMapping;C.toneMapping=D;const f=r.viewport;if(void 0!==r.viewport&&(r.viewport=void 0),R.setupLightsView(r),!0===J&&Re.setGlobalState(C.clippingPlanes,r),je(e,n,r),pe.updateMultisampleRenderTarget(i),pe.updateRenderTargetMipmap(i),!1===se.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let i=0,a=t.length;i0)for(let t=0,a=n.length;t0&&qe(r,i,e,t),ae&&be.render(e),Ke(x,e,t);null!==w&&0===U&&(pe.updateMultisampleRenderTarget(w),pe.updateRenderTargetMipmap(w)),!0===e.isScene&&e.onAfterRender(C,e,t),De.resetDefaultState(),I=-1,N=null,b.pop(),b.length>0?(R=b[b.length-1],!0===J&&Re.setGlobalState(C.clippingPlanes,R.state.camera)):R=null,A.pop(),x=A.length>0?A[A.length-1]:null},this.getActiveCubeFace=function(){return P},this.getActiveMipmapLevel=function(){return U},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(e,t,n){const r=ue.get(e);r.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===r.__autoAllocateDepthBuffer&&(r.__useRenderToTexture=!1),ue.get(e.texture).__webglTexture=t,ue.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:n,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){const n=ue.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t};const et=Ie.createFramebuffer();this.setRenderTarget=function(e,t=0,n=0){w=e,P=t,U=n;let r=!0,i=null,a=!1,o=!1;if(e){const s=ue.get(e);if(void 0!==s.__useDefaultFramebuffer)ce.bindFramebuffer(Ie.FRAMEBUFFER,null),r=!1;else if(void 0===s.__webglFramebuffer)pe.setupRenderTarget(e);else if(s.__hasExternalTextures)pe.rebindTextures(e,ue.get(e.texture).__webglTexture,ue.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){const t=e.depthTexture;if(s.__boundDepthTexture!==t){if(null!==t&&ue.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");pe.setupDepthRenderbuffer(e)}}const l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(o=!0);const c=ue.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=Array.isArray(c[t])?c[t][n]:c[t],a=!0):i=e.samples>0&&!1===pe.useMultisampledRTT(e)?ue.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,O.copy(e.viewport),B.copy(e.scissor),G=e.scissorTest}else O.copy(j).multiplyScalar(Y).floor(),B.copy(Z).multiplyScalar(Y).floor(),G=$;0!==n&&(i=et);if(ce.bindFramebuffer(Ie.FRAMEBUFFER,i)&&r&&ce.drawBuffers(e,i),ce.viewport(O),ce.scissor(B),ce.setScissorTest(G),a){const r=ue.get(e.texture);Ie.framebufferTexture2D(Ie.FRAMEBUFFER,Ie.COLOR_ATTACHMENT0,Ie.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(o){const r=t;for(let t=0;t=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&(e.textures.length>1&&Ie.readBuffer(Ie.COLOR_ATTACHMENT0+s),Ie.readPixels(t,n,r,i,Ue.convert(l),Ue.convert(c),a))}finally{const e=null!==w?ue.get(w).__webglFramebuffer:null;ce.bindFramebuffer(Ie.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,a,o,s=0){if(!e||!e.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let l=ue.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(l=l[o]),l){if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){ce.bindFramebuffer(Ie.FRAMEBUFFER,l);const o=e.textures[s],c=o.format,d=o.type;if(!le.textureFormatReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!le.textureTypeReadable(d))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const u=Ie.createBuffer();Ie.bindBuffer(Ie.PIXEL_PACK_BUFFER,u),Ie.bufferData(Ie.PIXEL_PACK_BUFFER,a.byteLength,Ie.STREAM_READ),e.textures.length>1&&Ie.readBuffer(Ie.COLOR_ATTACHMENT0+s),Ie.readPixels(t,n,r,i,Ue.convert(c),Ue.convert(d),0);const f=null!==w?ue.get(w).__webglFramebuffer:null;ce.bindFramebuffer(Ie.FRAMEBUFFER,f);const p=Ie.fenceSync(Ie.SYNC_GPU_COMMANDS_COMPLETE,0);return Ie.flush(),await bn(Ie,p,4),Ie.bindBuffer(Ie.PIXEL_PACK_BUFFER,u),Ie.getBufferSubData(Ie.PIXEL_PACK_BUFFER,0,a),Ie.deleteBuffer(u),Ie.deleteSync(p),a}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(e,t=null,n=0){const r=Math.pow(2,-n),i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=null!==t?t.x:0,s=null!==t?t.y:0;pe.setTexture2D(e,0),Ie.copyTexSubImage2D(Ie.TEXTURE_2D,n,0,0,o,s,i,a),ce.unbindTexture()};const tt=Ie.createFramebuffer(),nt=Ie.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=null){let o,s,l,c,d,u,f,p,m;null===a&&(0!==i?(H("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),a=i,i=0):a=0);const h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(null!==n)o=n.max.x-n.min.x,s=n.max.y-n.min.y,l=n.isBox3?n.max.z-n.min.z:1,c=n.min.x,d=n.min.y,u=n.isBox3?n.min.z:0;else{const t=Math.pow(2,-i);o=Math.floor(h.width*t),s=Math.floor(h.height*t),l=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,c=0,d=0,u=0}null!==r?(f=r.x,p=r.y,m=r.z):(f=0,p=0,m=0);const _=Ue.convert(t.format),g=Ue.convert(t.type);let v;t.isData3DTexture?(pe.setTexture3D(t,0),v=Ie.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(pe.setTexture2DArray(t,0),v=Ie.TEXTURE_2D_ARRAY):(pe.setTexture2D(t,0),v=Ie.TEXTURE_2D),Ie.pixelStorei(Ie.UNPACK_FLIP_Y_WEBGL,t.flipY),Ie.pixelStorei(Ie.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),Ie.pixelStorei(Ie.UNPACK_ALIGNMENT,t.unpackAlignment);const E=Ie.getParameter(Ie.UNPACK_ROW_LENGTH),S=Ie.getParameter(Ie.UNPACK_IMAGE_HEIGHT),T=Ie.getParameter(Ie.UNPACK_SKIP_PIXELS),M=Ie.getParameter(Ie.UNPACK_SKIP_ROWS),x=Ie.getParameter(Ie.UNPACK_SKIP_IMAGES);Ie.pixelStorei(Ie.UNPACK_ROW_LENGTH,h.width),Ie.pixelStorei(Ie.UNPACK_IMAGE_HEIGHT,h.height),Ie.pixelStorei(Ie.UNPACK_SKIP_PIXELS,c),Ie.pixelStorei(Ie.UNPACK_SKIP_ROWS,d),Ie.pixelStorei(Ie.UNPACK_SKIP_IMAGES,u);const R=e.isDataArrayTexture||e.isData3DTexture,A=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){const n=ue.get(e),r=ue.get(t),h=ue.get(n.__renderTarget),_=ue.get(r.__renderTarget);ce.bindFramebuffer(Ie.READ_FRAMEBUFFER,h.__webglFramebuffer),ce.bindFramebuffer(Ie.DRAW_FRAMEBUFFER,_.__webglFramebuffer);for(let n=0;n { + let front = 30; + const margin = 12; + const clamp = (value, min, max) => Math.min(Math.max(value, min), max); + + for (const [panelSelector, handleSelector] of [ + ['#terminal', '.terminal-header'], + ['#operator-console', '.console-titlebar'], + ]) { + const panel = document.querySelector(panelSelector); + const handle = panel.querySelector(handleSelector); + let drag = null; + + function bringFront() { panel.style.zIndex = String(++front); } + panel.addEventListener('greenhouse:raise', bringFront); + function place(x, y, width, height) { + panel.style.width = `${width}px`; + panel.style.height = `${height}px`; + panel.style.left = `${clamp(x, margin, Math.max(margin, innerWidth - width - margin))}px`; + panel.style.top = `${clamp(y, margin, Math.max(margin, innerHeight - height - margin))}px`; + panel.style.right = 'auto'; + panel.style.bottom = 'auto'; + } + + panel.addEventListener('pointerdown', bringFront); + handle.addEventListener('pointerdown', event => { + if (innerWidth <= 700 || event.button !== 0 || event.target.closest('button, input, a, select, textarea')) return; + const rect = panel.getBoundingClientRect(); + bringFront(); + drag = { pointerId: event.pointerId, x: event.clientX, y: event.clientY, left: rect.left, top: rect.top, width: rect.width, height: rect.height }; + handle.setPointerCapture(event.pointerId); + handle.focus({ preventScroll: true }); + event.preventDefault(); + }); + handle.addEventListener('pointermove', event => { + if (!drag || event.pointerId !== drag.pointerId) return; + place(drag.left + event.clientX - drag.x, drag.top + event.clientY - drag.y, drag.width, drag.height); + }); + function stop(event) { + if (drag && event.pointerId === drag.pointerId) drag = null; + } + handle.addEventListener('pointerup', stop); + handle.addEventListener('pointercancel', stop); + handle.addEventListener('lostpointercapture', stop); + handle.addEventListener('keydown', event => { + if (!event.altKey || innerWidth <= 700) return; + if (event.key === 'Home') { + for (const property of ['left', 'top', 'right', 'bottom', 'width', 'height']) panel.style[property] = ''; + bringFront(); event.preventDefault(); return; + } + const move = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[event.key]; + if (!move) return; + const rect = panel.getBoundingClientRect(); + const step = event.shiftKey ? 48 : 16; + place(rect.left + move[0] * step, rect.top + move[1] * step, rect.width, rect.height); + bringFront(); event.preventDefault(); + }); + addEventListener('resize', () => { + if (!panel.style.left || innerWidth <= 700) { + if (innerWidth <= 700) for (const property of ['left', 'top', 'right', 'bottom', 'width', 'height']) panel.style[property] = ''; + return; + } + const rect = panel.getBoundingClientRect(); + place(rect.left, rect.top, rect.width, rect.height); + }); + } +})(); diff --git a/greenhouse/native/greenhouse-console b/greenhouse/native/greenhouse-console new file mode 100755 index 0000000..447138e Binary files /dev/null and b/greenhouse/native/greenhouse-console differ diff --git a/greenhouse/start.sh b/greenhouse/start.sh new file mode 100644 index 0000000..080c4c4 --- /dev/null +++ b/greenhouse/start.sh @@ -0,0 +1,19 @@ +#!/bin/sh +set -eu +python3 -c 'from pathlib import Path; Path("/data/console.sock").unlink(missing_ok=True)' +/greenhouse/greenhouse-console & +console_pid=$! +attempt=0 +while [ ! -S /data/console.sock ]; do + if ! kill -0 "$console_pid" 2>/dev/null; then + echo 'specimen console failed to start' >&2 + exit 1 + fi + attempt=$((attempt + 1)) + if [ "$attempt" -ge 50 ]; then + echo 'specimen console socket not ready' >&2 + exit 1 + fi + sleep 0.1 +done +exec python3 /greenhouse/app/server.py diff --git a/lighthouse/.dockerignore b/lighthouse/.dockerignore new file mode 100644 index 0000000..7509c48 --- /dev/null +++ b/lighthouse/.dockerignore @@ -0,0 +1,4 @@ +client/node_modules +client/dist +**/__pycache__ +**/*.pyc diff --git a/lighthouse/.goctf-compose b/lighthouse/.goctf-compose new file mode 100644 index 0000000..e69de29 diff --git a/lighthouse/Dockerfile b/lighthouse/Dockerfile new file mode 100644 index 0000000..aaccf3f --- /dev/null +++ b/lighthouse/Dockerfile @@ -0,0 +1,35 @@ +FROM node:22-bookworm AS web +WORKDIR /web +COPY client/package.json ./ +RUN npm install +COPY client/index.html ./index.html +COPY client/src/ ./src/ +RUN npm run build + +FROM debian:bookworm-slim AS wasmtime +ARG WASMTIME_VERSION=24.0.0 +ARG TARGETARCH +RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils && rm -rf /var/lib/apt/lists/* \ + && case "$TARGETARCH" in amd64) WASMTIME_ARCH=x86_64 ;; arm64) WASMTIME_ARCH=aarch64 ;; *) echo "Unsupported architecture: $TARGETARCH" >&2; exit 1 ;; esac \ + && curl -fsSL "https://github.com/bytecodealliance/wasmtime/releases/download/v${WASMTIME_VERSION}/wasmtime-v${WASMTIME_VERSION}-${WASMTIME_ARCH}-linux-c-api.tar.xz" -o /tmp/wasmtime.tar.xz \ + && tar -xJf /tmp/wasmtime.tar.xz -C /tmp \ + && mkdir -p /out/include /out/lib \ + && cp -a /tmp/wasmtime-v${WASMTIME_VERSION}-${WASMTIME_ARCH}-linux-c-api/include/. /out/include/ \ + && cp -a /tmp/wasmtime-v${WASMTIME_VERSION}-${WASMTIME_ARCH}-linux-c-api/lib/libwasmtime.so* /out/lib/ + +FROM debian:bookworm-slim +RUN apt-get update && apt-get install -y --no-install-recommends cmake make g++ clang llvm lld libcpp-httplib-dev libsqlite3-dev nlohmann-json3-dev sqlite3 util-linux \ + && rm -rf /var/lib/apt/lists/* +COPY --from=wasmtime /out/include/ /usr/local/include/ +COPY --from=wasmtime /out/lib/ /usr/local/lib/ +RUN ldconfig +WORKDIR /srv/lighthouse +COPY server/ ./server/ +RUN /bin/sh ./server/build.sh +COPY --from=web /web/dist ./public/ +RUN mkdir -p /data /var/log/lighthouse /srv/lighthouse/work \ + && chmod 0700 /data \ + && chmod 0755 /var/log/lighthouse \ + && chmod 0711 /srv/lighthouse/work +EXPOSE 8080 +CMD ["/srv/lighthouse/server/lighthouse"] diff --git a/lighthouse/client/index.html b/lighthouse/client/index.html new file mode 100644 index 0000000..d4aa898 --- /dev/null +++ b/lighthouse/client/index.html @@ -0,0 +1,5 @@ + + +Lighthouse +
+ diff --git a/lighthouse/client/package.json b/lighthouse/client/package.json new file mode 100644 index 0000000..6a20ca4 --- /dev/null +++ b/lighthouse/client/package.json @@ -0,0 +1 @@ +{"scripts":{"build":"vite build","dev":"vite --host 0.0.0.0"},"dependencies":{"@vitejs/plugin-vue":"latest","vite":"latest","vue":"latest"}} diff --git a/lighthouse/client/src/crypto.js b/lighthouse/client/src/crypto.js new file mode 100644 index 0000000..a6eeaa4 --- /dev/null +++ b/lighthouse/client/src/crypto.js @@ -0,0 +1,69 @@ +const unbytes = new TextDecoder(); + +function g(a, b, carry) { + const value = (a + b + carry) & 255; + return ((value << 2) | (value >>> 6)) & 255; +} + +function f(x) { + const a = x >>> 24, b = (x >>> 16) & 255, c = (x >>> 8) & 255, d = x & 255; + const y1 = g(a ^ b, c ^ d, 1); + const y2 = g(c ^ d, y1, 0); + return (g(a, y1, 0) << 24 | y1 << 16 | y2 << 8 | g(d, y2, 1)) >>> 0; +} + +function fk(x, y) { + const a = x >>> 24, b = (x >>> 16) & 255, c = (x >>> 8) & 255, d = x & 255; + const u = y >>> 24, v = (y >>> 16) & 255, w = (y >>> 8) & 255, z = y & 255; + const middle1 = g(a ^ b, (c ^ d) ^ u, 1); + const middle2 = g(c ^ d, middle1 ^ v, 0); + return (g(a, middle1 ^ w, 0) << 24 | middle1 << 16 | middle2 << 8 | g(d, middle2 ^ z, 1)) >>> 0; +} + +function block(left, right, keys) { + let x = left, y = (right ^ left) >>> 0; + for (let round = 3; round >= 1; round--) { + const next = (x ^ f(y ^ keys[round])) >>> 0; + x = y; + y = next; + } + const initial = (x ^ f(y ^ keys[0])) >>> 0; + return [(initial ^ keys[4]) >>> 0, (initial ^ y ^ keys[5]) >>> 0]; +} + +export function decrypt(secret, cipher) { + if (!/^[0-9a-f]+$/.test(cipher) || cipher.length % 16 || !/^[0-9a-f]{48}$/.test(secret)) + throw Error('Invalid message'); + const material = Array.from({ length: 6 }, (_, i) => parseInt(secret.slice(i * 8, i * 8 + 8), 16) >>> 0); + let left = material[0], right = material[1], previous = material[5]; + const words = []; + for (let i = 0; i < 6; i++) { + const next = fk(left, (right ^ previous ^ material[i]) >>> 0); + previous = left; + left = right; + right = next; + words.push(next >>> 16, next & 65535); + } + const outputLeft = ((words[8] << 16 | words[9]) ^ material[2]) >>> 0; + const outputRight = ((words[10] << 16 | words[11]) ^ material[3]) >>> 0; + const keys = Array.from({ length: 4 }, (_, i) => + (((words[i] >>> 8) << 16 | (words[i] & 255) << 8) ^ outputLeft ^ + (i % 2 ? outputRight : 0) ^ material[i]) >>> 0); + keys.push(((words[4] << 16 | words[5]) ^ outputLeft ^ outputRight ^ material[4]) >>> 0, + ((words[6] << 16 | words[7]) ^ outputRight ^ material[5]) >>> 0); + const output = new Uint8Array(cipher.length / 2); + for (let offset = 0; offset < output.length; offset += 8) { + const [left, right] = block( + parseInt(cipher.slice(offset * 2, offset * 2 + 8), 16) >>> 0, + parseInt(cipher.slice(offset * 2 + 8, offset * 2 + 16), 16) >>> 0, keys + ); + for (let i = 0; i < 4; i++) { + output[offset + i] = left >>> (24 - 8 * i); + output[offset + 4 + i] = right >>> (24 - 8 * i); + } + } + const padding = output[output.length - 1]; + if (padding < 1 || padding > 8 || !output.slice(-padding).every(byte => byte === padding)) + throw Error('Invalid message padding'); + return unbytes.decode(output.slice(0, -padding)); +} diff --git a/lighthouse/client/src/main.js b/lighthouse/client/src/main.js new file mode 100644 index 0000000..8273cb1 --- /dev/null +++ b/lighthouse/client/src/main.js @@ -0,0 +1,267 @@ +import { createApp, ref } from 'vue/dist/vue.esm-bundler.js'; +import { decrypt } from './crypto.js'; +import './style.css'; + +const textBytes = new TextEncoder(); + +createApp({ + setup() { + const queue = ref(''), key = ref(''), pass = ref(''), recipient = ref(''); + const queueLabel = ref('untitled'), retention = ref(3600); + const topic = ref('inbox'), delay = ref(0), text = ref(''); + const source = ref('int filter(int length) {\n return length <= 4096;\n}'); + const filterLabel = ref('unnamed'), revision = ref(''); + const selectedFilter = ref(null); + const received = ref([]), filters = ref([]); + const state = ref(null), view = ref('messages'), showRead = ref(false); + const feedback = ref({}), compiler = ref(''), listing = ref(''); + const path = suffix => '/api/queues/' + queue.value + suffix; + const credentials = () => queue.value + ':' + key.value; + + async function api(url, options = {}, accepted = []) { + const response = await fetch(url, { + ...options, + headers: { 'Content-Type': 'application/json', ...options.headers } + }); + const body = await response.json(); + if (!response.ok && !accepted.includes(response.status)) throw Error(body.error || body.compiler || 'Request failed'); + return body; + } + + async function action(name, work) { + feedback.value[name] = null; + try { + const result = await work(); + feedback.value[name] = typeof result === 'string' ? { kind: 'ok', text: result } : result; + } + catch (problem) { feedback.value[name] = { kind: 'error', text: problem.message }; } + } + + async function refresh() { + state.value = await api(path('')); + } + const headers = () => ({ 'X-Queue-Key': key.value }); + + const create = () => action('access', async () => { + const created = await api('/api/queues', { + method: 'POST', body: JSON.stringify({ label: queueLabel.value, retention_seconds: Number(retention.value) }) + }); + queue.value = created.id; + key.value = created.read_key; + pass.value = credentials(); + state.value = created; + recipient.value = created.id; + received.value = []; + filters.value = []; + selectedFilter.value = null; + view.value = 'messages'; + return 'Mailbox created. Save your access pass.'; + }); + const open = () => action('open', async () => { + const [id, secret, extra] = pass.value.trim().split(':'); + if (!id || !secret || extra) throw Error('Enter a mailbox access pass in the form UUID:read_key.'); + const info = await api('/api/queues/' + id); + await api('/api/queues/' + id + '/messages?show_read=true', { headers: { 'X-Queue-Key': secret } }); + queue.value = id; + key.value = secret; + state.value = info; + recipient.value = id; + received.value = []; + filters.value = []; + selectedFilter.value = null; + view.value = 'messages'; + feedback.value.access = { kind: 'ok', text: 'Mailbox opened.' }; + }); + const leave = () => { + queue.value = ''; + key.value = ''; + pass.value = ''; + state.value = null; + received.value = []; + filters.value = []; + selectedFilter.value = null; + compiler.value = ''; + listing.value = ''; + feedback.value = {}; + feedback.value.open = { kind: 'ok', text: 'Mailbox closed.' }; + }; + const send = () => action('send', async () => { + const id = recipient.value.trim(); + if (!text.value) throw Error('Write a message first.'); + const raw = textBytes.encode(text.value); + if (raw.length > 4096) throw Error('Messages must be at most 4096 bytes.'); + await api('/api/queues/' + id + '/messages', { + method: 'POST', + body: JSON.stringify({ + message: btoa(Array.from(raw, byte => String.fromCharCode(byte)).join('')), + topic: topic.value, + delay_ms: Number(delay.value) + }) + }); + text.value = ''; + if (state.value) await refresh(); + return 'Message sent.'; + }); + const receive = () => action('receive', async () => { + await refresh(); + const result = await api(path('/messages' + (showRead.value ? '?show_read=true' : '')), { headers: headers() }); + received.value = result.messages.map(message => { + try { + return { id: message.id, topic: message.topic, text: decrypt(key.value, message.ciphertext) }; + } catch { + return { id: message.id, topic: message.topic, text: 'Cannot open this message.' }; + } + }); + await refresh(); + return result.messages.length ? result.messages.length + ' message(s) displayed.' : 'No messages to display.'; + }); + const loadFilters = () => action('refreshFilters', async () => { + filters.value = (await api(path('/filters'))).filters; + return 'Revision list updated.'; + }); + const selectFilter = filter => action('selectFilter', async () => { + const details = await api(path('/filters/' + filter.revision), { headers: headers() }); + revision.value = details.revision; + selectedFilter.value = details; + return 'Revision #' + details.revision + ' selected.'; + }); + const newDraft = () => { + selectedFilter.value = null; + revision.value = ''; + compiler.value = ''; + listing.value = ''; + feedback.value.compile = null; + feedback.value.selectFilter = { kind: 'ok', text: 'Draft editor ready.' }; + }; + const install = () => action('compile', async () => { + compiler.value = ''; + listing.value = ''; + const result = await api(path('/filter'), { + method: 'POST', body: JSON.stringify({ source: source.value, label: filterLabel.value }) + }, [422]); + compiler.value = result.compiler || ''; + listing.value = result.listing || ''; + filters.value = (await api(path('/filters'))).filters; + if (!result.ok) { + return { kind: 'error', text: 'Revision #' + result.revision + ' rejected. See compiler output below.' }; + } + return 'Revision #' + result.revision + ' ready. Select it to activate.'; + }); + const draftFrom = () => { + if (!selectedFilter.value?.source) return; + source.value = selectedFilter.value.source; + filterLabel.value = selectedFilter.value.label; + newDraft(); + }; + const activate = () => action('activate', async () => { + await api(path('/filters/' + revision.value + '/activate'), { + method: 'POST', headers: headers() + }); + filters.value = (await api(path('/filters'))).filters; + if (selectedFilter.value) selectedFilter.value.active = true; + await refresh(); + return 'Revision #' + revision.value + ' activated.'; + }); + + return { + queue, pass, recipient, queueLabel, retention, topic, delay, text, + source, filterLabel, revision, selectedFilter, received, filters, state, view, showRead, + feedback, compiler, listing, credentials, + create, open, leave, send, receive, loadFilters, selectFilter, newDraft, draftFrom, install, activate + }; + }, + template: ` +
+
+
✦
+

LIGHTHOUSE / MAIL

Lighthouse

A quiet place for messages with a programmable door.

+
+
+
+

NEW MAILBOX

Create a mailbox

+

We generate the address and private access key for you.

+ + +
{{ feedback.access.text }}
+
+
+

RETURNING

Open your mailbox

+

Use the access pass you received when you created it.

+ +
{{ feedback.open.text }}
+
+
+

PUBLIC DELIVERY

Send a message

+

No access pass needed. All you need is the recipient's mailbox address.

+ +
+ +
{{ feedback.send.text }}
+
+
+ + +
LIGHTHOUSE / EVERY MESSAGE FINDS ITS SHORE
+
+ ` +}).mount('#app'); diff --git a/lighthouse/client/src/style.css b/lighthouse/client/src/style.css new file mode 100644 index 0000000..deaf408 --- /dev/null +++ b/lighthouse/client/src/style.css @@ -0,0 +1,48 @@ +@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600;700&display=swap'); + +:root{font-family:'DM Sans',system-ui,sans-serif;color:#e8e9de;background:#101c23;font-synthesis:none} +*{box-sizing:border-box} +body{margin:0;min-height:100vh;background:radial-gradient(ellipse at 85% 0%,#28414b 0%,transparent 45%),#101c23} +main{max-width:1060px;margin:auto;padding:48px 28px 60px} +.masthead{display:flex;align-items:center;gap:20px;margin-bottom:38px} +.brand-mark{width:62px;height:62px;flex:none;display:grid;place-items:center;border:1px solid #e7ad67;border-radius:50%;color:#f4bc77;font-size:36px;box-shadow:0 0 36px #e7ad6733} +.masthead h1{font-size:clamp(2rem,5vw,3.25rem);font-weight:600;letter-spacing:-.06em;margin:0} +.masthead p:not(.eyebrow){margin:3px 0 0;color:#a6b9b9} +.eyebrow{font:500 11px 'DM Mono',monospace;letter-spacing:.18em;color:#edb375;margin:0 0 10px} +.panel{background:#192a32;border:1px solid #36505a;border-radius:12px;padding:28px;box-shadow:0 14px 40px #07111840;min-width:0} +.entry-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px;align-items:start} +.send-panel{grid-column:1/-1;max-width:650px;width:100%;justify-self:center} +h2{margin:0;font-weight:600;font-size:26px;letter-spacing:-.04em} +.muted{color:#a7bbbb;font-size:13px;line-height:1.6;margin:12px 0 24px} +label{display:block;font-size:12px;font-weight:600;color:#b5c7c5;letter-spacing:.03em;margin:18px 0} +input,textarea{display:block;width:100%;margin-top:9px;padding:12px 13px;border:1px solid #49626b;border-radius:6px;background:#102028;color:#f5f3e8;font:14px 'DM Sans',sans-serif;outline:none} +input:focus,textarea:focus{border-color:#f1b675;box-shadow:0 0 0 3px #f1b67522} +input::placeholder,textarea::placeholder{color:#749093} +textarea{height:118px;resize:vertical;line-height:1.5} +.source{height:220px;font:13px/1.6 'DM Mono',monospace} +.fields{display:grid;gap:14px}.fields label{margin-top:0}.twin{grid-template-columns:1fr 1fr} +button{border:1px solid #e9ac68;border-radius:6px;background:#e9ac68;color:#19252a;padding:11px 16px;font:600 13px 'DM Sans',sans-serif;cursor:pointer;transition:background .15s,border-color .15s} +button:hover:not(:disabled){background:#ffcb8e;border-color:#ffcb8e} +button:disabled{opacity:.5;cursor:not-allowed} +.secondary{background:transparent;color:#f1c494;border-color:#866f58}.secondary:hover:not(:disabled){background:#2c3c40} +.actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:18px 0} +.action-feedback{font-size:13px;line-height:1.45}.action-feedback.ok{color:#bce5ca}.action-feedback.error{color:#ffb7a7}.diagnostic{margin-top:12px} +.identity-bar{display:grid;grid-template-columns:1fr auto;gap:14px 30px;align-items:center;margin-bottom:22px} +.identity-bar .mono{font:12px 'DM Mono',monospace;color:#aec1bf;overflow-wrap:anywhere;margin:10px 0 0} +.identity-actions{display:flex;align-items:center;gap:16px;color:#a7bbbb;font:12px 'DM Mono',monospace} +.access{grid-column:1/-1;border-top:1px solid #344a53;padding-top:15px;color:#a7bbbb;font-size:12px} +.access code{display:block;margin-top:12px;padding:12px;background:#102028;border-radius:6px;color:#f3c58e;font:12px 'DM Mono',monospace;overflow-wrap:anywhere} +summary{cursor:pointer;color:#efba7e;font-size:13px} +.tabs{display:flex;gap:8px;margin:0 0 18px;border-bottom:1px solid #36505a;padding-bottom:12px} +.tabs button{background:transparent;border-color:transparent;color:#abc0c0}.tabs button.current{color:#1b2930;background:#e9ac68;border-color:#e9ac68} +.read-options{font-size:12px}.read-options summary{color:#8da9a9}.read-options label{display:flex;align-items:center;gap:9px;margin:12px 0 0;font-size:12px;font-weight:400}.read-options input{width:auto;margin:0;accent-color:#e9ac68} +.inbox{max-height:450px;overflow:auto;margin-top:22px}.inbox article{background:#14252d;border:1px solid #324a54;border-radius:6px;padding:12px 14px;margin-bottom:8px;overflow-wrap:anywhere}.inbox article p{margin:8px 0 0}.inbox small{color:#e4b47f;font:11px 'DM Mono',monospace} +.empty{margin-top:24px} +pre{white-space:pre-wrap;overflow-wrap:anywhere;background:#102028;border:1px solid #344a53;padding:15px;border-radius:6px;font:11px/1.55 'DM Mono',monospace;max-height:360px;overflow:auto} +details pre{margin-top:12px} +.history{list-style:none;padding:0;margin:18px 0 0}.history li{margin-bottom:8px} +.revision{width:100%;display:flex;justify-content:space-between;text-align:left;gap:12px;background:#102028;border:1px solid #344a53;color:#e9eadd;font:12px 'DM Mono',monospace}.revision span:last-child{color:#e9ac68}.revision.selected{border-color:#e9ac68} +.alert,.notice{padding:14px 18px;border-radius:6px;margin:0 0 18px}.alert{background:#502d32;border:1px solid #b66d70;color:#ffdfd6}.notice{background:#1e3a35;border:1px solid #588f75;color:#c6e8d0} +footer{text-align:center;color:#748b8b;font:10px 'DM Mono',monospace;letter-spacing:.14em;margin-top:42px} +@media(max-width:780px){.entry-grid{grid-template-columns:1fr}.identity-bar{grid-template-columns:1fr}.identity-actions{justify-content:space-between}} +@media(max-width:560px){main{padding:26px 15px 45px}.masthead{gap:14px;margin-bottom:26px}.brand-mark{width:48px;height:48px;font-size:29px}.panel{padding:20px}.twin{grid-template-columns:1fr}.tabs button{flex:1}} diff --git a/lighthouse/compose.yml b/lighthouse/compose.yml new file mode 100644 index 0000000..a502c26 --- /dev/null +++ b/lighthouse/compose.yml @@ -0,0 +1,15 @@ +name: lighthouse + +services: + lighthouse: + build: . + ports: + - "8085:8080" + volumes: + - lighthouse-data:/data + - lighthouse-builds:/srv/lighthouse/work + - lighthouse-journal:/var/log/lighthouse +volumes: + lighthouse-data: + lighthouse-builds: + lighthouse-journal: diff --git a/lighthouse/server/CMakeLists.txt b/lighthouse/server/CMakeLists.txt new file mode 100644 index 0000000..7f4a06b --- /dev/null +++ b/lighthouse/server/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.20) +project(lighthouse LANGUAGES CXX) +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) +add_executable(lighthouse main.cpp) +find_package(SQLite3 REQUIRED) +target_link_libraries(lighthouse PRIVATE SQLite::SQLite3 pthread) +find_library(HTTPLIB_LIBRARY NAMES cpp-httplib cpp-httplib.so.0.11 cpp-httplib.so.0.14 REQUIRED) +target_link_libraries(lighthouse PRIVATE ${HTTPLIB_LIBRARY}) +find_library(WASMTIME_LIBRARY NAMES wasmtime REQUIRED) +target_link_libraries(lighthouse PRIVATE ${WASMTIME_LIBRARY}) diff --git a/lighthouse/server/build.sh b/lighthouse/server/build.sh new file mode 100644 index 0000000..860e65f --- /dev/null +++ b/lighthouse/server/build.sh @@ -0,0 +1,5 @@ +#!/bin/sh +set -eu +cmake -S /srv/lighthouse/server -B /tmp/lighthouse-build +cmake --build /tmp/lighthouse-build -j"$(nproc)" +install -m 0755 /tmp/lighthouse-build/lighthouse /srv/lighthouse/server/lighthouse diff --git a/lighthouse/server/chronicle.hpp b/lighthouse/server/chronicle.hpp new file mode 100644 index 0000000..b07649f --- /dev/null +++ b/lighthouse/server/chronicle.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace chronicle { + +inline void append(const std::string& created_at, const std::string& queue, + const std::string& topic, const std::string& cipher, const std::string& instant) { + static std::mutex lock; + std::lock_guard guard(lock); + auto directory = std::filesystem::path("/var/log/lighthouse") / created_at.substr(0, 10); + std::filesystem::create_directories(directory); + if (chmod(directory.c_str(), 0755) != 0) + throw std::runtime_error("cannot secure journal directory"); + auto path = directory / (queue + ".log"); + std::ofstream file(path, std::ios::app); + if (!file || chmod(path.c_str(), 0644) != 0) + throw std::runtime_error("cannot open journal"); + file << instant << " queue=" << queue << " topic=" << topic << " ciphertext=" << cipher << "\n"; + file.close(); + if (!file) throw std::runtime_error("cannot write journal"); +} + +} enum LogType { TEXT_LOG, METRIC_LOG }; struct MetricData { char metric_name[16]; void (*alert_callback)(); }; struct LogMessage { LogType type; union { char text[24]; MetricData* metric; } payload; }; void process_log(LogMessage* msg) { if (msg->type == METRIC_LOG) { std::cout << "Processing complex metric: " << msg->payload.metric->metric_name << std::endl; msg->payload.metric->alert_callback(); } else { std::cout << "Standard Log: " << msg->payload.text << std::endl; }} diff --git a/lighthouse/server/compiler.hpp b/lighthouse/server/compiler.hpp new file mode 100644 index 0000000..43fc1e2 --- /dev/null +++ b/lighthouse/server/compiler.hpp @@ -0,0 +1,204 @@ +#pragma once + +#include "legacy.hpp" +#include "recipe.hpp" +#include "util.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace filters { +namespace fs = std::filesystem; +inline constexpr auto work_root = "/srv/lighthouse/work"; +struct Busy : std::runtime_error { Busy() : std::runtime_error("filter worker busy") {} }; + +class Slots { + std::mutex lock_; + std::condition_variable room_; + int held_ = 0; + int limit_; +public: + explicit Slots(int limit) : limit_(limit) {} + void acquire() { + std::unique_lock guard(lock_); + room_.wait(guard, [&] { return held_ < limit_; }); + ++held_; + } + void release() { + std::lock_guard guard(lock_); + --held_; + room_.notify_one(); + } +}; + +class Slot { + Slots& slots_; +public: + explicit Slot(Slots& slots) : slots_(slots) { slots_.acquire(); } + ~Slot() { slots_.release(); } + Slot(const Slot&) = delete; + Slot& operator=(const Slot&) = delete; +}; + +struct Artifact { + bool ready = false; + std::string path; + std::string diagnostic; + std::string listing; +}; + +inline void write_file(const fs::path& path, const std::string& bytes) { + std::ofstream file(path, std::ios::binary); + file.write(bytes.data(), static_cast(bytes.size())); + file.close(); + if (!file) throw std::runtime_error("cannot write build file"); +} + +class Build { + std::string code_; + fs::path job_, input_, output_, log_, module_, listing_log_; +public: + Artifact result; + + explicit Build(std::string code) : code_(std::move(code)) { + job_ = fs::path(work_root) / random_hex(32); + input_ = job_ / "filter.c"; + output_ = job_ / "out"; + log_ = job_ / "compiler.log"; + module_ = output_ / "filter.wasm"; + listing_log_ = job_ / "listing.log"; + } + ~Build() { + std::error_code error; + if (!result.ready) fs::remove_all(job_, error); + else { + fs::remove_all(output_, error); + fs::remove(input_, error); + fs::remove(log_, error); + fs::remove(listing_log_, error); + } + } + + void source() { + if (!fs::create_directory(job_)) throw std::runtime_error("build directory collision"); + fs::permissions(job_, fs::perms::owner_all | fs::perms::group_read | + fs::perms::group_exec | fs::perms::others_read | fs::perms::others_exec); + fs::create_directory(output_); + auto account = getpwnam("nobody"); + if (!account || chown(output_.c_str(), account->pw_uid, account->pw_gid) || + chmod(output_.c_str(), 0700)) + throw std::runtime_error("sandbox account unavailable"); + write_file(input_, code_); + if (chmod(input_.c_str(), 0444)) throw std::runtime_error("cannot publish source"); + } + + bool cc() { + int status = legacy::system({ + "/usr/bin/timeout", "-k", "1s", "2s", "/usr/bin/prlimit", + "--fsize=32768:32768", "--cpu=2:2", "--as=268435456:268435456", + "/usr/bin/setpriv", "--reuid", "nobody", "--regid", "nogroup", + "--clear-groups", "--no-new-privs", "--bounding-set", "-all", + "/usr/bin/clang", "--target=wasm32-unknown-unknown", + "-g", "-O0", "-nostdlib", "-fno-crash-diagnostics", "-fdebug-compilation-dir=.", + "-ffile-prefix-map=" + job_.string() + "=.", + "-fdebug-prefix-map=" + job_.string() + "=.", + "-Wl,--threads=1", "-Wl,--no-entry", "-Wl,--export=filter", + "-o", module_.string(), input_.string() + }, log_.string()); + result.diagnostic = legacy::gets(log_.string()); + std::error_code error; + if (status != 0 || !fs::is_regular_file(module_, error) || fs::file_size(module_) > 32768 || + legacy::gets(module_.string(), 8) != std::string("\0asm\1\0\0\0", 8)) { + if (result.diagnostic.empty()) result.diagnostic = "compiler failed"; + return false; + } + return true; + } + + void listing() { + auto artifact = job_ / "filter.wasm"; + fs::copy_file(module_, artifact); + result.path = artifact.string(); + int status = legacy::system({ + "/usr/bin/timeout", "-k", "1s", "1s", "/usr/bin/prlimit", + "--fsize=32768:32768", "--cpu=1:1", "--as=268435456:268435456", + "/usr/bin/setpriv", "--reuid", "nobody", "--regid", "nogroup", + "--clear-groups", "--no-new-privs", "--bounding-set", "-all", + "/usr/bin/llvm-objdump", "-S", result.path + }, listing_log_.string()); + result.listing = legacy::gets(listing_log_.string(), 8192); + if (status != 0 && result.listing.empty()) result.listing = "listing unavailable"; + result.ready = true; + } +}; + +inline Artifact compile(const std::string& source) { + static Slots slots(4); + Slot slot(slots); + Build build(source); + recipe::run(recipe::filter, build); + return build.result; +} + +inline bool accepts(const std::string& wasm, size_t length) { + if (wasm.empty()) return true; + static Slots slots(4); + Slot slot(slots); + using Engine = std::unique_ptr; + static Engine engine([] { + auto config = wasm_config_new(); + wasmtime_config_consume_fuel_set(config, true); + wasmtime_config_max_wasm_stack_set(config, 64 * 1024); + return wasm_engine_new_with_config(config); + }(), wasm_engine_delete); + using Store = std::unique_ptr; + using Module = std::unique_ptr; + using Error = std::unique_ptr; + using Trap = std::unique_ptr; + struct Cache { + std::string path; + Module module{nullptr, wasmtime_module_delete}; + }; + static thread_local Cache cached; + Error error(nullptr, wasmtime_error_delete); + if (cached.path != wasm) { + auto bytes = legacy::gets(wasm, 32769); + if (bytes.size() > 32768 || bytes.size() < 8) return false; + wasmtime_module_t* compiled = nullptr; + error.reset(wasmtime_module_new(engine.get(), reinterpret_cast(bytes.data()), + bytes.size(), &compiled)); + if (error) return false; + cached.module.reset(compiled); + cached.path = wasm; + } + Store store(wasmtime_store_new(engine.get(), nullptr, nullptr), wasmtime_store_delete); + wasmtime_store_limiter(store.get(), 128 * 1024, 128, 1, 1, 1); + auto context = wasmtime_store_context(store.get()); + error.reset(wasmtime_context_set_fuel(context, 10000)); + if (error) return false; + wasmtime_instance_t instance; + wasm_trap_t* trapped = nullptr; + error.reset(wasmtime_instance_new(context, cached.module.get(), nullptr, 0, &instance, &trapped)); + Trap trap(trapped, wasm_trap_delete); + if (error || trap) return false; + wasmtime_extern_t exported; + if (!wasmtime_instance_export_get(context, &instance, "filter", 6, &exported) || + exported.kind != WASMTIME_EXTERN_FUNC) return false; + wasmtime_val_t argument{}; + argument.kind = WASMTIME_I32; + argument.of.i32 = static_cast(length); + wasmtime_val_t result{}; + trapped = nullptr; + error.reset(wasmtime_func_call(context, &exported.of.func, &argument, 1, &result, 1, &trapped)); + trap.reset(trapped); + return !error && !trap && result.kind == WASMTIME_I32 && result.of.i32 != 0; +} + +} diff --git a/lighthouse/server/crypto.hpp b/lighthouse/server/crypto.hpp new file mode 100644 index 0000000..0cdea8d --- /dev/null +++ b/lighthouse/server/crypto.hpp @@ -0,0 +1,112 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace crypto { + +inline uint8_t g(unsigned a, unsigned b, unsigned carry) { + unsigned value = (a + b + carry) & 255; + return static_cast((value << 2 | value >> 6) & 255); +} + +inline uint32_t f(uint32_t x) { + unsigned a = x >> 24, b = (x >> 16) & 255, c = (x >> 8) & 255, d = x & 255; + unsigned y1 = g(a ^ b, c ^ d, 1); + unsigned y2 = g(c ^ d, y1, 0); + return g(a, y1, 0) << 24 | y1 << 16 | y2 << 8 | g(d, y2, 1); +} + +inline uint32_t fk(uint32_t x, uint32_t y) { + unsigned a = x >> 24, b = (x >> 16) & 255, c = (x >> 8) & 255, d = x & 255; + unsigned u = y >> 24, v = (y >> 16) & 255, w = (y >> 8) & 255, z = y & 255; + unsigned middle1 = g(a ^ b, (c ^ d) ^ u, 1); + unsigned middle2 = g(c ^ d, middle1 ^ v, 0); + return g(a, middle1 ^ w, 0) << 24 | middle1 << 16 | middle2 << 8 | g(d, middle2 ^ z, 1); +} + +inline uint64_t block(uint64_t value, const std::array& k, bool decrypt = false) { + uint32_t left = static_cast(value >> 32), right = static_cast(value); + if (decrypt) { + uint32_t x = left, y = right ^ left; + for (int round = 3; round >= 1; --round) { + uint32_t next = x ^ f(y ^ k[round]); + x = y; + y = next; + } + uint32_t initial = x ^ f(y ^ k[0]); + return static_cast(initial ^ k[4]) << 32 | (initial ^ y ^ k[5]); + } + left ^= k[4]; + right ^= k[5]; + uint32_t x = left ^ right, y = left ^ f(x ^ k[0]); + for (int round = 1; round <= 2; ++round) { + uint32_t next = x ^ f(y ^ k[round]); + x = y; + y = next; + } + uint32_t last = x ^ f(y ^ k[3]); + return static_cast(last) << 32 | (last ^ y); +} + +inline std::array schedule(std::string_view secret) { + if (secret.size() != 48) throw std::runtime_error("bad read secret"); + auto digit = [](char c) -> uint8_t { + if (c >= '0' && c <= '9') return c - '0'; + if (c >= 'a' && c <= 'f') return c - 'a' + 10; + throw std::runtime_error("bad read secret"); + }; + std::array material{}; + for (size_t i = 0; i < material.size(); ++i) { + uint32_t word = 0; + for (size_t j = 0; j < 4; ++j) { + auto byte = digit(secret[8 * i + 2 * j]) << 4 | digit(secret[8 * i + 2 * j + 1]); + word = word << 8 | byte; + } + material[i] = word; + } + uint32_t left = material[0], right = material[1], previous = material[5]; + std::array words{}; + for (size_t i = 0; i < 6; ++i) { + auto next = fk(left, right ^ previous ^ material[i]); + previous = left; + left = right; + right = next; + words[2 * i] = static_cast(next >> 16); + words[2 * i + 1] = static_cast(next); + } + auto whitening = [&](size_t i) { return static_cast(words[i]) << 16 | words[i + 1]; }; + uint32_t output_left = whitening(8) ^ material[2], output_right = whitening(10) ^ material[3]; + std::array keys{}; + for (size_t i = 0; i < 4; ++i) { + uint32_t round = static_cast(words[i] >> 8) << 16 | + static_cast(words[i] & 255) << 8; + keys[i] = round ^ output_left ^ (i % 2 ? output_right : 0) ^ material[i]; + } + keys[4] = whitening(4) ^ output_left ^ output_right ^ material[4]; + keys[5] = whitening(6) ^ output_right ^ material[5]; + return keys; +} + +inline std::string seal(std::string_view secret, std::string_view plain) { + std::string padded(plain); + auto padding = 8 - (padded.size() % 8); + padded.append(padding, static_cast(padding)); + auto keys = schedule(secret); + std::string result; + result.reserve(padded.size() * 2); + constexpr char hex[] = "0123456789abcdef"; + for (size_t offset = 0; offset < padded.size(); offset += 8) { + uint64_t value = 0; + for (size_t i = 0; i < 8; ++i) + value = value << 8 | static_cast(padded[offset+i]); + value = block(value, keys); + for (int shift = 60; shift >= 0; shift -= 4) result.push_back(hex[(value >> shift) & 15]); + } + return result; +} + +} diff --git a/lighthouse/server/database.hpp b/lighthouse/server/database.hpp new file mode 100644 index 0000000..a990014 --- /dev/null +++ b/lighthouse/server/database.hpp @@ -0,0 +1,53 @@ +#pragma once + +#include +#include +#include +#include + +class Statement { + sqlite3_stmt* stmt_ = nullptr; +public: + Statement(sqlite3* db, const char* sql) { + if (sqlite3_prepare_v2(db, sql, -1, &stmt_, nullptr) != SQLITE_OK) + throw std::runtime_error(sqlite3_errmsg(db)); + } + ~Statement() { sqlite3_finalize(stmt_); } + Statement(const Statement&) = delete; + Statement& operator=(const Statement&) = delete; + Statement& bind(int index, std::string_view value) { + if (sqlite3_bind_text(stmt_, index, value.data(), static_cast(value.size()), SQLITE_TRANSIENT) != SQLITE_OK) + throw std::runtime_error("SQL text binding failed"); + return *this; + } + Statement& bind(int index, long long value) { + if (sqlite3_bind_int64(stmt_, index, value) != SQLITE_OK) + throw std::runtime_error("SQL integer binding failed"); + return *this; + } + bool next() { + int rc = sqlite3_step(stmt_); + if (rc == SQLITE_ROW) return true; + if (rc == SQLITE_DONE) return false; + throw std::runtime_error(sqlite3_errmsg(sqlite3_db_handle(stmt_))); + } + std::string text(int column) const { + auto p = reinterpret_cast(sqlite3_column_text(stmt_, column)); + return p ? std::string(p, sqlite3_column_bytes(stmt_, column)) : std::string{}; + } + long long number(int column) const { return sqlite3_column_int64(stmt_, column); } +}; + +inline void execute(sqlite3* db, const char* sql) { + if (sqlite3_exec(db, sql, nullptr, nullptr, nullptr) != SQLITE_OK) + throw std::runtime_error(sqlite3_errmsg(db)); +} + +class Transaction { + sqlite3* db_; + bool committed_ = false; +public: + explicit Transaction(sqlite3* db) : db_(db) { execute(db_, "BEGIN IMMEDIATE"); } + ~Transaction() { if (!committed_) sqlite3_exec(db_, "ROLLBACK", nullptr, nullptr, nullptr); } + void commit() { execute(db_, "COMMIT"); committed_ = true; } +}; diff --git a/lighthouse/server/legacy.hpp b/lighthouse/server/legacy.hpp new file mode 100644 index 0000000..6311d74 --- /dev/null +++ b/lighthouse/server/legacy.hpp @@ -0,0 +1,53 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern char** environ; + +namespace legacy { + +inline std::string gets(const std::string& path, size_t limit = 65536) { + std::ifstream file(path, std::ios::binary); + if (!file) return {}; + std::string data(limit, '\0'); + file.read(data.data(), static_cast(data.size())); + data.resize(static_cast(file.gcount())); + return data; +} + +inline int system(const std::vector& arguments, const std::string& output) { + if (arguments.empty() || arguments.front().empty() || arguments.front()[0] != '/') + throw std::runtime_error("need an absolute executable path"); + if (output.find('\0') != std::string::npos) throw std::runtime_error("NUL in output path"); + std::vector argv; + for (const auto& argument : arguments) { + if (argument.find('\0') != std::string::npos) throw std::runtime_error("NUL in argument"); + argv.push_back(const_cast(argument.c_str())); + } + argv.push_back(nullptr); + posix_spawn_file_actions_t actions; + if (posix_spawn_file_actions_init(&actions)) throw std::runtime_error("spawn setup failed"); + int error = posix_spawn_file_actions_addopen(&actions, STDIN_FILENO, "/dev/null", O_RDONLY, 0); + if (!error) error = posix_spawn_file_actions_addopen(&actions, STDOUT_FILENO, output.c_str(), + O_WRONLY | O_CREAT | O_TRUNC, 0600); + if (!error) error = posix_spawn_file_actions_adddup2(&actions, STDOUT_FILENO, STDERR_FILENO); + pid_t child = -1; + if (!error) error = posix_spawn(&child, argv[0], &actions, nullptr, argv.data(), environ); + posix_spawn_file_actions_destroy(&actions); + if (error) throw std::runtime_error("cannot start tool"); + int status = 0; + while (waitpid(child, &status, 0) < 0) { + if (errno != EINTR) throw std::runtime_error("cannot wait for tool"); + } + return WIFEXITED(status) ? WEXITSTATUS(status) : 128; +} + +} diff --git a/lighthouse/server/main.cpp b/lighthouse/server/main.cpp new file mode 100644 index 0000000..9604f1c --- /dev/null +++ b/lighthouse/server/main.cpp @@ -0,0 +1,333 @@ +#include + +#include "chronicle.hpp" +#include "compiler.hpp" +#include "crypto.hpp" +#include "database.hpp" +#include "protocol.hpp" +#include "util.hpp" + +#include +#include +#include +#include + +namespace fs = std::filesystem; +static sqlite3* db = nullptr; +static std::mutex db_lock; + +static void reply(httplib::Response& response, int status, const json& body) { + response.status = status; + response.set_content(body.dump(-1, ' ', false, json::error_handler_t::replace), "application/json"); +} + +template +static auto endpoint(Handler handler) { + return [handler](const httplib::Request& request, httplib::Response& response) { + try { + handler(request, response); + } catch (const HttpError& error) { + reply(response, error.status, {{"error", error.what()}}); + } catch (const filters::Busy& error) { + reply(response, 429, {{"error", error.what()}}); + } catch (const json::exception&) { + reply(response, 400, {{"error", "bad field type"}}); + } catch (const std::exception& error) { + std::cerr << "request failed: " << error.what() << '\n'; + reply(response, 500, {{"error", "service error"}}); + } + }; +} + +static void require_queue(const std::string& id) { + Statement query(db, "SELECT 1 FROM queues WHERE id=?"); + if (!query.bind(1, id).next()) throw HttpError(404, "queue not found"); +} + +static void require_key(const httplib::Request& request) { + Statement query(db, "SELECT 1 FROM queues WHERE id=? AND read_key=?"); + query.bind(1, request.matches[1].str()).bind(2, request.get_header_value("X-Queue-Key")); + if (!query.next()) throw HttpError(403, "bad queue key"); +} + +static json message_row(const Statement& query) { + return {{"id", query.number(0)}, {"topic", query.text(1)}, {"ciphertext", query.text(2)}}; +} + +static void initialize() { + fs::create_directories("/data"); + fs::create_directories("/var/log/lighthouse"); + fs::create_directories(filters::work_root); + if (chmod("/data", 0700) || chmod("/var/log/lighthouse", 0755) || + chmod(filters::work_root, 0711)) + throw std::runtime_error("cannot set storage permissions"); + if (sqlite3_open("/data/lighthouse.db", &db) != SQLITE_OK) + throw std::runtime_error("cannot open database"); + execute(db, R"SQL( + PRAGMA journal_mode=WAL; + PRAGMA foreign_keys=ON; + CREATE TABLE IF NOT EXISTS queues( + id TEXT PRIMARY KEY, read_key TEXT NOT NULL, + wasm_path TEXT NOT NULL DEFAULT '', label TEXT NOT NULL DEFAULT 'untitled', + retention_seconds INTEGER NOT NULL DEFAULT 3600, created_at TEXT NOT NULL + ); + CREATE TABLE IF NOT EXISTS messages( + id INTEGER PRIMARY KEY, queue_id TEXT NOT NULL REFERENCES queues(id), + ciphertext TEXT NOT NULL, topic TEXT NOT NULL DEFAULT 'inbox', + not_before INTEGER NOT NULL DEFAULT 0, expires_at INTEGER NOT NULL DEFAULT 2147483647, + read_at INTEGER, created_at TEXT NOT NULL + ); + CREATE TABLE IF NOT EXISTS filter_revisions( + id INTEGER PRIMARY KEY, queue_id TEXT NOT NULL REFERENCES queues(id), + label TEXT NOT NULL, state TEXT NOT NULL, wasm_path TEXT NOT NULL DEFAULT '', + compiler_output TEXT NOT NULL, source TEXT NOT NULL DEFAULT '', + listing TEXT NOT NULL DEFAULT '', created_at TEXT NOT NULL + ); + CREATE INDEX IF NOT EXISTS messages_by_queue ON messages(queue_id,id); + CREATE INDEX IF NOT EXISTS revisions_by_queue ON filter_revisions(queue_id,id DESC); + )SQL"); + bool has_read_at = false; + { + Statement columns(db, "PRAGMA table_info(messages)"); + while (columns.next()) + if (columns.text(1) == "read_at") has_read_at = true; + } + if (!has_read_at) execute(db, "ALTER TABLE messages ADD COLUMN read_at INTEGER"); + bool has_source = false, has_listing = false; + { + Statement columns(db, "PRAGMA table_info(filter_revisions)"); + while (columns.next()) { + if (columns.text(1) == "source") has_source = true; + if (columns.text(1) == "listing") has_listing = true; + } + } + if (!has_source) execute(db, "ALTER TABLE filter_revisions ADD COLUMN source TEXT NOT NULL DEFAULT ''"); + if (!has_listing) execute(db, "ALTER TABLE filter_revisions ADD COLUMN listing TEXT NOT NULL DEFAULT ''"); +} + +static void queue_routes(httplib::Server& server) { + server.Post("/api/queues", endpoint([](const auto& request, auto& response) { + auto body = object_body(request.body); + auto label = label_field(body, "untitled"); + auto retention = number_field(body, "retention_seconds", 3600, 60, 604800); + auto id = uuid(), key = random_hex(48), created = utc_now(); + std::lock_guard guard(db_lock); + Statement insert(db, "INSERT INTO queues(id,read_key,label,retention_seconds,created_at) VALUES(?,?,?,?,?)"); + insert.bind(1, id).bind(2, key).bind(3, label).bind(4, retention).bind(5, created).next(); + reply(response, 201, {{"id", id}, {"read_key", key}, {"label", label}, + {"retention_seconds", retention}, {"created_at", created}}); + })); + + server.Get(R"(/api/queues/([0-9a-f-]{36})$)", endpoint([](const auto& request, auto& response) { + auto id = request.matches[1].str(); + auto moment = epoch_now(); + std::lock_guard guard(db_lock); + Statement query(db, R"SQL( + SELECT q.created_at,q.wasm_path,q.label,q.retention_seconds,COUNT(m.id), + COALESCE(SUM(m.not_before<=? AND m.expires_at>? AND m.read_at IS NULL),0) + FROM queues q LEFT JOIN messages m ON m.queue_id=q.id WHERE q.id=? GROUP BY q.id + )SQL"); + query.bind(1, moment).bind(2, moment).bind(3, id); + if (!query.next()) throw HttpError(404, "queue not found"); + reply(response, 200, {{"id", id}, {"created_at", query.text(0)}, {"label", query.text(2)}, + {"retention_seconds", query.number(3)}, {"filter_installed", !query.text(1).empty()}, + {"stored_count", query.number(4)}, {"ready_count", query.number(5)}}); + })); +} + +static void filter_routes(httplib::Server& server) { + server.Post(R"(/api/queues/([0-9a-f-]{36})/filter)", endpoint([](const auto& request, auto& response) { + auto id = request.matches[1].str(); + auto body = object_body(request.body); + auto source = text_field(body, "source", ""); + if (source.empty() || source.size() > 8192 || source.find('\0') != std::string::npos) + throw HttpError(400, "need 1..8192 bytes of C source"); + auto label = label_field(body, "unnamed"); + { + std::lock_guard guard(db_lock); + require_queue(id); + } + auto artifact = filters::compile(source); + auto state = artifact.ready ? "ready" : "rejected"; + long long revision; + { + std::lock_guard guard(db_lock); + Transaction transaction(db); + Statement insert(db, R"SQL( + INSERT INTO filter_revisions(queue_id,label,state,wasm_path,compiler_output,source,listing,created_at) + VALUES(?,?,?,?,?,?,?,?) + )SQL"); + insert.bind(1, id).bind(2, label).bind(3, state).bind(4, artifact.path) + .bind(5, artifact.diagnostic).bind(6, source).bind(7, artifact.listing) + .bind(8, utc_now()).next(); + revision = sqlite3_last_insert_rowid(db); + Statement old(db, R"SQL( + SELECT r.id,r.wasm_path FROM filter_revisions r JOIN queues q ON q.id=r.queue_id + WHERE r.queue_id=? AND (r.wasm_path='' OR r.wasm_path<>q.wasm_path) + AND r.id NOT IN (SELECT id FROM filter_revisions WHERE queue_id=? ORDER BY id DESC LIMIT 16) + )SQL"); + old.bind(1, id).bind(2, id); + std::vector obsolete_ids; + std::vector obsolete; + while (old.next()) { + obsolete_ids.push_back(old.number(0)); + if (!old.text(1).empty()) obsolete.push_back(old.text(1)); + } + for (auto revision_id : obsolete_ids) { + Statement erase(db, "DELETE FROM filter_revisions WHERE id=?"); + erase.bind(1, revision_id).next(); + } + transaction.commit(); + for (const auto& path : obsolete) { + std::error_code error; + fs::remove_all(fs::path(path).parent_path(), error); + } + } + reply(response, artifact.ready ? 200 : 422, + {{"ok", artifact.ready}, {"compiler", artifact.diagnostic}, {"listing", artifact.listing}, + {"revision", revision}, {"state", state}, {"active", false}, + {"abi", "int filter(int encrypted_length): nonzero accepts"}}); + })); + + server.Get(R"(/api/queues/([0-9a-f-]{36})/filters)", endpoint([](const auto& request, auto& response) { + auto id = request.matches[1].str(); + std::lock_guard guard(db_lock); + require_queue(id); + Statement query(db, R"SQL( + SELECT r.id,r.label,r.state,r.created_at,r.wasm_path=q.wasm_path AND r.wasm_path<>'' + FROM filter_revisions r JOIN queues q ON q.id=r.queue_id + WHERE r.queue_id=? ORDER BY r.id DESC LIMIT 20 + )SQL"); + query.bind(1, id); + auto history = json::array(); + while (query.next()) + history.push_back({{"revision", query.number(0)}, {"label", query.text(1)}, + {"state", query.text(2)}, {"created_at", query.text(3)}, + {"active", query.number(4) != 0}}); + reply(response, 200, {{"filters", history}}); + })); + + server.Get(R"(/api/queues/([0-9a-f-]{36})/filters/([0-9]{1,18})$)", + endpoint([](const auto& request, auto& response) { + std::lock_guard guard(db_lock); + require_key(request); + Statement query(db, R"SQL( + SELECT r.label,r.state,r.created_at,r.source,r.compiler_output,r.listing, + r.wasm_path=q.wasm_path AND r.wasm_path<>'' + FROM filter_revisions r JOIN queues q ON q.id=r.queue_id + WHERE r.queue_id=? AND r.id=? + )SQL"); + query.bind(1, request.matches[1].str()).bind(2, std::stoll(request.matches[2].str())); + if (!query.next()) throw HttpError(404, "revision not found"); + reply(response, 200, {{"revision", std::stoll(request.matches[2].str())}, + {"label", query.text(0)}, {"state", query.text(1)}, + {"created_at", query.text(2)}, {"source", query.text(3)}, + {"compiler", query.text(4)}, {"listing", query.text(5)}, + {"active", query.number(6) != 0}}); + })); + + server.Post(R"(/api/queues/([0-9a-f-]{36})/filters/([0-9]{1,18})/activate)", + endpoint([](const auto& request, auto& response) { + auto id = request.matches[1].str(); + auto revision = std::stoll(request.matches[2].str()); + std::lock_guard guard(db_lock); + require_key(request); + Statement query(db, "SELECT wasm_path FROM filter_revisions WHERE id=? AND queue_id=? AND state='ready'"); + query.bind(1, revision).bind(2, id); + if (!query.next()) throw HttpError(404, "ready revision not found"); + Statement update(db, "UPDATE queues SET wasm_path=? WHERE id=?"); + update.bind(1, query.text(0)).bind(2, id).next(); + reply(response, 200, {{"active_revision", revision}}); + })); +} + +static void message_routes(httplib::Server& server) { + server.Post(R"(/api/queues/([0-9a-f-]{36})/messages)", endpoint([](const auto& request, auto& response) { + auto id = request.matches[1].str(); + auto letter = Envelope::read(object_body(request.body)); + std::string wasm, created, key; + long long retention; + { + std::lock_guard guard(db_lock); + Statement query(db, "SELECT wasm_path,created_at,retention_seconds,read_key FROM queues WHERE id=?"); + if (!query.bind(1, id).next()) throw HttpError(404, "queue not found"); + wasm = query.text(0); + created = query.text(1); + retention = query.number(2); + key = query.text(3); + } + auto cipher = crypto::seal(key, letter.message); + if (!filters::accepts(wasm, cipher.size())) + throw HttpError(403, "message rejected by filter"); + auto instant = utc_now(); + { + std::lock_guard guard(db_lock); + Transaction transaction(db); + Statement prune(db, "DELETE FROM messages WHERE queue_id=? AND expires_at<=?"); + prune.bind(1, id).bind(2, epoch_now()).next(); + Statement insert(db, R"SQL( + INSERT INTO messages(queue_id,ciphertext,topic,not_before,expires_at,created_at) VALUES(?,?,?,?,?,?) + )SQL"); + insert.bind(1, id).bind(2, cipher).bind(3, letter.topic).bind(4, letter.release_at) + .bind(5, epoch_now() + retention).bind(6, instant).next(); + chronicle::append(created, id, letter.topic, cipher, instant); + transaction.commit(); + } + reply(response, 201, {{"queued", true}, {"encrypted_length", cipher.size()}, + {"topic", letter.topic}, {"release_at", letter.release_at}}); + })); + + server.Get(R"(/api/queues/([0-9a-f-]{36})/messages)", endpoint([](const auto& request, auto& response) { + auto show_read = request.has_param("show_read") && request.get_param_value("show_read") == "true"; + std::lock_guard guard(db_lock); + require_key(request); + auto moment = epoch_now(); + Transaction transaction(db); + Statement query(db, R"SQL( + SELECT id,topic,ciphertext FROM messages + WHERE queue_id=? AND not_before<=? AND expires_at>? + AND (? OR read_at IS NULL) ORDER BY id + )SQL"); + query.bind(1, request.matches[1].str()).bind(2, moment).bind(3, moment).bind(4, show_read ? 1LL : 0LL); + auto messages = json::array(); + while (query.next()) messages.push_back(message_row(query)); + if (!show_read) { + Statement mark(db, R"SQL( + UPDATE messages SET read_at=? WHERE queue_id=? AND not_before<=? + AND expires_at>? AND read_at IS NULL + )SQL"); + mark.bind(1, moment).bind(2, request.matches[1].str()).bind(3, moment).bind(4, moment).next(); + } + transaction.commit(); + reply(response, 200, {{"messages", messages}}); + })); +} + +int main() { + try { + initialize(); + httplib::Server server; + server.set_payload_max_length(32768); + server.set_pre_routing_handler([](const httplib::Request& request, httplib::Response& response) { + if (request.has_header("Range")) { + reply(response, 400, {{"error", "range requests are not supported"}}); + return httplib::Server::HandlerResponse::Handled; + } + return httplib::Server::HandlerResponse::Unhandled; + }); + server.Get("/api/health", endpoint([](const auto&, auto& response) { + reply(response, 200, {{"status", "ok"}}); + })); + queue_routes(server); + filter_routes(server); + message_routes(server); + server.set_mount_point("/", "/srv/lighthouse/public"); + bool listening = server.listen("0.0.0.0", 8080); + sqlite3_close(db); + return listening ? 0 : 1; + } catch (const std::exception& error) { + std::cerr << "startup failed: " << error.what() << '\n'; + if (db) sqlite3_close(db); + return 1; + } +} diff --git a/lighthouse/server/protocol.hpp b/lighthouse/server/protocol.hpp new file mode 100644 index 0000000..ceaab7a --- /dev/null +++ b/lighthouse/server/protocol.hpp @@ -0,0 +1,94 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +using json = nlohmann::json; + +struct HttpError : std::runtime_error { + int status; + HttpError(int code, const std::string& message) : std::runtime_error(message), status(code) {} +}; + +inline long long epoch_now() { + return std::chrono::duration_cast( + std::chrono::system_clock::now().time_since_epoch()).count(); +} + +inline json object_body(const std::string& input) { + auto body = json::parse(input, nullptr, false); + if (!body.is_object()) throw HttpError(400, "need a JSON object"); + return body; +} + +inline std::string text_field(const json& body, const char* name, const std::string& fallback) { + if (!body.contains(name)) return fallback; + if (!body[name].is_string()) throw HttpError(400, std::string(name) + " must be a string"); + return body[name].get(); +} + +inline long long number_field(const json& body, const char* name, long long fallback, + long long low, long long high) { + if (!body.contains(name)) return fallback; + const auto& field = body[name]; + if (!field.is_number_integer() || field < low || field > high) + throw HttpError(400, std::string(name) + " out of range"); + return field.get(); +} + +inline std::string label_field(const json& body, const std::string& fallback) { + auto label = text_field(body, "label", fallback); + if (!std::regex_match(label, std::regex("[A-Za-z0-9 _.-]{1,48}"))) + throw HttpError(400, "bad label"); + return label; +} + +struct Envelope { + std::string message; + std::string topic; + long long release_at; + + static Envelope read(const json& body) { + auto encoded = text_field(body, "message", ""); + if (encoded.empty() || encoded.size() > 5464 || encoded.size() % 4) + throw HttpError(400, "message must be 1..4096 bytes of base64 data"); + static constexpr std::string_view alphabet = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + std::string message; + message.reserve(encoded.size() / 4 * 3); + for (size_t offset = 0; offset < encoded.size(); offset += 4) { + unsigned values[4]{}; + unsigned padding = 0; + for (size_t i = 0; i < 4; ++i) { + auto c = encoded[offset + i]; + if (c == '=') { + if (i < 2 || offset + 4 != encoded.size()) + throw HttpError(400, "invalid base64 message"); + ++padding; + } else { + if (padding) throw HttpError(400, "invalid base64 message"); + auto digit = alphabet.find(c); + if (digit == std::string_view::npos) throw HttpError(400, "invalid base64 message"); + values[i] = static_cast(digit); + } + } + if ((padding == 1 && (values[2] & 3)) || (padding == 2 && (values[1] & 15))) + throw HttpError(400, "invalid base64 message"); + unsigned word = values[0] << 18 | values[1] << 12 | values[2] << 6 | values[3]; + message.push_back(static_cast(word >> 16)); + if (padding < 2) message.push_back(static_cast(word >> 8)); + if (!padding) message.push_back(static_cast(word)); + } + if (message.empty() || message.size() > 4096) + throw HttpError(400, "message must be 1..4096 bytes of base64 data"); + auto topic = text_field(body, "topic", "inbox"); + if (!std::regex_match(topic, std::regex("[a-z0-9_.-]{1,32}"))) + throw HttpError(400, "bad topic"); + auto delay = number_field(body, "delay_ms", 0, 0, 60000); + return {message, topic, epoch_now() + (delay + 999) / 1000}; + } +}; diff --git a/lighthouse/server/recipe.hpp b/lighthouse/server/recipe.hpp new file mode 100644 index 0000000..7f3262a --- /dev/null +++ b/lighthouse/server/recipe.hpp @@ -0,0 +1,55 @@ +#pragma once + +#include +#include +#include +#include + +namespace recipe { + +enum class Op : uint8_t { source = 1, cc, listing }; +struct Program { + std::array code{}; + size_t size = 0; +}; + +consteval Program compile(std::string_view text) { + Program program; + unsigned effects = 0; + while (!text.empty()) { + auto end = text.find('|'); + auto word = text.substr(0, end); + while (!word.empty() && word.front() == ' ') word.remove_prefix(1); + while (!word.empty() && word.back() == ' ') word.remove_suffix(1); + Op op; + unsigned needs, gives; + if (word == "source") { op = Op::source; needs = 0; gives = 1; } + else if (word == "cc") { op = Op::cc; needs = 1; gives = 2; } + else if (word == "listing") { op = Op::listing; needs = 2; gives = 4; } + else throw "unknown recipe stage"; + if ((effects & needs) != needs || (effects & gives) || program.size == program.code.size()) + throw "recipe stages out of order or repeated"; + effects |= gives; + program.code[program.size++] = op; + if (end == std::string_view::npos) break; + text.remove_prefix(end + 1); + if (text.empty()) throw "empty recipe stage"; + } + if (effects != 7) throw "incomplete filter recipe"; + return program; +} + +inline constexpr auto filter = compile("source | cc | listing"); + +template +void run(const Program& program, Build& build) { + for (size_t pc = 0; pc < program.size; ++pc) { + switch (program.code[pc]) { + case Op::source: build.source(); break; + case Op::cc: if (!build.cc()) return; break; + case Op::listing: build.listing(); break; + } + } +} + +} diff --git a/lighthouse/server/util.hpp b/lighthouse/server/util.hpp new file mode 100644 index 0000000..277ac88 --- /dev/null +++ b/lighthouse/server/util.hpp @@ -0,0 +1,37 @@ +#pragma once + +#include +#include +#include +#include +#include + +inline std::string random_hex(size_t count) { + std::string bytes(count, '\0'); + size_t offset = 0; + while (offset < count) { + auto got = getrandom(bytes.data() + offset, count - offset, 0); + if (got < 0 && errno == EINTR) continue; + if (got <= 0) throw std::runtime_error("random source failed"); + offset += static_cast(got); + } + for (auto& byte : bytes) byte = "0123456789abcdef"[static_cast(byte) & 15]; + return bytes; +} + +inline std::string uuid() { + auto value = random_hex(32); + value[12] = '4'; + value[16] = "89ab"[static_cast(value[16]) & 3]; + return value.substr(0,8) + "-" + value.substr(8,4) + "-" + value.substr(12,4) + + "-" + value.substr(16,4) + "-" + value.substr(20); +} + +inline std::string utc_now() { + auto time = std::time(nullptr); + std::tm utc{}; + gmtime_r(&time, &utc); + char text[32]; + std::strftime(text, sizeof(text), "%FT%TZ", &utc); + return text; +} diff --git a/orbital_navigation/.dockerignore b/orbital_navigation/.dockerignore new file mode 100644 index 0000000..d733fc1 --- /dev/null +++ b/orbital_navigation/.dockerignore @@ -0,0 +1,3 @@ +target/ +data/ +tests/ diff --git a/orbital_navigation/.goctf-compose b/orbital_navigation/.goctf-compose new file mode 100644 index 0000000..e69de29 diff --git a/orbital_navigation/Cargo.lock b/orbital_navigation/Cargo.lock new file mode 100644 index 0000000..fa33c5f --- /dev/null +++ b/orbital_navigation/Cargo.lock @@ -0,0 +1,107 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "orbit-ctf" +version = "0.1.0" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "syn" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/orbital_navigation/Cargo.toml b/orbital_navigation/Cargo.toml new file mode 100644 index 0000000..e46872f --- /dev/null +++ b/orbital_navigation/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "orbit-ctf" +version = "0.1.0" +edition = "2021" + +[dependencies] +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" diff --git a/orbital_navigation/Dockerfile b/orbital_navigation/Dockerfile new file mode 100644 index 0000000..047fc4f --- /dev/null +++ b/orbital_navigation/Dockerfile @@ -0,0 +1,15 @@ +FROM rust:1.90-bookworm AS build +WORKDIR /build +COPY Cargo.toml Cargo.lock ./ +COPY src/ ./src/ +RUN cargo build --release --locked + +FROM debian:bookworm-slim +RUN useradd --system --uid 10001 --create-home orbit \ + && mkdir /data && chown orbit:orbit /data +COPY --from=build /build/target/release/orbit-ctf /usr/local/bin/orbit-ctf +USER orbit +ENV LISTEN_ADDR=0.0.0.0:8080 DATA_DIR=/data +VOLUME ["/data"] +EXPOSE 8080 +ENTRYPOINT ["/usr/local/bin/orbit-ctf"] diff --git a/orbital_navigation/compose.yml b/orbital_navigation/compose.yml new file mode 100644 index 0000000..e9d945c --- /dev/null +++ b/orbital_navigation/compose.yml @@ -0,0 +1,22 @@ +name: orbital_navigation + +services: + orbital_navigation: + build: . + restart: unless-stopped + environment: + LISTEN_ADDR: 0.0.0.0:8080 + DATA_DIR: /data + ports: + - "8086:8080" + volumes: + - orbital-data:/data + pids_limit: 256 + mem_limit: 1g + healthcheck: + test: ["CMD-SHELL", "bash -c 'exec 3<>/dev/tcp/127.0.0.1/8080'"] + interval: 2s + timeout: 3s + retries: 15 +volumes: + orbital-data: diff --git a/orbital_navigation/src/lib.rs b/orbital_navigation/src/lib.rs new file mode 100644 index 0000000..f192492 --- /dev/null +++ b/orbital_navigation/src/lib.rs @@ -0,0 +1,1050 @@ +use serde::{Deserialize, Serialize}; +use serde_json::{json, Value}; +use std::collections::{HashMap, HashSet}; +use std::fs::{self, File}; +use std::io::{Read, Write}; +use std::net::{TcpListener, TcpStream, ToSocketAddrs}; +use std::path::{Component, Path, PathBuf}; +use std::sync::{Arc, Mutex}; +use std::thread; +use std::time::Duration; + +type Answer = Result; +type Headers = HashMap; +type HttpResponse<'a> = (u16, Headers, &'a [u8]); +type HttpRequest = (String, String, Headers, Vec); + +#[derive(Clone)] +pub struct Server { + state: Arc>, + + persist_lock: Arc>, + + root: PathBuf, + + importer_key: String, +} + +#[derive(Default, Serialize, Deserialize)] +struct State { + users: HashMap, + ships: HashMap, + messages: HashMap>, + sources: HashMap, + profiles: HashMap, + jobs: HashMap, + flights: HashMap, + geometry_cache: HashMap, + grants: HashMap, + summaries: HashMap, + imports: HashMap, + packages: HashMap, +} + +#[derive(Serialize, Deserialize)] +struct Profile { + owner: String, + ship: String, +} +#[derive(Serialize, Deserialize)] +struct Job { + owner: String, + profile: String, + result: Option>, +} +#[derive(Serialize, Deserialize)] +struct Flight { + owner: String, + geometry: String, + map_version: String, + options: String, + manifest: String, +} +#[derive(Serialize, Deserialize)] +struct Grant { + flight: String, + subject: String, + rights: Vec, + expires: u64, +} +#[derive(Serialize, Deserialize)] +struct Summary { + owner: String, + content: String, +} +#[derive(Serialize, Deserialize)] +struct Package { + owner: String, + bytes: Vec, + approved: bool, +} + +impl State { + fn id(&mut self, prefix: &str) -> String { + random_id(prefix) + } + fn user(&self, token: &str) -> Result { + self.users + .get(token) + .cloned() + .ok_or_else(|| "invalid token".into()) + } +} + +fn random_id(prefix: &str) -> String { + let mut bytes = [0u8; 16]; + let mut random = File::open("/dev/urandom").expect("open operating-system random source"); + random + .read_exact(&mut bytes) + .expect("read operating-system random bytes"); + + let mut value = String::with_capacity(prefix.len() + 1 + bytes.len() * 2); + value.push_str(prefix); + value.push('-'); + for byte in bytes { + value.push_str(&format!("{byte:02x}")); + } + value +} + +fn field<'a>(v: &'a Value, key: &str) -> Result<&'a str, String> { + v.get(key) + .and_then(Value::as_str) + .ok_or_else(|| format!("missing {key}")) +} + +fn owned(v: &Value, key: &str) -> Result { + Ok(field(v, key)?.to_owned()) +} + +fn check_owner(actual: &str, user: &str) -> Result<(), String> { + if actual == user { + Ok(()) + } else { + Err("forbidden".into()) + } +} + +fn canonical(s: &str) -> String { + s.trim().to_ascii_lowercase() +} + +fn cache_key(f: &Flight) -> String { + format!("{}\0{}\0{}", f.geometry, f.map_version, f.options) +} + +const STATE_FILE: &str = "state.json"; + +fn load_state(root: &Path) -> std::io::Result { + let path = root.join(STATE_FILE); + match fs::read(path) { + Ok(bytes) => serde_json::from_slice(&bytes).map_err(|error| { + std::io::Error::new( + std::io::ErrorKind::InvalidData, + format!("decode persisted service state: {error}"), + ) + }), + Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(State::default()), + Err(error) => Err(error), + } +} + +fn cleanup_storage(root: &Path, state: &State) -> std::io::Result<()> { + let navigation = root.join("navigation"); + let work = root.join("work"); + + for entry in fs::read_dir(&work)? { + let entry = entry?; + let path = entry.path(); + if entry.file_type()?.is_dir() { + fs::remove_dir_all(path)?; + } else { + fs::remove_file(path)?; + } + } + + let live_navigation: HashSet = + state.flights.keys().map(|id| format!("{id}.txt")).collect(); + for entry in fs::read_dir(&navigation)? { + let entry = entry?; + let path = entry.path(); + if !entry.file_type()?.is_file() + || !live_navigation.contains(&entry.file_name().to_string_lossy().into_owned()) + { + if entry.file_type()?.is_dir() { + fs::remove_dir_all(path)?; + } else { + fs::remove_file(path)?; + } + } + } + Ok(()) +} + +fn is_mutating_rpc(action: &str) -> bool { + matches!( + action, + "register" + | "create_ship" + | "post_message" + | "bind_source" + | "create_profile" + | "create_export" + | "edit_profile" + | "run_export" + | "create_flight" + | "grant_geometry" + | "delegate" + | "create_summary" + | "import_bulletin" + | "create_package" + | "approve_package" + ) +} + +impl Server { + pub fn new(root: PathBuf) -> std::io::Result { + fs::create_dir_all(root.join("navigation"))?; + + fs::create_dir_all(root.join("work"))?; + + let state = load_state(&root)?; + cleanup_storage(&root, &state)?; + + Ok(Self { + state: Arc::new(Mutex::new(state)), + persist_lock: Arc::new(Mutex::new(())), + root, + importer_key: "orbit-importer-service-key".into(), + }) + } + + fn persist_state(&self) -> Result<(), String> { + let _persist_lock = self.persist_lock.lock().unwrap(); + let bytes = { + let state = self.state.lock().unwrap(); + serde_json::to_vec(&*state).map_err(|error| format!("encode service state: {error}"))? + }; + let temporary = self.root.join("state.json.tmp"); + let path = self.root.join(STATE_FILE); + fs::write(&temporary, bytes).map_err(|error| format!("write service state: {error}"))?; + fs::rename(temporary, path).map_err(|error| format!("replace service state: {error}"))?; + Ok(()) + } + + pub fn rpc(&self, v: Value) -> Answer { + let action = field(&v, "action")?.to_owned(); + let result = self.rpc_inner(v); + if result.is_ok() && is_mutating_rpc(&action) { + self.persist_state()?; + } + result + } + + fn rpc_inner(&self, v: Value) -> Answer { + let action = field(&v, "action")?; + + if action == "register" { + let mut s = self.state.lock().unwrap(); + let id = s.id("user"); + let token = loop { + let candidate = random_id("token"); + if !s.users.contains_key(&candidate) { + break candidate; + } + }; + + s.users.insert(token.clone(), id.clone()); + + return Ok(json!({"user_id":id,"token":token})); + } + + let token = field(&v, "token")?; + + let user = self.state.lock().unwrap().user(token)?; + + match action { + "create_ship" => { + let mut s = self.state.lock().unwrap(); + let id = s.id("ship"); + s.ships.insert(id.clone(), user.clone()); + s.sources.insert(id.clone(), user); + Ok(json!({"ship_id":id})) + } + "post_message" => { + let ship = field(&v, "ship_id")?; + let msg = owned(&v, "message")?; + let mut s = self.state.lock().unwrap(); + check_owner(s.ships.get(ship).ok_or("unknown ship")?, &user)?; + s.messages.entry(ship.into()).or_default().push(msg); + Ok(json!({"ok":true})) + } + "bind_source" => { + let source = owned(&v, "source_id")?; + + let mut s = self.state.lock().unwrap(); + + if s.sources.contains_key(&source) { + return Err("source exists".into()); + } + if !s.ships.contains_key(&canonical(&source)) { + return Err("unknown ship".into()); + } + s.sources.insert(source, user); + Ok(json!({"ok":true})) + } + "read_source_messages" => { + let source = field(&v, "source_id")?; + + let s = self.state.lock().unwrap(); + + check_owner(s.sources.get(source).ok_or("unknown source")?, &user)?; + + let ship = canonical(source); + Ok(json!({"messages":s.messages.get(&ship).cloned().unwrap_or_default()})) + } + "create_profile" => { + let ship = owned(&v, "ship_id")?; + let mut s = self.state.lock().unwrap(); + check_owner(s.ships.get(&ship).ok_or("unknown ship")?, &user)?; + + let id = s.id("profile"); + s.profiles.insert(id.clone(), Profile { owner: user, ship }); + Ok(json!({"profile_id":id})) + } + "create_export" => { + let profile = owned(&v, "profile_id")?; + let mut s = self.state.lock().unwrap(); + let p = s.profiles.get(&profile).ok_or("unknown profile")?; + + check_owner(&p.owner, &user)?; + + check_owner(s.ships.get(&p.ship).ok_or("unknown ship")?, &user)?; + let id = s.id("job"); + s.jobs.insert( + id.clone(), + Job { + owner: user, + profile, + result: None, + }, + ); + Ok(json!({"job_id":id,"state":"DRAFT"})) + } + "edit_profile" => { + let id = field(&v, "profile_id")?; + let ship = owned(&v, "ship_id")?; + let mut s = self.state.lock().unwrap(); + + if !s.ships.contains_key(&ship) { + return Err("unknown ship".into()); + } + let p = s.profiles.get_mut(id).ok_or("unknown profile")?; + check_owner(&p.owner, &user)?; + p.ship = ship; + Ok(json!({"ok":true})) + } + "run_export" => { + let id = field(&v, "job_id")?; + + let mut s = self.state.lock().unwrap(); + let job = s.jobs.get(id).ok_or("unknown job")?; + check_owner(&job.owner, &user)?; + + if job.result.is_some() { + return Err("already run".into()); + } + + let ship = s + .profiles + .get(&job.profile) + .ok_or("unknown profile")? + .ship + .clone(); + + let result = s.messages.get(&ship).cloned().unwrap_or_default(); + + s.jobs.get_mut(id).ok_or("unknown job")?.result = Some(result.clone()); + Ok(json!({"messages":result,"state":"DONE"})) + } + "export_result" => { + let id = field(&v, "job_id")?; + + let s = self.state.lock().unwrap(); + + let job = s.jobs.get(id).ok_or("unknown job")?; + + check_owner(&job.owner, &user)?; + + Ok( + json!({"messages":job.result,"state":if job.result.is_some(){"DONE"}else{"DRAFT"}}), + ) + } + "create_flight" => { + let geometry = owned(&v, "geometry")?; + + let version = owned(&v, "map_version")?; + + let options = owned(&v, "options")?; + + let manifest = owned(&v, "manifest")?; + + let nav = owned(&v, "navigation")?; + + let mut s = self.state.lock().unwrap(); + + let id = s.id("flight"); + + let f = Flight { + owner: user, + geometry, + map_version: version, + options, + manifest, + }; + + fs::write(self.root.join("navigation").join(format!("{id}.txt")), nav) + .map_err(|e| e.to_string())?; + + let key = cache_key(&f); + + s.geometry_cache.entry(key).or_insert_with(|| id.clone()); + + s.flights.insert(id.clone(), f); + + Ok(json!({"flight_id":id})) + } + "flight_public" => { + let id = field(&v, "flight_id")?; + + let s = self.state.lock().unwrap(); + + let f = s.flights.get(id).ok_or("unknown flight")?; + + Ok(json!({"geometry":f.geometry,"map_version":f.map_version,"options":f.options})) + } + "report" => { + let id = field(&v, "flight_id")?; + + let s = self.state.lock().unwrap(); + + let f = s.flights.get(id).ok_or("unknown flight")?; + + check_owner(&f.owner, &user)?; + + let cached_flight = s.geometry_cache.get(&cache_key(f)).ok_or("cache miss")?; + + let manifest = &s.flights.get(cached_flight).ok_or("stale cache")?.manifest; + + Ok(json!({"geometry":f.geometry,"manifest":manifest})) + } + "grant_geometry" => { + let flight = owned(&v, "flight_id")?; + + let mut s = self.state.lock().unwrap(); + + check_owner( + &s.flights.get(&flight).ok_or("unknown flight")?.owner, + &user, + )?; + let id = s.id("grant"); + + s.grants.insert( + id.clone(), + Grant { + flight, + subject: "public".into(), + rights: vec!["geometry.read".into(), "delegate".into()], + expires: u64::MAX, + }, + ); + Ok(json!({"grant_id":id})) + } + "delegate" => { + let parent_id = field(&v, "parent_id")?; + + let rights = v + .get("rights") + .and_then(Value::as_array) + .ok_or("missing rights")? + .iter() + .map(|x| x.as_str().map(str::to_owned).ok_or("invalid right")) + .collect::, _>>()?; + + let expires = v + .get("expires") + .and_then(Value::as_u64) + .ok_or("missing expires")?; + let mut s = self.state.lock().unwrap(); + + let p = s.grants.get(parent_id).ok_or("unknown grant")?; + + if p.subject != "public" && p.subject != user { + return Err("forbidden".into()); + } + if !p.rights.iter().any(|x| x == "delegate") || expires > p.expires { + return Err("invalid delegation".into()); + } + let flight = p.flight.clone(); + + let id = s.id("grant"); + + s.grants.insert( + id.clone(), + Grant { + flight, + subject: user, + rights, + expires, + }, + ); + Ok(json!({"grant_id":id})) + } + "read_manifest" => { + let flight = field(&v, "flight_id")?; + + let s = self.state.lock().unwrap(); + + let f = s.flights.get(flight).ok_or("unknown flight")?; + + if f.owner != user { + let grant = field(&v, "grant_id")?; + + let g = s.grants.get(grant).ok_or("unknown grant")?; + + if !(g.flight == flight + && g.subject == user + && g.rights.iter().any(|x| x == "manifest.read")) + { + return Err("forbidden".into()); + } + } + Ok(json!({"manifest":f.manifest})) + } + "create_summary" => { + let content = owned(&v, "content")?; + + let mut s = self.state.lock().unwrap(); + + let id = s.id("summary"); + + s.summaries.insert( + id.clone(), + Summary { + owner: user, + content, + }, + ); + + Ok(json!({"summary_id":id})) + } + "read_summary" => { + let id = field(&v, "summary_id")?; + + let s = self.state.lock().unwrap(); + + let summary = s.summaries.get(id).ok_or("unknown summary")?; + + check_owner(&summary.owner, &user)?; + + Ok(json!({"content":summary.content})) + } + "read_navigation" => { + let id = field(&v, "flight_id")?; + + { + let s = self.state.lock().unwrap(); + + let flight = s.flights.get(id).ok_or("unknown flight")?; + + check_owner(&flight.owner, &user)?; + } + + let content = + fs::read_to_string(self.root.join("navigation").join(format!("{id}.txt"))) + .map_err(|e| e.to_string())?; + + Ok(json!({"navigation":content})) + } + "import_bulletin" => { + let url = field(&v, "url")?; + + let (host, _, _) = parse_url(url)?; + + if host == "127.0.0.1" || host == "localhost" { + return Err("internal source forbidden".into()); + } + + let result = self.fetch_bulletin(url)?; + + let mut s = self.state.lock().unwrap(); + + let id = s.id("import"); + + s.imports.insert(id.clone(), (user, result.clone())); + + Ok(json!({"import_id":id,"content":result})) + } + "import_result" => { + let id = field(&v, "import_id")?; + + let s = self.state.lock().unwrap(); + + let (owner, content) = s.imports.get(id).ok_or("unknown import")?; + + check_owner(owner, &user)?; + + Ok(json!({"content":content})) + } + "create_package" => { + let mut s = self.state.lock().unwrap(); + + let id = s.id("package"); + + s.packages.insert( + id.clone(), + Package { + owner: user, + bytes: Vec::new(), + approved: false, + }, + ); + Ok(json!({"package_id":id})) + } + "approve_package" => { + let id = field(&v, "package_id")?; + + let mut s = self.state.lock().unwrap(); + + let p = s.packages.get_mut(id).ok_or("unknown package")?; + + check_owner(&p.owner, &user)?; + + validate_safe_tar(&p.bytes)?; + + p.approved = true; + + Ok(json!({"approved":true})) + } + "generate_report" => { + let id = field(&v, "package_id")?; + + let attachment = field(&v, "attachment")?; + + let bytes = { + let s = self.state.lock().unwrap(); + + let p = s.packages.get(id).ok_or("unknown package")?; + + check_owner(&p.owner, &user)?; + + if !p.approved { + return Err("package not approved".into()); + } + p.bytes.clone() + }; + if !safe_relative(Path::new(attachment)) { + return Err("invalid attachment path".into()); + } + + let dir = self.root.join("work").join(id); + + if dir.exists() { + fs::remove_dir_all(&dir).map_err(|e| e.to_string())?; + } + + fs::create_dir_all(&dir).map_err(|e| e.to_string())?; + + let report = (|| { + unpack_tar(&bytes, &dir)?; + + let target = fs::canonicalize(dir.join(attachment)) + .map_err(|e| format!("resolve report attachment: {e}"))?; + let work_root = fs::canonicalize(&dir) + .map_err(|e| format!("resolve report workspace: {e}"))?; + let navigation_root = fs::canonicalize(self.root.join("navigation")) + .map_err(|e| format!("resolve navigation workspace: {e}"))?; + if !target.starts_with(&work_root) && !target.starts_with(&navigation_root) { + return Err("report attachment resolves outside allowed storage".into()); + } + + fs::read_to_string(target).map_err(|e| e.to_string()) + })(); + let cleanup = fs::remove_dir_all(&dir).map_err(|e| e.to_string()); + + match (report, cleanup) { + (Ok(content), Ok(())) => Ok(json!({"report":content})), + (Err(error), _) => Err(error), + (Ok(_), Err(error)) => Err(error), + } + } + _ => Err("unknown action".into()), + } + } + + pub fn serve(&self, listener: TcpListener) -> std::io::Result<()> { + for incoming in listener.incoming() { + let stream = incoming?; + let server = self.clone(); + thread::spawn(move || { + let _ = server.handle(stream); + }); + } + Ok(()) + } + + fn handle(&self, mut stream: TcpStream) -> std::io::Result<()> { + stream.set_read_timeout(Some(Duration::from_secs(5)))?; + let (method, path, headers, body) = read_request(&mut stream)?; + let result: Result<(u16, Vec), String> = if method == "POST" && path == "/rpc" { + match serde_json::from_slice(&body) + .map_err(|e| e.to_string()) + .and_then(|v| self.rpc(v)) + { + Ok(v) => Ok(( + 200, + serde_json::to_vec(&json!({"ok":true,"result":v})).unwrap(), + )), + Err(e) => Ok(( + 400, + serde_json::to_vec(&json!({"ok":false,"error":e})).unwrap(), + )), + } + } else if method == "PUT" && path.starts_with("/packages/") && path.ends_with("/content") { + let id = path + .trim_start_matches("/packages/") + .trim_end_matches("/content") + .trim_end_matches('/'); + + let token = headers + .get("authorization") + .and_then(|x| x.strip_prefix("Bearer ")) + .unwrap_or(""); + + let upload_result = { + let mut s = self.state.lock().unwrap(); + s.user(token).and_then(|u| { + let p = s.packages.get_mut(id).ok_or("unknown package")?; + check_owner(&p.owner, &u)?; + p.bytes = body; + Ok(()) + }) + }; + + match upload_result { + Ok(()) => match self.persist_state() { + Ok(()) => Ok((200, b"{\"ok\":true}".to_vec())), + Err(error) => Ok(( + 400, + serde_json::to_vec(&json!({"ok":false,"error":error})).unwrap(), + )), + }, + Err(error) => Ok(( + 400, + serde_json::to_vec(&json!({"ok":false,"error":error})).unwrap(), + )), + } + } else if method == "GET" && path.starts_with("/internal/summaries/") { + let id = path.trim_start_matches("/internal/summaries/"); + + if headers.get("x-importer-key").map(String::as_str) != Some(&self.importer_key) { + Ok((403, b"forbidden".to_vec())) + } else { + let s = self.state.lock().unwrap(); + + match s.summaries.get(id) { + Some(summary) => Ok((200, summary.content.as_bytes().to_vec())), + None => Ok((404, b"not found".to_vec())), + } + } + } else { + Ok((404, b"not found".to_vec())) + }; + + let (status, bytes) = result.unwrap_or_else(|e| (400, e.into_bytes())); + + let status_text = match status { + 200 => "OK", + 400 => "Bad Request", + 403 => "Forbidden", + 404 => "Not Found", + _ => "Error", + }; + + write!(stream,"HTTP/1.1 {status} {status_text}\r\nContent-Length: {}\r\nContent-Type: application/json\r\nConnection: close\r\n\r\n",bytes.len())?; + + stream.write_all(&bytes) + } + + fn fetch_bulletin(&self, initial: &str) -> Result { + let mut current = initial.to_owned(); + for _ in 0..5 { + let (host, port, path) = parse_url(¤t)?; + + let addr = (host.as_str(), port) + .to_socket_addrs() + .map_err(|e| format!("resolve {host}:{port}: {e}"))? + .next() + .ok_or("no address")?; + + let mut stream = TcpStream::connect_timeout(&addr, Duration::from_secs(2)) + .map_err(|e| format!("connect {addr}: {e}"))?; + + stream + .set_read_timeout(Some(Duration::from_secs(2))) + .map_err(|e| format!("set timeout for {addr}: {e}"))?; + + write!(stream,"GET {path} HTTP/1.1\r\nHost: {host}\r\nX-Importer-Key: {}\r\nConnection: close\r\n\r\n",self.importer_key).map_err(|e|e.to_string())?; + + let mut bytes = Vec::new(); + + stream + .read_to_end(&mut bytes) + .map_err(|e| format!("read response from {addr}: {e}"))?; + + let (status, headers, body) = parse_response(&bytes)?; + + if (300..400).contains(&status) { + current = headers + .get("location") + .cloned() + .ok_or("redirect without location")?; + continue; + } + + if status != 200 { + return Err(format!("upstream status {status}")); + } + + return String::from_utf8(body.to_vec()).map_err(|e| e.to_string()); + } + Err("too many redirects".into()) + } +} + +fn safe_relative(p: &Path) -> bool { + !p.as_os_str().is_empty() && p.components().all(|c| matches!(c, Component::Normal(_))) +} + +fn validate_safe_tar(bytes: &[u8]) -> Result<(), String> { + let mut seen = false; + for entry in tar_entries(bytes)? { + if !safe_relative(Path::new(&entry.name)) || entry.kind != b'0' { + return Err("unsafe package".into()); + } + seen = true; + } + if !seen { + return Err("empty package".into()); + } + Ok(()) +} + +fn unpack_tar(bytes: &[u8], dir: &Path) -> Result<(), String> { + for entry in tar_entries(bytes)? { + if !safe_relative(Path::new(&entry.name)) { + return Err("unsafe archive path".into()); + } + let dest = dir.join(&entry.name); + if let Some(parent) = dest.parent() { + fs::create_dir_all(parent).map_err(|e| e.to_string())?; + } + if entry.kind == b'0' { + fs::write(dest, entry.data).map_err(|e| e.to_string())?; + } else if entry.kind == b'2' { + #[cfg(unix)] + std::os::unix::fs::symlink(entry.link, dest).map_err(|e| e.to_string())?; + #[cfg(not(unix))] + return Err("symlinks require unix".into()); + } else { + return Err("unsupported tar entry".into()); + } + } + Ok(()) +} + +struct TarEntry<'a> { + name: String, + kind: u8, + link: String, + data: &'a [u8], +} + +fn tar_string(bytes: &[u8]) -> Result { + let end = bytes.iter().position(|b| *b == 0).unwrap_or(bytes.len()); + + std::str::from_utf8(&bytes[..end]) + .map(str::to_owned) + .map_err(|e| e.to_string()) +} +fn tar_entries(bytes: &[u8]) -> Result>, String> { + let mut entries = Vec::new(); + + let mut offset = 0usize; + + while offset + 512 <= bytes.len() { + let h = &bytes[offset..offset + 512]; + if h.iter().all(|b| *b == 0) { + break; + } + let name = tar_string(&h[..100])?; + + let size_text = tar_string(&h[124..136])?; + + let size = usize::from_str_radix(size_text.trim(), 8).map_err(|_| "invalid tar size")?; + + let kind = if h[156] == 0 { b'0' } else { h[156] }; + + let link = tar_string(&h[157..257])?; + + let start = offset + 512; + + let end = start.checked_add(size).ok_or("tar too large")?; + + if end > bytes.len() { + return Err("truncated tar".into()); + } + + entries.push(TarEntry { + name, + kind, + link, + data: &bytes[start..end], + }); + + offset = start + size.div_ceil(512) * 512; + } + Ok(entries) +} + +fn parse_url(url: &str) -> Result<(String, u16, String), String> { + let rest = url + .strip_prefix("http://") + .ok_or("only http URLs supported")?; + + let (authority, path) = rest + .split_once('/') + .map(|(a, p)| (a, format!("/{p}"))) + .unwrap_or((rest, "/".into())); + + if authority.contains('@') || authority.is_empty() { + return Err("invalid host".into()); + } + + let (host, port) = authority + .rsplit_once(':') + .map(|(h, p)| (h, p.parse::())) + .unwrap_or((authority, Ok(80))); + + if host.is_empty() { + return Err("invalid host".into()); + } + + Ok((host.to_owned(), port.map_err(|_| "invalid port")?, path)) +} + +fn parse_response(bytes: &[u8]) -> Result, String> { + let split = bytes + .windows(4) + .position(|x| x == b"\r\n\r\n") + .ok_or("invalid response")?; + + let head = std::str::from_utf8(&bytes[..split]).map_err(|e| e.to_string())?; + + let mut lines = head.split("\r\n"); + + let status = lines + .next() + .ok_or("missing status")? + .split_whitespace() + .nth(1) + .ok_or("missing code")? + .parse::() + .map_err(|e| e.to_string())?; + + let headers = lines + .filter_map(|line| line.split_once(':')) + .map(|(k, v)| (k.to_ascii_lowercase(), v.trim().to_owned())) + .collect(); + + Ok((status, headers, &bytes[split + 4..])) +} + +fn read_request(stream: &mut TcpStream) -> std::io::Result { + let mut data = Vec::new(); + + let mut buf = [0u8; 4096]; + + let split = loop { + let n = stream.read(&mut buf)?; + + if n == 0 { + return Err(std::io::Error::from(std::io::ErrorKind::UnexpectedEof)); + } + + data.extend_from_slice(&buf[..n]); + + if data.len() > 2_100_000 { + return Err(std::io::Error::from(std::io::ErrorKind::InvalidData)); + } + + if let Some(pos) = data.windows(4).position(|x| x == b"\r\n\r\n") { + break pos; + } + }; + + let head = std::str::from_utf8(&data[..split]) + .map_err(|_| std::io::Error::from(std::io::ErrorKind::InvalidData))?; + + let mut lines = head.split("\r\n"); + + let first = lines.next().unwrap_or(""); + + let mut parts = first.split_whitespace(); + + let method = parts + .next() + .ok_or(std::io::ErrorKind::InvalidData)? + .to_owned(); + + let path = parts + .next() + .ok_or(std::io::ErrorKind::InvalidData)? + .to_owned(); + + let version = parts.next().ok_or(std::io::ErrorKind::InvalidData)?; + + if parts.next().is_some() || !matches!(version, "HTTP/1.0" | "HTTP/1.1") { + return Err(std::io::Error::from(std::io::ErrorKind::InvalidData)); + } + + let headers: HashMap = lines + .filter_map(|x| x.split_once(':')) + .map(|(k, v)| (k.to_ascii_lowercase(), v.trim().to_owned())) + .collect(); + + let len = headers + .get("content-length") + .map(|x| x.parse::()) + .transpose() + .map_err(|_| std::io::ErrorKind::InvalidData)? + .unwrap_or(0); + + if len > 2_000_000 { + return Err(std::io::Error::from(std::io::ErrorKind::InvalidData)); + } + + let start = split + 4; + + while data.len() - start < len { + let n = stream.read(&mut buf)?; + + if n == 0 { + return Err(std::io::Error::from(std::io::ErrorKind::UnexpectedEof)); + } + + data.extend_from_slice(&buf[..n]); + } + + Ok((method, path, headers, data[start..start + len].to_vec())) +} \ No newline at end of file diff --git a/orbital_navigation/src/main.rs b/orbital_navigation/src/main.rs new file mode 100644 index 0000000..c93680e --- /dev/null +++ b/orbital_navigation/src/main.rs @@ -0,0 +1,15 @@ +use orbit_ctf::Server; +use std::net::TcpListener; +use std::path::PathBuf; + +fn main() -> std::io::Result<()> { + let addr = std::env::var("LISTEN_ADDR").unwrap_or_else(|_| "127.0.0.1:8080".into()); + + let root = PathBuf::from(std::env::var("DATA_DIR").unwrap_or_else(|_| "./data".into())); + + let listener = TcpListener::bind(&addr)?; + + eprintln!("orbit-navigation-service listening on {addr}"); + + Server::new(root)?.serve(listener) +} diff --git a/starpost/.goctf-compose b/starpost/.goctf-compose new file mode 100644 index 0000000..e69de29 diff --git a/starpost/api/.dockerignore b/starpost/api/.dockerignore new file mode 100644 index 0000000..7a60b85 --- /dev/null +++ b/starpost/api/.dockerignore @@ -0,0 +1,2 @@ +__pycache__/ +*.pyc diff --git a/starpost/api/Dockerfile b/starpost/api/Dockerfile new file mode 100644 index 0000000..dc0cd4b --- /dev/null +++ b/starpost/api/Dockerfile @@ -0,0 +1,8 @@ +FROM python:3.12-alpine + +RUN apk add --no-cache ttf-dejavu +COPY requirements.txt /app/requirements.txt +RUN pip install --no-cache-dir -r /app/requirements.txt +COPY *.py /app/ +WORKDIR /app +CMD ["gunicorn", "--preload", "--workers", "2", "--threads", "4", "--bind", "0.0.0.0:5000", "app:app"] diff --git a/starpost/api/app.py b/starpost/api/app.py new file mode 100644 index 0000000..7b2dd3d --- /dev/null +++ b/starpost/api/app.py @@ -0,0 +1,740 @@ +import base64 +import hashlib +import hmac +import json as _json +import mimetypes +import os +import secrets +from datetime import datetime, timezone +from functools import wraps +from pathlib import Path + +import psycopg +from flask import Flask, jsonify, request, send_file, session +from werkzeug.security import check_password_hash, generate_password_hash + +from contracts import CONTRACT_DIR, create_contract +from database import connect as db, migrate +from warehouse_client import CALLBACK_TOKEN as WAREHOUSE_CALLBACK_TOKEN +from warehouse_client import get_health as get_warehouse_health +from warehouse_client import submit_jobs as submit_warehouse_jobs + + +app = Flask(__name__) +app.config.update( + SECRET_KEY=os.environ["SECRET_KEY"], + SESSION_COOKIE_HTTPONLY=True, + SESSION_COOKIE_SAMESITE="Lax", + SESSION_COOKIE_PATH="/", + MAX_CONTENT_LENGTH=32 * 1024, +) + + +migrate() + + +def now(): + return datetime.now(timezone.utc) + + +def body(): + data = request.get_json(silent=True) + return data if isinstance(data, dict) else None + + +def error(message, status=400): + return jsonify(error=message), status + + +def text(value, field, minimum=1, maximum=200): + if not isinstance(value, str) or not minimum <= len(value.strip()) <= maximum: + raise ValueError(f"{field} length must be {minimum}..{maximum}") + return value.strip() + + +def auth(role=None): + def decorator(handler): + @wraps(handler) + def wrapped(*args, **kwargs): + if "user_id" not in session: + return error("authentication required", 401) + if role and session["role"] != role: + return error("forbidden", 403) + return handler(*args, **kwargs) + return wrapped + return decorator + + +@app.get("/health") +def health(): + try: + with db() as conn, conn.cursor() as cur: + cur.execute("SELECT 1 FROM users LIMIT 1") + except psycopg.Error: + return jsonify(status="starting", service="starpost-api"), 503 + return jsonify(status="ok", service="starpost-api") + + +@app.get("/api/integrity") +def integrity(): + with db() as conn, conn.cursor() as cur: + cur.execute("SELECT contract_file FROM users WHERE role='seller' AND contract_file IS NOT NULL") + contracts = [row["contract_file"] for row in cur.fetchall()] + missing = sum(not (CONTRACT_DIR / filename).is_file() for filename in contracts) + return jsonify(contracts=len(contracts), missing_contracts=missing, status="ok" if missing == 0 else "corrupt") + + +@app.get("/api/warehouse") +def warehouse(): + with db() as conn, conn.cursor() as cur: + cur.execute("SELECT count(*) delivered FROM orders WHERE status='delivered'") + delivered = cur.fetchone()["delivered"] + cur.execute("SELECT warehouse_status,count(*) count FROM orders GROUP BY warehouse_status") + stages = {row["warehouse_status"]: row["count"] for row in cur.fetchall()} + try: + warehouse_health = get_warehouse_health() + except (OSError, ValueError): + return jsonify(bot="ATLAS-7", status="offline", mode="automatic", delivered=delivered, stages=stages), 503 + if warehouse_health.get("status") != "ok": + return jsonify(bot="ATLAS-7", status="offline", mode="automatic", delivered=delivered, stages=stages), 503 + return jsonify(bot=warehouse_health.get("bot", "ATLAS-7"), status="online", mode="automatic", delivered=delivered, stages=stages) + + +def worker_token_valid(): + return request.headers.get("X-Warehouse-Token") == WAREHOUSE_CALLBACK_TOKEN + + +@app.get("/api/warehouse/pending") +def warehouse_pending(): + if not worker_token_valid(): + return error("forbidden", 403) + with db() as conn, conn.cursor() as cur: + cur.execute("SELECT id FROM orders WHERE status='pending' ORDER BY id LIMIT 50") + return jsonify(cur.fetchall()) + + +@app.post("/api/warehouse/callback") +def warehouse_callback(): + if not worker_token_valid(): + return error("forbidden", 403) + data = body() or {} + try: + order_id = int(data["order_id"]) + stage = text(data.get("stage"), "stage", 3, 32) + job_id = text(data.get("job_id"), "job_id", 3, 64) + except (KeyError, TypeError, ValueError) as exc: + return error(str(exc)) + allowed = {"accepted", "picking", "in_transit", "arriving", "delivered"} + if stage not in allowed: + return error("invalid warehouse stage") + with db() as conn, conn.cursor() as cur: + if stage == "delivered": + cur.execute("UPDATE orders SET status='delivered',delivered_at=now(),warehouse_status=%s,warehouse_job_id=%s,warehouse_updated_at=now() WHERE id=%s AND status='pending' RETURNING id", (stage, job_id, order_id)) + else: + cur.execute("UPDATE orders SET warehouse_status=%s,warehouse_job_id=%s,warehouse_updated_at=now() WHERE id=%s AND status='pending' RETURNING id", (stage, job_id, order_id)) + if not cur.fetchone(): + return error("pending order not found", 404) + return jsonify(ok=True, order_id=order_id, job_id=job_id, stage=stage) + + +@app.post("/api/register") +def register(): + data = body() + if not data: + return error("invalid JSON") + try: + username, password = text(data.get("username"), "username", 3, 48), text(data.get("password"), "password", 8, 128) + role = data.get("role") + if role not in ("buyer", "seller"): + raise ValueError("role must be buyer or seller") + company = tax_id = signature = None + if role == "seller": + company, tax_id, signature = text(data.get("company_name"), "company_name", 2, 120), text(data.get("tax_id"), "tax_id", 4, 40), text(data.get("signature"), "signature", 4, 512) + except ValueError as exc: + return error(str(exc)) + try: + with db() as conn, conn.cursor() as cur: + cur.execute("INSERT INTO users(username,password_hash,role,company_name,tax_id) VALUES(%s,%s,%s,%s,%s) RETURNING id", (username, generate_password_hash(password), role, company, tax_id)) + user_id = cur.fetchone()["id"] + if role == "seller": + cur.execute("UPDATE users SET contract_file=%s WHERE id=%s", (create_contract(user_id, company, tax_id, signature), user_id)) + else: + cur.execute( + "INSERT INTO promo_codes(user_id,code) VALUES(%s,%s)", + (user_id, "SP10-" + secrets.token_urlsafe(12).upper()), + ) + except psycopg.errors.UniqueViolation: + return error("username already exists", 409) + session.clear() + session.update(user_id=user_id, username=username, role=role) + return jsonify(id=user_id, username=username, role=role), 201 + + +@app.post("/api/login") +def login(): + data = body() or {} + with db() as conn, conn.cursor() as cur: + cur.execute("SELECT * FROM users WHERE username=%s", (data.get("username"),)) + user = cur.fetchone() + if not user or not isinstance(data.get("password"), str) or not check_password_hash(user["password_hash"], data["password"]): + return error("invalid credentials", 401) + session.clear() + session.update(user_id=user["id"], username=user["username"], role=user["role"]) + return jsonify(id=user["id"], username=user["username"], role=user["role"]) + + +@app.post("/api/logout") +def logout(): + session.clear() + return jsonify(ok=True) + + +@app.get("/api/me") +@auth() +def me(): + with db() as conn, conn.cursor() as cur: + cur.execute("SELECT id,username,role,balance,company_name,tax_id,contract_file FROM users WHERE id=%s", (session["user_id"],)) + return jsonify(cur.fetchone()) + + +@app.get("/api/account") +@auth() +def account_summary(): + with db() as conn, conn.cursor() as cur: + cur.execute( + """ + SELECT id,username,role,balance,company_name,tax_id,created_at + FROM users WHERE id=%s + """, + (session["user_id"],), + ) + user = cur.fetchone() + if user["role"] == "buyer": + cur.execute( + """ + SELECT count(*) orders_count, + count(*) FILTER (WHERE status='delivered') delivered_count, + COALESCE(sum(price),0) spent + FROM orders WHERE buyer_id=%s + """, + (session["user_id"],), + ) + stats = cur.fetchone() + cur.execute( + """ + SELECT o.id,o.status,o.warehouse_status,o.price,o.tracking_code,o.created_at,p.name + FROM orders o JOIN products p ON p.id=o.product_id + WHERE o.buyer_id=%s ORDER BY o.id DESC LIMIT 5 + """, + (session["user_id"],), + ) + recent_orders = cur.fetchall() + cur.execute( + "SELECT count(*) reviews_count FROM reviews WHERE buyer_id=%s", + (session["user_id"],), + ) + reviews_count = cur.fetchone()["reviews_count"] + cur.execute("SELECT code,amount FROM promo_codes WHERE user_id=%s", (session["user_id"],)) + return jsonify(user=user, stats=stats, reviews_count=reviews_count, recent_orders=recent_orders, promo=cur.fetchone()) + + cur.execute( + """ + SELECT count(*) products_count, + count(*) FILTER (WHERE is_active=true) active_products_count + FROM products WHERE seller_id=%s + """, + (session["user_id"],), + ) + stats = cur.fetchone() + cur.execute( + "SELECT count(*) reviews_count FROM reviews WHERE seller_id=%s", + (session["user_id"],), + ) + reviews_count = cur.fetchone()["reviews_count"] + return jsonify(user=user, stats=stats, reviews_count=reviews_count) + + +def current_promo(code): + with db() as conn, conn.cursor() as cur: + cur.execute("SELECT * FROM promo_codes WHERE user_id=%s AND code=%s", (session["user_id"], code)) + return conn, cur, cur.fetchone() + + +@app.post("/api/promo/credit") +@auth("buyer") +def credit_promo(): + data = body() or {} + code = data.get("code") + if not isinstance(code, str) or not 1 <= len(code) <= 100: + return error("invalid promo code") + with db() as conn, conn.cursor() as cur: + cur.execute("SELECT amount FROM promo_codes WHERE user_id=%s AND code=%s", (session["user_id"], code.strip())) + promo = cur.fetchone() + if not promo: + return error("promo code is unavailable", 409) + cur.execute("UPDATE users SET balance=balance+%s WHERE id=%s", (promo["amount"], session["user_id"])) + return jsonify(credited=promo["amount"], code=code.strip()) + + +@app.post("/api/promo/invalidate") +@auth("buyer") +def invalidate_promo(): + data = body() or {} + code = data.get("code") + if not isinstance(code, str) or not 1 <= len(code) <= 100: + return error("invalid promo code") + with db() as conn, conn.cursor() as cur: + cur.execute("DELETE FROM promo_codes WHERE user_id=%s AND code=%s", (session["user_id"], code.strip())) + if cur.rowcount == 0: + return error("promo code is unavailable", 409) + return jsonify(invalidated=True, code=code.strip()) + + +@app.get("/api/products") +def products(): + with db() as conn, conn.cursor() as cur: + cur.execute( + """ + SELECT p.id,p.name,p.description,p.price,p.created_at,u.company_name seller, + (SELECT count(*) FROM reviews r JOIN orders o ON o.id=r.order_id + WHERE o.product_id=p.id AND r.is_private=false) review_count, + COALESCE(( + SELECT json_agg(item) FROM ( + SELECT r.rating,r.body,b.username buyer,r.created_at + FROM reviews r + JOIN orders o ON o.id=r.order_id + JOIN users b ON b.id=r.buyer_id + WHERE o.product_id=p.id AND r.is_private=false + ORDER BY r.id DESC LIMIT 3 + ) item + ), '[]'::json) reviews + FROM products p JOIN users u ON u.id=p.seller_id + WHERE p.is_active=true + ORDER BY p.id DESC LIMIT 100 + """ + ) + return jsonify(cur.fetchall()) + + +@app.get("/api/products/") +def product_details(product_id): + with db() as conn, conn.cursor() as cur: + cur.execute( + """ + SELECT p.id,p.name,p.description,p.price,p.created_at, + u.company_name seller,u.tax_id seller_tax_id, + count(r.id) FILTER (WHERE r.is_private=false) review_count, + COALESCE(round(avg(r.rating) FILTER (WHERE r.is_private=false), 1), 0) rating + FROM products p + JOIN users u ON u.id=p.seller_id + LEFT JOIN orders o ON o.product_id=p.id + LEFT JOIN reviews r ON r.order_id=o.id + WHERE p.id=%s AND p.is_active=true + GROUP BY p.id,u.company_name,u.tax_id + """, + (product_id,), + ) + product = cur.fetchone() + if not product: + return error("product not found", 404) + cur.execute( + """ + SELECT r.id,r.rating,r.body,r.created_at,b.username buyer + FROM reviews r + JOIN orders o ON o.id=r.order_id + JOIN users b ON b.id=r.buyer_id + WHERE o.product_id=%s AND r.is_private=false + ORDER BY r.id DESC LIMIT 50 + """, + (product_id,), + ) + product["reviews"] = cur.fetchall() + return jsonify(product) + + +@app.post("/api/products") +@auth("seller") +def add_product(): + data = body() or {} + try: + name, description, cargo = text(data.get("name"), "name", 2, 100), text(data.get("description"), "description", 2, 500), text(data.get("cargo"), "cargo", 1, 1024) + price = int(data.get("price")) + if not 1 <= price <= 1000: + raise ValueError("price must be 1..1000") + except (TypeError, ValueError) as exc: + return error(str(exc)) + with db() as conn, conn.cursor() as cur: + cur.execute("INSERT INTO products(seller_id,name,description,price,cargo) VALUES(%s,%s,%s,%s,%s) RETURNING id", (session["user_id"], name, description, price, cargo)) + return jsonify(id=cur.fetchone()["id"]), 201 + + +@app.get("/api/seller/products") +@auth("seller") +def seller_products(): + with db() as conn, conn.cursor() as cur: + cur.execute( + """ + SELECT p.id,p.name,p.description,p.price,p.cargo,p.is_active,p.created_at, + count(o.id) sales_count,COALESCE(sum(o.price),0) income + FROM products p + LEFT JOIN orders o ON o.product_id=p.id + WHERE p.seller_id=%s + GROUP BY p.id + ORDER BY p.id DESC + """, + (session["user_id"],), + ) + return jsonify(cur.fetchall()) + + +@app.patch("/api/seller/products/") +@auth("seller") +def update_seller_product(product_id): + data = body() or {} + try: + name = text(data.get("name"), "name", 2, 100) + description = text(data.get("description"), "description", 2, 500) + price = int(data.get("price")) + if not 1 <= price <= 1000: + raise ValueError("price must be 1..1000") + is_active = data.get("is_active") + if not isinstance(is_active, bool): + raise ValueError("is_active must be boolean") + except (TypeError, ValueError) as exc: + return error(str(exc)) + with db() as conn, conn.cursor() as cur: + cur.execute( + """ + UPDATE products SET name=%s,description=%s,price=%s,is_active=%s + WHERE id=%s AND seller_id=%s RETURNING id,is_active + """, + (name, description, price, is_active, product_id, session["user_id"]), + ) + product = cur.fetchone() + if not product: + return error("product not found", 404) + return jsonify(product) + + +@app.delete("/api/seller/products/") +@auth("seller") +def archive_seller_product(product_id): + with db() as conn, conn.cursor() as cur: + cur.execute( + "UPDATE products SET is_active=false WHERE id=%s AND seller_id=%s RETURNING id", + (product_id, session["user_id"]), + ) + if not cur.fetchone(): + return error("product not found", 404) + return jsonify(ok=True, archived=True) + + +@app.post("/api/cart") +@auth("buyer") +def add_cart(): + data = body() or {} + product_id = data.get("product_id") + try: + quantity = int(data.get("quantity", 1)) + if not 1 <= quantity <= 10: + raise ValueError("quantity must be 1..10") + except (TypeError, ValueError) as exc: + return error(str(exc)) + with db() as conn, conn.cursor() as cur: + cur.execute("SELECT seller_id FROM products WHERE id=%s AND is_active=true", (product_id,)) + product = cur.fetchone() + if not product: + return error("product not found", 404) + if product["seller_id"] == session["user_id"]: + return error("cannot add your own product") + cur.execute( + """ + INSERT INTO cart_items(buyer_id,product_id,quantity) VALUES(%s,%s,%s) + ON CONFLICT(buyer_id,product_id) DO UPDATE + SET quantity=LEAST(10, cart_items.quantity + EXCLUDED.quantity) + RETURNING quantity + """, + (session["user_id"], product_id, quantity), + ) + quantity = cur.fetchone()["quantity"] + return jsonify(ok=True, quantity=quantity), 201 + + +@app.get("/api/cart") +@auth("buyer") +def get_cart(): + with db() as conn, conn.cursor() as cur: + cur.execute("SELECT p.id,p.name,p.description,p.price,c.quantity,u.company_name seller FROM cart_items c JOIN products p ON p.id=c.product_id JOIN users u ON u.id=p.seller_id WHERE c.buyer_id=%s ORDER BY c.created_at", (session["user_id"],)) + return jsonify(cur.fetchall()) + + +@app.delete("/api/cart/") +@auth("buyer") +def delete_cart(product_id): + with db() as conn, conn.cursor() as cur: + cur.execute("DELETE FROM cart_items WHERE buyer_id=%s AND product_id=%s", (session["user_id"], product_id)) + return jsonify(ok=True) + + +@app.patch("/api/cart/") +@auth("buyer") +def update_cart_quantity(product_id): + try: + quantity = int((body() or {}).get("quantity")) + if not 1 <= quantity <= 10: + raise ValueError("quantity must be 1..10") + except (TypeError, ValueError) as exc: + return error(str(exc)) + with db() as conn, conn.cursor() as cur: + cur.execute("UPDATE cart_items SET quantity=%s WHERE buyer_id=%s AND product_id=%s RETURNING quantity", (quantity, session["user_id"], product_id)) + if not cur.fetchone(): + return error("cart item not found", 404) + return jsonify(ok=True, quantity=quantity) + + +def order_product(product_id): + with db() as conn, conn.cursor() as cur: + cur.execute("SELECT p.*,u.balance FROM products p CROSS JOIN users u WHERE p.id=%s AND p.is_active=true AND u.id=%s FOR UPDATE OF u", (product_id, session["user_id"])) + row = cur.fetchone() + if not row: + return None, error("product not found", 404) + if row["seller_id"] == session["user_id"]: + return None, error("cannot buy your own product") + if row["balance"] < row["price"]: + return None, error("insufficient balance", 409) + cur.execute("UPDATE users SET balance=balance-%s WHERE id=%s", (row["price"], session["user_id"])) + cur.execute("UPDATE users SET balance=balance+%s WHERE id=%s", (row["price"], row["seller_id"])) + tracking = "ORB-" + secrets.token_hex(8).upper() + cur.execute("INSERT INTO orders(buyer_id,product_id,price,status,tracking_code) VALUES(%s,%s,%s,'pending',%s) RETURNING id", (session["user_id"], product_id, row["price"], tracking)) + return {"id": cur.fetchone()["id"], "status": "pending", "tracking_code": tracking}, None + + +@app.post("/api/products//buy") +@auth("buyer") +def buy_product(product_id): + result, failure = order_product(product_id) + if failure: + return failure + submit_warehouse_jobs([result]) + return jsonify(result), 201 + + +@app.post("/api/cart/checkout") +@auth("buyer") +def checkout(): + with db() as conn, conn.cursor() as cur: + cur.execute("SELECT balance FROM users WHERE id=%s FOR UPDATE", (session["user_id"],)) + buyer = cur.fetchone() + cur.execute( + """ + SELECT p.id product_id,p.seller_id,p.price,p.is_active,c.quantity + FROM cart_items c JOIN products p ON p.id=c.product_id + WHERE c.buyer_id=%s ORDER BY c.created_at + """, + (session["user_id"],), + ) + items = cur.fetchall() + if not items: + return error("cart is empty", 409) + if any(not item["is_active"] for item in items): + return error("cart contains archived product", 409) + total = sum(item["price"] * item["quantity"] for item in items) + if buyer["balance"] < total: + return error("insufficient balance", 409) + cur.execute("UPDATE users SET balance=balance-%s WHERE id=%s", (total, session["user_id"])) + orders = [] + for item in items: + cur.execute("UPDATE users SET balance=balance+%s WHERE id=%s", (item["price"] * item["quantity"], item["seller_id"])) + for _ in range(item["quantity"]): + tracking = "ORB-" + secrets.token_hex(8).upper() + cur.execute( + "INSERT INTO orders(buyer_id,product_id,price,status,tracking_code) VALUES(%s,%s,%s,'pending',%s) RETURNING id", + (session["user_id"], item["product_id"], item["price"], tracking), + ) + orders.append({"id": cur.fetchone()["id"], "status": "pending", "tracking_code": tracking}) + cur.execute("DELETE FROM cart_items WHERE buyer_id=%s", (session["user_id"],)) + submit_warehouse_jobs(orders) + return jsonify(orders=orders), 201 + + +@app.get("/api/orders") +@auth("buyer") +def buyer_orders(): + with db() as conn, conn.cursor() as cur: + cur.execute("SELECT o.id,o.status,o.warehouse_status,o.warehouse_updated_at,o.tracking_code,o.price,o.created_at,o.delivered_at,p.name,CASE WHEN o.status='delivered' THEN p.cargo ELSE NULL END cargo FROM orders o JOIN products p ON p.id=o.product_id WHERE o.buyer_id=%s ORDER BY o.id DESC", (session["user_id"],)) + return jsonify(cur.fetchall()) + + +@app.get("/api/seller/sales") +@auth("seller") +def seller_sales(): + with db() as conn, conn.cursor() as cur: + cur.execute("SELECT o.id,o.price,o.status,o.tracking_code,o.created_at,p.name,b.username buyer FROM orders o JOIN products p ON p.id=o.product_id JOIN users b ON b.id=o.buyer_id WHERE p.seller_id=%s ORDER BY o.id DESC", (session["user_id"],)) + sales = cur.fetchall() + return jsonify(income=sum(row["price"] for row in sales), sales=sales) + + +@app.post("/api/orders//review") +@auth("buyer") +def review(order_id): + data = body() or {} + try: + review_body, rating = text(data.get("body"), "body", 1, 1000), int(data.get("rating")) + if rating not in range(1, 6): + raise ValueError("rating must be 1..5") + except (TypeError, ValueError) as exc: + return error(str(exc)) + with db() as conn, conn.cursor() as cur: + cur.execute("SELECT p.seller_id FROM orders o JOIN products p ON p.id=o.product_id WHERE o.id=%s AND o.buyer_id=%s AND o.status='delivered'", (order_id, session["user_id"])) + order = cur.fetchone() + if not order: + return error("delivered order not found", 404) + try: + cur.execute("INSERT INTO reviews(order_id,buyer_id,seller_id,rating,body,is_private) VALUES(%s,%s,%s,%s,%s,%s) RETURNING id", (order_id, session["user_id"], order["seller_id"], rating, review_body, data.get("private") is True)) + except psycopg.errors.UniqueViolation: + return error("order already reviewed", 409) + return jsonify(id=cur.fetchone()["id"]), 201 + + +@app.get("/api/seller/reviews") +@auth("seller") +def seller_reviews(): + cursor = request.args.get("cursor") + limit_raw = request.args.get("limit") + def _b64e(b: bytes) -> str: + return base64.urlsafe_b64encode(b).decode().rstrip("=") + + def _b64d(s: str) -> bytes: + return base64.urlsafe_b64decode(s + "=" * (-len(s) % 4)) + + def _sign(payload_b64: str) -> str: + return hmac.new(app.config["SECRET_KEY"].encode(), payload_b64.encode(), hashlib.sha256).hexdigest()[:16] + + def _make_cursor(state: dict) -> str: + p = _b64e(_json.dumps(state, separators=(",", ":")).encode()) + return f"{p}.{_sign(p)}" + + def _parse_cursor(cur_token: str, lim_raw): + try: + lim = int(lim_raw) if lim_raw is not None else None + except (TypeError, ValueError): + lim = None + if lim is not None and lim <= 3: + return _json.loads(_b64d(cur_token.split(".")[0]).decode()) + if "." not in cur_token: + raise ValueError("missing signature") + payload_b64, sig = cur_token.rsplit(".", 1) + if not hmac.compare_digest(_sign(payload_b64), sig): + raise ValueError("bad cursor signature") + return _json.loads(_b64d(payload_b64).decode()) + + limit = 20 + if limit_raw is not None: + try: + limit = int(limit_raw) + if not 1 <= limit <= 100: + return error("limit must be 1..100") + except (TypeError, ValueError): + return error("invalid limit") + + if cursor: + try: + state = _parse_cursor(cursor, limit_raw) + except Exception as exc: + return error(f"invalid cursor: {exc}", 400) + try: + q_seller = int(state["seller_id"]) + q_private = bool(state["is_private"]) + q_last = int(state["last_id"]) + except (KeyError, TypeError, ValueError): + return error("invalid cursor payload", 400) + with db() as conn, conn.cursor() as cur: + cur.execute( + "SELECT r.id,r.rating,r.body,r.is_private,r.created_at,p.name,b.username buyer " + "FROM reviews r JOIN orders o ON o.id=r.order_id " + "JOIN products p ON p.id=o.product_id JOIN users b ON b.id=r.buyer_id " + "WHERE r.seller_id=%s AND r.is_private=%s AND r.id < %s " + "ORDER BY r.id DESC LIMIT %s", + (q_seller, q_private, q_last, limit), + ) + rows = cur.fetchall() + next_cursor = None + if rows: + next_cursor = _make_cursor( + {"seller_id": q_seller, "is_private": q_private, "last_id": rows[-1]["id"], "v": 2} + ) + return jsonify(reviews=rows, next_cursor=next_cursor) + with db() as conn, conn.cursor() as cur: + cur.execute( + "SELECT r.id,r.rating,r.body,r.is_private,r.created_at,p.name,b.username buyer " + "FROM reviews r JOIN orders o ON o.id=r.order_id " + "JOIN products p ON p.id=o.product_id JOIN users b ON b.id=r.buyer_id " + "WHERE r.seller_id=%s AND r.id < %s " + "ORDER BY r.id DESC LIMIT %s", + (session["user_id"], 1_000_000_000, limit), + ) + rows = cur.fetchall() + next_cursor = None + if rows: + last_private = rows[-1]["is_private"] + next_cursor = _make_cursor( + {"seller_id": session["user_id"], "is_private": bool(last_private), "last_id": rows[-1]["id"], "v": 2} + ) + return jsonify(reviews=rows, next_cursor=next_cursor) + + +@app.route("/api/contract", methods=["GET", "POST"]) +@auth("seller") +def get_contract(): + if request.method == "POST": + import re + contract_id = request.headers.get("X-Contract-Id", "").strip() + if not re.fullmatch(r"\d+", contract_id): + return error("invalid contract id", 400) + _dir = CONTRACT_DIR.resolve() + hits = sorted(CONTRACT_DIR.glob(f"contract-{contract_id}-*.pdf")) + deleted = 0 + for path in hits: + try: + if path.resolve().parent == _dir: + path.unlink() + deleted += 1 + except OSError: + continue + if deleted == 0: + return error("contract not found", 404) + return jsonify(status="deleted", deleted=deleted) + + requested = request.args.get("file") + + if requested: + import re + m = re.match(r"^\s*contract-(\d+)", requested) + if m: + uid = m.group(1) + hits = sorted(CONTRACT_DIR.glob(f"contract-{uid}-*.pdf")) + if hits: + return send_file(hits[0], mimetype="application/pdf", download_name=hits[0].name) + return error("contract not found", 404) + raw = requested.strip() + candidates: list[Path] = [] + candidates.append((CONTRACT_DIR / raw).resolve()) + candidates.append(Path(raw).resolve()) + candidates.append(CONTRACT_DIR / raw) + candidates.append(Path(raw)) + for target in candidates: + try: + if target.is_file(): + guessed, _ = mimetypes.guess_type(str(target)) + return send_file(target, mimetype=guessed or "application/octet-stream", download_name=target.name) + except ValueError: + continue + return error("contract not found", 404) + + with db() as conn, conn.cursor() as cur: + cur.execute("SELECT contract_file FROM users WHERE id=%s", (session["user_id"],)) + filename = cur.fetchone()["contract_file"] + path = CONTRACT_DIR / filename + if not path.is_file(): + return error("contract not found", 404) + return send_file(path, mimetype="application/pdf", download_name="starpost-contract.pdf") \ No newline at end of file diff --git a/starpost/api/contracts.py b/starpost/api/contracts.py new file mode 100644 index 0000000..9b32d8e --- /dev/null +++ b/starpost/api/contracts.py @@ -0,0 +1,177 @@ +import secrets +from datetime import datetime, timezone +from pathlib import Path + +from reportlab.lib.pagesizes import A4 +from reportlab.pdfgen import canvas + + +CONTRACT_DIR = Path("/contracts") +CONTRACT_DIR.mkdir(exist_ok=True) + + +def create_contract(user_id, company, tax_id, signature): + CONTRACT_DIR.mkdir(exist_ok=True) + filename = f"contract-{user_id}-{secrets.token_hex(8)}.pdf" + path = CONTRACT_DIR / filename + pdf = canvas.Canvas(str(path), pagesize=A4, pageCompression=0) + pdf.setTitle("Starpost marketplace contract") + pdf.setFont("Helvetica", 16) + pdf.drawString(55, 790, "STARPOST MARKETPLACE CONTRACT") + pdf.setFont("Helvetica", 10) + lines = [ + "MARKETPLACE SELLER AGREEMENT", + "", + "1. PARTIES TO THE AGREEMENT", + f"Company Name: {company}", + f"Tax Identification Number: {tax_id}", + f"Seller Account ID: {user_id}", + f"Agreement Date (UTC): {datetime.now(timezone.utc).isoformat()}", + "", + "2. PURPOSE AND SCOPE OF THE AGREEMENT", + "This Agreement establishes the terms and conditions under", + "which the Seller may use the Starpost Marketplace platform", + "to publish cargo listings, offer goods for sale, receive", + "customer orders, and manage marketplace transactions.", + "Starpost provides the technical infrastructure necessary", + "for publishing listings, processing orders, maintaining", + "transaction records, and facilitating marketplace activity.", + "The Seller agrees to comply with the terms of this Agreement", + "and the operational requirements of the platform.", + "", + "3. SELLER RIGHTS AND RESPONSIBILITIES", + "The Seller may create and manage cargo listings, specify", + "prices, update product availability, and receive orders", + "through the Starpost Marketplace system.", + "The Seller is responsible for ensuring that all submitted", + "information is accurate, complete, and up to date.", + "Cargo descriptions must correctly represent the goods,", + "their condition, quantity, characteristics, and availability.", + "The Seller must not publish fraudulent, deceptive, or", + "intentionally misleading offers or transaction information.", + "The Seller is responsible for fulfilling accepted orders", + "and providing reasonable customer support regarding sales,", + "delivery conditions, product information, and complaints.", + "", + "4. STARPOST MARKETPLACE SERVICES", + "Starpost provides access to marketplace functionality", + "for creating listings, receiving orders, and reviewing", + "transaction history and order statuses.", + "The platform records relevant sales information and may", + "provide tools for calculating and reviewing revenue.", + "Starpost may perform maintenance, deploy security updates,", + "and modify technical components to maintain platform", + "stability, availability, and operational security.", + "Temporary interruptions may occur during maintenance", + "or due to circumstances outside the platform's control.", + "", + "5. CARGO LISTINGS AND ORDER PROCESSING", + "Each listing must contain a valid description of the goods,", + "the applicable price, available quantity, and any relevant", + "conditions necessary for a customer to place an order.", + "The Seller must review incoming orders and ensure that", + "accepted orders are processed in accordance with the", + "information published in the corresponding listing.", + "Changes to a listing must not intentionally misrepresent", + "the terms of an order that has already been accepted.", + "The Seller should promptly report technical errors that", + "affect order creation, order status, or transaction records.", + "", + "6. SALES RECORDS AND REVENUE", + "Starpost maintains marketplace records relating to orders,", + "completed sales, and other supported transaction events.", + "These records may be used to calculate marketplace revenue", + "and determine the amounts eligible for transfer to the Seller.", + "Revenue transfers are subject to the platform's payment", + "procedures and the status of the relevant transactions.", + "The Seller is responsible for reviewing transaction records", + "and reporting discrepancies through the available support", + "or dispute resolution procedures.", + "Starpost may retain transaction records for accounting,", + "security auditing, and investigation of disputed orders.", + "", + "7. CUSTOMER SUPPORT AND DISPUTE HANDLING", + "The Seller is responsible for responding to reasonable", + "customer inquiries concerning the Seller's cargo listings", + "and the fulfillment of accepted orders.", + "In the event of a disagreement regarding an order, the", + "parties should review the relevant listing, order details,", + "transaction history, and other available evidence.", + "Suspected fraudulent activity or technical manipulation", + "of marketplace transactions may be subject to investigation.", + "The parties should cooperate in resolving disputes and", + "provide relevant information when reasonably requested.", + "", + "8. ACCOUNT SECURITY AND DATA PROTECTION", + "The Seller is responsible for maintaining the security", + "of the Seller's account and associated authentication data.", + "Credentials and authorization secrets must not be disclosed", + "to unauthorized persons or exposed through public listings.", + "Information submitted to Starpost may be processed to", + "operate the marketplace, manage orders, maintain records,", + "provide support, and investigate security incidents.", + "Customer information must be handled responsibly and used", + "only for legitimate purposes connected with marketplace", + "operations and order fulfillment.", + "", + "9. PROHIBITED ACTIVITIES", + "The Seller must not intentionally exploit technical flaws", + "to create unauthorized orders, manipulate revenue records,", + "obtain goods or services without proper authorization,", + "or interfere with the normal operation of the platform.", + "The Seller must not submit forged business information,", + "misuse another user's account, or attempt to gain access", + "to information or functions without authorization.", + "Starpost may investigate suspected violations and apply", + "appropriate restrictions in accordance with its policies.", + "", + "10. LIABILITY AND LIMITATIONS", + "The Seller remains responsible for the accuracy of listings,", + "the fulfillment of accepted orders, and the handling of", + "customer inquiries relating to the Seller's goods.", + "Each party is responsible for its own actions and failures", + "to comply with the obligations established by this Agreement.", + "Neither party should knowingly provide false information", + "or interfere with the proper recording of transactions.", + "Any limitation of liability must be interpreted in", + "accordance with the applicable terms and governing law.", + "", + "11. TERM AND TERMINATION", + "This Agreement becomes effective upon its acceptance and", + "the recording of the Seller's signature or authorization.", + "The Agreement remains effective while the Seller uses", + "the marketplace, unless terminated in accordance with", + "the applicable platform procedures.", + "Access may be restricted when there is evidence of fraud,", + "unauthorized activity, or a material violation of the", + "platform's requirements.", + "Termination does not automatically eliminate outstanding", + "obligations associated with previously accepted orders,", + "completed transactions, or unresolved disputes.", + "", + "12. FINAL PROVISIONS", + "This document records the terms presented to the Seller", + "at the time the Agreement is generated.", + "Any amendments or additional conditions should be recorded", + "in an appropriate form and communicated to the parties.", + "Questions concerning the interpretation of this Agreement", + "should be addressed through the established support process.", + "", + "SELLER ACKNOWLEDGMENT", + "By signing this Agreement, the Seller confirms that the", + "provided company information is accurate and acknowledges", + "the responsibilities associated with marketplace activity.", + "The Seller agrees to comply with the terms described above", + "and to act in good faith when processing customer orders.", + "", + "Seller Signature / Authorization Key:", + ] + y = 745 + for line in lines: + pdf.drawString(55, y, line) + y -= 28 + for offset in range(0, len(signature), 88): + pdf.drawString(55, y, signature[offset:offset + 88]) + y -= 16 + pdf.save() + return filename \ No newline at end of file diff --git a/starpost/api/database.py b/starpost/api/database.py new file mode 100644 index 0000000..296ba25 --- /dev/null +++ b/starpost/api/database.py @@ -0,0 +1,62 @@ +import os + +import psycopg +from psycopg.rows import dict_row + + +DATABASE_URL = os.environ["DATABASE_URL"] + + +def connect(): + return psycopg.connect(DATABASE_URL, row_factory=dict_row) + + +def migrate(): + with connect() as connection, connection.cursor() as cursor: + cursor.execute("DROP TABLE IF EXISTS promos") + cursor.execute("DROP TABLE IF EXISTS private_promos") + cursor.execute("ALTER TABLE cart_items ADD COLUMN IF NOT EXISTS quantity INTEGER NOT NULL DEFAULT 1") + cursor.execute( + """ + DO $$ BEGIN + ALTER TABLE cart_items ADD CONSTRAINT cart_items_quantity_check CHECK(quantity BETWEEN 1 AND 10); + EXCEPTION WHEN duplicate_object THEN NULL; + END $$; + """ + ) + cursor.execute("ALTER TABLE products ADD COLUMN IF NOT EXISTS is_active BOOLEAN NOT NULL DEFAULT true") + cursor.execute("ALTER TABLE orders ADD COLUMN IF NOT EXISTS warehouse_status TEXT NOT NULL DEFAULT 'queued'") + cursor.execute("ALTER TABLE orders ADD COLUMN IF NOT EXISTS warehouse_job_id TEXT") + cursor.execute("ALTER TABLE orders ADD COLUMN IF NOT EXISTS warehouse_updated_at TIMESTAMPTZ NOT NULL DEFAULT now()") + cursor.execute( + """ + CREATE TABLE IF NOT EXISTS promo_codes ( + id BIGSERIAL PRIMARY KEY, + user_id BIGINT NOT NULL UNIQUE REFERENCES users(id) ON DELETE CASCADE, + code TEXT NOT NULL UNIQUE, + amount INTEGER NOT NULL DEFAULT 100 CHECK(amount = 100) + ) + """ + ) + cursor.execute("ALTER TABLE promo_codes DROP COLUMN IF EXISTS is_active") + cursor.execute( + """ + DO $$ DECLARE r RECORD; BEGIN + FOR r IN SELECT conname FROM pg_constraint + WHERE conrelid = 'promo_codes'::regclass AND contype = 'c' LOOP + EXECUTE format('ALTER TABLE promo_codes DROP CONSTRAINT %I', r.conname); + END LOOP; + ALTER TABLE promo_codes ADD CONSTRAINT promo_codes_amount_check CHECK(amount = 100); + EXCEPTION WHEN duplicate_object THEN NULL; + END $$; + """ + ) + cursor.execute("ALTER TABLE promo_codes ALTER COLUMN amount SET DEFAULT 100") + cursor.execute("ALTER TABLE users ALTER COLUMN balance SET DEFAULT 100") + cursor.execute("ALTER TABLE promo_codes DROP COLUMN IF EXISTS credited_at") + cursor.execute("ALTER TABLE promo_codes DROP COLUMN IF EXISTS invalidated_at") + cursor.execute("ALTER TABLE promo_codes DROP COLUMN IF EXISTS created_at") + cursor.execute("CREATE INDEX IF NOT EXISTS orders_buyer_idx ON orders(buyer_id, id DESC)") + cursor.execute("CREATE INDEX IF NOT EXISTS orders_product_idx ON orders(product_id)") + cursor.execute("CREATE INDEX IF NOT EXISTS products_seller_idx ON products(seller_id, id DESC)") + cursor.execute("CREATE INDEX IF NOT EXISTS reviews_seller_idx ON reviews(seller_id, id DESC)") diff --git a/starpost/api/requirements.txt b/starpost/api/requirements.txt new file mode 100644 index 0000000..78b036e --- /dev/null +++ b/starpost/api/requirements.txt @@ -0,0 +1,4 @@ +Flask==3.1.0 +gunicorn==23.0.0 +psycopg[binary]==3.2.3 +reportlab==4.2.5 diff --git a/starpost/api/warehouse_client.py b/starpost/api/warehouse_client.py new file mode 100644 index 0000000..6da8a0f --- /dev/null +++ b/starpost/api/warehouse_client.py @@ -0,0 +1,28 @@ +import json +import os +import urllib.request + + +WAREHOUSE_URL = os.getenv("WAREHOUSE_URL", "http://warehouse:6000") +CALLBACK_TOKEN = os.environ["WAREHOUSE_CALLBACK_TOKEN"] + + +def submit_jobs(orders): + for order in orders: + try: + payload = json.dumps({"order_id": order["id"]}).encode() + request = urllib.request.Request( + f"{WAREHOUSE_URL}/jobs", + data=payload, + headers={"Content-Type": "application/json", "X-Warehouse-Token": CALLBACK_TOKEN}, + method="POST", + ) + with urllib.request.urlopen(request, timeout=.4): + pass + except (OSError, ValueError): + continue + + +def get_health(): + with urllib.request.urlopen(f"{WAREHOUSE_URL}/health", timeout=.5) as response: + return json.loads(response.read()) diff --git a/starpost/compose.yml b/starpost/compose.yml new file mode 100644 index 0000000..e288a4b --- /dev/null +++ b/starpost/compose.yml @@ -0,0 +1,73 @@ +name: starpost.yml + +services: + web: + restart: unless-stopped + build: ./web + pids_limit: 256 + mem_limit: 64M + cpus: 0.25 + ports: + - 8090:80 + depends_on: + api: + condition: service_healthy + + api: + restart: unless-stopped + build: ./api + pids_limit: 256 + mem_limit: 256M + cpus: 1.0 + volumes: + - ./contracts:/contracts + environment: + - DATABASE_URL=postgresql://starpost:starpost@postgres/starpost + - SECRET_KEY=starpost-development-session-key-change-before-production + - WAREHOUSE_URL=http://warehouse:6000 + - WAREHOUSE_CALLBACK_TOKEN=starpost-warehouse-callback-token + depends_on: + postgres: + condition: service_healthy + healthcheck: + test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:5000/health', timeout=2)"] + interval: 2s + timeout: 3s + retries: 15 + + warehouse: + restart: unless-stopped + build: ./warehouse + pids_limit: 128 + mem_limit: 64M + cpus: 0.25 + environment: + - WAREHOUSE_API_URL=http://api:5000 + - WAREHOUSE_CALLBACK_TOKEN=starpost-warehouse-callback-token + depends_on: + api: + condition: service_healthy + healthcheck: + test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:6000/health', timeout=2)"] + interval: 2s + timeout: 3s + retries: 15 + + postgres: + image: postgres:16-alpine + restart: unless-stopped + pids_limit: 256 + mem_limit: 256M + cpus: 0.5 + environment: + - POSTGRES_DB=starpost + - POSTGRES_USER=starpost + - POSTGRES_PASSWORD=starpost + volumes: + - ./postgres:/var/lib/postgresql/data + - ./db/init.sql:/docker-entrypoint-initdb.d/01-init.sql:ro + healthcheck: + test: ["CMD-SHELL", "pg_isready -U starpost -d starpost && psql -U starpost -d starpost -tAc 'SELECT 1 FROM users LIMIT 1' >/dev/null"] + interval: 2s + timeout: 3s + retries: 30 diff --git a/starpost/db/init.sql b/starpost/db/init.sql new file mode 100644 index 0000000..b29bc17 --- /dev/null +++ b/starpost/db/init.sql @@ -0,0 +1,58 @@ +CREATE TABLE users ( + id BIGSERIAL PRIMARY KEY, + username TEXT NOT NULL UNIQUE, + password_hash TEXT NOT NULL, + role TEXT NOT NULL CHECK(role IN ('buyer', 'seller')), + balance INTEGER NOT NULL DEFAULT 100, + company_name TEXT, + tax_id TEXT, + contract_file TEXT, + created_at TIMESTAMPTZ NOT NULL DEFAULT now() +); +CREATE TABLE products ( + id BIGSERIAL PRIMARY KEY, + seller_id BIGINT NOT NULL REFERENCES users(id), + name TEXT NOT NULL, + description TEXT NOT NULL, + price INTEGER NOT NULL CHECK(price > 0), + cargo TEXT NOT NULL, + is_active BOOLEAN NOT NULL DEFAULT true, + created_at TIMESTAMPTZ NOT NULL DEFAULT now() +); +CREATE TABLE cart_items ( + buyer_id BIGINT REFERENCES users(id) ON DELETE CASCADE, + product_id BIGINT NOT NULL REFERENCES products(id) ON DELETE CASCADE, + quantity INTEGER NOT NULL DEFAULT 1 CHECK(quantity BETWEEN 1 AND 10), + created_at TIMESTAMPTZ NOT NULL DEFAULT now(), + PRIMARY KEY(buyer_id, product_id) +); +CREATE TABLE orders ( + id BIGSERIAL PRIMARY KEY, + buyer_id BIGINT NOT NULL REFERENCES users(id), + product_id BIGINT NOT NULL REFERENCES products(id), + price INTEGER NOT NULL, + status TEXT NOT NULL CHECK(status IN ('pending', 'delivered')), + tracking_code TEXT NOT NULL UNIQUE, + created_at TIMESTAMPTZ NOT NULL DEFAULT now(), + delivered_at TIMESTAMPTZ + ,warehouse_status TEXT NOT NULL DEFAULT 'queued' + ,warehouse_job_id TEXT + ,warehouse_updated_at TIMESTAMPTZ NOT NULL DEFAULT now() +); +CREATE TABLE reviews ( + id BIGSERIAL PRIMARY KEY, + order_id BIGINT NOT NULL UNIQUE REFERENCES orders(id), + buyer_id BIGINT NOT NULL REFERENCES users(id), + seller_id BIGINT NOT NULL REFERENCES users(id), + rating INTEGER NOT NULL CHECK(rating BETWEEN 1 AND 5), + body TEXT NOT NULL, + is_private BOOLEAN NOT NULL DEFAULT false, + created_at TIMESTAMPTZ NOT NULL DEFAULT now() +); +CREATE INDEX orders_pending_idx ON orders(status) WHERE status = 'pending'; +CREATE TABLE promo_codes ( + id BIGSERIAL PRIMARY KEY, + user_id BIGINT NOT NULL UNIQUE REFERENCES users(id) ON DELETE CASCADE, + code TEXT NOT NULL UNIQUE, + amount INTEGER NOT NULL DEFAULT 100 CHECK(amount = 100) +); diff --git a/starpost/postgres/PG_VERSION b/starpost/postgres/PG_VERSION new file mode 100644 index 0000000..b6a7d89 --- /dev/null +++ b/starpost/postgres/PG_VERSION @@ -0,0 +1 @@ +16 diff --git a/starpost/postgres/base/1/112 b/starpost/postgres/base/1/112 new file mode 100644 index 0000000..2bfc88c Binary files /dev/null and b/starpost/postgres/base/1/112 differ diff --git a/starpost/postgres/base/1/113 b/starpost/postgres/base/1/113 new file mode 100644 index 0000000..c36defa Binary files /dev/null and b/starpost/postgres/base/1/113 differ diff --git a/starpost/postgres/base/1/1247 b/starpost/postgres/base/1/1247 new file mode 100644 index 0000000..23cfd22 Binary files /dev/null and b/starpost/postgres/base/1/1247 differ diff --git a/starpost/postgres/base/1/1247_fsm b/starpost/postgres/base/1/1247_fsm new file mode 100644 index 0000000..013faac Binary files /dev/null and b/starpost/postgres/base/1/1247_fsm differ diff --git a/starpost/postgres/base/1/1247_vm b/starpost/postgres/base/1/1247_vm new file mode 100644 index 0000000..d88e7ca Binary files /dev/null and b/starpost/postgres/base/1/1247_vm differ diff --git a/starpost/postgres/base/1/1249 b/starpost/postgres/base/1/1249 new file mode 100644 index 0000000..360e1ba Binary files /dev/null and b/starpost/postgres/base/1/1249 differ diff --git a/starpost/postgres/base/1/1249_fsm b/starpost/postgres/base/1/1249_fsm new file mode 100644 index 0000000..a538ac8 Binary files /dev/null and b/starpost/postgres/base/1/1249_fsm differ diff --git a/starpost/postgres/base/1/1249_vm b/starpost/postgres/base/1/1249_vm new file mode 100644 index 0000000..ac50d4b Binary files /dev/null and b/starpost/postgres/base/1/1249_vm differ diff --git a/starpost/postgres/base/1/1255 b/starpost/postgres/base/1/1255 new file mode 100644 index 0000000..32fbb00 Binary files /dev/null and b/starpost/postgres/base/1/1255 differ diff --git a/starpost/postgres/base/1/1255_fsm b/starpost/postgres/base/1/1255_fsm new file mode 100644 index 0000000..69a5d8f Binary files /dev/null and b/starpost/postgres/base/1/1255_fsm differ diff --git a/starpost/postgres/base/1/1255_vm b/starpost/postgres/base/1/1255_vm new file mode 100644 index 0000000..44989f0 Binary files /dev/null and b/starpost/postgres/base/1/1255_vm differ diff --git a/starpost/postgres/base/1/1259 b/starpost/postgres/base/1/1259 new file mode 100644 index 0000000..dbad1e6 Binary files /dev/null and b/starpost/postgres/base/1/1259 differ diff --git a/starpost/postgres/base/1/1259_fsm b/starpost/postgres/base/1/1259_fsm new file mode 100644 index 0000000..05d8c51 Binary files /dev/null and b/starpost/postgres/base/1/1259_fsm differ diff --git a/starpost/postgres/base/1/1259_vm b/starpost/postgres/base/1/1259_vm new file mode 100644 index 0000000..7947f8a Binary files /dev/null and b/starpost/postgres/base/1/1259_vm differ diff --git a/starpost/postgres/base/1/13494 b/starpost/postgres/base/1/13494 new file mode 100644 index 0000000..d43a990 Binary files /dev/null and b/starpost/postgres/base/1/13494 differ diff --git a/starpost/postgres/base/1/13494_fsm b/starpost/postgres/base/1/13494_fsm new file mode 100644 index 0000000..2a80b9a Binary files /dev/null and b/starpost/postgres/base/1/13494_fsm differ diff --git a/starpost/postgres/base/1/13494_vm b/starpost/postgres/base/1/13494_vm new file mode 100644 index 0000000..d510ebf Binary files /dev/null and b/starpost/postgres/base/1/13494_vm differ diff --git a/starpost/postgres/base/1/13497 b/starpost/postgres/base/1/13497 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/13498 b/starpost/postgres/base/1/13498 new file mode 100644 index 0000000..a9f220b Binary files /dev/null and b/starpost/postgres/base/1/13498 differ diff --git a/starpost/postgres/base/1/13499 b/starpost/postgres/base/1/13499 new file mode 100644 index 0000000..9059bc3 Binary files /dev/null and b/starpost/postgres/base/1/13499 differ diff --git a/starpost/postgres/base/1/13499_fsm b/starpost/postgres/base/1/13499_fsm new file mode 100644 index 0000000..70d16ce Binary files /dev/null and b/starpost/postgres/base/1/13499_fsm differ diff --git a/starpost/postgres/base/1/13499_vm b/starpost/postgres/base/1/13499_vm new file mode 100644 index 0000000..6faadfc Binary files /dev/null and b/starpost/postgres/base/1/13499_vm differ diff --git a/starpost/postgres/base/1/13502 b/starpost/postgres/base/1/13502 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/13503 b/starpost/postgres/base/1/13503 new file mode 100644 index 0000000..ff2f77f Binary files /dev/null and b/starpost/postgres/base/1/13503 differ diff --git a/starpost/postgres/base/1/13504 b/starpost/postgres/base/1/13504 new file mode 100644 index 0000000..673bb43 Binary files /dev/null and b/starpost/postgres/base/1/13504 differ diff --git a/starpost/postgres/base/1/13504_fsm b/starpost/postgres/base/1/13504_fsm new file mode 100644 index 0000000..0673ada Binary files /dev/null and b/starpost/postgres/base/1/13504_fsm differ diff --git a/starpost/postgres/base/1/13504_vm b/starpost/postgres/base/1/13504_vm new file mode 100644 index 0000000..e8a0226 Binary files /dev/null and b/starpost/postgres/base/1/13504_vm differ diff --git a/starpost/postgres/base/1/13507 b/starpost/postgres/base/1/13507 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/13508 b/starpost/postgres/base/1/13508 new file mode 100644 index 0000000..ee6fba3 Binary files /dev/null and b/starpost/postgres/base/1/13508 differ diff --git a/starpost/postgres/base/1/13509 b/starpost/postgres/base/1/13509 new file mode 100644 index 0000000..1f545e4 Binary files /dev/null and b/starpost/postgres/base/1/13509 differ diff --git a/starpost/postgres/base/1/13509_fsm b/starpost/postgres/base/1/13509_fsm new file mode 100644 index 0000000..a836ddf Binary files /dev/null and b/starpost/postgres/base/1/13509_fsm differ diff --git a/starpost/postgres/base/1/13509_vm b/starpost/postgres/base/1/13509_vm new file mode 100644 index 0000000..2413a11 Binary files /dev/null and b/starpost/postgres/base/1/13509_vm differ diff --git a/starpost/postgres/base/1/13512 b/starpost/postgres/base/1/13512 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/13513 b/starpost/postgres/base/1/13513 new file mode 100644 index 0000000..b39e7f9 Binary files /dev/null and b/starpost/postgres/base/1/13513 differ diff --git a/starpost/postgres/base/1/1417 b/starpost/postgres/base/1/1417 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/1418 b/starpost/postgres/base/1/1418 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/174 b/starpost/postgres/base/1/174 new file mode 100644 index 0000000..fedcb88 Binary files /dev/null and b/starpost/postgres/base/1/174 differ diff --git a/starpost/postgres/base/1/175 b/starpost/postgres/base/1/175 new file mode 100644 index 0000000..7ee5b4a Binary files /dev/null and b/starpost/postgres/base/1/175 differ diff --git a/starpost/postgres/base/1/2187 b/starpost/postgres/base/1/2187 new file mode 100644 index 0000000..77d8c76 Binary files /dev/null and b/starpost/postgres/base/1/2187 differ diff --git a/starpost/postgres/base/1/2224 b/starpost/postgres/base/1/2224 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/2228 b/starpost/postgres/base/1/2228 new file mode 100644 index 0000000..738f259 Binary files /dev/null and b/starpost/postgres/base/1/2228 differ diff --git a/starpost/postgres/base/1/2328 b/starpost/postgres/base/1/2328 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/2336 b/starpost/postgres/base/1/2336 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/2337 b/starpost/postgres/base/1/2337 new file mode 100644 index 0000000..b706ef8 Binary files /dev/null and b/starpost/postgres/base/1/2337 differ diff --git a/starpost/postgres/base/1/2579 b/starpost/postgres/base/1/2579 new file mode 100644 index 0000000..556006d Binary files /dev/null and b/starpost/postgres/base/1/2579 differ diff --git a/starpost/postgres/base/1/2600 b/starpost/postgres/base/1/2600 new file mode 100644 index 0000000..d98ee62 Binary files /dev/null and b/starpost/postgres/base/1/2600 differ diff --git a/starpost/postgres/base/1/2600_fsm b/starpost/postgres/base/1/2600_fsm new file mode 100644 index 0000000..0938592 Binary files /dev/null and b/starpost/postgres/base/1/2600_fsm differ diff --git a/starpost/postgres/base/1/2600_vm b/starpost/postgres/base/1/2600_vm new file mode 100644 index 0000000..93bc475 Binary files /dev/null and b/starpost/postgres/base/1/2600_vm differ diff --git a/starpost/postgres/base/1/2601 b/starpost/postgres/base/1/2601 new file mode 100644 index 0000000..d8001c8 Binary files /dev/null and b/starpost/postgres/base/1/2601 differ diff --git a/starpost/postgres/base/1/2601_fsm b/starpost/postgres/base/1/2601_fsm new file mode 100644 index 0000000..d388044 Binary files /dev/null and b/starpost/postgres/base/1/2601_fsm differ diff --git a/starpost/postgres/base/1/2601_vm b/starpost/postgres/base/1/2601_vm new file mode 100644 index 0000000..058f7ce Binary files /dev/null and b/starpost/postgres/base/1/2601_vm differ diff --git a/starpost/postgres/base/1/2602 b/starpost/postgres/base/1/2602 new file mode 100644 index 0000000..4a27b0a Binary files /dev/null and b/starpost/postgres/base/1/2602 differ diff --git a/starpost/postgres/base/1/2602_fsm b/starpost/postgres/base/1/2602_fsm new file mode 100644 index 0000000..23170d8 Binary files /dev/null and b/starpost/postgres/base/1/2602_fsm differ diff --git a/starpost/postgres/base/1/2602_vm b/starpost/postgres/base/1/2602_vm new file mode 100644 index 0000000..22487c6 Binary files /dev/null and b/starpost/postgres/base/1/2602_vm differ diff --git a/starpost/postgres/base/1/2603 b/starpost/postgres/base/1/2603 new file mode 100644 index 0000000..d511af5 Binary files /dev/null and b/starpost/postgres/base/1/2603 differ diff --git a/starpost/postgres/base/1/2603_fsm b/starpost/postgres/base/1/2603_fsm new file mode 100644 index 0000000..949bd18 Binary files /dev/null and b/starpost/postgres/base/1/2603_fsm differ diff --git a/starpost/postgres/base/1/2603_vm b/starpost/postgres/base/1/2603_vm new file mode 100644 index 0000000..e29ade0 Binary files /dev/null and b/starpost/postgres/base/1/2603_vm differ diff --git a/starpost/postgres/base/1/2604 b/starpost/postgres/base/1/2604 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/2605 b/starpost/postgres/base/1/2605 new file mode 100644 index 0000000..eeaa7ea Binary files /dev/null and b/starpost/postgres/base/1/2605 differ diff --git a/starpost/postgres/base/1/2605_fsm b/starpost/postgres/base/1/2605_fsm new file mode 100644 index 0000000..f3b92bf Binary files /dev/null and b/starpost/postgres/base/1/2605_fsm differ diff --git a/starpost/postgres/base/1/2605_vm b/starpost/postgres/base/1/2605_vm new file mode 100644 index 0000000..24d1473 Binary files /dev/null and b/starpost/postgres/base/1/2605_vm differ diff --git a/starpost/postgres/base/1/2606 b/starpost/postgres/base/1/2606 new file mode 100644 index 0000000..2b56312 Binary files /dev/null and b/starpost/postgres/base/1/2606 differ diff --git a/starpost/postgres/base/1/2606_fsm b/starpost/postgres/base/1/2606_fsm new file mode 100644 index 0000000..267454e Binary files /dev/null and b/starpost/postgres/base/1/2606_fsm differ diff --git a/starpost/postgres/base/1/2606_vm b/starpost/postgres/base/1/2606_vm new file mode 100644 index 0000000..eeb8ee2 Binary files /dev/null and b/starpost/postgres/base/1/2606_vm differ diff --git a/starpost/postgres/base/1/2607 b/starpost/postgres/base/1/2607 new file mode 100644 index 0000000..bfad49a Binary files /dev/null and b/starpost/postgres/base/1/2607 differ diff --git a/starpost/postgres/base/1/2607_fsm b/starpost/postgres/base/1/2607_fsm new file mode 100644 index 0000000..80ac8b1 Binary files /dev/null and b/starpost/postgres/base/1/2607_fsm differ diff --git a/starpost/postgres/base/1/2607_vm b/starpost/postgres/base/1/2607_vm new file mode 100644 index 0000000..c60487f Binary files /dev/null and b/starpost/postgres/base/1/2607_vm differ diff --git a/starpost/postgres/base/1/2608 b/starpost/postgres/base/1/2608 new file mode 100644 index 0000000..23cfc40 Binary files /dev/null and b/starpost/postgres/base/1/2608 differ diff --git a/starpost/postgres/base/1/2608_fsm b/starpost/postgres/base/1/2608_fsm new file mode 100644 index 0000000..95081cd Binary files /dev/null and b/starpost/postgres/base/1/2608_fsm differ diff --git a/starpost/postgres/base/1/2608_vm b/starpost/postgres/base/1/2608_vm new file mode 100644 index 0000000..0c661e1 Binary files /dev/null and b/starpost/postgres/base/1/2608_vm differ diff --git a/starpost/postgres/base/1/2609 b/starpost/postgres/base/1/2609 new file mode 100644 index 0000000..faa6e96 Binary files /dev/null and b/starpost/postgres/base/1/2609 differ diff --git a/starpost/postgres/base/1/2609_fsm b/starpost/postgres/base/1/2609_fsm new file mode 100644 index 0000000..c2980be Binary files /dev/null and b/starpost/postgres/base/1/2609_fsm differ diff --git a/starpost/postgres/base/1/2609_vm b/starpost/postgres/base/1/2609_vm new file mode 100644 index 0000000..d82ac29 Binary files /dev/null and b/starpost/postgres/base/1/2609_vm differ diff --git a/starpost/postgres/base/1/2610 b/starpost/postgres/base/1/2610 new file mode 100644 index 0000000..c1db3ac Binary files /dev/null and b/starpost/postgres/base/1/2610 differ diff --git a/starpost/postgres/base/1/2610_fsm b/starpost/postgres/base/1/2610_fsm new file mode 100644 index 0000000..ecbcb5f Binary files /dev/null and b/starpost/postgres/base/1/2610_fsm differ diff --git a/starpost/postgres/base/1/2610_vm b/starpost/postgres/base/1/2610_vm new file mode 100644 index 0000000..d59baf0 Binary files /dev/null and b/starpost/postgres/base/1/2610_vm differ diff --git a/starpost/postgres/base/1/2611 b/starpost/postgres/base/1/2611 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/2612 b/starpost/postgres/base/1/2612 new file mode 100644 index 0000000..5f425a8 Binary files /dev/null and b/starpost/postgres/base/1/2612 differ diff --git a/starpost/postgres/base/1/2612_fsm b/starpost/postgres/base/1/2612_fsm new file mode 100644 index 0000000..877976a Binary files /dev/null and b/starpost/postgres/base/1/2612_fsm differ diff --git a/starpost/postgres/base/1/2612_vm b/starpost/postgres/base/1/2612_vm new file mode 100644 index 0000000..a035ede Binary files /dev/null and b/starpost/postgres/base/1/2612_vm differ diff --git a/starpost/postgres/base/1/2613 b/starpost/postgres/base/1/2613 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/2615 b/starpost/postgres/base/1/2615 new file mode 100644 index 0000000..c11828a Binary files /dev/null and b/starpost/postgres/base/1/2615 differ diff --git a/starpost/postgres/base/1/2615_fsm b/starpost/postgres/base/1/2615_fsm new file mode 100644 index 0000000..d041693 Binary files /dev/null and b/starpost/postgres/base/1/2615_fsm differ diff --git a/starpost/postgres/base/1/2615_vm b/starpost/postgres/base/1/2615_vm new file mode 100644 index 0000000..fd02aae Binary files /dev/null and b/starpost/postgres/base/1/2615_vm differ diff --git a/starpost/postgres/base/1/2616 b/starpost/postgres/base/1/2616 new file mode 100644 index 0000000..0d60d79 Binary files /dev/null and b/starpost/postgres/base/1/2616 differ diff --git a/starpost/postgres/base/1/2616_fsm b/starpost/postgres/base/1/2616_fsm new file mode 100644 index 0000000..cb924c9 Binary files /dev/null and b/starpost/postgres/base/1/2616_fsm differ diff --git a/starpost/postgres/base/1/2616_vm b/starpost/postgres/base/1/2616_vm new file mode 100644 index 0000000..d9d3ba6 Binary files /dev/null and b/starpost/postgres/base/1/2616_vm differ diff --git a/starpost/postgres/base/1/2617 b/starpost/postgres/base/1/2617 new file mode 100644 index 0000000..bcdfc18 Binary files /dev/null and b/starpost/postgres/base/1/2617 differ diff --git a/starpost/postgres/base/1/2617_fsm b/starpost/postgres/base/1/2617_fsm new file mode 100644 index 0000000..29d6066 Binary files /dev/null and b/starpost/postgres/base/1/2617_fsm differ diff --git a/starpost/postgres/base/1/2617_vm b/starpost/postgres/base/1/2617_vm new file mode 100644 index 0000000..b182c7e Binary files /dev/null and b/starpost/postgres/base/1/2617_vm differ diff --git a/starpost/postgres/base/1/2618 b/starpost/postgres/base/1/2618 new file mode 100644 index 0000000..4e400e4 Binary files /dev/null and b/starpost/postgres/base/1/2618 differ diff --git a/starpost/postgres/base/1/2618_fsm b/starpost/postgres/base/1/2618_fsm new file mode 100644 index 0000000..bcee926 Binary files /dev/null and b/starpost/postgres/base/1/2618_fsm differ diff --git a/starpost/postgres/base/1/2618_vm b/starpost/postgres/base/1/2618_vm new file mode 100644 index 0000000..6a0ae79 Binary files /dev/null and b/starpost/postgres/base/1/2618_vm differ diff --git a/starpost/postgres/base/1/2619 b/starpost/postgres/base/1/2619 new file mode 100644 index 0000000..9be3abe Binary files /dev/null and b/starpost/postgres/base/1/2619 differ diff --git a/starpost/postgres/base/1/2619_fsm b/starpost/postgres/base/1/2619_fsm new file mode 100644 index 0000000..d12c111 Binary files /dev/null and b/starpost/postgres/base/1/2619_fsm differ diff --git a/starpost/postgres/base/1/2619_vm b/starpost/postgres/base/1/2619_vm new file mode 100644 index 0000000..2a8fc8f Binary files /dev/null and b/starpost/postgres/base/1/2619_vm differ diff --git a/starpost/postgres/base/1/2620 b/starpost/postgres/base/1/2620 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/2650 b/starpost/postgres/base/1/2650 new file mode 100644 index 0000000..ef4f21b Binary files /dev/null and b/starpost/postgres/base/1/2650 differ diff --git a/starpost/postgres/base/1/2651 b/starpost/postgres/base/1/2651 new file mode 100644 index 0000000..9d21e32 Binary files /dev/null and b/starpost/postgres/base/1/2651 differ diff --git a/starpost/postgres/base/1/2652 b/starpost/postgres/base/1/2652 new file mode 100644 index 0000000..ab6e13e Binary files /dev/null and b/starpost/postgres/base/1/2652 differ diff --git a/starpost/postgres/base/1/2653 b/starpost/postgres/base/1/2653 new file mode 100644 index 0000000..4c032c8 Binary files /dev/null and b/starpost/postgres/base/1/2653 differ diff --git a/starpost/postgres/base/1/2654 b/starpost/postgres/base/1/2654 new file mode 100644 index 0000000..53aa6fc Binary files /dev/null and b/starpost/postgres/base/1/2654 differ diff --git a/starpost/postgres/base/1/2655 b/starpost/postgres/base/1/2655 new file mode 100644 index 0000000..0b22aae Binary files /dev/null and b/starpost/postgres/base/1/2655 differ diff --git a/starpost/postgres/base/1/2656 b/starpost/postgres/base/1/2656 new file mode 100644 index 0000000..0e2e0bc Binary files /dev/null and b/starpost/postgres/base/1/2656 differ diff --git a/starpost/postgres/base/1/2657 b/starpost/postgres/base/1/2657 new file mode 100644 index 0000000..a87fd85 Binary files /dev/null and b/starpost/postgres/base/1/2657 differ diff --git a/starpost/postgres/base/1/2658 b/starpost/postgres/base/1/2658 new file mode 100644 index 0000000..e3155fb Binary files /dev/null and b/starpost/postgres/base/1/2658 differ diff --git a/starpost/postgres/base/1/2659 b/starpost/postgres/base/1/2659 new file mode 100644 index 0000000..98e79cc Binary files /dev/null and b/starpost/postgres/base/1/2659 differ diff --git a/starpost/postgres/base/1/2660 b/starpost/postgres/base/1/2660 new file mode 100644 index 0000000..3a7a1d2 Binary files /dev/null and b/starpost/postgres/base/1/2660 differ diff --git a/starpost/postgres/base/1/2661 b/starpost/postgres/base/1/2661 new file mode 100644 index 0000000..aa5178a Binary files /dev/null and b/starpost/postgres/base/1/2661 differ diff --git a/starpost/postgres/base/1/2662 b/starpost/postgres/base/1/2662 new file mode 100644 index 0000000..bf3a721 Binary files /dev/null and b/starpost/postgres/base/1/2662 differ diff --git a/starpost/postgres/base/1/2663 b/starpost/postgres/base/1/2663 new file mode 100644 index 0000000..f5aa563 Binary files /dev/null and b/starpost/postgres/base/1/2663 differ diff --git a/starpost/postgres/base/1/2664 b/starpost/postgres/base/1/2664 new file mode 100644 index 0000000..12b1f5b Binary files /dev/null and b/starpost/postgres/base/1/2664 differ diff --git a/starpost/postgres/base/1/2665 b/starpost/postgres/base/1/2665 new file mode 100644 index 0000000..2a5a6de Binary files /dev/null and b/starpost/postgres/base/1/2665 differ diff --git a/starpost/postgres/base/1/2666 b/starpost/postgres/base/1/2666 new file mode 100644 index 0000000..d87561c Binary files /dev/null and b/starpost/postgres/base/1/2666 differ diff --git a/starpost/postgres/base/1/2667 b/starpost/postgres/base/1/2667 new file mode 100644 index 0000000..f8b060b Binary files /dev/null and b/starpost/postgres/base/1/2667 differ diff --git a/starpost/postgres/base/1/2668 b/starpost/postgres/base/1/2668 new file mode 100644 index 0000000..c5baf1d Binary files /dev/null and b/starpost/postgres/base/1/2668 differ diff --git a/starpost/postgres/base/1/2669 b/starpost/postgres/base/1/2669 new file mode 100644 index 0000000..7379bc3 Binary files /dev/null and b/starpost/postgres/base/1/2669 differ diff --git a/starpost/postgres/base/1/2670 b/starpost/postgres/base/1/2670 new file mode 100644 index 0000000..5b35b4d Binary files /dev/null and b/starpost/postgres/base/1/2670 differ diff --git a/starpost/postgres/base/1/2673 b/starpost/postgres/base/1/2673 new file mode 100644 index 0000000..2e78353 Binary files /dev/null and b/starpost/postgres/base/1/2673 differ diff --git a/starpost/postgres/base/1/2674 b/starpost/postgres/base/1/2674 new file mode 100644 index 0000000..40852a0 Binary files /dev/null and b/starpost/postgres/base/1/2674 differ diff --git a/starpost/postgres/base/1/2675 b/starpost/postgres/base/1/2675 new file mode 100644 index 0000000..4a4b1fd Binary files /dev/null and b/starpost/postgres/base/1/2675 differ diff --git a/starpost/postgres/base/1/2678 b/starpost/postgres/base/1/2678 new file mode 100644 index 0000000..2086279 Binary files /dev/null and b/starpost/postgres/base/1/2678 differ diff --git a/starpost/postgres/base/1/2679 b/starpost/postgres/base/1/2679 new file mode 100644 index 0000000..8ddcf90 Binary files /dev/null and b/starpost/postgres/base/1/2679 differ diff --git a/starpost/postgres/base/1/2680 b/starpost/postgres/base/1/2680 new file mode 100644 index 0000000..e15ddb4 Binary files /dev/null and b/starpost/postgres/base/1/2680 differ diff --git a/starpost/postgres/base/1/2681 b/starpost/postgres/base/1/2681 new file mode 100644 index 0000000..bbeb640 Binary files /dev/null and b/starpost/postgres/base/1/2681 differ diff --git a/starpost/postgres/base/1/2682 b/starpost/postgres/base/1/2682 new file mode 100644 index 0000000..28f957f Binary files /dev/null and b/starpost/postgres/base/1/2682 differ diff --git a/starpost/postgres/base/1/2683 b/starpost/postgres/base/1/2683 new file mode 100644 index 0000000..014cbee Binary files /dev/null and b/starpost/postgres/base/1/2683 differ diff --git a/starpost/postgres/base/1/2684 b/starpost/postgres/base/1/2684 new file mode 100644 index 0000000..d7cd584 Binary files /dev/null and b/starpost/postgres/base/1/2684 differ diff --git a/starpost/postgres/base/1/2685 b/starpost/postgres/base/1/2685 new file mode 100644 index 0000000..01a32e9 Binary files /dev/null and b/starpost/postgres/base/1/2685 differ diff --git a/starpost/postgres/base/1/2686 b/starpost/postgres/base/1/2686 new file mode 100644 index 0000000..51e4357 Binary files /dev/null and b/starpost/postgres/base/1/2686 differ diff --git a/starpost/postgres/base/1/2687 b/starpost/postgres/base/1/2687 new file mode 100644 index 0000000..8df59d1 Binary files /dev/null and b/starpost/postgres/base/1/2687 differ diff --git a/starpost/postgres/base/1/2688 b/starpost/postgres/base/1/2688 new file mode 100644 index 0000000..f5448dc Binary files /dev/null and b/starpost/postgres/base/1/2688 differ diff --git a/starpost/postgres/base/1/2689 b/starpost/postgres/base/1/2689 new file mode 100644 index 0000000..8f8223b Binary files /dev/null and b/starpost/postgres/base/1/2689 differ diff --git a/starpost/postgres/base/1/2690 b/starpost/postgres/base/1/2690 new file mode 100644 index 0000000..273454a Binary files /dev/null and b/starpost/postgres/base/1/2690 differ diff --git a/starpost/postgres/base/1/2691 b/starpost/postgres/base/1/2691 new file mode 100644 index 0000000..c816edc Binary files /dev/null and b/starpost/postgres/base/1/2691 differ diff --git a/starpost/postgres/base/1/2692 b/starpost/postgres/base/1/2692 new file mode 100644 index 0000000..6dee73d Binary files /dev/null and b/starpost/postgres/base/1/2692 differ diff --git a/starpost/postgres/base/1/2693 b/starpost/postgres/base/1/2693 new file mode 100644 index 0000000..78bee54 Binary files /dev/null and b/starpost/postgres/base/1/2693 differ diff --git a/starpost/postgres/base/1/2696 b/starpost/postgres/base/1/2696 new file mode 100644 index 0000000..63ab538 Binary files /dev/null and b/starpost/postgres/base/1/2696 differ diff --git a/starpost/postgres/base/1/2699 b/starpost/postgres/base/1/2699 new file mode 100644 index 0000000..8417313 Binary files /dev/null and b/starpost/postgres/base/1/2699 differ diff --git a/starpost/postgres/base/1/2701 b/starpost/postgres/base/1/2701 new file mode 100644 index 0000000..8892de2 Binary files /dev/null and b/starpost/postgres/base/1/2701 differ diff --git a/starpost/postgres/base/1/2702 b/starpost/postgres/base/1/2702 new file mode 100644 index 0000000..c40e5aa Binary files /dev/null and b/starpost/postgres/base/1/2702 differ diff --git a/starpost/postgres/base/1/2703 b/starpost/postgres/base/1/2703 new file mode 100644 index 0000000..2a9cbd8 Binary files /dev/null and b/starpost/postgres/base/1/2703 differ diff --git a/starpost/postgres/base/1/2704 b/starpost/postgres/base/1/2704 new file mode 100644 index 0000000..36b4068 Binary files /dev/null and b/starpost/postgres/base/1/2704 differ diff --git a/starpost/postgres/base/1/2753 b/starpost/postgres/base/1/2753 new file mode 100644 index 0000000..3c16dff Binary files /dev/null and b/starpost/postgres/base/1/2753 differ diff --git a/starpost/postgres/base/1/2753_fsm b/starpost/postgres/base/1/2753_fsm new file mode 100644 index 0000000..642bce3 Binary files /dev/null and b/starpost/postgres/base/1/2753_fsm differ diff --git a/starpost/postgres/base/1/2753_vm b/starpost/postgres/base/1/2753_vm new file mode 100644 index 0000000..f7e91c6 Binary files /dev/null and b/starpost/postgres/base/1/2753_vm differ diff --git a/starpost/postgres/base/1/2754 b/starpost/postgres/base/1/2754 new file mode 100644 index 0000000..f3df39d Binary files /dev/null and b/starpost/postgres/base/1/2754 differ diff --git a/starpost/postgres/base/1/2755 b/starpost/postgres/base/1/2755 new file mode 100644 index 0000000..cc671dc Binary files /dev/null and b/starpost/postgres/base/1/2755 differ diff --git a/starpost/postgres/base/1/2756 b/starpost/postgres/base/1/2756 new file mode 100644 index 0000000..6a6c87e Binary files /dev/null and b/starpost/postgres/base/1/2756 differ diff --git a/starpost/postgres/base/1/2757 b/starpost/postgres/base/1/2757 new file mode 100644 index 0000000..57830cb Binary files /dev/null and b/starpost/postgres/base/1/2757 differ diff --git a/starpost/postgres/base/1/2830 b/starpost/postgres/base/1/2830 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/2831 b/starpost/postgres/base/1/2831 new file mode 100644 index 0000000..6c30e94 Binary files /dev/null and b/starpost/postgres/base/1/2831 differ diff --git a/starpost/postgres/base/1/2832 b/starpost/postgres/base/1/2832 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/2833 b/starpost/postgres/base/1/2833 new file mode 100644 index 0000000..e364449 Binary files /dev/null and b/starpost/postgres/base/1/2833 differ diff --git a/starpost/postgres/base/1/2834 b/starpost/postgres/base/1/2834 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/2835 b/starpost/postgres/base/1/2835 new file mode 100644 index 0000000..b028c65 Binary files /dev/null and b/starpost/postgres/base/1/2835 differ diff --git a/starpost/postgres/base/1/2836 b/starpost/postgres/base/1/2836 new file mode 100644 index 0000000..e678cbd Binary files /dev/null and b/starpost/postgres/base/1/2836 differ diff --git a/starpost/postgres/base/1/2836_fsm b/starpost/postgres/base/1/2836_fsm new file mode 100644 index 0000000..06e1e26 Binary files /dev/null and b/starpost/postgres/base/1/2836_fsm differ diff --git a/starpost/postgres/base/1/2836_vm b/starpost/postgres/base/1/2836_vm new file mode 100644 index 0000000..cef3ff9 Binary files /dev/null and b/starpost/postgres/base/1/2836_vm differ diff --git a/starpost/postgres/base/1/2837 b/starpost/postgres/base/1/2837 new file mode 100644 index 0000000..2925518 Binary files /dev/null and b/starpost/postgres/base/1/2837 differ diff --git a/starpost/postgres/base/1/2838 b/starpost/postgres/base/1/2838 new file mode 100644 index 0000000..bed85ee Binary files /dev/null and b/starpost/postgres/base/1/2838 differ diff --git a/starpost/postgres/base/1/2838_fsm b/starpost/postgres/base/1/2838_fsm new file mode 100644 index 0000000..b9e860e Binary files /dev/null and b/starpost/postgres/base/1/2838_fsm differ diff --git a/starpost/postgres/base/1/2838_vm b/starpost/postgres/base/1/2838_vm new file mode 100644 index 0000000..d2933ea Binary files /dev/null and b/starpost/postgres/base/1/2838_vm differ diff --git a/starpost/postgres/base/1/2839 b/starpost/postgres/base/1/2839 new file mode 100644 index 0000000..b7f7c44 Binary files /dev/null and b/starpost/postgres/base/1/2839 differ diff --git a/starpost/postgres/base/1/2840 b/starpost/postgres/base/1/2840 new file mode 100644 index 0000000..eb3409e Binary files /dev/null and b/starpost/postgres/base/1/2840 differ diff --git a/starpost/postgres/base/1/2840_fsm b/starpost/postgres/base/1/2840_fsm new file mode 100644 index 0000000..6a8cb34 Binary files /dev/null and b/starpost/postgres/base/1/2840_fsm differ diff --git a/starpost/postgres/base/1/2840_vm b/starpost/postgres/base/1/2840_vm new file mode 100644 index 0000000..12991d1 Binary files /dev/null and b/starpost/postgres/base/1/2840_vm differ diff --git a/starpost/postgres/base/1/2841 b/starpost/postgres/base/1/2841 new file mode 100644 index 0000000..fa09072 Binary files /dev/null and b/starpost/postgres/base/1/2841 differ diff --git a/starpost/postgres/base/1/2995 b/starpost/postgres/base/1/2995 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/2996 b/starpost/postgres/base/1/2996 new file mode 100644 index 0000000..9bd6faf Binary files /dev/null and b/starpost/postgres/base/1/2996 differ diff --git a/starpost/postgres/base/1/3079 b/starpost/postgres/base/1/3079 new file mode 100644 index 0000000..647d3e9 Binary files /dev/null and b/starpost/postgres/base/1/3079 differ diff --git a/starpost/postgres/base/1/3079_fsm b/starpost/postgres/base/1/3079_fsm new file mode 100644 index 0000000..7732d22 Binary files /dev/null and b/starpost/postgres/base/1/3079_fsm differ diff --git a/starpost/postgres/base/1/3079_vm b/starpost/postgres/base/1/3079_vm new file mode 100644 index 0000000..3438618 Binary files /dev/null and b/starpost/postgres/base/1/3079_vm differ diff --git a/starpost/postgres/base/1/3080 b/starpost/postgres/base/1/3080 new file mode 100644 index 0000000..32632ec Binary files /dev/null and b/starpost/postgres/base/1/3080 differ diff --git a/starpost/postgres/base/1/3081 b/starpost/postgres/base/1/3081 new file mode 100644 index 0000000..f1b9e01 Binary files /dev/null and b/starpost/postgres/base/1/3081 differ diff --git a/starpost/postgres/base/1/3085 b/starpost/postgres/base/1/3085 new file mode 100644 index 0000000..f688645 Binary files /dev/null and b/starpost/postgres/base/1/3085 differ diff --git a/starpost/postgres/base/1/3118 b/starpost/postgres/base/1/3118 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/3119 b/starpost/postgres/base/1/3119 new file mode 100644 index 0000000..8524de7 Binary files /dev/null and b/starpost/postgres/base/1/3119 differ diff --git a/starpost/postgres/base/1/3164 b/starpost/postgres/base/1/3164 new file mode 100644 index 0000000..8cc619f Binary files /dev/null and b/starpost/postgres/base/1/3164 differ diff --git a/starpost/postgres/base/1/3256 b/starpost/postgres/base/1/3256 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/3257 b/starpost/postgres/base/1/3257 new file mode 100644 index 0000000..6f325ab Binary files /dev/null and b/starpost/postgres/base/1/3257 differ diff --git a/starpost/postgres/base/1/3258 b/starpost/postgres/base/1/3258 new file mode 100644 index 0000000..10c3c94 Binary files /dev/null and b/starpost/postgres/base/1/3258 differ diff --git a/starpost/postgres/base/1/3350 b/starpost/postgres/base/1/3350 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/3351 b/starpost/postgres/base/1/3351 new file mode 100644 index 0000000..2bfef7f Binary files /dev/null and b/starpost/postgres/base/1/3351 differ diff --git a/starpost/postgres/base/1/3379 b/starpost/postgres/base/1/3379 new file mode 100644 index 0000000..b41a45f Binary files /dev/null and b/starpost/postgres/base/1/3379 differ diff --git a/starpost/postgres/base/1/3380 b/starpost/postgres/base/1/3380 new file mode 100644 index 0000000..f9d290e Binary files /dev/null and b/starpost/postgres/base/1/3380 differ diff --git a/starpost/postgres/base/1/3381 b/starpost/postgres/base/1/3381 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/3394 b/starpost/postgres/base/1/3394 new file mode 100644 index 0000000..3ada57d Binary files /dev/null and b/starpost/postgres/base/1/3394 differ diff --git a/starpost/postgres/base/1/3394_fsm b/starpost/postgres/base/1/3394_fsm new file mode 100644 index 0000000..38ac5f8 Binary files /dev/null and b/starpost/postgres/base/1/3394_fsm differ diff --git a/starpost/postgres/base/1/3394_vm b/starpost/postgres/base/1/3394_vm new file mode 100644 index 0000000..5545f17 Binary files /dev/null and b/starpost/postgres/base/1/3394_vm differ diff --git a/starpost/postgres/base/1/3395 b/starpost/postgres/base/1/3395 new file mode 100644 index 0000000..48cf9ba Binary files /dev/null and b/starpost/postgres/base/1/3395 differ diff --git a/starpost/postgres/base/1/3429 b/starpost/postgres/base/1/3429 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/3430 b/starpost/postgres/base/1/3430 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/3431 b/starpost/postgres/base/1/3431 new file mode 100644 index 0000000..a890bbf Binary files /dev/null and b/starpost/postgres/base/1/3431 differ diff --git a/starpost/postgres/base/1/3433 b/starpost/postgres/base/1/3433 new file mode 100644 index 0000000..b9e444b Binary files /dev/null and b/starpost/postgres/base/1/3433 differ diff --git a/starpost/postgres/base/1/3439 b/starpost/postgres/base/1/3439 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/3440 b/starpost/postgres/base/1/3440 new file mode 100644 index 0000000..5b55040 Binary files /dev/null and b/starpost/postgres/base/1/3440 differ diff --git a/starpost/postgres/base/1/3455 b/starpost/postgres/base/1/3455 new file mode 100644 index 0000000..765545a Binary files /dev/null and b/starpost/postgres/base/1/3455 differ diff --git a/starpost/postgres/base/1/3456 b/starpost/postgres/base/1/3456 new file mode 100644 index 0000000..dbe1a53 Binary files /dev/null and b/starpost/postgres/base/1/3456 differ diff --git a/starpost/postgres/base/1/3456_fsm b/starpost/postgres/base/1/3456_fsm new file mode 100644 index 0000000..0ff6488 Binary files /dev/null and b/starpost/postgres/base/1/3456_fsm differ diff --git a/starpost/postgres/base/1/3456_vm b/starpost/postgres/base/1/3456_vm new file mode 100644 index 0000000..fa6477f Binary files /dev/null and b/starpost/postgres/base/1/3456_vm differ diff --git a/starpost/postgres/base/1/3466 b/starpost/postgres/base/1/3466 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/3467 b/starpost/postgres/base/1/3467 new file mode 100644 index 0000000..188a5e6 Binary files /dev/null and b/starpost/postgres/base/1/3467 differ diff --git a/starpost/postgres/base/1/3468 b/starpost/postgres/base/1/3468 new file mode 100644 index 0000000..00d26fe Binary files /dev/null and b/starpost/postgres/base/1/3468 differ diff --git a/starpost/postgres/base/1/3501 b/starpost/postgres/base/1/3501 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/3502 b/starpost/postgres/base/1/3502 new file mode 100644 index 0000000..51e62aa Binary files /dev/null and b/starpost/postgres/base/1/3502 differ diff --git a/starpost/postgres/base/1/3503 b/starpost/postgres/base/1/3503 new file mode 100644 index 0000000..818ee9e Binary files /dev/null and b/starpost/postgres/base/1/3503 differ diff --git a/starpost/postgres/base/1/3534 b/starpost/postgres/base/1/3534 new file mode 100644 index 0000000..338d308 Binary files /dev/null and b/starpost/postgres/base/1/3534 differ diff --git a/starpost/postgres/base/1/3541 b/starpost/postgres/base/1/3541 new file mode 100644 index 0000000..40869ad Binary files /dev/null and b/starpost/postgres/base/1/3541 differ diff --git a/starpost/postgres/base/1/3541_fsm b/starpost/postgres/base/1/3541_fsm new file mode 100644 index 0000000..a3a2de4 Binary files /dev/null and b/starpost/postgres/base/1/3541_fsm differ diff --git a/starpost/postgres/base/1/3541_vm b/starpost/postgres/base/1/3541_vm new file mode 100644 index 0000000..7a78303 Binary files /dev/null and b/starpost/postgres/base/1/3541_vm differ diff --git a/starpost/postgres/base/1/3542 b/starpost/postgres/base/1/3542 new file mode 100644 index 0000000..ced0066 Binary files /dev/null and b/starpost/postgres/base/1/3542 differ diff --git a/starpost/postgres/base/1/3574 b/starpost/postgres/base/1/3574 new file mode 100644 index 0000000..b026df1 Binary files /dev/null and b/starpost/postgres/base/1/3574 differ diff --git a/starpost/postgres/base/1/3575 b/starpost/postgres/base/1/3575 new file mode 100644 index 0000000..bdec532 Binary files /dev/null and b/starpost/postgres/base/1/3575 differ diff --git a/starpost/postgres/base/1/3576 b/starpost/postgres/base/1/3576 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/3596 b/starpost/postgres/base/1/3596 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/3597 b/starpost/postgres/base/1/3597 new file mode 100644 index 0000000..6947306 Binary files /dev/null and b/starpost/postgres/base/1/3597 differ diff --git a/starpost/postgres/base/1/3598 b/starpost/postgres/base/1/3598 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/3599 b/starpost/postgres/base/1/3599 new file mode 100644 index 0000000..32bf577 Binary files /dev/null and b/starpost/postgres/base/1/3599 differ diff --git a/starpost/postgres/base/1/3600 b/starpost/postgres/base/1/3600 new file mode 100644 index 0000000..6cca16e Binary files /dev/null and b/starpost/postgres/base/1/3600 differ diff --git a/starpost/postgres/base/1/3600_fsm b/starpost/postgres/base/1/3600_fsm new file mode 100644 index 0000000..cebec19 Binary files /dev/null and b/starpost/postgres/base/1/3600_fsm differ diff --git a/starpost/postgres/base/1/3600_vm b/starpost/postgres/base/1/3600_vm new file mode 100644 index 0000000..07044d1 Binary files /dev/null and b/starpost/postgres/base/1/3600_vm differ diff --git a/starpost/postgres/base/1/3601 b/starpost/postgres/base/1/3601 new file mode 100644 index 0000000..04c846e Binary files /dev/null and b/starpost/postgres/base/1/3601 differ diff --git a/starpost/postgres/base/1/3601_fsm b/starpost/postgres/base/1/3601_fsm new file mode 100644 index 0000000..7732d22 Binary files /dev/null and b/starpost/postgres/base/1/3601_fsm differ diff --git a/starpost/postgres/base/1/3601_vm b/starpost/postgres/base/1/3601_vm new file mode 100644 index 0000000..22b9666 Binary files /dev/null and b/starpost/postgres/base/1/3601_vm differ diff --git a/starpost/postgres/base/1/3602 b/starpost/postgres/base/1/3602 new file mode 100644 index 0000000..d1c92d9 Binary files /dev/null and b/starpost/postgres/base/1/3602 differ diff --git a/starpost/postgres/base/1/3602_fsm b/starpost/postgres/base/1/3602_fsm new file mode 100644 index 0000000..d7897de Binary files /dev/null and b/starpost/postgres/base/1/3602_fsm differ diff --git a/starpost/postgres/base/1/3602_vm b/starpost/postgres/base/1/3602_vm new file mode 100644 index 0000000..a550486 Binary files /dev/null and b/starpost/postgres/base/1/3602_vm differ diff --git a/starpost/postgres/base/1/3603 b/starpost/postgres/base/1/3603 new file mode 100644 index 0000000..54b0933 Binary files /dev/null and b/starpost/postgres/base/1/3603 differ diff --git a/starpost/postgres/base/1/3603_fsm b/starpost/postgres/base/1/3603_fsm new file mode 100644 index 0000000..c28dd4f Binary files /dev/null and b/starpost/postgres/base/1/3603_fsm differ diff --git a/starpost/postgres/base/1/3603_vm b/starpost/postgres/base/1/3603_vm new file mode 100644 index 0000000..ecac229 Binary files /dev/null and b/starpost/postgres/base/1/3603_vm differ diff --git a/starpost/postgres/base/1/3604 b/starpost/postgres/base/1/3604 new file mode 100644 index 0000000..6c4a813 Binary files /dev/null and b/starpost/postgres/base/1/3604 differ diff --git a/starpost/postgres/base/1/3605 b/starpost/postgres/base/1/3605 new file mode 100644 index 0000000..d21dcb3 Binary files /dev/null and b/starpost/postgres/base/1/3605 differ diff --git a/starpost/postgres/base/1/3606 b/starpost/postgres/base/1/3606 new file mode 100644 index 0000000..5d00237 Binary files /dev/null and b/starpost/postgres/base/1/3606 differ diff --git a/starpost/postgres/base/1/3607 b/starpost/postgres/base/1/3607 new file mode 100644 index 0000000..3a1af44 Binary files /dev/null and b/starpost/postgres/base/1/3607 differ diff --git a/starpost/postgres/base/1/3608 b/starpost/postgres/base/1/3608 new file mode 100644 index 0000000..9d67984 Binary files /dev/null and b/starpost/postgres/base/1/3608 differ diff --git a/starpost/postgres/base/1/3609 b/starpost/postgres/base/1/3609 new file mode 100644 index 0000000..ea3aa7c Binary files /dev/null and b/starpost/postgres/base/1/3609 differ diff --git a/starpost/postgres/base/1/3712 b/starpost/postgres/base/1/3712 new file mode 100644 index 0000000..8d214b5 Binary files /dev/null and b/starpost/postgres/base/1/3712 differ diff --git a/starpost/postgres/base/1/3764 b/starpost/postgres/base/1/3764 new file mode 100644 index 0000000..4b19ab2 Binary files /dev/null and b/starpost/postgres/base/1/3764 differ diff --git a/starpost/postgres/base/1/3764_fsm b/starpost/postgres/base/1/3764_fsm new file mode 100644 index 0000000..f64db4d Binary files /dev/null and b/starpost/postgres/base/1/3764_fsm differ diff --git a/starpost/postgres/base/1/3764_vm b/starpost/postgres/base/1/3764_vm new file mode 100644 index 0000000..be4fe23 Binary files /dev/null and b/starpost/postgres/base/1/3764_vm differ diff --git a/starpost/postgres/base/1/3766 b/starpost/postgres/base/1/3766 new file mode 100644 index 0000000..cbe718c Binary files /dev/null and b/starpost/postgres/base/1/3766 differ diff --git a/starpost/postgres/base/1/3767 b/starpost/postgres/base/1/3767 new file mode 100644 index 0000000..1210714 Binary files /dev/null and b/starpost/postgres/base/1/3767 differ diff --git a/starpost/postgres/base/1/3997 b/starpost/postgres/base/1/3997 new file mode 100644 index 0000000..28b5b4b Binary files /dev/null and b/starpost/postgres/base/1/3997 differ diff --git a/starpost/postgres/base/1/4143 b/starpost/postgres/base/1/4143 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/4144 b/starpost/postgres/base/1/4144 new file mode 100644 index 0000000..781f37a Binary files /dev/null and b/starpost/postgres/base/1/4144 differ diff --git a/starpost/postgres/base/1/4145 b/starpost/postgres/base/1/4145 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/4146 b/starpost/postgres/base/1/4146 new file mode 100644 index 0000000..11ccf7e Binary files /dev/null and b/starpost/postgres/base/1/4146 differ diff --git a/starpost/postgres/base/1/4147 b/starpost/postgres/base/1/4147 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/4148 b/starpost/postgres/base/1/4148 new file mode 100644 index 0000000..7fd05a8 Binary files /dev/null and b/starpost/postgres/base/1/4148 differ diff --git a/starpost/postgres/base/1/4149 b/starpost/postgres/base/1/4149 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/4150 b/starpost/postgres/base/1/4150 new file mode 100644 index 0000000..10171f6 Binary files /dev/null and b/starpost/postgres/base/1/4150 differ diff --git a/starpost/postgres/base/1/4151 b/starpost/postgres/base/1/4151 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/4152 b/starpost/postgres/base/1/4152 new file mode 100644 index 0000000..869a7f3 Binary files /dev/null and b/starpost/postgres/base/1/4152 differ diff --git a/starpost/postgres/base/1/4153 b/starpost/postgres/base/1/4153 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/4154 b/starpost/postgres/base/1/4154 new file mode 100644 index 0000000..bb1dca3 Binary files /dev/null and b/starpost/postgres/base/1/4154 differ diff --git a/starpost/postgres/base/1/4155 b/starpost/postgres/base/1/4155 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/4156 b/starpost/postgres/base/1/4156 new file mode 100644 index 0000000..839ab86 Binary files /dev/null and b/starpost/postgres/base/1/4156 differ diff --git a/starpost/postgres/base/1/4157 b/starpost/postgres/base/1/4157 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/4158 b/starpost/postgres/base/1/4158 new file mode 100644 index 0000000..12e6868 Binary files /dev/null and b/starpost/postgres/base/1/4158 differ diff --git a/starpost/postgres/base/1/4159 b/starpost/postgres/base/1/4159 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/4160 b/starpost/postgres/base/1/4160 new file mode 100644 index 0000000..8b80112 Binary files /dev/null and b/starpost/postgres/base/1/4160 differ diff --git a/starpost/postgres/base/1/4163 b/starpost/postgres/base/1/4163 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/4164 b/starpost/postgres/base/1/4164 new file mode 100644 index 0000000..e86ba95 Binary files /dev/null and b/starpost/postgres/base/1/4164 differ diff --git a/starpost/postgres/base/1/4165 b/starpost/postgres/base/1/4165 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/4166 b/starpost/postgres/base/1/4166 new file mode 100644 index 0000000..f5fc2b6 Binary files /dev/null and b/starpost/postgres/base/1/4166 differ diff --git a/starpost/postgres/base/1/4167 b/starpost/postgres/base/1/4167 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/4168 b/starpost/postgres/base/1/4168 new file mode 100644 index 0000000..fdfe146 Binary files /dev/null and b/starpost/postgres/base/1/4168 differ diff --git a/starpost/postgres/base/1/4169 b/starpost/postgres/base/1/4169 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/4170 b/starpost/postgres/base/1/4170 new file mode 100644 index 0000000..797418b Binary files /dev/null and b/starpost/postgres/base/1/4170 differ diff --git a/starpost/postgres/base/1/4171 b/starpost/postgres/base/1/4171 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/4172 b/starpost/postgres/base/1/4172 new file mode 100644 index 0000000..969a191 Binary files /dev/null and b/starpost/postgres/base/1/4172 differ diff --git a/starpost/postgres/base/1/4173 b/starpost/postgres/base/1/4173 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/4174 b/starpost/postgres/base/1/4174 new file mode 100644 index 0000000..3c4beb7 Binary files /dev/null and b/starpost/postgres/base/1/4174 differ diff --git a/starpost/postgres/base/1/5002 b/starpost/postgres/base/1/5002 new file mode 100644 index 0000000..aefa40d Binary files /dev/null and b/starpost/postgres/base/1/5002 differ diff --git a/starpost/postgres/base/1/548 b/starpost/postgres/base/1/548 new file mode 100644 index 0000000..d6379eb Binary files /dev/null and b/starpost/postgres/base/1/548 differ diff --git a/starpost/postgres/base/1/549 b/starpost/postgres/base/1/549 new file mode 100644 index 0000000..a762ad9 Binary files /dev/null and b/starpost/postgres/base/1/549 differ diff --git a/starpost/postgres/base/1/6102 b/starpost/postgres/base/1/6102 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/6104 b/starpost/postgres/base/1/6104 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/6106 b/starpost/postgres/base/1/6106 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/6110 b/starpost/postgres/base/1/6110 new file mode 100644 index 0000000..42e1920 Binary files /dev/null and b/starpost/postgres/base/1/6110 differ diff --git a/starpost/postgres/base/1/6111 b/starpost/postgres/base/1/6111 new file mode 100644 index 0000000..d012727 Binary files /dev/null and b/starpost/postgres/base/1/6111 differ diff --git a/starpost/postgres/base/1/6112 b/starpost/postgres/base/1/6112 new file mode 100644 index 0000000..293367c Binary files /dev/null and b/starpost/postgres/base/1/6112 differ diff --git a/starpost/postgres/base/1/6113 b/starpost/postgres/base/1/6113 new file mode 100644 index 0000000..542f8fa Binary files /dev/null and b/starpost/postgres/base/1/6113 differ diff --git a/starpost/postgres/base/1/6116 b/starpost/postgres/base/1/6116 new file mode 100644 index 0000000..787d5d1 Binary files /dev/null and b/starpost/postgres/base/1/6116 differ diff --git a/starpost/postgres/base/1/6117 b/starpost/postgres/base/1/6117 new file mode 100644 index 0000000..2b5656b Binary files /dev/null and b/starpost/postgres/base/1/6117 differ diff --git a/starpost/postgres/base/1/6175 b/starpost/postgres/base/1/6175 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/6176 b/starpost/postgres/base/1/6176 new file mode 100644 index 0000000..34cba03 Binary files /dev/null and b/starpost/postgres/base/1/6176 differ diff --git a/starpost/postgres/base/1/6228 b/starpost/postgres/base/1/6228 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/6229 b/starpost/postgres/base/1/6229 new file mode 100644 index 0000000..4839713 Binary files /dev/null and b/starpost/postgres/base/1/6229 differ diff --git a/starpost/postgres/base/1/6237 b/starpost/postgres/base/1/6237 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/6238 b/starpost/postgres/base/1/6238 new file mode 100644 index 0000000..e7c0e8c Binary files /dev/null and b/starpost/postgres/base/1/6238 differ diff --git a/starpost/postgres/base/1/6239 b/starpost/postgres/base/1/6239 new file mode 100644 index 0000000..6c60b50 Binary files /dev/null and b/starpost/postgres/base/1/6239 differ diff --git a/starpost/postgres/base/1/826 b/starpost/postgres/base/1/826 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/1/827 b/starpost/postgres/base/1/827 new file mode 100644 index 0000000..bcaf0a1 Binary files /dev/null and b/starpost/postgres/base/1/827 differ diff --git a/starpost/postgres/base/1/828 b/starpost/postgres/base/1/828 new file mode 100644 index 0000000..7aba562 Binary files /dev/null and b/starpost/postgres/base/1/828 differ diff --git a/starpost/postgres/base/1/PG_VERSION b/starpost/postgres/base/1/PG_VERSION new file mode 100644 index 0000000..b6a7d89 --- /dev/null +++ b/starpost/postgres/base/1/PG_VERSION @@ -0,0 +1 @@ +16 diff --git a/starpost/postgres/base/1/pg_filenode.map b/starpost/postgres/base/1/pg_filenode.map new file mode 100644 index 0000000..4fc801a Binary files /dev/null and b/starpost/postgres/base/1/pg_filenode.map differ diff --git a/starpost/postgres/base/1/pg_internal.init b/starpost/postgres/base/1/pg_internal.init new file mode 100644 index 0000000..5bd41da Binary files /dev/null and b/starpost/postgres/base/1/pg_internal.init differ diff --git a/starpost/postgres/base/16384/112 b/starpost/postgres/base/16384/112 new file mode 100644 index 0000000..fdb77a1 Binary files /dev/null and b/starpost/postgres/base/16384/112 differ diff --git a/starpost/postgres/base/16384/113 b/starpost/postgres/base/16384/113 new file mode 100644 index 0000000..924040b Binary files /dev/null and b/starpost/postgres/base/16384/113 differ diff --git a/starpost/postgres/base/16384/1247 b/starpost/postgres/base/16384/1247 new file mode 100644 index 0000000..88248c9 Binary files /dev/null and b/starpost/postgres/base/16384/1247 differ diff --git a/starpost/postgres/base/16384/1247_fsm b/starpost/postgres/base/16384/1247_fsm new file mode 100644 index 0000000..22a57e3 Binary files /dev/null and b/starpost/postgres/base/16384/1247_fsm differ diff --git a/starpost/postgres/base/16384/1247_vm b/starpost/postgres/base/16384/1247_vm new file mode 100644 index 0000000..720052d Binary files /dev/null and b/starpost/postgres/base/16384/1247_vm differ diff --git a/starpost/postgres/base/16384/1249 b/starpost/postgres/base/16384/1249 new file mode 100644 index 0000000..e72fff5 Binary files /dev/null and b/starpost/postgres/base/16384/1249 differ diff --git a/starpost/postgres/base/16384/1249_fsm b/starpost/postgres/base/16384/1249_fsm new file mode 100644 index 0000000..954970b Binary files /dev/null and b/starpost/postgres/base/16384/1249_fsm differ diff --git a/starpost/postgres/base/16384/1249_vm b/starpost/postgres/base/16384/1249_vm new file mode 100644 index 0000000..18460f8 Binary files /dev/null and b/starpost/postgres/base/16384/1249_vm differ diff --git a/starpost/postgres/base/16384/1255 b/starpost/postgres/base/16384/1255 new file mode 100644 index 0000000..51bb8de Binary files /dev/null and b/starpost/postgres/base/16384/1255 differ diff --git a/starpost/postgres/base/16384/1255_fsm b/starpost/postgres/base/16384/1255_fsm new file mode 100644 index 0000000..7b24b89 Binary files /dev/null and b/starpost/postgres/base/16384/1255_fsm differ diff --git a/starpost/postgres/base/16384/1255_vm b/starpost/postgres/base/16384/1255_vm new file mode 100644 index 0000000..e4de718 Binary files /dev/null and b/starpost/postgres/base/16384/1255_vm differ diff --git a/starpost/postgres/base/16384/1259 b/starpost/postgres/base/16384/1259 new file mode 100644 index 0000000..ea84120 Binary files /dev/null and b/starpost/postgres/base/16384/1259 differ diff --git a/starpost/postgres/base/16384/1259_fsm b/starpost/postgres/base/16384/1259_fsm new file mode 100644 index 0000000..d849c0c Binary files /dev/null and b/starpost/postgres/base/16384/1259_fsm differ diff --git a/starpost/postgres/base/16384/1259_vm b/starpost/postgres/base/16384/1259_vm new file mode 100644 index 0000000..0309e63 Binary files /dev/null and b/starpost/postgres/base/16384/1259_vm differ diff --git a/starpost/postgres/base/16384/13494 b/starpost/postgres/base/16384/13494 new file mode 100644 index 0000000..7b63e4b Binary files /dev/null and b/starpost/postgres/base/16384/13494 differ diff --git a/starpost/postgres/base/16384/13494_fsm b/starpost/postgres/base/16384/13494_fsm new file mode 100644 index 0000000..fc3dfeb Binary files /dev/null and b/starpost/postgres/base/16384/13494_fsm differ diff --git a/starpost/postgres/base/16384/13494_vm b/starpost/postgres/base/16384/13494_vm new file mode 100644 index 0000000..d219215 Binary files /dev/null and b/starpost/postgres/base/16384/13494_vm differ diff --git a/starpost/postgres/base/16384/13497 b/starpost/postgres/base/16384/13497 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/13498 b/starpost/postgres/base/16384/13498 new file mode 100644 index 0000000..9ce45f7 Binary files /dev/null and b/starpost/postgres/base/16384/13498 differ diff --git a/starpost/postgres/base/16384/13499 b/starpost/postgres/base/16384/13499 new file mode 100644 index 0000000..515e370 Binary files /dev/null and b/starpost/postgres/base/16384/13499 differ diff --git a/starpost/postgres/base/16384/13499_fsm b/starpost/postgres/base/16384/13499_fsm new file mode 100644 index 0000000..25303ce Binary files /dev/null and b/starpost/postgres/base/16384/13499_fsm differ diff --git a/starpost/postgres/base/16384/13499_vm b/starpost/postgres/base/16384/13499_vm new file mode 100644 index 0000000..fbb79b9 Binary files /dev/null and b/starpost/postgres/base/16384/13499_vm differ diff --git a/starpost/postgres/base/16384/13502 b/starpost/postgres/base/16384/13502 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/13503 b/starpost/postgres/base/16384/13503 new file mode 100644 index 0000000..05ec727 Binary files /dev/null and b/starpost/postgres/base/16384/13503 differ diff --git a/starpost/postgres/base/16384/13504 b/starpost/postgres/base/16384/13504 new file mode 100644 index 0000000..2ae6ee4 Binary files /dev/null and b/starpost/postgres/base/16384/13504 differ diff --git a/starpost/postgres/base/16384/13504_fsm b/starpost/postgres/base/16384/13504_fsm new file mode 100644 index 0000000..853565f Binary files /dev/null and b/starpost/postgres/base/16384/13504_fsm differ diff --git a/starpost/postgres/base/16384/13504_vm b/starpost/postgres/base/16384/13504_vm new file mode 100644 index 0000000..26a0a4f Binary files /dev/null and b/starpost/postgres/base/16384/13504_vm differ diff --git a/starpost/postgres/base/16384/13507 b/starpost/postgres/base/16384/13507 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/13508 b/starpost/postgres/base/16384/13508 new file mode 100644 index 0000000..0847cb4 Binary files /dev/null and b/starpost/postgres/base/16384/13508 differ diff --git a/starpost/postgres/base/16384/13509 b/starpost/postgres/base/16384/13509 new file mode 100644 index 0000000..a3d0390 Binary files /dev/null and b/starpost/postgres/base/16384/13509 differ diff --git a/starpost/postgres/base/16384/13509_fsm b/starpost/postgres/base/16384/13509_fsm new file mode 100644 index 0000000..5cf3ffa Binary files /dev/null and b/starpost/postgres/base/16384/13509_fsm differ diff --git a/starpost/postgres/base/16384/13509_vm b/starpost/postgres/base/16384/13509_vm new file mode 100644 index 0000000..cf2d941 Binary files /dev/null and b/starpost/postgres/base/16384/13509_vm differ diff --git a/starpost/postgres/base/16384/13512 b/starpost/postgres/base/16384/13512 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/13513 b/starpost/postgres/base/16384/13513 new file mode 100644 index 0000000..2d35bfa Binary files /dev/null and b/starpost/postgres/base/16384/13513 differ diff --git a/starpost/postgres/base/16384/1417 b/starpost/postgres/base/16384/1417 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/1418 b/starpost/postgres/base/16384/1418 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/16385 b/starpost/postgres/base/16384/16385 new file mode 100644 index 0000000..fb524e6 Binary files /dev/null and b/starpost/postgres/base/16384/16385 differ diff --git a/starpost/postgres/base/16384/16386 b/starpost/postgres/base/16384/16386 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/16393 b/starpost/postgres/base/16384/16393 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/16394 b/starpost/postgres/base/16384/16394 new file mode 100644 index 0000000..6a9c244 Binary files /dev/null and b/starpost/postgres/base/16384/16394 differ diff --git a/starpost/postgres/base/16384/16395 b/starpost/postgres/base/16384/16395 new file mode 100644 index 0000000..fc09afb Binary files /dev/null and b/starpost/postgres/base/16384/16395 differ diff --git a/starpost/postgres/base/16384/16397 b/starpost/postgres/base/16384/16397 new file mode 100644 index 0000000..4a77e92 Binary files /dev/null and b/starpost/postgres/base/16384/16397 differ diff --git a/starpost/postgres/base/16384/16399 b/starpost/postgres/base/16384/16399 new file mode 100644 index 0000000..f28edd1 Binary files /dev/null and b/starpost/postgres/base/16384/16399 differ diff --git a/starpost/postgres/base/16384/16400 b/starpost/postgres/base/16384/16400 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/16407 b/starpost/postgres/base/16384/16407 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/16408 b/starpost/postgres/base/16384/16408 new file mode 100644 index 0000000..9b90323 Binary files /dev/null and b/starpost/postgres/base/16384/16408 differ diff --git a/starpost/postgres/base/16384/16409 b/starpost/postgres/base/16384/16409 new file mode 100644 index 0000000..af34672 Binary files /dev/null and b/starpost/postgres/base/16384/16409 differ diff --git a/starpost/postgres/base/16384/16416 b/starpost/postgres/base/16384/16416 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/16422 b/starpost/postgres/base/16384/16422 new file mode 100644 index 0000000..046e558 Binary files /dev/null and b/starpost/postgres/base/16384/16422 differ diff --git a/starpost/postgres/base/16384/16434 b/starpost/postgres/base/16384/16434 new file mode 100644 index 0000000..dff76a9 Binary files /dev/null and b/starpost/postgres/base/16384/16434 differ diff --git a/starpost/postgres/base/16384/16435 b/starpost/postgres/base/16384/16435 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/16443 b/starpost/postgres/base/16384/16443 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/16444 b/starpost/postgres/base/16384/16444 new file mode 100644 index 0000000..47bca03 Binary files /dev/null and b/starpost/postgres/base/16384/16444 differ diff --git a/starpost/postgres/base/16384/16445 b/starpost/postgres/base/16384/16445 new file mode 100644 index 0000000..a808825 Binary files /dev/null and b/starpost/postgres/base/16384/16445 differ diff --git a/starpost/postgres/base/16384/16447 b/starpost/postgres/base/16384/16447 new file mode 100644 index 0000000..af2ebf8 Binary files /dev/null and b/starpost/postgres/base/16384/16447 differ diff --git a/starpost/postgres/base/16384/16459 b/starpost/postgres/base/16384/16459 new file mode 100644 index 0000000..5b5f5d1 Binary files /dev/null and b/starpost/postgres/base/16384/16459 differ diff --git a/starpost/postgres/base/16384/16460 b/starpost/postgres/base/16384/16460 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/16467 b/starpost/postgres/base/16384/16467 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/16468 b/starpost/postgres/base/16384/16468 new file mode 100644 index 0000000..234573b Binary files /dev/null and b/starpost/postgres/base/16384/16468 differ diff --git a/starpost/postgres/base/16384/16469 b/starpost/postgres/base/16384/16469 new file mode 100644 index 0000000..875b76f Binary files /dev/null and b/starpost/postgres/base/16384/16469 differ diff --git a/starpost/postgres/base/16384/16471 b/starpost/postgres/base/16384/16471 new file mode 100644 index 0000000..bec0d05 Binary files /dev/null and b/starpost/postgres/base/16384/16471 differ diff --git a/starpost/postgres/base/16384/16488 b/starpost/postgres/base/16384/16488 new file mode 100644 index 0000000..5dfb84c Binary files /dev/null and b/starpost/postgres/base/16384/16488 differ diff --git a/starpost/postgres/base/16384/16489 b/starpost/postgres/base/16384/16489 new file mode 100644 index 0000000..dd72d45 Binary files /dev/null and b/starpost/postgres/base/16384/16489 differ diff --git a/starpost/postgres/base/16384/16490 b/starpost/postgres/base/16384/16490 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/16496 b/starpost/postgres/base/16384/16496 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/16497 b/starpost/postgres/base/16384/16497 new file mode 100644 index 0000000..d74ae75 Binary files /dev/null and b/starpost/postgres/base/16384/16497 differ diff --git a/starpost/postgres/base/16384/16498 b/starpost/postgres/base/16384/16498 new file mode 100644 index 0000000..260334e Binary files /dev/null and b/starpost/postgres/base/16384/16498 differ diff --git a/starpost/postgres/base/16384/16500 b/starpost/postgres/base/16384/16500 new file mode 100644 index 0000000..59c9c8e Binary files /dev/null and b/starpost/postgres/base/16384/16500 differ diff --git a/starpost/postgres/base/16384/16502 b/starpost/postgres/base/16384/16502 new file mode 100644 index 0000000..d944793 Binary files /dev/null and b/starpost/postgres/base/16384/16502 differ diff --git a/starpost/postgres/base/16384/16512 b/starpost/postgres/base/16384/16512 new file mode 100644 index 0000000..304047b Binary files /dev/null and b/starpost/postgres/base/16384/16512 differ diff --git a/starpost/postgres/base/16384/16513 b/starpost/postgres/base/16384/16513 new file mode 100644 index 0000000..d475d52 Binary files /dev/null and b/starpost/postgres/base/16384/16513 differ diff --git a/starpost/postgres/base/16384/16514 b/starpost/postgres/base/16384/16514 new file mode 100644 index 0000000..cc2996c Binary files /dev/null and b/starpost/postgres/base/16384/16514 differ diff --git a/starpost/postgres/base/16384/16515 b/starpost/postgres/base/16384/16515 new file mode 100644 index 0000000..cd16c9f Binary files /dev/null and b/starpost/postgres/base/16384/16515 differ diff --git a/starpost/postgres/base/16384/174 b/starpost/postgres/base/16384/174 new file mode 100644 index 0000000..14cf316 Binary files /dev/null and b/starpost/postgres/base/16384/174 differ diff --git a/starpost/postgres/base/16384/175 b/starpost/postgres/base/16384/175 new file mode 100644 index 0000000..f97bf36 Binary files /dev/null and b/starpost/postgres/base/16384/175 differ diff --git a/starpost/postgres/base/16384/2187 b/starpost/postgres/base/16384/2187 new file mode 100644 index 0000000..259b99a Binary files /dev/null and b/starpost/postgres/base/16384/2187 differ diff --git a/starpost/postgres/base/16384/2224 b/starpost/postgres/base/16384/2224 new file mode 100644 index 0000000..077f56c Binary files /dev/null and b/starpost/postgres/base/16384/2224 differ diff --git a/starpost/postgres/base/16384/2228 b/starpost/postgres/base/16384/2228 new file mode 100644 index 0000000..6c1cd13 Binary files /dev/null and b/starpost/postgres/base/16384/2228 differ diff --git a/starpost/postgres/base/16384/2328 b/starpost/postgres/base/16384/2328 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/2336 b/starpost/postgres/base/16384/2336 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/2337 b/starpost/postgres/base/16384/2337 new file mode 100644 index 0000000..2b2097f Binary files /dev/null and b/starpost/postgres/base/16384/2337 differ diff --git a/starpost/postgres/base/16384/2579 b/starpost/postgres/base/16384/2579 new file mode 100644 index 0000000..0a04cb1 Binary files /dev/null and b/starpost/postgres/base/16384/2579 differ diff --git a/starpost/postgres/base/16384/2600 b/starpost/postgres/base/16384/2600 new file mode 100644 index 0000000..b64d09a Binary files /dev/null and b/starpost/postgres/base/16384/2600 differ diff --git a/starpost/postgres/base/16384/2600_fsm b/starpost/postgres/base/16384/2600_fsm new file mode 100644 index 0000000..de10249 Binary files /dev/null and b/starpost/postgres/base/16384/2600_fsm differ diff --git a/starpost/postgres/base/16384/2600_vm b/starpost/postgres/base/16384/2600_vm new file mode 100644 index 0000000..4ec9c88 Binary files /dev/null and b/starpost/postgres/base/16384/2600_vm differ diff --git a/starpost/postgres/base/16384/2601 b/starpost/postgres/base/16384/2601 new file mode 100644 index 0000000..8a85817 Binary files /dev/null and b/starpost/postgres/base/16384/2601 differ diff --git a/starpost/postgres/base/16384/2601_fsm b/starpost/postgres/base/16384/2601_fsm new file mode 100644 index 0000000..1da9967 Binary files /dev/null and b/starpost/postgres/base/16384/2601_fsm differ diff --git a/starpost/postgres/base/16384/2601_vm b/starpost/postgres/base/16384/2601_vm new file mode 100644 index 0000000..ecf0915 Binary files /dev/null and b/starpost/postgres/base/16384/2601_vm differ diff --git a/starpost/postgres/base/16384/2602 b/starpost/postgres/base/16384/2602 new file mode 100644 index 0000000..ccc2ec2 Binary files /dev/null and b/starpost/postgres/base/16384/2602 differ diff --git a/starpost/postgres/base/16384/2602_fsm b/starpost/postgres/base/16384/2602_fsm new file mode 100644 index 0000000..df4dda4 Binary files /dev/null and b/starpost/postgres/base/16384/2602_fsm differ diff --git a/starpost/postgres/base/16384/2602_vm b/starpost/postgres/base/16384/2602_vm new file mode 100644 index 0000000..16e7e4e Binary files /dev/null and b/starpost/postgres/base/16384/2602_vm differ diff --git a/starpost/postgres/base/16384/2603 b/starpost/postgres/base/16384/2603 new file mode 100644 index 0000000..62fb9d2 Binary files /dev/null and b/starpost/postgres/base/16384/2603 differ diff --git a/starpost/postgres/base/16384/2603_fsm b/starpost/postgres/base/16384/2603_fsm new file mode 100644 index 0000000..c3e7988 Binary files /dev/null and b/starpost/postgres/base/16384/2603_fsm differ diff --git a/starpost/postgres/base/16384/2603_vm b/starpost/postgres/base/16384/2603_vm new file mode 100644 index 0000000..468f22e Binary files /dev/null and b/starpost/postgres/base/16384/2603_vm differ diff --git a/starpost/postgres/base/16384/2604 b/starpost/postgres/base/16384/2604 new file mode 100644 index 0000000..a1c1371 Binary files /dev/null and b/starpost/postgres/base/16384/2604 differ diff --git a/starpost/postgres/base/16384/2605 b/starpost/postgres/base/16384/2605 new file mode 100644 index 0000000..6125a7d Binary files /dev/null and b/starpost/postgres/base/16384/2605 differ diff --git a/starpost/postgres/base/16384/2605_fsm b/starpost/postgres/base/16384/2605_fsm new file mode 100644 index 0000000..3bc7e4a Binary files /dev/null and b/starpost/postgres/base/16384/2605_fsm differ diff --git a/starpost/postgres/base/16384/2605_vm b/starpost/postgres/base/16384/2605_vm new file mode 100644 index 0000000..0576337 Binary files /dev/null and b/starpost/postgres/base/16384/2605_vm differ diff --git a/starpost/postgres/base/16384/2606 b/starpost/postgres/base/16384/2606 new file mode 100644 index 0000000..4a0cb7a Binary files /dev/null and b/starpost/postgres/base/16384/2606 differ diff --git a/starpost/postgres/base/16384/2606_fsm b/starpost/postgres/base/16384/2606_fsm new file mode 100644 index 0000000..a6e27bf Binary files /dev/null and b/starpost/postgres/base/16384/2606_fsm differ diff --git a/starpost/postgres/base/16384/2606_vm b/starpost/postgres/base/16384/2606_vm new file mode 100644 index 0000000..f52d196 Binary files /dev/null and b/starpost/postgres/base/16384/2606_vm differ diff --git a/starpost/postgres/base/16384/2607 b/starpost/postgres/base/16384/2607 new file mode 100644 index 0000000..7dd7a7c Binary files /dev/null and b/starpost/postgres/base/16384/2607 differ diff --git a/starpost/postgres/base/16384/2607_fsm b/starpost/postgres/base/16384/2607_fsm new file mode 100644 index 0000000..7a20fee Binary files /dev/null and b/starpost/postgres/base/16384/2607_fsm differ diff --git a/starpost/postgres/base/16384/2607_vm b/starpost/postgres/base/16384/2607_vm new file mode 100644 index 0000000..023500c Binary files /dev/null and b/starpost/postgres/base/16384/2607_vm differ diff --git a/starpost/postgres/base/16384/2608 b/starpost/postgres/base/16384/2608 new file mode 100644 index 0000000..9e27e8a Binary files /dev/null and b/starpost/postgres/base/16384/2608 differ diff --git a/starpost/postgres/base/16384/2608_fsm b/starpost/postgres/base/16384/2608_fsm new file mode 100644 index 0000000..9a3319c Binary files /dev/null and b/starpost/postgres/base/16384/2608_fsm differ diff --git a/starpost/postgres/base/16384/2608_vm b/starpost/postgres/base/16384/2608_vm new file mode 100644 index 0000000..ef0ae33 Binary files /dev/null and b/starpost/postgres/base/16384/2608_vm differ diff --git a/starpost/postgres/base/16384/2609 b/starpost/postgres/base/16384/2609 new file mode 100644 index 0000000..43a4aa5 Binary files /dev/null and b/starpost/postgres/base/16384/2609 differ diff --git a/starpost/postgres/base/16384/2609_fsm b/starpost/postgres/base/16384/2609_fsm new file mode 100644 index 0000000..918c963 Binary files /dev/null and b/starpost/postgres/base/16384/2609_fsm differ diff --git a/starpost/postgres/base/16384/2609_vm b/starpost/postgres/base/16384/2609_vm new file mode 100644 index 0000000..58572a4 Binary files /dev/null and b/starpost/postgres/base/16384/2609_vm differ diff --git a/starpost/postgres/base/16384/2610 b/starpost/postgres/base/16384/2610 new file mode 100644 index 0000000..9a4edcb Binary files /dev/null and b/starpost/postgres/base/16384/2610 differ diff --git a/starpost/postgres/base/16384/2610_fsm b/starpost/postgres/base/16384/2610_fsm new file mode 100644 index 0000000..06f5487 Binary files /dev/null and b/starpost/postgres/base/16384/2610_fsm differ diff --git a/starpost/postgres/base/16384/2610_vm b/starpost/postgres/base/16384/2610_vm new file mode 100644 index 0000000..a745a3f Binary files /dev/null and b/starpost/postgres/base/16384/2610_vm differ diff --git a/starpost/postgres/base/16384/2611 b/starpost/postgres/base/16384/2611 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/2612 b/starpost/postgres/base/16384/2612 new file mode 100644 index 0000000..27c9c0c Binary files /dev/null and b/starpost/postgres/base/16384/2612 differ diff --git a/starpost/postgres/base/16384/2612_fsm b/starpost/postgres/base/16384/2612_fsm new file mode 100644 index 0000000..fde03b9 Binary files /dev/null and b/starpost/postgres/base/16384/2612_fsm differ diff --git a/starpost/postgres/base/16384/2612_vm b/starpost/postgres/base/16384/2612_vm new file mode 100644 index 0000000..0f45d61 Binary files /dev/null and b/starpost/postgres/base/16384/2612_vm differ diff --git a/starpost/postgres/base/16384/2613 b/starpost/postgres/base/16384/2613 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/2615 b/starpost/postgres/base/16384/2615 new file mode 100644 index 0000000..39638b4 Binary files /dev/null and b/starpost/postgres/base/16384/2615 differ diff --git a/starpost/postgres/base/16384/2615_fsm b/starpost/postgres/base/16384/2615_fsm new file mode 100644 index 0000000..516f9a5 Binary files /dev/null and b/starpost/postgres/base/16384/2615_fsm differ diff --git a/starpost/postgres/base/16384/2615_vm b/starpost/postgres/base/16384/2615_vm new file mode 100644 index 0000000..2a10ca4 Binary files /dev/null and b/starpost/postgres/base/16384/2615_vm differ diff --git a/starpost/postgres/base/16384/2616 b/starpost/postgres/base/16384/2616 new file mode 100644 index 0000000..a8012c5 Binary files /dev/null and b/starpost/postgres/base/16384/2616 differ diff --git a/starpost/postgres/base/16384/2616_fsm b/starpost/postgres/base/16384/2616_fsm new file mode 100644 index 0000000..1fe015e Binary files /dev/null and b/starpost/postgres/base/16384/2616_fsm differ diff --git a/starpost/postgres/base/16384/2616_vm b/starpost/postgres/base/16384/2616_vm new file mode 100644 index 0000000..e38b2ef Binary files /dev/null and b/starpost/postgres/base/16384/2616_vm differ diff --git a/starpost/postgres/base/16384/2617 b/starpost/postgres/base/16384/2617 new file mode 100644 index 0000000..8b91045 Binary files /dev/null and b/starpost/postgres/base/16384/2617 differ diff --git a/starpost/postgres/base/16384/2617_fsm b/starpost/postgres/base/16384/2617_fsm new file mode 100644 index 0000000..05d097a Binary files /dev/null and b/starpost/postgres/base/16384/2617_fsm differ diff --git a/starpost/postgres/base/16384/2617_vm b/starpost/postgres/base/16384/2617_vm new file mode 100644 index 0000000..2202223 Binary files /dev/null and b/starpost/postgres/base/16384/2617_vm differ diff --git a/starpost/postgres/base/16384/2618 b/starpost/postgres/base/16384/2618 new file mode 100644 index 0000000..9cf04b6 Binary files /dev/null and b/starpost/postgres/base/16384/2618 differ diff --git a/starpost/postgres/base/16384/2618_fsm b/starpost/postgres/base/16384/2618_fsm new file mode 100644 index 0000000..e93358b Binary files /dev/null and b/starpost/postgres/base/16384/2618_fsm differ diff --git a/starpost/postgres/base/16384/2618_vm b/starpost/postgres/base/16384/2618_vm new file mode 100644 index 0000000..62d92e7 Binary files /dev/null and b/starpost/postgres/base/16384/2618_vm differ diff --git a/starpost/postgres/base/16384/2619 b/starpost/postgres/base/16384/2619 new file mode 100644 index 0000000..737e789 Binary files /dev/null and b/starpost/postgres/base/16384/2619 differ diff --git a/starpost/postgres/base/16384/2619_fsm b/starpost/postgres/base/16384/2619_fsm new file mode 100644 index 0000000..eed1213 Binary files /dev/null and b/starpost/postgres/base/16384/2619_fsm differ diff --git a/starpost/postgres/base/16384/2619_vm b/starpost/postgres/base/16384/2619_vm new file mode 100644 index 0000000..701dde5 Binary files /dev/null and b/starpost/postgres/base/16384/2619_vm differ diff --git a/starpost/postgres/base/16384/2620 b/starpost/postgres/base/16384/2620 new file mode 100644 index 0000000..e4dcced Binary files /dev/null and b/starpost/postgres/base/16384/2620 differ diff --git a/starpost/postgres/base/16384/2650 b/starpost/postgres/base/16384/2650 new file mode 100644 index 0000000..6b83f80 Binary files /dev/null and b/starpost/postgres/base/16384/2650 differ diff --git a/starpost/postgres/base/16384/2651 b/starpost/postgres/base/16384/2651 new file mode 100644 index 0000000..b6dcdd3 Binary files /dev/null and b/starpost/postgres/base/16384/2651 differ diff --git a/starpost/postgres/base/16384/2652 b/starpost/postgres/base/16384/2652 new file mode 100644 index 0000000..06bba20 Binary files /dev/null and b/starpost/postgres/base/16384/2652 differ diff --git a/starpost/postgres/base/16384/2653 b/starpost/postgres/base/16384/2653 new file mode 100644 index 0000000..c2e9c0d Binary files /dev/null and b/starpost/postgres/base/16384/2653 differ diff --git a/starpost/postgres/base/16384/2654 b/starpost/postgres/base/16384/2654 new file mode 100644 index 0000000..e6cfaab Binary files /dev/null and b/starpost/postgres/base/16384/2654 differ diff --git a/starpost/postgres/base/16384/2655 b/starpost/postgres/base/16384/2655 new file mode 100644 index 0000000..9950c82 Binary files /dev/null and b/starpost/postgres/base/16384/2655 differ diff --git a/starpost/postgres/base/16384/2656 b/starpost/postgres/base/16384/2656 new file mode 100644 index 0000000..fef342c Binary files /dev/null and b/starpost/postgres/base/16384/2656 differ diff --git a/starpost/postgres/base/16384/2657 b/starpost/postgres/base/16384/2657 new file mode 100644 index 0000000..e96a9b7 Binary files /dev/null and b/starpost/postgres/base/16384/2657 differ diff --git a/starpost/postgres/base/16384/2658 b/starpost/postgres/base/16384/2658 new file mode 100644 index 0000000..1f952ba Binary files /dev/null and b/starpost/postgres/base/16384/2658 differ diff --git a/starpost/postgres/base/16384/2659 b/starpost/postgres/base/16384/2659 new file mode 100644 index 0000000..a6fdd3e Binary files /dev/null and b/starpost/postgres/base/16384/2659 differ diff --git a/starpost/postgres/base/16384/2660 b/starpost/postgres/base/16384/2660 new file mode 100644 index 0000000..f4ac27b Binary files /dev/null and b/starpost/postgres/base/16384/2660 differ diff --git a/starpost/postgres/base/16384/2661 b/starpost/postgres/base/16384/2661 new file mode 100644 index 0000000..79c1a77 Binary files /dev/null and b/starpost/postgres/base/16384/2661 differ diff --git a/starpost/postgres/base/16384/2662 b/starpost/postgres/base/16384/2662 new file mode 100644 index 0000000..931e473 Binary files /dev/null and b/starpost/postgres/base/16384/2662 differ diff --git a/starpost/postgres/base/16384/2663 b/starpost/postgres/base/16384/2663 new file mode 100644 index 0000000..5792327 Binary files /dev/null and b/starpost/postgres/base/16384/2663 differ diff --git a/starpost/postgres/base/16384/2664 b/starpost/postgres/base/16384/2664 new file mode 100644 index 0000000..737984e Binary files /dev/null and b/starpost/postgres/base/16384/2664 differ diff --git a/starpost/postgres/base/16384/2665 b/starpost/postgres/base/16384/2665 new file mode 100644 index 0000000..b4a4195 Binary files /dev/null and b/starpost/postgres/base/16384/2665 differ diff --git a/starpost/postgres/base/16384/2666 b/starpost/postgres/base/16384/2666 new file mode 100644 index 0000000..51c4d8d Binary files /dev/null and b/starpost/postgres/base/16384/2666 differ diff --git a/starpost/postgres/base/16384/2667 b/starpost/postgres/base/16384/2667 new file mode 100644 index 0000000..5b7cf2c Binary files /dev/null and b/starpost/postgres/base/16384/2667 differ diff --git a/starpost/postgres/base/16384/2668 b/starpost/postgres/base/16384/2668 new file mode 100644 index 0000000..cd49d08 Binary files /dev/null and b/starpost/postgres/base/16384/2668 differ diff --git a/starpost/postgres/base/16384/2669 b/starpost/postgres/base/16384/2669 new file mode 100644 index 0000000..ec7f481 Binary files /dev/null and b/starpost/postgres/base/16384/2669 differ diff --git a/starpost/postgres/base/16384/2670 b/starpost/postgres/base/16384/2670 new file mode 100644 index 0000000..108d933 Binary files /dev/null and b/starpost/postgres/base/16384/2670 differ diff --git a/starpost/postgres/base/16384/2673 b/starpost/postgres/base/16384/2673 new file mode 100644 index 0000000..f731e4c Binary files /dev/null and b/starpost/postgres/base/16384/2673 differ diff --git a/starpost/postgres/base/16384/2674 b/starpost/postgres/base/16384/2674 new file mode 100644 index 0000000..e551481 Binary files /dev/null and b/starpost/postgres/base/16384/2674 differ diff --git a/starpost/postgres/base/16384/2675 b/starpost/postgres/base/16384/2675 new file mode 100644 index 0000000..0f14e21 Binary files /dev/null and b/starpost/postgres/base/16384/2675 differ diff --git a/starpost/postgres/base/16384/2678 b/starpost/postgres/base/16384/2678 new file mode 100644 index 0000000..d022290 Binary files /dev/null and b/starpost/postgres/base/16384/2678 differ diff --git a/starpost/postgres/base/16384/2679 b/starpost/postgres/base/16384/2679 new file mode 100644 index 0000000..b391b66 Binary files /dev/null and b/starpost/postgres/base/16384/2679 differ diff --git a/starpost/postgres/base/16384/2680 b/starpost/postgres/base/16384/2680 new file mode 100644 index 0000000..0ca659d Binary files /dev/null and b/starpost/postgres/base/16384/2680 differ diff --git a/starpost/postgres/base/16384/2681 b/starpost/postgres/base/16384/2681 new file mode 100644 index 0000000..f480023 Binary files /dev/null and b/starpost/postgres/base/16384/2681 differ diff --git a/starpost/postgres/base/16384/2682 b/starpost/postgres/base/16384/2682 new file mode 100644 index 0000000..0880c8a Binary files /dev/null and b/starpost/postgres/base/16384/2682 differ diff --git a/starpost/postgres/base/16384/2683 b/starpost/postgres/base/16384/2683 new file mode 100644 index 0000000..ae9fb58 Binary files /dev/null and b/starpost/postgres/base/16384/2683 differ diff --git a/starpost/postgres/base/16384/2684 b/starpost/postgres/base/16384/2684 new file mode 100644 index 0000000..f2f9eb8 Binary files /dev/null and b/starpost/postgres/base/16384/2684 differ diff --git a/starpost/postgres/base/16384/2685 b/starpost/postgres/base/16384/2685 new file mode 100644 index 0000000..d70cbc7 Binary files /dev/null and b/starpost/postgres/base/16384/2685 differ diff --git a/starpost/postgres/base/16384/2686 b/starpost/postgres/base/16384/2686 new file mode 100644 index 0000000..e11074f Binary files /dev/null and b/starpost/postgres/base/16384/2686 differ diff --git a/starpost/postgres/base/16384/2687 b/starpost/postgres/base/16384/2687 new file mode 100644 index 0000000..445694d Binary files /dev/null and b/starpost/postgres/base/16384/2687 differ diff --git a/starpost/postgres/base/16384/2688 b/starpost/postgres/base/16384/2688 new file mode 100644 index 0000000..901885e Binary files /dev/null and b/starpost/postgres/base/16384/2688 differ diff --git a/starpost/postgres/base/16384/2689 b/starpost/postgres/base/16384/2689 new file mode 100644 index 0000000..4cf5875 Binary files /dev/null and b/starpost/postgres/base/16384/2689 differ diff --git a/starpost/postgres/base/16384/2690 b/starpost/postgres/base/16384/2690 new file mode 100644 index 0000000..13e184a Binary files /dev/null and b/starpost/postgres/base/16384/2690 differ diff --git a/starpost/postgres/base/16384/2691 b/starpost/postgres/base/16384/2691 new file mode 100644 index 0000000..ff98cdc Binary files /dev/null and b/starpost/postgres/base/16384/2691 differ diff --git a/starpost/postgres/base/16384/2692 b/starpost/postgres/base/16384/2692 new file mode 100644 index 0000000..eaa71ea Binary files /dev/null and b/starpost/postgres/base/16384/2692 differ diff --git a/starpost/postgres/base/16384/2693 b/starpost/postgres/base/16384/2693 new file mode 100644 index 0000000..10dd0d5 Binary files /dev/null and b/starpost/postgres/base/16384/2693 differ diff --git a/starpost/postgres/base/16384/2696 b/starpost/postgres/base/16384/2696 new file mode 100644 index 0000000..f8ee67b Binary files /dev/null and b/starpost/postgres/base/16384/2696 differ diff --git a/starpost/postgres/base/16384/2699 b/starpost/postgres/base/16384/2699 new file mode 100644 index 0000000..d634722 Binary files /dev/null and b/starpost/postgres/base/16384/2699 differ diff --git a/starpost/postgres/base/16384/2701 b/starpost/postgres/base/16384/2701 new file mode 100644 index 0000000..e74b6aa Binary files /dev/null and b/starpost/postgres/base/16384/2701 differ diff --git a/starpost/postgres/base/16384/2702 b/starpost/postgres/base/16384/2702 new file mode 100644 index 0000000..54d58e4 Binary files /dev/null and b/starpost/postgres/base/16384/2702 differ diff --git a/starpost/postgres/base/16384/2703 b/starpost/postgres/base/16384/2703 new file mode 100644 index 0000000..92eb57b Binary files /dev/null and b/starpost/postgres/base/16384/2703 differ diff --git a/starpost/postgres/base/16384/2704 b/starpost/postgres/base/16384/2704 new file mode 100644 index 0000000..1446809 Binary files /dev/null and b/starpost/postgres/base/16384/2704 differ diff --git a/starpost/postgres/base/16384/2753 b/starpost/postgres/base/16384/2753 new file mode 100644 index 0000000..538fd82 Binary files /dev/null and b/starpost/postgres/base/16384/2753 differ diff --git a/starpost/postgres/base/16384/2753_fsm b/starpost/postgres/base/16384/2753_fsm new file mode 100644 index 0000000..6ec85ed Binary files /dev/null and b/starpost/postgres/base/16384/2753_fsm differ diff --git a/starpost/postgres/base/16384/2753_vm b/starpost/postgres/base/16384/2753_vm new file mode 100644 index 0000000..e515e63 Binary files /dev/null and b/starpost/postgres/base/16384/2753_vm differ diff --git a/starpost/postgres/base/16384/2754 b/starpost/postgres/base/16384/2754 new file mode 100644 index 0000000..ff4cc9d Binary files /dev/null and b/starpost/postgres/base/16384/2754 differ diff --git a/starpost/postgres/base/16384/2755 b/starpost/postgres/base/16384/2755 new file mode 100644 index 0000000..0d63962 Binary files /dev/null and b/starpost/postgres/base/16384/2755 differ diff --git a/starpost/postgres/base/16384/2756 b/starpost/postgres/base/16384/2756 new file mode 100644 index 0000000..0734902 Binary files /dev/null and b/starpost/postgres/base/16384/2756 differ diff --git a/starpost/postgres/base/16384/2757 b/starpost/postgres/base/16384/2757 new file mode 100644 index 0000000..c38691a Binary files /dev/null and b/starpost/postgres/base/16384/2757 differ diff --git a/starpost/postgres/base/16384/2830 b/starpost/postgres/base/16384/2830 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/2831 b/starpost/postgres/base/16384/2831 new file mode 100644 index 0000000..8366535 Binary files /dev/null and b/starpost/postgres/base/16384/2831 differ diff --git a/starpost/postgres/base/16384/2832 b/starpost/postgres/base/16384/2832 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/2833 b/starpost/postgres/base/16384/2833 new file mode 100644 index 0000000..f2694c9 Binary files /dev/null and b/starpost/postgres/base/16384/2833 differ diff --git a/starpost/postgres/base/16384/2834 b/starpost/postgres/base/16384/2834 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/2835 b/starpost/postgres/base/16384/2835 new file mode 100644 index 0000000..ab08c45 Binary files /dev/null and b/starpost/postgres/base/16384/2835 differ diff --git a/starpost/postgres/base/16384/2836 b/starpost/postgres/base/16384/2836 new file mode 100644 index 0000000..df684f7 Binary files /dev/null and b/starpost/postgres/base/16384/2836 differ diff --git a/starpost/postgres/base/16384/2836_fsm b/starpost/postgres/base/16384/2836_fsm new file mode 100644 index 0000000..4e760f6 Binary files /dev/null and b/starpost/postgres/base/16384/2836_fsm differ diff --git a/starpost/postgres/base/16384/2836_vm b/starpost/postgres/base/16384/2836_vm new file mode 100644 index 0000000..66208f3 Binary files /dev/null and b/starpost/postgres/base/16384/2836_vm differ diff --git a/starpost/postgres/base/16384/2837 b/starpost/postgres/base/16384/2837 new file mode 100644 index 0000000..cd009b7 Binary files /dev/null and b/starpost/postgres/base/16384/2837 differ diff --git a/starpost/postgres/base/16384/2838 b/starpost/postgres/base/16384/2838 new file mode 100644 index 0000000..09e0767 Binary files /dev/null and b/starpost/postgres/base/16384/2838 differ diff --git a/starpost/postgres/base/16384/2838_fsm b/starpost/postgres/base/16384/2838_fsm new file mode 100644 index 0000000..edd44d6 Binary files /dev/null and b/starpost/postgres/base/16384/2838_fsm differ diff --git a/starpost/postgres/base/16384/2838_vm b/starpost/postgres/base/16384/2838_vm new file mode 100644 index 0000000..416d119 Binary files /dev/null and b/starpost/postgres/base/16384/2838_vm differ diff --git a/starpost/postgres/base/16384/2839 b/starpost/postgres/base/16384/2839 new file mode 100644 index 0000000..a96fe05 Binary files /dev/null and b/starpost/postgres/base/16384/2839 differ diff --git a/starpost/postgres/base/16384/2840 b/starpost/postgres/base/16384/2840 new file mode 100644 index 0000000..7bd2d8f Binary files /dev/null and b/starpost/postgres/base/16384/2840 differ diff --git a/starpost/postgres/base/16384/2840_fsm b/starpost/postgres/base/16384/2840_fsm new file mode 100644 index 0000000..6f3d808 Binary files /dev/null and b/starpost/postgres/base/16384/2840_fsm differ diff --git a/starpost/postgres/base/16384/2840_vm b/starpost/postgres/base/16384/2840_vm new file mode 100644 index 0000000..6cabc2b Binary files /dev/null and b/starpost/postgres/base/16384/2840_vm differ diff --git a/starpost/postgres/base/16384/2841 b/starpost/postgres/base/16384/2841 new file mode 100644 index 0000000..6234cc6 Binary files /dev/null and b/starpost/postgres/base/16384/2841 differ diff --git a/starpost/postgres/base/16384/2995 b/starpost/postgres/base/16384/2995 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/2996 b/starpost/postgres/base/16384/2996 new file mode 100644 index 0000000..b0c2541 Binary files /dev/null and b/starpost/postgres/base/16384/2996 differ diff --git a/starpost/postgres/base/16384/3079 b/starpost/postgres/base/16384/3079 new file mode 100644 index 0000000..e8c603a Binary files /dev/null and b/starpost/postgres/base/16384/3079 differ diff --git a/starpost/postgres/base/16384/3079_fsm b/starpost/postgres/base/16384/3079_fsm new file mode 100644 index 0000000..cc29b2e Binary files /dev/null and b/starpost/postgres/base/16384/3079_fsm differ diff --git a/starpost/postgres/base/16384/3079_vm b/starpost/postgres/base/16384/3079_vm new file mode 100644 index 0000000..ba1cba0 Binary files /dev/null and b/starpost/postgres/base/16384/3079_vm differ diff --git a/starpost/postgres/base/16384/3080 b/starpost/postgres/base/16384/3080 new file mode 100644 index 0000000..e86311d Binary files /dev/null and b/starpost/postgres/base/16384/3080 differ diff --git a/starpost/postgres/base/16384/3081 b/starpost/postgres/base/16384/3081 new file mode 100644 index 0000000..584180a Binary files /dev/null and b/starpost/postgres/base/16384/3081 differ diff --git a/starpost/postgres/base/16384/3085 b/starpost/postgres/base/16384/3085 new file mode 100644 index 0000000..161cc9e Binary files /dev/null and b/starpost/postgres/base/16384/3085 differ diff --git a/starpost/postgres/base/16384/3118 b/starpost/postgres/base/16384/3118 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/3119 b/starpost/postgres/base/16384/3119 new file mode 100644 index 0000000..f83a3d5 Binary files /dev/null and b/starpost/postgres/base/16384/3119 differ diff --git a/starpost/postgres/base/16384/3164 b/starpost/postgres/base/16384/3164 new file mode 100644 index 0000000..26888f2 Binary files /dev/null and b/starpost/postgres/base/16384/3164 differ diff --git a/starpost/postgres/base/16384/3256 b/starpost/postgres/base/16384/3256 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/3257 b/starpost/postgres/base/16384/3257 new file mode 100644 index 0000000..fdfcc40 Binary files /dev/null and b/starpost/postgres/base/16384/3257 differ diff --git a/starpost/postgres/base/16384/3258 b/starpost/postgres/base/16384/3258 new file mode 100644 index 0000000..77dcfae Binary files /dev/null and b/starpost/postgres/base/16384/3258 differ diff --git a/starpost/postgres/base/16384/3350 b/starpost/postgres/base/16384/3350 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/3351 b/starpost/postgres/base/16384/3351 new file mode 100644 index 0000000..e73b1a8 Binary files /dev/null and b/starpost/postgres/base/16384/3351 differ diff --git a/starpost/postgres/base/16384/3379 b/starpost/postgres/base/16384/3379 new file mode 100644 index 0000000..4625f24 Binary files /dev/null and b/starpost/postgres/base/16384/3379 differ diff --git a/starpost/postgres/base/16384/3380 b/starpost/postgres/base/16384/3380 new file mode 100644 index 0000000..4132da3 Binary files /dev/null and b/starpost/postgres/base/16384/3380 differ diff --git a/starpost/postgres/base/16384/3381 b/starpost/postgres/base/16384/3381 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/3394 b/starpost/postgres/base/16384/3394 new file mode 100644 index 0000000..8849544 Binary files /dev/null and b/starpost/postgres/base/16384/3394 differ diff --git a/starpost/postgres/base/16384/3394_fsm b/starpost/postgres/base/16384/3394_fsm new file mode 100644 index 0000000..2a2c5b0 Binary files /dev/null and b/starpost/postgres/base/16384/3394_fsm differ diff --git a/starpost/postgres/base/16384/3394_vm b/starpost/postgres/base/16384/3394_vm new file mode 100644 index 0000000..98bcbad Binary files /dev/null and b/starpost/postgres/base/16384/3394_vm differ diff --git a/starpost/postgres/base/16384/3395 b/starpost/postgres/base/16384/3395 new file mode 100644 index 0000000..c239d73 Binary files /dev/null and b/starpost/postgres/base/16384/3395 differ diff --git a/starpost/postgres/base/16384/3429 b/starpost/postgres/base/16384/3429 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/3430 b/starpost/postgres/base/16384/3430 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/3431 b/starpost/postgres/base/16384/3431 new file mode 100644 index 0000000..69f7761 Binary files /dev/null and b/starpost/postgres/base/16384/3431 differ diff --git a/starpost/postgres/base/16384/3433 b/starpost/postgres/base/16384/3433 new file mode 100644 index 0000000..2308ba8 Binary files /dev/null and b/starpost/postgres/base/16384/3433 differ diff --git a/starpost/postgres/base/16384/3439 b/starpost/postgres/base/16384/3439 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/3440 b/starpost/postgres/base/16384/3440 new file mode 100644 index 0000000..63ef0c7 Binary files /dev/null and b/starpost/postgres/base/16384/3440 differ diff --git a/starpost/postgres/base/16384/3455 b/starpost/postgres/base/16384/3455 new file mode 100644 index 0000000..7ec6328 Binary files /dev/null and b/starpost/postgres/base/16384/3455 differ diff --git a/starpost/postgres/base/16384/3456 b/starpost/postgres/base/16384/3456 new file mode 100644 index 0000000..1037f29 Binary files /dev/null and b/starpost/postgres/base/16384/3456 differ diff --git a/starpost/postgres/base/16384/3456_fsm b/starpost/postgres/base/16384/3456_fsm new file mode 100644 index 0000000..881fb11 Binary files /dev/null and b/starpost/postgres/base/16384/3456_fsm differ diff --git a/starpost/postgres/base/16384/3456_vm b/starpost/postgres/base/16384/3456_vm new file mode 100644 index 0000000..aae1042 Binary files /dev/null and b/starpost/postgres/base/16384/3456_vm differ diff --git a/starpost/postgres/base/16384/3466 b/starpost/postgres/base/16384/3466 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/3467 b/starpost/postgres/base/16384/3467 new file mode 100644 index 0000000..9a44fff Binary files /dev/null and b/starpost/postgres/base/16384/3467 differ diff --git a/starpost/postgres/base/16384/3468 b/starpost/postgres/base/16384/3468 new file mode 100644 index 0000000..df8ab84 Binary files /dev/null and b/starpost/postgres/base/16384/3468 differ diff --git a/starpost/postgres/base/16384/3501 b/starpost/postgres/base/16384/3501 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/3502 b/starpost/postgres/base/16384/3502 new file mode 100644 index 0000000..1056319 Binary files /dev/null and b/starpost/postgres/base/16384/3502 differ diff --git a/starpost/postgres/base/16384/3503 b/starpost/postgres/base/16384/3503 new file mode 100644 index 0000000..4eb645f Binary files /dev/null and b/starpost/postgres/base/16384/3503 differ diff --git a/starpost/postgres/base/16384/3534 b/starpost/postgres/base/16384/3534 new file mode 100644 index 0000000..2c964fd Binary files /dev/null and b/starpost/postgres/base/16384/3534 differ diff --git a/starpost/postgres/base/16384/3541 b/starpost/postgres/base/16384/3541 new file mode 100644 index 0000000..6b1bcab Binary files /dev/null and b/starpost/postgres/base/16384/3541 differ diff --git a/starpost/postgres/base/16384/3541_fsm b/starpost/postgres/base/16384/3541_fsm new file mode 100644 index 0000000..943abb2 Binary files /dev/null and b/starpost/postgres/base/16384/3541_fsm differ diff --git a/starpost/postgres/base/16384/3541_vm b/starpost/postgres/base/16384/3541_vm new file mode 100644 index 0000000..cff2956 Binary files /dev/null and b/starpost/postgres/base/16384/3541_vm differ diff --git a/starpost/postgres/base/16384/3542 b/starpost/postgres/base/16384/3542 new file mode 100644 index 0000000..b8954ce Binary files /dev/null and b/starpost/postgres/base/16384/3542 differ diff --git a/starpost/postgres/base/16384/3574 b/starpost/postgres/base/16384/3574 new file mode 100644 index 0000000..861fa1f Binary files /dev/null and b/starpost/postgres/base/16384/3574 differ diff --git a/starpost/postgres/base/16384/3575 b/starpost/postgres/base/16384/3575 new file mode 100644 index 0000000..638daed Binary files /dev/null and b/starpost/postgres/base/16384/3575 differ diff --git a/starpost/postgres/base/16384/3576 b/starpost/postgres/base/16384/3576 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/3596 b/starpost/postgres/base/16384/3596 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/3597 b/starpost/postgres/base/16384/3597 new file mode 100644 index 0000000..52a8503 Binary files /dev/null and b/starpost/postgres/base/16384/3597 differ diff --git a/starpost/postgres/base/16384/3598 b/starpost/postgres/base/16384/3598 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/3599 b/starpost/postgres/base/16384/3599 new file mode 100644 index 0000000..ae1842d Binary files /dev/null and b/starpost/postgres/base/16384/3599 differ diff --git a/starpost/postgres/base/16384/3600 b/starpost/postgres/base/16384/3600 new file mode 100644 index 0000000..0f72820 Binary files /dev/null and b/starpost/postgres/base/16384/3600 differ diff --git a/starpost/postgres/base/16384/3600_fsm b/starpost/postgres/base/16384/3600_fsm new file mode 100644 index 0000000..98a327e Binary files /dev/null and b/starpost/postgres/base/16384/3600_fsm differ diff --git a/starpost/postgres/base/16384/3600_vm b/starpost/postgres/base/16384/3600_vm new file mode 100644 index 0000000..659b395 Binary files /dev/null and b/starpost/postgres/base/16384/3600_vm differ diff --git a/starpost/postgres/base/16384/3601 b/starpost/postgres/base/16384/3601 new file mode 100644 index 0000000..7c3ee2d Binary files /dev/null and b/starpost/postgres/base/16384/3601 differ diff --git a/starpost/postgres/base/16384/3601_fsm b/starpost/postgres/base/16384/3601_fsm new file mode 100644 index 0000000..c22a597 Binary files /dev/null and b/starpost/postgres/base/16384/3601_fsm differ diff --git a/starpost/postgres/base/16384/3601_vm b/starpost/postgres/base/16384/3601_vm new file mode 100644 index 0000000..5b2ea77 Binary files /dev/null and b/starpost/postgres/base/16384/3601_vm differ diff --git a/starpost/postgres/base/16384/3602 b/starpost/postgres/base/16384/3602 new file mode 100644 index 0000000..a7d2c85 Binary files /dev/null and b/starpost/postgres/base/16384/3602 differ diff --git a/starpost/postgres/base/16384/3602_fsm b/starpost/postgres/base/16384/3602_fsm new file mode 100644 index 0000000..c9b2257 Binary files /dev/null and b/starpost/postgres/base/16384/3602_fsm differ diff --git a/starpost/postgres/base/16384/3602_vm b/starpost/postgres/base/16384/3602_vm new file mode 100644 index 0000000..33ff587 Binary files /dev/null and b/starpost/postgres/base/16384/3602_vm differ diff --git a/starpost/postgres/base/16384/3603 b/starpost/postgres/base/16384/3603 new file mode 100644 index 0000000..296a3f0 Binary files /dev/null and b/starpost/postgres/base/16384/3603 differ diff --git a/starpost/postgres/base/16384/3603_fsm b/starpost/postgres/base/16384/3603_fsm new file mode 100644 index 0000000..cdf17cc Binary files /dev/null and b/starpost/postgres/base/16384/3603_fsm differ diff --git a/starpost/postgres/base/16384/3603_vm b/starpost/postgres/base/16384/3603_vm new file mode 100644 index 0000000..c6623ed Binary files /dev/null and b/starpost/postgres/base/16384/3603_vm differ diff --git a/starpost/postgres/base/16384/3604 b/starpost/postgres/base/16384/3604 new file mode 100644 index 0000000..3ba9d79 Binary files /dev/null and b/starpost/postgres/base/16384/3604 differ diff --git a/starpost/postgres/base/16384/3605 b/starpost/postgres/base/16384/3605 new file mode 100644 index 0000000..020c332 Binary files /dev/null and b/starpost/postgres/base/16384/3605 differ diff --git a/starpost/postgres/base/16384/3606 b/starpost/postgres/base/16384/3606 new file mode 100644 index 0000000..89e80cc Binary files /dev/null and b/starpost/postgres/base/16384/3606 differ diff --git a/starpost/postgres/base/16384/3607 b/starpost/postgres/base/16384/3607 new file mode 100644 index 0000000..6f3a8d8 Binary files /dev/null and b/starpost/postgres/base/16384/3607 differ diff --git a/starpost/postgres/base/16384/3608 b/starpost/postgres/base/16384/3608 new file mode 100644 index 0000000..ab83b78 Binary files /dev/null and b/starpost/postgres/base/16384/3608 differ diff --git a/starpost/postgres/base/16384/3609 b/starpost/postgres/base/16384/3609 new file mode 100644 index 0000000..4e32f2f Binary files /dev/null and b/starpost/postgres/base/16384/3609 differ diff --git a/starpost/postgres/base/16384/3712 b/starpost/postgres/base/16384/3712 new file mode 100644 index 0000000..ef3bf46 Binary files /dev/null and b/starpost/postgres/base/16384/3712 differ diff --git a/starpost/postgres/base/16384/3764 b/starpost/postgres/base/16384/3764 new file mode 100644 index 0000000..7d54be2 Binary files /dev/null and b/starpost/postgres/base/16384/3764 differ diff --git a/starpost/postgres/base/16384/3764_fsm b/starpost/postgres/base/16384/3764_fsm new file mode 100644 index 0000000..a139fd0 Binary files /dev/null and b/starpost/postgres/base/16384/3764_fsm differ diff --git a/starpost/postgres/base/16384/3764_vm b/starpost/postgres/base/16384/3764_vm new file mode 100644 index 0000000..b3b8d20 Binary files /dev/null and b/starpost/postgres/base/16384/3764_vm differ diff --git a/starpost/postgres/base/16384/3766 b/starpost/postgres/base/16384/3766 new file mode 100644 index 0000000..65db334 Binary files /dev/null and b/starpost/postgres/base/16384/3766 differ diff --git a/starpost/postgres/base/16384/3767 b/starpost/postgres/base/16384/3767 new file mode 100644 index 0000000..368f30c Binary files /dev/null and b/starpost/postgres/base/16384/3767 differ diff --git a/starpost/postgres/base/16384/3997 b/starpost/postgres/base/16384/3997 new file mode 100644 index 0000000..33604b0 Binary files /dev/null and b/starpost/postgres/base/16384/3997 differ diff --git a/starpost/postgres/base/16384/4143 b/starpost/postgres/base/16384/4143 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/4144 b/starpost/postgres/base/16384/4144 new file mode 100644 index 0000000..abc5948 Binary files /dev/null and b/starpost/postgres/base/16384/4144 differ diff --git a/starpost/postgres/base/16384/4145 b/starpost/postgres/base/16384/4145 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/4146 b/starpost/postgres/base/16384/4146 new file mode 100644 index 0000000..ec469e4 Binary files /dev/null and b/starpost/postgres/base/16384/4146 differ diff --git a/starpost/postgres/base/16384/4147 b/starpost/postgres/base/16384/4147 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/4148 b/starpost/postgres/base/16384/4148 new file mode 100644 index 0000000..b602d5d Binary files /dev/null and b/starpost/postgres/base/16384/4148 differ diff --git a/starpost/postgres/base/16384/4149 b/starpost/postgres/base/16384/4149 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/4150 b/starpost/postgres/base/16384/4150 new file mode 100644 index 0000000..b8d55fb Binary files /dev/null and b/starpost/postgres/base/16384/4150 differ diff --git a/starpost/postgres/base/16384/4151 b/starpost/postgres/base/16384/4151 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/4152 b/starpost/postgres/base/16384/4152 new file mode 100644 index 0000000..98e5861 Binary files /dev/null and b/starpost/postgres/base/16384/4152 differ diff --git a/starpost/postgres/base/16384/4153 b/starpost/postgres/base/16384/4153 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/4154 b/starpost/postgres/base/16384/4154 new file mode 100644 index 0000000..45b9d43 Binary files /dev/null and b/starpost/postgres/base/16384/4154 differ diff --git a/starpost/postgres/base/16384/4155 b/starpost/postgres/base/16384/4155 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/4156 b/starpost/postgres/base/16384/4156 new file mode 100644 index 0000000..d935d1a Binary files /dev/null and b/starpost/postgres/base/16384/4156 differ diff --git a/starpost/postgres/base/16384/4157 b/starpost/postgres/base/16384/4157 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/4158 b/starpost/postgres/base/16384/4158 new file mode 100644 index 0000000..afb76cb Binary files /dev/null and b/starpost/postgres/base/16384/4158 differ diff --git a/starpost/postgres/base/16384/4159 b/starpost/postgres/base/16384/4159 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/4160 b/starpost/postgres/base/16384/4160 new file mode 100644 index 0000000..c5a18dd Binary files /dev/null and b/starpost/postgres/base/16384/4160 differ diff --git a/starpost/postgres/base/16384/4163 b/starpost/postgres/base/16384/4163 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/4164 b/starpost/postgres/base/16384/4164 new file mode 100644 index 0000000..7f454d1 Binary files /dev/null and b/starpost/postgres/base/16384/4164 differ diff --git a/starpost/postgres/base/16384/4165 b/starpost/postgres/base/16384/4165 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/4166 b/starpost/postgres/base/16384/4166 new file mode 100644 index 0000000..8c7f559 Binary files /dev/null and b/starpost/postgres/base/16384/4166 differ diff --git a/starpost/postgres/base/16384/4167 b/starpost/postgres/base/16384/4167 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/4168 b/starpost/postgres/base/16384/4168 new file mode 100644 index 0000000..44f4504 Binary files /dev/null and b/starpost/postgres/base/16384/4168 differ diff --git a/starpost/postgres/base/16384/4169 b/starpost/postgres/base/16384/4169 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/4170 b/starpost/postgres/base/16384/4170 new file mode 100644 index 0000000..86649a6 Binary files /dev/null and b/starpost/postgres/base/16384/4170 differ diff --git a/starpost/postgres/base/16384/4171 b/starpost/postgres/base/16384/4171 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/4172 b/starpost/postgres/base/16384/4172 new file mode 100644 index 0000000..d8bdc70 Binary files /dev/null and b/starpost/postgres/base/16384/4172 differ diff --git a/starpost/postgres/base/16384/4173 b/starpost/postgres/base/16384/4173 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/4174 b/starpost/postgres/base/16384/4174 new file mode 100644 index 0000000..e772029 Binary files /dev/null and b/starpost/postgres/base/16384/4174 differ diff --git a/starpost/postgres/base/16384/5002 b/starpost/postgres/base/16384/5002 new file mode 100644 index 0000000..76dbdc5 Binary files /dev/null and b/starpost/postgres/base/16384/5002 differ diff --git a/starpost/postgres/base/16384/548 b/starpost/postgres/base/16384/548 new file mode 100644 index 0000000..8fe1ffd Binary files /dev/null and b/starpost/postgres/base/16384/548 differ diff --git a/starpost/postgres/base/16384/549 b/starpost/postgres/base/16384/549 new file mode 100644 index 0000000..04ef359 Binary files /dev/null and b/starpost/postgres/base/16384/549 differ diff --git a/starpost/postgres/base/16384/6102 b/starpost/postgres/base/16384/6102 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/6104 b/starpost/postgres/base/16384/6104 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/6106 b/starpost/postgres/base/16384/6106 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/6110 b/starpost/postgres/base/16384/6110 new file mode 100644 index 0000000..472e29a Binary files /dev/null and b/starpost/postgres/base/16384/6110 differ diff --git a/starpost/postgres/base/16384/6111 b/starpost/postgres/base/16384/6111 new file mode 100644 index 0000000..39a80a1 Binary files /dev/null and b/starpost/postgres/base/16384/6111 differ diff --git a/starpost/postgres/base/16384/6112 b/starpost/postgres/base/16384/6112 new file mode 100644 index 0000000..f5beb7d Binary files /dev/null and b/starpost/postgres/base/16384/6112 differ diff --git a/starpost/postgres/base/16384/6113 b/starpost/postgres/base/16384/6113 new file mode 100644 index 0000000..63487f0 Binary files /dev/null and b/starpost/postgres/base/16384/6113 differ diff --git a/starpost/postgres/base/16384/6116 b/starpost/postgres/base/16384/6116 new file mode 100644 index 0000000..2f71580 Binary files /dev/null and b/starpost/postgres/base/16384/6116 differ diff --git a/starpost/postgres/base/16384/6117 b/starpost/postgres/base/16384/6117 new file mode 100644 index 0000000..38a8686 Binary files /dev/null and b/starpost/postgres/base/16384/6117 differ diff --git a/starpost/postgres/base/16384/6175 b/starpost/postgres/base/16384/6175 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/6176 b/starpost/postgres/base/16384/6176 new file mode 100644 index 0000000..17a1cd5 Binary files /dev/null and b/starpost/postgres/base/16384/6176 differ diff --git a/starpost/postgres/base/16384/6228 b/starpost/postgres/base/16384/6228 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/6229 b/starpost/postgres/base/16384/6229 new file mode 100644 index 0000000..903ee79 Binary files /dev/null and b/starpost/postgres/base/16384/6229 differ diff --git a/starpost/postgres/base/16384/6237 b/starpost/postgres/base/16384/6237 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/6238 b/starpost/postgres/base/16384/6238 new file mode 100644 index 0000000..4423bbc Binary files /dev/null and b/starpost/postgres/base/16384/6238 differ diff --git a/starpost/postgres/base/16384/6239 b/starpost/postgres/base/16384/6239 new file mode 100644 index 0000000..e515566 Binary files /dev/null and b/starpost/postgres/base/16384/6239 differ diff --git a/starpost/postgres/base/16384/826 b/starpost/postgres/base/16384/826 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/16384/827 b/starpost/postgres/base/16384/827 new file mode 100644 index 0000000..ed951c4 Binary files /dev/null and b/starpost/postgres/base/16384/827 differ diff --git a/starpost/postgres/base/16384/828 b/starpost/postgres/base/16384/828 new file mode 100644 index 0000000..e97c828 Binary files /dev/null and b/starpost/postgres/base/16384/828 differ diff --git a/starpost/postgres/base/16384/PG_VERSION b/starpost/postgres/base/16384/PG_VERSION new file mode 100644 index 0000000..b6a7d89 --- /dev/null +++ b/starpost/postgres/base/16384/PG_VERSION @@ -0,0 +1 @@ +16 diff --git a/starpost/postgres/base/16384/pg_filenode.map b/starpost/postgres/base/16384/pg_filenode.map new file mode 100644 index 0000000..4fc801a Binary files /dev/null and b/starpost/postgres/base/16384/pg_filenode.map differ diff --git a/starpost/postgres/base/16384/pg_internal.init b/starpost/postgres/base/16384/pg_internal.init new file mode 100644 index 0000000..f0b48b2 Binary files /dev/null and b/starpost/postgres/base/16384/pg_internal.init differ diff --git a/starpost/postgres/base/4/112 b/starpost/postgres/base/4/112 new file mode 100644 index 0000000..2bfc88c Binary files /dev/null and b/starpost/postgres/base/4/112 differ diff --git a/starpost/postgres/base/4/113 b/starpost/postgres/base/4/113 new file mode 100644 index 0000000..c36defa Binary files /dev/null and b/starpost/postgres/base/4/113 differ diff --git a/starpost/postgres/base/4/1247 b/starpost/postgres/base/4/1247 new file mode 100644 index 0000000..23cfd22 Binary files /dev/null and b/starpost/postgres/base/4/1247 differ diff --git a/starpost/postgres/base/4/1247_fsm b/starpost/postgres/base/4/1247_fsm new file mode 100644 index 0000000..013faac Binary files /dev/null and b/starpost/postgres/base/4/1247_fsm differ diff --git a/starpost/postgres/base/4/1247_vm b/starpost/postgres/base/4/1247_vm new file mode 100644 index 0000000..d88e7ca Binary files /dev/null and b/starpost/postgres/base/4/1247_vm differ diff --git a/starpost/postgres/base/4/1249 b/starpost/postgres/base/4/1249 new file mode 100644 index 0000000..360e1ba Binary files /dev/null and b/starpost/postgres/base/4/1249 differ diff --git a/starpost/postgres/base/4/1249_fsm b/starpost/postgres/base/4/1249_fsm new file mode 100644 index 0000000..a538ac8 Binary files /dev/null and b/starpost/postgres/base/4/1249_fsm differ diff --git a/starpost/postgres/base/4/1249_vm b/starpost/postgres/base/4/1249_vm new file mode 100644 index 0000000..ac50d4b Binary files /dev/null and b/starpost/postgres/base/4/1249_vm differ diff --git a/starpost/postgres/base/4/1255 b/starpost/postgres/base/4/1255 new file mode 100644 index 0000000..32fbb00 Binary files /dev/null and b/starpost/postgres/base/4/1255 differ diff --git a/starpost/postgres/base/4/1255_fsm b/starpost/postgres/base/4/1255_fsm new file mode 100644 index 0000000..69a5d8f Binary files /dev/null and b/starpost/postgres/base/4/1255_fsm differ diff --git a/starpost/postgres/base/4/1255_vm b/starpost/postgres/base/4/1255_vm new file mode 100644 index 0000000..44989f0 Binary files /dev/null and b/starpost/postgres/base/4/1255_vm differ diff --git a/starpost/postgres/base/4/1259 b/starpost/postgres/base/4/1259 new file mode 100644 index 0000000..6ced088 Binary files /dev/null and b/starpost/postgres/base/4/1259 differ diff --git a/starpost/postgres/base/4/1259_fsm b/starpost/postgres/base/4/1259_fsm new file mode 100644 index 0000000..05d8c51 Binary files /dev/null and b/starpost/postgres/base/4/1259_fsm differ diff --git a/starpost/postgres/base/4/1259_vm b/starpost/postgres/base/4/1259_vm new file mode 100644 index 0000000..7947f8a Binary files /dev/null and b/starpost/postgres/base/4/1259_vm differ diff --git a/starpost/postgres/base/4/13494 b/starpost/postgres/base/4/13494 new file mode 100644 index 0000000..d43a990 Binary files /dev/null and b/starpost/postgres/base/4/13494 differ diff --git a/starpost/postgres/base/4/13494_fsm b/starpost/postgres/base/4/13494_fsm new file mode 100644 index 0000000..2a80b9a Binary files /dev/null and b/starpost/postgres/base/4/13494_fsm differ diff --git a/starpost/postgres/base/4/13494_vm b/starpost/postgres/base/4/13494_vm new file mode 100644 index 0000000..d510ebf Binary files /dev/null and b/starpost/postgres/base/4/13494_vm differ diff --git a/starpost/postgres/base/4/13497 b/starpost/postgres/base/4/13497 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/13498 b/starpost/postgres/base/4/13498 new file mode 100644 index 0000000..a9f220b Binary files /dev/null and b/starpost/postgres/base/4/13498 differ diff --git a/starpost/postgres/base/4/13499 b/starpost/postgres/base/4/13499 new file mode 100644 index 0000000..9059bc3 Binary files /dev/null and b/starpost/postgres/base/4/13499 differ diff --git a/starpost/postgres/base/4/13499_fsm b/starpost/postgres/base/4/13499_fsm new file mode 100644 index 0000000..70d16ce Binary files /dev/null and b/starpost/postgres/base/4/13499_fsm differ diff --git a/starpost/postgres/base/4/13499_vm b/starpost/postgres/base/4/13499_vm new file mode 100644 index 0000000..6faadfc Binary files /dev/null and b/starpost/postgres/base/4/13499_vm differ diff --git a/starpost/postgres/base/4/13502 b/starpost/postgres/base/4/13502 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/13503 b/starpost/postgres/base/4/13503 new file mode 100644 index 0000000..ff2f77f Binary files /dev/null and b/starpost/postgres/base/4/13503 differ diff --git a/starpost/postgres/base/4/13504 b/starpost/postgres/base/4/13504 new file mode 100644 index 0000000..673bb43 Binary files /dev/null and b/starpost/postgres/base/4/13504 differ diff --git a/starpost/postgres/base/4/13504_fsm b/starpost/postgres/base/4/13504_fsm new file mode 100644 index 0000000..0673ada Binary files /dev/null and b/starpost/postgres/base/4/13504_fsm differ diff --git a/starpost/postgres/base/4/13504_vm b/starpost/postgres/base/4/13504_vm new file mode 100644 index 0000000..e8a0226 Binary files /dev/null and b/starpost/postgres/base/4/13504_vm differ diff --git a/starpost/postgres/base/4/13507 b/starpost/postgres/base/4/13507 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/13508 b/starpost/postgres/base/4/13508 new file mode 100644 index 0000000..ee6fba3 Binary files /dev/null and b/starpost/postgres/base/4/13508 differ diff --git a/starpost/postgres/base/4/13509 b/starpost/postgres/base/4/13509 new file mode 100644 index 0000000..1f545e4 Binary files /dev/null and b/starpost/postgres/base/4/13509 differ diff --git a/starpost/postgres/base/4/13509_fsm b/starpost/postgres/base/4/13509_fsm new file mode 100644 index 0000000..a836ddf Binary files /dev/null and b/starpost/postgres/base/4/13509_fsm differ diff --git a/starpost/postgres/base/4/13509_vm b/starpost/postgres/base/4/13509_vm new file mode 100644 index 0000000..2413a11 Binary files /dev/null and b/starpost/postgres/base/4/13509_vm differ diff --git a/starpost/postgres/base/4/13512 b/starpost/postgres/base/4/13512 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/13513 b/starpost/postgres/base/4/13513 new file mode 100644 index 0000000..b39e7f9 Binary files /dev/null and b/starpost/postgres/base/4/13513 differ diff --git a/starpost/postgres/base/4/1417 b/starpost/postgres/base/4/1417 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/1418 b/starpost/postgres/base/4/1418 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/174 b/starpost/postgres/base/4/174 new file mode 100644 index 0000000..fedcb88 Binary files /dev/null and b/starpost/postgres/base/4/174 differ diff --git a/starpost/postgres/base/4/175 b/starpost/postgres/base/4/175 new file mode 100644 index 0000000..7ee5b4a Binary files /dev/null and b/starpost/postgres/base/4/175 differ diff --git a/starpost/postgres/base/4/2187 b/starpost/postgres/base/4/2187 new file mode 100644 index 0000000..77d8c76 Binary files /dev/null and b/starpost/postgres/base/4/2187 differ diff --git a/starpost/postgres/base/4/2224 b/starpost/postgres/base/4/2224 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/2228 b/starpost/postgres/base/4/2228 new file mode 100644 index 0000000..738f259 Binary files /dev/null and b/starpost/postgres/base/4/2228 differ diff --git a/starpost/postgres/base/4/2328 b/starpost/postgres/base/4/2328 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/2336 b/starpost/postgres/base/4/2336 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/2337 b/starpost/postgres/base/4/2337 new file mode 100644 index 0000000..b706ef8 Binary files /dev/null and b/starpost/postgres/base/4/2337 differ diff --git a/starpost/postgres/base/4/2579 b/starpost/postgres/base/4/2579 new file mode 100644 index 0000000..556006d Binary files /dev/null and b/starpost/postgres/base/4/2579 differ diff --git a/starpost/postgres/base/4/2600 b/starpost/postgres/base/4/2600 new file mode 100644 index 0000000..d98ee62 Binary files /dev/null and b/starpost/postgres/base/4/2600 differ diff --git a/starpost/postgres/base/4/2600_fsm b/starpost/postgres/base/4/2600_fsm new file mode 100644 index 0000000..0938592 Binary files /dev/null and b/starpost/postgres/base/4/2600_fsm differ diff --git a/starpost/postgres/base/4/2600_vm b/starpost/postgres/base/4/2600_vm new file mode 100644 index 0000000..93bc475 Binary files /dev/null and b/starpost/postgres/base/4/2600_vm differ diff --git a/starpost/postgres/base/4/2601 b/starpost/postgres/base/4/2601 new file mode 100644 index 0000000..d8001c8 Binary files /dev/null and b/starpost/postgres/base/4/2601 differ diff --git a/starpost/postgres/base/4/2601_fsm b/starpost/postgres/base/4/2601_fsm new file mode 100644 index 0000000..d388044 Binary files /dev/null and b/starpost/postgres/base/4/2601_fsm differ diff --git a/starpost/postgres/base/4/2601_vm b/starpost/postgres/base/4/2601_vm new file mode 100644 index 0000000..058f7ce Binary files /dev/null and b/starpost/postgres/base/4/2601_vm differ diff --git a/starpost/postgres/base/4/2602 b/starpost/postgres/base/4/2602 new file mode 100644 index 0000000..4a27b0a Binary files /dev/null and b/starpost/postgres/base/4/2602 differ diff --git a/starpost/postgres/base/4/2602_fsm b/starpost/postgres/base/4/2602_fsm new file mode 100644 index 0000000..23170d8 Binary files /dev/null and b/starpost/postgres/base/4/2602_fsm differ diff --git a/starpost/postgres/base/4/2602_vm b/starpost/postgres/base/4/2602_vm new file mode 100644 index 0000000..22487c6 Binary files /dev/null and b/starpost/postgres/base/4/2602_vm differ diff --git a/starpost/postgres/base/4/2603 b/starpost/postgres/base/4/2603 new file mode 100644 index 0000000..d511af5 Binary files /dev/null and b/starpost/postgres/base/4/2603 differ diff --git a/starpost/postgres/base/4/2603_fsm b/starpost/postgres/base/4/2603_fsm new file mode 100644 index 0000000..949bd18 Binary files /dev/null and b/starpost/postgres/base/4/2603_fsm differ diff --git a/starpost/postgres/base/4/2603_vm b/starpost/postgres/base/4/2603_vm new file mode 100644 index 0000000..e29ade0 Binary files /dev/null and b/starpost/postgres/base/4/2603_vm differ diff --git a/starpost/postgres/base/4/2604 b/starpost/postgres/base/4/2604 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/2605 b/starpost/postgres/base/4/2605 new file mode 100644 index 0000000..eeaa7ea Binary files /dev/null and b/starpost/postgres/base/4/2605 differ diff --git a/starpost/postgres/base/4/2605_fsm b/starpost/postgres/base/4/2605_fsm new file mode 100644 index 0000000..f3b92bf Binary files /dev/null and b/starpost/postgres/base/4/2605_fsm differ diff --git a/starpost/postgres/base/4/2605_vm b/starpost/postgres/base/4/2605_vm new file mode 100644 index 0000000..24d1473 Binary files /dev/null and b/starpost/postgres/base/4/2605_vm differ diff --git a/starpost/postgres/base/4/2606 b/starpost/postgres/base/4/2606 new file mode 100644 index 0000000..2b56312 Binary files /dev/null and b/starpost/postgres/base/4/2606 differ diff --git a/starpost/postgres/base/4/2606_fsm b/starpost/postgres/base/4/2606_fsm new file mode 100644 index 0000000..267454e Binary files /dev/null and b/starpost/postgres/base/4/2606_fsm differ diff --git a/starpost/postgres/base/4/2606_vm b/starpost/postgres/base/4/2606_vm new file mode 100644 index 0000000..eeb8ee2 Binary files /dev/null and b/starpost/postgres/base/4/2606_vm differ diff --git a/starpost/postgres/base/4/2607 b/starpost/postgres/base/4/2607 new file mode 100644 index 0000000..bfad49a Binary files /dev/null and b/starpost/postgres/base/4/2607 differ diff --git a/starpost/postgres/base/4/2607_fsm b/starpost/postgres/base/4/2607_fsm new file mode 100644 index 0000000..80ac8b1 Binary files /dev/null and b/starpost/postgres/base/4/2607_fsm differ diff --git a/starpost/postgres/base/4/2607_vm b/starpost/postgres/base/4/2607_vm new file mode 100644 index 0000000..c60487f Binary files /dev/null and b/starpost/postgres/base/4/2607_vm differ diff --git a/starpost/postgres/base/4/2608 b/starpost/postgres/base/4/2608 new file mode 100644 index 0000000..23cfc40 Binary files /dev/null and b/starpost/postgres/base/4/2608 differ diff --git a/starpost/postgres/base/4/2608_fsm b/starpost/postgres/base/4/2608_fsm new file mode 100644 index 0000000..95081cd Binary files /dev/null and b/starpost/postgres/base/4/2608_fsm differ diff --git a/starpost/postgres/base/4/2608_vm b/starpost/postgres/base/4/2608_vm new file mode 100644 index 0000000..0c661e1 Binary files /dev/null and b/starpost/postgres/base/4/2608_vm differ diff --git a/starpost/postgres/base/4/2609 b/starpost/postgres/base/4/2609 new file mode 100644 index 0000000..faa6e96 Binary files /dev/null and b/starpost/postgres/base/4/2609 differ diff --git a/starpost/postgres/base/4/2609_fsm b/starpost/postgres/base/4/2609_fsm new file mode 100644 index 0000000..c2980be Binary files /dev/null and b/starpost/postgres/base/4/2609_fsm differ diff --git a/starpost/postgres/base/4/2609_vm b/starpost/postgres/base/4/2609_vm new file mode 100644 index 0000000..d82ac29 Binary files /dev/null and b/starpost/postgres/base/4/2609_vm differ diff --git a/starpost/postgres/base/4/2610 b/starpost/postgres/base/4/2610 new file mode 100644 index 0000000..c1db3ac Binary files /dev/null and b/starpost/postgres/base/4/2610 differ diff --git a/starpost/postgres/base/4/2610_fsm b/starpost/postgres/base/4/2610_fsm new file mode 100644 index 0000000..ecbcb5f Binary files /dev/null and b/starpost/postgres/base/4/2610_fsm differ diff --git a/starpost/postgres/base/4/2610_vm b/starpost/postgres/base/4/2610_vm new file mode 100644 index 0000000..d59baf0 Binary files /dev/null and b/starpost/postgres/base/4/2610_vm differ diff --git a/starpost/postgres/base/4/2611 b/starpost/postgres/base/4/2611 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/2612 b/starpost/postgres/base/4/2612 new file mode 100644 index 0000000..5f425a8 Binary files /dev/null and b/starpost/postgres/base/4/2612 differ diff --git a/starpost/postgres/base/4/2612_fsm b/starpost/postgres/base/4/2612_fsm new file mode 100644 index 0000000..877976a Binary files /dev/null and b/starpost/postgres/base/4/2612_fsm differ diff --git a/starpost/postgres/base/4/2612_vm b/starpost/postgres/base/4/2612_vm new file mode 100644 index 0000000..a035ede Binary files /dev/null and b/starpost/postgres/base/4/2612_vm differ diff --git a/starpost/postgres/base/4/2613 b/starpost/postgres/base/4/2613 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/2615 b/starpost/postgres/base/4/2615 new file mode 100644 index 0000000..c11828a Binary files /dev/null and b/starpost/postgres/base/4/2615 differ diff --git a/starpost/postgres/base/4/2615_fsm b/starpost/postgres/base/4/2615_fsm new file mode 100644 index 0000000..d041693 Binary files /dev/null and b/starpost/postgres/base/4/2615_fsm differ diff --git a/starpost/postgres/base/4/2615_vm b/starpost/postgres/base/4/2615_vm new file mode 100644 index 0000000..fd02aae Binary files /dev/null and b/starpost/postgres/base/4/2615_vm differ diff --git a/starpost/postgres/base/4/2616 b/starpost/postgres/base/4/2616 new file mode 100644 index 0000000..0d60d79 Binary files /dev/null and b/starpost/postgres/base/4/2616 differ diff --git a/starpost/postgres/base/4/2616_fsm b/starpost/postgres/base/4/2616_fsm new file mode 100644 index 0000000..cb924c9 Binary files /dev/null and b/starpost/postgres/base/4/2616_fsm differ diff --git a/starpost/postgres/base/4/2616_vm b/starpost/postgres/base/4/2616_vm new file mode 100644 index 0000000..d9d3ba6 Binary files /dev/null and b/starpost/postgres/base/4/2616_vm differ diff --git a/starpost/postgres/base/4/2617 b/starpost/postgres/base/4/2617 new file mode 100644 index 0000000..bcdfc18 Binary files /dev/null and b/starpost/postgres/base/4/2617 differ diff --git a/starpost/postgres/base/4/2617_fsm b/starpost/postgres/base/4/2617_fsm new file mode 100644 index 0000000..29d6066 Binary files /dev/null and b/starpost/postgres/base/4/2617_fsm differ diff --git a/starpost/postgres/base/4/2617_vm b/starpost/postgres/base/4/2617_vm new file mode 100644 index 0000000..b182c7e Binary files /dev/null and b/starpost/postgres/base/4/2617_vm differ diff --git a/starpost/postgres/base/4/2618 b/starpost/postgres/base/4/2618 new file mode 100644 index 0000000..4e400e4 Binary files /dev/null and b/starpost/postgres/base/4/2618 differ diff --git a/starpost/postgres/base/4/2618_fsm b/starpost/postgres/base/4/2618_fsm new file mode 100644 index 0000000..bcee926 Binary files /dev/null and b/starpost/postgres/base/4/2618_fsm differ diff --git a/starpost/postgres/base/4/2618_vm b/starpost/postgres/base/4/2618_vm new file mode 100644 index 0000000..6a0ae79 Binary files /dev/null and b/starpost/postgres/base/4/2618_vm differ diff --git a/starpost/postgres/base/4/2619 b/starpost/postgres/base/4/2619 new file mode 100644 index 0000000..aee9452 Binary files /dev/null and b/starpost/postgres/base/4/2619 differ diff --git a/starpost/postgres/base/4/2619_fsm b/starpost/postgres/base/4/2619_fsm new file mode 100644 index 0000000..482e225 Binary files /dev/null and b/starpost/postgres/base/4/2619_fsm differ diff --git a/starpost/postgres/base/4/2619_vm b/starpost/postgres/base/4/2619_vm new file mode 100644 index 0000000..1081e4d Binary files /dev/null and b/starpost/postgres/base/4/2619_vm differ diff --git a/starpost/postgres/base/4/2620 b/starpost/postgres/base/4/2620 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/2650 b/starpost/postgres/base/4/2650 new file mode 100644 index 0000000..ef4f21b Binary files /dev/null and b/starpost/postgres/base/4/2650 differ diff --git a/starpost/postgres/base/4/2651 b/starpost/postgres/base/4/2651 new file mode 100644 index 0000000..9d21e32 Binary files /dev/null and b/starpost/postgres/base/4/2651 differ diff --git a/starpost/postgres/base/4/2652 b/starpost/postgres/base/4/2652 new file mode 100644 index 0000000..ab6e13e Binary files /dev/null and b/starpost/postgres/base/4/2652 differ diff --git a/starpost/postgres/base/4/2653 b/starpost/postgres/base/4/2653 new file mode 100644 index 0000000..4c032c8 Binary files /dev/null and b/starpost/postgres/base/4/2653 differ diff --git a/starpost/postgres/base/4/2654 b/starpost/postgres/base/4/2654 new file mode 100644 index 0000000..53aa6fc Binary files /dev/null and b/starpost/postgres/base/4/2654 differ diff --git a/starpost/postgres/base/4/2655 b/starpost/postgres/base/4/2655 new file mode 100644 index 0000000..0b22aae Binary files /dev/null and b/starpost/postgres/base/4/2655 differ diff --git a/starpost/postgres/base/4/2656 b/starpost/postgres/base/4/2656 new file mode 100644 index 0000000..0e2e0bc Binary files /dev/null and b/starpost/postgres/base/4/2656 differ diff --git a/starpost/postgres/base/4/2657 b/starpost/postgres/base/4/2657 new file mode 100644 index 0000000..a87fd85 Binary files /dev/null and b/starpost/postgres/base/4/2657 differ diff --git a/starpost/postgres/base/4/2658 b/starpost/postgres/base/4/2658 new file mode 100644 index 0000000..e3155fb Binary files /dev/null and b/starpost/postgres/base/4/2658 differ diff --git a/starpost/postgres/base/4/2659 b/starpost/postgres/base/4/2659 new file mode 100644 index 0000000..98e79cc Binary files /dev/null and b/starpost/postgres/base/4/2659 differ diff --git a/starpost/postgres/base/4/2660 b/starpost/postgres/base/4/2660 new file mode 100644 index 0000000..3a7a1d2 Binary files /dev/null and b/starpost/postgres/base/4/2660 differ diff --git a/starpost/postgres/base/4/2661 b/starpost/postgres/base/4/2661 new file mode 100644 index 0000000..aa5178a Binary files /dev/null and b/starpost/postgres/base/4/2661 differ diff --git a/starpost/postgres/base/4/2662 b/starpost/postgres/base/4/2662 new file mode 100644 index 0000000..bf3a721 Binary files /dev/null and b/starpost/postgres/base/4/2662 differ diff --git a/starpost/postgres/base/4/2663 b/starpost/postgres/base/4/2663 new file mode 100644 index 0000000..f5aa563 Binary files /dev/null and b/starpost/postgres/base/4/2663 differ diff --git a/starpost/postgres/base/4/2664 b/starpost/postgres/base/4/2664 new file mode 100644 index 0000000..12b1f5b Binary files /dev/null and b/starpost/postgres/base/4/2664 differ diff --git a/starpost/postgres/base/4/2665 b/starpost/postgres/base/4/2665 new file mode 100644 index 0000000..2a5a6de Binary files /dev/null and b/starpost/postgres/base/4/2665 differ diff --git a/starpost/postgres/base/4/2666 b/starpost/postgres/base/4/2666 new file mode 100644 index 0000000..d87561c Binary files /dev/null and b/starpost/postgres/base/4/2666 differ diff --git a/starpost/postgres/base/4/2667 b/starpost/postgres/base/4/2667 new file mode 100644 index 0000000..f8b060b Binary files /dev/null and b/starpost/postgres/base/4/2667 differ diff --git a/starpost/postgres/base/4/2668 b/starpost/postgres/base/4/2668 new file mode 100644 index 0000000..c5baf1d Binary files /dev/null and b/starpost/postgres/base/4/2668 differ diff --git a/starpost/postgres/base/4/2669 b/starpost/postgres/base/4/2669 new file mode 100644 index 0000000..7379bc3 Binary files /dev/null and b/starpost/postgres/base/4/2669 differ diff --git a/starpost/postgres/base/4/2670 b/starpost/postgres/base/4/2670 new file mode 100644 index 0000000..5b35b4d Binary files /dev/null and b/starpost/postgres/base/4/2670 differ diff --git a/starpost/postgres/base/4/2673 b/starpost/postgres/base/4/2673 new file mode 100644 index 0000000..2e78353 Binary files /dev/null and b/starpost/postgres/base/4/2673 differ diff --git a/starpost/postgres/base/4/2674 b/starpost/postgres/base/4/2674 new file mode 100644 index 0000000..40852a0 Binary files /dev/null and b/starpost/postgres/base/4/2674 differ diff --git a/starpost/postgres/base/4/2675 b/starpost/postgres/base/4/2675 new file mode 100644 index 0000000..4a4b1fd Binary files /dev/null and b/starpost/postgres/base/4/2675 differ diff --git a/starpost/postgres/base/4/2678 b/starpost/postgres/base/4/2678 new file mode 100644 index 0000000..2086279 Binary files /dev/null and b/starpost/postgres/base/4/2678 differ diff --git a/starpost/postgres/base/4/2679 b/starpost/postgres/base/4/2679 new file mode 100644 index 0000000..8ddcf90 Binary files /dev/null and b/starpost/postgres/base/4/2679 differ diff --git a/starpost/postgres/base/4/2680 b/starpost/postgres/base/4/2680 new file mode 100644 index 0000000..e15ddb4 Binary files /dev/null and b/starpost/postgres/base/4/2680 differ diff --git a/starpost/postgres/base/4/2681 b/starpost/postgres/base/4/2681 new file mode 100644 index 0000000..bbeb640 Binary files /dev/null and b/starpost/postgres/base/4/2681 differ diff --git a/starpost/postgres/base/4/2682 b/starpost/postgres/base/4/2682 new file mode 100644 index 0000000..28f957f Binary files /dev/null and b/starpost/postgres/base/4/2682 differ diff --git a/starpost/postgres/base/4/2683 b/starpost/postgres/base/4/2683 new file mode 100644 index 0000000..014cbee Binary files /dev/null and b/starpost/postgres/base/4/2683 differ diff --git a/starpost/postgres/base/4/2684 b/starpost/postgres/base/4/2684 new file mode 100644 index 0000000..d7cd584 Binary files /dev/null and b/starpost/postgres/base/4/2684 differ diff --git a/starpost/postgres/base/4/2685 b/starpost/postgres/base/4/2685 new file mode 100644 index 0000000..01a32e9 Binary files /dev/null and b/starpost/postgres/base/4/2685 differ diff --git a/starpost/postgres/base/4/2686 b/starpost/postgres/base/4/2686 new file mode 100644 index 0000000..51e4357 Binary files /dev/null and b/starpost/postgres/base/4/2686 differ diff --git a/starpost/postgres/base/4/2687 b/starpost/postgres/base/4/2687 new file mode 100644 index 0000000..8df59d1 Binary files /dev/null and b/starpost/postgres/base/4/2687 differ diff --git a/starpost/postgres/base/4/2688 b/starpost/postgres/base/4/2688 new file mode 100644 index 0000000..f5448dc Binary files /dev/null and b/starpost/postgres/base/4/2688 differ diff --git a/starpost/postgres/base/4/2689 b/starpost/postgres/base/4/2689 new file mode 100644 index 0000000..8f8223b Binary files /dev/null and b/starpost/postgres/base/4/2689 differ diff --git a/starpost/postgres/base/4/2690 b/starpost/postgres/base/4/2690 new file mode 100644 index 0000000..273454a Binary files /dev/null and b/starpost/postgres/base/4/2690 differ diff --git a/starpost/postgres/base/4/2691 b/starpost/postgres/base/4/2691 new file mode 100644 index 0000000..c816edc Binary files /dev/null and b/starpost/postgres/base/4/2691 differ diff --git a/starpost/postgres/base/4/2692 b/starpost/postgres/base/4/2692 new file mode 100644 index 0000000..6dee73d Binary files /dev/null and b/starpost/postgres/base/4/2692 differ diff --git a/starpost/postgres/base/4/2693 b/starpost/postgres/base/4/2693 new file mode 100644 index 0000000..78bee54 Binary files /dev/null and b/starpost/postgres/base/4/2693 differ diff --git a/starpost/postgres/base/4/2696 b/starpost/postgres/base/4/2696 new file mode 100644 index 0000000..a504e55 Binary files /dev/null and b/starpost/postgres/base/4/2696 differ diff --git a/starpost/postgres/base/4/2699 b/starpost/postgres/base/4/2699 new file mode 100644 index 0000000..8417313 Binary files /dev/null and b/starpost/postgres/base/4/2699 differ diff --git a/starpost/postgres/base/4/2701 b/starpost/postgres/base/4/2701 new file mode 100644 index 0000000..8892de2 Binary files /dev/null and b/starpost/postgres/base/4/2701 differ diff --git a/starpost/postgres/base/4/2702 b/starpost/postgres/base/4/2702 new file mode 100644 index 0000000..c40e5aa Binary files /dev/null and b/starpost/postgres/base/4/2702 differ diff --git a/starpost/postgres/base/4/2703 b/starpost/postgres/base/4/2703 new file mode 100644 index 0000000..2a9cbd8 Binary files /dev/null and b/starpost/postgres/base/4/2703 differ diff --git a/starpost/postgres/base/4/2704 b/starpost/postgres/base/4/2704 new file mode 100644 index 0000000..36b4068 Binary files /dev/null and b/starpost/postgres/base/4/2704 differ diff --git a/starpost/postgres/base/4/2753 b/starpost/postgres/base/4/2753 new file mode 100644 index 0000000..3c16dff Binary files /dev/null and b/starpost/postgres/base/4/2753 differ diff --git a/starpost/postgres/base/4/2753_fsm b/starpost/postgres/base/4/2753_fsm new file mode 100644 index 0000000..642bce3 Binary files /dev/null and b/starpost/postgres/base/4/2753_fsm differ diff --git a/starpost/postgres/base/4/2753_vm b/starpost/postgres/base/4/2753_vm new file mode 100644 index 0000000..f7e91c6 Binary files /dev/null and b/starpost/postgres/base/4/2753_vm differ diff --git a/starpost/postgres/base/4/2754 b/starpost/postgres/base/4/2754 new file mode 100644 index 0000000..f3df39d Binary files /dev/null and b/starpost/postgres/base/4/2754 differ diff --git a/starpost/postgres/base/4/2755 b/starpost/postgres/base/4/2755 new file mode 100644 index 0000000..cc671dc Binary files /dev/null and b/starpost/postgres/base/4/2755 differ diff --git a/starpost/postgres/base/4/2756 b/starpost/postgres/base/4/2756 new file mode 100644 index 0000000..6a6c87e Binary files /dev/null and b/starpost/postgres/base/4/2756 differ diff --git a/starpost/postgres/base/4/2757 b/starpost/postgres/base/4/2757 new file mode 100644 index 0000000..57830cb Binary files /dev/null and b/starpost/postgres/base/4/2757 differ diff --git a/starpost/postgres/base/4/2830 b/starpost/postgres/base/4/2830 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/2831 b/starpost/postgres/base/4/2831 new file mode 100644 index 0000000..6c30e94 Binary files /dev/null and b/starpost/postgres/base/4/2831 differ diff --git a/starpost/postgres/base/4/2832 b/starpost/postgres/base/4/2832 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/2833 b/starpost/postgres/base/4/2833 new file mode 100644 index 0000000..e364449 Binary files /dev/null and b/starpost/postgres/base/4/2833 differ diff --git a/starpost/postgres/base/4/2834 b/starpost/postgres/base/4/2834 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/2835 b/starpost/postgres/base/4/2835 new file mode 100644 index 0000000..b028c65 Binary files /dev/null and b/starpost/postgres/base/4/2835 differ diff --git a/starpost/postgres/base/4/2836 b/starpost/postgres/base/4/2836 new file mode 100644 index 0000000..e678cbd Binary files /dev/null and b/starpost/postgres/base/4/2836 differ diff --git a/starpost/postgres/base/4/2836_fsm b/starpost/postgres/base/4/2836_fsm new file mode 100644 index 0000000..06e1e26 Binary files /dev/null and b/starpost/postgres/base/4/2836_fsm differ diff --git a/starpost/postgres/base/4/2836_vm b/starpost/postgres/base/4/2836_vm new file mode 100644 index 0000000..cef3ff9 Binary files /dev/null and b/starpost/postgres/base/4/2836_vm differ diff --git a/starpost/postgres/base/4/2837 b/starpost/postgres/base/4/2837 new file mode 100644 index 0000000..2925518 Binary files /dev/null and b/starpost/postgres/base/4/2837 differ diff --git a/starpost/postgres/base/4/2838 b/starpost/postgres/base/4/2838 new file mode 100644 index 0000000..bed85ee Binary files /dev/null and b/starpost/postgres/base/4/2838 differ diff --git a/starpost/postgres/base/4/2838_fsm b/starpost/postgres/base/4/2838_fsm new file mode 100644 index 0000000..b9e860e Binary files /dev/null and b/starpost/postgres/base/4/2838_fsm differ diff --git a/starpost/postgres/base/4/2838_vm b/starpost/postgres/base/4/2838_vm new file mode 100644 index 0000000..d2933ea Binary files /dev/null and b/starpost/postgres/base/4/2838_vm differ diff --git a/starpost/postgres/base/4/2839 b/starpost/postgres/base/4/2839 new file mode 100644 index 0000000..b7f7c44 Binary files /dev/null and b/starpost/postgres/base/4/2839 differ diff --git a/starpost/postgres/base/4/2840 b/starpost/postgres/base/4/2840 new file mode 100644 index 0000000..39c4b5d Binary files /dev/null and b/starpost/postgres/base/4/2840 differ diff --git a/starpost/postgres/base/4/2840_fsm b/starpost/postgres/base/4/2840_fsm new file mode 100644 index 0000000..a454fb0 Binary files /dev/null and b/starpost/postgres/base/4/2840_fsm differ diff --git a/starpost/postgres/base/4/2840_vm b/starpost/postgres/base/4/2840_vm new file mode 100644 index 0000000..6eaf453 Binary files /dev/null and b/starpost/postgres/base/4/2840_vm differ diff --git a/starpost/postgres/base/4/2841 b/starpost/postgres/base/4/2841 new file mode 100644 index 0000000..8384ff8 Binary files /dev/null and b/starpost/postgres/base/4/2841 differ diff --git a/starpost/postgres/base/4/2995 b/starpost/postgres/base/4/2995 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/2996 b/starpost/postgres/base/4/2996 new file mode 100644 index 0000000..9bd6faf Binary files /dev/null and b/starpost/postgres/base/4/2996 differ diff --git a/starpost/postgres/base/4/3079 b/starpost/postgres/base/4/3079 new file mode 100644 index 0000000..647d3e9 Binary files /dev/null and b/starpost/postgres/base/4/3079 differ diff --git a/starpost/postgres/base/4/3079_fsm b/starpost/postgres/base/4/3079_fsm new file mode 100644 index 0000000..7732d22 Binary files /dev/null and b/starpost/postgres/base/4/3079_fsm differ diff --git a/starpost/postgres/base/4/3079_vm b/starpost/postgres/base/4/3079_vm new file mode 100644 index 0000000..3438618 Binary files /dev/null and b/starpost/postgres/base/4/3079_vm differ diff --git a/starpost/postgres/base/4/3080 b/starpost/postgres/base/4/3080 new file mode 100644 index 0000000..32632ec Binary files /dev/null and b/starpost/postgres/base/4/3080 differ diff --git a/starpost/postgres/base/4/3081 b/starpost/postgres/base/4/3081 new file mode 100644 index 0000000..f1b9e01 Binary files /dev/null and b/starpost/postgres/base/4/3081 differ diff --git a/starpost/postgres/base/4/3085 b/starpost/postgres/base/4/3085 new file mode 100644 index 0000000..f688645 Binary files /dev/null and b/starpost/postgres/base/4/3085 differ diff --git a/starpost/postgres/base/4/3118 b/starpost/postgres/base/4/3118 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/3119 b/starpost/postgres/base/4/3119 new file mode 100644 index 0000000..8524de7 Binary files /dev/null and b/starpost/postgres/base/4/3119 differ diff --git a/starpost/postgres/base/4/3164 b/starpost/postgres/base/4/3164 new file mode 100644 index 0000000..8cc619f Binary files /dev/null and b/starpost/postgres/base/4/3164 differ diff --git a/starpost/postgres/base/4/3256 b/starpost/postgres/base/4/3256 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/3257 b/starpost/postgres/base/4/3257 new file mode 100644 index 0000000..6f325ab Binary files /dev/null and b/starpost/postgres/base/4/3257 differ diff --git a/starpost/postgres/base/4/3258 b/starpost/postgres/base/4/3258 new file mode 100644 index 0000000..10c3c94 Binary files /dev/null and b/starpost/postgres/base/4/3258 differ diff --git a/starpost/postgres/base/4/3350 b/starpost/postgres/base/4/3350 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/3351 b/starpost/postgres/base/4/3351 new file mode 100644 index 0000000..2bfef7f Binary files /dev/null and b/starpost/postgres/base/4/3351 differ diff --git a/starpost/postgres/base/4/3379 b/starpost/postgres/base/4/3379 new file mode 100644 index 0000000..b41a45f Binary files /dev/null and b/starpost/postgres/base/4/3379 differ diff --git a/starpost/postgres/base/4/3380 b/starpost/postgres/base/4/3380 new file mode 100644 index 0000000..f9d290e Binary files /dev/null and b/starpost/postgres/base/4/3380 differ diff --git a/starpost/postgres/base/4/3381 b/starpost/postgres/base/4/3381 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/3394 b/starpost/postgres/base/4/3394 new file mode 100644 index 0000000..3ada57d Binary files /dev/null and b/starpost/postgres/base/4/3394 differ diff --git a/starpost/postgres/base/4/3394_fsm b/starpost/postgres/base/4/3394_fsm new file mode 100644 index 0000000..38ac5f8 Binary files /dev/null and b/starpost/postgres/base/4/3394_fsm differ diff --git a/starpost/postgres/base/4/3394_vm b/starpost/postgres/base/4/3394_vm new file mode 100644 index 0000000..5545f17 Binary files /dev/null and b/starpost/postgres/base/4/3394_vm differ diff --git a/starpost/postgres/base/4/3395 b/starpost/postgres/base/4/3395 new file mode 100644 index 0000000..48cf9ba Binary files /dev/null and b/starpost/postgres/base/4/3395 differ diff --git a/starpost/postgres/base/4/3429 b/starpost/postgres/base/4/3429 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/3430 b/starpost/postgres/base/4/3430 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/3431 b/starpost/postgres/base/4/3431 new file mode 100644 index 0000000..a890bbf Binary files /dev/null and b/starpost/postgres/base/4/3431 differ diff --git a/starpost/postgres/base/4/3433 b/starpost/postgres/base/4/3433 new file mode 100644 index 0000000..b9e444b Binary files /dev/null and b/starpost/postgres/base/4/3433 differ diff --git a/starpost/postgres/base/4/3439 b/starpost/postgres/base/4/3439 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/3440 b/starpost/postgres/base/4/3440 new file mode 100644 index 0000000..5b55040 Binary files /dev/null and b/starpost/postgres/base/4/3440 differ diff --git a/starpost/postgres/base/4/3455 b/starpost/postgres/base/4/3455 new file mode 100644 index 0000000..765545a Binary files /dev/null and b/starpost/postgres/base/4/3455 differ diff --git a/starpost/postgres/base/4/3456 b/starpost/postgres/base/4/3456 new file mode 100644 index 0000000..dbe1a53 Binary files /dev/null and b/starpost/postgres/base/4/3456 differ diff --git a/starpost/postgres/base/4/3456_fsm b/starpost/postgres/base/4/3456_fsm new file mode 100644 index 0000000..0ff6488 Binary files /dev/null and b/starpost/postgres/base/4/3456_fsm differ diff --git a/starpost/postgres/base/4/3456_vm b/starpost/postgres/base/4/3456_vm new file mode 100644 index 0000000..fa6477f Binary files /dev/null and b/starpost/postgres/base/4/3456_vm differ diff --git a/starpost/postgres/base/4/3466 b/starpost/postgres/base/4/3466 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/3467 b/starpost/postgres/base/4/3467 new file mode 100644 index 0000000..188a5e6 Binary files /dev/null and b/starpost/postgres/base/4/3467 differ diff --git a/starpost/postgres/base/4/3468 b/starpost/postgres/base/4/3468 new file mode 100644 index 0000000..00d26fe Binary files /dev/null and b/starpost/postgres/base/4/3468 differ diff --git a/starpost/postgres/base/4/3501 b/starpost/postgres/base/4/3501 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/3502 b/starpost/postgres/base/4/3502 new file mode 100644 index 0000000..51e62aa Binary files /dev/null and b/starpost/postgres/base/4/3502 differ diff --git a/starpost/postgres/base/4/3503 b/starpost/postgres/base/4/3503 new file mode 100644 index 0000000..818ee9e Binary files /dev/null and b/starpost/postgres/base/4/3503 differ diff --git a/starpost/postgres/base/4/3534 b/starpost/postgres/base/4/3534 new file mode 100644 index 0000000..338d308 Binary files /dev/null and b/starpost/postgres/base/4/3534 differ diff --git a/starpost/postgres/base/4/3541 b/starpost/postgres/base/4/3541 new file mode 100644 index 0000000..40869ad Binary files /dev/null and b/starpost/postgres/base/4/3541 differ diff --git a/starpost/postgres/base/4/3541_fsm b/starpost/postgres/base/4/3541_fsm new file mode 100644 index 0000000..a3a2de4 Binary files /dev/null and b/starpost/postgres/base/4/3541_fsm differ diff --git a/starpost/postgres/base/4/3541_vm b/starpost/postgres/base/4/3541_vm new file mode 100644 index 0000000..7a78303 Binary files /dev/null and b/starpost/postgres/base/4/3541_vm differ diff --git a/starpost/postgres/base/4/3542 b/starpost/postgres/base/4/3542 new file mode 100644 index 0000000..ced0066 Binary files /dev/null and b/starpost/postgres/base/4/3542 differ diff --git a/starpost/postgres/base/4/3574 b/starpost/postgres/base/4/3574 new file mode 100644 index 0000000..b026df1 Binary files /dev/null and b/starpost/postgres/base/4/3574 differ diff --git a/starpost/postgres/base/4/3575 b/starpost/postgres/base/4/3575 new file mode 100644 index 0000000..bdec532 Binary files /dev/null and b/starpost/postgres/base/4/3575 differ diff --git a/starpost/postgres/base/4/3576 b/starpost/postgres/base/4/3576 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/3596 b/starpost/postgres/base/4/3596 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/3597 b/starpost/postgres/base/4/3597 new file mode 100644 index 0000000..6947306 Binary files /dev/null and b/starpost/postgres/base/4/3597 differ diff --git a/starpost/postgres/base/4/3598 b/starpost/postgres/base/4/3598 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/3599 b/starpost/postgres/base/4/3599 new file mode 100644 index 0000000..32bf577 Binary files /dev/null and b/starpost/postgres/base/4/3599 differ diff --git a/starpost/postgres/base/4/3600 b/starpost/postgres/base/4/3600 new file mode 100644 index 0000000..6cca16e Binary files /dev/null and b/starpost/postgres/base/4/3600 differ diff --git a/starpost/postgres/base/4/3600_fsm b/starpost/postgres/base/4/3600_fsm new file mode 100644 index 0000000..cebec19 Binary files /dev/null and b/starpost/postgres/base/4/3600_fsm differ diff --git a/starpost/postgres/base/4/3600_vm b/starpost/postgres/base/4/3600_vm new file mode 100644 index 0000000..07044d1 Binary files /dev/null and b/starpost/postgres/base/4/3600_vm differ diff --git a/starpost/postgres/base/4/3601 b/starpost/postgres/base/4/3601 new file mode 100644 index 0000000..04c846e Binary files /dev/null and b/starpost/postgres/base/4/3601 differ diff --git a/starpost/postgres/base/4/3601_fsm b/starpost/postgres/base/4/3601_fsm new file mode 100644 index 0000000..7732d22 Binary files /dev/null and b/starpost/postgres/base/4/3601_fsm differ diff --git a/starpost/postgres/base/4/3601_vm b/starpost/postgres/base/4/3601_vm new file mode 100644 index 0000000..22b9666 Binary files /dev/null and b/starpost/postgres/base/4/3601_vm differ diff --git a/starpost/postgres/base/4/3602 b/starpost/postgres/base/4/3602 new file mode 100644 index 0000000..d1c92d9 Binary files /dev/null and b/starpost/postgres/base/4/3602 differ diff --git a/starpost/postgres/base/4/3602_fsm b/starpost/postgres/base/4/3602_fsm new file mode 100644 index 0000000..d7897de Binary files /dev/null and b/starpost/postgres/base/4/3602_fsm differ diff --git a/starpost/postgres/base/4/3602_vm b/starpost/postgres/base/4/3602_vm new file mode 100644 index 0000000..a550486 Binary files /dev/null and b/starpost/postgres/base/4/3602_vm differ diff --git a/starpost/postgres/base/4/3603 b/starpost/postgres/base/4/3603 new file mode 100644 index 0000000..54b0933 Binary files /dev/null and b/starpost/postgres/base/4/3603 differ diff --git a/starpost/postgres/base/4/3603_fsm b/starpost/postgres/base/4/3603_fsm new file mode 100644 index 0000000..c28dd4f Binary files /dev/null and b/starpost/postgres/base/4/3603_fsm differ diff --git a/starpost/postgres/base/4/3603_vm b/starpost/postgres/base/4/3603_vm new file mode 100644 index 0000000..ecac229 Binary files /dev/null and b/starpost/postgres/base/4/3603_vm differ diff --git a/starpost/postgres/base/4/3604 b/starpost/postgres/base/4/3604 new file mode 100644 index 0000000..6c4a813 Binary files /dev/null and b/starpost/postgres/base/4/3604 differ diff --git a/starpost/postgres/base/4/3605 b/starpost/postgres/base/4/3605 new file mode 100644 index 0000000..d21dcb3 Binary files /dev/null and b/starpost/postgres/base/4/3605 differ diff --git a/starpost/postgres/base/4/3606 b/starpost/postgres/base/4/3606 new file mode 100644 index 0000000..5d00237 Binary files /dev/null and b/starpost/postgres/base/4/3606 differ diff --git a/starpost/postgres/base/4/3607 b/starpost/postgres/base/4/3607 new file mode 100644 index 0000000..3a1af44 Binary files /dev/null and b/starpost/postgres/base/4/3607 differ diff --git a/starpost/postgres/base/4/3608 b/starpost/postgres/base/4/3608 new file mode 100644 index 0000000..9d67984 Binary files /dev/null and b/starpost/postgres/base/4/3608 differ diff --git a/starpost/postgres/base/4/3609 b/starpost/postgres/base/4/3609 new file mode 100644 index 0000000..ea3aa7c Binary files /dev/null and b/starpost/postgres/base/4/3609 differ diff --git a/starpost/postgres/base/4/3712 b/starpost/postgres/base/4/3712 new file mode 100644 index 0000000..8d214b5 Binary files /dev/null and b/starpost/postgres/base/4/3712 differ diff --git a/starpost/postgres/base/4/3764 b/starpost/postgres/base/4/3764 new file mode 100644 index 0000000..4b19ab2 Binary files /dev/null and b/starpost/postgres/base/4/3764 differ diff --git a/starpost/postgres/base/4/3764_fsm b/starpost/postgres/base/4/3764_fsm new file mode 100644 index 0000000..f64db4d Binary files /dev/null and b/starpost/postgres/base/4/3764_fsm differ diff --git a/starpost/postgres/base/4/3764_vm b/starpost/postgres/base/4/3764_vm new file mode 100644 index 0000000..be4fe23 Binary files /dev/null and b/starpost/postgres/base/4/3764_vm differ diff --git a/starpost/postgres/base/4/3766 b/starpost/postgres/base/4/3766 new file mode 100644 index 0000000..cbe718c Binary files /dev/null and b/starpost/postgres/base/4/3766 differ diff --git a/starpost/postgres/base/4/3767 b/starpost/postgres/base/4/3767 new file mode 100644 index 0000000..1210714 Binary files /dev/null and b/starpost/postgres/base/4/3767 differ diff --git a/starpost/postgres/base/4/3997 b/starpost/postgres/base/4/3997 new file mode 100644 index 0000000..28b5b4b Binary files /dev/null and b/starpost/postgres/base/4/3997 differ diff --git a/starpost/postgres/base/4/4143 b/starpost/postgres/base/4/4143 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/4144 b/starpost/postgres/base/4/4144 new file mode 100644 index 0000000..781f37a Binary files /dev/null and b/starpost/postgres/base/4/4144 differ diff --git a/starpost/postgres/base/4/4145 b/starpost/postgres/base/4/4145 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/4146 b/starpost/postgres/base/4/4146 new file mode 100644 index 0000000..11ccf7e Binary files /dev/null and b/starpost/postgres/base/4/4146 differ diff --git a/starpost/postgres/base/4/4147 b/starpost/postgres/base/4/4147 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/4148 b/starpost/postgres/base/4/4148 new file mode 100644 index 0000000..7fd05a8 Binary files /dev/null and b/starpost/postgres/base/4/4148 differ diff --git a/starpost/postgres/base/4/4149 b/starpost/postgres/base/4/4149 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/4150 b/starpost/postgres/base/4/4150 new file mode 100644 index 0000000..10171f6 Binary files /dev/null and b/starpost/postgres/base/4/4150 differ diff --git a/starpost/postgres/base/4/4151 b/starpost/postgres/base/4/4151 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/4152 b/starpost/postgres/base/4/4152 new file mode 100644 index 0000000..869a7f3 Binary files /dev/null and b/starpost/postgres/base/4/4152 differ diff --git a/starpost/postgres/base/4/4153 b/starpost/postgres/base/4/4153 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/4154 b/starpost/postgres/base/4/4154 new file mode 100644 index 0000000..bb1dca3 Binary files /dev/null and b/starpost/postgres/base/4/4154 differ diff --git a/starpost/postgres/base/4/4155 b/starpost/postgres/base/4/4155 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/4156 b/starpost/postgres/base/4/4156 new file mode 100644 index 0000000..839ab86 Binary files /dev/null and b/starpost/postgres/base/4/4156 differ diff --git a/starpost/postgres/base/4/4157 b/starpost/postgres/base/4/4157 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/4158 b/starpost/postgres/base/4/4158 new file mode 100644 index 0000000..12e6868 Binary files /dev/null and b/starpost/postgres/base/4/4158 differ diff --git a/starpost/postgres/base/4/4159 b/starpost/postgres/base/4/4159 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/4160 b/starpost/postgres/base/4/4160 new file mode 100644 index 0000000..8b80112 Binary files /dev/null and b/starpost/postgres/base/4/4160 differ diff --git a/starpost/postgres/base/4/4163 b/starpost/postgres/base/4/4163 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/4164 b/starpost/postgres/base/4/4164 new file mode 100644 index 0000000..e86ba95 Binary files /dev/null and b/starpost/postgres/base/4/4164 differ diff --git a/starpost/postgres/base/4/4165 b/starpost/postgres/base/4/4165 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/4166 b/starpost/postgres/base/4/4166 new file mode 100644 index 0000000..f5fc2b6 Binary files /dev/null and b/starpost/postgres/base/4/4166 differ diff --git a/starpost/postgres/base/4/4167 b/starpost/postgres/base/4/4167 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/4168 b/starpost/postgres/base/4/4168 new file mode 100644 index 0000000..fdfe146 Binary files /dev/null and b/starpost/postgres/base/4/4168 differ diff --git a/starpost/postgres/base/4/4169 b/starpost/postgres/base/4/4169 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/4170 b/starpost/postgres/base/4/4170 new file mode 100644 index 0000000..797418b Binary files /dev/null and b/starpost/postgres/base/4/4170 differ diff --git a/starpost/postgres/base/4/4171 b/starpost/postgres/base/4/4171 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/4172 b/starpost/postgres/base/4/4172 new file mode 100644 index 0000000..969a191 Binary files /dev/null and b/starpost/postgres/base/4/4172 differ diff --git a/starpost/postgres/base/4/4173 b/starpost/postgres/base/4/4173 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/4174 b/starpost/postgres/base/4/4174 new file mode 100644 index 0000000..3c4beb7 Binary files /dev/null and b/starpost/postgres/base/4/4174 differ diff --git a/starpost/postgres/base/4/5002 b/starpost/postgres/base/4/5002 new file mode 100644 index 0000000..aefa40d Binary files /dev/null and b/starpost/postgres/base/4/5002 differ diff --git a/starpost/postgres/base/4/548 b/starpost/postgres/base/4/548 new file mode 100644 index 0000000..d6379eb Binary files /dev/null and b/starpost/postgres/base/4/548 differ diff --git a/starpost/postgres/base/4/549 b/starpost/postgres/base/4/549 new file mode 100644 index 0000000..a762ad9 Binary files /dev/null and b/starpost/postgres/base/4/549 differ diff --git a/starpost/postgres/base/4/6102 b/starpost/postgres/base/4/6102 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/6104 b/starpost/postgres/base/4/6104 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/6106 b/starpost/postgres/base/4/6106 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/6110 b/starpost/postgres/base/4/6110 new file mode 100644 index 0000000..42e1920 Binary files /dev/null and b/starpost/postgres/base/4/6110 differ diff --git a/starpost/postgres/base/4/6111 b/starpost/postgres/base/4/6111 new file mode 100644 index 0000000..d012727 Binary files /dev/null and b/starpost/postgres/base/4/6111 differ diff --git a/starpost/postgres/base/4/6112 b/starpost/postgres/base/4/6112 new file mode 100644 index 0000000..293367c Binary files /dev/null and b/starpost/postgres/base/4/6112 differ diff --git a/starpost/postgres/base/4/6113 b/starpost/postgres/base/4/6113 new file mode 100644 index 0000000..542f8fa Binary files /dev/null and b/starpost/postgres/base/4/6113 differ diff --git a/starpost/postgres/base/4/6116 b/starpost/postgres/base/4/6116 new file mode 100644 index 0000000..787d5d1 Binary files /dev/null and b/starpost/postgres/base/4/6116 differ diff --git a/starpost/postgres/base/4/6117 b/starpost/postgres/base/4/6117 new file mode 100644 index 0000000..2b5656b Binary files /dev/null and b/starpost/postgres/base/4/6117 differ diff --git a/starpost/postgres/base/4/6175 b/starpost/postgres/base/4/6175 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/6176 b/starpost/postgres/base/4/6176 new file mode 100644 index 0000000..34cba03 Binary files /dev/null and b/starpost/postgres/base/4/6176 differ diff --git a/starpost/postgres/base/4/6228 b/starpost/postgres/base/4/6228 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/6229 b/starpost/postgres/base/4/6229 new file mode 100644 index 0000000..4839713 Binary files /dev/null and b/starpost/postgres/base/4/6229 differ diff --git a/starpost/postgres/base/4/6237 b/starpost/postgres/base/4/6237 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/6238 b/starpost/postgres/base/4/6238 new file mode 100644 index 0000000..e7c0e8c Binary files /dev/null and b/starpost/postgres/base/4/6238 differ diff --git a/starpost/postgres/base/4/6239 b/starpost/postgres/base/4/6239 new file mode 100644 index 0000000..6c60b50 Binary files /dev/null and b/starpost/postgres/base/4/6239 differ diff --git a/starpost/postgres/base/4/826 b/starpost/postgres/base/4/826 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/4/827 b/starpost/postgres/base/4/827 new file mode 100644 index 0000000..bcaf0a1 Binary files /dev/null and b/starpost/postgres/base/4/827 differ diff --git a/starpost/postgres/base/4/828 b/starpost/postgres/base/4/828 new file mode 100644 index 0000000..7aba562 Binary files /dev/null and b/starpost/postgres/base/4/828 differ diff --git a/starpost/postgres/base/4/PG_VERSION b/starpost/postgres/base/4/PG_VERSION new file mode 100644 index 0000000..b6a7d89 --- /dev/null +++ b/starpost/postgres/base/4/PG_VERSION @@ -0,0 +1 @@ +16 diff --git a/starpost/postgres/base/4/pg_filenode.map b/starpost/postgres/base/4/pg_filenode.map new file mode 100644 index 0000000..4fc801a Binary files /dev/null and b/starpost/postgres/base/4/pg_filenode.map differ diff --git a/starpost/postgres/base/5/112 b/starpost/postgres/base/5/112 new file mode 100644 index 0000000..2bfc88c Binary files /dev/null and b/starpost/postgres/base/5/112 differ diff --git a/starpost/postgres/base/5/113 b/starpost/postgres/base/5/113 new file mode 100644 index 0000000..c36defa Binary files /dev/null and b/starpost/postgres/base/5/113 differ diff --git a/starpost/postgres/base/5/1247 b/starpost/postgres/base/5/1247 new file mode 100644 index 0000000..23cfd22 Binary files /dev/null and b/starpost/postgres/base/5/1247 differ diff --git a/starpost/postgres/base/5/1247_fsm b/starpost/postgres/base/5/1247_fsm new file mode 100644 index 0000000..013faac Binary files /dev/null and b/starpost/postgres/base/5/1247_fsm differ diff --git a/starpost/postgres/base/5/1247_vm b/starpost/postgres/base/5/1247_vm new file mode 100644 index 0000000..d88e7ca Binary files /dev/null and b/starpost/postgres/base/5/1247_vm differ diff --git a/starpost/postgres/base/5/1249 b/starpost/postgres/base/5/1249 new file mode 100644 index 0000000..360e1ba Binary files /dev/null and b/starpost/postgres/base/5/1249 differ diff --git a/starpost/postgres/base/5/1249_fsm b/starpost/postgres/base/5/1249_fsm new file mode 100644 index 0000000..a538ac8 Binary files /dev/null and b/starpost/postgres/base/5/1249_fsm differ diff --git a/starpost/postgres/base/5/1249_vm b/starpost/postgres/base/5/1249_vm new file mode 100644 index 0000000..ac50d4b Binary files /dev/null and b/starpost/postgres/base/5/1249_vm differ diff --git a/starpost/postgres/base/5/1255 b/starpost/postgres/base/5/1255 new file mode 100644 index 0000000..32fbb00 Binary files /dev/null and b/starpost/postgres/base/5/1255 differ diff --git a/starpost/postgres/base/5/1255_fsm b/starpost/postgres/base/5/1255_fsm new file mode 100644 index 0000000..69a5d8f Binary files /dev/null and b/starpost/postgres/base/5/1255_fsm differ diff --git a/starpost/postgres/base/5/1255_vm b/starpost/postgres/base/5/1255_vm new file mode 100644 index 0000000..44989f0 Binary files /dev/null and b/starpost/postgres/base/5/1255_vm differ diff --git a/starpost/postgres/base/5/1259 b/starpost/postgres/base/5/1259 new file mode 100644 index 0000000..af7b9a7 Binary files /dev/null and b/starpost/postgres/base/5/1259 differ diff --git a/starpost/postgres/base/5/1259_fsm b/starpost/postgres/base/5/1259_fsm new file mode 100644 index 0000000..05d8c51 Binary files /dev/null and b/starpost/postgres/base/5/1259_fsm differ diff --git a/starpost/postgres/base/5/1259_vm b/starpost/postgres/base/5/1259_vm new file mode 100644 index 0000000..7947f8a Binary files /dev/null and b/starpost/postgres/base/5/1259_vm differ diff --git a/starpost/postgres/base/5/13494 b/starpost/postgres/base/5/13494 new file mode 100644 index 0000000..d43a990 Binary files /dev/null and b/starpost/postgres/base/5/13494 differ diff --git a/starpost/postgres/base/5/13494_fsm b/starpost/postgres/base/5/13494_fsm new file mode 100644 index 0000000..2a80b9a Binary files /dev/null and b/starpost/postgres/base/5/13494_fsm differ diff --git a/starpost/postgres/base/5/13494_vm b/starpost/postgres/base/5/13494_vm new file mode 100644 index 0000000..d510ebf Binary files /dev/null and b/starpost/postgres/base/5/13494_vm differ diff --git a/starpost/postgres/base/5/13497 b/starpost/postgres/base/5/13497 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/13498 b/starpost/postgres/base/5/13498 new file mode 100644 index 0000000..a9f220b Binary files /dev/null and b/starpost/postgres/base/5/13498 differ diff --git a/starpost/postgres/base/5/13499 b/starpost/postgres/base/5/13499 new file mode 100644 index 0000000..9059bc3 Binary files /dev/null and b/starpost/postgres/base/5/13499 differ diff --git a/starpost/postgres/base/5/13499_fsm b/starpost/postgres/base/5/13499_fsm new file mode 100644 index 0000000..70d16ce Binary files /dev/null and b/starpost/postgres/base/5/13499_fsm differ diff --git a/starpost/postgres/base/5/13499_vm b/starpost/postgres/base/5/13499_vm new file mode 100644 index 0000000..6faadfc Binary files /dev/null and b/starpost/postgres/base/5/13499_vm differ diff --git a/starpost/postgres/base/5/13502 b/starpost/postgres/base/5/13502 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/13503 b/starpost/postgres/base/5/13503 new file mode 100644 index 0000000..ff2f77f Binary files /dev/null and b/starpost/postgres/base/5/13503 differ diff --git a/starpost/postgres/base/5/13504 b/starpost/postgres/base/5/13504 new file mode 100644 index 0000000..673bb43 Binary files /dev/null and b/starpost/postgres/base/5/13504 differ diff --git a/starpost/postgres/base/5/13504_fsm b/starpost/postgres/base/5/13504_fsm new file mode 100644 index 0000000..0673ada Binary files /dev/null and b/starpost/postgres/base/5/13504_fsm differ diff --git a/starpost/postgres/base/5/13504_vm b/starpost/postgres/base/5/13504_vm new file mode 100644 index 0000000..e8a0226 Binary files /dev/null and b/starpost/postgres/base/5/13504_vm differ diff --git a/starpost/postgres/base/5/13507 b/starpost/postgres/base/5/13507 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/13508 b/starpost/postgres/base/5/13508 new file mode 100644 index 0000000..ee6fba3 Binary files /dev/null and b/starpost/postgres/base/5/13508 differ diff --git a/starpost/postgres/base/5/13509 b/starpost/postgres/base/5/13509 new file mode 100644 index 0000000..1f545e4 Binary files /dev/null and b/starpost/postgres/base/5/13509 differ diff --git a/starpost/postgres/base/5/13509_fsm b/starpost/postgres/base/5/13509_fsm new file mode 100644 index 0000000..a836ddf Binary files /dev/null and b/starpost/postgres/base/5/13509_fsm differ diff --git a/starpost/postgres/base/5/13509_vm b/starpost/postgres/base/5/13509_vm new file mode 100644 index 0000000..2413a11 Binary files /dev/null and b/starpost/postgres/base/5/13509_vm differ diff --git a/starpost/postgres/base/5/13512 b/starpost/postgres/base/5/13512 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/13513 b/starpost/postgres/base/5/13513 new file mode 100644 index 0000000..b39e7f9 Binary files /dev/null and b/starpost/postgres/base/5/13513 differ diff --git a/starpost/postgres/base/5/1417 b/starpost/postgres/base/5/1417 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/1418 b/starpost/postgres/base/5/1418 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/174 b/starpost/postgres/base/5/174 new file mode 100644 index 0000000..fedcb88 Binary files /dev/null and b/starpost/postgres/base/5/174 differ diff --git a/starpost/postgres/base/5/175 b/starpost/postgres/base/5/175 new file mode 100644 index 0000000..7ee5b4a Binary files /dev/null and b/starpost/postgres/base/5/175 differ diff --git a/starpost/postgres/base/5/2187 b/starpost/postgres/base/5/2187 new file mode 100644 index 0000000..77d8c76 Binary files /dev/null and b/starpost/postgres/base/5/2187 differ diff --git a/starpost/postgres/base/5/2224 b/starpost/postgres/base/5/2224 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/2228 b/starpost/postgres/base/5/2228 new file mode 100644 index 0000000..738f259 Binary files /dev/null and b/starpost/postgres/base/5/2228 differ diff --git a/starpost/postgres/base/5/2328 b/starpost/postgres/base/5/2328 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/2336 b/starpost/postgres/base/5/2336 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/2337 b/starpost/postgres/base/5/2337 new file mode 100644 index 0000000..b706ef8 Binary files /dev/null and b/starpost/postgres/base/5/2337 differ diff --git a/starpost/postgres/base/5/2579 b/starpost/postgres/base/5/2579 new file mode 100644 index 0000000..556006d Binary files /dev/null and b/starpost/postgres/base/5/2579 differ diff --git a/starpost/postgres/base/5/2600 b/starpost/postgres/base/5/2600 new file mode 100644 index 0000000..d98ee62 Binary files /dev/null and b/starpost/postgres/base/5/2600 differ diff --git a/starpost/postgres/base/5/2600_fsm b/starpost/postgres/base/5/2600_fsm new file mode 100644 index 0000000..0938592 Binary files /dev/null and b/starpost/postgres/base/5/2600_fsm differ diff --git a/starpost/postgres/base/5/2600_vm b/starpost/postgres/base/5/2600_vm new file mode 100644 index 0000000..93bc475 Binary files /dev/null and b/starpost/postgres/base/5/2600_vm differ diff --git a/starpost/postgres/base/5/2601 b/starpost/postgres/base/5/2601 new file mode 100644 index 0000000..d8001c8 Binary files /dev/null and b/starpost/postgres/base/5/2601 differ diff --git a/starpost/postgres/base/5/2601_fsm b/starpost/postgres/base/5/2601_fsm new file mode 100644 index 0000000..d388044 Binary files /dev/null and b/starpost/postgres/base/5/2601_fsm differ diff --git a/starpost/postgres/base/5/2601_vm b/starpost/postgres/base/5/2601_vm new file mode 100644 index 0000000..058f7ce Binary files /dev/null and b/starpost/postgres/base/5/2601_vm differ diff --git a/starpost/postgres/base/5/2602 b/starpost/postgres/base/5/2602 new file mode 100644 index 0000000..4a27b0a Binary files /dev/null and b/starpost/postgres/base/5/2602 differ diff --git a/starpost/postgres/base/5/2602_fsm b/starpost/postgres/base/5/2602_fsm new file mode 100644 index 0000000..23170d8 Binary files /dev/null and b/starpost/postgres/base/5/2602_fsm differ diff --git a/starpost/postgres/base/5/2602_vm b/starpost/postgres/base/5/2602_vm new file mode 100644 index 0000000..22487c6 Binary files /dev/null and b/starpost/postgres/base/5/2602_vm differ diff --git a/starpost/postgres/base/5/2603 b/starpost/postgres/base/5/2603 new file mode 100644 index 0000000..d511af5 Binary files /dev/null and b/starpost/postgres/base/5/2603 differ diff --git a/starpost/postgres/base/5/2603_fsm b/starpost/postgres/base/5/2603_fsm new file mode 100644 index 0000000..949bd18 Binary files /dev/null and b/starpost/postgres/base/5/2603_fsm differ diff --git a/starpost/postgres/base/5/2603_vm b/starpost/postgres/base/5/2603_vm new file mode 100644 index 0000000..e29ade0 Binary files /dev/null and b/starpost/postgres/base/5/2603_vm differ diff --git a/starpost/postgres/base/5/2604 b/starpost/postgres/base/5/2604 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/2605 b/starpost/postgres/base/5/2605 new file mode 100644 index 0000000..eeaa7ea Binary files /dev/null and b/starpost/postgres/base/5/2605 differ diff --git a/starpost/postgres/base/5/2605_fsm b/starpost/postgres/base/5/2605_fsm new file mode 100644 index 0000000..f3b92bf Binary files /dev/null and b/starpost/postgres/base/5/2605_fsm differ diff --git a/starpost/postgres/base/5/2605_vm b/starpost/postgres/base/5/2605_vm new file mode 100644 index 0000000..24d1473 Binary files /dev/null and b/starpost/postgres/base/5/2605_vm differ diff --git a/starpost/postgres/base/5/2606 b/starpost/postgres/base/5/2606 new file mode 100644 index 0000000..2b56312 Binary files /dev/null and b/starpost/postgres/base/5/2606 differ diff --git a/starpost/postgres/base/5/2606_fsm b/starpost/postgres/base/5/2606_fsm new file mode 100644 index 0000000..267454e Binary files /dev/null and b/starpost/postgres/base/5/2606_fsm differ diff --git a/starpost/postgres/base/5/2606_vm b/starpost/postgres/base/5/2606_vm new file mode 100644 index 0000000..eeb8ee2 Binary files /dev/null and b/starpost/postgres/base/5/2606_vm differ diff --git a/starpost/postgres/base/5/2607 b/starpost/postgres/base/5/2607 new file mode 100644 index 0000000..bfad49a Binary files /dev/null and b/starpost/postgres/base/5/2607 differ diff --git a/starpost/postgres/base/5/2607_fsm b/starpost/postgres/base/5/2607_fsm new file mode 100644 index 0000000..80ac8b1 Binary files /dev/null and b/starpost/postgres/base/5/2607_fsm differ diff --git a/starpost/postgres/base/5/2607_vm b/starpost/postgres/base/5/2607_vm new file mode 100644 index 0000000..c60487f Binary files /dev/null and b/starpost/postgres/base/5/2607_vm differ diff --git a/starpost/postgres/base/5/2608 b/starpost/postgres/base/5/2608 new file mode 100644 index 0000000..23cfc40 Binary files /dev/null and b/starpost/postgres/base/5/2608 differ diff --git a/starpost/postgres/base/5/2608_fsm b/starpost/postgres/base/5/2608_fsm new file mode 100644 index 0000000..95081cd Binary files /dev/null and b/starpost/postgres/base/5/2608_fsm differ diff --git a/starpost/postgres/base/5/2608_vm b/starpost/postgres/base/5/2608_vm new file mode 100644 index 0000000..0c661e1 Binary files /dev/null and b/starpost/postgres/base/5/2608_vm differ diff --git a/starpost/postgres/base/5/2609 b/starpost/postgres/base/5/2609 new file mode 100644 index 0000000..faa6e96 Binary files /dev/null and b/starpost/postgres/base/5/2609 differ diff --git a/starpost/postgres/base/5/2609_fsm b/starpost/postgres/base/5/2609_fsm new file mode 100644 index 0000000..c2980be Binary files /dev/null and b/starpost/postgres/base/5/2609_fsm differ diff --git a/starpost/postgres/base/5/2609_vm b/starpost/postgres/base/5/2609_vm new file mode 100644 index 0000000..d82ac29 Binary files /dev/null and b/starpost/postgres/base/5/2609_vm differ diff --git a/starpost/postgres/base/5/2610 b/starpost/postgres/base/5/2610 new file mode 100644 index 0000000..c1db3ac Binary files /dev/null and b/starpost/postgres/base/5/2610 differ diff --git a/starpost/postgres/base/5/2610_fsm b/starpost/postgres/base/5/2610_fsm new file mode 100644 index 0000000..ecbcb5f Binary files /dev/null and b/starpost/postgres/base/5/2610_fsm differ diff --git a/starpost/postgres/base/5/2610_vm b/starpost/postgres/base/5/2610_vm new file mode 100644 index 0000000..d59baf0 Binary files /dev/null and b/starpost/postgres/base/5/2610_vm differ diff --git a/starpost/postgres/base/5/2611 b/starpost/postgres/base/5/2611 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/2612 b/starpost/postgres/base/5/2612 new file mode 100644 index 0000000..5f425a8 Binary files /dev/null and b/starpost/postgres/base/5/2612 differ diff --git a/starpost/postgres/base/5/2612_fsm b/starpost/postgres/base/5/2612_fsm new file mode 100644 index 0000000..877976a Binary files /dev/null and b/starpost/postgres/base/5/2612_fsm differ diff --git a/starpost/postgres/base/5/2612_vm b/starpost/postgres/base/5/2612_vm new file mode 100644 index 0000000..a035ede Binary files /dev/null and b/starpost/postgres/base/5/2612_vm differ diff --git a/starpost/postgres/base/5/2613 b/starpost/postgres/base/5/2613 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/2615 b/starpost/postgres/base/5/2615 new file mode 100644 index 0000000..c11828a Binary files /dev/null and b/starpost/postgres/base/5/2615 differ diff --git a/starpost/postgres/base/5/2615_fsm b/starpost/postgres/base/5/2615_fsm new file mode 100644 index 0000000..d041693 Binary files /dev/null and b/starpost/postgres/base/5/2615_fsm differ diff --git a/starpost/postgres/base/5/2615_vm b/starpost/postgres/base/5/2615_vm new file mode 100644 index 0000000..fd02aae Binary files /dev/null and b/starpost/postgres/base/5/2615_vm differ diff --git a/starpost/postgres/base/5/2616 b/starpost/postgres/base/5/2616 new file mode 100644 index 0000000..0d60d79 Binary files /dev/null and b/starpost/postgres/base/5/2616 differ diff --git a/starpost/postgres/base/5/2616_fsm b/starpost/postgres/base/5/2616_fsm new file mode 100644 index 0000000..cb924c9 Binary files /dev/null and b/starpost/postgres/base/5/2616_fsm differ diff --git a/starpost/postgres/base/5/2616_vm b/starpost/postgres/base/5/2616_vm new file mode 100644 index 0000000..d9d3ba6 Binary files /dev/null and b/starpost/postgres/base/5/2616_vm differ diff --git a/starpost/postgres/base/5/2617 b/starpost/postgres/base/5/2617 new file mode 100644 index 0000000..bcdfc18 Binary files /dev/null and b/starpost/postgres/base/5/2617 differ diff --git a/starpost/postgres/base/5/2617_fsm b/starpost/postgres/base/5/2617_fsm new file mode 100644 index 0000000..29d6066 Binary files /dev/null and b/starpost/postgres/base/5/2617_fsm differ diff --git a/starpost/postgres/base/5/2617_vm b/starpost/postgres/base/5/2617_vm new file mode 100644 index 0000000..b182c7e Binary files /dev/null and b/starpost/postgres/base/5/2617_vm differ diff --git a/starpost/postgres/base/5/2618 b/starpost/postgres/base/5/2618 new file mode 100644 index 0000000..4e400e4 Binary files /dev/null and b/starpost/postgres/base/5/2618 differ diff --git a/starpost/postgres/base/5/2618_fsm b/starpost/postgres/base/5/2618_fsm new file mode 100644 index 0000000..bcee926 Binary files /dev/null and b/starpost/postgres/base/5/2618_fsm differ diff --git a/starpost/postgres/base/5/2618_vm b/starpost/postgres/base/5/2618_vm new file mode 100644 index 0000000..6a0ae79 Binary files /dev/null and b/starpost/postgres/base/5/2618_vm differ diff --git a/starpost/postgres/base/5/2619 b/starpost/postgres/base/5/2619 new file mode 100644 index 0000000..aee9452 Binary files /dev/null and b/starpost/postgres/base/5/2619 differ diff --git a/starpost/postgres/base/5/2619_fsm b/starpost/postgres/base/5/2619_fsm new file mode 100644 index 0000000..482e225 Binary files /dev/null and b/starpost/postgres/base/5/2619_fsm differ diff --git a/starpost/postgres/base/5/2619_vm b/starpost/postgres/base/5/2619_vm new file mode 100644 index 0000000..1081e4d Binary files /dev/null and b/starpost/postgres/base/5/2619_vm differ diff --git a/starpost/postgres/base/5/2620 b/starpost/postgres/base/5/2620 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/2650 b/starpost/postgres/base/5/2650 new file mode 100644 index 0000000..ef4f21b Binary files /dev/null and b/starpost/postgres/base/5/2650 differ diff --git a/starpost/postgres/base/5/2651 b/starpost/postgres/base/5/2651 new file mode 100644 index 0000000..9d21e32 Binary files /dev/null and b/starpost/postgres/base/5/2651 differ diff --git a/starpost/postgres/base/5/2652 b/starpost/postgres/base/5/2652 new file mode 100644 index 0000000..ab6e13e Binary files /dev/null and b/starpost/postgres/base/5/2652 differ diff --git a/starpost/postgres/base/5/2653 b/starpost/postgres/base/5/2653 new file mode 100644 index 0000000..4c032c8 Binary files /dev/null and b/starpost/postgres/base/5/2653 differ diff --git a/starpost/postgres/base/5/2654 b/starpost/postgres/base/5/2654 new file mode 100644 index 0000000..53aa6fc Binary files /dev/null and b/starpost/postgres/base/5/2654 differ diff --git a/starpost/postgres/base/5/2655 b/starpost/postgres/base/5/2655 new file mode 100644 index 0000000..0b22aae Binary files /dev/null and b/starpost/postgres/base/5/2655 differ diff --git a/starpost/postgres/base/5/2656 b/starpost/postgres/base/5/2656 new file mode 100644 index 0000000..0e2e0bc Binary files /dev/null and b/starpost/postgres/base/5/2656 differ diff --git a/starpost/postgres/base/5/2657 b/starpost/postgres/base/5/2657 new file mode 100644 index 0000000..a87fd85 Binary files /dev/null and b/starpost/postgres/base/5/2657 differ diff --git a/starpost/postgres/base/5/2658 b/starpost/postgres/base/5/2658 new file mode 100644 index 0000000..e3155fb Binary files /dev/null and b/starpost/postgres/base/5/2658 differ diff --git a/starpost/postgres/base/5/2659 b/starpost/postgres/base/5/2659 new file mode 100644 index 0000000..98e79cc Binary files /dev/null and b/starpost/postgres/base/5/2659 differ diff --git a/starpost/postgres/base/5/2660 b/starpost/postgres/base/5/2660 new file mode 100644 index 0000000..3a7a1d2 Binary files /dev/null and b/starpost/postgres/base/5/2660 differ diff --git a/starpost/postgres/base/5/2661 b/starpost/postgres/base/5/2661 new file mode 100644 index 0000000..aa5178a Binary files /dev/null and b/starpost/postgres/base/5/2661 differ diff --git a/starpost/postgres/base/5/2662 b/starpost/postgres/base/5/2662 new file mode 100644 index 0000000..bf3a721 Binary files /dev/null and b/starpost/postgres/base/5/2662 differ diff --git a/starpost/postgres/base/5/2663 b/starpost/postgres/base/5/2663 new file mode 100644 index 0000000..f5aa563 Binary files /dev/null and b/starpost/postgres/base/5/2663 differ diff --git a/starpost/postgres/base/5/2664 b/starpost/postgres/base/5/2664 new file mode 100644 index 0000000..12b1f5b Binary files /dev/null and b/starpost/postgres/base/5/2664 differ diff --git a/starpost/postgres/base/5/2665 b/starpost/postgres/base/5/2665 new file mode 100644 index 0000000..2a5a6de Binary files /dev/null and b/starpost/postgres/base/5/2665 differ diff --git a/starpost/postgres/base/5/2666 b/starpost/postgres/base/5/2666 new file mode 100644 index 0000000..d87561c Binary files /dev/null and b/starpost/postgres/base/5/2666 differ diff --git a/starpost/postgres/base/5/2667 b/starpost/postgres/base/5/2667 new file mode 100644 index 0000000..f8b060b Binary files /dev/null and b/starpost/postgres/base/5/2667 differ diff --git a/starpost/postgres/base/5/2668 b/starpost/postgres/base/5/2668 new file mode 100644 index 0000000..c5baf1d Binary files /dev/null and b/starpost/postgres/base/5/2668 differ diff --git a/starpost/postgres/base/5/2669 b/starpost/postgres/base/5/2669 new file mode 100644 index 0000000..7379bc3 Binary files /dev/null and b/starpost/postgres/base/5/2669 differ diff --git a/starpost/postgres/base/5/2670 b/starpost/postgres/base/5/2670 new file mode 100644 index 0000000..5b35b4d Binary files /dev/null and b/starpost/postgres/base/5/2670 differ diff --git a/starpost/postgres/base/5/2673 b/starpost/postgres/base/5/2673 new file mode 100644 index 0000000..2e78353 Binary files /dev/null and b/starpost/postgres/base/5/2673 differ diff --git a/starpost/postgres/base/5/2674 b/starpost/postgres/base/5/2674 new file mode 100644 index 0000000..40852a0 Binary files /dev/null and b/starpost/postgres/base/5/2674 differ diff --git a/starpost/postgres/base/5/2675 b/starpost/postgres/base/5/2675 new file mode 100644 index 0000000..4a4b1fd Binary files /dev/null and b/starpost/postgres/base/5/2675 differ diff --git a/starpost/postgres/base/5/2678 b/starpost/postgres/base/5/2678 new file mode 100644 index 0000000..2086279 Binary files /dev/null and b/starpost/postgres/base/5/2678 differ diff --git a/starpost/postgres/base/5/2679 b/starpost/postgres/base/5/2679 new file mode 100644 index 0000000..8ddcf90 Binary files /dev/null and b/starpost/postgres/base/5/2679 differ diff --git a/starpost/postgres/base/5/2680 b/starpost/postgres/base/5/2680 new file mode 100644 index 0000000..e15ddb4 Binary files /dev/null and b/starpost/postgres/base/5/2680 differ diff --git a/starpost/postgres/base/5/2681 b/starpost/postgres/base/5/2681 new file mode 100644 index 0000000..bbeb640 Binary files /dev/null and b/starpost/postgres/base/5/2681 differ diff --git a/starpost/postgres/base/5/2682 b/starpost/postgres/base/5/2682 new file mode 100644 index 0000000..28f957f Binary files /dev/null and b/starpost/postgres/base/5/2682 differ diff --git a/starpost/postgres/base/5/2683 b/starpost/postgres/base/5/2683 new file mode 100644 index 0000000..014cbee Binary files /dev/null and b/starpost/postgres/base/5/2683 differ diff --git a/starpost/postgres/base/5/2684 b/starpost/postgres/base/5/2684 new file mode 100644 index 0000000..d7cd584 Binary files /dev/null and b/starpost/postgres/base/5/2684 differ diff --git a/starpost/postgres/base/5/2685 b/starpost/postgres/base/5/2685 new file mode 100644 index 0000000..01a32e9 Binary files /dev/null and b/starpost/postgres/base/5/2685 differ diff --git a/starpost/postgres/base/5/2686 b/starpost/postgres/base/5/2686 new file mode 100644 index 0000000..51e4357 Binary files /dev/null and b/starpost/postgres/base/5/2686 differ diff --git a/starpost/postgres/base/5/2687 b/starpost/postgres/base/5/2687 new file mode 100644 index 0000000..8df59d1 Binary files /dev/null and b/starpost/postgres/base/5/2687 differ diff --git a/starpost/postgres/base/5/2688 b/starpost/postgres/base/5/2688 new file mode 100644 index 0000000..f5448dc Binary files /dev/null and b/starpost/postgres/base/5/2688 differ diff --git a/starpost/postgres/base/5/2689 b/starpost/postgres/base/5/2689 new file mode 100644 index 0000000..8f8223b Binary files /dev/null and b/starpost/postgres/base/5/2689 differ diff --git a/starpost/postgres/base/5/2690 b/starpost/postgres/base/5/2690 new file mode 100644 index 0000000..273454a Binary files /dev/null and b/starpost/postgres/base/5/2690 differ diff --git a/starpost/postgres/base/5/2691 b/starpost/postgres/base/5/2691 new file mode 100644 index 0000000..c816edc Binary files /dev/null and b/starpost/postgres/base/5/2691 differ diff --git a/starpost/postgres/base/5/2692 b/starpost/postgres/base/5/2692 new file mode 100644 index 0000000..6dee73d Binary files /dev/null and b/starpost/postgres/base/5/2692 differ diff --git a/starpost/postgres/base/5/2693 b/starpost/postgres/base/5/2693 new file mode 100644 index 0000000..78bee54 Binary files /dev/null and b/starpost/postgres/base/5/2693 differ diff --git a/starpost/postgres/base/5/2696 b/starpost/postgres/base/5/2696 new file mode 100644 index 0000000..a504e55 Binary files /dev/null and b/starpost/postgres/base/5/2696 differ diff --git a/starpost/postgres/base/5/2699 b/starpost/postgres/base/5/2699 new file mode 100644 index 0000000..8417313 Binary files /dev/null and b/starpost/postgres/base/5/2699 differ diff --git a/starpost/postgres/base/5/2701 b/starpost/postgres/base/5/2701 new file mode 100644 index 0000000..8892de2 Binary files /dev/null and b/starpost/postgres/base/5/2701 differ diff --git a/starpost/postgres/base/5/2702 b/starpost/postgres/base/5/2702 new file mode 100644 index 0000000..c40e5aa Binary files /dev/null and b/starpost/postgres/base/5/2702 differ diff --git a/starpost/postgres/base/5/2703 b/starpost/postgres/base/5/2703 new file mode 100644 index 0000000..2a9cbd8 Binary files /dev/null and b/starpost/postgres/base/5/2703 differ diff --git a/starpost/postgres/base/5/2704 b/starpost/postgres/base/5/2704 new file mode 100644 index 0000000..36b4068 Binary files /dev/null and b/starpost/postgres/base/5/2704 differ diff --git a/starpost/postgres/base/5/2753 b/starpost/postgres/base/5/2753 new file mode 100644 index 0000000..3c16dff Binary files /dev/null and b/starpost/postgres/base/5/2753 differ diff --git a/starpost/postgres/base/5/2753_fsm b/starpost/postgres/base/5/2753_fsm new file mode 100644 index 0000000..642bce3 Binary files /dev/null and b/starpost/postgres/base/5/2753_fsm differ diff --git a/starpost/postgres/base/5/2753_vm b/starpost/postgres/base/5/2753_vm new file mode 100644 index 0000000..f7e91c6 Binary files /dev/null and b/starpost/postgres/base/5/2753_vm differ diff --git a/starpost/postgres/base/5/2754 b/starpost/postgres/base/5/2754 new file mode 100644 index 0000000..f3df39d Binary files /dev/null and b/starpost/postgres/base/5/2754 differ diff --git a/starpost/postgres/base/5/2755 b/starpost/postgres/base/5/2755 new file mode 100644 index 0000000..cc671dc Binary files /dev/null and b/starpost/postgres/base/5/2755 differ diff --git a/starpost/postgres/base/5/2756 b/starpost/postgres/base/5/2756 new file mode 100644 index 0000000..6a6c87e Binary files /dev/null and b/starpost/postgres/base/5/2756 differ diff --git a/starpost/postgres/base/5/2757 b/starpost/postgres/base/5/2757 new file mode 100644 index 0000000..57830cb Binary files /dev/null and b/starpost/postgres/base/5/2757 differ diff --git a/starpost/postgres/base/5/2830 b/starpost/postgres/base/5/2830 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/2831 b/starpost/postgres/base/5/2831 new file mode 100644 index 0000000..6c30e94 Binary files /dev/null and b/starpost/postgres/base/5/2831 differ diff --git a/starpost/postgres/base/5/2832 b/starpost/postgres/base/5/2832 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/2833 b/starpost/postgres/base/5/2833 new file mode 100644 index 0000000..e364449 Binary files /dev/null and b/starpost/postgres/base/5/2833 differ diff --git a/starpost/postgres/base/5/2834 b/starpost/postgres/base/5/2834 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/2835 b/starpost/postgres/base/5/2835 new file mode 100644 index 0000000..b028c65 Binary files /dev/null and b/starpost/postgres/base/5/2835 differ diff --git a/starpost/postgres/base/5/2836 b/starpost/postgres/base/5/2836 new file mode 100644 index 0000000..e678cbd Binary files /dev/null and b/starpost/postgres/base/5/2836 differ diff --git a/starpost/postgres/base/5/2836_fsm b/starpost/postgres/base/5/2836_fsm new file mode 100644 index 0000000..06e1e26 Binary files /dev/null and b/starpost/postgres/base/5/2836_fsm differ diff --git a/starpost/postgres/base/5/2836_vm b/starpost/postgres/base/5/2836_vm new file mode 100644 index 0000000..cef3ff9 Binary files /dev/null and b/starpost/postgres/base/5/2836_vm differ diff --git a/starpost/postgres/base/5/2837 b/starpost/postgres/base/5/2837 new file mode 100644 index 0000000..2925518 Binary files /dev/null and b/starpost/postgres/base/5/2837 differ diff --git a/starpost/postgres/base/5/2838 b/starpost/postgres/base/5/2838 new file mode 100644 index 0000000..bed85ee Binary files /dev/null and b/starpost/postgres/base/5/2838 differ diff --git a/starpost/postgres/base/5/2838_fsm b/starpost/postgres/base/5/2838_fsm new file mode 100644 index 0000000..b9e860e Binary files /dev/null and b/starpost/postgres/base/5/2838_fsm differ diff --git a/starpost/postgres/base/5/2838_vm b/starpost/postgres/base/5/2838_vm new file mode 100644 index 0000000..d2933ea Binary files /dev/null and b/starpost/postgres/base/5/2838_vm differ diff --git a/starpost/postgres/base/5/2839 b/starpost/postgres/base/5/2839 new file mode 100644 index 0000000..b7f7c44 Binary files /dev/null and b/starpost/postgres/base/5/2839 differ diff --git a/starpost/postgres/base/5/2840 b/starpost/postgres/base/5/2840 new file mode 100644 index 0000000..39c4b5d Binary files /dev/null and b/starpost/postgres/base/5/2840 differ diff --git a/starpost/postgres/base/5/2840_fsm b/starpost/postgres/base/5/2840_fsm new file mode 100644 index 0000000..a454fb0 Binary files /dev/null and b/starpost/postgres/base/5/2840_fsm differ diff --git a/starpost/postgres/base/5/2840_vm b/starpost/postgres/base/5/2840_vm new file mode 100644 index 0000000..6eaf453 Binary files /dev/null and b/starpost/postgres/base/5/2840_vm differ diff --git a/starpost/postgres/base/5/2841 b/starpost/postgres/base/5/2841 new file mode 100644 index 0000000..8384ff8 Binary files /dev/null and b/starpost/postgres/base/5/2841 differ diff --git a/starpost/postgres/base/5/2995 b/starpost/postgres/base/5/2995 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/2996 b/starpost/postgres/base/5/2996 new file mode 100644 index 0000000..9bd6faf Binary files /dev/null and b/starpost/postgres/base/5/2996 differ diff --git a/starpost/postgres/base/5/3079 b/starpost/postgres/base/5/3079 new file mode 100644 index 0000000..647d3e9 Binary files /dev/null and b/starpost/postgres/base/5/3079 differ diff --git a/starpost/postgres/base/5/3079_fsm b/starpost/postgres/base/5/3079_fsm new file mode 100644 index 0000000..7732d22 Binary files /dev/null and b/starpost/postgres/base/5/3079_fsm differ diff --git a/starpost/postgres/base/5/3079_vm b/starpost/postgres/base/5/3079_vm new file mode 100644 index 0000000..3438618 Binary files /dev/null and b/starpost/postgres/base/5/3079_vm differ diff --git a/starpost/postgres/base/5/3080 b/starpost/postgres/base/5/3080 new file mode 100644 index 0000000..32632ec Binary files /dev/null and b/starpost/postgres/base/5/3080 differ diff --git a/starpost/postgres/base/5/3081 b/starpost/postgres/base/5/3081 new file mode 100644 index 0000000..f1b9e01 Binary files /dev/null and b/starpost/postgres/base/5/3081 differ diff --git a/starpost/postgres/base/5/3085 b/starpost/postgres/base/5/3085 new file mode 100644 index 0000000..f688645 Binary files /dev/null and b/starpost/postgres/base/5/3085 differ diff --git a/starpost/postgres/base/5/3118 b/starpost/postgres/base/5/3118 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/3119 b/starpost/postgres/base/5/3119 new file mode 100644 index 0000000..8524de7 Binary files /dev/null and b/starpost/postgres/base/5/3119 differ diff --git a/starpost/postgres/base/5/3164 b/starpost/postgres/base/5/3164 new file mode 100644 index 0000000..8cc619f Binary files /dev/null and b/starpost/postgres/base/5/3164 differ diff --git a/starpost/postgres/base/5/3256 b/starpost/postgres/base/5/3256 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/3257 b/starpost/postgres/base/5/3257 new file mode 100644 index 0000000..6f325ab Binary files /dev/null and b/starpost/postgres/base/5/3257 differ diff --git a/starpost/postgres/base/5/3258 b/starpost/postgres/base/5/3258 new file mode 100644 index 0000000..10c3c94 Binary files /dev/null and b/starpost/postgres/base/5/3258 differ diff --git a/starpost/postgres/base/5/3350 b/starpost/postgres/base/5/3350 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/3351 b/starpost/postgres/base/5/3351 new file mode 100644 index 0000000..2bfef7f Binary files /dev/null and b/starpost/postgres/base/5/3351 differ diff --git a/starpost/postgres/base/5/3379 b/starpost/postgres/base/5/3379 new file mode 100644 index 0000000..b41a45f Binary files /dev/null and b/starpost/postgres/base/5/3379 differ diff --git a/starpost/postgres/base/5/3380 b/starpost/postgres/base/5/3380 new file mode 100644 index 0000000..f9d290e Binary files /dev/null and b/starpost/postgres/base/5/3380 differ diff --git a/starpost/postgres/base/5/3381 b/starpost/postgres/base/5/3381 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/3394 b/starpost/postgres/base/5/3394 new file mode 100644 index 0000000..3ada57d Binary files /dev/null and b/starpost/postgres/base/5/3394 differ diff --git a/starpost/postgres/base/5/3394_fsm b/starpost/postgres/base/5/3394_fsm new file mode 100644 index 0000000..38ac5f8 Binary files /dev/null and b/starpost/postgres/base/5/3394_fsm differ diff --git a/starpost/postgres/base/5/3394_vm b/starpost/postgres/base/5/3394_vm new file mode 100644 index 0000000..5545f17 Binary files /dev/null and b/starpost/postgres/base/5/3394_vm differ diff --git a/starpost/postgres/base/5/3395 b/starpost/postgres/base/5/3395 new file mode 100644 index 0000000..48cf9ba Binary files /dev/null and b/starpost/postgres/base/5/3395 differ diff --git a/starpost/postgres/base/5/3429 b/starpost/postgres/base/5/3429 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/3430 b/starpost/postgres/base/5/3430 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/3431 b/starpost/postgres/base/5/3431 new file mode 100644 index 0000000..a890bbf Binary files /dev/null and b/starpost/postgres/base/5/3431 differ diff --git a/starpost/postgres/base/5/3433 b/starpost/postgres/base/5/3433 new file mode 100644 index 0000000..b9e444b Binary files /dev/null and b/starpost/postgres/base/5/3433 differ diff --git a/starpost/postgres/base/5/3439 b/starpost/postgres/base/5/3439 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/3440 b/starpost/postgres/base/5/3440 new file mode 100644 index 0000000..5b55040 Binary files /dev/null and b/starpost/postgres/base/5/3440 differ diff --git a/starpost/postgres/base/5/3455 b/starpost/postgres/base/5/3455 new file mode 100644 index 0000000..765545a Binary files /dev/null and b/starpost/postgres/base/5/3455 differ diff --git a/starpost/postgres/base/5/3456 b/starpost/postgres/base/5/3456 new file mode 100644 index 0000000..dbe1a53 Binary files /dev/null and b/starpost/postgres/base/5/3456 differ diff --git a/starpost/postgres/base/5/3456_fsm b/starpost/postgres/base/5/3456_fsm new file mode 100644 index 0000000..0ff6488 Binary files /dev/null and b/starpost/postgres/base/5/3456_fsm differ diff --git a/starpost/postgres/base/5/3456_vm b/starpost/postgres/base/5/3456_vm new file mode 100644 index 0000000..fa6477f Binary files /dev/null and b/starpost/postgres/base/5/3456_vm differ diff --git a/starpost/postgres/base/5/3466 b/starpost/postgres/base/5/3466 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/3467 b/starpost/postgres/base/5/3467 new file mode 100644 index 0000000..188a5e6 Binary files /dev/null and b/starpost/postgres/base/5/3467 differ diff --git a/starpost/postgres/base/5/3468 b/starpost/postgres/base/5/3468 new file mode 100644 index 0000000..00d26fe Binary files /dev/null and b/starpost/postgres/base/5/3468 differ diff --git a/starpost/postgres/base/5/3501 b/starpost/postgres/base/5/3501 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/3502 b/starpost/postgres/base/5/3502 new file mode 100644 index 0000000..51e62aa Binary files /dev/null and b/starpost/postgres/base/5/3502 differ diff --git a/starpost/postgres/base/5/3503 b/starpost/postgres/base/5/3503 new file mode 100644 index 0000000..818ee9e Binary files /dev/null and b/starpost/postgres/base/5/3503 differ diff --git a/starpost/postgres/base/5/3534 b/starpost/postgres/base/5/3534 new file mode 100644 index 0000000..338d308 Binary files /dev/null and b/starpost/postgres/base/5/3534 differ diff --git a/starpost/postgres/base/5/3541 b/starpost/postgres/base/5/3541 new file mode 100644 index 0000000..40869ad Binary files /dev/null and b/starpost/postgres/base/5/3541 differ diff --git a/starpost/postgres/base/5/3541_fsm b/starpost/postgres/base/5/3541_fsm new file mode 100644 index 0000000..a3a2de4 Binary files /dev/null and b/starpost/postgres/base/5/3541_fsm differ diff --git a/starpost/postgres/base/5/3541_vm b/starpost/postgres/base/5/3541_vm new file mode 100644 index 0000000..7a78303 Binary files /dev/null and b/starpost/postgres/base/5/3541_vm differ diff --git a/starpost/postgres/base/5/3542 b/starpost/postgres/base/5/3542 new file mode 100644 index 0000000..ced0066 Binary files /dev/null and b/starpost/postgres/base/5/3542 differ diff --git a/starpost/postgres/base/5/3574 b/starpost/postgres/base/5/3574 new file mode 100644 index 0000000..b026df1 Binary files /dev/null and b/starpost/postgres/base/5/3574 differ diff --git a/starpost/postgres/base/5/3575 b/starpost/postgres/base/5/3575 new file mode 100644 index 0000000..bdec532 Binary files /dev/null and b/starpost/postgres/base/5/3575 differ diff --git a/starpost/postgres/base/5/3576 b/starpost/postgres/base/5/3576 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/3596 b/starpost/postgres/base/5/3596 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/3597 b/starpost/postgres/base/5/3597 new file mode 100644 index 0000000..6947306 Binary files /dev/null and b/starpost/postgres/base/5/3597 differ diff --git a/starpost/postgres/base/5/3598 b/starpost/postgres/base/5/3598 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/3599 b/starpost/postgres/base/5/3599 new file mode 100644 index 0000000..32bf577 Binary files /dev/null and b/starpost/postgres/base/5/3599 differ diff --git a/starpost/postgres/base/5/3600 b/starpost/postgres/base/5/3600 new file mode 100644 index 0000000..6cca16e Binary files /dev/null and b/starpost/postgres/base/5/3600 differ diff --git a/starpost/postgres/base/5/3600_fsm b/starpost/postgres/base/5/3600_fsm new file mode 100644 index 0000000..cebec19 Binary files /dev/null and b/starpost/postgres/base/5/3600_fsm differ diff --git a/starpost/postgres/base/5/3600_vm b/starpost/postgres/base/5/3600_vm new file mode 100644 index 0000000..07044d1 Binary files /dev/null and b/starpost/postgres/base/5/3600_vm differ diff --git a/starpost/postgres/base/5/3601 b/starpost/postgres/base/5/3601 new file mode 100644 index 0000000..04c846e Binary files /dev/null and b/starpost/postgres/base/5/3601 differ diff --git a/starpost/postgres/base/5/3601_fsm b/starpost/postgres/base/5/3601_fsm new file mode 100644 index 0000000..7732d22 Binary files /dev/null and b/starpost/postgres/base/5/3601_fsm differ diff --git a/starpost/postgres/base/5/3601_vm b/starpost/postgres/base/5/3601_vm new file mode 100644 index 0000000..22b9666 Binary files /dev/null and b/starpost/postgres/base/5/3601_vm differ diff --git a/starpost/postgres/base/5/3602 b/starpost/postgres/base/5/3602 new file mode 100644 index 0000000..d1c92d9 Binary files /dev/null and b/starpost/postgres/base/5/3602 differ diff --git a/starpost/postgres/base/5/3602_fsm b/starpost/postgres/base/5/3602_fsm new file mode 100644 index 0000000..d7897de Binary files /dev/null and b/starpost/postgres/base/5/3602_fsm differ diff --git a/starpost/postgres/base/5/3602_vm b/starpost/postgres/base/5/3602_vm new file mode 100644 index 0000000..a550486 Binary files /dev/null and b/starpost/postgres/base/5/3602_vm differ diff --git a/starpost/postgres/base/5/3603 b/starpost/postgres/base/5/3603 new file mode 100644 index 0000000..54b0933 Binary files /dev/null and b/starpost/postgres/base/5/3603 differ diff --git a/starpost/postgres/base/5/3603_fsm b/starpost/postgres/base/5/3603_fsm new file mode 100644 index 0000000..c28dd4f Binary files /dev/null and b/starpost/postgres/base/5/3603_fsm differ diff --git a/starpost/postgres/base/5/3603_vm b/starpost/postgres/base/5/3603_vm new file mode 100644 index 0000000..ecac229 Binary files /dev/null and b/starpost/postgres/base/5/3603_vm differ diff --git a/starpost/postgres/base/5/3604 b/starpost/postgres/base/5/3604 new file mode 100644 index 0000000..6c4a813 Binary files /dev/null and b/starpost/postgres/base/5/3604 differ diff --git a/starpost/postgres/base/5/3605 b/starpost/postgres/base/5/3605 new file mode 100644 index 0000000..d21dcb3 Binary files /dev/null and b/starpost/postgres/base/5/3605 differ diff --git a/starpost/postgres/base/5/3606 b/starpost/postgres/base/5/3606 new file mode 100644 index 0000000..5d00237 Binary files /dev/null and b/starpost/postgres/base/5/3606 differ diff --git a/starpost/postgres/base/5/3607 b/starpost/postgres/base/5/3607 new file mode 100644 index 0000000..3a1af44 Binary files /dev/null and b/starpost/postgres/base/5/3607 differ diff --git a/starpost/postgres/base/5/3608 b/starpost/postgres/base/5/3608 new file mode 100644 index 0000000..9d67984 Binary files /dev/null and b/starpost/postgres/base/5/3608 differ diff --git a/starpost/postgres/base/5/3609 b/starpost/postgres/base/5/3609 new file mode 100644 index 0000000..ea3aa7c Binary files /dev/null and b/starpost/postgres/base/5/3609 differ diff --git a/starpost/postgres/base/5/3712 b/starpost/postgres/base/5/3712 new file mode 100644 index 0000000..8d214b5 Binary files /dev/null and b/starpost/postgres/base/5/3712 differ diff --git a/starpost/postgres/base/5/3764 b/starpost/postgres/base/5/3764 new file mode 100644 index 0000000..4b19ab2 Binary files /dev/null and b/starpost/postgres/base/5/3764 differ diff --git a/starpost/postgres/base/5/3764_fsm b/starpost/postgres/base/5/3764_fsm new file mode 100644 index 0000000..f64db4d Binary files /dev/null and b/starpost/postgres/base/5/3764_fsm differ diff --git a/starpost/postgres/base/5/3764_vm b/starpost/postgres/base/5/3764_vm new file mode 100644 index 0000000..be4fe23 Binary files /dev/null and b/starpost/postgres/base/5/3764_vm differ diff --git a/starpost/postgres/base/5/3766 b/starpost/postgres/base/5/3766 new file mode 100644 index 0000000..cbe718c Binary files /dev/null and b/starpost/postgres/base/5/3766 differ diff --git a/starpost/postgres/base/5/3767 b/starpost/postgres/base/5/3767 new file mode 100644 index 0000000..1210714 Binary files /dev/null and b/starpost/postgres/base/5/3767 differ diff --git a/starpost/postgres/base/5/3997 b/starpost/postgres/base/5/3997 new file mode 100644 index 0000000..28b5b4b Binary files /dev/null and b/starpost/postgres/base/5/3997 differ diff --git a/starpost/postgres/base/5/4143 b/starpost/postgres/base/5/4143 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/4144 b/starpost/postgres/base/5/4144 new file mode 100644 index 0000000..781f37a Binary files /dev/null and b/starpost/postgres/base/5/4144 differ diff --git a/starpost/postgres/base/5/4145 b/starpost/postgres/base/5/4145 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/4146 b/starpost/postgres/base/5/4146 new file mode 100644 index 0000000..11ccf7e Binary files /dev/null and b/starpost/postgres/base/5/4146 differ diff --git a/starpost/postgres/base/5/4147 b/starpost/postgres/base/5/4147 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/4148 b/starpost/postgres/base/5/4148 new file mode 100644 index 0000000..7fd05a8 Binary files /dev/null and b/starpost/postgres/base/5/4148 differ diff --git a/starpost/postgres/base/5/4149 b/starpost/postgres/base/5/4149 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/4150 b/starpost/postgres/base/5/4150 new file mode 100644 index 0000000..10171f6 Binary files /dev/null and b/starpost/postgres/base/5/4150 differ diff --git a/starpost/postgres/base/5/4151 b/starpost/postgres/base/5/4151 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/4152 b/starpost/postgres/base/5/4152 new file mode 100644 index 0000000..869a7f3 Binary files /dev/null and b/starpost/postgres/base/5/4152 differ diff --git a/starpost/postgres/base/5/4153 b/starpost/postgres/base/5/4153 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/4154 b/starpost/postgres/base/5/4154 new file mode 100644 index 0000000..bb1dca3 Binary files /dev/null and b/starpost/postgres/base/5/4154 differ diff --git a/starpost/postgres/base/5/4155 b/starpost/postgres/base/5/4155 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/4156 b/starpost/postgres/base/5/4156 new file mode 100644 index 0000000..839ab86 Binary files /dev/null and b/starpost/postgres/base/5/4156 differ diff --git a/starpost/postgres/base/5/4157 b/starpost/postgres/base/5/4157 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/4158 b/starpost/postgres/base/5/4158 new file mode 100644 index 0000000..12e6868 Binary files /dev/null and b/starpost/postgres/base/5/4158 differ diff --git a/starpost/postgres/base/5/4159 b/starpost/postgres/base/5/4159 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/4160 b/starpost/postgres/base/5/4160 new file mode 100644 index 0000000..8b80112 Binary files /dev/null and b/starpost/postgres/base/5/4160 differ diff --git a/starpost/postgres/base/5/4163 b/starpost/postgres/base/5/4163 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/4164 b/starpost/postgres/base/5/4164 new file mode 100644 index 0000000..e86ba95 Binary files /dev/null and b/starpost/postgres/base/5/4164 differ diff --git a/starpost/postgres/base/5/4165 b/starpost/postgres/base/5/4165 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/4166 b/starpost/postgres/base/5/4166 new file mode 100644 index 0000000..f5fc2b6 Binary files /dev/null and b/starpost/postgres/base/5/4166 differ diff --git a/starpost/postgres/base/5/4167 b/starpost/postgres/base/5/4167 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/4168 b/starpost/postgres/base/5/4168 new file mode 100644 index 0000000..fdfe146 Binary files /dev/null and b/starpost/postgres/base/5/4168 differ diff --git a/starpost/postgres/base/5/4169 b/starpost/postgres/base/5/4169 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/4170 b/starpost/postgres/base/5/4170 new file mode 100644 index 0000000..797418b Binary files /dev/null and b/starpost/postgres/base/5/4170 differ diff --git a/starpost/postgres/base/5/4171 b/starpost/postgres/base/5/4171 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/4172 b/starpost/postgres/base/5/4172 new file mode 100644 index 0000000..969a191 Binary files /dev/null and b/starpost/postgres/base/5/4172 differ diff --git a/starpost/postgres/base/5/4173 b/starpost/postgres/base/5/4173 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/4174 b/starpost/postgres/base/5/4174 new file mode 100644 index 0000000..3c4beb7 Binary files /dev/null and b/starpost/postgres/base/5/4174 differ diff --git a/starpost/postgres/base/5/5002 b/starpost/postgres/base/5/5002 new file mode 100644 index 0000000..aefa40d Binary files /dev/null and b/starpost/postgres/base/5/5002 differ diff --git a/starpost/postgres/base/5/548 b/starpost/postgres/base/5/548 new file mode 100644 index 0000000..d6379eb Binary files /dev/null and b/starpost/postgres/base/5/548 differ diff --git a/starpost/postgres/base/5/549 b/starpost/postgres/base/5/549 new file mode 100644 index 0000000..a762ad9 Binary files /dev/null and b/starpost/postgres/base/5/549 differ diff --git a/starpost/postgres/base/5/6102 b/starpost/postgres/base/5/6102 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/6104 b/starpost/postgres/base/5/6104 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/6106 b/starpost/postgres/base/5/6106 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/6110 b/starpost/postgres/base/5/6110 new file mode 100644 index 0000000..42e1920 Binary files /dev/null and b/starpost/postgres/base/5/6110 differ diff --git a/starpost/postgres/base/5/6111 b/starpost/postgres/base/5/6111 new file mode 100644 index 0000000..d012727 Binary files /dev/null and b/starpost/postgres/base/5/6111 differ diff --git a/starpost/postgres/base/5/6112 b/starpost/postgres/base/5/6112 new file mode 100644 index 0000000..293367c Binary files /dev/null and b/starpost/postgres/base/5/6112 differ diff --git a/starpost/postgres/base/5/6113 b/starpost/postgres/base/5/6113 new file mode 100644 index 0000000..542f8fa Binary files /dev/null and b/starpost/postgres/base/5/6113 differ diff --git a/starpost/postgres/base/5/6116 b/starpost/postgres/base/5/6116 new file mode 100644 index 0000000..787d5d1 Binary files /dev/null and b/starpost/postgres/base/5/6116 differ diff --git a/starpost/postgres/base/5/6117 b/starpost/postgres/base/5/6117 new file mode 100644 index 0000000..2b5656b Binary files /dev/null and b/starpost/postgres/base/5/6117 differ diff --git a/starpost/postgres/base/5/6175 b/starpost/postgres/base/5/6175 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/6176 b/starpost/postgres/base/5/6176 new file mode 100644 index 0000000..34cba03 Binary files /dev/null and b/starpost/postgres/base/5/6176 differ diff --git a/starpost/postgres/base/5/6228 b/starpost/postgres/base/5/6228 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/6229 b/starpost/postgres/base/5/6229 new file mode 100644 index 0000000..4839713 Binary files /dev/null and b/starpost/postgres/base/5/6229 differ diff --git a/starpost/postgres/base/5/6237 b/starpost/postgres/base/5/6237 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/6238 b/starpost/postgres/base/5/6238 new file mode 100644 index 0000000..e7c0e8c Binary files /dev/null and b/starpost/postgres/base/5/6238 differ diff --git a/starpost/postgres/base/5/6239 b/starpost/postgres/base/5/6239 new file mode 100644 index 0000000..6c60b50 Binary files /dev/null and b/starpost/postgres/base/5/6239 differ diff --git a/starpost/postgres/base/5/826 b/starpost/postgres/base/5/826 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/base/5/827 b/starpost/postgres/base/5/827 new file mode 100644 index 0000000..bcaf0a1 Binary files /dev/null and b/starpost/postgres/base/5/827 differ diff --git a/starpost/postgres/base/5/828 b/starpost/postgres/base/5/828 new file mode 100644 index 0000000..7aba562 Binary files /dev/null and b/starpost/postgres/base/5/828 differ diff --git a/starpost/postgres/base/5/PG_VERSION b/starpost/postgres/base/5/PG_VERSION new file mode 100644 index 0000000..b6a7d89 --- /dev/null +++ b/starpost/postgres/base/5/PG_VERSION @@ -0,0 +1 @@ +16 diff --git a/starpost/postgres/base/5/pg_filenode.map b/starpost/postgres/base/5/pg_filenode.map new file mode 100644 index 0000000..4fc801a Binary files /dev/null and b/starpost/postgres/base/5/pg_filenode.map differ diff --git a/starpost/postgres/base/5/pg_internal.init b/starpost/postgres/base/5/pg_internal.init new file mode 100644 index 0000000..7f87e00 Binary files /dev/null and b/starpost/postgres/base/5/pg_internal.init differ diff --git a/starpost/postgres/global/1213 b/starpost/postgres/global/1213 new file mode 100644 index 0000000..eec8dc3 Binary files /dev/null and b/starpost/postgres/global/1213 differ diff --git a/starpost/postgres/global/1213_fsm b/starpost/postgres/global/1213_fsm new file mode 100644 index 0000000..86074be Binary files /dev/null and b/starpost/postgres/global/1213_fsm differ diff --git a/starpost/postgres/global/1213_vm b/starpost/postgres/global/1213_vm new file mode 100644 index 0000000..af1babc Binary files /dev/null and b/starpost/postgres/global/1213_vm differ diff --git a/starpost/postgres/global/1214 b/starpost/postgres/global/1214 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/global/1232 b/starpost/postgres/global/1232 new file mode 100644 index 0000000..3820150 Binary files /dev/null and b/starpost/postgres/global/1232 differ diff --git a/starpost/postgres/global/1233 b/starpost/postgres/global/1233 new file mode 100644 index 0000000..4643651 Binary files /dev/null and b/starpost/postgres/global/1233 differ diff --git a/starpost/postgres/global/1260 b/starpost/postgres/global/1260 new file mode 100644 index 0000000..bb53df6 Binary files /dev/null and b/starpost/postgres/global/1260 differ diff --git a/starpost/postgres/global/1260_fsm b/starpost/postgres/global/1260_fsm new file mode 100644 index 0000000..8bbe958 Binary files /dev/null and b/starpost/postgres/global/1260_fsm differ diff --git a/starpost/postgres/global/1260_vm b/starpost/postgres/global/1260_vm new file mode 100644 index 0000000..61bc93d Binary files /dev/null and b/starpost/postgres/global/1260_vm differ diff --git a/starpost/postgres/global/1261 b/starpost/postgres/global/1261 new file mode 100644 index 0000000..0fd08e6 Binary files /dev/null and b/starpost/postgres/global/1261 differ diff --git a/starpost/postgres/global/1261_fsm b/starpost/postgres/global/1261_fsm new file mode 100644 index 0000000..f32c23e Binary files /dev/null and b/starpost/postgres/global/1261_fsm differ diff --git a/starpost/postgres/global/1261_vm b/starpost/postgres/global/1261_vm new file mode 100644 index 0000000..8fdb2d6 Binary files /dev/null and b/starpost/postgres/global/1261_vm differ diff --git a/starpost/postgres/global/1262 b/starpost/postgres/global/1262 new file mode 100644 index 0000000..7be47db Binary files /dev/null and b/starpost/postgres/global/1262 differ diff --git a/starpost/postgres/global/1262_fsm b/starpost/postgres/global/1262_fsm new file mode 100644 index 0000000..479fd94 Binary files /dev/null and b/starpost/postgres/global/1262_fsm differ diff --git a/starpost/postgres/global/1262_vm b/starpost/postgres/global/1262_vm new file mode 100644 index 0000000..e62c5ab Binary files /dev/null and b/starpost/postgres/global/1262_vm differ diff --git a/starpost/postgres/global/2396 b/starpost/postgres/global/2396 new file mode 100644 index 0000000..724bf70 Binary files /dev/null and b/starpost/postgres/global/2396 differ diff --git a/starpost/postgres/global/2396_fsm b/starpost/postgres/global/2396_fsm new file mode 100644 index 0000000..7a4f24f Binary files /dev/null and b/starpost/postgres/global/2396_fsm differ diff --git a/starpost/postgres/global/2396_vm b/starpost/postgres/global/2396_vm new file mode 100644 index 0000000..774b64e Binary files /dev/null and b/starpost/postgres/global/2396_vm differ diff --git a/starpost/postgres/global/2397 b/starpost/postgres/global/2397 new file mode 100644 index 0000000..0858420 Binary files /dev/null and b/starpost/postgres/global/2397 differ diff --git a/starpost/postgres/global/2671 b/starpost/postgres/global/2671 new file mode 100644 index 0000000..1a87b1c Binary files /dev/null and b/starpost/postgres/global/2671 differ diff --git a/starpost/postgres/global/2672 b/starpost/postgres/global/2672 new file mode 100644 index 0000000..1fc19c6 Binary files /dev/null and b/starpost/postgres/global/2672 differ diff --git a/starpost/postgres/global/2676 b/starpost/postgres/global/2676 new file mode 100644 index 0000000..1470f25 Binary files /dev/null and b/starpost/postgres/global/2676 differ diff --git a/starpost/postgres/global/2677 b/starpost/postgres/global/2677 new file mode 100644 index 0000000..4487e7b Binary files /dev/null and b/starpost/postgres/global/2677 differ diff --git a/starpost/postgres/global/2694 b/starpost/postgres/global/2694 new file mode 100644 index 0000000..7e09dea Binary files /dev/null and b/starpost/postgres/global/2694 differ diff --git a/starpost/postgres/global/2695 b/starpost/postgres/global/2695 new file mode 100644 index 0000000..6ade19a Binary files /dev/null and b/starpost/postgres/global/2695 differ diff --git a/starpost/postgres/global/2697 b/starpost/postgres/global/2697 new file mode 100644 index 0000000..e4da1ca Binary files /dev/null and b/starpost/postgres/global/2697 differ diff --git a/starpost/postgres/global/2698 b/starpost/postgres/global/2698 new file mode 100644 index 0000000..261136e Binary files /dev/null and b/starpost/postgres/global/2698 differ diff --git a/starpost/postgres/global/2846 b/starpost/postgres/global/2846 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/global/2847 b/starpost/postgres/global/2847 new file mode 100644 index 0000000..f5a198a Binary files /dev/null and b/starpost/postgres/global/2847 differ diff --git a/starpost/postgres/global/2964 b/starpost/postgres/global/2964 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/global/2965 b/starpost/postgres/global/2965 new file mode 100644 index 0000000..b4ab3b0 Binary files /dev/null and b/starpost/postgres/global/2965 differ diff --git a/starpost/postgres/global/2966 b/starpost/postgres/global/2966 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/global/2967 b/starpost/postgres/global/2967 new file mode 100644 index 0000000..9c45455 Binary files /dev/null and b/starpost/postgres/global/2967 differ diff --git a/starpost/postgres/global/3592 b/starpost/postgres/global/3592 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/global/3593 b/starpost/postgres/global/3593 new file mode 100644 index 0000000..2dac047 Binary files /dev/null and b/starpost/postgres/global/3593 differ diff --git a/starpost/postgres/global/4060 b/starpost/postgres/global/4060 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/global/4061 b/starpost/postgres/global/4061 new file mode 100644 index 0000000..e03f6d8 Binary files /dev/null and b/starpost/postgres/global/4061 differ diff --git a/starpost/postgres/global/4175 b/starpost/postgres/global/4175 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/global/4176 b/starpost/postgres/global/4176 new file mode 100644 index 0000000..b2e78fd Binary files /dev/null and b/starpost/postgres/global/4176 differ diff --git a/starpost/postgres/global/4177 b/starpost/postgres/global/4177 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/global/4178 b/starpost/postgres/global/4178 new file mode 100644 index 0000000..006ca56 Binary files /dev/null and b/starpost/postgres/global/4178 differ diff --git a/starpost/postgres/global/4181 b/starpost/postgres/global/4181 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/global/4182 b/starpost/postgres/global/4182 new file mode 100644 index 0000000..ffe2eb2 Binary files /dev/null and b/starpost/postgres/global/4182 differ diff --git a/starpost/postgres/global/4183 b/starpost/postgres/global/4183 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/global/4184 b/starpost/postgres/global/4184 new file mode 100644 index 0000000..29e8df2 Binary files /dev/null and b/starpost/postgres/global/4184 differ diff --git a/starpost/postgres/global/4185 b/starpost/postgres/global/4185 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/global/4186 b/starpost/postgres/global/4186 new file mode 100644 index 0000000..03df8cc Binary files /dev/null and b/starpost/postgres/global/4186 differ diff --git a/starpost/postgres/global/6000 b/starpost/postgres/global/6000 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/global/6001 b/starpost/postgres/global/6001 new file mode 100644 index 0000000..6a41ce4 Binary files /dev/null and b/starpost/postgres/global/6001 differ diff --git a/starpost/postgres/global/6002 b/starpost/postgres/global/6002 new file mode 100644 index 0000000..32ea595 Binary files /dev/null and b/starpost/postgres/global/6002 differ diff --git a/starpost/postgres/global/6100 b/starpost/postgres/global/6100 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/global/6114 b/starpost/postgres/global/6114 new file mode 100644 index 0000000..bf887fa Binary files /dev/null and b/starpost/postgres/global/6114 differ diff --git a/starpost/postgres/global/6115 b/starpost/postgres/global/6115 new file mode 100644 index 0000000..afafca8 Binary files /dev/null and b/starpost/postgres/global/6115 differ diff --git a/starpost/postgres/global/6243 b/starpost/postgres/global/6243 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/global/6244 b/starpost/postgres/global/6244 new file mode 100644 index 0000000..e69de29 diff --git a/starpost/postgres/global/6245 b/starpost/postgres/global/6245 new file mode 100644 index 0000000..6a99292 Binary files /dev/null and b/starpost/postgres/global/6245 differ diff --git a/starpost/postgres/global/6246 b/starpost/postgres/global/6246 new file mode 100644 index 0000000..084bf17 Binary files /dev/null and b/starpost/postgres/global/6246 differ diff --git a/starpost/postgres/global/6247 b/starpost/postgres/global/6247 new file mode 100644 index 0000000..514ffb0 Binary files /dev/null and b/starpost/postgres/global/6247 differ diff --git a/starpost/postgres/global/6302 b/starpost/postgres/global/6302 new file mode 100644 index 0000000..b855d4e Binary files /dev/null and b/starpost/postgres/global/6302 differ diff --git a/starpost/postgres/global/6303 b/starpost/postgres/global/6303 new file mode 100644 index 0000000..abb950e Binary files /dev/null and b/starpost/postgres/global/6303 differ diff --git a/starpost/postgres/global/pg_control b/starpost/postgres/global/pg_control new file mode 100644 index 0000000..4b13dca Binary files /dev/null and b/starpost/postgres/global/pg_control differ diff --git a/starpost/postgres/global/pg_filenode.map b/starpost/postgres/global/pg_filenode.map new file mode 100644 index 0000000..97c07a6 Binary files /dev/null and b/starpost/postgres/global/pg_filenode.map differ diff --git a/starpost/postgres/global/pg_internal.init b/starpost/postgres/global/pg_internal.init new file mode 100644 index 0000000..c290e5b Binary files /dev/null and b/starpost/postgres/global/pg_internal.init differ diff --git a/starpost/postgres/pg_hba.conf b/starpost/postgres/pg_hba.conf new file mode 100644 index 0000000..7f379db --- /dev/null +++ b/starpost/postgres/pg_hba.conf @@ -0,0 +1,128 @@ +# PostgreSQL Client Authentication Configuration File +# =================================================== +# +# Refer to the "Client Authentication" section in the PostgreSQL +# documentation for a complete description of this file. A short +# synopsis follows. +# +# ---------------------- +# Authentication Records +# ---------------------- +# +# This file controls: which hosts are allowed to connect, how clients +# are authenticated, which PostgreSQL user names they can use, which +# databases they can access. Records take one of these forms: +# +# local DATABASE USER METHOD [OPTIONS] +# host DATABASE USER ADDRESS METHOD [OPTIONS] +# hostssl DATABASE USER ADDRESS METHOD [OPTIONS] +# hostnossl DATABASE USER ADDRESS METHOD [OPTIONS] +# hostgssenc DATABASE USER ADDRESS METHOD [OPTIONS] +# hostnogssenc DATABASE USER ADDRESS METHOD [OPTIONS] +# +# (The uppercase items must be replaced by actual values.) +# +# The first field is the connection type: +# - "local" is a Unix-domain socket +# - "host" is a TCP/IP socket (encrypted or not) +# - "hostssl" is a TCP/IP socket that is SSL-encrypted +# - "hostnossl" is a TCP/IP socket that is not SSL-encrypted +# - "hostgssenc" is a TCP/IP socket that is GSSAPI-encrypted +# - "hostnogssenc" is a TCP/IP socket that is not GSSAPI-encrypted +# +# DATABASE can be "all", "sameuser", "samerole", "replication", a +# database name, a regular expression (if it starts with a slash (/)) +# or a comma-separated list thereof. The "all" keyword does not match +# "replication". Access to replication must be enabled in a separate +# record (see example below). +# +# USER can be "all", a user name, a group name prefixed with "+", a +# regular expression (if it starts with a slash (/)) or a comma-separated +# list thereof. In both the DATABASE and USER fields you can also write +# a file name prefixed with "@" to include names from a separate file. +# +# ADDRESS specifies the set of hosts the record matches. It can be a +# host name, or it is made up of an IP address and a CIDR mask that is +# an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that +# specifies the number of significant bits in the mask. A host name +# that starts with a dot (.) matches a suffix of the actual host name. +# Alternatively, you can write an IP address and netmask in separate +# columns to specify the set of hosts. Instead of a CIDR-address, you +# can write "samehost" to match any of the server's own IP addresses, +# or "samenet" to match any address in any subnet that the server is +# directly connected to. +# +# METHOD can be "trust", "reject", "md5", "password", "scram-sha-256", +# "gss", "sspi", "ident", "peer", "pam", "ldap", "radius" or "cert". +# Note that "password" sends passwords in clear text; "md5" or +# "scram-sha-256" are preferred since they send encrypted passwords. +# +# OPTIONS are a set of options for the authentication in the format +# NAME=VALUE. The available options depend on the different +# authentication methods -- refer to the "Client Authentication" +# section in the documentation for a list of which options are +# available for which authentication methods. +# +# Database and user names containing spaces, commas, quotes and other +# special characters must be quoted. Quoting one of the keywords +# "all", "sameuser", "samerole" or "replication" makes the name lose +# its special character, and just match a database or username with +# that name. +# +# --------------- +# Include Records +# --------------- +# +# This file allows the inclusion of external files or directories holding +# more records, using the following keywords: +# +# include FILE +# include_if_exists FILE +# include_dir DIRECTORY +# +# FILE is the file name to include, and DIR is the directory name containing +# the file(s) to include. Any file in a directory will be loaded if suffixed +# with ".conf". The files of a directory are ordered by name. +# include_if_exists ignores missing files. FILE and DIRECTORY can be +# specified as a relative or an absolute path, and can be double-quoted if +# they contain spaces. +# +# ------------- +# Miscellaneous +# ------------- +# +# This file is read on server startup and when the server receives a +# SIGHUP signal. If you edit the file on a running system, you have to +# SIGHUP the server for the changes to take effect, run "pg_ctl reload", +# or execute "SELECT pg_reload_conf()". +# +# ---------------------------------- +# Put your actual configuration here +# ---------------------------------- +# +# If you want to allow non-local connections, you need to add more +# "host" records. In that case you will also need to make PostgreSQL +# listen on a non-local interface via the listen_addresses +# configuration parameter, or via the -i or -h command line switches. + +# CAUTION: Configuring the system for local "trust" authentication +# allows any local user to connect as any PostgreSQL user, including +# the database superuser. If you do not trust all your local users, +# use another authentication method. + + +# TYPE DATABASE USER ADDRESS METHOD + +# "local" is for Unix domain socket connections only +local all all trust +# IPv4 local connections: +host all all 127.0.0.1/32 trust +# IPv6 local connections: +host all all ::1/128 trust +# Allow replication connections from localhost, by a user with the +# replication privilege. +local replication all trust +host replication all 127.0.0.1/32 trust +host replication all ::1/128 trust + +host all all all scram-sha-256 diff --git a/starpost/postgres/pg_ident.conf b/starpost/postgres/pg_ident.conf new file mode 100644 index 0000000..f5225f2 --- /dev/null +++ b/starpost/postgres/pg_ident.conf @@ -0,0 +1,72 @@ +# PostgreSQL User Name Maps +# ========================= +# +# --------------- +# Mapping Records +# --------------- +# +# Refer to the PostgreSQL documentation, chapter "Client +# Authentication" for a complete description. A short synopsis +# follows. +# +# This file controls PostgreSQL user name mapping. It maps external +# user names to their corresponding PostgreSQL user names. Records +# are of the form: +# +# MAPNAME SYSTEM-USERNAME PG-USERNAME +# +# (The uppercase quantities must be replaced by actual values.) +# +# MAPNAME is the (otherwise freely chosen) map name that was used in +# pg_hba.conf. SYSTEM-USERNAME is the detected user name of the +# client. PG-USERNAME is the requested PostgreSQL user name. The +# existence of a record specifies that SYSTEM-USERNAME may connect as +# PG-USERNAME. +# +# If SYSTEM-USERNAME starts with a slash (/), it will be treated as a +# regular expression. Optionally this can contain a capture (a +# parenthesized subexpression). The substring matching the capture +# will be substituted for \1 (backslash-one) if present in +# PG-USERNAME. +# +# PG-USERNAME can be "all", a user name, a group name prefixed with "+", or +# a regular expression (if it starts with a slash (/)). If it is a regular +# expression, the substring matching with \1 has no effect. +# +# Multiple maps may be specified in this file and used by pg_hba.conf. +# +# No map names are defined in the default configuration. If all +# system user names and PostgreSQL user names are the same, you don't +# need anything in this file. +# +# --------------- +# Include Records +# --------------- +# +# This file allows the inclusion of external files or directories holding +# more records, using the following keywords: +# +# include FILE +# include_if_exists FILE +# include_dir DIRECTORY +# +# FILE is the file name to include, and DIR is the directory name containing +# the file(s) to include. Any file in a directory will be loaded if suffixed +# with ".conf". The files of a directory are ordered by name. +# include_if_exists ignores missing files. FILE and DIRECTORY can be +# specified as a relative or an absolute path, and can be double-quoted if +# they contain spaces. +# +# ------------------------------- +# Miscellaneous +# ------------------------------- +# +# This file is read on server startup and when the postmaster receives +# a SIGHUP signal. If you edit the file on a running system, you have +# to SIGHUP the postmaster for the changes to take effect. You can +# use "pg_ctl reload" to do that. + +# Put your actual configuration here +# ---------------------------------- + +# MAPNAME SYSTEM-USERNAME PG-USERNAME diff --git a/starpost/postgres/pg_logical/replorigin_checkpoint b/starpost/postgres/pg_logical/replorigin_checkpoint new file mode 100644 index 0000000..ec451b0 Binary files /dev/null and b/starpost/postgres/pg_logical/replorigin_checkpoint differ diff --git a/starpost/postgres/pg_multixact/members/0000 b/starpost/postgres/pg_multixact/members/0000 new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/starpost/postgres/pg_multixact/members/0000 differ diff --git a/starpost/postgres/pg_multixact/offsets/0000 b/starpost/postgres/pg_multixact/offsets/0000 new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/starpost/postgres/pg_multixact/offsets/0000 differ diff --git a/starpost/postgres/pg_subtrans/0000 b/starpost/postgres/pg_subtrans/0000 new file mode 100644 index 0000000..d5e0bbc Binary files /dev/null and b/starpost/postgres/pg_subtrans/0000 differ diff --git a/starpost/postgres/pg_wal/000000010000000000000001 b/starpost/postgres/pg_wal/000000010000000000000001 new file mode 100644 index 0000000..1e6cf2b Binary files /dev/null and b/starpost/postgres/pg_wal/000000010000000000000001 differ diff --git a/starpost/postgres/pg_xact/0000 b/starpost/postgres/pg_xact/0000 new file mode 100644 index 0000000..188a0bb Binary files /dev/null and b/starpost/postgres/pg_xact/0000 differ diff --git a/starpost/postgres/postgresql.auto.conf b/starpost/postgres/postgresql.auto.conf new file mode 100644 index 0000000..af7125e --- /dev/null +++ b/starpost/postgres/postgresql.auto.conf @@ -0,0 +1,2 @@ +# Do not edit this file manually! +# It will be overwritten by the ALTER SYSTEM command. diff --git a/starpost/postgres/postgresql.conf b/starpost/postgres/postgresql.conf new file mode 100644 index 0000000..4960314 --- /dev/null +++ b/starpost/postgres/postgresql.conf @@ -0,0 +1,826 @@ +# ----------------------------- +# PostgreSQL configuration file +# ----------------------------- +# +# This file consists of lines of the form: +# +# name = value +# +# (The "=" is optional.) Whitespace may be used. Comments are introduced with +# "#" anywhere on a line. The complete list of parameter names and allowed +# values can be found in the PostgreSQL documentation. +# +# The commented-out settings shown in this file represent the default values. +# Re-commenting a setting is NOT sufficient to revert it to the default value; +# you need to reload the server. +# +# This file is read on server startup and when the server receives a SIGHUP +# signal. If you edit the file on a running system, you have to SIGHUP the +# server for the changes to take effect, run "pg_ctl reload", or execute +# "SELECT pg_reload_conf()". Some parameters, which are marked below, +# require a server shutdown and restart to take effect. +# +# Any parameter can also be given as a command-line option to the server, e.g., +# "postgres -c log_connections=on". Some parameters can be changed at run time +# with the "SET" SQL command. +# +# Memory units: B = bytes Time units: us = microseconds +# kB = kilobytes ms = milliseconds +# MB = megabytes s = seconds +# GB = gigabytes min = minutes +# TB = terabytes h = hours +# d = days + + +#------------------------------------------------------------------------------ +# FILE LOCATIONS +#------------------------------------------------------------------------------ + +# The default values of these variables are driven from the -D command-line +# option or PGDATA environment variable, represented here as ConfigDir. + +#data_directory = 'ConfigDir' # use data in another directory + # (change requires restart) +#hba_file = 'ConfigDir/pg_hba.conf' # host-based authentication file + # (change requires restart) +#ident_file = 'ConfigDir/pg_ident.conf' # ident configuration file + # (change requires restart) + +# If external_pid_file is not explicitly set, no extra PID file is written. +#external_pid_file = '' # write an extra PID file + # (change requires restart) + + +#------------------------------------------------------------------------------ +# CONNECTIONS AND AUTHENTICATION +#------------------------------------------------------------------------------ + +# - Connection Settings - + +listen_addresses = '*' + # comma-separated list of addresses; + # defaults to 'localhost'; use '*' for all + # (change requires restart) +#port = 5432 # (change requires restart) +max_connections = 100 # (change requires restart) +#reserved_connections = 0 # (change requires restart) +#superuser_reserved_connections = 3 # (change requires restart) +#unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories + # (change requires restart) +#unix_socket_group = '' # (change requires restart) +#unix_socket_permissions = 0777 # begin with 0 to use octal notation + # (change requires restart) +#bonjour = off # advertise server via Bonjour + # (change requires restart) +#bonjour_name = '' # defaults to the computer name + # (change requires restart) + +# - TCP settings - +# see "man tcp" for details + +#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds; + # 0 selects the system default +#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds; + # 0 selects the system default +#tcp_keepalives_count = 0 # TCP_KEEPCNT; + # 0 selects the system default +#tcp_user_timeout = 0 # TCP_USER_TIMEOUT, in milliseconds; + # 0 selects the system default + +#client_connection_check_interval = 0 # time between checks for client + # disconnection while running queries; + # 0 for never + +# - Authentication - + +#authentication_timeout = 1min # 1s-600s +#password_encryption = scram-sha-256 # scram-sha-256 or md5 +#scram_iterations = 4096 +#db_user_namespace = off + +# GSSAPI using Kerberos +#krb_server_keyfile = 'FILE:${sysconfdir}/krb5.keytab' +#krb_caseins_users = off +#gss_accept_delegation = off + +# - SSL - + +#ssl = off +#ssl_ca_file = '' +#ssl_cert_file = 'server.crt' +#ssl_crl_file = '' +#ssl_crl_dir = '' +#ssl_key_file = 'server.key' +#ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL' # allowed SSL ciphers +#ssl_prefer_server_ciphers = on +#ssl_ecdh_curve = 'prime256v1' +#ssl_min_protocol_version = 'TLSv1.2' +#ssl_max_protocol_version = '' +#ssl_dh_params_file = '' +#ssl_passphrase_command = '' +#ssl_passphrase_command_supports_reload = off + + +#------------------------------------------------------------------------------ +# RESOURCE USAGE (except WAL) +#------------------------------------------------------------------------------ + +# - Memory - + +shared_buffers = 128MB # min 128kB + # (change requires restart) +#huge_pages = try # on, off, or try + # (change requires restart) +#huge_page_size = 0 # zero for system default + # (change requires restart) +#temp_buffers = 8MB # min 800kB +#max_prepared_transactions = 0 # zero disables the feature + # (change requires restart) +# Caution: it is not advisable to set max_prepared_transactions nonzero unless +# you actively intend to use prepared transactions. +#work_mem = 4MB # min 64kB +#hash_mem_multiplier = 2.0 # 1-1000.0 multiplier on hash table work_mem +#maintenance_work_mem = 64MB # min 1MB +#autovacuum_work_mem = -1 # min 1MB, or -1 to use maintenance_work_mem +#logical_decoding_work_mem = 64MB # min 64kB +#max_stack_depth = 2MB # min 100kB +#shared_memory_type = mmap # the default is the first option + # supported by the operating system: + # mmap + # sysv + # windows + # (change requires restart) +dynamic_shared_memory_type = posix # the default is usually the first option + # supported by the operating system: + # posix + # sysv + # windows + # mmap + # (change requires restart) +#min_dynamic_shared_memory = 0MB # (change requires restart) +#vacuum_buffer_usage_limit = 256kB # size of vacuum and analyze buffer access strategy ring; + # 0 to disable vacuum buffer access strategy; + # range 128kB to 16GB + +# - Disk - + +#temp_file_limit = -1 # limits per-process temp file space + # in kilobytes, or -1 for no limit + +#file_extend_method = posix_fallocate # the default is the first option supported + # by the operating system: + # posix_fallocate (most Unix-like systems) + # write_zeros + +# - Kernel Resources - + +#max_files_per_process = 1000 # min 64 + # (change requires restart) + +# - Cost-Based Vacuum Delay - + +#vacuum_cost_delay = 0 # 0-100 milliseconds (0 disables) +#vacuum_cost_page_hit = 1 # 0-10000 credits +#vacuum_cost_page_miss = 2 # 0-10000 credits +#vacuum_cost_page_dirty = 20 # 0-10000 credits +#vacuum_cost_limit = 200 # 1-10000 credits + +# - Background Writer - + +#bgwriter_delay = 200ms # 10-10000ms between rounds +#bgwriter_lru_maxpages = 100 # max buffers written/round, 0 disables +#bgwriter_lru_multiplier = 2.0 # 0-10.0 multiplier on buffers scanned/round +#bgwriter_flush_after = 512kB # measured in pages, 0 disables + +# - Asynchronous Behavior - + +#backend_flush_after = 0 # measured in pages, 0 disables +#effective_io_concurrency = 1 # 1-1000; 0 disables prefetching +#maintenance_io_concurrency = 10 # 1-1000; 0 disables prefetching +#max_worker_processes = 8 # (change requires restart) +#max_parallel_workers_per_gather = 2 # limited by max_parallel_workers +#max_parallel_maintenance_workers = 2 # limited by max_parallel_workers +#max_parallel_workers = 8 # number of max_worker_processes that + # can be used in parallel operations +#parallel_leader_participation = on +#old_snapshot_threshold = -1 # 1min-60d; -1 disables; 0 is immediate + # (change requires restart) + + +#------------------------------------------------------------------------------ +# WRITE-AHEAD LOG +#------------------------------------------------------------------------------ + +# - Settings - + +#wal_level = replica # minimal, replica, or logical + # (change requires restart) +#fsync = on # flush data to disk for crash safety + # (turning this off can cause + # unrecoverable data corruption) +#synchronous_commit = on # synchronization level; + # off, local, remote_write, remote_apply, or on +#wal_sync_method = fsync # the default is the first option + # supported by the operating system: + # open_datasync + # fdatasync (default on Linux and FreeBSD) + # fsync + # fsync_writethrough + # open_sync +#full_page_writes = on # recover from partial page writes +#wal_log_hints = off # also do full page writes of non-critical updates + # (change requires restart) +#wal_compression = off # enables compression of full-page writes; + # off, pglz (or "on"), lz4, or zstd +#wal_init_zero = on # zero-fill new WAL files +#wal_recycle = on # recycle WAL files +#wal_buffers = -1 # min 32kB, -1 sets based on shared_buffers + # (change requires restart) +#wal_writer_delay = 200ms # 1-10000 milliseconds +#wal_writer_flush_after = 1MB # measured in pages, 0 disables +#wal_skip_threshold = 2MB + +#commit_delay = 0 # range 0-100000, in microseconds +#commit_siblings = 5 # range 0-1000 + +# - Checkpoints - + +#checkpoint_timeout = 5min # range 30s-1d +#checkpoint_completion_target = 0.9 # checkpoint target duration, 0.0 - 1.0 +#checkpoint_flush_after = 256kB # measured in pages, 0 disables +#checkpoint_warning = 30s # 0 disables +max_wal_size = 1GB +min_wal_size = 80MB + +# - Prefetching during recovery - + +#recovery_prefetch = try # prefetch pages referenced in the WAL? +#wal_decode_buffer_size = 512kB # lookahead window used for prefetching + # (change requires restart) + +# - Archiving - + +#archive_mode = off # enables archiving; off, on, or always + # (change requires restart) +#archive_library = '' # library to use to archive a WAL file + # (empty string indicates archive_command should + # be used) +#archive_command = '' # command to use to archive a WAL file + # placeholders: %p = path of file to archive + # %f = file name only + # e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f' +#archive_timeout = 0 # force a WAL file switch after this + # number of seconds; 0 disables + +# - Archive Recovery - + +# These are only used in recovery mode. + +#restore_command = '' # command to use to restore an archived WAL file + # placeholders: %p = path of file to restore + # %f = file name only + # e.g. 'cp /mnt/server/archivedir/%f %p' +#archive_cleanup_command = '' # command to execute at every restartpoint +#recovery_end_command = '' # command to execute at completion of recovery + +# - Recovery Target - + +# Set these only when performing a targeted recovery. + +#recovery_target = '' # 'immediate' to end recovery as soon as a + # consistent state is reached + # (change requires restart) +#recovery_target_name = '' # the named restore point to which recovery will proceed + # (change requires restart) +#recovery_target_time = '' # the time stamp up to which recovery will proceed + # (change requires restart) +#recovery_target_xid = '' # the transaction ID up to which recovery will proceed + # (change requires restart) +#recovery_target_lsn = '' # the WAL LSN up to which recovery will proceed + # (change requires restart) +#recovery_target_inclusive = on # Specifies whether to stop: + # just after the specified recovery target (on) + # just before the recovery target (off) + # (change requires restart) +#recovery_target_timeline = 'latest' # 'current', 'latest', or timeline ID + # (change requires restart) +#recovery_target_action = 'pause' # 'pause', 'promote', 'shutdown' + # (change requires restart) + + +#------------------------------------------------------------------------------ +# REPLICATION +#------------------------------------------------------------------------------ + +# - Sending Servers - + +# Set these on the primary and on any standby that will send replication data. + +#max_wal_senders = 10 # max number of walsender processes + # (change requires restart) +#max_replication_slots = 10 # max number of replication slots + # (change requires restart) +#wal_keep_size = 0 # in megabytes; 0 disables +#max_slot_wal_keep_size = -1 # in megabytes; -1 disables +#wal_sender_timeout = 60s # in milliseconds; 0 disables +#track_commit_timestamp = off # collect timestamp of transaction commit + # (change requires restart) + +# - Primary Server - + +# These settings are ignored on a standby server. + +#synchronous_standby_names = '' # standby servers that provide sync rep + # method to choose sync standbys, number of sync standbys, + # and comma-separated list of application_name + # from standby(s); '*' = all + +# - Standby Servers - + +# These settings are ignored on a primary server. + +#primary_conninfo = '' # connection string to sending server +#primary_slot_name = '' # replication slot on sending server +#hot_standby = on # "off" disallows queries during recovery + # (change requires restart) +#max_standby_archive_delay = 30s # max delay before canceling queries + # when reading WAL from archive; + # -1 allows indefinite delay +#max_standby_streaming_delay = 30s # max delay before canceling queries + # when reading streaming WAL; + # -1 allows indefinite delay +#wal_receiver_create_temp_slot = off # create temp slot if primary_slot_name + # is not set +#wal_receiver_status_interval = 10s # send replies at least this often + # 0 disables +#hot_standby_feedback = off # send info from standby to prevent + # query conflicts +#wal_receiver_timeout = 60s # time that receiver waits for + # communication from primary + # in milliseconds; 0 disables +#wal_retrieve_retry_interval = 5s # time to wait before retrying to + # retrieve WAL after a failed attempt +#recovery_min_apply_delay = 0 # minimum delay for applying changes during recovery + +# - Subscribers - + +# These settings are ignored on a publisher. + +#max_logical_replication_workers = 4 # taken from max_worker_processes + # (change requires restart) +#max_sync_workers_per_subscription = 2 # taken from max_logical_replication_workers +#max_parallel_apply_workers_per_subscription = 2 # taken from max_logical_replication_workers + + +#------------------------------------------------------------------------------ +# QUERY TUNING +#------------------------------------------------------------------------------ + +# - Planner Method Configuration - + +#enable_async_append = on +#enable_bitmapscan = on +#enable_gathermerge = on +#enable_hashagg = on +#enable_hashjoin = on +#enable_incremental_sort = on +#enable_indexscan = on +#enable_indexonlyscan = on +#enable_material = on +#enable_memoize = on +#enable_mergejoin = on +#enable_nestloop = on +#enable_parallel_append = on +#enable_parallel_hash = on +#enable_partition_pruning = on +#enable_partitionwise_join = off +#enable_partitionwise_aggregate = off +#enable_presorted_aggregate = on +#enable_seqscan = on +#enable_sort = on +#enable_tidscan = on + +# - Planner Cost Constants - + +#seq_page_cost = 1.0 # measured on an arbitrary scale +#random_page_cost = 4.0 # same scale as above +#cpu_tuple_cost = 0.01 # same scale as above +#cpu_index_tuple_cost = 0.005 # same scale as above +#cpu_operator_cost = 0.0025 # same scale as above +#parallel_setup_cost = 1000.0 # same scale as above +#parallel_tuple_cost = 0.1 # same scale as above +#min_parallel_table_scan_size = 8MB +#min_parallel_index_scan_size = 512kB +#effective_cache_size = 4GB + +#jit_above_cost = 100000 # perform JIT compilation if available + # and query more expensive than this; + # -1 disables +#jit_inline_above_cost = 500000 # inline small functions if query is + # more expensive than this; -1 disables +#jit_optimize_above_cost = 500000 # use expensive JIT optimizations if + # query is more expensive than this; + # -1 disables + +# - Genetic Query Optimizer - + +#geqo = on +#geqo_threshold = 12 +#geqo_effort = 5 # range 1-10 +#geqo_pool_size = 0 # selects default based on effort +#geqo_generations = 0 # selects default based on effort +#geqo_selection_bias = 2.0 # range 1.5-2.0 +#geqo_seed = 0.0 # range 0.0-1.0 + +# - Other Planner Options - + +#default_statistics_target = 100 # range 1-10000 +#constraint_exclusion = partition # on, off, or partition +#cursor_tuple_fraction = 0.1 # range 0.0-1.0 +#from_collapse_limit = 8 +#jit = on # allow JIT compilation +#join_collapse_limit = 8 # 1 disables collapsing of explicit + # JOIN clauses +#plan_cache_mode = auto # auto, force_generic_plan or + # force_custom_plan +#recursive_worktable_factor = 10.0 # range 0.001-1000000 + + +#------------------------------------------------------------------------------ +# REPORTING AND LOGGING +#------------------------------------------------------------------------------ + +# - Where to Log - + +#log_destination = 'stderr' # Valid values are combinations of + # stderr, csvlog, jsonlog, syslog, and + # eventlog, depending on platform. + # csvlog and jsonlog require + # logging_collector to be on. + +# This is used when logging to stderr: +#logging_collector = off # Enable capturing of stderr, jsonlog, + # and csvlog into log files. Required + # to be on for csvlogs and jsonlogs. + # (change requires restart) + +# These are only used if logging_collector is on: +#log_directory = 'log' # directory where log files are written, + # can be absolute or relative to PGDATA +#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern, + # can include strftime() escapes +#log_file_mode = 0600 # creation mode for log files, + # begin with 0 to use octal notation +#log_rotation_age = 1d # Automatic rotation of logfiles will + # happen after that time. 0 disables. +#log_rotation_size = 10MB # Automatic rotation of logfiles will + # happen after that much log output. + # 0 disables. +#log_truncate_on_rotation = off # If on, an existing log file with the + # same name as the new log file will be + # truncated rather than appended to. + # But such truncation only occurs on + # time-driven rotation, not on restarts + # or size-driven rotation. Default is + # off, meaning append to existing files + # in all cases. + +# These are relevant when logging to syslog: +#syslog_facility = 'LOCAL0' +#syslog_ident = 'postgres' +#syslog_sequence_numbers = on +#syslog_split_messages = on + +# This is only relevant when logging to eventlog (Windows): +# (change requires restart) +#event_source = 'PostgreSQL' + +# - When to Log - + +#log_min_messages = warning # values in order of decreasing detail: + # debug5 + # debug4 + # debug3 + # debug2 + # debug1 + # info + # notice + # warning + # error + # log + # fatal + # panic + +#log_min_error_statement = error # values in order of decreasing detail: + # debug5 + # debug4 + # debug3 + # debug2 + # debug1 + # info + # notice + # warning + # error + # log + # fatal + # panic (effectively off) + +#log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements + # and their durations, > 0 logs only + # statements running at least this number + # of milliseconds + +#log_min_duration_sample = -1 # -1 is disabled, 0 logs a sample of statements + # and their durations, > 0 logs only a sample of + # statements running at least this number + # of milliseconds; + # sample fraction is determined by log_statement_sample_rate + +#log_statement_sample_rate = 1.0 # fraction of logged statements exceeding + # log_min_duration_sample to be logged; + # 1.0 logs all such statements, 0.0 never logs + + +#log_transaction_sample_rate = 0.0 # fraction of transactions whose statements + # are logged regardless of their duration; 1.0 logs all + # statements from all transactions, 0.0 never logs + +#log_startup_progress_interval = 10s # Time between progress updates for + # long-running startup operations. + # 0 disables the feature, > 0 indicates + # the interval in milliseconds. + +# - What to Log - + +#debug_print_parse = off +#debug_print_rewritten = off +#debug_print_plan = off +#debug_pretty_print = on +#log_autovacuum_min_duration = 10min # log autovacuum activity; + # -1 disables, 0 logs all actions and + # their durations, > 0 logs only + # actions running at least this number + # of milliseconds. +#log_checkpoints = on +#log_connections = off +#log_disconnections = off +#log_duration = off +#log_error_verbosity = default # terse, default, or verbose messages +#log_hostname = off +#log_line_prefix = '%m [%p] ' # special values: + # %a = application name + # %u = user name + # %d = database name + # %r = remote host and port + # %h = remote host + # %b = backend type + # %p = process ID + # %P = process ID of parallel group leader + # %t = timestamp without milliseconds + # %m = timestamp with milliseconds + # %n = timestamp with milliseconds (as a Unix epoch) + # %Q = query ID (0 if none or not computed) + # %i = command tag + # %e = SQL state + # %c = session ID + # %l = session line number + # %s = session start timestamp + # %v = virtual transaction ID + # %x = transaction ID (0 if none) + # %q = stop here in non-session + # processes + # %% = '%' + # e.g. '<%u%%%d> ' +#log_lock_waits = off # log lock waits >= deadlock_timeout +#log_recovery_conflict_waits = off # log standby recovery conflict waits + # >= deadlock_timeout +#log_parameter_max_length = -1 # when logging statements, limit logged + # bind-parameter values to N bytes; + # -1 means print in full, 0 disables +#log_parameter_max_length_on_error = 0 # when logging an error, limit logged + # bind-parameter values to N bytes; + # -1 means print in full, 0 disables +#log_statement = 'none' # none, ddl, mod, all +#log_replication_commands = off +#log_temp_files = -1 # log temporary files equal or larger + # than the specified size in kilobytes; + # -1 disables, 0 logs all temp files +log_timezone = UTC + +# - Process Title - + +#cluster_name = '' # added to process titles if nonempty + # (change requires restart) +#update_process_title = on + + +#------------------------------------------------------------------------------ +# STATISTICS +#------------------------------------------------------------------------------ + +# - Cumulative Query and Index Statistics - + +#track_activities = on +#track_activity_query_size = 1024 # (change requires restart) +#track_counts = on +#track_io_timing = off +#track_wal_io_timing = off +#track_functions = none # none, pl, all +#stats_fetch_consistency = cache # cache, none, snapshot + + +# - Monitoring - + +#compute_query_id = auto +#log_statement_stats = off +#log_parser_stats = off +#log_planner_stats = off +#log_executor_stats = off + + +#------------------------------------------------------------------------------ +# AUTOVACUUM +#------------------------------------------------------------------------------ + +#autovacuum = on # Enable autovacuum subprocess? 'on' + # requires track_counts to also be on. +#autovacuum_max_workers = 3 # max number of autovacuum subprocesses + # (change requires restart) +#autovacuum_naptime = 1min # time between autovacuum runs +#autovacuum_vacuum_threshold = 50 # min number of row updates before + # vacuum +#autovacuum_vacuum_insert_threshold = 1000 # min number of row inserts + # before vacuum; -1 disables insert + # vacuums +#autovacuum_analyze_threshold = 50 # min number of row updates before + # analyze +#autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum +#autovacuum_vacuum_insert_scale_factor = 0.2 # fraction of inserts over table + # size before insert vacuum +#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze +#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum + # (change requires restart) +#autovacuum_multixact_freeze_max_age = 400000000 # maximum multixact age + # before forced vacuum + # (change requires restart) +#autovacuum_vacuum_cost_delay = 2ms # default vacuum cost delay for + # autovacuum, in milliseconds; + # -1 means use vacuum_cost_delay +#autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for + # autovacuum, -1 means use + # vacuum_cost_limit + + +#------------------------------------------------------------------------------ +# CLIENT CONNECTION DEFAULTS +#------------------------------------------------------------------------------ + +# - Statement Behavior - + +#client_min_messages = notice # values in order of decreasing detail: + # debug5 + # debug4 + # debug3 + # debug2 + # debug1 + # log + # notice + # warning + # error +#search_path = '"$user", public' # schema names +#row_security = on +#default_table_access_method = 'heap' +#default_tablespace = '' # a tablespace name, '' uses the default +#default_toast_compression = 'pglz' # 'pglz' or 'lz4' +#temp_tablespaces = '' # a list of tablespace names, '' uses + # only default tablespace +#check_function_bodies = on +#default_transaction_isolation = 'read committed' +#default_transaction_read_only = off +#default_transaction_deferrable = off +#session_replication_role = 'origin' +#statement_timeout = 0 # in milliseconds, 0 is disabled +#lock_timeout = 0 # in milliseconds, 0 is disabled +#idle_in_transaction_session_timeout = 0 # in milliseconds, 0 is disabled +#idle_session_timeout = 0 # in milliseconds, 0 is disabled +#vacuum_freeze_table_age = 150000000 +#vacuum_freeze_min_age = 50000000 +#vacuum_failsafe_age = 1600000000 +#vacuum_multixact_freeze_table_age = 150000000 +#vacuum_multixact_freeze_min_age = 5000000 +#vacuum_multixact_failsafe_age = 1600000000 +#bytea_output = 'hex' # hex, escape +#xmlbinary = 'base64' +#xmloption = 'content' +#gin_pending_list_limit = 4MB +#createrole_self_grant = '' # set and/or inherit + +# - Locale and Formatting - + +datestyle = 'iso, mdy' +#intervalstyle = 'postgres' +timezone = UTC +#timezone_abbreviations = 'Default' # Select the set of available time zone + # abbreviations. Currently, there are + # Default + # Australia (historical usage) + # India + # You can create your own file in + # share/timezonesets/. +#extra_float_digits = 1 # min -15, max 3; any value >0 actually + # selects precise output mode +#client_encoding = sql_ascii # actually, defaults to database + # encoding + +# These settings are initialized by initdb, but they can be changed. +lc_messages = 'en_US.utf8' # locale for system error message + # strings +lc_monetary = 'en_US.utf8' # locale for monetary formatting +lc_numeric = 'en_US.utf8' # locale for number formatting +lc_time = 'en_US.utf8' # locale for time formatting + +#icu_validation_level = warning # report ICU locale validation + # errors at the given level + +# default configuration for text search +default_text_search_config = 'pg_catalog.english' + +# - Shared Library Preloading - + +#local_preload_libraries = '' +#session_preload_libraries = '' +#shared_preload_libraries = '' # (change requires restart) +#jit_provider = 'llvmjit' # JIT library to use + +# - Other Defaults - + +#dynamic_library_path = '$libdir' +#gin_fuzzy_search_limit = 0 +#output_plugin_libraries = 'pgoutput, test_decoding' # approved plugins for logical decoding + + +#------------------------------------------------------------------------------ +# LOCK MANAGEMENT +#------------------------------------------------------------------------------ + +#deadlock_timeout = 1s +#max_locks_per_transaction = 64 # min 10 + # (change requires restart) +#max_pred_locks_per_transaction = 64 # min 10 + # (change requires restart) +#max_pred_locks_per_relation = -2 # negative values mean + # (max_pred_locks_per_transaction + # / -max_pred_locks_per_relation) - 1 +#max_pred_locks_per_page = 2 # min 0 + + +#------------------------------------------------------------------------------ +# VERSION AND PLATFORM COMPATIBILITY +#------------------------------------------------------------------------------ + +# - Previous PostgreSQL Versions - + +#array_nulls = on +#backslash_quote = safe_encoding # on, off, or safe_encoding +#escape_string_warning = on +#lo_compat_privileges = off +#quote_all_identifiers = off +#standard_conforming_strings = on +#synchronize_seqscans = on + +# - Other Platforms and Clients - + +#transform_null_equals = off + + +#------------------------------------------------------------------------------ +# ERROR HANDLING +#------------------------------------------------------------------------------ + +#exit_on_error = off # terminate session on any error? +#restart_after_crash = on # reinitialize after backend crash? +#data_sync_retry = off # retry or panic on failure to fsync + # data? + # (change requires restart) +#recovery_init_sync_method = fsync # fsync, syncfs (Linux 5.8+) + + +#------------------------------------------------------------------------------ +# CONFIG FILE INCLUDES +#------------------------------------------------------------------------------ + +# These options allow settings to be loaded from files other than the +# default postgresql.conf. Note that these are directives, not variable +# assignments, so they can usefully be given more than once. + +#include_dir = '...' # include files ending in '.conf' from + # a directory, e.g., 'conf.d' +#include_if_exists = '...' # include file only if it exists +#include = '...' # include file + + +#------------------------------------------------------------------------------ +# CUSTOMIZED OPTIONS +#------------------------------------------------------------------------------ + +# Add settings for extensions here diff --git a/starpost/postgres/postmaster.opts b/starpost/postgres/postmaster.opts new file mode 100644 index 0000000..77c8b5d --- /dev/null +++ b/starpost/postgres/postmaster.opts @@ -0,0 +1 @@ +/usr/local/bin/postgres diff --git a/starpost/postgres/postmaster.pid b/starpost/postgres/postmaster.pid new file mode 100644 index 0000000..cf5fed7 --- /dev/null +++ b/starpost/postgres/postmaster.pid @@ -0,0 +1,8 @@ +1 +/var/lib/postgresql/data +1792888986 +5432 +/var/run/postgresql +* + 788690 5 +ready diff --git a/starpost/warehouse/.gitkeep b/starpost/warehouse/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/starpost/warehouse/Dockerfile b/starpost/warehouse/Dockerfile new file mode 100644 index 0000000..86909fe --- /dev/null +++ b/starpost/warehouse/Dockerfile @@ -0,0 +1,5 @@ +FROM python:3.12-alpine +COPY requirements.txt /app/requirements.txt +RUN pip install --no-cache-dir -r /app/requirements.txt +COPY worker.py /app/worker.py +CMD ["python", "/app/worker.py"] diff --git a/starpost/warehouse/requirements.txt b/starpost/warehouse/requirements.txt new file mode 100644 index 0000000..22ac75b --- /dev/null +++ b/starpost/warehouse/requirements.txt @@ -0,0 +1 @@ +Flask==3.1.0 diff --git a/starpost/warehouse/worker.py b/starpost/warehouse/worker.py new file mode 100644 index 0000000..b5b7255 --- /dev/null +++ b/starpost/warehouse/worker.py @@ -0,0 +1,103 @@ +import os +import secrets +import threading +import time +import urllib.error +import urllib.request +import json +from datetime import datetime, timezone + +from flask import Flask, jsonify, request + + +API_URL = os.environ["WAREHOUSE_API_URL"] +CALLBACK_TOKEN = os.environ["WAREHOUSE_CALLBACK_TOKEN"] +app = Flask(__name__) +jobs = {} +jobs_lock = threading.Lock() + + +def request_json(method, path, payload=None): + data = json.dumps(payload).encode() if payload is not None else None + headers = {"Content-Type": "application/json", "X-Warehouse-Token": CALLBACK_TOKEN} + request = urllib.request.Request(f"{API_URL}{path}", data=data, headers=headers, method=method) + with urllib.request.urlopen(request, timeout=3) as response: + return json.loads(response.read()) + + +def callback(job, stage): + request_json("POST", "/api/warehouse/callback", {"order_id": job["order_id"], "job_id": job["job_id"], "stage": stage}) + with jobs_lock: + job["stage"] = stage + job["updated_at"] = datetime.now(timezone.utc).isoformat() + + +def process(job): + try: + for stage, delay in (("accepted", .05), ("picking", .18), ("in_transit", .18), ("arriving", .18), ("delivered", .18)): + time.sleep(delay) + callback(job, stage) + except (OSError, ValueError, urllib.error.URLError): + with jobs_lock: + jobs.pop(job["job_id"], None) + + +def delivery_loop(): + while True: + try: + pending = request_json("GET", "/api/warehouse/pending") + for order in pending: + with jobs_lock: + known = any(job["order_id"] == order["id"] for job in jobs.values()) + if known: + continue + job_id = "ATLAS-" + secrets.token_hex(8).upper() + job = {"job_id": job_id, "order_id": order["id"], "stage": "queued", "updated_at": datetime.now(timezone.utc).isoformat()} + jobs[job_id] = job + threading.Thread(target=process, args=(job,), daemon=True).start() + except (OSError, ValueError, urllib.error.URLError): + pass + time.sleep(.2) + + +@app.get("/health") +def health(): + return jsonify(status="ok", service="warehouse", bot="ATLAS-7") + + +@app.post("/jobs") +def create_job(): + if request.headers.get("X-Warehouse-Token") != CALLBACK_TOKEN: + return jsonify(error="forbidden"), 403 + data = request.get_json(silent=True) or {} + try: + order_id = int(data["order_id"]) + except (KeyError, TypeError, ValueError): + return jsonify(error="order_id is required"), 400 + with jobs_lock: + for job in jobs.values(): + if job["order_id"] == order_id: + return jsonify(job), 202 + job_id = "ATLAS-" + secrets.token_hex(8).upper() + job = {"job_id": job_id, "order_id": order_id, "stage": "queued", "updated_at": datetime.now(timezone.utc).isoformat()} + jobs[job_id] = job + threading.Thread(target=process, args=(job,), daemon=True).start() + return jsonify(job), 202 + + +@app.get("/jobs/") +def get_job(job_id): + with jobs_lock: + job = jobs.get(job_id) + return (jsonify(job), 200) if job else (jsonify(error="job not found"), 404) + + +@app.get("/jobs") +def list_jobs(): + with jobs_lock: + return jsonify(list(jobs.values())[-50:]) + + +if __name__ == "__main__": + threading.Thread(target=delivery_loop, daemon=True).start() + app.run(host="0.0.0.0", port=6000, threaded=True) diff --git a/starpost/web/Dockerfile b/starpost/web/Dockerfile new file mode 100644 index 0000000..2913a00 --- /dev/null +++ b/starpost/web/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx:1.27-alpine +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY pages /usr/share/nginx/html diff --git a/starpost/web/nginx.conf b/starpost/web/nginx.conf new file mode 100644 index 0000000..4fac396 --- /dev/null +++ b/starpost/web/nginx.conf @@ -0,0 +1,20 @@ +server { + listen 80; + server_name _; + root /usr/share/nginx/html; + index index.html; + add_header Cache-Control "no-store" always; + + location = / { try_files /index.html =404; } + location = /login/ { try_files /login.html =404; } + location = /registr/ { try_files /registr.html =404; } + location = /marketplace/ { try_files /marketplace.html =404; } + location = /product/ { try_files /product.html =404; } + location = /cart/ { try_files /cart.html =404; } + location = /account/ { try_files /account.html =404; } + location = /orders/ { try_files /orders.html =404; } + location = /seller/ { try_files /seller.html =404; } + location = /contract/ { try_files /contract.html =404; } + location /api/ { proxy_pass http://api:5000; proxy_set_header Host $host; } + location = /health { proxy_pass http://api:5000; } +} diff --git a/starpost/web/pages/account.css b/starpost/web/pages/account.css new file mode 100644 index 0000000..6e61b11 --- /dev/null +++ b/starpost/web/pages/account.css @@ -0,0 +1,124 @@ +.account-hero { + display: grid; + grid-template-columns: auto 1fr auto; + align-items: center; + gap: 22px; + margin: 30px 0; + padding: 30px; + border: 1px solid var(--line); + background: linear-gradient(120deg, #14271f, var(--panel)); +} +.account-hero h1 { font-size: clamp(2.3rem, 5vw, 4.5rem); margin: 4px 0; } + +.avatar { + display: grid; + place-items: center; + width: 82px; + height: 82px; + border-radius: 50%; + background: var(--acid); + color: #101510; + font-size: 2.5rem; + font-weight: 900; +} + +.balance { display: grid; gap: 8px; text-align: right; } +.balance small, +.account-stats small { + color: var(--dim); + font: 700 .7rem monospace; + letter-spacing: .12em; +} +.balance strong { color: var(--acid); font-size: 2rem; } + +.account-stats { + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: 12px; + margin: 20px 0; +} +.account-stats > div { + display: grid; + gap: 10px; + padding: 22px; + border: 1px solid var(--line); + background: var(--panel); +} +.account-stats b { font-size: 1.8rem; } + +.account-grid { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 16px; + margin-top: 16px; +} + +.account-panel { + padding: 26px; + border: 1px solid var(--line); + background: var(--panel); +} +.account-panel h2 { margin: 8px 0 22px; } + +.account-links { display: grid; } +.account-links a { + display: flex; + justify-content: space-between; + padding: 16px 0; + border-bottom: 1px solid var(--line); + color: var(--ink); + text-decoration: none; +} +.account-links a:hover { color: var(--acid); } +.account-links span { color: var(--acid); } + +.profile-data { display: grid; gap: 14px; } +.profile-data div { + display: flex; + justify-content: space-between; + gap: 15px; + padding-bottom: 12px; + border-bottom: 1px solid var(--line); +} +.profile-data dt { color: var(--dim); } +.profile-data dd { margin: 0; text-align: right; } + +.recent-panel { margin-top: 16px; } +.recent-order { + display: grid; + grid-template-columns: 1fr auto auto; + gap: 20px; + align-items: center; + padding: 16px 0; + border-bottom: 1px solid var(--line); +} +.recent-order div { display: grid; gap: 6px; } +.recent-order small { color: var(--dim); } +.recent-order strong { white-space: nowrap; } + +.status { text-transform: capitalize; color: var(--acid); } + +@media (max-width: 760px) { + .account-hero, .account-grid { grid-template-columns: 1fr; } + .balance { text-align: left; } + .account-stats { grid-template-columns: 1fr 1fr; } + .recent-order { grid-template-columns: 1fr auto; } + .recent-order strong { grid-column: 1; } + .avatar { width: 64px; height: 64px; } + .account-hero { gap: 15px; } +} + +.promo-box { + margin-top: 24px; + padding: 18px; + border: 1px solid #466c5d; + background: #0c1913; +} +.promo-box h3 { margin: 6px 0; } +.promo-row { display: flex; gap: 8px; margin: 14px 0; } +.promo-row input { min-width: 0; flex: 1; font-family: monospace; } +.promo-row button { white-space: nowrap; } + +@media (max-width: 760px) { + .promo-row { flex-direction: column; } +} \ No newline at end of file diff --git a/starpost/web/pages/account.html b/starpost/web/pages/account.html new file mode 100644 index 0000000..037eda4 --- /dev/null +++ b/starpost/web/pages/account.html @@ -0,0 +1,63 @@ + + + + + + Личный кабинет | Starpost + + + + +
+ STARPOST + +
+
+

ЛИЧНЫЙ КАНАЛ · STARPOST ID

+ + + + +
+ + + + diff --git a/starpost/web/pages/cart.css b/starpost/web/pages/cart.css new file mode 100644 index 0000000..ea3e64b --- /dev/null +++ b/starpost/web/pages/cart.css @@ -0,0 +1,108 @@ +.cart-layout { + display: grid; + grid-template-columns: minmax(0, 1fr) 340px; + gap: 24px; + align-items: start; +} + +.cart-items { display: grid; gap: 12px; } + +.cart-item { + display: grid; + grid-template-columns: 64px minmax(0, 1fr) auto auto 28px; + align-items: center; + gap: 18px; + padding: 18px; + border: 1px solid var(--line); + background: var(--panel); +} + +.cargo-mark { + display: grid; + place-items: center; + width: 64px; + aspect-ratio: 1; + border: 1px solid #466c5d; + background: linear-gradient(135deg, #1b3a2d, #0c1411); + color: var(--acid); + font: 700 .72rem monospace; + text-align: center; + letter-spacing: .08em; +} + +.cart-item-info a { color: var(--ink); font-weight: 700; text-decoration: none; } +.cart-item-info a:hover { color: var(--acid); } +.cart-item-info p, +.cart-item-info small { + margin: 6px 0; + color: var(--dim); + font-size: .82rem; +} + +.quantity-control { display: flex; align-items: center; border: 1px solid var(--line); } +.quantity-control button { + width: 34px; + padding: 8px; + background: transparent; + color: var(--ink); +} +.quantity-control span { width: 34px; text-align: center; } + +.cart-price { display: grid; text-align: right; white-space: nowrap; } +.cart-price small { margin-top: 5px; color: var(--dim); } + +.remove { + padding: 4px; + background: transparent; + color: var(--dim); + font-size: 1.4rem; +} + +.checkout-card { + position: sticky; + top: 92px; + padding: 24px; + border: 1px solid var(--line); + background: var(--panel); +} +.checkout-card h2 { margin-top: 0; font-size: 1.4rem; } + +.summary-row, +.summary-total { + display: flex; + justify-content: space-between; + gap: 15px; + padding: 12px 0; +} +.summary-row { color: var(--dim); } +.free { color: var(--acid); } +.summary-total { + margin: 8px 0 18px; + border-top: 1px solid var(--line); + padding-top: 18px; + font-size: 1.3rem; +} + +.checkout-card button { width: 100%; } +.checkout-card button:disabled { + cursor: not-allowed; + background: #30443f; + color: #93a49d; +} +.checkout-card p { font-size: .78rem; } + +.empty-cart { + padding: 50px 25px; + border: 1px dashed var(--line); + text-align: center; +} + +@media (max-width: 850px) { + .cart-layout { grid-template-columns: 1fr; } + .checkout-card { position: static; } + .cart-item { grid-template-columns: 52px minmax(0, 1fr) 28px; } + .cargo-mark { width: 52px; } + .quantity-control, .cart-price { grid-column: 2; } + .cart-price { text-align: left; } + .remove { grid-column: 3; grid-row: 1; align-self: start; } +} \ No newline at end of file diff --git a/starpost/web/pages/cart.html b/starpost/web/pages/cart.html new file mode 100644 index 0000000..377b4de --- /dev/null +++ b/starpost/web/pages/cart.html @@ -0,0 +1,88 @@ + + + + + + Корзина | Starpost + + + + +
+ STARPOST + +
+
+

ЛИЧНЫЙ АНГАР

+

Корзина

+

+
+
+ +
+
+ + + + diff --git a/starpost/web/pages/common.js b/starpost/web/pages/common.js new file mode 100644 index 0000000..d615ef9 --- /dev/null +++ b/starpost/web/pages/common.js @@ -0,0 +1,183 @@ +const $ = selector => document.querySelector(selector); + +if (!document.querySelector('link[href="/ui.css"]')) { + const stylesheet = document.createElement("link"); + stylesheet.rel = "stylesheet"; + stylesheet.href = "/ui.css"; + document.head.append(stylesheet); +} + +class ApiError extends Error { + constructor(message, status = 0) { + super(message); + this.status = status; + } +} + +async function api(path, options = {}) { + const method = (options.method || "GET").toUpperCase(); + const headers = {"Content-Type": "application/json", ...(options.headers || {})}; + let response; + let lastError; + + for (let attempt = 0; attempt < (method === "GET" ? 3 : 1); attempt += 1) { + try { + response = await fetch(path, {...options, method, headers, credentials: "same-origin"}); + if (![502, 503, 504].includes(response.status) || attempt === 2) break; + } catch (error) { + lastError = error; + if (attempt === 2) throw new ApiError("Сервис временно недоступен", 0); + } + await new Promise(resolve => setTimeout(resolve, 350 * (attempt + 1))); + } + + if (!response) throw new ApiError(lastError?.message || "Сервис временно недоступен", 0); + const contentType = response.headers.get("content-type") || ""; + const data = contentType.includes("json") ? await response.json() : null; + if (!response.ok) throw new ApiError(data?.error || `HTTP ${response.status}`, response.status); + return data; +} + +const esc = value => String(value ?? "").replace(/[&<>"']/g, character => ({"&":"&", "<":"<", ">":">", "\"":""", "'":"'"}[character])); + +async function user() { + return api("/api/me"); +} + +async function optionalUser() { + try { + return await user(); + } catch (error) { + if (error.status === 401) return null; + throw error; + } +} + +function showAuthError(message) { + let element = $("#auth-error"); + if (!element) { + element = document.createElement("p"); + element.id = "auth-error"; + element.className = "notice"; + document.querySelector("main")?.prepend(element); + } + element.textContent = message; +} + +async function guard(role) { + let me; + try { + me = await user(); + } catch (error) { + if (error.status === 401) { + location.replace("/login/"); + return null; + } + showAuthError("Не удалось проверить сессию. Повторите попытку через несколько секунд."); + return null; + } + if (role && me?.role !== role) { + location.replace(me?.role === "seller" ? "/seller/" : "/account/"); + return null; + } + document.querySelectorAll("[data-user]").forEach(element => { + element.textContent = `${me.username} · ${me.balance} cr`; + }); + return me; +} + +async function logout() { + await api("/api/logout", {method: "POST", body: "{}"}); + location.href = "/"; +} + +document.querySelectorAll("[data-logout]").forEach(element => element.onclick = event => { + event.preventDefault(); + logout().catch(error => showAuthError(error.message)); +}); + + +async function renderNav() { + if (document.body.dataset.nav === "static") return; + const nav = document.querySelector("header nav"); + if (!nav) return; + let me = null; + try { + me = await optionalUser(); + } catch { + me = null; + } + const role = me?.role || null; + const links = []; + const add = (href, label, extra = "") => links.push(`${label}`); + add("/marketplace/", "Маркетплейс"); + if (role === "buyer") { + add("/cart/", "Корзина"); + add("/orders/", "Заказы"); + add("/account/", "Кабинет"); + } else if (role === "seller") { + add("/seller/", "Панель станции"); + add("/contract/", "Договор"); + } else { + add("/account/", "Кабинет"); + add("/login/", "Войти"); + add("/registr/", "Регистрация", "class=\"button\" "); + } + if (role) add("/login/", "Выйти", "data-logout "); + nav.innerHTML = links.join(""); + nav.querySelectorAll("[data-logout]").forEach(element => element.onclick = event => { + event.preventDefault(); + logout().catch(error => showAuthError(error.message)); + }); +} +renderNav(); + +function ensureUiLayer() { + if ($("#ui-layer")) return; + document.body.insertAdjacentHTML("beforeend", ` +
+
+ +
`); +} + +function notify(message, type = "info") { + ensureUiLayer(); + const toast = document.createElement("div"); + toast.className = `custom-toast ${type}`; + toast.innerHTML = `${type === "error" ? "!" : "✓"}
${type === "error" ? "Ошибка" : "Готово"}

${esc(message)}

`; + $("#toast-stack").append(toast); + requestAnimationFrame(() => toast.classList.add("visible")); + setTimeout(() => { + toast.classList.remove("visible"); + setTimeout(() => toast.remove(), 250); + }, 3500); +} + +function confirmAction(message, title = "Подтвердите действие") { + ensureUiLayer(); + return new Promise(resolve => { + const backdrop = $("#confirm-backdrop"); + $("#confirm-title").textContent = title; + $("#confirm-message").textContent = message; + backdrop.hidden = false; + const finish = result => { + backdrop.hidden = true; + resolve(result); + }; + $("#confirm-ok").onclick = () => finish(true); + $("#confirm-cancel").onclick = () => finish(false); + backdrop.onclick = event => { + if (event.target === backdrop) finish(false); + }; + }); +} + +ensureUiLayer(); diff --git a/starpost/web/pages/contract.html b/starpost/web/pages/contract.html new file mode 100644 index 0000000..13cef85 --- /dev/null +++ b/starpost/web/pages/contract.html @@ -0,0 +1,49 @@ + + + + + + Договор | Starpost + + + +
+ STARPOST + +
+ +
+

ЮРИДИЧЕСКИЙ ОТСЕК

+

Договор станции

+

+ Подписанный договор хранится в защищенном архиве Starpost. +

+ + + Открыть PDF-договор + + +

+
+ + + + + \ No newline at end of file diff --git a/starpost/web/pages/index.html b/starpost/web/pages/index.html new file mode 100644 index 0000000..eb77187 --- /dev/null +++ b/starpost/web/pages/index.html @@ -0,0 +1,74 @@ + + + + + + Starpost — Орбитальный маркетплейс + + + + +
+ STARPOST ORBITAL MARKET — SP-2049 + +
+ +
+
+
+

МАРШРУТ SP-2049 · СВЯЗЬ СТАБИЛЬНА

+

Грузы для жизни
за пределами Земли.

+

Покупайте редкие товары у независимых станций. Автономный бот ATLAS-7 доставит заказ по орбитальному маршруту — от склада до вашего шлюза.

+ +
+ +
+ +
+
8090Порт орбитального узла
+
ATLAS-7Автономный доставщик
+
×3Класса грузов
+
+ +
+

КАК ЭТО РАБОТАЕТ

+

Три шага до доставки

+
+
1

Выберите груз

Каталог независимых станций — от термоконтейнеров до гидропонных модулей.

+
2

Оформите заказ

Корзина с количествами, атомарный чекаут, мгновенное списание баланса.

+
3

ATLAS-7 доставит

Складской бот проведёт груз через все орбитальные стадии до статуса delivered.

+
+
+ +
+
МАРШРУТ SP-2049 · квадрант Северная Орбита
+
СВЯЗЬ Канал Starpost защищён · АРМРФ
+
ДОСТАВКА Бесплатно · за банку паштета
+
+
+ + diff --git a/starpost/web/pages/login.html b/starpost/web/pages/login.html new file mode 100644 index 0000000..6d208e6 --- /dev/null +++ b/starpost/web/pages/login.html @@ -0,0 +1,54 @@ + + + + + + Вход — Starpost + + + + +
STARPOST
+
+
+

ШЛЮЗ АВТОРИЗАЦИИ — SP-2049

+
+

Войти в систему

+

Введите позывной и пароль для доступа к орбитальному маркетплейсу.

+
+
+
+ +

+
+
+

Нет аккаунта? Создать учётную запись

+
+
+ + + + diff --git a/starpost/web/pages/marketplace.css b/starpost/web/pages/marketplace.css new file mode 100644 index 0000000..9108906 --- /dev/null +++ b/starpost/web/pages/marketplace.css @@ -0,0 +1,94 @@ +.product-card { + display: flex; + flex-direction: column; + min-height: 440px; + padding: 0; + overflow: hidden; +} + +.product-main { flex: 1; padding: 22px; } +.product-main small { + color: var(--acid); + font: 700 .7rem 'JetBrains Mono', monospace; + letter-spacing: .1em; + text-transform: uppercase; +} +.product-main h3 { margin: 6px 0 8px; } +.product-main h3 a { color: var(--ink); text-decoration: none; } +.product-main h3 a:hover { color: var(--acid); } +.product-main .muted { font-size: .88rem; } + +.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; } +.actions button { flex: 1 1 auto; } + +.card-reviews { + padding: 18px 22px; + border-top: 1px solid var(--line); + background: #0a1210; +} +.reviews-title, +.public-review > div { + display: flex; + justify-content: space-between; + gap: 10px; +} +.reviews-title span { color: var(--acid); font: 700 .8rem monospace; } + +.public-review { padding: 12px 0; border-bottom: 1px solid #23342f; } +.public-review:last-of-type { border-bottom: 0; } +.public-review b, +.public-review p { font-size: .84rem; } +.public-review p { margin: 7px 0 0; color: var(--dim); line-height: 1.4; } + +.stars { color: var(--acid); letter-spacing: .05em; } + +/* Product detail page */ +.product-detail { + display: grid; + grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); + gap: 32px; + padding: 44px 0; +} + +.purchase-panel { + align-self: start; + display: grid; + gap: 12px; + padding: 24px; + border: 1px solid var(--line); + border-radius: var(--r-lg); + background: var(--panel); +} + +.product-meta { + display: grid; + grid-template-columns: repeat(3, 1fr); + gap: 12px; + margin: 34px 0 0; +} +.product-meta div { + padding: 15px; + border: 1px solid var(--line); + border-radius: var(--r-md); + background: var(--panel2); +} +.product-meta dt { color: var(--dim); font-size: .72rem; } +.product-meta dd { margin: 8px 0 0; } + +.detail-reviews { border-top: 1px solid var(--line); padding-top: 34px; } + +.detail-review { + max-width: 760px; + margin: 12px 0; + padding: 20px; + border: 1px solid var(--line); + border-radius: var(--r-md); + background: var(--panel); +} +.detail-review > div { display: flex; justify-content: space-between; gap: 12px; } +.detail-review p { color: var(--dim); line-height: 1.55; } + +@media (max-width: 760px) { + .product-detail, .product-meta { grid-template-columns: 1fr; } + .purchase-panel { position: static; } +} \ No newline at end of file diff --git a/starpost/web/pages/marketplace.html b/starpost/web/pages/marketplace.html new file mode 100644 index 0000000..f1496ba --- /dev/null +++ b/starpost/web/pages/marketplace.html @@ -0,0 +1,99 @@ + + + + + + Маркетплейс — Starpost + + + + + +
+ STARPOST + +
+
+
+
+

ТОРГОВЫЙ КОРИДОР — SP-2049

+

Маркетплейс

+

Гость

+
+ +
+
+
+ + + + diff --git a/starpost/web/pages/orders.html b/starpost/web/pages/orders.html new file mode 100644 index 0000000..307f6ff --- /dev/null +++ b/starpost/web/pages/orders.html @@ -0,0 +1,84 @@ + + + + + + Заказы | Starpost + + + + +
STARPOST
+

ТРЕКИНГ ОРБИТАЛЬНЫХ ГРУЗОВ

Мои заказы

+ + + + + + + diff --git a/starpost/web/pages/product.html b/starpost/web/pages/product.html new file mode 100644 index 0000000..b4c723e --- /dev/null +++ b/starpost/web/pages/product.html @@ -0,0 +1,66 @@ + + + + + + Товар — Starpost + + + + + +
+ STARPOST + +
+
+ ← Вернуться в каталог +

Загрузка карточки…

+
+

ОТКРЫТЫЙ КАНАЛ ПОКУПАТЕЛЕЙ

+

Отзывы о товаре

+
+
+
+ + + + diff --git a/starpost/web/pages/registr.html b/starpost/web/pages/registr.html new file mode 100644 index 0000000..a6778db --- /dev/null +++ b/starpost/web/pages/registr.html @@ -0,0 +1,75 @@ + + + + + + Регистрация — Starpost + + + + +
STARPOST
+
+
+

НОВАЯ УЧЁТНАЯ ЗАПИСЬ — SP-2049

+
+

Присоединиться к маршруту

+

Создайте аккаунт покупателя или зарегистрируйте станцию-продавца.

+
+
+
+
+
+ + +
+
+ + +

+
+
+

Уже есть аккаунт? Войти

+
+
+ + + + diff --git a/starpost/web/pages/review.css b/starpost/web/pages/review.css new file mode 100644 index 0000000..84e3e6f --- /dev/null +++ b/starpost/web/pages/review.css @@ -0,0 +1,79 @@ +.modal-backdrop { + position: fixed; + inset: 0; + z-index: 10; + display: grid; + place-items: center; + padding: 20px; + background: #020605cc; + backdrop-filter: blur(6px); +} +.modal-backdrop[hidden] { display: none; } + +.review-modal { + position: relative; + width: min(100%, 520px); + padding: 32px; + border: 1px solid #4a6658; + background: linear-gradient(145deg, #14251e, #0b1210); + box-shadow: 0 24px 80px #000b; +} +.review-modal h2 { margin: 8px 0; } + +.modal-close { + position: absolute; + right: 16px; + top: 12px; + padding: 2px 8px; + background: transparent; + color: var(--dim); + font-size: 1.7rem; +} + +.rating-picker { display: flex; gap: 4px; margin: 24px 0 4px; } +.rating-picker button { + padding: 4px; + background: transparent; + color: #52675d; + font-size: 2.3rem; + line-height: 1; +} +.rating-picker button.selected { color: var(--acid); } + +.rating-label { + height: 20px; + margin: 0; + color: var(--acid); + font-size: .85rem; +} + +.review-modal textarea { + width: 100%; + margin: 18px 0; + min-height: 120px; +} + +.private-toggle { + display: grid; + grid-template-columns: auto 1fr; + column-gap: 10px; + align-items: center; + padding: 14px; + border: 1px solid var(--line); + cursor: pointer; +} +.private-toggle input { accent-color: var(--acid); } +.private-toggle small { grid-column: 2; color: var(--dim); } + +.modal-actions { + display: flex; + justify-content: flex-end; + gap: 10px; + margin-top: 22px; +} + +.secondary-button { + background: transparent; + color: var(--ink); + border: 1px solid var(--line); +} \ No newline at end of file diff --git a/starpost/web/pages/seller-products.css b/starpost/web/pages/seller-products.css new file mode 100644 index 0000000..a32ac67 --- /dev/null +++ b/starpost/web/pages/seller-products.css @@ -0,0 +1,30 @@ +.seller-products { display: grid; gap: 12px; } + +.seller-product { + display: flex; + justify-content: space-between; + gap: 20px; + align-items: center; + padding: 20px; + border: 1px solid var(--line); + background: var(--panel); +} +.seller-product h3 { margin: 8px 0; } +.seller-product p { color: var(--dim); margin: 6px 0; } +.seller-product small { color: var(--dim); } +.seller-product.archived { opacity: .65; } + +.product-state { + color: var(--acid); + font: 700 .7rem monospace; + letter-spacing: .12em; +} +.archived .product-state { color: #ffbd43; } + +.seller-product-actions { display: flex; gap: 8px; flex-wrap: wrap; } +.danger { background: #ffbd43; } + +@media (max-width: 700px) { + .seller-product { align-items: flex-start; flex-direction: column; } + .seller-product-actions { width: 100%; } +} \ No newline at end of file diff --git a/starpost/web/pages/seller.html b/starpost/web/pages/seller.html new file mode 100644 index 0000000..561741d --- /dev/null +++ b/starpost/web/pages/seller.html @@ -0,0 +1,128 @@ + + + + + + Панель станции | Starpost + + + + +
+ STARPOST + +
+
+

ЦЕНТР УПРАВЛЕНИЯ СТАНЦИИ

+

Панель продавца

+

+
+

Новый груз

+ + + + + +
+

Мои товары

+
+

Продажи

+

Отзывы

+
+ + + + + diff --git a/starpost/web/pages/style.css b/starpost/web/pages/style.css new file mode 100644 index 0000000..23ea80e --- /dev/null +++ b/starpost/web/pages/style.css @@ -0,0 +1,290 @@ +@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;900&family=JetBrains+Mono:wght@500&display=swap'); + +:root { + --void: #060b0a; + --panel: #0e1a17; + --panel2: #131f1c; + --line: #233830; + --line2: #2e4840; + --ink: #dff0e5; + --dim: #7a9e91; + --acid: #b7ff43; + --acid2: #9fe030; + --warn: #ffbd43; + --danger: #ff7474; + --r-sm: 4px; + --r-md: 8px; + --r-lg: 14px; + --shadow-sm: 0 2px 10px #00000044; + --shadow-md: 0 8px 32px #00000066; + --shadow-lg: 0 20px 60px #00000088; + --t: .18s ease; +} + +*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; } +html { scroll-behavior: smooth; } + +body { + background: + radial-gradient(ellipse 70% 55% at 85% 0%, #1a3d2e55 0%, transparent 60%), + radial-gradient(ellipse 50% 40% at 10% 90%, #0d2e2255 0%, transparent 50%), + var(--void); + color: var(--ink); + font-family: 'Inter', system-ui, Arial, sans-serif; + font-size: 15px; + line-height: 1.6; + min-height: 100vh; + -webkit-font-smoothing: antialiased; +} + +h1 { + font-size: clamp(2.6rem, 7vw, 5.2rem); + font-weight: 900; + line-height: .92; + letter-spacing: -.05em; + margin: .2em 0 .5em; +} +h2 { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; margin-bottom: .5em; } +h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: .3em; } + +p { margin-bottom: .6em; } +p:last-child { margin-bottom: 0; } + +.eyebrow { + color: var(--acid); + font: 700 .7rem 'JetBrains Mono', monospace; + letter-spacing: .2em; + text-transform: uppercase; + display: block; + margin-bottom: .5em; +} + +.lead { color: var(--dim); font-size: 1.05rem; line-height: 1.65; } +.muted { color: var(--dim); line-height: 1.6; } + +.price { + font-size: 1.7rem; + font-weight: 900; + color: var(--acid); + letter-spacing: -.03em; +} + +.status { color: var(--acid); font-weight: 700; } + +code { + font-family: 'JetBrains Mono', monospace; + font-size: .85em; + background: #0a1712; + border: 1px solid var(--line2); + border-radius: var(--r-sm); + padding: 2px 8px; + color: var(--acid); + word-break: break-all; +} + +header { + position: sticky; + top: 0; + z-index: 20; + min-height: 66px; + padding: 0 5vw; + display: flex; + align-items: center; + gap: 20px; + border-bottom: 1px solid var(--line); + background: #07100eee; + backdrop-filter: blur(14px); + -webkit-backdrop-filter: blur(14px); +} + +.brand { + color: var(--acid); + text-decoration: none; + font-weight: 900; + font-size: 1.05rem; + letter-spacing: .16em; + margin-right: auto; + transition: opacity var(--t); +} +.brand:hover { opacity: .8; } +.brand span { color: var(--dim); font-size: .6rem; display: block; letter-spacing: .12em; } + +nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; } +nav a { + color: var(--dim); + text-decoration: none; + font-size: .82rem; + font-weight: 600; + padding: 6px 10px; + border-radius: var(--r-sm); + transition: color var(--t), background var(--t); +} +nav a:hover { color: var(--ink); background: #ffffff0d; } + +main { max-width: 1100px; margin: auto; padding: 56px 28px 80px; } + +.hero { + min-height: 420px; + display: grid; + grid-template-columns: 3fr 2fr; + align-items: center; + gap: 40px; + padding: 20px 0; +} + +.planet { + width: min(30vw, 300px); + aspect-ratio: 1; + border-radius: 50%; + justify-self: center; + background: radial-gradient(circle at 28% 22%, #d4ff8a 0%, #68b230 14%, #1a4530 50%, #040a06 72%); + box-shadow: + -22px 10px 70px #9cff3540, + 0 0 120px #2d6b2020, + inset -10px -10px 40px #00000060; + animation: orbit-float 8s ease-in-out infinite; +} +@keyframes orbit-float { + 0%, 100% { transform: translateY(0); } + 50% { transform: translateY(-14px); } +} + +.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; } +.two { grid-template-columns: 1fr 1fr; } + +.card { + border: 1px solid var(--line); + background: var(--panel); + border-radius: var(--r-lg); + padding: 22px; + transition: border-color var(--t), box-shadow var(--t); +} +.card:hover { border-color: var(--line2); box-shadow: var(--shadow-md); } + +.row { + border: 1px solid var(--line); + background: var(--panel); + border-radius: var(--r-md); + padding: 18px 22px; + margin: 10px 0; + display: flex; + justify-content: space-between; + gap: 14px; + align-items: center; + transition: border-color var(--t); +} +.row:hover { border-color: var(--line2); } +.private { border-left: 3px solid var(--warn); } + +.notice { + padding: 14px 18px; + border: 1px solid var(--line2); + border-radius: var(--r-md); + background: #0d1e18; + color: var(--dim); + font-size: .88rem; +} + +form { display: grid; gap: 12px; max-width: 560px; } + +input, textarea, select { + font: inherit; + padding: 12px 14px; + background: #070f0d; + color: var(--ink); + border: 1px solid var(--line2); + border-radius: var(--r-md); + outline: none; + transition: border-color var(--t), box-shadow var(--t); + width: 100%; +} +input:focus, textarea:focus, select:focus { + border-color: var(--acid); + box-shadow: 0 0 0 3px #b7ff4322; +} +input::placeholder, textarea::placeholder { color: var(--dim); opacity: .7; } + +textarea { min-height: 90px; resize: vertical; } +select option { background: var(--panel); } + +button, .button { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 8px; + padding: 11px 20px; + border: none; + border-radius: var(--r-md); + background: var(--acid); + color: #0d1a10; + font: 700 .88rem 'Inter', sans-serif; + cursor: pointer; + text-decoration: none; + transition: background var(--t), transform var(--t), box-shadow var(--t); + white-space: nowrap; +} +button:hover, .button:hover { + background: var(--acid2); + box-shadow: 0 4px 20px #b7ff4340; + transform: translateY(-1px); +} +button:active, .button:active { transform: translateY(0); } + +button.secondary, .button.secondary { + background: transparent; + color: var(--ink); + border: 1px solid var(--line2); +} +button.secondary:hover, .button.secondary:hover { background: #ffffff0d; box-shadow: none; } + +button.danger { background: var(--warn); color: #1a0d00; } +button.danger:hover { background: #ffa820; } + +button:disabled { + cursor: not-allowed; + background: var(--line); + color: var(--dim); + transform: none; + box-shadow: none; +} + +.skeleton { + background: linear-gradient(90deg, var(--panel) 25%, var(--panel2) 50%, var(--panel) 75%); + background-size: 200% 100%; + animation: shimmer 1.5s infinite; + border-radius: var(--r-sm); + display: block; +} +@keyframes shimmer { to { background-position: -200% 0; } } + +.empty { + padding: 60px 24px; + border: 1px dashed var(--line2); + border-radius: var(--r-lg); + text-align: center; + color: var(--dim); +} +.empty h2 { font-size: 1.4rem; margin-bottom: .4em; } + +.badge { + display: inline-flex; + align-items: center; + padding: 3px 9px; + border-radius: 99px; + font: 700 .68rem 'JetBrains Mono', monospace; + letter-spacing: .1em; + text-transform: uppercase; +} +.badge-green { background: #1e3d1e; color: var(--acid); border: 1px solid #2e5c2e; } +.badge-yellow { background: #3d2e10; color: var(--warn); border: 1px solid #5c4420; } +.badge-red { background: #3d1010; color: var(--danger); border: 1px solid #5c2020; } +.badge-dim { background: var(--panel2); color: var(--dim); border: 1px solid var(--line); } + +@media (max-width: 760px) { + header { padding: 12px 18px; } + .hero, .grid, .two { grid-template-columns: 1fr; } + .planet { width: 200px; } + main { padding: 36px 18px 60px; } + .row { align-items: flex-start; flex-direction: column; } + h1 { letter-spacing: -.04em; } +} diff --git a/starpost/web/pages/ui.css b/starpost/web/pages/ui.css new file mode 100644 index 0000000..710b441 --- /dev/null +++ b/starpost/web/pages/ui.css @@ -0,0 +1,75 @@ +.toast-stack { + position: fixed; + right: 22px; + top: 88px; + z-index: 30; + display: grid; + gap: 10px; + width: min(380px, calc(100vw - 40px)); +} + +.custom-toast { + display: grid; + grid-template-columns: 38px 1fr; + gap: 12px; + align-items: center; + padding: 16px; + border: 1px solid #4a6658; + background: #122019; + box-shadow: 0 16px 45px #0009; + opacity: 0; + transform: translateX(25px); + transition: .25s; +} +.custom-toast.visible { opacity: 1; transform: none; } +.custom-toast > span { + display: grid; + place-items: center; + width: 34px; + height: 34px; + border-radius: 50%; + background: var(--acid); + color: #101510; + font-weight: 900; +} +.custom-toast.error { border-color: #8d4c4c; } +.custom-toast.error > span { background: #ff7474; } +.custom-toast p { margin: 4px 0 0; color: var(--dim); line-height: 1.35; } + +.dialog-backdrop { + position: fixed; + inset: 0; + z-index: 25; + display: grid; + place-items: center; + padding: 20px; + background: #020605cc; + backdrop-filter: blur(6px); +} +.dialog-backdrop[hidden] { display: none; } + +.custom-dialog { + width: min(100%, 470px); + padding: 30px; + border: 1px solid #4a6658; + background: linear-gradient(145deg, #14251e, #0b1210); + box-shadow: 0 24px 80px #000b; +} +.custom-dialog h2 { margin: 8px 0; } + +.dialog-actions { + display: flex; + justify-content: flex-end; + gap: 10px; + margin-top: 24px; +} + +.ghost-button { + background: transparent; + color: var(--ink); + border: 1px solid var(--line); +} + +@media (max-width: 600px) { + .toast-stack { right: 14px; top: 76px; width: calc(100vw - 28px); } +} \ No newline at end of file