commit 1d4407462ade478ced49ca0a303d5009a163f091 Author: Joren de Graaf Date: Sun Oct 4 17:09:22 2026 +0200 first commit diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..70624bc --- /dev/null +++ b/.env.example @@ -0,0 +1,10 @@ +# Copy to .env. Replace the placeholder with a long random secret. +DJANGO_SECRET_KEY=replace-with-a-long-random-secret +DJANGO_DEBUG=0 +DJANGO_ALLOWED_HOSTS=django.jorendegraaf.eu,100.91.62.59,localhost,127.0.0.1 +DJANGO_CSRF_TRUSTED_ORIGINS=https://django.jorendegraaf.eu +CLASSIFIER_URL= +CLASSIFIER_TIMEOUT=30 +MAX_AUDIO_UPLOAD_SIZE=26214400 +BOOMCAST_H3_RESOLUTION=9 +VITE_USE_DEV_SERVER=0 diff --git a/.env.vite.example b/.env.vite.example new file mode 100644 index 0000000..5370068 --- /dev/null +++ b/.env.vite.example @@ -0,0 +1,21 @@ +# Frontend development server +VITE_HOST=127.0.0.1 +VITE_PORT=5173 +VITE_DEV_SERVER_URL=http://127.0.0.1:5173/ +# Development-only Vite base; keep this aligned with VITE_DEV_SERVER_URL. +VITE_DEV_BASE_URL=/ +VITE_USE_DEV_SERVER=true + +# Django development process (override the whole command for uv, docker, etc.) +DJANGO_HOST=127.0.0.1 +DJANGO_PORT=8000 +# DJANGO_DEV_COMMAND=python manage.py runserver 127.0.0.1:8000 + +# Vite discovers every .js file beneath VITE_ENTRY_DIR by default. +VITE_ENTRY_DIR=frontend/src/entries + +# Production build output and Django static namespace +VITE_OUT_DIR=vite_integration/static/vite +VITE_STATIC_PREFIX=vite +# Must match Django STATIC_URL plus VITE_STATIC_PREFIX (for example, /static/vite/). +VITE_BASE_URL=/static/vite/ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..75cdecf --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +.venv/ +node_modules/ +db.sqlite3 +staticfiles/ +media/ +vite_integration/static/vite/ +__pycache__/ +*.pyc +.env +*.orig diff --git a/README.md b/README.md new file mode 100644 index 0000000..81ccf79 --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ +# BoomCast + +Fresh Django rebuild with separate `core`, `events`, `analysis`, `devices`, and `notifications` apps. The old project is a read-only reference at `/home/jorenmartijn/python/django` and its database and media were not copied. + +## Local setup + +```sh +python3 -m venv .venv +.venv/bin/pip install -r requirements.txt +PATH=/home/jorenmartijn/.nvm/versions/node/v22.23.2/bin:$PATH npm ci +.venv/bin/python manage.py migrate +PATH=/home/jorenmartijn/.nvm/versions/node/v22.23.2/bin:$PATH npm run dev +``` + +Node 22 is installed under the shown path on this machine. Django loads `.env` from this project directory automatically; existing process environment variables take priority. Start from `.env.example`, generate a fresh `DJANGO_SECRET_KEY`, and keep `.env` out of version control. The included domain defaults allow `django.jorendegraaf.eu` behind an HTTPS-terminating Caddy reverse proxy. Set `CLASSIFIER_URL` to the external classifier endpoint for server audio analysis. `npm run dev` deliberately enables Django debug and Vite HMR for local development; use the deployment process rather than that command for the public site. + +For production assets: + +```sh +PATH=/home/jorenmartijn/.nvm/versions/node/v22.23.2/bin:$PATH npm run build +.venv/bin/python manage.py collectstatic --noinput +``` + +## Current implementation + +- Shared navigation and responsive shell, overview, report, activity, map, analyser, settings, sensors, and login. +- Single pending/approved/rejected event model. Admin actions use the shared review service. +- Manual coordinates are converted to H3 and never stored. The public map API returns coarse cells only. +- Browser and sensor uploads use one server classifier client. Upload analysis saves media only when submitted for review. +- Sensor tokens are hashed and only revealed on creation or rotation. Archived tokens stop working. +- ntfy preferences and event notifications use transaction commit callbacks. +- Original Vite integration, ffmpeg, TensorFlow/YAMNet modules, browser audio tests, and model assets are present. + +## Remaining work against the full spec + +The browser audio modules are connected to the analyser and the burst listener to reporting, but the rebuilt controls have not received a complete cross-browser interaction pass. Dutch translation covers the shared navigation and introductory copy; many new form and detail strings remain English. Sensor and notification settings use targeted HTMX form updates, and Activity detail uses a desktop HTMX rail. Sensor creation and rotation still need a complete keyboard and screen-reader interaction pass. The map shows coarse H3 areas and approximate direction lines, but richer legends and filter controls remain. Add those before treating this as a polished replacement for the old application. + +## Verification + +```sh +.venv/bin/python manage.py test +PATH=/home/jorenmartijn/.nvm/versions/node/v22.23.2/bin:$PATH npm test +PATH=/home/jorenmartijn/.nvm/versions/node/v22.23.2/bin:$PATH npm run build +.venv/bin/python manage.py collectstatic --noinput +``` diff --git a/analysis/__init__.py b/analysis/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/analysis/admin.py b/analysis/admin.py new file mode 100644 index 0000000..616cb0b --- /dev/null +++ b/analysis/admin.py @@ -0,0 +1,4 @@ +from django.contrib import admin +from .models import ClassificationRule,BrowserProcessingSettings +admin.site.register(ClassificationRule) +admin.site.register(BrowserProcessingSettings) diff --git a/analysis/migrations/0001_initial.py b/analysis/migrations/0001_initial.py new file mode 100644 index 0000000..2b7eb83 --- /dev/null +++ b/analysis/migrations/0001_initial.py @@ -0,0 +1,33 @@ +# Generated by Django 6.1.1 on 2026-10-04 14:20 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='BrowserProcessingSettings', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('browser_processing_beta_enabled', models.BooleanField(default=False)), + ], + ), + migrations.CreateModel( + name='ClassificationRule', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('value', models.CharField(max_length=255)), + ('rule_type', models.CharField(choices=[('whitelist', 'Whitelist'), ('blacklist', 'Blacklist')], max_length=10)), + ('enabled', models.BooleanField(default=True)), + ], + options={ + 'constraints': [models.UniqueConstraint(fields=('value', 'rule_type'), name='unique_classification_rule')], + }, + ), + ] diff --git a/analysis/migrations/__init__.py b/analysis/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/analysis/models.py b/analysis/models.py new file mode 100644 index 0000000..fbcd465 --- /dev/null +++ b/analysis/models.py @@ -0,0 +1,14 @@ +from django.db import models +class ClassificationRule(models.Model): + class RuleType(models.TextChoices): + WHITELIST='whitelist','Whitelist';BLACKLIST='blacklist','Blacklist' + value=models.CharField(max_length=255) + rule_type=models.CharField(max_length=10,choices=RuleType.choices) + enabled=models.BooleanField(default=True) + class Meta: constraints=[models.UniqueConstraint(fields=['value','rule_type'],name='unique_classification_rule')] + def __str__(self): return f'{self.value} ({self.rule_type})' +class BrowserProcessingSettings(models.Model): + browser_processing_beta_enabled=models.BooleanField(default=False) + def save(self,*args,**kwargs): self.pk=1;return super().save(*args,**kwargs) + @classmethod + def enabled(cls): return bool(cls.objects.filter(pk=1).values_list('browser_processing_beta_enabled',flat=True).first()) diff --git a/analysis/services/__init__.py b/analysis/services/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/analysis/services/browser_policy.py b/analysis/services/browser_policy.py new file mode 100644 index 0000000..9eb6bc0 --- /dev/null +++ b/analysis/services/browser_policy.py @@ -0,0 +1,84 @@ +"""Public, advisory configuration for the optional browser processing beta.""" + +import json +from pathlib import Path + +from django.templatetags.static import static + +from django.urls import reverse + +from analysis.models import BrowserProcessingSettings, ClassificationRule + +POLICY_VERSION = 1 +SPEECH_LABEL_TERMS = ( + "speech", "conversation", "narration", "monologue", "babbling", "whisper", + "speaking", "speech synthesizer", +) +GATE_RESULTS = {"whitelist_match", "speech_only", "no_match", "unavailable", "error"} +RELEVANCE_THRESHOLD = 0.5 +SPEECH_THRESHOLD = 0.5 +MODEL_VERSION = "google-yamnet-1" + + +def browser_config(): + """Keep template configuration in one small, non-secret object.""" + return { + "browserProcessingBeta": BrowserProcessingSettings.enabled(), + "policyUrl": reverse("browser_policy"), + "policyVersion": POLICY_VERSION, + } + + +def browser_policy(): + enabled = BrowserProcessingSettings.enabled() + policy = { + "version": POLICY_VERSION, + "browser_processing_beta_enabled": enabled, + "whitelist": [], + "privacy_sensitive_speech": [], + "thresholds": {}, + "model_version": MODEL_VERSION, + "model_url": "", + "class_map_url": "", + } + if not enabled: + return policy + rules = ClassificationRule.objects.filter(enabled=True).order_by("value") + policy["whitelist"] = list(rules.filter(rule_type=ClassificationRule.RuleType.WHITELIST).values_list("value", flat=True)) + class_map_path = Path(__file__).resolve().parents[1] / "static/browser-yamnet/yamnet_class_map.json" + class_names = json.loads(class_map_path.read_text(encoding="utf-8")) + speech_classes = {name for name in class_names if any(term in name.lower() for term in SPEECH_LABEL_TERMS)} + speech_classes.update(value for value in rules.filter(rule_type=ClassificationRule.RuleType.BLACKLIST).values_list("value", flat=True) + if any(term in value.lower() for term in SPEECH_LABEL_TERMS)) + policy["privacy_sensitive_speech"] = sorted(speech_classes) + policy["thresholds"] = {"relevance": RELEVANCE_THRESHOLD, "speech": SPEECH_THRESHOLD} + policy["model_url"] = static("browser-yamnet/model.json") + policy["class_map_url"] = static("browser-yamnet/yamnet_class_map.json") + return policy + + +def advisory_browser_metadata(post_data): + """Parse bounded diagnostics; never use this to authorize or classify audio.""" + raw = post_data.get("browser_processing_metadata", "") + if not raw or len(raw) > 1024: + return {} + try: + submitted = json.loads(raw) + except (TypeError, ValueError): + return {} + if not isinstance(submitted, dict): + return {} + metadata = {} + for key in ("browser_processing_used", "browser_override"): + if type(submitted.get(key)) is bool: + metadata[key] = submitted[key] + version = submitted.get("browser_processing_version") + if type(version) is int and 0 < version <= POLICY_VERSION: + metadata["browser_processing_version"] = version + gate_result = submitted.get("browser_gate_result") + if isinstance(gate_result, str) and gate_result in GATE_RESULTS: + metadata["browser_gate_result"] = gate_result + speech = submitted.get("browser_speech_detected") + if type(speech) is bool: + metadata["browser_speech_detected"] = speech + return metadata diff --git a/analysis/services/classifier.py b/analysis/services/classifier.py new file mode 100644 index 0000000..3bc6f63 --- /dev/null +++ b/analysis/services/classifier.py @@ -0,0 +1,16 @@ +import requests +from pathlib import Path +from django.conf import settings +class ClassifierError(Exception): pass +def classify(upload): + if not settings.CLASSIFIER_URL: raise ClassifierError('Classifier is not configured.') + if upload.size>settings.MAX_AUDIO_UPLOAD_SIZE: raise ClassifierError('Audio is too large.') + if not (str(getattr(upload,'content_type','')).startswith('audio/') or Path(upload.name).suffix.lower() in {'.aac','.aif','.aiff','.flac','.m4a','.mp3','.ogg','.opus','.wav','.weba'}): raise ClassifierError('Unsupported audio format.') + try: + upload.seek(0) + response=requests.post(settings.CLASSIFIER_URL,files={'file':(upload.name,upload,upload.content_type or 'application/octet-stream')},timeout=settings.CLASSIFIER_TIMEOUT) + response.raise_for_status();data=response.json() + except (requests.RequestException,ValueError) as exc: raise ClassifierError('Classifier request failed.') from exc + if not isinstance(data,dict) or not isinstance(data.get('predictions'),list): raise ClassifierError('Invalid classifier response.') + upload.seek(0) + return data diff --git a/analysis/static/browser-yamnet/VERSION b/analysis/static/browser-yamnet/VERSION new file mode 100644 index 0000000..79c436f --- /dev/null +++ b/analysis/static/browser-yamnet/VERSION @@ -0,0 +1,3 @@ +google-yamnet-1 +source_revision=c651073789719ff39dcf51406733bbcaaafb43f2 +tensorflow=2.21.0 diff --git a/analysis/static/browser-yamnet/group1-shard1of4.bin b/analysis/static/browser-yamnet/group1-shard1of4.bin new file mode 100644 index 0000000..0366fb3 Binary files /dev/null and b/analysis/static/browser-yamnet/group1-shard1of4.bin differ diff --git a/analysis/static/browser-yamnet/group1-shard2of4.bin b/analysis/static/browser-yamnet/group1-shard2of4.bin new file mode 100644 index 0000000..9ac72a5 Binary files /dev/null and b/analysis/static/browser-yamnet/group1-shard2of4.bin differ diff --git a/analysis/static/browser-yamnet/group1-shard3of4.bin b/analysis/static/browser-yamnet/group1-shard3of4.bin new file mode 100644 index 0000000..f9eb843 Binary files /dev/null and b/analysis/static/browser-yamnet/group1-shard3of4.bin differ diff --git a/analysis/static/browser-yamnet/group1-shard4of4.bin b/analysis/static/browser-yamnet/group1-shard4of4.bin new file mode 100644 index 0000000..ccc34d5 Binary files /dev/null and b/analysis/static/browser-yamnet/group1-shard4of4.bin differ diff --git a/analysis/static/browser-yamnet/model.json b/analysis/static/browser-yamnet/model.json new file mode 100644 index 0000000..7064fe3 --- /dev/null +++ b/analysis/static/browser-yamnet/model.json @@ -0,0 +1 @@ +{"format": "graph-model", "generatedBy": "2.21.0", "convertedBy": "TensorFlow.js Converter v4.22.0", "signature": {"inputs": {"waveform": {"name": "waveform:0", "dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "-1"}]}}}, "outputs": {"predictions": {"name": "Identity_2:0", "dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "-1"}, {"size": "521"}]}}, "log_mel_spectrogram": {"name": "Identity_1:0", "dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "-1"}, {"size": "64"}]}}, "embeddings": {"name": "Identity:0", "dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "-1"}, {"size": "1024"}]}}}}, "modelTopology": {"node": [{"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/zeros_like", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{"size": "2"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/mul/y", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat/axis", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/ones_like", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{"size": "2"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/floordiv_3/y", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat_1/values_1/1", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat_1/axis", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/range_1/start", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/range_1/delta", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape_2/shape/1", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape_3", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{"size": "1"}, {"size": "2"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/strided_slice", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Const", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/add/x", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape/shape_1", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/frame_step", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/frame_length", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "unknown_7", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "512"}, {"size": "257"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad_1/Pad/paddings/0_1", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{"size": "2"}]}}}}}, {"name": "unknown_5", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "unknown_4", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/zeros_like", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/mul/y", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat/axis", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/ones_like", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/floordiv_3/y", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat_1/values_1/1", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat_1/axis", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/range_1/start", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/range_1/delta", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/floordiv_2", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape_2/shape/1", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape_3", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{"size": "1"}, {"size": "5"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/strided_slice", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Const", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/add/x", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape/shape_1", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/frame_step", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/frame_length", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad/Pad/paddings/0/0", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "unknown_2", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "unknown_1", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "ConstantFolding/StatefulPartitionedCall/yamnet_frames/tf.math.truediv/truediv_recip", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem/strided_slice/stack", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem/strided_slice/stack_1", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem/strided_slice/stack_2", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{"size": "1"}]}}}}}, {"name": "unknown", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/packed", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{"size": "3"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/split/split_dim", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat_2/axis", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "unknown_3", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "1"}, {"size": "400"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem_1/strided_slice/stack", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem_1/strided_slice/stack_1", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem_1/strided_slice/stack_2", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.floor_div/FloorDiv/y", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "unknown_6", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "512"}, {"size": "257"}]}}}}}, {"name": "unknown_8", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "257"}, {"size": "64"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.__operators__.add_1/y", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/packed", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{"size": "3"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/split/split_dim", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat_2/axis", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/reshape/strided_slice/stack", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/reshape/strided_slice/stack_1", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/reshape/strided_slice/stack_2", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/reshape/Reshape/shape/1", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/reshape/Reshape/shape/2", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/reshape/Reshape/shape/3", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/global_average_pooling2d/Mean/reduction_indices", "op": "Const", "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {"dim": [{"size": "2"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/dense/MatMul/ReadVariableOp", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "1024"}, {"size": "521"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/dense/BiasAdd/ReadVariableOp", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "521"}]}}}}}, {"name": "waveform", "op": "Placeholder", "attr": {"shape": {"shape": {"dim": [{"size": "-1"}]}}, "dtype": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer1/conv/Conv2D_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "3"}, {"size": "3"}, {"size": "1"}, {"size": "32"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer12/pointwise_conv/Conv2D_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "512"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer1/conv/Conv2D_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "32"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer2/depthwise_conv/depthwise_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "3"}, {"size": "3"}, {"size": "32"}, {"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer2/depthwise_conv/depthwise_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "32"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer2/pointwise_conv/Conv2D_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "1"}, {"size": "1"}, {"size": "32"}, {"size": "64"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer2/pointwise_conv/Conv2D_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "64"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer13/depthwise_conv/depthwise_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "3"}, {"size": "3"}, {"size": "512"}, {"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer3/depthwise_conv/depthwise_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "3"}, {"size": "3"}, {"size": "64"}, {"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer3/depthwise_conv/depthwise_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "64"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer3/pointwise_conv/Conv2D_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "1"}, {"size": "1"}, {"size": "64"}, {"size": "128"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer3/pointwise_conv/Conv2D_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "128"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer13/depthwise_conv/depthwise_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "512"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer4/depthwise_conv/depthwise_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "3"}, {"size": "3"}, {"size": "128"}, {"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer4/depthwise_conv/depthwise_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "128"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer4/pointwise_conv/Conv2D_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "1"}, {"size": "1"}, {"size": "128"}, {"size": "128"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer4/pointwise_conv/Conv2D_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "128"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer5/depthwise_conv/depthwise_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "3"}, {"size": "3"}, {"size": "128"}, {"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer5/depthwise_conv/depthwise_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "128"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer5/pointwise_conv/Conv2D_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "1"}, {"size": "1"}, {"size": "128"}, {"size": "256"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer13/pointwise_conv/Conv2D_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "1"}, {"size": "1"}, {"size": "512"}, {"size": "1024"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer5/pointwise_conv/Conv2D_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "256"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer6/depthwise_conv/depthwise_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "3"}, {"size": "3"}, {"size": "256"}, {"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer6/depthwise_conv/depthwise_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "256"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer6/pointwise_conv/Conv2D_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "1"}, {"size": "1"}, {"size": "256"}, {"size": "256"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer13/pointwise_conv/Conv2D_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "1024"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer6/pointwise_conv/Conv2D_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "256"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer7/depthwise_conv/depthwise_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "3"}, {"size": "3"}, {"size": "256"}, {"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer7/depthwise_conv/depthwise_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "256"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer7/pointwise_conv/Conv2D_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "1"}, {"size": "1"}, {"size": "256"}, {"size": "512"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer7/pointwise_conv/Conv2D_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "512"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer14/depthwise_conv/depthwise_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "3"}, {"size": "3"}, {"size": "1024"}, {"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer8/depthwise_conv/depthwise_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "3"}, {"size": "3"}, {"size": "512"}, {"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer8/depthwise_conv/depthwise_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "512"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer8/pointwise_conv/Conv2D_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "1"}, {"size": "1"}, {"size": "512"}, {"size": "512"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer8/pointwise_conv/Conv2D_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "512"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer14/depthwise_conv/depthwise_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "1024"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer9/depthwise_conv/depthwise_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "3"}, {"size": "3"}, {"size": "512"}, {"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer9/depthwise_conv/depthwise_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "512"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer9/pointwise_conv/Conv2D_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "1"}, {"size": "1"}, {"size": "512"}, {"size": "512"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer9/pointwise_conv/Conv2D_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "512"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer10/depthwise_conv/depthwise_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "3"}, {"size": "3"}, {"size": "512"}, {"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer10/depthwise_conv/depthwise_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "512"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer10/pointwise_conv/Conv2D_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "1"}, {"size": "1"}, {"size": "512"}, {"size": "512"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer14/pointwise_conv/Conv2D_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "1"}, {"size": "1"}, {"size": "1024"}, {"size": "1024"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer10/pointwise_conv/Conv2D_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "512"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer11/depthwise_conv/depthwise_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "3"}, {"size": "3"}, {"size": "512"}, {"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer11/depthwise_conv/depthwise_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "512"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer11/pointwise_conv/Conv2D_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "1"}, {"size": "1"}, {"size": "512"}, {"size": "512"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer14/pointwise_conv/Conv2D_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "1024"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer11/pointwise_conv/Conv2D_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "512"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer12/depthwise_conv/depthwise_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "3"}, {"size": "3"}, {"size": "512"}, {"size": "1"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer12/depthwise_conv/depthwise_bn_offset", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "512"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer12/pointwise_conv/Conv2D_weights", "op": "Const", "attr": {"dtype": {"type": "DT_FLOAT"}, "value": {"tensor": {"dtype": "DT_FLOAT", "tensorShape": {"dim": [{"size": "1"}, {"size": "1"}, {"size": "512"}, {"size": "512"}]}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.shape/Shape", "op": "Shape", "input": ["waveform"], "attr": {"out_type": {"type": "DT_INT32"}, "T": {"type": "DT_FLOAT"}}, "experimentalType": {"typeId": "TFT_PRODUCT", "args": [{"typeId": "TFT_SHAPE_TENSOR", "args": [{"typeId": "TFT_INT32"}]}]}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem/strided_slice", "op": "StridedSlice", "input": ["StatefulPartitionedCall/yamnet_frames/tf.compat.v1.shape/Shape", "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem/strided_slice/stack", "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem/strided_slice/stack_1", "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem/strided_slice/stack_2"], "attr": {"begin_mask": {"i": "0"}, "Index": {"type": "DT_INT32"}, "end_mask": {"i": "0"}, "shrink_axis_mask": {"i": "1"}, "new_axis_mask": {"i": "0"}, "ellipsis_mask": {"i": "0"}, "T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.math.subtract/Sub", "op": "Sub", "input": ["unknown", "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem/strided_slice"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.math.maximum_1/Maximum", "op": "Maximum", "input": ["StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem/strided_slice", "unknown"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.math.maximum/Maximum", "op": "Maximum", "input": ["unknown_2", "StatefulPartitionedCall/yamnet_frames/tf.math.subtract/Sub"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.math.subtract_1/Sub", "op": "Sub", "input": ["StatefulPartitionedCall/yamnet_frames/tf.math.maximum_1/Maximum", "unknown"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.cast/Cast", "op": "Cast", "input": ["StatefulPartitionedCall/yamnet_frames/tf.math.subtract_1/Sub"], "attr": {"SrcT": {"type": "DT_INT32"}, "Truncate": {"b": false}, "DstT": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.math.truediv/truediv", "op": "Mul", "input": ["StatefulPartitionedCall/yamnet_frames/tf.cast/Cast", "ConstantFolding/StatefulPartitionedCall/yamnet_frames/tf.math.truediv/truediv_recip"], "attr": {"T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.math.ceil/Ceil", "op": "Ceil", "input": ["StatefulPartitionedCall/yamnet_frames/tf.math.truediv/truediv"], "attr": {"T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.cast_1/Cast", "op": "Cast", "input": ["StatefulPartitionedCall/yamnet_frames/tf.math.ceil/Ceil"], "attr": {"SrcT": {"type": "DT_FLOAT"}, "Truncate": {"b": false}, "DstT": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.math.multiply/Mul", "op": "Mul", "input": ["unknown_1", "StatefulPartitionedCall/yamnet_frames/tf.cast_1/Cast"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.math.subtract_2/Sub", "op": "Sub", "input": ["StatefulPartitionedCall/yamnet_frames/tf.math.multiply/Mul", "StatefulPartitionedCall/yamnet_frames/tf.math.subtract_1/Sub"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.__operators__.add/AddV2", "op": "AddV2", "input": ["StatefulPartitionedCall/yamnet_frames/tf.math.maximum/Maximum", "StatefulPartitionedCall/yamnet_frames/tf.math.subtract_2/Sub"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad/Pad/paddings/0", "op": "Pack", "input": ["StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad/Pad/paddings/0/0", "StatefulPartitionedCall/yamnet_frames/tf.__operators__.add/AddV2"], "attr": {"N": {"i": "2"}, "axis": {"i": "0"}, "T": {"type": "DT_INT32"}}}, {"name": "ConstantFolding/StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad/Pad/paddings_const_axis", "op": "Const", "input": ["^StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad/Pad/paddings/0"], "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad/Pad/paddings", "op": "ExpandDims", "input": ["StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad/Pad/paddings/0", "ConstantFolding/StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad/Pad/paddings_const_axis"], "attr": {"Tdim": {"type": "DT_INT32"}, "T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad/Pad", "op": "Pad", "input": ["waveform", "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad/Pad/paddings"], "attr": {"Tpaddings": {"type": "DT_INT32"}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Shape", "op": "Shape", "input": ["StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad/Pad"], "attr": {"out_type": {"type": "DT_INT32"}, "T": {"type": "DT_FLOAT"}}, "experimentalType": {"typeId": "TFT_PRODUCT", "args": [{"typeId": "TFT_SHAPE_TENSOR", "args": [{"typeId": "TFT_INT32"}]}]}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/split", "op": "SplitV", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Shape", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/packed", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/split/split_dim"], "attr": {"Tlen": {"type": "DT_INT32"}, "num_split": {"i": "3"}, "T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape", "op": "Reshape", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/split:1", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape/shape_1"], "attr": {"Tshape": {"type": "DT_INT32"}, "T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/floordiv_3", "op": "FloorDiv", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/floordiv_3/y"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/sub_2", "op": "Sub", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/frame_length"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/mul", "op": "Mul", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/floordiv_3", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/mul/y"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat_1/values_1", "op": "Pack", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/floordiv_3", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat_1/values_1/1"], "attr": {"N": {"i": "2"}, "axis": {"i": "0"}, "T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/floordiv", "op": "FloorDiv", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/sub_2", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/frame_step"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "ConstantFolding/StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat/values_1_const_axis", "op": "Const", "input": ["^StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/mul"], "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat_1", "op": "ConcatV2", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/split", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat_1/values_1", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/split:2", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat_1/axis"], "attr": {"T": {"type": "DT_INT32"}, "Tidx": {"type": "DT_INT32"}, "N": {"i": "3"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/add", "op": "AddV2", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/add/x", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/floordiv"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat/values_1", "op": "ExpandDims", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/mul", "ConstantFolding/StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat/values_1_const_axis"], "attr": {"Tdim": {"type": "DT_INT32"}, "T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Maximum", "op": "Maximum", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Const", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/add"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat", "op": "ConcatV2", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/split", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat/values_1", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/split:2", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat/axis"], "attr": {"T": {"type": "DT_INT32"}, "Tidx": {"type": "DT_INT32"}, "N": {"i": "3"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/range_1", "op": "Range", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/range_1/start", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Maximum", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/range_1/delta"], "attr": {"Tidx": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape_2/shape", "op": "Pack", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Maximum", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape_2/shape/1"], "attr": {"N": {"i": "2"}, "axis": {"i": "0"}, "T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/packed_1", "op": "Pack", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Maximum", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/frame_length"], "attr": {"T": {"type": "DT_INT32"}, "axis": {"i": "0"}, "N": {"i": "2"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/StridedSlice", "op": "StridedSlice", "input": ["StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad/Pad", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/zeros_like", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/ones_like"], "attr": {"begin_mask": {"i": "0"}, "Index": {"type": "DT_INT32"}, "end_mask": {"i": "0"}, "shrink_axis_mask": {"i": "0"}, "new_axis_mask": {"i": "0"}, "ellipsis_mask": {"i": "0"}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/mul_1", "op": "Mul", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/range_1", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/floordiv_2"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat_2", "op": "ConcatV2", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/split", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/packed_1", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/split:2", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat_2/axis"], "attr": {"N": {"i": "3"}, "Tidx": {"type": "DT_INT32"}, "T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape_1", "op": "Reshape", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/StridedSlice", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat_1"], "attr": {"T": {"type": "DT_FLOAT"}, "Tshape": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape_2", "op": "Reshape", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/mul_1", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape_2/shape"], "attr": {"T": {"type": "DT_INT32"}, "Tshape": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/add_1", "op": "AddV2", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape_2", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape_3"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/GatherV2", "op": "GatherV2", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape_1", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/add_1", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/strided_slice"], "attr": {"Tparams": {"type": "DT_FLOAT"}, "Taxis": {"type": "DT_INT32"}, "batch_dims": {"i": "0"}, "Tindices": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape_4", "op": "Reshape", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/GatherV2", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat_2"], "attr": {"Tshape": {"type": "DT_INT32"}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.math.multiply_1/Mul", "op": "Mul", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape_4", "unknown_3"], "attr": {"T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.shape_1/Shape", "op": "Shape", "input": ["StatefulPartitionedCall/yamnet_frames/tf.math.multiply_1/Mul"], "attr": {"out_type": {"type": "DT_INT32"}, "T": {"type": "DT_FLOAT"}}, "experimentalType": {"typeId": "TFT_PRODUCT", "args": [{"typeId": "TFT_SHAPE_TENSOR", "args": [{"typeId": "TFT_INT32"}]}]}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem_1/strided_slice", "op": "StridedSlice", "input": ["StatefulPartitionedCall/yamnet_frames/tf.compat.v1.shape_1/Shape", "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem_1/strided_slice/stack", "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem_1/strided_slice/stack_1", "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem_1/strided_slice/stack_2"], "attr": {"end_mask": {"i": "0"}, "Index": {"type": "DT_INT32"}, "begin_mask": {"i": "0"}, "shrink_axis_mask": {"i": "1"}, "new_axis_mask": {"i": "0"}, "ellipsis_mask": {"i": "0"}, "T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.math.subtract_4/Sub", "op": "Sub", "input": ["unknown_5", "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem_1/strided_slice"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.math.subtract_3/Sub", "op": "Sub", "input": ["unknown_4", "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem_1/strided_slice"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.floor_div/FloorDiv", "op": "FloorDiv", "input": ["StatefulPartitionedCall/yamnet_frames/tf.math.subtract_3/Sub", "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.floor_div/FloorDiv/y"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.math.subtract_5/Sub", "op": "Sub", "input": ["StatefulPartitionedCall/yamnet_frames/tf.math.subtract_4/Sub", "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.floor_div/FloorDiv"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad_1/Pad/paddings/1", "op": "Pack", "input": ["StatefulPartitionedCall/yamnet_frames/tf.compat.v1.floor_div/FloorDiv", "StatefulPartitionedCall/yamnet_frames/tf.math.subtract_5/Sub"], "attr": {"N": {"i": "2"}, "axis": {"i": "0"}, "T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad_1/Pad/paddings", "op": "Pack", "input": ["StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad_1/Pad/paddings/0_1", "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad_1/Pad/paddings/1"], "attr": {"N": {"i": "2"}, "axis": {"i": "0"}, "T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad_1/Pad", "op": "Pad", "input": ["StatefulPartitionedCall/yamnet_frames/tf.math.multiply_1/Mul", "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad_1/Pad/paddings"], "attr": {"Tpaddings": {"type": "DT_INT32"}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.linalg.matmul/MatMul", "op": "MatMul", "input": ["StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad_1/Pad", "unknown_7"], "device": "/device:CPU:0", "attr": {"T": {"type": "DT_FLOAT"}, "transpose_b": {"b": false}, "grad_a": {"b": false}, "transpose_a": {"b": false}, "grad_b": {"b": false}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.linalg.matmul_1/MatMul", "op": "MatMul", "input": ["StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad_1/Pad", "unknown_6"], "device": "/device:CPU:0", "attr": {"T": {"type": "DT_FLOAT"}, "transpose_b": {"b": false}, "grad_b": {"b": false}, "transpose_a": {"b": false}, "grad_a": {"b": false}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.math.multiply_2/ArithmeticOptimizer/ReplaceMulWithSquare_Mul", "op": "Square", "input": ["StatefulPartitionedCall/yamnet_frames/tf.linalg.matmul/MatMul"], "attr": {"T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.math.multiply_3/ArithmeticOptimizer/ReplaceMulWithSquare_Mul", "op": "Square", "input": ["StatefulPartitionedCall/yamnet_frames/tf.linalg.matmul_1/MatMul"], "attr": {"T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.math.add/Add", "op": "AddV2", "input": ["StatefulPartitionedCall/yamnet_frames/tf.math.multiply_2/ArithmeticOptimizer/ReplaceMulWithSquare_Mul", "StatefulPartitionedCall/yamnet_frames/tf.math.multiply_3/ArithmeticOptimizer/ReplaceMulWithSquare_Mul"], "attr": {"T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.math.sqrt/Sqrt", "op": "Sqrt", "input": ["StatefulPartitionedCall/yamnet_frames/tf.math.add/Add"], "attr": {"T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.__operators__.add_1/AddV2", "op": "_FusedMatMul", "input": ["StatefulPartitionedCall/yamnet_frames/tf.math.sqrt/Sqrt", "unknown_8", "StatefulPartitionedCall/yamnet_frames/tf.__operators__.add_1/y"], "device": "/device:CPU:0", "attr": {"transpose_b": {"b": false}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA=="]}}, "num_args": {"i": "1"}, "transpose_a": {"b": false}, "epsilon": {"f": 0.0}, "leakyrelu_alpha": {"f": 0.2}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.math.log/Log", "op": "Log", "input": ["StatefulPartitionedCall/yamnet_frames/tf.__operators__.add_1/AddV2"], "attr": {"T": {"type": "DT_FLOAT"}}}, {"name": "Identity_1", "op": "Identity", "input": ["StatefulPartitionedCall/yamnet_frames/tf.math.log/Log"], "attr": {"T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Shape", "op": "Shape", "input": ["StatefulPartitionedCall/yamnet_frames/tf.math.log/Log"], "attr": {"out_type": {"type": "DT_INT32"}, "T": {"type": "DT_FLOAT"}}, "experimentalType": {"typeId": "TFT_PRODUCT", "args": [{"typeId": "TFT_SHAPE_TENSOR", "args": [{"typeId": "TFT_INT32"}]}]}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/split", "op": "SplitV", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Shape", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/packed", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/split/split_dim"], "attr": {"Tlen": {"type": "DT_INT32"}, "num_split": {"i": "3"}, "T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape", "op": "Reshape", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/split:1", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape/shape_1"], "attr": {"T": {"type": "DT_INT32"}, "Tshape": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/floordiv_3", "op": "FloorDiv", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/floordiv_3/y"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/sub_2", "op": "Sub", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/frame_length"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/mul", "op": "Mul", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/floordiv_3", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/mul/y"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat_1/values_1", "op": "Pack", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/floordiv_3", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat_1/values_1/1"], "attr": {"N": {"i": "2"}, "axis": {"i": "0"}, "T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/floordiv", "op": "FloorDiv", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/sub_2", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/frame_step"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "ConstantFolding/StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat/values_1_const_axis", "op": "Const", "input": ["^StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/mul"], "attr": {"dtype": {"type": "DT_INT32"}, "value": {"tensor": {"dtype": "DT_INT32", "tensorShape": {}}}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat_1", "op": "ConcatV2", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/split", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat_1/values_1", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/split:2", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat_1/axis"], "attr": {"N": {"i": "3"}, "Tidx": {"type": "DT_INT32"}, "T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/add", "op": "AddV2", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/add/x", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/floordiv"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat/values_1", "op": "ExpandDims", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/mul", "ConstantFolding/StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat/values_1_const_axis"], "attr": {"Tdim": {"type": "DT_INT32"}, "T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Maximum", "op": "Maximum", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Const", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/add"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat", "op": "ConcatV2", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/split", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat/values_1", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/split:2", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat/axis"], "attr": {"T": {"type": "DT_INT32"}, "Tidx": {"type": "DT_INT32"}, "N": {"i": "3"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/range_1", "op": "Range", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/range_1/start", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Maximum", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/range_1/delta"], "attr": {"Tidx": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape_2/shape", "op": "Pack", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Maximum", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape_2/shape/1"], "attr": {"N": {"i": "2"}, "axis": {"i": "0"}, "T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/packed_1", "op": "Pack", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Maximum", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/frame_length"], "attr": {"N": {"i": "2"}, "axis": {"i": "0"}, "T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/StridedSlice", "op": "StridedSlice", "input": ["StatefulPartitionedCall/yamnet_frames/tf.math.log/Log", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/zeros_like", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/ones_like"], "attr": {"begin_mask": {"i": "0"}, "Index": {"type": "DT_INT32"}, "end_mask": {"i": "0"}, "new_axis_mask": {"i": "0"}, "shrink_axis_mask": {"i": "0"}, "ellipsis_mask": {"i": "0"}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape_2", "op": "Reshape", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/range_1", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape_2/shape"], "attr": {"Tshape": {"type": "DT_INT32"}, "T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat_2", "op": "ConcatV2", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/split", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/packed_1", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/split:2", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat_2/axis"], "attr": {"T": {"type": "DT_INT32"}, "Tidx": {"type": "DT_INT32"}, "N": {"i": "3"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape_1", "op": "Reshape", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/StridedSlice", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat_1"], "attr": {"T": {"type": "DT_FLOAT"}, "Tshape": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/add_1", "op": "AddV2", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape_2", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape_3"], "attr": {"T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/GatherV2", "op": "GatherV2", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape_1", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/add_1", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/strided_slice"], "attr": {"Tparams": {"type": "DT_FLOAT"}, "Taxis": {"type": "DT_INT32"}, "batch_dims": {"i": "0"}, "Tindices": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape_4", "op": "Reshape", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/GatherV2", "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat_2"], "attr": {"T": {"type": "DT_FLOAT"}, "Tshape": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/reshape/Shape", "op": "Shape", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape_4"], "attr": {"out_type": {"type": "DT_INT32"}, "T": {"type": "DT_FLOAT"}}, "experimentalType": {"typeId": "TFT_PRODUCT", "args": [{"typeId": "TFT_SHAPE_TENSOR", "args": [{"typeId": "TFT_INT32"}]}]}}, {"name": "StatefulPartitionedCall/yamnet_frames/reshape/strided_slice", "op": "StridedSlice", "input": ["StatefulPartitionedCall/yamnet_frames/reshape/Shape", "StatefulPartitionedCall/yamnet_frames/reshape/strided_slice/stack", "StatefulPartitionedCall/yamnet_frames/reshape/strided_slice/stack_1", "StatefulPartitionedCall/yamnet_frames/reshape/strided_slice/stack_2"], "attr": {"end_mask": {"i": "0"}, "Index": {"type": "DT_INT32"}, "begin_mask": {"i": "0"}, "shrink_axis_mask": {"i": "1"}, "new_axis_mask": {"i": "0"}, "ellipsis_mask": {"i": "0"}, "T": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/reshape/Reshape/shape", "op": "Pack", "input": ["StatefulPartitionedCall/yamnet_frames/reshape/strided_slice", "StatefulPartitionedCall/yamnet_frames/reshape/Reshape/shape/1", "StatefulPartitionedCall/yamnet_frames/reshape/Reshape/shape/2", "StatefulPartitionedCall/yamnet_frames/reshape/Reshape/shape/3"], "attr": {"T": {"type": "DT_INT32"}, "axis": {"i": "0"}, "N": {"i": "4"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/reshape/Reshape", "op": "Reshape", "input": ["StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape_4", "StatefulPartitionedCall/yamnet_frames/reshape/Reshape/shape"], "attr": {"T": {"type": "DT_FLOAT"}, "Tshape": {"type": "DT_INT32"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer1/relu/Relu", "op": "_FusedConv2D", "input": ["StatefulPartitionedCall/yamnet_frames/reshape/Reshape", "StatefulPartitionedCall/yamnet_frames/layer1/conv/Conv2D_weights", "StatefulPartitionedCall/yamnet_frames/layer1/conv/Conv2D_bn_offset"], "device": "/device:CPU:0", "attr": {"TArgs": {"list": {"type": ["DT_FLOAT"]}}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "num_host_args": {"i": "0"}, "strides": {"list": {"i": ["1", "2", "2", "1"]}}, "data_format": {"s": "TkhXQw=="}, "filter_format": {"s": "SFdJTw=="}, "explicit_paddings": {"list": {}}, "use_cudnn_on_gpu": {"b": true}, "leakyrelu_alpha": {"f": 0.2}, "padding": {"s": "U0FNRQ=="}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "epsilon": {"f": 0.0}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer2/depthwise_conv/depthwise", "op": "FusedDepthwiseConv2dNative", "input": ["StatefulPartitionedCall/yamnet_frames/layer1/relu/Relu", "StatefulPartitionedCall/yamnet_frames/layer2/depthwise_conv/depthwise_weights", "StatefulPartitionedCall/yamnet_frames/layer2/depthwise_conv/depthwise_bn_offset"], "attr": {"data_format": {"s": "TkhXQw=="}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "padding": {"s": "U0FNRQ=="}, "explicit_paddings": {"list": {}}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer2/pointwise_conv/relu/Relu", "op": "_FusedConv2D", "input": ["StatefulPartitionedCall/yamnet_frames/layer2/depthwise_conv/depthwise", "StatefulPartitionedCall/yamnet_frames/layer2/pointwise_conv/Conv2D_weights", "StatefulPartitionedCall/yamnet_frames/layer2/pointwise_conv/Conv2D_bn_offset"], "device": "/device:CPU:0", "attr": {"TArgs": {"list": {"type": ["DT_FLOAT"]}}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "data_format": {"s": "TkhXQw=="}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "num_host_args": {"i": "0"}, "filter_format": {"s": "SFdJTw=="}, "explicit_paddings": {"list": {}}, "use_cudnn_on_gpu": {"b": true}, "leakyrelu_alpha": {"f": 0.2}, "padding": {"s": "U0FNRQ=="}, "num_args": {"i": "1"}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "epsilon": {"f": 0.0}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer3/depthwise_conv/depthwise", "op": "FusedDepthwiseConv2dNative", "input": ["StatefulPartitionedCall/yamnet_frames/layer2/pointwise_conv/relu/Relu", "StatefulPartitionedCall/yamnet_frames/layer3/depthwise_conv/depthwise_weights", "StatefulPartitionedCall/yamnet_frames/layer3/depthwise_conv/depthwise_bn_offset"], "attr": {"data_format": {"s": "TkhXQw=="}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "strides": {"list": {"i": ["1", "2", "2", "1"]}}, "padding": {"s": "U0FNRQ=="}, "explicit_paddings": {"list": {}}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer3/pointwise_conv/relu/Relu", "op": "_FusedConv2D", "input": ["StatefulPartitionedCall/yamnet_frames/layer3/depthwise_conv/depthwise", "StatefulPartitionedCall/yamnet_frames/layer3/pointwise_conv/Conv2D_weights", "StatefulPartitionedCall/yamnet_frames/layer3/pointwise_conv/Conv2D_bn_offset"], "device": "/device:CPU:0", "attr": {"num_host_args": {"i": "0"}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "TArgs": {"list": {"type": ["DT_FLOAT"]}}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "data_format": {"s": "TkhXQw=="}, "padding": {"s": "U0FNRQ=="}, "explicit_paddings": {"list": {}}, "use_cudnn_on_gpu": {"b": true}, "leakyrelu_alpha": {"f": 0.2}, "filter_format": {"s": "SFdJTw=="}, "num_args": {"i": "1"}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "epsilon": {"f": 0.0}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer4/depthwise_conv/depthwise", "op": "FusedDepthwiseConv2dNative", "input": ["StatefulPartitionedCall/yamnet_frames/layer3/pointwise_conv/relu/Relu", "StatefulPartitionedCall/yamnet_frames/layer4/depthwise_conv/depthwise_weights", "StatefulPartitionedCall/yamnet_frames/layer4/depthwise_conv/depthwise_bn_offset"], "attr": {"data_format": {"s": "TkhXQw=="}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "padding": {"s": "U0FNRQ=="}, "explicit_paddings": {"list": {}}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer4/pointwise_conv/relu/Relu", "op": "_FusedConv2D", "input": ["StatefulPartitionedCall/yamnet_frames/layer4/depthwise_conv/depthwise", "StatefulPartitionedCall/yamnet_frames/layer4/pointwise_conv/Conv2D_weights", "StatefulPartitionedCall/yamnet_frames/layer4/pointwise_conv/Conv2D_bn_offset"], "device": "/device:CPU:0", "attr": {"num_host_args": {"i": "0"}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "TArgs": {"list": {"type": ["DT_FLOAT"]}}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "data_format": {"s": "TkhXQw=="}, "padding": {"s": "U0FNRQ=="}, "explicit_paddings": {"list": {}}, "use_cudnn_on_gpu": {"b": true}, "leakyrelu_alpha": {"f": 0.2}, "filter_format": {"s": "SFdJTw=="}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "epsilon": {"f": 0.0}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer5/depthwise_conv/depthwise", "op": "FusedDepthwiseConv2dNative", "input": ["StatefulPartitionedCall/yamnet_frames/layer4/pointwise_conv/relu/Relu", "StatefulPartitionedCall/yamnet_frames/layer5/depthwise_conv/depthwise_weights", "StatefulPartitionedCall/yamnet_frames/layer5/depthwise_conv/depthwise_bn_offset"], "attr": {"data_format": {"s": "TkhXQw=="}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "strides": {"list": {"i": ["1", "2", "2", "1"]}}, "padding": {"s": "U0FNRQ=="}, "explicit_paddings": {"list": {}}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer5/pointwise_conv/relu/Relu", "op": "_FusedConv2D", "input": ["StatefulPartitionedCall/yamnet_frames/layer5/depthwise_conv/depthwise", "StatefulPartitionedCall/yamnet_frames/layer5/pointwise_conv/Conv2D_weights", "StatefulPartitionedCall/yamnet_frames/layer5/pointwise_conv/Conv2D_bn_offset"], "device": "/device:CPU:0", "attr": {"data_format": {"s": "TkhXQw=="}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "num_host_args": {"i": "0"}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "TArgs": {"list": {"type": ["DT_FLOAT"]}}, "padding": {"s": "U0FNRQ=="}, "explicit_paddings": {"list": {}}, "use_cudnn_on_gpu": {"b": true}, "leakyrelu_alpha": {"f": 0.2}, "filter_format": {"s": "SFdJTw=="}, "num_args": {"i": "1"}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "epsilon": {"f": 0.0}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer6/depthwise_conv/depthwise", "op": "FusedDepthwiseConv2dNative", "input": ["StatefulPartitionedCall/yamnet_frames/layer5/pointwise_conv/relu/Relu", "StatefulPartitionedCall/yamnet_frames/layer6/depthwise_conv/depthwise_weights", "StatefulPartitionedCall/yamnet_frames/layer6/depthwise_conv/depthwise_bn_offset"], "attr": {"data_format": {"s": "TkhXQw=="}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "padding": {"s": "U0FNRQ=="}, "explicit_paddings": {"list": {}}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer6/pointwise_conv/relu/Relu", "op": "_FusedConv2D", "input": ["StatefulPartitionedCall/yamnet_frames/layer6/depthwise_conv/depthwise", "StatefulPartitionedCall/yamnet_frames/layer6/pointwise_conv/Conv2D_weights", "StatefulPartitionedCall/yamnet_frames/layer6/pointwise_conv/Conv2D_bn_offset"], "device": "/device:CPU:0", "attr": {"num_host_args": {"i": "0"}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "data_format": {"s": "TkhXQw=="}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "TArgs": {"list": {"type": ["DT_FLOAT"]}}, "padding": {"s": "U0FNRQ=="}, "explicit_paddings": {"list": {}}, "use_cudnn_on_gpu": {"b": true}, "leakyrelu_alpha": {"f": 0.2}, "filter_format": {"s": "SFdJTw=="}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "epsilon": {"f": 0.0}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer7/depthwise_conv/depthwise", "op": "FusedDepthwiseConv2dNative", "input": ["StatefulPartitionedCall/yamnet_frames/layer6/pointwise_conv/relu/Relu", "StatefulPartitionedCall/yamnet_frames/layer7/depthwise_conv/depthwise_weights", "StatefulPartitionedCall/yamnet_frames/layer7/depthwise_conv/depthwise_bn_offset"], "attr": {"data_format": {"s": "TkhXQw=="}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "strides": {"list": {"i": ["1", "2", "2", "1"]}}, "padding": {"s": "U0FNRQ=="}, "explicit_paddings": {"list": {}}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer7/pointwise_conv/relu/Relu", "op": "_FusedConv2D", "input": ["StatefulPartitionedCall/yamnet_frames/layer7/depthwise_conv/depthwise", "StatefulPartitionedCall/yamnet_frames/layer7/pointwise_conv/Conv2D_weights", "StatefulPartitionedCall/yamnet_frames/layer7/pointwise_conv/Conv2D_bn_offset"], "device": "/device:CPU:0", "attr": {"num_host_args": {"i": "0"}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "data_format": {"s": "TkhXQw=="}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "TArgs": {"list": {"type": ["DT_FLOAT"]}}, "filter_format": {"s": "SFdJTw=="}, "explicit_paddings": {"list": {}}, "use_cudnn_on_gpu": {"b": true}, "leakyrelu_alpha": {"f": 0.2}, "padding": {"s": "U0FNRQ=="}, "num_args": {"i": "1"}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "epsilon": {"f": 0.0}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer8/depthwise_conv/depthwise", "op": "FusedDepthwiseConv2dNative", "input": ["StatefulPartitionedCall/yamnet_frames/layer7/pointwise_conv/relu/Relu", "StatefulPartitionedCall/yamnet_frames/layer8/depthwise_conv/depthwise_weights", "StatefulPartitionedCall/yamnet_frames/layer8/depthwise_conv/depthwise_bn_offset"], "attr": {"data_format": {"s": "TkhXQw=="}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "padding": {"s": "U0FNRQ=="}, "explicit_paddings": {"list": {}}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer8/pointwise_conv/relu/Relu", "op": "_FusedConv2D", "input": ["StatefulPartitionedCall/yamnet_frames/layer8/depthwise_conv/depthwise", "StatefulPartitionedCall/yamnet_frames/layer8/pointwise_conv/Conv2D_weights", "StatefulPartitionedCall/yamnet_frames/layer8/pointwise_conv/Conv2D_bn_offset"], "device": "/device:CPU:0", "attr": {"num_host_args": {"i": "0"}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "data_format": {"s": "TkhXQw=="}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "TArgs": {"list": {"type": ["DT_FLOAT"]}}, "filter_format": {"s": "SFdJTw=="}, "explicit_paddings": {"list": {}}, "use_cudnn_on_gpu": {"b": true}, "leakyrelu_alpha": {"f": 0.2}, "padding": {"s": "U0FNRQ=="}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "epsilon": {"f": 0.0}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer9/depthwise_conv/depthwise", "op": "FusedDepthwiseConv2dNative", "input": ["StatefulPartitionedCall/yamnet_frames/layer8/pointwise_conv/relu/Relu", "StatefulPartitionedCall/yamnet_frames/layer9/depthwise_conv/depthwise_weights", "StatefulPartitionedCall/yamnet_frames/layer9/depthwise_conv/depthwise_bn_offset"], "attr": {"data_format": {"s": "TkhXQw=="}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "padding": {"s": "U0FNRQ=="}, "explicit_paddings": {"list": {}}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer9/pointwise_conv/relu/Relu", "op": "_FusedConv2D", "input": ["StatefulPartitionedCall/yamnet_frames/layer9/depthwise_conv/depthwise", "StatefulPartitionedCall/yamnet_frames/layer9/pointwise_conv/Conv2D_weights", "StatefulPartitionedCall/yamnet_frames/layer9/pointwise_conv/Conv2D_bn_offset"], "device": "/device:CPU:0", "attr": {"TArgs": {"list": {"type": ["DT_FLOAT"]}}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "num_host_args": {"i": "0"}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "data_format": {"s": "TkhXQw=="}, "filter_format": {"s": "SFdJTw=="}, "explicit_paddings": {"list": {}}, "use_cudnn_on_gpu": {"b": true}, "leakyrelu_alpha": {"f": 0.2}, "padding": {"s": "U0FNRQ=="}, "num_args": {"i": "1"}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "epsilon": {"f": 0.0}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer10/depthwise_conv/depthwise", "op": "FusedDepthwiseConv2dNative", "input": ["StatefulPartitionedCall/yamnet_frames/layer9/pointwise_conv/relu/Relu", "StatefulPartitionedCall/yamnet_frames/layer10/depthwise_conv/depthwise_weights", "StatefulPartitionedCall/yamnet_frames/layer10/depthwise_conv/depthwise_bn_offset"], "attr": {"data_format": {"s": "TkhXQw=="}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "padding": {"s": "U0FNRQ=="}, "explicit_paddings": {"list": {}}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer10/pointwise_conv/relu/Relu", "op": "_FusedConv2D", "input": ["StatefulPartitionedCall/yamnet_frames/layer10/depthwise_conv/depthwise", "StatefulPartitionedCall/yamnet_frames/layer10/pointwise_conv/Conv2D_weights", "StatefulPartitionedCall/yamnet_frames/layer10/pointwise_conv/Conv2D_bn_offset"], "device": "/device:CPU:0", "attr": {"TArgs": {"list": {"type": ["DT_FLOAT"]}}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "num_host_args": {"i": "0"}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "data_format": {"s": "TkhXQw=="}, "filter_format": {"s": "SFdJTw=="}, "explicit_paddings": {"list": {}}, "use_cudnn_on_gpu": {"b": true}, "leakyrelu_alpha": {"f": 0.2}, "padding": {"s": "U0FNRQ=="}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "epsilon": {"f": 0.0}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer11/depthwise_conv/depthwise", "op": "FusedDepthwiseConv2dNative", "input": ["StatefulPartitionedCall/yamnet_frames/layer10/pointwise_conv/relu/Relu", "StatefulPartitionedCall/yamnet_frames/layer11/depthwise_conv/depthwise_weights", "StatefulPartitionedCall/yamnet_frames/layer11/depthwise_conv/depthwise_bn_offset"], "attr": {"data_format": {"s": "TkhXQw=="}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "padding": {"s": "U0FNRQ=="}, "explicit_paddings": {"list": {}}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer11/pointwise_conv/relu/Relu", "op": "_FusedConv2D", "input": ["StatefulPartitionedCall/yamnet_frames/layer11/depthwise_conv/depthwise", "StatefulPartitionedCall/yamnet_frames/layer11/pointwise_conv/Conv2D_weights", "StatefulPartitionedCall/yamnet_frames/layer11/pointwise_conv/Conv2D_bn_offset"], "device": "/device:CPU:0", "attr": {"data_format": {"s": "TkhXQw=="}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "TArgs": {"list": {"type": ["DT_FLOAT"]}}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "num_host_args": {"i": "0"}, "padding": {"s": "U0FNRQ=="}, "explicit_paddings": {"list": {}}, "use_cudnn_on_gpu": {"b": true}, "leakyrelu_alpha": {"f": 0.2}, "filter_format": {"s": "SFdJTw=="}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "epsilon": {"f": 0.0}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer12/depthwise_conv/depthwise", "op": "FusedDepthwiseConv2dNative", "input": ["StatefulPartitionedCall/yamnet_frames/layer11/pointwise_conv/relu/Relu", "StatefulPartitionedCall/yamnet_frames/layer12/depthwise_conv/depthwise_weights", "StatefulPartitionedCall/yamnet_frames/layer12/depthwise_conv/depthwise_bn_offset"], "attr": {"data_format": {"s": "TkhXQw=="}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "padding": {"s": "U0FNRQ=="}, "explicit_paddings": {"list": {}}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer12/pointwise_conv/relu/Relu", "op": "_FusedConv2D", "input": ["StatefulPartitionedCall/yamnet_frames/layer12/depthwise_conv/depthwise", "StatefulPartitionedCall/yamnet_frames/layer12/pointwise_conv/Conv2D_weights", "StatefulPartitionedCall/yamnet_frames/layer12/pointwise_conv/Conv2D_bn_offset"], "device": "/device:CPU:0", "attr": {"data_format": {"s": "TkhXQw=="}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "num_host_args": {"i": "0"}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "TArgs": {"list": {"type": ["DT_FLOAT"]}}, "filter_format": {"s": "SFdJTw=="}, "explicit_paddings": {"list": {}}, "use_cudnn_on_gpu": {"b": true}, "leakyrelu_alpha": {"f": 0.2}, "padding": {"s": "U0FNRQ=="}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "epsilon": {"f": 0.0}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer13/depthwise_conv/depthwise", "op": "FusedDepthwiseConv2dNative", "input": ["StatefulPartitionedCall/yamnet_frames/layer12/pointwise_conv/relu/Relu", "StatefulPartitionedCall/yamnet_frames/layer13/depthwise_conv/depthwise_weights", "StatefulPartitionedCall/yamnet_frames/layer13/depthwise_conv/depthwise_bn_offset"], "attr": {"data_format": {"s": "TkhXQw=="}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "strides": {"list": {"i": ["1", "2", "2", "1"]}}, "padding": {"s": "U0FNRQ=="}, "explicit_paddings": {"list": {}}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer13/pointwise_conv/relu/Relu", "op": "_FusedConv2D", "input": ["StatefulPartitionedCall/yamnet_frames/layer13/depthwise_conv/depthwise", "StatefulPartitionedCall/yamnet_frames/layer13/pointwise_conv/Conv2D_weights", "StatefulPartitionedCall/yamnet_frames/layer13/pointwise_conv/Conv2D_bn_offset"], "device": "/device:CPU:0", "attr": {"data_format": {"s": "TkhXQw=="}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "TArgs": {"list": {"type": ["DT_FLOAT"]}}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "num_host_args": {"i": "0"}, "padding": {"s": "U0FNRQ=="}, "explicit_paddings": {"list": {}}, "use_cudnn_on_gpu": {"b": true}, "leakyrelu_alpha": {"f": 0.2}, "filter_format": {"s": "SFdJTw=="}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "epsilon": {"f": 0.0}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer14/depthwise_conv/depthwise", "op": "FusedDepthwiseConv2dNative", "input": ["StatefulPartitionedCall/yamnet_frames/layer13/pointwise_conv/relu/Relu", "StatefulPartitionedCall/yamnet_frames/layer14/depthwise_conv/depthwise_weights", "StatefulPartitionedCall/yamnet_frames/layer14/depthwise_conv/depthwise_bn_offset"], "attr": {"data_format": {"s": "TkhXQw=="}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "padding": {"s": "U0FNRQ=="}, "explicit_paddings": {"list": {}}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/layer14/pointwise_conv/relu/Relu", "op": "_FusedConv2D", "input": ["StatefulPartitionedCall/yamnet_frames/layer14/depthwise_conv/depthwise", "StatefulPartitionedCall/yamnet_frames/layer14/pointwise_conv/Conv2D_weights", "StatefulPartitionedCall/yamnet_frames/layer14/pointwise_conv/Conv2D_bn_offset"], "device": "/device:CPU:0", "attr": {"data_format": {"s": "TkhXQw=="}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA==", "UmVsdQ=="]}}, "num_host_args": {"i": "0"}, "strides": {"list": {"i": ["1", "1", "1", "1"]}}, "TArgs": {"list": {"type": ["DT_FLOAT"]}}, "filter_format": {"s": "SFdJTw=="}, "explicit_paddings": {"list": {}}, "use_cudnn_on_gpu": {"b": true}, "leakyrelu_alpha": {"f": 0.2}, "padding": {"s": "U0FNRQ=="}, "dilations": {"list": {"i": ["1", "1", "1", "1"]}}, "num_args": {"i": "1"}, "epsilon": {"f": 0.0}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/global_average_pooling2d/Mean", "op": "Mean", "input": ["StatefulPartitionedCall/yamnet_frames/layer14/pointwise_conv/relu/Relu", "StatefulPartitionedCall/yamnet_frames/global_average_pooling2d/Mean/reduction_indices"], "attr": {"keep_dims": {"b": false}, "Tidx": {"type": "DT_INT32"}, "T": {"type": "DT_FLOAT"}}}, {"name": "Identity", "op": "Identity", "input": ["StatefulPartitionedCall/yamnet_frames/global_average_pooling2d/Mean"], "attr": {"T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/dense/BiasAdd", "op": "_FusedMatMul", "input": ["StatefulPartitionedCall/yamnet_frames/global_average_pooling2d/Mean", "StatefulPartitionedCall/yamnet_frames/dense/MatMul/ReadVariableOp", "StatefulPartitionedCall/yamnet_frames/dense/BiasAdd/ReadVariableOp"], "device": "/device:CPU:0", "attr": {"leakyrelu_alpha": {"f": 0.2}, "fused_ops": {"list": {"s": ["Qmlhc0FkZA=="]}}, "num_args": {"i": "1"}, "transpose_a": {"b": false}, "epsilon": {"f": 0.0}, "transpose_b": {"b": false}, "T": {"type": "DT_FLOAT"}}}, {"name": "StatefulPartitionedCall/yamnet_frames/activation/Sigmoid", "op": "Sigmoid", "input": ["StatefulPartitionedCall/yamnet_frames/dense/BiasAdd"], "attr": {"T": {"type": "DT_FLOAT"}}}, {"name": "Identity_2", "op": "Identity", "input": ["StatefulPartitionedCall/yamnet_frames/activation/Sigmoid"], "attr": {"T": {"type": "DT_FLOAT"}}}], "library": {}, "versions": {"producer": 2474}}, "weightsManifest": [{"paths": ["group1-shard1of4.bin", "group1-shard2of4.bin", "group1-shard3of4.bin", "group1-shard4of4.bin"], "weights": [{"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/zeros_like", "shape": [2], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/mul/y", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat/axis", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/ones_like", "shape": [2], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/floordiv_3/y", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat_1/values_1/1", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat_1/axis", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/range_1/start", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/range_1/delta", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape_2/shape/1", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape_3", "shape": [1, 2], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/strided_slice", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Const", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/add/x", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/Reshape/shape_1", "shape": [0], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/frame_step", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/frame_length", "shape": [], "dtype": "int32"}, {"name": "unknown_7", "shape": [512, 257], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad_1/Pad/paddings/0_1", "shape": [2], "dtype": "int32"}, {"name": "unknown_5", "shape": [], "dtype": "int32"}, {"name": "unknown_4", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/zeros_like", "shape": [1], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/mul/y", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat/axis", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/ones_like", "shape": [1], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/floordiv_3/y", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat_1/values_1/1", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat_1/axis", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/range_1/start", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/range_1/delta", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/floordiv_2", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape_2/shape/1", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape_3", "shape": [1, 5], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/strided_slice", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Const", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/add/x", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/Reshape/shape_1", "shape": [0], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/frame_step", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/frame_length", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad/Pad/paddings/0/0", "shape": [], "dtype": "int32"}, {"name": "unknown_2", "shape": [], "dtype": "int32"}, {"name": "unknown_1", "shape": [], "dtype": "int32"}, {"name": "ConstantFolding/StatefulPartitionedCall/yamnet_frames/tf.math.truediv/truediv_recip", "shape": [], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem/strided_slice/stack", "shape": [1], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem/strided_slice/stack_1", "shape": [1], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem/strided_slice/stack_2", "shape": [1], "dtype": "int32"}, {"name": "unknown", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/packed", "shape": [3], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/split/split_dim", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat_2/axis", "shape": [], "dtype": "int32"}, {"name": "unknown_3", "shape": [1, 400], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem_1/strided_slice/stack", "shape": [1], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem_1/strided_slice/stack_1", "shape": [1], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.__operators__.getitem_1/strided_slice/stack_2", "shape": [1], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.compat.v1.floor_div/FloorDiv/y", "shape": [], "dtype": "int32"}, {"name": "unknown_6", "shape": [512, 257], "dtype": "float32"}, {"name": "unknown_8", "shape": [257, 64], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.__operators__.add_1/y", "shape": [], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/packed", "shape": [3], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/split/split_dim", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat_2/axis", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/reshape/strided_slice/stack", "shape": [1], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/reshape/strided_slice/stack_1", "shape": [1], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/reshape/strided_slice/stack_2", "shape": [1], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/reshape/Reshape/shape/1", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/reshape/Reshape/shape/2", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/reshape/Reshape/shape/3", "shape": [], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/global_average_pooling2d/Mean/reduction_indices", "shape": [2], "dtype": "int32"}, {"name": "StatefulPartitionedCall/yamnet_frames/dense/MatMul/ReadVariableOp", "shape": [1024, 521], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/dense/BiasAdd/ReadVariableOp", "shape": [521], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer1/conv/Conv2D_weights", "shape": [3, 3, 1, 32], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer12/pointwise_conv/Conv2D_bn_offset", "shape": [512], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer1/conv/Conv2D_bn_offset", "shape": [32], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer2/depthwise_conv/depthwise_weights", "shape": [3, 3, 32, 1], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer2/depthwise_conv/depthwise_bn_offset", "shape": [32], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer2/pointwise_conv/Conv2D_weights", "shape": [1, 1, 32, 64], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer2/pointwise_conv/Conv2D_bn_offset", "shape": [64], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer13/depthwise_conv/depthwise_weights", "shape": [3, 3, 512, 1], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer3/depthwise_conv/depthwise_weights", "shape": [3, 3, 64, 1], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer3/depthwise_conv/depthwise_bn_offset", "shape": [64], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer3/pointwise_conv/Conv2D_weights", "shape": [1, 1, 64, 128], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer3/pointwise_conv/Conv2D_bn_offset", "shape": [128], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer13/depthwise_conv/depthwise_bn_offset", "shape": [512], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer4/depthwise_conv/depthwise_weights", "shape": [3, 3, 128, 1], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer4/depthwise_conv/depthwise_bn_offset", "shape": [128], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer4/pointwise_conv/Conv2D_weights", "shape": [1, 1, 128, 128], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer4/pointwise_conv/Conv2D_bn_offset", "shape": [128], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer5/depthwise_conv/depthwise_weights", "shape": [3, 3, 128, 1], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer5/depthwise_conv/depthwise_bn_offset", "shape": [128], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer5/pointwise_conv/Conv2D_weights", "shape": [1, 1, 128, 256], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer13/pointwise_conv/Conv2D_weights", "shape": [1, 1, 512, 1024], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer5/pointwise_conv/Conv2D_bn_offset", "shape": [256], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer6/depthwise_conv/depthwise_weights", "shape": [3, 3, 256, 1], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer6/depthwise_conv/depthwise_bn_offset", "shape": [256], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer6/pointwise_conv/Conv2D_weights", "shape": [1, 1, 256, 256], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer13/pointwise_conv/Conv2D_bn_offset", "shape": [1024], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer6/pointwise_conv/Conv2D_bn_offset", "shape": [256], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer7/depthwise_conv/depthwise_weights", "shape": [3, 3, 256, 1], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer7/depthwise_conv/depthwise_bn_offset", "shape": [256], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer7/pointwise_conv/Conv2D_weights", "shape": [1, 1, 256, 512], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer7/pointwise_conv/Conv2D_bn_offset", "shape": [512], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer14/depthwise_conv/depthwise_weights", "shape": [3, 3, 1024, 1], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer8/depthwise_conv/depthwise_weights", "shape": [3, 3, 512, 1], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer8/depthwise_conv/depthwise_bn_offset", "shape": [512], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer8/pointwise_conv/Conv2D_weights", "shape": [1, 1, 512, 512], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer8/pointwise_conv/Conv2D_bn_offset", "shape": [512], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer14/depthwise_conv/depthwise_bn_offset", "shape": [1024], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer9/depthwise_conv/depthwise_weights", "shape": [3, 3, 512, 1], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer9/depthwise_conv/depthwise_bn_offset", "shape": [512], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer9/pointwise_conv/Conv2D_weights", "shape": [1, 1, 512, 512], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer9/pointwise_conv/Conv2D_bn_offset", "shape": [512], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer10/depthwise_conv/depthwise_weights", "shape": [3, 3, 512, 1], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer10/depthwise_conv/depthwise_bn_offset", "shape": [512], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer10/pointwise_conv/Conv2D_weights", "shape": [1, 1, 512, 512], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer14/pointwise_conv/Conv2D_weights", "shape": [1, 1, 1024, 1024], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer10/pointwise_conv/Conv2D_bn_offset", "shape": [512], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer11/depthwise_conv/depthwise_weights", "shape": [3, 3, 512, 1], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer11/depthwise_conv/depthwise_bn_offset", "shape": [512], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer11/pointwise_conv/Conv2D_weights", "shape": [1, 1, 512, 512], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer14/pointwise_conv/Conv2D_bn_offset", "shape": [1024], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer11/pointwise_conv/Conv2D_bn_offset", "shape": [512], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer12/depthwise_conv/depthwise_weights", "shape": [3, 3, 512, 1], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer12/depthwise_conv/depthwise_bn_offset", "shape": [512], "dtype": "float32"}, {"name": "StatefulPartitionedCall/yamnet_frames/layer12/pointwise_conv/Conv2D_weights", "shape": [1, 1, 512, 512], "dtype": "float32"}, {"name": "ConstantFolding/StatefulPartitionedCall/yamnet_frames/tf.compat.v1.pad/Pad/paddings_const_axis", "shape": [], "dtype": "int32"}, {"name": "ConstantFolding/StatefulPartitionedCall/yamnet_frames/tf.signal.frame/frame/concat/values_1_const_axis", "shape": [], "dtype": "int32"}, {"name": "ConstantFolding/StatefulPartitionedCall/yamnet_frames/tf.signal.frame_1/frame/concat/values_1_const_axis", "shape": [], "dtype": "int32"}]}]} \ No newline at end of file diff --git a/analysis/static/browser-yamnet/yamnet_class_map.csv b/analysis/static/browser-yamnet/yamnet_class_map.csv new file mode 100644 index 0000000..9c07d81 --- /dev/null +++ b/analysis/static/browser-yamnet/yamnet_class_map.csv @@ -0,0 +1,522 @@ +index,mid,display_name +0,/m/09x0r,Speech +1,/m/0ytgt,"Child speech, kid speaking" +2,/m/01h8n0,Conversation +3,/m/02qldy,"Narration, monologue" +4,/m/0261r1,Babbling +5,/m/0brhx,Speech synthesizer +6,/m/07p6fty,Shout +7,/m/07q4ntr,Bellow +8,/m/07rwj3x,Whoop +9,/m/07sr1lc,Yell +10,/t/dd00135,Children shouting +11,/m/03qc9zr,Screaming +12,/m/02rtxlg,Whispering +13,/m/01j3sz,Laughter +14,/t/dd00001,Baby laughter +15,/m/07r660_,Giggle +16,/m/07s04w4,Snicker +17,/m/07sq110,Belly laugh +18,/m/07rgt08,"Chuckle, chortle" +19,/m/0463cq4,"Crying, sobbing" +20,/t/dd00002,"Baby cry, infant cry" +21,/m/07qz6j3,Whimper +22,/m/07qw_06,"Wail, moan" +23,/m/07plz5l,Sigh +24,/m/015lz1,Singing +25,/m/0l14jd,Choir +26,/m/01swy6,Yodeling +27,/m/02bk07,Chant +28,/m/01c194,Mantra +29,/t/dd00005,Child singing +30,/t/dd00006,Synthetic singing +31,/m/06bxc,Rapping +32,/m/02fxyj,Humming +33,/m/07s2xch,Groan +34,/m/07r4k75,Grunt +35,/m/01w250,Whistling +36,/m/0lyf6,Breathing +37,/m/07mzm6,Wheeze +38,/m/01d3sd,Snoring +39,/m/07s0dtb,Gasp +40,/m/07pyy8b,Pant +41,/m/07q0yl5,Snort +42,/m/01b_21,Cough +43,/m/0dl9sf8,Throat clearing +44,/m/01hsr_,Sneeze +45,/m/07ppn3j,Sniff +46,/m/06h7j,Run +47,/m/07qv_x_,Shuffle +48,/m/07pbtc8,"Walk, footsteps" +49,/m/03cczk,"Chewing, mastication" +50,/m/07pdhp0,Biting +51,/m/0939n_,Gargling +52,/m/01g90h,Stomach rumble +53,/m/03q5_w,"Burping, eructation" +54,/m/02p3nc,Hiccup +55,/m/02_nn,Fart +56,/m/0k65p,Hands +57,/m/025_jnm,Finger snapping +58,/m/0l15bq,Clapping +59,/m/01jg02,"Heart sounds, heartbeat" +60,/m/01jg1z,Heart murmur +61,/m/053hz1,Cheering +62,/m/028ght,Applause +63,/m/07rkbfh,Chatter +64,/m/03qtwd,Crowd +65,/m/07qfr4h,"Hubbub, speech noise, speech babble" +66,/t/dd00013,Children playing +67,/m/0jbk,Animal +68,/m/068hy,"Domestic animals, pets" +69,/m/0bt9lr,Dog +70,/m/05tny_,Bark +71,/m/07r_k2n,Yip +72,/m/07qf0zm,Howl +73,/m/07rc7d9,Bow-wow +74,/m/0ghcn6,Growling +75,/t/dd00136,Whimper (dog) +76,/m/01yrx,Cat +77,/m/02yds9,Purr +78,/m/07qrkrw,Meow +79,/m/07rjwbb,Hiss +80,/m/07r81j2,Caterwaul +81,/m/0ch8v,"Livestock, farm animals, working animals" +82,/m/03k3r,Horse +83,/m/07rv9rh,Clip-clop +84,/m/07q5rw0,"Neigh, whinny" +85,/m/01xq0k1,"Cattle, bovinae" +86,/m/07rpkh9,Moo +87,/m/0239kh,Cowbell +88,/m/068zj,Pig +89,/t/dd00018,Oink +90,/m/03fwl,Goat +91,/m/07q0h5t,Bleat +92,/m/07bgp,Sheep +93,/m/025rv6n,Fowl +94,/m/09b5t,"Chicken, rooster" +95,/m/07st89h,Cluck +96,/m/07qn5dc,"Crowing, cock-a-doodle-doo" +97,/m/01rd7k,Turkey +98,/m/07svc2k,Gobble +99,/m/09ddx,Duck +100,/m/07qdb04,Quack +101,/m/0dbvp,Goose +102,/m/07qwf61,Honk +103,/m/01280g,Wild animals +104,/m/0cdnk,"Roaring cats (lions, tigers)" +105,/m/04cvmfc,Roar +106,/m/015p6,Bird +107,/m/020bb7,"Bird vocalization, bird call, bird song" +108,/m/07pggtn,"Chirp, tweet" +109,/m/07sx8x_,Squawk +110,/m/0h0rv,"Pigeon, dove" +111,/m/07r_25d,Coo +112,/m/04s8yn,Crow +113,/m/07r5c2p,Caw +114,/m/09d5_,Owl +115,/m/07r_80w,Hoot +116,/m/05_wcq,"Bird flight, flapping wings" +117,/m/01z5f,"Canidae, dogs, wolves" +118,/m/06hps,"Rodents, rats, mice" +119,/m/04rmv,Mouse +120,/m/07r4gkf,Patter +121,/m/03vt0,Insect +122,/m/09xqv,Cricket +123,/m/09f96,Mosquito +124,/m/0h2mp,"Fly, housefly" +125,/m/07pjwq1,Buzz +126,/m/01h3n,"Bee, wasp, etc." +127,/m/09ld4,Frog +128,/m/07st88b,Croak +129,/m/078jl,Snake +130,/m/07qn4z3,Rattle +131,/m/032n05,Whale vocalization +132,/m/04rlf,Music +133,/m/04szw,Musical instrument +134,/m/0fx80y,Plucked string instrument +135,/m/0342h,Guitar +136,/m/02sgy,Electric guitar +137,/m/018vs,Bass guitar +138,/m/042v_gx,Acoustic guitar +139,/m/06w87,"Steel guitar, slide guitar" +140,/m/01glhc,Tapping (guitar technique) +141,/m/07s0s5r,Strum +142,/m/018j2,Banjo +143,/m/0jtg0,Sitar +144,/m/04rzd,Mandolin +145,/m/01bns_,Zither +146,/m/07xzm,Ukulele +147,/m/05148p4,Keyboard (musical) +148,/m/05r5c,Piano +149,/m/01s0ps,Electric piano +150,/m/013y1f,Organ +151,/m/03xq_f,Electronic organ +152,/m/03gvt,Hammond organ +153,/m/0l14qv,Synthesizer +154,/m/01v1d8,Sampler +155,/m/03q5t,Harpsichord +156,/m/0l14md,Percussion +157,/m/02hnl,Drum kit +158,/m/0cfdd,Drum machine +159,/m/026t6,Drum +160,/m/06rvn,Snare drum +161,/m/03t3fj,Rimshot +162,/m/02k_mr,Drum roll +163,/m/0bm02,Bass drum +164,/m/011k_j,Timpani +165,/m/01p970,Tabla +166,/m/01qbl,Cymbal +167,/m/03qtq,Hi-hat +168,/m/01sm1g,Wood block +169,/m/07brj,Tambourine +170,/m/05r5wn,Rattle (instrument) +171,/m/0xzly,Maraca +172,/m/0mbct,Gong +173,/m/016622,Tubular bells +174,/m/0j45pbj,Mallet percussion +175,/m/0dwsp,"Marimba, xylophone" +176,/m/0dwtp,Glockenspiel +177,/m/0dwt5,Vibraphone +178,/m/0l156b,Steelpan +179,/m/05pd6,Orchestra +180,/m/01kcd,Brass instrument +181,/m/0319l,French horn +182,/m/07gql,Trumpet +183,/m/07c6l,Trombone +184,/m/0l14_3,Bowed string instrument +185,/m/02qmj0d,String section +186,/m/07y_7,"Violin, fiddle" +187,/m/0d8_n,Pizzicato +188,/m/01xqw,Cello +189,/m/02fsn,Double bass +190,/m/085jw,"Wind instrument, woodwind instrument" +191,/m/0l14j_,Flute +192,/m/06ncr,Saxophone +193,/m/01wy6,Clarinet +194,/m/03m5k,Harp +195,/m/0395lw,Bell +196,/m/03w41f,Church bell +197,/m/027m70_,Jingle bell +198,/m/0gy1t2s,Bicycle bell +199,/m/07n_g,Tuning fork +200,/m/0f8s22,Chime +201,/m/026fgl,Wind chime +202,/m/0150b9,Change ringing (campanology) +203,/m/03qjg,Harmonica +204,/m/0mkg,Accordion +205,/m/0192l,Bagpipes +206,/m/02bxd,Didgeridoo +207,/m/0l14l2,Shofar +208,/m/07kc_,Theremin +209,/m/0l14t7,Singing bowl +210,/m/01hgjl,Scratching (performance technique) +211,/m/064t9,Pop music +212,/m/0glt670,Hip hop music +213,/m/02cz_7,Beatboxing +214,/m/06by7,Rock music +215,/m/03lty,Heavy metal +216,/m/05r6t,Punk rock +217,/m/0dls3,Grunge +218,/m/0dl5d,Progressive rock +219,/m/07sbbz2,Rock and roll +220,/m/05w3f,Psychedelic rock +221,/m/06j6l,Rhythm and blues +222,/m/0gywn,Soul music +223,/m/06cqb,Reggae +224,/m/01lyv,Country +225,/m/015y_n,Swing music +226,/m/0gg8l,Bluegrass +227,/m/02x8m,Funk +228,/m/02w4v,Folk music +229,/m/06j64v,Middle Eastern music +230,/m/03_d0,Jazz +231,/m/026z9,Disco +232,/m/0ggq0m,Classical music +233,/m/05lls,Opera +234,/m/02lkt,Electronic music +235,/m/03mb9,House music +236,/m/07gxw,Techno +237,/m/07s72n,Dubstep +238,/m/0283d,Drum and bass +239,/m/0m0jc,Electronica +240,/m/08cyft,Electronic dance music +241,/m/0fd3y,Ambient music +242,/m/07lnk,Trance music +243,/m/0g293,Music of Latin America +244,/m/0ln16,Salsa music +245,/m/0326g,Flamenco +246,/m/0155w,Blues +247,/m/05fw6t,Music for children +248,/m/02v2lh,New-age music +249,/m/0y4f8,Vocal music +250,/m/0z9c,A capella +251,/m/0164x2,Music of Africa +252,/m/0145m,Afrobeat +253,/m/02mscn,Christian music +254,/m/016cjb,Gospel music +255,/m/028sqc,Music of Asia +256,/m/015vgc,Carnatic music +257,/m/0dq0md,Music of Bollywood +258,/m/06rqw,Ska +259,/m/02p0sh1,Traditional music +260,/m/05rwpb,Independent music +261,/m/074ft,Song +262,/m/025td0t,Background music +263,/m/02cjck,Theme music +264,/m/03r5q_,Jingle (music) +265,/m/0l14gg,Soundtrack music +266,/m/07pkxdp,Lullaby +267,/m/01z7dr,Video game music +268,/m/0140xf,Christmas music +269,/m/0ggx5q,Dance music +270,/m/04wptg,Wedding music +271,/t/dd00031,Happy music +272,/t/dd00033,Sad music +273,/t/dd00034,Tender music +274,/t/dd00035,Exciting music +275,/t/dd00036,Angry music +276,/t/dd00037,Scary music +277,/m/03m9d0z,Wind +278,/m/09t49,Rustling leaves +279,/t/dd00092,Wind noise (microphone) +280,/m/0jb2l,Thunderstorm +281,/m/0ngt1,Thunder +282,/m/0838f,Water +283,/m/06mb1,Rain +284,/m/07r10fb,Raindrop +285,/t/dd00038,Rain on surface +286,/m/0j6m2,Stream +287,/m/0j2kx,Waterfall +288,/m/05kq4,Ocean +289,/m/034srq,"Waves, surf" +290,/m/06wzb,Steam +291,/m/07swgks,Gurgling +292,/m/02_41,Fire +293,/m/07pzfmf,Crackle +294,/m/07yv9,Vehicle +295,/m/019jd,"Boat, Water vehicle" +296,/m/0hsrw,"Sailboat, sailing ship" +297,/m/056ks2,"Rowboat, canoe, kayak" +298,/m/02rlv9,"Motorboat, speedboat" +299,/m/06q74,Ship +300,/m/012f08,Motor vehicle (road) +301,/m/0k4j,Car +302,/m/0912c9,"Vehicle horn, car horn, honking" +303,/m/07qv_d5,Toot +304,/m/02mfyn,Car alarm +305,/m/04gxbd,"Power windows, electric windows" +306,/m/07rknqz,Skidding +307,/m/0h9mv,Tire squeal +308,/t/dd00134,Car passing by +309,/m/0ltv,"Race car, auto racing" +310,/m/07r04,Truck +311,/m/0gvgw0,Air brake +312,/m/05x_td,"Air horn, truck horn" +313,/m/02rhddq,Reversing beeps +314,/m/03cl9h,"Ice cream truck, ice cream van" +315,/m/01bjv,Bus +316,/m/03j1ly,Emergency vehicle +317,/m/04qvtq,Police car (siren) +318,/m/012n7d,Ambulance (siren) +319,/m/012ndj,"Fire engine, fire truck (siren)" +320,/m/04_sv,Motorcycle +321,/m/0btp2,"Traffic noise, roadway noise" +322,/m/06d_3,Rail transport +323,/m/07jdr,Train +324,/m/04zmvq,Train whistle +325,/m/0284vy3,Train horn +326,/m/01g50p,"Railroad car, train wagon" +327,/t/dd00048,Train wheels squealing +328,/m/0195fx,"Subway, metro, underground" +329,/m/0k5j,Aircraft +330,/m/014yck,Aircraft engine +331,/m/04229,Jet engine +332,/m/02l6bg,"Propeller, airscrew" +333,/m/09ct_,Helicopter +334,/m/0cmf2,"Fixed-wing aircraft, airplane" +335,/m/0199g,Bicycle +336,/m/06_fw,Skateboard +337,/m/02mk9,Engine +338,/t/dd00065,Light engine (high frequency) +339,/m/08j51y,"Dental drill, dentist's drill" +340,/m/01yg9g,Lawn mower +341,/m/01j4z9,Chainsaw +342,/t/dd00066,Medium engine (mid frequency) +343,/t/dd00067,Heavy engine (low frequency) +344,/m/01h82_,Engine knocking +345,/t/dd00130,Engine starting +346,/m/07pb8fc,Idling +347,/m/07q2z82,"Accelerating, revving, vroom" +348,/m/02dgv,Door +349,/m/03wwcy,Doorbell +350,/m/07r67yg,Ding-dong +351,/m/02y_763,Sliding door +352,/m/07rjzl8,Slam +353,/m/07r4wb8,Knock +354,/m/07qcpgn,Tap +355,/m/07q6cd_,Squeak +356,/m/0642b4,Cupboard open or close +357,/m/0fqfqc,Drawer open or close +358,/m/04brg2,"Dishes, pots, and pans" +359,/m/023pjk,"Cutlery, silverware" +360,/m/07pn_8q,Chopping (food) +361,/m/0dxrf,Frying (food) +362,/m/0fx9l,Microwave oven +363,/m/02pjr4,Blender +364,/m/02jz0l,"Water tap, faucet" +365,/m/0130jx,Sink (filling or washing) +366,/m/03dnzn,Bathtub (filling or washing) +367,/m/03wvsk,Hair dryer +368,/m/01jt3m,Toilet flush +369,/m/012xff,Toothbrush +370,/m/04fgwm,Electric toothbrush +371,/m/0d31p,Vacuum cleaner +372,/m/01s0vc,Zipper (clothing) +373,/m/03v3yw,Keys jangling +374,/m/0242l,Coin (dropping) +375,/m/01lsmm,Scissors +376,/m/02g901,"Electric shaver, electric razor" +377,/m/05rj2,Shuffling cards +378,/m/0316dw,Typing +379,/m/0c2wf,Typewriter +380,/m/01m2v,Computer keyboard +381,/m/081rb,Writing +382,/m/07pp_mv,Alarm +383,/m/07cx4,Telephone +384,/m/07pp8cl,Telephone bell ringing +385,/m/01hnzm,Ringtone +386,/m/02c8p,"Telephone dialing, DTMF" +387,/m/015jpf,Dial tone +388,/m/01z47d,Busy signal +389,/m/046dlr,Alarm clock +390,/m/03kmc9,Siren +391,/m/0dgbq,Civil defense siren +392,/m/030rvx,Buzzer +393,/m/01y3hg,"Smoke detector, smoke alarm" +394,/m/0c3f7m,Fire alarm +395,/m/04fq5q,Foghorn +396,/m/0l156k,Whistle +397,/m/06hck5,Steam whistle +398,/t/dd00077,Mechanisms +399,/m/02bm9n,"Ratchet, pawl" +400,/m/01x3z,Clock +401,/m/07qjznt,Tick +402,/m/07qjznl,Tick-tock +403,/m/0l7xg,Gears +404,/m/05zc1,Pulleys +405,/m/0llzx,Sewing machine +406,/m/02x984l,Mechanical fan +407,/m/025wky1,Air conditioning +408,/m/024dl,Cash register +409,/m/01m4t,Printer +410,/m/0dv5r,Camera +411,/m/07bjf,Single-lens reflex camera +412,/m/07k1x,Tools +413,/m/03l9g,Hammer +414,/m/03p19w,Jackhammer +415,/m/01b82r,Sawing +416,/m/02p01q,Filing (rasp) +417,/m/023vsd,Sanding +418,/m/0_ksk,Power tool +419,/m/01d380,Drill +420,/m/014zdl,Explosion +421,/m/032s66,"Gunshot, gunfire" +422,/m/04zjc,Machine gun +423,/m/02z32qm,Fusillade +424,/m/0_1c,Artillery fire +425,/m/073cg4,Cap gun +426,/m/0g6b5,Fireworks +427,/g/122z_qxw,Firecracker +428,/m/07qsvvw,"Burst, pop" +429,/m/07pxg6y,Eruption +430,/m/07qqyl4,Boom +431,/m/083vt,Wood +432,/m/07pczhz,Chop +433,/m/07pl1bw,Splinter +434,/m/07qs1cx,Crack +435,/m/039jq,Glass +436,/m/07q7njn,"Chink, clink" +437,/m/07rn7sz,Shatter +438,/m/04k94,Liquid +439,/m/07rrlb6,"Splash, splatter" +440,/m/07p6mqd,Slosh +441,/m/07qlwh6,Squish +442,/m/07r5v4s,Drip +443,/m/07prgkl,Pour +444,/m/07pqc89,"Trickle, dribble" +445,/t/dd00088,Gush +446,/m/07p7b8y,Fill (with liquid) +447,/m/07qlf79,Spray +448,/m/07ptzwd,Pump (liquid) +449,/m/07ptfmf,Stir +450,/m/0dv3j,Boiling +451,/m/0790c,Sonar +452,/m/0dl83,Arrow +453,/m/07rqsjt,"Whoosh, swoosh, swish" +454,/m/07qnq_y,"Thump, thud" +455,/m/07rrh0c,Thunk +456,/m/0b_fwt,Electronic tuner +457,/m/02rr_,Effects unit +458,/m/07m2kt,Chorus effect +459,/m/018w8,Basketball bounce +460,/m/07pws3f,Bang +461,/m/07ryjzk,"Slap, smack" +462,/m/07rdhzs,"Whack, thwack" +463,/m/07pjjrj,"Smash, crash" +464,/m/07pc8lb,Breaking +465,/m/07pqn27,Bouncing +466,/m/07rbp7_,Whip +467,/m/07pyf11,Flap +468,/m/07qb_dv,Scratch +469,/m/07qv4k0,Scrape +470,/m/07pdjhy,Rub +471,/m/07s8j8t,Roll +472,/m/07plct2,Crushing +473,/t/dd00112,"Crumpling, crinkling" +474,/m/07qcx4z,Tearing +475,/m/02fs_r,"Beep, bleep" +476,/m/07qwdck,Ping +477,/m/07phxs1,Ding +478,/m/07rv4dm,Clang +479,/m/07s02z0,Squeal +480,/m/07qh7jl,Creak +481,/m/07qwyj0,Rustle +482,/m/07s34ls,Whir +483,/m/07qmpdm,Clatter +484,/m/07p9k1k,Sizzle +485,/m/07qc9xj,Clicking +486,/m/07rwm0c,Clickety-clack +487,/m/07phhsh,Rumble +488,/m/07qyrcz,Plop +489,/m/07qfgpx,"Jingle, tinkle" +490,/m/07rcgpl,Hum +491,/m/07p78v5,Zing +492,/t/dd00121,Boing +493,/m/07s12q4,Crunch +494,/m/028v0c,Silence +495,/m/01v_m0,Sine wave +496,/m/0b9m1,Harmonic +497,/m/0hdsk,Chirp tone +498,/m/0c1dj,Sound effect +499,/m/07pt_g0,Pulse +500,/t/dd00125,"Inside, small room" +501,/t/dd00126,"Inside, large room or hall" +502,/t/dd00127,"Inside, public space" +503,/t/dd00128,"Outside, urban or manmade" +504,/t/dd00129,"Outside, rural or natural" +505,/m/01b9nn,Reverberation +506,/m/01jnbd,Echo +507,/m/096m7z,Noise +508,/m/06_y0by,Environmental noise +509,/m/07rgkc5,Static +510,/m/06xkwv,Mains hum +511,/m/0g12c5,Distortion +512,/m/08p9q4,Sidetone +513,/m/07szfh9,Cacophony +514,/m/0chx_,White noise +515,/m/0cj0r,Pink noise +516,/m/07p_0gm,Throbbing +517,/m/01jwx6,Vibration +518,/m/07c52,Television +519,/m/06bz3,Radio +520,/m/07hvw1,Field recording diff --git a/analysis/static/browser-yamnet/yamnet_class_map.json b/analysis/static/browser-yamnet/yamnet_class_map.json new file mode 100644 index 0000000..ee5d3bc --- /dev/null +++ b/analysis/static/browser-yamnet/yamnet_class_map.json @@ -0,0 +1 @@ +["Speech", "Child speech, kid speaking", "Conversation", "Narration, monologue", "Babbling", "Speech synthesizer", "Shout", "Bellow", "Whoop", "Yell", "Children shouting", "Screaming", "Whispering", "Laughter", "Baby laughter", "Giggle", "Snicker", "Belly laugh", "Chuckle, chortle", "Crying, sobbing", "Baby cry, infant cry", "Whimper", "Wail, moan", "Sigh", "Singing", "Choir", "Yodeling", "Chant", "Mantra", "Child singing", "Synthetic singing", "Rapping", "Humming", "Groan", "Grunt", "Whistling", "Breathing", "Wheeze", "Snoring", "Gasp", "Pant", "Snort", "Cough", "Throat clearing", "Sneeze", "Sniff", "Run", "Shuffle", "Walk, footsteps", "Chewing, mastication", "Biting", "Gargling", "Stomach rumble", "Burping, eructation", "Hiccup", "Fart", "Hands", "Finger snapping", "Clapping", "Heart sounds, heartbeat", "Heart murmur", "Cheering", "Applause", "Chatter", "Crowd", "Hubbub, speech noise, speech babble", "Children playing", "Animal", "Domestic animals, pets", "Dog", "Bark", "Yip", "Howl", "Bow-wow", "Growling", "Whimper (dog)", "Cat", "Purr", "Meow", "Hiss", "Caterwaul", "Livestock, farm animals, working animals", "Horse", "Clip-clop", "Neigh, whinny", "Cattle, bovinae", "Moo", "Cowbell", "Pig", "Oink", "Goat", "Bleat", "Sheep", "Fowl", "Chicken, rooster", "Cluck", "Crowing, cock-a-doodle-doo", "Turkey", "Gobble", "Duck", "Quack", "Goose", "Honk", "Wild animals", "Roaring cats (lions, tigers)", "Roar", "Bird", "Bird vocalization, bird call, bird song", "Chirp, tweet", "Squawk", "Pigeon, dove", "Coo", "Crow", "Caw", "Owl", "Hoot", "Bird flight, flapping wings", "Canidae, dogs, wolves", "Rodents, rats, mice", "Mouse", "Patter", "Insect", "Cricket", "Mosquito", "Fly, housefly", "Buzz", "Bee, wasp, etc.", "Frog", "Croak", "Snake", "Rattle", "Whale vocalization", "Music", "Musical instrument", "Plucked string instrument", "Guitar", "Electric guitar", "Bass guitar", "Acoustic guitar", "Steel guitar, slide guitar", "Tapping (guitar technique)", "Strum", "Banjo", "Sitar", "Mandolin", "Zither", "Ukulele", "Keyboard (musical)", "Piano", "Electric piano", "Organ", "Electronic organ", "Hammond organ", "Synthesizer", "Sampler", "Harpsichord", "Percussion", "Drum kit", "Drum machine", "Drum", "Snare drum", "Rimshot", "Drum roll", "Bass drum", "Timpani", "Tabla", "Cymbal", "Hi-hat", "Wood block", "Tambourine", "Rattle (instrument)", "Maraca", "Gong", "Tubular bells", "Mallet percussion", "Marimba, xylophone", "Glockenspiel", "Vibraphone", "Steelpan", "Orchestra", "Brass instrument", "French horn", "Trumpet", "Trombone", "Bowed string instrument", "String section", "Violin, fiddle", "Pizzicato", "Cello", "Double bass", "Wind instrument, woodwind instrument", "Flute", "Saxophone", "Clarinet", "Harp", "Bell", "Church bell", "Jingle bell", "Bicycle bell", "Tuning fork", "Chime", "Wind chime", "Change ringing (campanology)", "Harmonica", "Accordion", "Bagpipes", "Didgeridoo", "Shofar", "Theremin", "Singing bowl", "Scratching (performance technique)", "Pop music", "Hip hop music", "Beatboxing", "Rock music", "Heavy metal", "Punk rock", "Grunge", "Progressive rock", "Rock and roll", "Psychedelic rock", "Rhythm and blues", "Soul music", "Reggae", "Country", "Swing music", "Bluegrass", "Funk", "Folk music", "Middle Eastern music", "Jazz", "Disco", "Classical music", "Opera", "Electronic music", "House music", "Techno", "Dubstep", "Drum and bass", "Electronica", "Electronic dance music", "Ambient music", "Trance music", "Music of Latin America", "Salsa music", "Flamenco", "Blues", "Music for children", "New-age music", "Vocal music", "A capella", "Music of Africa", "Afrobeat", "Christian music", "Gospel music", "Music of Asia", "Carnatic music", "Music of Bollywood", "Ska", "Traditional music", "Independent music", "Song", "Background music", "Theme music", "Jingle (music)", "Soundtrack music", "Lullaby", "Video game music", "Christmas music", "Dance music", "Wedding music", "Happy music", "Sad music", "Tender music", "Exciting music", "Angry music", "Scary music", "Wind", "Rustling leaves", "Wind noise (microphone)", "Thunderstorm", "Thunder", "Water", "Rain", "Raindrop", "Rain on surface", "Stream", "Waterfall", "Ocean", "Waves, surf", "Steam", "Gurgling", "Fire", "Crackle", "Vehicle", "Boat, Water vehicle", "Sailboat, sailing ship", "Rowboat, canoe, kayak", "Motorboat, speedboat", "Ship", "Motor vehicle (road)", "Car", "Vehicle horn, car horn, honking", "Toot", "Car alarm", "Power windows, electric windows", "Skidding", "Tire squeal", "Car passing by", "Race car, auto racing", "Truck", "Air brake", "Air horn, truck horn", "Reversing beeps", "Ice cream truck, ice cream van", "Bus", "Emergency vehicle", "Police car (siren)", "Ambulance (siren)", "Fire engine, fire truck (siren)", "Motorcycle", "Traffic noise, roadway noise", "Rail transport", "Train", "Train whistle", "Train horn", "Railroad car, train wagon", "Train wheels squealing", "Subway, metro, underground", "Aircraft", "Aircraft engine", "Jet engine", "Propeller, airscrew", "Helicopter", "Fixed-wing aircraft, airplane", "Bicycle", "Skateboard", "Engine", "Light engine (high frequency)", "Dental drill, dentist's drill", "Lawn mower", "Chainsaw", "Medium engine (mid frequency)", "Heavy engine (low frequency)", "Engine knocking", "Engine starting", "Idling", "Accelerating, revving, vroom", "Door", "Doorbell", "Ding-dong", "Sliding door", "Slam", "Knock", "Tap", "Squeak", "Cupboard open or close", "Drawer open or close", "Dishes, pots, and pans", "Cutlery, silverware", "Chopping (food)", "Frying (food)", "Microwave oven", "Blender", "Water tap, faucet", "Sink (filling or washing)", "Bathtub (filling or washing)", "Hair dryer", "Toilet flush", "Toothbrush", "Electric toothbrush", "Vacuum cleaner", "Zipper (clothing)", "Keys jangling", "Coin (dropping)", "Scissors", "Electric shaver, electric razor", "Shuffling cards", "Typing", "Typewriter", "Computer keyboard", "Writing", "Alarm", "Telephone", "Telephone bell ringing", "Ringtone", "Telephone dialing, DTMF", "Dial tone", "Busy signal", "Alarm clock", "Siren", "Civil defense siren", "Buzzer", "Smoke detector, smoke alarm", "Fire alarm", "Foghorn", "Whistle", "Steam whistle", "Mechanisms", "Ratchet, pawl", "Clock", "Tick", "Tick-tock", "Gears", "Pulleys", "Sewing machine", "Mechanical fan", "Air conditioning", "Cash register", "Printer", "Camera", "Single-lens reflex camera", "Tools", "Hammer", "Jackhammer", "Sawing", "Filing (rasp)", "Sanding", "Power tool", "Drill", "Explosion", "Gunshot, gunfire", "Machine gun", "Fusillade", "Artillery fire", "Cap gun", "Fireworks", "Firecracker", "Burst, pop", "Eruption", "Boom", "Wood", "Chop", "Splinter", "Crack", "Glass", "Chink, clink", "Shatter", "Liquid", "Splash, splatter", "Slosh", "Squish", "Drip", "Pour", "Trickle, dribble", "Gush", "Fill (with liquid)", "Spray", "Pump (liquid)", "Stir", "Boiling", "Sonar", "Arrow", "Whoosh, swoosh, swish", "Thump, thud", "Thunk", "Electronic tuner", "Effects unit", "Chorus effect", "Basketball bounce", "Bang", "Slap, smack", "Whack, thwack", "Smash, crash", "Breaking", "Bouncing", "Whip", "Flap", "Scratch", "Scrape", "Rub", "Roll", "Crushing", "Crumpling, crinkling", "Tearing", "Beep, bleep", "Ping", "Ding", "Clang", "Squeal", "Creak", "Rustle", "Whir", "Clatter", "Sizzle", "Clicking", "Clickety-clack", "Rumble", "Plop", "Jingle, tinkle", "Hum", "Zing", "Boing", "Crunch", "Silence", "Sine wave", "Harmonic", "Chirp tone", "Sound effect", "Pulse", "Inside, small room", "Inside, large room or hall", "Inside, public space", "Outside, urban or manmade", "Outside, rural or natural", "Reverberation", "Echo", "Noise", "Environmental noise", "Static", "Mains hum", "Distortion", "Sidetone", "Cacophony", "White noise", "Pink noise", "Throbbing", "Vibration", "Television", "Radio", "Field recording"] \ No newline at end of file diff --git a/analysis/templates/analysis/analyse.html b/analysis/templates/analysis/analyse.html new file mode 100644 index 0000000..bae0381 --- /dev/null +++ b/analysis/templates/analysis/analyse.html @@ -0,0 +1,15 @@ +{% extends 'base.html' %}{% load static event_extras %}{% block content %} +

Analyse audio

Inspect a recording. You choose whether it enters review.

+{{ browser_config|json_script:'boomcast-browser-config' }} +
+{% csrf_token %} +{% if form.errors %}{% endif %} + +

No file selected

+{% if browser_config.browserProcessingBeta %}{% endif %} + + + +
{% if error %}{% elif result %}

Result

{% for prediction in result.predictions %}

{{ prediction.class }} · {{ prediction.score|percentage }}

{% endfor %}{% if event %}

Submitted as report #{{ event.pk }} for review.

{% else %}

This sample was not saved.

{% endif %}
{% endif %}
+

+{% endblock %} diff --git a/analysis/tests/__init__.py b/analysis/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/analysis/tests/test_policy.py b/analysis/tests/test_policy.py new file mode 100644 index 0000000..563149f --- /dev/null +++ b/analysis/tests/test_policy.py @@ -0,0 +1,11 @@ +from django.test import TestCase +from analysis.models import BrowserProcessingSettings +class PolicyTests(TestCase): + def test_beta_disabled_by_default(self): + response=self.client.get('/api/v1/browser-policy/') + self.assertFalse(response.json()['browser_processing_beta_enabled']) + def test_beta_enabled_has_self_hosted_model(self): + BrowserProcessingSettings.objects.create(browser_processing_beta_enabled=True) + data=self.client.get('/api/v1/browser-policy/').json() + self.assertTrue(data['browser_processing_beta_enabled']) + self.assertEqual(data['model_url'],'/static/browser-yamnet/model.json') diff --git a/analysis/tests/test_upload.py b/analysis/tests/test_upload.py new file mode 100644 index 0000000..5f92f81 --- /dev/null +++ b/analysis/tests/test_upload.py @@ -0,0 +1,16 @@ +from unittest.mock import patch +from django.core.files.uploadedfile import SimpleUploadedFile +from django.test import TestCase,override_settings +from events.models import Event +@override_settings(VITE_USE_DEV_SERVER=True) +class AnalysisTests(TestCase): + @patch('analysis.views.classify',return_value={'predictions':[{'class':'Fireworks','score':0.8}]}) + def test_analysis_only_does_not_persist(self,classify): + file=SimpleUploadedFile('test.wav',b'RIFF',content_type='audio/wav') + self.client.post('/analyse/',{'audio_file':file}) + self.assertFalse(Event.objects.exists()) + @patch('analysis.views.classify',return_value={'predictions':[{'class':'Fireworks','score':0.8}]}) + def test_submission_uses_upload_source(self,classify): + file=SimpleUploadedFile('test.wav',b'RIFF',content_type='audio/wav') + self.client.post('/analyse/',{'audio_file':file,'submit_for_review':'on'}) + self.assertEqual(Event.objects.get().source,'upload') diff --git a/analysis/views.py b/analysis/views.py new file mode 100644 index 0000000..58eb740 --- /dev/null +++ b/analysis/views.py @@ -0,0 +1,30 @@ +from django.http import JsonResponse +from django.shortcuts import render,redirect +from django.db import transaction +from django.utils import timezone +from events.forms import AudioValidationMixin +from events.models import Event +from django import forms +from .models import BrowserProcessingSettings,ClassificationRule +from .services.classifier import classify,ClassifierError +from .services.browser_policy import browser_config,browser_policy as policy_data +class UploadForm(AudioValidationMixin,forms.Form): + audio_file=forms.FileField() + submit_for_review=forms.BooleanField(required=False) +def analyse(request): + files=request.FILES.copy() + if 'audio' in files and 'audio_file' not in files: files['audio_file']=files['audio'] + form=UploadForm(request.POST or None,files or None);result=None;event=None;error=None + if request.method=='POST' and form.is_valid(): + audio=form.cleaned_data['audio_file'] + try: + result=classify(audio) + if form.cleaned_data['submit_for_review']: + with transaction.atomic(): + event=Event.objects.create(source=Event.Source.UPLOAD,submitted_by=request.user if request.user.is_authenticated else None,audio_file=audio,original_filename=audio.name,classifier_response=result,occurred_at=timezone.now()) + except ClassifierError as exc: error=str(exc) + return render(request,'analysis/analyse.html',{'form':form,'result':result,'event':event,'error':error,'browser_config':browser_config()}) +def browser_policy(request): return JsonResponse(policy_data()) +def rules(request,kind): + if kind not in ClassificationRule.RuleType.values: return JsonResponse({'error':'Unknown rule type'},status=404) + return JsonResponse({'rules':list(ClassificationRule.objects.filter(rule_type=kind,enabled=True).values_list('value',flat=True))}) diff --git a/config/__init__.py b/config/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/config/asgi.py b/config/asgi.py new file mode 100644 index 0000000..9002b49 --- /dev/null +++ b/config/asgi.py @@ -0,0 +1,4 @@ +import os +os.environ.setdefault('DJANGO_SETTINGS_MODULE','config.settings') +from django.core.asgi import get_asgi_application +application = get_asgi_application() diff --git a/config/settings.py b/config/settings.py new file mode 100644 index 0000000..ca46289 --- /dev/null +++ b/config/settings.py @@ -0,0 +1,40 @@ +import os +from pathlib import Path +from dotenv import load_dotenv +BASE_DIR=Path(__file__).resolve().parent.parent +load_dotenv(BASE_DIR / ".env", override=False) +BOOMCAST_APP_NAME='BoomCast' +SECRET_KEY=os.environ.get('DJANGO_SECRET_KEY','development-only-change-me') +DEBUG=os.environ.get('DJANGO_DEBUG','0')=='1' +ALLOWED_HOSTS=[host.strip() for host in os.environ.get('DJANGO_ALLOWED_HOSTS','localhost,127.0.0.1').split(',') if host.strip()] +CSRF_TRUSTED_ORIGINS=[origin.strip() for origin in os.environ.get('DJANGO_CSRF_TRUSTED_ORIGINS','').split(',') if origin.strip()] +SECURE_PROXY_SSL_HEADER=('HTTP_X_FORWARDED_PROTO','https') +SESSION_COOKIE_SECURE=not DEBUG +CSRF_COOKIE_SECURE=not DEBUG +INSTALLED_APPS=['django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles','vite_integration','core','events','analysis','devices','notifications'] +MIDDLEWARE=['django.middleware.security.SecurityMiddleware','django.contrib.sessions.middleware.SessionMiddleware','django.middleware.locale.LocaleMiddleware','django.middleware.common.CommonMiddleware','django.middleware.csrf.CsrfViewMiddleware','django.contrib.auth.middleware.AuthenticationMiddleware','django.contrib.messages.middleware.MessageMiddleware','django.middleware.clickjacking.XFrameOptionsMiddleware'] +ROOT_URLCONF='config.urls' +TEMPLATES=[{'BACKEND':'django.template.backends.django.DjangoTemplates','DIRS':[BASE_DIR/'templates'],'APP_DIRS':True,'OPTIONS':{'context_processors':['django.template.context_processors.debug','django.template.context_processors.request','django.contrib.auth.context_processors.auth','django.contrib.messages.context_processors.messages','core.context_processors.brand']}}] +WSGI_APPLICATION='config.wsgi.application' +DATABASES={'default':{'ENGINE':'django.db.backends.sqlite3','NAME':BASE_DIR/'db.sqlite3'}} +AUTH_PASSWORD_VALIDATORS=[] +LANGUAGE_CODE='en' +LANGUAGES=[('en','English'),('nl','Nederlands')] +LOCALE_PATHS=[BASE_DIR/'locale'] +TIME_ZONE='Europe/Amsterdam' +USE_I18N=True +USE_TZ=True +STATIC_URL='static/' +STATIC_ROOT=BASE_DIR/'staticfiles' +MEDIA_ROOT=BASE_DIR/'media' +MEDIA_URL='/media/' +DEFAULT_AUTO_FIELD='django.db.models.BigAutoField' +LOGIN_URL='/login/' +LOGIN_REDIRECT_URL='/' +LOGOUT_REDIRECT_URL='/' +VITE_USE_DEV_SERVER=os.environ.get('VITE_USE_DEV_SERVER','0')=='1' +VITE_DEV_SERVER_URL=os.environ.get('VITE_DEV_SERVER_URL','http://127.0.0.1:5173/') +CLASSIFIER_URL=os.environ.get('CLASSIFIER_URL','') +CLASSIFIER_TIMEOUT=int(os.environ.get('CLASSIFIER_TIMEOUT','30')) +MAX_AUDIO_UPLOAD_SIZE=int(os.environ.get('MAX_AUDIO_UPLOAD_SIZE',str(25*1024*1024))) +BOOMCAST_H3_RESOLUTION=int(os.environ.get('BOOMCAST_H3_RESOLUTION','9')) diff --git a/config/urls.py b/config/urls.py new file mode 100644 index 0000000..fd0b239 --- /dev/null +++ b/config/urls.py @@ -0,0 +1,15 @@ +from django.contrib import admin +from django.contrib.auth import views as auth_views +from django.urls import path +from core import views as core +from events import views as events +from analysis import views as analysis +from devices import views as devices +from notifications import views as notifications +urlpatterns=[ + path('',core.overview,name='overview'),path('report/',events.report,name='report'),path('activity/',events.activity,name='activity'),path('activity//',events.detail,name='event_detail'),path('activity//audio/',events.audio,name='event_audio'),path('map/',events.map_page,name='map'),path('api/v1/map/',events.map_json,name='map_json'), + path('analyse/',analysis.analyse,name='analyse'),path('api/v1/browser-policy/',analysis.browser_policy,name='browser_policy'),path('api/v1/classification-rules//',analysis.rules,name='classification_rules'), + path('settings/',core.settings_view,name='settings'),path('settings/notifications/',notifications.settings_view,name='notification_settings'),path('settings/notifications/test/',notifications.test_notification,name='notification_test'),path('settings/sensors/',devices.sensors,name='sensors'),path('settings/sensors//',devices.sensor_detail,name='sensor_detail'), + path('api/v1/sensors/events/',devices.submit_event,name='sensor_event'),path('api/v1/sensors/heartbeat/',devices.heartbeat,name='sensor_heartbeat'), + path('fireworks/classify/',devices.submit_event),path('fireworks/heartbeat/',devices.heartbeat), + path('login/',auth_views.LoginView.as_view(template_name='registration/login.html'),name='login'),path('logout/',auth_views.LogoutView.as_view(),name='logout'),path('admin/',admin.site.urls)] diff --git a/config/wsgi.py b/config/wsgi.py new file mode 100644 index 0000000..26797b8 --- /dev/null +++ b/config/wsgi.py @@ -0,0 +1,4 @@ +import os +os.environ.setdefault('DJANGO_SETTINGS_MODULE','config.settings') +from django.core.wsgi import get_wsgi_application +application = get_wsgi_application() diff --git a/core/__init__.py b/core/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/core/admin.py b/core/admin.py new file mode 100644 index 0000000..68f145c --- /dev/null +++ b/core/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin +from .models import UserPreference +admin.site.register(UserPreference) diff --git a/core/context_processors.py b/core/context_processors.py new file mode 100644 index 0000000..b8bd4a6 --- /dev/null +++ b/core/context_processors.py @@ -0,0 +1,2 @@ +from django.conf import settings +def brand(request): return {'app_name':settings.BOOMCAST_APP_NAME} diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py new file mode 100644 index 0000000..a9b14ea --- /dev/null +++ b/core/migrations/0001_initial.py @@ -0,0 +1,26 @@ +# Generated by Django 6.1.1 on 2026-10-04 14:20 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='UserPreference', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('language', models.CharField(choices=[('en', 'English'), ('nl', 'Nederlands')], default='en', max_length=2)), + ('theme', models.CharField(choices=[('system', 'System'), ('dark', 'Dark'), ('light', 'Light')], default='system', max_length=6)), + ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/core/migrations/__init__.py b/core/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/core/models.py b/core/models.py new file mode 100644 index 0000000..0d698f2 --- /dev/null +++ b/core/models.py @@ -0,0 +1,6 @@ +from django.conf import settings +from django.db import models +class UserPreference(models.Model): + user=models.OneToOneField(settings.AUTH_USER_MODEL,on_delete=models.CASCADE) + language=models.CharField(max_length=2,choices=[('en','English'),('nl','Nederlands')],default='en') + theme=models.CharField(max_length=6,choices=[('system','System'),('dark','Dark'),('light','Light')],default='system') diff --git a/core/static/core/style.css b/core/static/core/style.css new file mode 100644 index 0000000..29d6af0 --- /dev/null +++ b/core/static/core/style.css @@ -0,0 +1,4 @@ +*{box-sizing:border-box}html{font-family:Inter,system-ui,sans-serif;background:#0d1225;color:#edf1fb}body{margin:0;min-height:100vh}a{color:#a9c7ff}button,input,select{font:inherit}button,.button{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:.65rem 1rem;border:1px solid #697394;border-radius:.7rem;background:#222e4d;color:#fff;cursor:pointer;text-decoration:none}.button{background:#f9b35b;color:#23170b;border-color:#f9b35b;font-weight:700}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #f9b35b;outline-offset:3px}.wrap{width:min(100% - 32px,1140px);margin:auto}.site-header{border-bottom:1px solid #34405b;background:#111a32}.header-inner{min-height:68px;display:flex;align-items:center;gap:2rem}.brand{color:white;font-weight:800;text-decoration:none;font-size:1.25rem}.desktop-nav{display:flex;gap:1.3rem}.desktop-nav a,.user-nav a{text-decoration:none;color:#dce5f9}.user-nav{margin-left:auto}.menu{position:absolute;background:#1c2945;padding:1rem;display:grid;gap:.5rem;z-index:10;right:1rem;border-radius:.6rem}.skip{position:absolute;left:-9999px}.skip:focus{left:1rem;top:1rem;z-index:100}main{padding-block:2rem 5rem}.intro,.page-head{max-width:760px;margin-bottom:1.5rem}.intro{padding-block:2rem}.eyebrow{color:#f9b35b;text-transform:uppercase;font-size:.8rem;letter-spacing:.16em;font-weight:700}h1{font-size:clamp(2.3rem,5vw,4rem);line-height:1.05;margin:.4rem 0 1rem}h2{font-size:1.45rem}.intro p,.page-head p,.muted{color:#aab9d0}.grid{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(260px,1fr);gap:1rem}.card{background:#17223c;border:1px solid #334160;border-radius:1rem;padding:1.3rem;margin-bottom:1rem}.activity-list{display:grid;gap:.7rem}.activity-row{display:flex;flex-wrap:wrap;align-items:center;gap:.4rem 1rem;color:#edf1fb;text-decoration:none}.activity-row strong{flex-basis:100%;font-size:1.2rem}.activity-row small{margin-left:auto;color:#aab9d0}.badge{background:#384567;border-radius:1rem;padding:.25rem .65rem}.form{max-width:720px;display:grid;gap:.8rem}.form label{display:grid;gap:.3rem}.form input:not([type=checkbox]),.form select,.filter input,.filter select{width:100%;max-width:100%;background:#0d1730;color:white;border:1px solid #5d6b88;border-radius:.5rem;padding:.7rem}.form details{border-top:1px solid #45516b;padding-top:1rem}.form details>*{margin-block:.7rem}.filter,.subnav{display:flex;flex-wrap:wrap;align-items:end;gap:.8rem;margin-bottom:1rem}.filter label{min-width:150px}.map{height:min(65vh,620px);min-height:360px;border-radius:1rem;background:#1b2a46}.score{display:grid;grid-template-columns:1fr 1fr auto;gap:.7rem;align-items:center}.score meter{width:100%}dl{display:grid;grid-template-columns:1fr 1fr;gap:.5rem}dt{color:#aab9d0}dd{margin:0}.bottom-nav{display:none}html[data-theme=light]{background:#f4f6fb;color:#17223c}html[data-theme=light] body{background:#f4f6fb;color:#17223c}html[data-theme=light] .card{background:white;color:#17223c}html[data-theme=light] .activity-row{color:#17223c}@media(max-width:700px){.desktop-nav{display:none}.header-inner{min-height:56px}.grid{grid-template-columns:1fr}.intro{padding-block:.7rem}main{padding-block:1rem 6rem}.bottom-nav{display:flex;position:fixed;bottom:0;left:0;right:0;background:#111a32;border-top:1px solid #34405b;justify-content:space-around;padding:.35rem;z-index:20}.bottom-nav a{min-height:48px;display:grid;place-items:center;color:white;text-decoration:none;font-size:.8rem;padding:.4rem}.bottom-nav .primary{background:#f9b35b;color:#23170b;border-radius:.7rem;font-weight:700}}@media(prefers-reduced-motion:reduce){*,*:before,*:after{scroll-behavior:auto!important;animation-duration:.01ms!important;transition-duration:.01ms!important}} +@media(prefers-color-scheme:light){html[data-theme=system] body{background:#f4f6fb;color:#17223c}html[data-theme=system] .card{background:white;color:#17223c}html[data-theme=system] .activity-row{color:#17223c}} + +.activity-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(280px,.8fr);gap:1rem;align-items:start}.detail-rail{position:sticky;top:1rem;max-height:calc(100vh - 2rem);overflow:auto}.detail-rail .grid{display:block}.detail-rail h1{font-size:2rem}.detail-rail .card{padding:.7rem}.detail-rail .score{grid-template-columns:1fr auto}.detail-rail meter{grid-column:1 / -1}@media(max-width:899px){.activity-layout{display:block}.detail-rail{display:none}} diff --git a/core/templates/core/overview.html b/core/templates/core/overview.html new file mode 100644 index 0000000..b582601 --- /dev/null +++ b/core/templates/core/overview.html @@ -0,0 +1 @@ +{% extends 'base.html' %}{% load i18n %}{% block content %}

{{ app_name }}

{% trans 'Hear it. Report it. See the pattern.' %}

{% trans 'A clearer picture of local fireworks activity, with privacy built in.' %}

{% trans 'Report fireworks' %}

{% trans 'Recent activity' %}

{{ reports_today }} reports today

{% for event in recent %}{{ event.primary_label }}{{ event.submitted_at|date:'j M · H:i' }} · {{ event.get_source_display }}{% empty %}

No approved activity yet.

{% endfor %}View all activity →
{% endblock %} \ No newline at end of file diff --git a/core/templates/core/settings.html b/core/templates/core/settings.html new file mode 100644 index 0000000..cf3a817 --- /dev/null +++ b/core/templates/core/settings.html @@ -0,0 +1 @@ +{% extends 'base.html' %}{% block content %}

Settings

Your BoomCast preferences.

{% csrf_token %}

General

{% endblock %} \ No newline at end of file diff --git a/core/views.py b/core/views.py new file mode 100644 index 0000000..5f042df --- /dev/null +++ b/core/views.py @@ -0,0 +1,19 @@ +from django.contrib.auth.decorators import login_required +from django.shortcuts import render,redirect +from django.utils import timezone +from events.models import Event +from .models import UserPreference + +def overview(request): + return render(request,'core/overview.html',{'recent':Event.objects.filter(status='approved')[:5],'reports_today':Event.objects.filter(submitted_at__date=timezone.localdate()).count()}) +@login_required +def settings_view(request): + pref,_=UserPreference.objects.get_or_create(user=request.user) + if request.method=='POST': + language=request.POST.get('language');theme=request.POST.get('theme') + if language in ('en','nl') and theme in ('system','dark','light'): + pref.language=language;pref.theme=theme;pref.save();request.session['django_language']=language + if not request.headers.get('HX-Request'): return redirect('settings') + response=render(request,'core/settings.html',{'preference':pref}) + response.set_cookie('django_language',pref.language,samesite='Lax') + return response diff --git a/devices/__init__.py b/devices/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/devices/admin.py b/devices/admin.py new file mode 100644 index 0000000..5c01985 --- /dev/null +++ b/devices/admin.py @@ -0,0 +1,6 @@ +from django.contrib import admin +from .models import Sensor +@admin.register(Sensor) +class SensorAdmin(admin.ModelAdmin): + list_display=['name','owner','is_active','last_heartbeat','last_submission'] + readonly_fields=['token_prefix','token_hash','last_heartbeat','last_submission','created_at'] diff --git a/devices/migrations/0001_initial.py b/devices/migrations/0001_initial.py new file mode 100644 index 0000000..cf442d8 --- /dev/null +++ b/devices/migrations/0001_initial.py @@ -0,0 +1,32 @@ +# Generated by Django 6.1.1 on 2026-10-04 14:20 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Sensor', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=100)), + ('is_active', models.BooleanField(default=True)), + ('archived_at', models.DateTimeField(blank=True, null=True)), + ('token_prefix', models.CharField(blank=True, db_index=True, editable=False, max_length=15)), + ('token_hash', models.CharField(blank=True, editable=False, max_length=256)), + ('last_heartbeat', models.DateTimeField(blank=True, null=True)), + ('last_submission', models.DateTimeField(blank=True, null=True)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sensors', to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/devices/migrations/__init__.py b/devices/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/devices/models.py b/devices/models.py new file mode 100644 index 0000000..580df91 --- /dev/null +++ b/devices/models.py @@ -0,0 +1,26 @@ +import secrets +from django.conf import settings +from django.contrib.auth.hashers import make_password,check_password +from django.db import models +from django.utils import timezone +class Sensor(models.Model): + name=models.CharField(max_length=100) + owner=models.ForeignKey(settings.AUTH_USER_MODEL,on_delete=models.CASCADE,related_name='sensors') + is_active=models.BooleanField(default=True) + archived_at=models.DateTimeField(null=True,blank=True) + token_prefix=models.CharField(max_length=15,blank=True,editable=False,db_index=True) + token_hash=models.CharField(max_length=256,blank=True,editable=False) + last_heartbeat=models.DateTimeField(null=True,blank=True) + last_submission=models.DateTimeField(null=True,blank=True) + created_at=models.DateTimeField(auto_now_add=True) + def __str__(self): return self.name + def issue_token(self): + token='bc_'+secrets.token_urlsafe(32);self.token_prefix=token[:15];self.token_hash=make_password(token);self.save(update_fields=['token_prefix','token_hash']);return token + def token_matches(self,token): return self.is_active and not self.archived_at and bool(self.token_hash) and check_password(token,self.token_hash) + @property + def heartbeat_status(self): + if not self.last_heartbeat: return 'never seen' + age=(timezone.now()-self.last_heartbeat).total_seconds() + return 'online' if age<=300 else 'delayed' if age<=900 else 'offline' + def archive(self): + self.is_active=False;self.archived_at=timezone.now();self.token_hash='';self.token_prefix='';self.save() diff --git a/devices/services/authentication.py b/devices/services/authentication.py new file mode 100644 index 0000000..c0deab9 --- /dev/null +++ b/devices/services/authentication.py @@ -0,0 +1,8 @@ +from devices.models import Sensor +def authenticate_sensor(request): + header=request.headers.get('Authorization','') + token=header.removeprefix('Bearer ').strip() if header.startswith('Bearer ') else request.headers.get('X-Sensor-Token','') + if not token: return None + for sensor in Sensor.objects.filter(token_prefix=token[:15],is_active=True,archived_at__isnull=True): + if sensor.token_matches(token): return sensor + return None diff --git a/devices/templates/devices/detail.html b/devices/templates/devices/detail.html new file mode 100644 index 0000000..4bee82a --- /dev/null +++ b/devices/templates/devices/detail.html @@ -0,0 +1 @@ +{% extends 'base.html' %}{% block content %}
← Sensors

{{ sensor.name }}

{{ sensor.heartbeat_status }}

{% if token %}

Copy your new token now

{{ token }}
{% endif %}

Last heartbeat: {{ sensor.last_heartbeat|default:'Never' }}

Last submission: {{ sensor.last_submission|default:'Never' }}

{% csrf_token %}
{% endblock %} \ No newline at end of file diff --git a/devices/templates/devices/sensors.html b/devices/templates/devices/sensors.html new file mode 100644 index 0000000..15fd1b3 --- /dev/null +++ b/devices/templates/devices/sensors.html @@ -0,0 +1 @@ +{% extends 'base.html' %}{% block content %}

Sensors

Manage your recording devices.

{% if token %}

Copy your token now

{{ token }}

It will not be shown again.

{% endif %}
{% csrf_token %}

Add sensor

{% for sensor in sensors %}{{ sensor.name }}{{ sensor.heartbeat_status }}{% empty %}

No sensors yet.

{% endfor %}
{% endblock %} \ No newline at end of file diff --git a/devices/tests/__init__.py b/devices/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/devices/tests/test_api.py b/devices/tests/test_api.py new file mode 100644 index 0000000..b86fa00 --- /dev/null +++ b/devices/tests/test_api.py @@ -0,0 +1,22 @@ +from unittest.mock import patch +from django.contrib.auth import get_user_model +from django.core.files.uploadedfile import SimpleUploadedFile +from django.test import TestCase +from devices.models import Sensor +from events.models import Event +class SensorApiTests(TestCase): + def setUp(self): + self.user=get_user_model().objects.create_user('owner') + self.sensor=Sensor.objects.create(name='Garden',owner=self.user) + self.token=self.sensor.issue_token() + def test_invalid_and_archived_tokens_rejected(self): + self.assertEqual(self.client.post('/api/v1/sensors/heartbeat/',HTTP_AUTHORIZATION='Bearer wrong').status_code,401) + self.sensor.archive() + self.assertEqual(self.client.post('/api/v1/sensors/heartbeat/',HTTP_AUTHORIZATION=f'Bearer {self.token}').status_code,401) + @patch('devices.views.classify',return_value={'predictions':[]}) + def test_submission_creates_pending_sensor_event(self,classify): + audio=SimpleUploadedFile('clip.wav',b'RIFF',content_type='audio/wav') + response=self.client.post('/api/v1/sensors/events/',{'audio_file':audio},HTTP_AUTHORIZATION=f'Bearer {self.token}') + self.assertEqual(response.status_code,201) + self.assertEqual(Event.objects.get().source,'sensor') + self.assertEqual(Event.objects.get().status,'pending') diff --git a/devices/tests/test_tokens.py b/devices/tests/test_tokens.py new file mode 100644 index 0000000..5b86af5 --- /dev/null +++ b/devices/tests/test_tokens.py @@ -0,0 +1,15 @@ +from django.contrib.auth import get_user_model +from django.test import TestCase +from devices.models import Sensor +from devices.services.authentication import authenticate_sensor +from django.test import RequestFactory +class SensorTokenTests(TestCase): + def test_token_hashed_and_archive_revokes(self): + user=get_user_model().objects.create_user('owner') + sensor=Sensor.objects.create(name='Garden',owner=user) + token=sensor.issue_token() + self.assertNotIn(token,sensor.token_hash) + request=RequestFactory().post('/',HTTP_AUTHORIZATION=f'Bearer {token}') + self.assertEqual(authenticate_sensor(request),sensor) + sensor.archive() + self.assertIsNone(authenticate_sensor(request)) diff --git a/devices/views.py b/devices/views.py new file mode 100644 index 0000000..9208a1a --- /dev/null +++ b/devices/views.py @@ -0,0 +1,50 @@ +from django.contrib.auth.decorators import login_required +from django.db import transaction +from django.http import JsonResponse +from django.shortcuts import render,get_object_or_404,redirect +from django.utils import timezone +from django.views.decorators.csrf import csrf_exempt +from .models import Sensor +from .services.authentication import authenticate_sensor +from analysis.services.classifier import classify,ClassifierError +from events.models import Event +from notifications.services import notify_event +@login_required +def sensors(request): + token=None + if request.method=='POST': + name=request.POST.get('name','').strip()[:100] + if name: + sensor=Sensor.objects.create(name=name,owner=request.user);token=sensor.issue_token() + return render(request,'devices/sensors.html',{'sensors':Sensor.objects.filter(owner=request.user,archived_at__isnull=True),'token':token}) +@login_required +def sensor_detail(request,pk): + sensor=get_object_or_404(Sensor,pk=pk,owner=request.user);token=None + if request.method=='POST': + action=request.POST.get('action') + if action=='rotate': token=sensor.issue_token() + elif action=='archive': sensor.archive();return redirect('sensors') + elif action=='toggle': sensor.is_active=not sensor.is_active;sensor.save(update_fields=['is_active']) + elif action=='rename': sensor.name=request.POST.get('name','').strip()[:100] or sensor.name;sensor.save(update_fields=['name']) + return render(request,'devices/detail.html',{'sensor':sensor,'token':token}) +@csrf_exempt +def heartbeat(request): + if request.method!='POST': return JsonResponse({'error':'POST required'},status=405) + sensor=authenticate_sensor(request) + if not sensor: return JsonResponse({'error':'Unauthorized'},status=401) + sensor.last_heartbeat=timezone.now();sensor.save(update_fields=['last_heartbeat']) + return JsonResponse({'status':'ok'}) +@csrf_exempt +def submit_event(request): + if request.method!='POST': return JsonResponse({'error':'POST required'},status=405) + sensor=authenticate_sensor(request) + if not sensor: return JsonResponse({'error':'Unauthorized'},status=401) + audio=request.FILES.get('audio_file') or request.FILES.get('file') + if not audio: return JsonResponse({'error':'Audio required'},status=400) + try: result=classify(audio) + except ClassifierError as exc: return JsonResponse({'error':str(exc)},status=502) + with transaction.atomic(): + event=Event.objects.create(source=Event.Source.SENSOR,sensor=sensor,audio_file=audio,original_filename=audio.name,classifier_response=result,occurred_at=timezone.now()) + sensor.last_heartbeat=timezone.now();sensor.last_submission=sensor.last_heartbeat;sensor.save(update_fields=['last_heartbeat','last_submission']) + transaction.on_commit(lambda:notify_event(event)) + return JsonResponse({'id':event.pk,'status':event.status},status=201) diff --git a/events/__init__.py b/events/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/events/admin.py b/events/admin.py new file mode 100644 index 0000000..e85047d --- /dev/null +++ b/events/admin.py @@ -0,0 +1,19 @@ +from django.contrib import admin +from django.utils.html import format_html +from .models import Event +from .services.review import review +@admin.register(Event) +class EventAdmin(admin.ModelAdmin): + list_display=['id','status','source','primary_label','primary_score','occurrences','sensor','submitted_at','reviewed_at'] + list_filter=['status','source','submitted_at','sensor','visually_confirmed'] + readonly_fields=['status','submitted_at','reviewed_at','reviewed_by','audio_preview','classifier_response'] + actions=['approve_selected','reject_selected'] + def audio_preview(self,obj): + if obj.pk and obj.audio_file: return format_html('',obj.pk) + return '—' + @admin.action(description='Approve selected') + def approve_selected(self,request,queryset): + for event in queryset: review(event,request.user,True) + @admin.action(description='Reject selected') + def reject_selected(self,request,queryset): + for event in queryset: review(event,request.user,False) diff --git a/events/forms.py b/events/forms.py new file mode 100644 index 0000000..8366ba2 --- /dev/null +++ b/events/forms.py @@ -0,0 +1,24 @@ +from django import forms +from django.conf import settings +from .models import Event +class AudioValidationMixin: + def clean_audio_file(self): + audio=self.cleaned_data.get('audio_file') + if audio and audio.size>settings.MAX_AUDIO_UPLOAD_SIZE: raise forms.ValidationError('Audio is too large.') + if audio and not audio.name.lower().endswith(('.wav','.mp3','.m4a','.ogg','.webm','.mp4','.aac','.aif','.aiff','.flac','.opus','.weba')): raise forms.ValidationError('Unsupported audio format.') + return audio +class ReportForm(AudioValidationMixin,forms.Form): + occurrences=forms.IntegerField(min_value=1,max_value=100,initial=1) + latitude=forms.FloatField(required=False,widget=forms.HiddenInput) + longitude=forms.FloatField(required=False,widget=forms.HiddenInput) + direction_degrees=forms.FloatField(required=False,min_value=0,max_value=359.999,widget=forms.HiddenInput) + direction_accuracy_degrees=forms.FloatField(required=False,min_value=0,widget=forms.HiddenInput) + direction_source=forms.CharField(required=False,max_length=32,widget=forms.HiddenInput) + visually_confirmed=forms.TypedChoiceField(required=False,choices=[('','Unknown'),('true','Yes'),('false','No')],coerce=lambda v:{'true':True,'false':False}.get(v)) + audio_file=forms.FileField(required=False) + def clean(self): + data=super().clean();lat=data.get('latitude');lon=data.get('longitude') + if (lat is None)!=(lon is None): raise forms.ValidationError('Both coordinates are required.') + if lat is not None and not -90<=lat<=90: self.add_error('latitude','Invalid latitude.') + if lon is not None and not -180<=lon<=180: self.add_error('longitude','Invalid longitude.') + return data diff --git a/events/migrations/0001_initial.py b/events/migrations/0001_initial.py new file mode 100644 index 0000000..81d88cd --- /dev/null +++ b/events/migrations/0001_initial.py @@ -0,0 +1,46 @@ +# Generated by Django 6.1.1 on 2026-10-04 14:20 + +import django.db.models.deletion +import django.utils.timezone +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('devices', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Event', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('status', models.CharField(choices=[('pending', 'Pending review'), ('approved', 'Approved'), ('rejected', 'Rejected')], db_index=True, default='pending', max_length=8)), + ('source', models.CharField(choices=[('manual', 'Manual report'), ('sensor', 'Sensor'), ('upload', 'Uploaded sample')], max_length=8)), + ('audio_file', models.FileField(blank=True, upload_to='event_audio/%Y/%m/%d')), + ('original_filename', models.CharField(blank=True, max_length=255)), + ('classifier_response', models.JSONField(blank=True, default=dict)), + ('occurrences', models.PositiveIntegerField(default=1)), + ('visually_confirmed', models.BooleanField(blank=True, null=True)), + ('h3_cell', models.CharField(blank=True, db_index=True, max_length=20)), + ('direction_degrees', models.FloatField(blank=True, null=True)), + ('direction_accuracy_degrees', models.FloatField(blank=True, null=True)), + ('direction_source', models.CharField(blank=True, max_length=32)), + ('submitted_at', models.DateTimeField(db_index=True, default=django.utils.timezone.now)), + ('occurred_at', models.DateTimeField(default=django.utils.timezone.now)), + ('reviewed_at', models.DateTimeField(blank=True, null=True)), + ('rejection_reason', models.TextField(blank=True)), + ('reviewed_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reviewed_events', to=settings.AUTH_USER_MODEL)), + ('sensor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='events', to='devices.sensor')), + ('submitted_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reports', to=settings.AUTH_USER_MODEL)), + ], + options={ + 'ordering': ['-submitted_at'], + }, + ), + ] diff --git a/events/migrations/__init__.py b/events/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/events/models.py b/events/models.py new file mode 100644 index 0000000..529a422 --- /dev/null +++ b/events/models.py @@ -0,0 +1,52 @@ +import math +from django.conf import settings +from django.core.exceptions import ValidationError +from django.db import models +from django.utils import timezone +class Event(models.Model): + class Status(models.TextChoices): + PENDING='pending','Pending review';APPROVED='approved','Approved';REJECTED='rejected','Rejected' + class Source(models.TextChoices): + MANUAL='manual','Manual report';SENSOR='sensor','Sensor';UPLOAD='upload','Uploaded sample' + status=models.CharField(max_length=8,choices=Status.choices,default=Status.PENDING,db_index=True) + source=models.CharField(max_length=8,choices=Source.choices) + submitted_by=models.ForeignKey(settings.AUTH_USER_MODEL,null=True,blank=True,on_delete=models.SET_NULL,related_name='reports') + sensor=models.ForeignKey('devices.Sensor',null=True,blank=True,on_delete=models.SET_NULL,related_name='events') + audio_file=models.FileField(upload_to='event_audio/%Y/%m/%d',blank=True) + original_filename=models.CharField(max_length=255,blank=True) + classifier_response=models.JSONField(default=dict,blank=True) + occurrences=models.PositiveIntegerField(default=1) + visually_confirmed=models.BooleanField(null=True,blank=True) + h3_cell=models.CharField(max_length=20,blank=True,db_index=True) + direction_degrees=models.FloatField(null=True,blank=True) + direction_accuracy_degrees=models.FloatField(null=True,blank=True) + direction_source=models.CharField(max_length=32,blank=True) + submitted_at=models.DateTimeField(default=timezone.now,db_index=True) + occurred_at=models.DateTimeField(default=timezone.now) + reviewed_at=models.DateTimeField(null=True,blank=True) + reviewed_by=models.ForeignKey(settings.AUTH_USER_MODEL,null=True,blank=True,on_delete=models.SET_NULL,related_name='reviewed_events') + rejection_reason=models.TextField(blank=True) + class Meta: ordering=['-submitted_at'] + def __str__(self): return f'{self.get_source_display()} #{self.pk}' + def clean(self): + errors={} + if self.occurrences<1: errors['occurrences']='Must be at least one.' + if self.direction_degrees is not None and (not math.isfinite(self.direction_degrees) or not 0<=self.direction_degrees<360): errors['direction_degrees']='Must be between 0 and 360.' + if self.direction_accuracy_degrees is not None and (not math.isfinite(self.direction_accuracy_degrees) or self.direction_accuracy_degrees<0): errors['direction_accuracy_degrees']='Must be non-negative.' + if errors: raise ValidationError(errors) + @property + def predictions(self): + value=self.classifier_response.get('predictions',[]) + return value if isinstance(value,list) else [] + @property + def primary_prediction(self): return self.predictions[0] if self.predictions else {} + @property + def primary_label(self): return self.primary_prediction.get('class','Fireworks reported' if self.source=='manual' else 'No prediction') + @property + def primary_score(self): + try: return f"{float(self.primary_prediction.get('score',0))*100:.1f}%" + except (ValueError,TypeError): return '—' + @property + def duration(self): return self.classifier_response.get('duration_seconds','—') + @property + def peak_predictions(self): return self.classifier_response.get('peak_predictions',[]) diff --git a/events/services/__init__.py b/events/services/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/events/services/map_data.py b/events/services/map_data.py new file mode 100644 index 0000000..a1198b4 --- /dev/null +++ b/events/services/map_data.py @@ -0,0 +1,25 @@ +from collections import defaultdict +from datetime import date as date_type +import h3 +from events.models import Event + +def map_data(params): + qs=Event.objects.filter(status=Event.Status.APPROVED).exclude(h3_cell='') + source=params.get('source') + if source in Event.Source.values: qs=qs.filter(source=source) + date=params.get('date') + if date: + try: date_type.fromisoformat(date) + except ValueError: return [] + qs=qs.filter(occurred_at__date=date) + cells=defaultdict(lambda:{'occurrences':0,'events':0,'dates':set(),'sources':set(),'visual_confirmed':None,'directions':[]}) + for event in qs: + cell=cells[event.h3_cell];cell['occurrences']+=event.occurrences;cell['events']+=1;cell['dates'].add(event.occurred_at.date().isoformat());cell['sources'].add(event.source) + if event.visually_confirmed is True: cell['visual_confirmed']=True + if event.direction_degrees is not None: cell['directions'].append({'degrees':event.direction_degrees,'accuracy_degrees':event.direction_accuracy_degrees}) + result=[] + for key,item in cells.items(): + try: boundary=[[lat,lon] for lat,lon in h3.cell_to_boundary(key)];center=list(h3.cell_to_latlng(key)) + except (ValueError,h3.H3Error): continue + result.append({'h3_cell':key,'boundary':boundary,'center':center,'occurrences':item['occurrences'],'events':item['events'],'dates':sorted(item['dates']),'sources':sorted(item['sources']),'visually_confirmed':item['visual_confirmed'],'directions':item['directions']}) + return result diff --git a/events/services/reporting.py b/events/services/reporting.py new file mode 100644 index 0000000..49071f6 --- /dev/null +++ b/events/services/reporting.py @@ -0,0 +1,13 @@ +import h3 +from django.conf import settings +from django.db import transaction +from django.utils import timezone +from events.models import Event +from notifications.services import notify_event + +def create_manual_report(data,user=None): + now=timezone.now();lat=data.get('latitude');lon=data.get('longitude') + with transaction.atomic(): + event=Event.objects.create(source=Event.Source.MANUAL,submitted_by=user if user and user.is_authenticated else None,submitted_at=now,occurred_at=now,occurrences=data['occurrences'],h3_cell=h3.latlng_to_cell(lat,lon,settings.BOOMCAST_H3_RESOLUTION) if lat is not None else '',visually_confirmed=data.get('visually_confirmed'),direction_degrees=data.get('direction_degrees'),direction_accuracy_degrees=data.get('direction_accuracy_degrees'),direction_source=data.get('direction_source') or '',audio_file=data.get('audio_file') or '',original_filename=getattr(data.get('audio_file'),'name','')) + transaction.on_commit(lambda:notify_event(event)) + return event diff --git a/events/services/review.py b/events/services/review.py new file mode 100644 index 0000000..e30f73a --- /dev/null +++ b/events/services/review.py @@ -0,0 +1,12 @@ +from django.db import transaction +from django.utils import timezone +from events.models import Event +@transaction.atomic +def review(event,reviewer,approve,reason=''): + if event.status!=Event.Status.PENDING: return event + event.status=Event.Status.APPROVED if approve else Event.Status.REJECTED + event.reviewed_at=timezone.now();event.reviewed_by=reviewer;event.rejection_reason=reason + if not approve and event.audio_file: + file=event.audio_file;event.audio_file='';event.save();transaction.on_commit(file.delete) + else: event.save() + return event diff --git a/events/templates/events/activity.html b/events/templates/events/activity.html new file mode 100644 index 0000000..c897e94 --- /dev/null +++ b/events/templates/events/activity.html @@ -0,0 +1 @@ +{% extends 'base.html' %}{% load i18n %}{% block content %}

{% trans 'Archive' %}

{% trans 'Activity' %}

Reviewed reports and recordings.

{% endblock %} \ No newline at end of file diff --git a/events/templates/events/detail.html b/events/templates/events/detail.html new file mode 100644 index 0000000..c3443ec --- /dev/null +++ b/events/templates/events/detail.html @@ -0,0 +1 @@ +{% extends 'base.html' %}{% load event_extras %}{% block content %}
← Activity

{{ event.primary_label }}

{{ event.get_source_display }} · {{ event.occurred_at|date:'j M Y · H:i' }} · Reviewed

Classification

{% for prediction in event.predictions %}
{{ prediction.class }}{{ prediction.score }}{{ prediction.score|percentage }}
{% empty %}

No classifier result; this was a manual report.

{% endfor %}

Notable moments

{% for peak in event.peak_predictions %}

{{ peak.class }} · {{ peak.score|percentage }}

{% empty %}

No notable moments recorded.

{% endfor %}
{% endblock %} \ No newline at end of file diff --git a/events/templates/events/map.html b/events/templates/events/map.html new file mode 100644 index 0000000..fb890ee --- /dev/null +++ b/events/templates/events/map.html @@ -0,0 +1 @@ +{% extends 'base.html' %}{% block content %}

Activity map

Approved reports grouped by coarse H3 area.

Map unavailable? Browse the activity archive.

{% endblock %} \ No newline at end of file diff --git a/events/templates/events/report.html b/events/templates/events/report.html new file mode 100644 index 0000000..9a11a46 --- /dev/null +++ b/events/templates/events/report.html @@ -0,0 +1 @@ +{% extends 'base.html' %}{% load i18n %}{% block content %}

{% trans 'Contribute' %}

{% trans 'Report fireworks' %}

{% trans 'Tell us what you heard. Details are optional.' %}

{% if event %}

Report received

Report #{{ event.pk }} is pending review.

{% if event.h3_cell %}Coarse area captured{% else %}No location{% endif %} · {% if event.direction_degrees != None %}Direction captured{% else %}No direction{% endif %} · {% if event.audio_file %}Audio attached{% else %}No audio{% endif %}

Report another View activity
{% else %}

What did you hear?

{% csrf_token %}{{ form.non_field_errors }}{{ form.occurrences }}{{ form.occurrences.errors }}

When did you hear it? Now

Add details or evidence (optional)

Your precise position is converted to an H3 area before storage. The map never receives your exact phone location.

{{ form.latitude }}{{ form.longitude }}

{{ form.direction_degrees }}{{ form.direction_accuracy_degrees }}{{ form.direction_source }}{{ form.visually_confirmed }}{{ form.audio_file }}{{ form.audio_file.errors }}
{% endif %}{% endblock %} \ No newline at end of file diff --git a/events/templatetags/__init__.py b/events/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/events/templatetags/event_extras.py b/events/templatetags/event_extras.py new file mode 100644 index 0000000..2a2a018 --- /dev/null +++ b/events/templatetags/event_extras.py @@ -0,0 +1,6 @@ +from django import template +register=template.Library() +@register.filter +def percentage(value): + try: return f'{float(value)*100:.1f}%' + except (TypeError,ValueError): return '—' diff --git a/events/tests/__init__.py b/events/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/events/tests/test_pipeline.py b/events/tests/test_pipeline.py new file mode 100644 index 0000000..ebf7d37 --- /dev/null +++ b/events/tests/test_pipeline.py @@ -0,0 +1,32 @@ +from django.contrib.auth import get_user_model +from django.test import TestCase, override_settings +from django.urls import reverse +from events.models import Event +from events.services.review import review + +@override_settings(VITE_USE_DEV_SERVER=True) +class EventPipelineTests(TestCase): + def test_manual_report_stores_only_h3_area(self): + response=self.client.post('/report/',{'occurrences':3,'latitude':52.1,'longitude':5.1}) + self.assertEqual(response.status_code,200) + event=Event.objects.get() + self.assertEqual(event.source,'manual') + self.assertEqual(event.status,'pending') + self.assertTrue(event.h3_cell) + self.assertNotIn('latitude',[field.name for field in Event._meta.fields]) + self.assertNotIn('52.1',self.client.get('/api/v1/map/').content.decode()) + def test_invalid_count_creates_nothing(self): + self.client.post('/report/',{'occurrences':0}) + self.assertFalse(Event.objects.exists()) + def test_review_keeps_same_row_and_controls_feed(self): + user=get_user_model().objects.create_user('reviewer',password='x',is_staff=True) + event=Event.objects.create(source='manual') + self.assertEqual(len(self.client.get('/api/v1/map/').json()['cells']),0) + review(event,user,True) + self.assertEqual(Event.objects.get().pk,event.pk) + self.assertContains(self.client.get('/activity/'),'Fireworks reported') + def test_rejected_absent_from_activity(self): + user=get_user_model().objects.create_user('reviewer',password='x',is_staff=True) + event=Event.objects.create(source='manual') + review(event,user,False) + self.assertNotContains(self.client.get('/activity/'),'Fireworks reported') diff --git a/events/views.py b/events/views.py new file mode 100644 index 0000000..1d2425f --- /dev/null +++ b/events/views.py @@ -0,0 +1,32 @@ +from django.http import JsonResponse,FileResponse,Http404 +from datetime import date as date_type +from django.shortcuts import render,get_object_or_404 +from .forms import ReportForm +from .models import Event +from .services.reporting import create_manual_report +from .services.map_data import map_data + +def report(request): + form=ReportForm(request.POST or None,request.FILES or None);event=None + if request.method=='POST' and form.is_valid(): event=create_manual_report(form.cleaned_data,request.user) + template='events/report.html' + return render(request,template,{'form':form,'event':event}) +def activity(request): + qs=Event.objects.filter(status=Event.Status.APPROVED) + source=request.GET.get('source','') + if source in Event.Source.values: qs=qs.filter(source=source) + date=request.GET.get('date','') + if date: + try: date_type.fromisoformat(date);qs=qs.filter(occurred_at__date=date) + except ValueError: qs=qs.none() + return render(request,'events/activity.html',{'events':qs[:100],'source':source,'date':date}) +def detail(request,pk): + event=get_object_or_404(Event,pk=pk,status=Event.Status.APPROVED) + return render(request,'events/detail.html',{'event':event}) +def audio(request,pk): + event=get_object_or_404(Event,pk=pk) + if not request.user.is_staff and not (event.status==Event.Status.APPROVED and request.user.is_authenticated and request.user.pk==event.submitted_by_id): raise Http404 + if not event.audio_file: raise Http404 + return FileResponse(event.audio_file.open('rb'),as_attachment=False) +def map_page(request): return render(request,'events/map.html') +def map_json(request): return JsonResponse({'cells':map_data(request.GET)}) diff --git a/frontend/src/entries/admin-audio-preview.js b/frontend/src/entries/admin-audio-preview.js new file mode 100644 index 0000000..9b9f461 --- /dev/null +++ b/frontend/src/entries/admin-audio-preview.js @@ -0,0 +1,2 @@ +import "../styles/pages/admin-audio-preview.css"; +import "../scripts/admin-audio-preview.js"; diff --git a/frontend/src/entries/app.js b/frontend/src/entries/app.js new file mode 100644 index 0000000..0514a3b --- /dev/null +++ b/frontend/src/entries/app.js @@ -0,0 +1,2 @@ +import "../scripts/boomcast-page.js"; +import "../scripts/audio-upload.js"; diff --git a/frontend/src/main.js b/frontend/src/main.js new file mode 100644 index 0000000..7cc8c43 --- /dev/null +++ b/frontend/src/main.js @@ -0,0 +1 @@ +// Replace this optional entry point with your project's client-side code. diff --git a/frontend/src/scripts/admin-audio-preview.js b/frontend/src/scripts/admin-audio-preview.js new file mode 100644 index 0000000..95d7e82 --- /dev/null +++ b/frontend/src/scripts/admin-audio-preview.js @@ -0,0 +1,2 @@ +const t = window.BOOMCAST_I18N || {}; +document.querySelectorAll('.audio-preview').forEach(function(box){var button=box.querySelector('.audio-play'),audio=box.querySelector('audio'),label=box.querySelector('.audio-play__label'),status=box.querySelector('.audio-status');button.addEventListener('click',function(){if(!audio.src){audio.src=button.dataset.audioUrl;button.classList.add('is-loading');status.textContent=(t.loadingRecording || 'Loading recording…');}if(audio.paused){audio.play().catch(function(){button.classList.remove('is-loading');status.textContent=(t.couldNotPlay || 'Could not play this recording.');});}else{audio.pause();}});audio.addEventListener('playing',function(){button.classList.remove('is-loading');label.textContent=(t.pauseRecording || 'Pause recording');status.textContent=(t.playingNow || 'Playing now');});audio.addEventListener('pause',function(){if(!audio.ended){label.textContent=(t.resumeRecording || 'Resume recording');status.textContent=(t.paused || 'Paused');}});audio.addEventListener('ended',function(){label.textContent=(t.replayRecording || 'Replay recording');status.textContent=(t.finished || 'Finished');});audio.addEventListener('waiting',function(){button.classList.add('is-loading');status.textContent=(t.buffering || 'Buffering…');});audio.addEventListener('canplay',function(){button.classList.remove('is-loading');});audio.addEventListener('error',function(){button.classList.remove('is-loading');status.textContent=(t.couldNotLoad || 'Could not load this recording.');});}); \ No newline at end of file diff --git a/frontend/src/scripts/audio-preprocessor.js b/frontend/src/scripts/audio-preprocessor.js new file mode 100644 index 0000000..6e1a7c2 --- /dev/null +++ b/frontend/src/scripts/audio-preprocessor.js @@ -0,0 +1,31 @@ +const RATE = 16000; + +export class AudioPreprocessor { + static async prepare(file, { signal } = {}) { + if (signal?.aborted) throw new DOMException("Cancelled", "AbortError"); + console.log("[BoomCast][YAMNet] Preparing local classification."); + const AudioContextClass = window.AudioContext || window.webkitAudioContext; + if (!AudioContextClass || !(window.OfflineAudioContext || window.webkitOfflineAudioContext)) throw new Error("Browser audio decoding unavailable"); + const context = new AudioContextClass(); + try { + const decoded = await context.decodeAudioData(await file.arrayBuffer()); + if (signal?.aborted) throw new DOMException("Cancelled", "AbortError"); + if (!decoded.duration || !Number.isFinite(decoded.duration)) throw new Error("Invalid audio duration"); + const OfflineContextClass = window.OfflineAudioContext || window.webkitOfflineAudioContext; + const offline = new OfflineContextClass(1, Math.ceil(decoded.duration * RATE), RATE); + const source = offline.createBufferSource(); + source.buffer = decoded; + source.connect(offline.destination); + source.start(); + const rendered = await offline.startRendering(); + if (signal?.aborted) throw new DOMException("Cancelled", "AbortError"); + const waveform = rendered.getChannelData(0).slice(); + console.log("[BoomCast][YAMNet] Waveform prepared.", { + sampleRate: RATE, samples: waveform.length, durationSeconds: waveform.length / RATE, + }); + return waveform; + } finally { + await context.close().catch(() => {}); + } + } +} diff --git a/frontend/src/scripts/audio-upload.js b/frontend/src/scripts/audio-upload.js new file mode 100644 index 0000000..01a5ad3 --- /dev/null +++ b/frontend/src/scripts/audio-upload.js @@ -0,0 +1,409 @@ +const form = document.querySelector(".upload-form"); + +if (form) { + const t = window.BOOMCAST_I18N || {}; + const dropZone = form.querySelector("#drop-zone"); + const fileInput = form.querySelector("#audio-file"); + const fileName = form.querySelector("#file-name"); + const circle = form.querySelector("#upload-progress-circle"); + const iconContent = form.querySelector("#upload-icon-content"); + const submit = form.querySelector('button[type="submit"]'); + const cancel = form.querySelector(".upload-cancel"); + const results = form.querySelector("#classification-results"); + const gatePanel = form.querySelector("#browser-gate"); + const gateTitle = form.querySelector("#browser-gate-title"); + const gateMessage = form.querySelector("#browser-gate-message"); + const gateChoose = form.querySelector("#browser-gate-choose"); + const gateOverride = form.querySelector("#browser-gate-override"); + const status = document.querySelector("#upload-status"); + const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)"); + const browserToggle = form.querySelector("#browser-processing-toggle"); + const configElement = document.querySelector("#boomcast-browser-config"); + let browserConfig = { browserProcessingBeta: false }; + try { browserConfig = JSON.parse(configElement?.textContent || "{}"); } + catch (error) { console.error("[BoomCast][BrowserBeta] Configuration unavailable:", error); } + const browserAvailable = browserConfig.browserProcessingBeta === true && Boolean(browserToggle); + if (browserToggle) browserToggle.checked = false; + const audioAccept = fileInput.accept; + const videoAccept = ",video/*,.mp4,.mov,.m4v,.webm,.mkv,.avi"; + const browserModeEnabled = () => browserAvailable && browserToggle.checked; + const isVideoFile = (file) => Boolean(file) && + (file.type.startsWith("video/") || (!file.type && /\.(mp4|mov|m4v|webm|mkv|avi)$/i.test(file.name || ""))); + let browserProcessor = null; + let browserProcessorPromise = null; + let sourceFile = null; + + async function getBrowserProcessor() { + if (browserProcessor) return browserProcessor; + browserProcessorPromise ||= import("./browser-submission-processor.js").then(({ BrowserSubmissionProcessor }) => { + browserProcessor = new BrowserSubmissionProcessor(browserConfig); + console.log("[BoomCast][BrowserBeta] Coordinator initialised."); + return browserProcessor; + }).catch((error) => { + browserProcessorPromise = null; + throw error; + }); + return browserProcessorPromise; + } + const states = ["idle", "file-selected", "uploading", "processing", "success", "error", "cancelled"]; + let request = null; + let busy = false; + let uploadComplete = false; + let processingTimer = null; + let selectionId = 0; + let selectionController = null; + let selectedResult = null; + let preparationPending = false; + let preparationFailed = false; + let gateBlocked = false; + if (!browserAvailable) { + console.log("[BoomCast][BrowserBeta] Feature disabled globally; using existing server flow."); + } else { + console.log("[BoomCast][BrowserBeta] Browser processing disabled by user; using existing server flow."); + } + + function setUploadState(state, { progress = null, message = "" } = {}) { + for (const name of states) form.classList.toggle(`audio-upload--${name}`, name === state); + const active = state === "uploading" || state === "processing"; + busy = active; + submit.disabled = active; + fileInput.disabled = active; + if (browserToggle) browserToggle.disabled = active; + cancel.hidden = !active; + if (active) form.setAttribute("aria-busy", "true"); + else form.removeAttribute("aria-busy"); + + if (state === "uploading") { + circle.setAttribute("role", "progressbar"); + circle.setAttribute("aria-label", t.uploadingAudio || "Uploading audio"); + circle.setAttribute("aria-valuemin", "0"); + circle.setAttribute("aria-valuemax", "100"); + if (progress === null) { + circle.removeAttribute("aria-valuenow"); + circle.setAttribute("aria-valuetext", t.uploadingAudio || "Uploading audio"); + iconContent.textContent = "↑"; + } else { + circle.setAttribute("aria-valuenow", String(progress)); + circle.setAttribute("aria-valuetext", `${t.uploadingAudio || "Uploading audio"}: ${progress}%`); + circle.style.setProperty("--upload-progress", `${progress}%`); + iconContent.textContent = `${progress}%`; + } + status.textContent = progress === null ? (t.uploadingAudio || "Uploading audio…") : ""; + } else { + circle.removeAttribute("role"); + circle.removeAttribute("aria-label"); + circle.removeAttribute("aria-valuemin"); + circle.removeAttribute("aria-valuemax"); + circle.removeAttribute("aria-valuenow"); + circle.removeAttribute("aria-valuetext"); + iconContent.textContent = state === "processing" ? "◉" : state === "success" ? "✓" : state === "error" ? "!" : "↑"; + status.textContent = message || ({ + processing: t.uploadCompleteAnalysing || "Upload complete. Analysing audio…", + success: t.analysisComplete || "Analysis complete.", + cancelled: t.uploadCancelled || "Upload cancelled.", + }[state] || ""); + } + } + + function showFile(file) { + fileName.textContent = file ? file.name : (t.noFile || "No file selected"); + if (!busy) setUploadState(file ? "file-selected" : "idle"); + if (file) console.log("[boomcast-upload] file selected", { size: file.size, type: file.type }); + } + + function fail(message, detail) { + clearTimeout(processingTimer); + console.error("[boomcast-upload] upload failed", detail); + setUploadState("error", { message }); + request = null; + } + + function finishUpload(xhr) { + if (uploadComplete) return; + uploadComplete = true; + console.log("[boomcast-upload] upload complete, awaiting classifier"); + // Give a real 100% progress event one paint before showing the separate server state. + processingTimer = window.setTimeout(() => { + if (request === xhr && busy) setUploadState("processing"); + }, 120); + } + + function handleResponse(xhr) { + clearTimeout(processingTimer); + request = null; + let fragment; + try { + fragment = new DOMParser().parseFromString(xhr.responseText, "text/html"); + } catch (error) { + fail(t.analysisFailed || "Analysis could not be completed.", error); + return; + } + const card = fragment.querySelector(".results-card"); + if (!card) { + fail(t.analysisFailed || "Analysis could not be completed.", `Unexpected response (HTTP ${xhr.status})`); + return; + } + results.replaceChildren(document.importNode(card, true)); + window.htmx?.process(results); + if (xhr.status >= 400 || card.classList.contains("error-card")) { + const message = card.querySelector("p")?.textContent || (t.analysisFailed || "Analysis could not be completed."); + console.error("[boomcast-upload] classification failed", { status: xhr.status, message }); + setUploadState("error", { message }); + return; + } + console.log("[boomcast-upload] classification response received", xhr.status); + setUploadState("success"); + if (form.dataset.scrollToResults === "true") { + results.scrollIntoView({ behavior: reducedMotion.matches ? "instant" : "smooth", block: "start" }); + } + } + + function selectFile(file) { + selectionId += 1; + selectionController?.abort(); + browserProcessor?.cancel(); + selectionController = null; + selectedResult = null; + preparationPending = false; + preparationFailed = false; + gateBlocked = false; + gatePanel.hidden = true; + if (!busy) results.replaceChildren(); + showFile(file); + if (!busy) { submit.disabled = false; cancel.hidden = true; } + if (!file) return; + console.log("[BoomCast][BrowserBeta] File selected.", { mimeType: file.type, sizeBytes: file.size }); + if (!browserModeEnabled()) { + console.log("[BoomCast][BrowserBeta] Server mode selected."); + if (isVideoFile(file)) { + preparationFailed = true; + submit.disabled = true; + status.textContent = t.serverAudioOnly || "Server processing currently accepts audio recordings. Choose an audio file or enable browser processing."; + } + return; + } + console.log("[BoomCast][BrowserBeta] Browser mode selected."); + const id = selectionId; + const controller = new AbortController(); + selectionController = controller; + preparationPending = true; + submit.disabled = true; + cancel.hidden = false; + status.textContent = isVideoFile(file) + ? (t.extractingAudio || "Extracting audio from video…") + : (t.preparingRecording || "Preparing recording…"); + getBrowserProcessor().then((processor) => { + if (id !== selectionId || controller.signal.aborted || !browserModeEnabled()) return null; + processor.setEnabled(true); + return processor.process(file, { signal: controller.signal, onState: (state) => { + if (id !== selectionId) return; + status.textContent = state === "checking" ? (t.checkingRecording || "Checking recording…") + : (t.extractingAudio || "Extracting audio from video…"); + } }); + }).then((result) => { + if (!result || id !== selectionId || controller.signal.aborted || !browserModeEnabled()) return; + preparationPending = false; + cancel.hidden = true; + if (isVideoFile(file) && result.file === file) { + preparationFailed = true; + submit.disabled = true; + status.textContent = t.videoExtractionFailed || "Could not extract audio from this video. Please choose an audio recording."; + return; + } + selectedResult = result; + gateBlocked = result.gate === "speech_only" || result.gate === "no_match"; + if (gateBlocked) { + gateTitle.textContent = result.gate === "speech_only" + ? (t.speechGateTitle || "This recording appears to contain speech, but no relevant sound was detected.") + : (t.irrelevantGateTitle || "No relevant sound was detected."); + gateMessage.textContent = result.gate === "speech_only" + ? (t.speechGateMessage || "To protect people’s privacy, this recording will not be uploaded automatically. You can still submit it for manual review.") + : (t.irrelevantGateMessage || "BoomCast could not identify a sound this service currently looks for. You can still submit it for manual review."); + gatePanel.hidden = false; + submit.disabled = true; + status.textContent = t.gateChooseMessage || "Recording checked. Choose another recording or submit for manual review."; + } else { + submit.disabled = false; + status.textContent = result.gate === "unavailable" + ? (t.localUnavailable || "Local checking was unavailable. BoomCast will use normal server processing.") + : isVideoFile(file) + ? (t.videoAudioOnly || "Video processed on this device. Only extracted audio will be sent if you submit.") + : (t.readyToSubmit || "Ready to submit."); + } + }).catch((error) => { + if (id !== selectionId || !browserModeEnabled()) return; + console.error("[BoomCast][BrowserBeta] Unexpected browser pipeline error:", error); + preparationPending = false; + cancel.hidden = true; + if (isVideoFile(file)) { + preparationFailed = true; + submit.disabled = true; + status.textContent = t.videoExtractionFailed || "Could not extract audio from this video. Please choose an audio recording."; + } else { + console.warn("[BoomCast][BrowserBeta] Browser pipeline unavailable; falling back to server."); + selectedResult = { file, metadata: null, gate: "unavailable" }; + submit.disabled = false; + status.textContent = t.localUnavailable || "Local checking was unavailable. BoomCast will use normal server processing."; + } + }); + } + + function restoreOriginalFile() { + if (!sourceFile || fileInput.files[0] === sourceFile) return; + try { + const transfer = new DataTransfer(); + transfer.items.add(sourceFile); + fileInput.files = transfer.files; + } catch (error) { + console.error("[BoomCast][Cleanup] Could not restore original selection:", error); + fileInput.value = ""; + sourceFile = null; + } + } + + browserToggle?.addEventListener("change", () => { + if (browserModeEnabled()) { + console.log("[BoomCast][BrowserBeta] Browser processing enabled by user."); + fileInput.accept = audioAccept + videoAccept; + selectFile(sourceFile || fileInput.files[0]); + } else { + console.log("[BoomCast][BrowserBeta] Switching to server processing."); + console.log("[BoomCast][Cleanup] Cancelling active browser processing job."); + selectionController?.abort(); + browserProcessor?.setEnabled(false); + browserProcessor?.cleanup(); + fileInput.accept = audioAccept; + restoreOriginalFile(); + selectFile(sourceFile || fileInput.files[0]); + } + }); + + fileInput.addEventListener("change", () => { sourceFile = fileInput.files[0] || null; selectFile(sourceFile); }); + ["dragenter", "dragover"].forEach((name) => dropZone.addEventListener(name, (event) => { + event.preventDefault(); + if (!busy) dropZone.classList.add("dragging"); + })); + ["dragleave", "drop"].forEach((name) => dropZone.addEventListener(name, (event) => { + event.preventDefault(); + dropZone.classList.remove("dragging"); + })); + dropZone.addEventListener("drop", (event) => { + if (busy || !event.dataTransfer.files.length) return; + fileInput.files = event.dataTransfer.files; + sourceFile = fileInput.files[0] || null; + selectFile(sourceFile); + }); + + function startUpload(file, metadata = null) { + // HTMX's later Pending action also reads the native file input. Replace a + // video with its extracted WAV so no subsequent form action can send video. + if (fileInput.files[0] !== file) { + try { + const transfer = new DataTransfer(); + transfer.items.add(file); + fileInput.files = transfer.files; + if (fileInput.files[0] !== file) throw new Error("Prepared audio could not replace video in form"); + } catch (error) { + console.error("[BoomCast][BrowserBeta] Could not secure native form upload:", error); + preparationFailed = true; + submit.disabled = true; + status.textContent = (t.secureVideoFailed || "Could not prepare this video for upload. Please choose an audio recording."); + return; + } + } + const formData = new FormData(form); + formData.set("audio", file); + if (metadata) formData.set("browser_processing_metadata", JSON.stringify(metadata)); + + const xhr = new XMLHttpRequest(); + request = xhr; + uploadComplete = false; + results.replaceChildren(); + setUploadState("uploading"); + console.log("[boomcast-upload] upload started", { size: file.size, type: file.type }); + xhr.open("POST", form.action); + xhr.upload.addEventListener("progress", (progressEvent) => { + if (uploadComplete) return; + if (!progressEvent.lengthComputable || progressEvent.total <= 0) return; + const percent = Math.min(100, Math.round(progressEvent.loaded / progressEvent.total * 100)); + if (percent !== Number(circle.getAttribute("aria-valuenow"))) { + setUploadState("uploading", { progress: percent }); + console.log("[boomcast-upload] upload progress", percent); + } + if (progressEvent.loaded >= progressEvent.total && !uploadComplete) { + finishUpload(xhr); + } + }); + xhr.upload.addEventListener("load", () => { + finishUpload(xhr); + }); + xhr.addEventListener("load", () => handleResponse(xhr)); + xhr.addEventListener("error", () => fail(t.uploadFailed || "Upload failed. Check your connection and try again.", "Network error")); + xhr.addEventListener("timeout", () => fail(t.uploadFailed || "Upload failed. Check your connection and try again.", "Request timed out")); + xhr.addEventListener("abort", () => { + clearTimeout(processingTimer); + request = null; + setUploadState("cancelled"); + console.log("[boomcast-upload] upload cancelled"); + }); + xhr.send(formData); + } + + // Capture before HTMX's bubbling submit listener; the hx-* attributes remain a fallback. + form.addEventListener("submit", (event) => { + event.preventDefault(); + event.stopImmediatePropagation(); + if (busy || preparationPending || preparationFailed || gateBlocked) return; + if (!form.reportValidity()) return; + const file = fileInput.files[0]; + if (!file) return; + if (!browserModeEnabled()) { startUpload(file); return; } + if (selectedResult) { startUpload(selectedResult.file, selectedResult.metadata); return; } + // Unknown audio types retain the existing server flow. + startUpload(file); + }, true); + + gateChoose.addEventListener("click", () => fileInput.click()); + gateOverride.addEventListener("click", () => { + if (!browserModeEnabled() || !gateBlocked || !selectedResult || busy || preparationPending) return; + console.warn("[BoomCast][Gate] User explicitly overrode local gate."); + console.log("[BoomCast][Gate] Submission will enter manual review."); + const metadata = { ...selectedResult.metadata, browser_override: true }; + selectedResult.metadata = metadata; + gateBlocked = false; + gatePanel.hidden = true; + startUpload(selectedResult.file, metadata); + }); + cancel.addEventListener("click", () => { + if (preparationPending) { + selectionController?.abort(); + browserProcessor?.cancel(); + selectionId += 1; + preparationPending = false; + preparationFailed = true; + submit.disabled = true; + cancel.hidden = true; + status.textContent = t.extractionCancelled || (t.preparationCancelled || "Preparation cancelled. Choose a recording to continue."); + } else request?.abort(); + }); + window.addEventListener("pageshow", (event) => { + if (event.persisted) { + request?.abort(); + selectionController?.abort(); + browserProcessor?.cancel(); + selectionId += 1; + selectedResult = null; + sourceFile = null; + if (browserToggle) { browserToggle.checked = false; fileInput.accept = audioAccept; } + browserProcessor?.setEnabled(false); + preparationPending = false; + preparationFailed = false; + gateBlocked = false; + gatePanel.hidden = true; + submit.disabled = false; + fileInput.value = ""; + results.replaceChildren(); + showFile(); + } + }); +} diff --git a/frontend/src/scripts/boomcast-page.js b/frontend/src/scripts/boomcast-page.js new file mode 100644 index 0000000..dc8848e --- /dev/null +++ b/frontend/src/scripts/boomcast-page.js @@ -0,0 +1,79 @@ +import { createBurstListener } from "./burst-listener.js"; +const locationButton = document.querySelector('#capture-location'); +locationButton?.addEventListener('click', () => { + const status = document.querySelector('#location-status'); + if (!navigator.geolocation) { status.textContent = 'Location unavailable'; return; } + status.textContent = 'Finding location…'; + navigator.geolocation.getCurrentPosition(({coords}) => { + document.querySelector('#id_latitude').value = coords.latitude; + document.querySelector('#id_longitude').value = coords.longitude; + status.textContent = 'Coarse area will be saved'; + }, () => { status.textContent = 'Location unavailable; you can still report'; }); +}); +const directionButton = document.querySelector('#capture-direction'); +let listening = false; +const onDirection = event => { + const heading = Number.isFinite(event.webkitCompassHeading) ? event.webkitCompassHeading : event.absolute && Number.isFinite(event.alpha) ? (360 - event.alpha) % 360 : null; + if (heading === null) return; + document.querySelector('#id_direction_degrees').value = heading; + document.querySelector('#id_direction_accuracy_degrees').value = Number.isFinite(event.webkitCompassAccuracy) && event.webkitCompassAccuracy >= 0 ? event.webkitCompassAccuracy : ''; + document.querySelector('#id_direction_source').value = 'device'; + document.querySelector('#direction-status').textContent = `${heading.toFixed(0)}° captured`; +}; +directionButton?.addEventListener('click', async () => { + if (listening) { window.removeEventListener('deviceorientation', onDirection); listening = false; directionButton.textContent = 'Capture direction'; return; } + if (!('DeviceOrientationEvent' in window)) { document.querySelector('#direction-status').textContent = 'Compass unavailable'; return; } + if (typeof DeviceOrientationEvent.requestPermission === 'function' && await DeviceOrientationEvent.requestPermission() !== 'granted') return; + window.addEventListener('deviceorientation', onDirection); listening = true; directionButton.textContent = 'Stop capturing'; +}); +const mapElement = document.querySelector('#map'); +if (mapElement && window.L) { + const map = L.map(mapElement).setView([52.1326, 5.2913], 7); + L.tileLayer('https://{s}.tile.openstreetmap.de/{z}/{x}/{y}.png', { maxZoom: 18, attribution: '© OpenStreetMap contributors' }).addTo(map); + const layer = L.layerGroup().addTo(map); + const loadMap = async () => { + const query = new URLSearchParams(new FormData(document.querySelector('#map-filters'))); + const response = await fetch(`/api/v1/map/?${query}`); + const { cells } = await response.json(); + layer.clearLayers(); + const bounds = []; + for (const cell of cells) { + L.polygon(cell.boundary, {color:'#f9b35b'}).addTo(layer).bindPopup(`${cell.events} reports · ${cell.occurrences} occurrences`); + for (const direction of cell.directions || []) { + const angle = direction.degrees * Math.PI / 180; + const length = 0.0015; + const from = cell.center; + const to = [from[0] + Math.cos(angle) * length, from[1] + Math.sin(angle) * length / Math.max(0.2, Math.cos(from[0] * Math.PI / 180))]; + L.polyline([from, to], { color: '#f9b35b', weight: 3 }).addTo(layer).bindTooltip(`Direction ${direction.degrees.toFixed(0)}°${direction.accuracy_degrees === null ? '' : ` ±${direction.accuracy_degrees.toFixed(0)}°`}`); + } + bounds.push(...cell.boundary); + } + if (bounds.length) map.fitBounds(bounds); + }; + document.querySelector('#map-filters').addEventListener('submit', event => { event.preventDefault(); loadMap(); }); + loadMap(); +} +const reportForm = document.querySelector('#manual-report-form'); +if (reportForm) { + const listener = createBurstListener(); + reportForm.addEventListener('submit', async event => { + if (!listener?.active || reportForm.dataset.burstReady) return; + event.preventDefault(); + event.stopImmediatePropagation(); + const clip = await listener.clipForSubmission(); + if (clip) { + const transfer = new DataTransfer(); transfer.items.add(clip); + reportForm.querySelector('#id_audio_file').files = transfer.files; + } + reportForm.dataset.burstReady = '1'; + reportForm.requestSubmit(); + }, true); +} + +document.body.addEventListener('htmx:beforeRequest', event => { + const link = event.detail.elt; + if (link?.matches?.('a[data-detail]') && window.innerWidth < 900) { + event.preventDefault(); + window.location.href = link.href; + } +}); diff --git a/frontend/src/scripts/browser-submission-gate.js b/frontend/src/scripts/browser-submission-gate.js new file mode 100644 index 0000000..0970156 --- /dev/null +++ b/frontend/src/scripts/browser-submission-gate.js @@ -0,0 +1,17 @@ +export class BrowserSubmissionGate { + static evaluate(predictions, policy) { + console.log("[BoomCast][Gate] Evaluating browser classification."); + const relevant = new Set((policy.whitelist || []).map((name) => name.toLowerCase())); + const speechNames = new Set((policy.privacy_sensitive_speech || []).map((name) => name.toLowerCase())); + const matchThreshold = Number(policy.thresholds?.relevance ?? 0.5); + const speechThreshold = Number(policy.thresholds?.speech ?? 0.5); + const matches = predictions.filter((item) => relevant.has(item.class.toLowerCase()) && item.score >= matchThreshold); + const speechDetected = predictions.some((item) => speechNames.has(item.class.toLowerCase()) && item.score >= speechThreshold); + console.log("[BoomCast][Gate] Relevant whitelist matches:", matches); + console.log("[BoomCast][Gate] Speech detected:", speechDetected); + const result = matches.length ? "whitelist_match" : speechDetected ? "speech_only" : "no_match"; + console.log(`[BoomCast][Gate] Decision: ${result.toUpperCase()}`); + if (result !== "whitelist_match") console.log("[BoomCast][Gate] Automatic upload suppressed."); + return { result, speechDetected, matches }; + } +} diff --git a/frontend/src/scripts/browser-submission-processor.js b/frontend/src/scripts/browser-submission-processor.js new file mode 100644 index 0000000..6090b4a --- /dev/null +++ b/frontend/src/scripts/browser-submission-processor.js @@ -0,0 +1,139 @@ +const PREFIX = "[BoomCast][BrowserBeta]"; + +export function readBrowserProcessingConfig() { + const element = document.querySelector("#boomcast-browser-config"); + if (!element) return { browserProcessingBeta: false }; + try { return JSON.parse(element.textContent); } + catch (error) { + console.error(`${PREFIX} Configuration unavailable:`, error); + return { browserProcessingBeta: false }; + } +} + +export class BrowserSubmissionProcessor { + constructor(config = readBrowserProcessingConfig(), extractVideo = null, dependencies = {}) { + this.config = config; + this.extractVideo = extractVideo; + this.dependencies = dependencies; + this.userEnabled = false; + this.activeController = null; + } + + isAvailable() { return this.config.browserProcessingBeta === true; } + + isEnabled() { return this.isAvailable() && this.userEnabled; } + + setEnabled(enabled) { + if (!enabled) this.cancel(); + this.userEnabled = this.isAvailable() && enabled === true; + console.log(`${PREFIX} ${this.userEnabled ? "Browser processing enabled by user." : "Browser processing disabled by user; using existing server flow."}`); + } + + cancel() { + this.activeController?.abort(); + this.activeController = null; + } + + async process(file, { signal, onState } = {}) { + this.cancel(); + const controller = new AbortController(); + this.activeController = controller; + const abort = () => controller.abort(); + signal?.addEventListener("abort", abort, { once: true }); + if (signal?.aborted) controller.abort(); + try { + return await this.prepare(file, { signal: controller.signal, onState }); + } finally { + signal?.removeEventListener("abort", abort); + if (this.activeController === controller) this.activeController = null; + } + } + + canProcess(file) { + return this.isEnabled() && Boolean(file) && (BrowserSubmissionProcessor.isAudio(file) || BrowserSubmissionProcessor.isVideo(file)); + } + + static isAudio(file) { + return Boolean(file) && (file.type.startsWith("audio/") || (!file.type && /\.(aac|aif|aiff|flac|m4a|mp3|ogg|opus|wav|weba)$/i.test(file.name || ""))); + } + + static isVideo(file) { + return Boolean(file) && (file.type.startsWith("video/") || (!file.type && /\.(mp4|mov|m4v|webm|mkv|avi)$/i.test(file.name || ""))); + } + + async prepare(file, { signal, onState = () => {} } = {}) { + if (!this.canProcess(file)) return { file, metadata: null, gate: "unavailable" }; + console.log(`${PREFIX} Initialising beta submission pipeline.`); + console.log(`${PREFIX} File selected:`, { type: file?.type || "", size: file?.size || 0 }); + const video = BrowserSubmissionProcessor.isVideo(file); + const controller = new AbortController(); + const abort = () => controller.abort(); + signal?.addEventListener("abort", abort, { once: true }); + const timeout = setTimeout(() => controller.abort(), 5000); + let policy; + try { + const response = await fetch(this.config.policyUrl, { + cache: "no-store", credentials: "same-origin", signal: controller.signal, + }); + if (!response.ok) throw new Error(`Policy HTTP ${response.status}`); + policy = await response.json(); + if (!policy.browser_processing_beta_enabled || policy.version !== this.config.policyVersion) { + console.log(`${PREFIX} Browser beta disabled or policy changed; using legacy submission flow.`); + return { file, metadata: null, gate: "unavailable" }; + } + } catch (error) { + if (signal?.aborted) throw error; + console.error(`${PREFIX} Policy unavailable:`, error); + if (video) throw error; + return { file, metadata: null, gate: "unavailable" }; + } finally { + clearTimeout(timeout); + signal?.removeEventListener("abort", abort); + } + if (signal?.aborted) throw new DOMException("Cancelled", "AbortError"); + let preparedFile = file; + if (video) { + const extract = this.extractVideo || (await import("./ffmpeg-video-extractor.js")).extractVideoAudio; + preparedFile = await extract(file, { signal, onState }); + } + const metadata = { + browser_processing_used: video, + browser_processing_version: policy.version, + browser_gate_result: "unavailable", + browser_override: false, + }; + try { + onState("checking"); + const prepareAudio = this.dependencies.prepareAudio || (await import("./audio-preprocessor.js")).AudioPreprocessor.prepare; + let waveform = await prepareAudio(preparedFile, { signal }); + if (signal?.aborted) throw new DOMException("Cancelled", "AbortError"); + try { + const classify = this.dependencies.classify || (await import("./browser-yamnet-classifier.js")).BrowserYamnetClassifier.classify; + const predictions = await classify(waveform, { + modelUrl: policy.model_url, classMapUrl: policy.class_map_url, signal, + }); + if (signal?.aborted) throw new DOMException("Cancelled", "AbortError"); + const evaluate = this.dependencies.evaluate || (await import("./browser-submission-gate.js")).BrowserSubmissionGate.evaluate; + const decision = evaluate(predictions, policy); + metadata.browser_processing_used = true; + metadata.browser_gate_result = decision.result; + metadata.browser_speech_detected = decision.speechDetected; + return { file: preparedFile, metadata, gate: decision.result, predictions: predictions.slice(0, 5) }; + } finally { + waveform = null; + console.log("[BoomCast][Cleanup] Releasing waveform buffers."); + } + } catch (error) { + if (signal?.aborted) throw error; + console.error("[BoomCast][YAMNet] Local classification unavailable:", error); + console.log("[BoomCast][Gate] Falling back to server classification."); + metadata.browser_gate_result = "unavailable"; + return { file: preparedFile, metadata, gate: "unavailable" }; + } + } + + cleanup() { + this.cancel(); + console.log("[BoomCast][Cleanup] Browser beta resources released."); + } +} diff --git a/frontend/src/scripts/browser-yamnet-classifier.js b/frontend/src/scripts/browser-yamnet-classifier.js new file mode 100644 index 0000000..d655575 --- /dev/null +++ b/frontend/src/scripts/browser-yamnet-classifier.js @@ -0,0 +1,70 @@ +const PREFIX = "[BoomCast][YAMNet]"; + +export class BrowserYamnetClassifier { + static async classify(waveform, { modelUrl, classMapUrl, signal, loadTensorFlow } = {}) { + let tf; + let model; + let input; + let output; + const started = performance.now(); + try { + if (signal?.aborted) throw new DOMException("Cancelled", "AbortError"); + console.log(`${PREFIX} Lazy-loading TensorFlow.js.`); + tf = loadTensorFlow ? await loadTensorFlow() : await import("@tensorflow/tfjs"); + if (signal?.aborted) throw new DOMException("Cancelled", "AbortError"); + console.log(`${PREFIX} TensorFlow.js loaded.`); + await tf.ready(); + console.log(`${PREFIX} Backend:`, tf.getBackend()); + console.log(`${PREFIX} Loading model.`); + const [loaded, mappingResponse] = await Promise.all([ + tf.loadGraphModel(modelUrl), + fetch(classMapUrl, { cache: "force-cache", signal }), + ]); + model = loaded; + if (!mappingResponse.ok) throw new Error("YAMNet class map unavailable"); + const classMap = await mappingResponse.json(); + if (!Array.isArray(classMap) || classMap.length !== 521) throw new Error("Invalid YAMNet class map"); + if (signal?.aborted) throw new DOMException("Cancelled", "AbortError"); + console.log(`${PREFIX} Model ready.`); + // YAMNet needs at least one 0.96 s patch, including STFT padding. + const samples = waveform.length < 15600 ? Float32Array.from({ length: 15600 }, (_, i) => waveform[i] || 0) : waveform; + input = tf.tensor1d(samples, "float32"); + console.log(`${PREFIX} Starting inference.`); + const result = await model.executeAsync(input); + output = Array.isArray(result) ? result : [result]; + const scores = output.find((tensor) => tensor.shape.length === 2 && tensor.shape[1] === classMap.length); + if (!scores) throw new Error("YAMNet score output unavailable"); + const values = await scores.data(); + if (signal?.aborted) throw new DOMException("Cancelled", "AbortError"); + const frames = scores.shape[0]; + const predictions = classMap.map((name, index) => { + let score = -1; + let frame = 0; + for (let row = 0; row < frames; row += 1) { + const value = values[row * classMap.length + index]; + if (value > score) { score = value; frame = row; } + } + return { class: name, score, frame, timeSeconds: Number((frame * 0.48).toFixed(2)) }; + }); + predictions.sort((a, b) => b.score - a.score); + console.log(`${PREFIX} Inference completed in`, Math.round(performance.now() - started), "ms."); + console.groupCollapsed(`${PREFIX} Top local predictions`); + console.table(predictions.slice(0, 10)); + console.groupEnd(); + return predictions; + } catch (error) { + console.error(`${PREFIX} Local inference failed:`, error); + throw error; + } finally { + if (tf) console.log(`${PREFIX} TensorFlow memory before cleanup:`, tf.memory()); + console.log("[BoomCast][Cleanup] Disposing YAMNet tensors."); + input?.dispose(); + output?.forEach((tensor) => tensor?.dispose()); + console.log("[BoomCast][Cleanup] Disposing browser YAMNet model."); + model?.dispose(); + console.log("[BoomCast][Cleanup] Releasing waveform buffers."); + if (tf) console.log(`${PREFIX} TensorFlow memory after cleanup:`, tf.memory()); + console.log("[BoomCast][Cleanup] Browser classification cleanup complete."); + } + } +} diff --git a/frontend/src/scripts/burst-listener-worklet.js b/frontend/src/scripts/burst-listener-worklet.js new file mode 100644 index 0000000..1ee64e1 --- /dev/null +++ b/frontend/src/scripts/burst-listener-worklet.js @@ -0,0 +1,83 @@ +class BurstListenerProcessor extends AudioWorkletProcessor { + constructor() { + super(); + this.samples = new Float32Array(Math.ceil(sampleRate * 10)); + this.position = 0; + this.count = 0; + this.interval = 0; + this.energy = 0; + this.peak = 0; + this.baseline = 0.01; + this.lastTrigger = -sampleRate * 10; + this.postRoll = 0; + this.eventPosition = 0; + this.eventCount = 0; + this.frame = 0; + this.mode = "listening"; + this.port.onmessage = ({ data }) => { + if (data === "snapshot") this.sendClip(this.count); + if (data === "reset") this.reset(); + }; + } + + reset() { + this.samples.fill(0); + this.position = 0; + this.count = 0; + this.interval = 0; + this.energy = 0; + this.peak = 0; + this.baseline = 0.01; + this.lastTrigger = this.frame; + this.postRoll = 0; + this.mode = "listening"; + } + + sendClip(length) { + const clip = new Float32Array(length); + let start = (this.position - length + this.samples.length) % this.samples.length; + for (let i = 0; i < length; i++) clip[i] = this.samples[(start + i) % this.samples.length]; + this.port.postMessage({ type: "clip", samples: clip, sampleRate }, [clip.buffer]); + } + + process(inputs) { + const channel = inputs[0]?.[0]; + if (!channel || this.mode === "captured") return true; + for (let i = 0; i < channel.length; i++) { + const value = channel[i]; + this.samples[this.position] = value; + this.position = (this.position + 1) % this.samples.length; + this.count = Math.min(this.count + 1, this.samples.length); + this.energy += value * value; + this.peak = Math.max(this.peak, Math.abs(value)); + this.interval++; + this.frame++; + if (this.mode === "tail") { + if (--this.postRoll === 0) { + this.mode = "captured"; + this.sendClip(Math.min(this.count, Math.round(sampleRate * 10))); + break; + } + } + if (this.interval >= Math.round(sampleRate / 30)) { + const rms = Math.sqrt(this.energy / this.interval); + this.port.postMessage({ type: "level", value: Math.max(rms, this.peak * 0.5) }); + if (this.mode === "listening" && this.frame > sampleRate && this.frame - this.lastTrigger > sampleRate * 3 + && rms > Math.max(0.075, this.baseline * 5) && this.peak > 0.16) { + this.mode = "tail"; + this.postRoll = Math.round(sampleRate * 2); + this.lastTrigger = this.frame; + this.port.postMessage({ type: "trigger" }); + } else if (this.mode === "listening") { + this.baseline = this.baseline * 0.98 + Math.min(rms, this.baseline * 2) * 0.02; + } + this.interval = 0; + this.energy = 0; + this.peak = 0; + } + } + return true; + } +} + +registerProcessor("burst-listener", BurstListenerProcessor); diff --git a/frontend/src/scripts/burst-listener.js b/frontend/src/scripts/burst-listener.js new file mode 100644 index 0000000..fb3572d --- /dev/null +++ b/frontend/src/scripts/burst-listener.js @@ -0,0 +1,157 @@ +const form = document.querySelector("#manual-report-form"); + +export function createBurstListener() { + if (!form) return null; + const start = document.querySelector("#burst-start"); + const panel = document.querySelector("#burst-panel"); + const heading = document.querySelector("#burst-heading"); + const detail = document.querySelector("#burst-detail"); + const canvas = document.querySelector("#burst-waveform"); + const preview = document.querySelector("#burst-preview"); + const resume = document.querySelector("#burst-resume"); + const discard = document.querySelector("#burst-discard"); + const stop = document.querySelector("#burst-stop"); + const error = document.querySelector("#burst-error"); + const levels = new Float32Array(300); + let levelPosition = 0; + let state = "off"; + let stream, context, source, node, silentOutput, previewUrl, captured, pendingSnapshot; + + function draw() { + const ctx = canvas.getContext("2d"); + ctx.clearRect(0, 0, canvas.width, canvas.height); + ctx.fillStyle = "#ffbd62"; + const width = canvas.width / levels.length; + const scale = Math.max(0.003, ...levels); + for (let i = 0; i < levels.length; i++) { + const value = levels[(levelPosition + i) % levels.length]; + const height = Math.max(2, Math.min(canvas.height, (value / scale) * canvas.height * 0.8)); + ctx.fillRect(i * width, (canvas.height - height) / 2, Math.max(1, width - 1), height); + } + } + + function clearClip() { + captured = null; + preview.pause(); + preview.removeAttribute("src"); + preview.load(); + preview.hidden = true; + if (previewUrl) URL.revokeObjectURL(previewUrl); + previewUrl = null; + } + + function setState(next) { + state = next; + start.hidden = next !== "off"; + panel.hidden = next === "off"; + resume.hidden = discard.hidden = next !== "captured"; + heading.textContent = next === "captured" ? "Sound captured" : next === "tail" ? "Sound detected — finishing clip…" : "Listening for the next sound…"; + detail.textContent = next === "listening" ? "Keeping the most recent ~10 seconds" : next === "captured" ? "Preview the clip or send your report." : ""; + } + + function wav(samples, rate) { + const bytes = new ArrayBuffer(44 + samples.length * 2); + const view = new DataView(bytes); + const write = (offset, value) => { for (let i = 0; i < value.length; i++) view.setUint8(offset + i, value.charCodeAt(i)); }; + write(0, "RIFF"); view.setUint32(4, bytes.byteLength - 8, true); + write(8, "WAVEfmt "); view.setUint32(16, 16, true); + view.setUint16(20, 1, true); view.setUint16(22, 1, true); + view.setUint32(24, rate, true); view.setUint32(28, rate * 2, true); + view.setUint16(32, 2, true); view.setUint16(34, 16, true); + write(36, "data"); view.setUint32(40, samples.length * 2, true); + for (let i = 0; i < samples.length; i++) { + const sample = Math.max(-1, Math.min(1, samples[i])); + view.setInt16(44 + i * 2, sample < 0 ? sample * 32768 : sample * 32767, true); + } + return new Blob([bytes], { type: "audio/wav" }); + } + + function filename() { + return `sound-signal-manual-${new Date().toISOString().replace(/[-:]/g, "").slice(0, 15)}.wav`; + } + + async function begin() { + error.hidden = true; + start.disabled = true; + try { + if (!navigator.mediaDevices?.getUserMedia || !window.AudioWorkletNode) throw new Error("Microphone listening is unavailable in this browser or connection."); + stream = await navigator.mediaDevices.getUserMedia({ audio: { channelCount: 1 }, video: false }); + context = new AudioContext(); + await context.audioWorklet.addModule(new URL("./burst-listener-worklet.js", import.meta.url)); + source = context.createMediaStreamSource(stream); + node = new AudioWorkletNode(context, "burst-listener"); + silentOutput = context.createGain(); + silentOutput.gain.value = 0; + node.port.onmessage = ({ data }) => { + if (data.type === "level" && (state === "listening" || state === "tail")) { + levels[levelPosition] = data.value; + levelPosition = (levelPosition + 1) % levels.length; + draw(); + } else if (data.type === "trigger" && state === "listening") { + setState("tail"); + } else if (data.type === "clip") { + const file = new File([wav(data.samples, data.sampleRate)], filename(), { type: "audio/wav" }); + if (pendingSnapshot) { + pendingSnapshot(file); + pendingSnapshot = null; + } else if (state === "tail") { + clearClip(); + captured = file; + previewUrl = URL.createObjectURL(file); + preview.src = previewUrl; + preview.hidden = false; + setState("captured"); + } + } + }; + source.connect(node); + node.connect(silentOutput).connect(context.destination); + await context.resume(); + levels.fill(0); levelPosition = 0; draw(); + setState("listening"); + } catch (cause) { + await end(); + error.textContent = cause.name === "NotAllowedError" ? "Microphone permission was denied. Manual reporting is still available." : (cause.message || "Microphone capture failed."); + error.hidden = false; + } finally { + start.disabled = false; + } + } + + async function end() { + if (pendingSnapshot) { pendingSnapshot(null); pendingSnapshot = null; } + clearClip(); + node?.disconnect(); source?.disconnect(); silentOutput?.disconnect(); + stream?.getTracks().forEach((track) => track.stop()); + await context?.close(); + stream = context = source = node = silentOutput = null; + levels.fill(0); levelPosition = 0; + setState("off"); + } + + function reset() { + clearClip(); + levels.fill(0); levelPosition = 0; draw(); + node?.port.postMessage("reset"); + if (node) setState("listening"); + } + + start.addEventListener("click", begin); + stop.addEventListener("click", end); + discard.addEventListener("click", reset); + resume.addEventListener("click", reset); + window.addEventListener("pagehide", end); + document.addEventListener("visibilitychange", () => { if (document.hidden) end(); }); + return { + get active() { return state !== "off"; }, + async clipForSubmission() { + if (captured) return captured; + if (state === "off" || !node) return null; + return new Promise((resolve) => { + pendingSnapshot = resolve; + node.port.postMessage("snapshot"); + }); + }, + submissionSucceeded: reset, + }; +} diff --git a/frontend/src/scripts/event-map.js b/frontend/src/scripts/event-map.js new file mode 100644 index 0000000..4c6adad --- /dev/null +++ b/frontend/src/scripts/event-map.js @@ -0,0 +1,101 @@ + const t = window.BOOMCAST_I18N || {}; + + const mapElement = document.getElementById("event-map"); + const h3Resolution = mapElement.dataset.h3Resolution; + const map = L.map(mapElement, { zoomControl: false, scrollWheelZoom: false }).setView([52.1326, 5.2913], 7); + L.control.zoom({ position: "bottomleft" }).addTo(map); + const compassControl = L.control({ position: "topright" }); + compassControl.onAdd = () => { + const compass = L.DomUtil.create("div", "map-compass"); + compass.setAttribute("role", "img"); + compass.setAttribute("aria-label", (t.mapCompass || "Map compass: north is up")); + compass.innerHTML = "NESW↑"; + L.DomEvent.disableClickPropagation(compass); + return compass; + }; + compassControl.addTo(map); + L.tileLayer("https://{s}.tile.openstreetmap.de/{z}/{x}/{y}.png", { + maxZoom: 18, + attribution: "© OpenStreetMap contributors", + }).addTo(map); + + const h3Cells = JSON.parse(document.getElementById("h3-cells-data").textContent); + const reports = JSON.parse(document.getElementById("map-events-data").textContent); + const bounds = L.latLngBounds([]); + + h3Cells.forEach((cell) => { + const polygon = L.polygon(cell.boundary, { + color: "#f59e0b", weight: 2, fillColor: "#f59e0b", fillOpacity: 0.25, + }).addTo(map); + polygon.bindPopup( + "H3 " + cell.cell + "" + + "" + cell.reports + " " + (cell.reports === 1 ? (t.report || "report") : (t.reports || "reports")) + " · " + cell.occurrences + + " " + (cell.occurrences === 1 ? (t.occurrence || "occurrence") : (t.occurrences || "occurrences")) + " · " + (t.resolution || "resolution") + " " + h3Resolution + "" + ); + bounds.extend(L.latLngBounds(cell.boundary)); + }); + + function cardinalDirection(degrees) { + const directions = ["N", "NE", "E", "SE", "S", "SW", "W", "NW"]; + return directions[Math.floor(((degrees + 22.5) % 360) / 45)]; + } + + function destinationPoint(origin, bearingDegrees, distanceMetres) { + const earthRadius = 6378137; + const bearing = bearingDegrees * Math.PI / 180; + const latitude = origin[0] * Math.PI / 180; + const longitude = origin[1] * Math.PI / 180; + const angularDistance = distanceMetres / earthRadius; + const targetLatitude = Math.asin( + Math.sin(latitude) * Math.cos(angularDistance) + + Math.cos(latitude) * Math.sin(angularDistance) * Math.cos(bearing) + ); + const targetLongitude = longitude + Math.atan2( + Math.sin(bearing) * Math.sin(angularDistance) * Math.cos(latitude), + Math.cos(angularDistance) - Math.sin(latitude) * Math.sin(targetLatitude) + ); + return [targetLatitude * 180 / Math.PI, targetLongitude * 180 / Math.PI]; + } + + const reportIcon = L.divIcon({ + className: "", html: "
✦
", iconSize: [37, 37], iconAnchor: [19, 19], + }); + reports.forEach((report) => { + const visualStatus = report.visually_confirmed ? (t.visuallyConfirmed || "Visually confirmed") : (t.notVisuallyConfirmed || "Not visually confirmed"); + let detail = report.occurrences + " " + (report.occurrences === 1 ? (t.occurrence || "occurrence") : (t.occurrences || "occurrences")) + + " · " + visualStatus + "
" + (t.reported || "Reported") + " " + report.reported_on; + if (report.direction_degrees !== null) { + detail += "
" + (t.compassDirection || "Compass direction") + " " + Math.round(report.direction_degrees) + "° (" + cardinalDirection(report.direction_degrees) + ")"; + if (report.direction_accuracy_degrees !== null) { + detail += " (±" + Math.round(report.direction_accuracy_degrees) + "°)"; + } + } + L.marker(report.center, { icon: reportIcon }).addTo(map).bindPopup( + "" + (t.manualReport || "Manual report") + " · H3 " + report.cell + "" + + "" + detail + "" + ); + + if (report.direction_degrees !== null) { + const arrowEnd = destinationPoint(report.center, report.direction_degrees, 900); + L.polyline([report.center, arrowEnd], { color: "#fff7e6", weight: 9, opacity: 0.8 }).addTo(map); + L.polyline([report.center, arrowEnd], { color: "#6d45a0", weight: 5, opacity: 1 }).addTo(map); + const arrowIcon = L.divIcon({ + className: "", + html: "
↑
", + iconSize: [56, 56], iconAnchor: [28, 28], + }); + L.marker(arrowEnd, { icon: arrowIcon, interactive: false }).addTo(map); + } + }); + + if (bounds.isValid()) { + map.fitBounds(bounds.pad(0.18)); + } + + const range = document.getElementById("range"); + if (range) { + document.querySelectorAll("#from-date, #to-date").forEach((input) => { + input.addEventListener("change", () => { range.value = "custom"; }); + }); + } + \ No newline at end of file diff --git a/frontend/src/scripts/ffmpeg-video-extractor.js b/frontend/src/scripts/ffmpeg-video-extractor.js new file mode 100644 index 0000000..e683522 --- /dev/null +++ b/frontend/src/scripts/ffmpeg-video-extractor.js @@ -0,0 +1,82 @@ +const PREFIX = "[BoomCast][FFmpeg]"; + +export class VideoExtractionError extends Error { + constructor(code, cause) { + super(code, { cause }); + this.name = "VideoExtractionError"; + this.code = code; + } +} + +export async function extractVideoAudio(file, { signal, onState = () => {}, createFFmpeg } = {}) { + let ffmpeg; + let inputWritten = false; + let outputWritten = false; + let stage = "module_load_failed"; + const started = performance.now(); + const inputName = "input"; + const outputName = "audio.wav"; + const abort = () => ffmpeg?.terminate(); + signal?.addEventListener("abort", abort, { once: true }); + console.log(`${PREFIX} Video input detected.`, { mimeType: file.type, sizeBytes: file.size }); + try { + if (signal?.aborted) throw new VideoExtractionError("cancelled"); + onState("loading_ffmpeg"); + console.log(`${PREFIX} Starting lazy import.`); + const factory = createFFmpeg || (async () => { + const [{ FFmpeg }, { default: coreURL }, { default: wasmURL }] = await Promise.all([ + import("@ffmpeg/ffmpeg"), + import("@ffmpeg/core?url"), + import("@ffmpeg/core/wasm?url"), + ]); + console.log(`${PREFIX} ffmpeg.wasm module imported.`); + return { ffmpeg: new FFmpeg(), coreURL, wasmURL }; + }); + const runtime = await factory(); + ffmpeg = runtime.ffmpeg; + if (signal?.aborted) throw new VideoExtractionError("cancelled"); + ffmpeg.on?.("log", ({ message }) => console.log(`${PREFIX}[core]`, message)); + stage = "core_load_failed"; + console.log(`${PREFIX} Loading FFmpeg core.`); + await ffmpeg.load({ coreURL: runtime.coreURL, wasmURL: runtime.wasmURL }); + console.log(`${PREFIX} FFmpeg core ready.`); + if (signal?.aborted) throw new VideoExtractionError("cancelled"); + onState("extracting_audio"); + stage = "resource_failed"; + console.log(`${PREFIX} Writing input to virtual filesystem.`); + // One input ArrayBuffer is unavoidable for the FFmpeg virtual filesystem. + inputWritten = true; + await ffmpeg.writeFile(inputName, new Uint8Array(await file.arrayBuffer())); + if (signal?.aborted) throw new VideoExtractionError("cancelled"); + stage = "extraction_failed"; + console.log(`${PREFIX} Starting audio extraction: mono / 16kHz WAV.`); + outputWritten = true; + const exitCode = await ffmpeg.exec(["-i", inputName, "-vn", "-ac", "1", "-ar", "16000", "-c:a", "pcm_s16le", outputName]); + if (exitCode !== 0) throw new VideoExtractionError("invalid_media"); + if (signal?.aborted) throw new VideoExtractionError("cancelled"); + const data = await ffmpeg.readFile(outputName); + if (!data?.byteLength) throw new VideoExtractionError("invalid_media"); + if (data.byteLength > 25 * 1024 * 1024) throw new VideoExtractionError("output_too_large"); + const wav = new File([data], `${file.name.replace(/\.[^.]+$/, "") || "recording"}.wav`, { type: "audio/wav" }); + console.log(`${PREFIX} Audio extraction completed.`, { outputSizeBytes: wav.size }); + console.log(`${PREFIX} Extraction finished in ${Math.round(performance.now() - started)} ms.`); + return wav; + } catch (error) { + const code = signal?.aborted ? "cancelled" : error instanceof VideoExtractionError ? error.code + : error instanceof RangeError ? "resource_failed" : stage; + if (code === "invalid_media") console.warn(`${PREFIX} Unsupported or undecodable video.`); + console.error(`${PREFIX} Audio extraction failed:`, error); + throw new VideoExtractionError(code, error); + } finally { + console.log(`${PREFIX} Removing temporary files.`); + if (ffmpeg?.loaded) { + if (inputWritten) await ffmpeg.deleteFile(inputName).catch(() => {}); + if (outputWritten) await ffmpeg.deleteFile(outputName).catch(() => {}); + } + console.log(`${PREFIX} Terminating worker.`); + ffmpeg?.terminate(); + ffmpeg = null; + signal?.removeEventListener("abort", abort); + console.log(`${PREFIX} Cleanup complete.`); + } +} diff --git a/frontend/src/scripts/legacy-audio-upload.js b/frontend/src/scripts/legacy-audio-upload.js new file mode 100644 index 0000000..acb65d3 --- /dev/null +++ b/frontend/src/scripts/legacy-audio-upload.js @@ -0,0 +1,16 @@ + + const form = document.querySelector('.upload-form'); + const dropZone = document.querySelector('#drop-zone'); + const fileInput = document.querySelector('#audio-file'); + const fileName = document.querySelector('#file-name'); + const status = document.querySelector('#upload-status'); + const showFile = (file) => { fileName.textContent = file ? file.name : 'No file selected'; }; + + fileInput.addEventListener('change', () => showFile(fileInput.files[0])); + ['dragenter', 'dragover'].forEach((eventName) => dropZone.addEventListener(eventName, (event) => { event.preventDefault(); dropZone.classList.add('dragging'); })); + ['dragleave', 'drop'].forEach((eventName) => dropZone.addEventListener(eventName, (event) => { event.preventDefault(); dropZone.classList.remove('dragging'); })); + dropZone.addEventListener('drop', (event) => { const [file] = event.dataTransfer.files; if (!file) return; fileInput.files = event.dataTransfer.files; showFile(file); }); + form.addEventListener('htmx:beforeRequest', () => { status.textContent = 'Analysing your recording…'; form.setAttribute('aria-busy', 'true'); }); + form.addEventListener('htmx:afterRequest', () => { status.textContent = ''; form.removeAttribute('aria-busy'); }); + form.addEventListener('htmx:responseError', () => { status.textContent = 'Analysis could not be completed.'; }); + \ No newline at end of file diff --git a/frontend/src/scripts/manual-report.js b/frontend/src/scripts/manual-report.js new file mode 100644 index 0000000..1dc1964 --- /dev/null +++ b/frontend/src/scripts/manual-report.js @@ -0,0 +1,171 @@ + import { createBurstListener } from "./burst-listener.js"; + const t = window.BOOMCAST_I18N || {}; + + const manualForm = document.querySelector("#manual-report-form"); + const manualSubmit = document.querySelector("#manual-submit"); + const manualStatus = document.querySelector("#manual-submission"); + const latitude = document.querySelector("#manual-latitude"); + const longitude = document.querySelector("#manual-longitude"); + const directionDegrees = document.querySelector("#manual-direction-degrees"); + const directionAccuracy = document.querySelector("#manual-direction-accuracy"); + const captureDirectionButton = document.querySelector("#manual-capture-direction"); + const directionStatus = document.querySelector("#manual-direction-status"); + const directionPanel = document.querySelector("#manual-direction-panel"); + const compass = document.querySelector("#manual-compass"); + const compassRose = document.querySelector("#manual-compass-rose"); + const compassHeading = document.querySelector("#manual-compass-heading"); + const isMobileDevice = /Android|iPhone|iPad|iPod|IEMobile|Opera Mini/.test(navigator.userAgent) + || (navigator.userAgent.includes("Macintosh") && navigator.maxTouchPoints > 1); + if (isMobileDevice) directionPanel.hidden = false; + let orientationListener; + let compassUnavailableTimeout; + let compassRotation = null; + const burstListener = createBurstListener(); + + const isUsableNumber = (value) => Number.isFinite(value); + const cardinalDirection = (heading) => ["N", "NE", "E", "SE", "S", "SW", "W", "NW"][Math.floor(((heading + 22.5) % 360) / 45)]; + const displayDegrees = (value) => Number(value.toFixed(1)).toString(); + + const stopCompassReading = () => { + if (orientationListener) window.removeEventListener("deviceorientation", orientationListener); + window.clearTimeout(compassUnavailableTimeout); + orientationListener = null; + compassUnavailableTimeout = null; + compass.hidden = true; + compassRotation = null; + }; + + const updateCompass = (heading) => { + const targetRotation = -heading; + if (compassRotation === null) { + compassRotation = targetRotation; + compassRose.style.transition = "none"; + compassRose.style.transform = `rotate(${compassRotation}deg)`; + // Restore the short rotation animation after the initial reading. + compassRose.offsetWidth; + compassRose.style.transition = ""; + } else { + const change = ((targetRotation - compassRotation + 540) % 360) - 180; + compassRotation += change; + compassRose.style.transform = `rotate(${compassRotation}deg)`; + } + compassHeading.textContent = `${displayDegrees(heading)}° · ${cardinalDirection(heading)}`; + compass.setAttribute("aria-label", `${t.compassDirection || "Compass direction"} ${displayDegrees(heading)}° ${cardinalDirection(heading)}`); + compass.hidden = false; + }; + + const showCapturedDirection = (heading, accuracy) => { + const accuracyText = accuracy === null ? (t.accuracyUnavailable || "Accuracy unavailable") : (t.accuracy || "Accuracy") + ": ±" + displayDegrees(accuracy) + "°"; + directionStatus.innerHTML = "" + displayDegrees(heading) + "° · " + cardinalDirection(heading) + "
" + accuracyText; + captureDirectionButton.textContent = (t.stopCapture || "Stop direction capture"); + }; + + const listenForCompassReading = () => { + stopCompassReading(); + directionStatus.textContent = (t.pointPhone || "Point the top of your phone toward the sound — direction will update live."); + orientationListener = (event) => { + const isWebKitCompass = "webkitCompassHeading" in event; + const heading = isUsableNumber(event.webkitCompassHeading) + ? event.webkitCompassHeading + : !isWebKitCompass && event.absolute && isUsableNumber(event.alpha) + ? (360 - event.alpha) % 360 + : null; + if (heading === null || heading < 0 || heading >= 360) return; + + const accuracy = isUsableNumber(event.webkitCompassAccuracy) && event.webkitCompassAccuracy >= 0 + ? event.webkitCompassAccuracy + : null; + directionDegrees.value = heading; + directionAccuracy.value = accuracy === null ? "" : accuracy; + showCapturedDirection(heading, accuracy); + updateCompass(heading); + window.clearTimeout(compassUnavailableTimeout); + }; + window.addEventListener("deviceorientation", orientationListener); + compassUnavailableTimeout = window.setTimeout(() => { + stopCompassReading(); + captureDirectionButton.textContent = (t.captureDirection || "Capture direction"); + directionStatus.textContent = (t.compassUnavailable || "Compass unavailable on this device."); + }, 15000); + }; + + const captureDirection = async () => { + if (orientationListener) { + stopCompassReading(); + captureDirectionButton.textContent = (t.captureAgain || "Capture again"); + return; + } + if (!window.isSecureContext) { + directionStatus.textContent = (t.secureCompass || "Compass capture requires a secure HTTPS connection."); + return; + } + if (typeof window.DeviceOrientationEvent === "undefined") { + directionStatus.textContent = (t.compassUnavailable || "Compass unavailable on this device."); + return; + } + if (typeof DeviceOrientationEvent.requestPermission === "function") { + directionStatus.textContent = (t.compassPermission || "Requesting compass permission…"); + try { + if (await DeviceOrientationEvent.requestPermission(true) !== "granted") { + directionStatus.textContent = (t.compassDenied || "Compass permission denied."); + return; + } + } catch (error) { + directionStatus.textContent = (t.compassDenied || "Compass permission denied."); + return; + } + } + listenForCompassReading(); + }; + + const submitManualReport = async () => { + stopCompassReading(); + manualSubmit.disabled = true; + if (burstListener?.active) { + try { + const audio = await burstListener.clipForSubmission(); + const data = new FormData(manualForm); + if (audio) data.append("audio", audio); + const response = await fetch(manualForm.action, { method: "POST", body: data, credentials: "same-origin" }); + const html = await response.text(); + document.querySelector("#manual-submission").outerHTML = html; + if (response.ok) burstListener.submissionSucceeded(); + } catch (error) { + document.querySelector("#manual-submission").textContent = "Could not send the report. Please try again."; + } finally { + manualSubmit.disabled = false; + } + return; + } + if (window.htmx) { + htmx.ajax("POST", manualForm.action, { + source: manualForm, + target: "#manual-submission", + swap: "outerHTML", + }); + } else { + manualForm.submit(); + } + }; + + captureDirectionButton.addEventListener("click", captureDirection); + manualSubmit.addEventListener("click", () => { + if (!navigator.geolocation) { + submitManualReport(); + return; + } + manualStatus.textContent = (t.requestingLocation || "Requesting your optional location…"); + navigator.geolocation.getCurrentPosition( + (position) => { + latitude.value = position.coords.latitude; + longitude.value = position.coords.longitude; + submitManualReport(); + }, + () => submitManualReport(), + { enableHighAccuracy: false, maximumAge: 300000, timeout: 10000 }, + ); + }); + document.body.addEventListener("htmx:afterRequest", (event) => { + if (event.detail.elt === manualForm) manualSubmit.disabled = false; + }); + diff --git a/frontend/src/scripts/theme.js b/frontend/src/scripts/theme.js new file mode 100644 index 0000000..20d6dff --- /dev/null +++ b/frontend/src/scripts/theme.js @@ -0,0 +1,65 @@ +const storageKey = "sound-signal-theme"; +const themes = new Set(["dark", "light"]); + +function savedTheme() { + try { + const value = window.localStorage.getItem(storageKey); + return themes.has(value) ? value : "dark"; + } catch { + return "dark"; + } +} + +function applyTheme(theme, button) { + document.documentElement.dataset.theme = theme; + if (!button) return; + const nextTheme = theme === "dark" ? "light" : "dark"; + const t = window.BOOMCAST_I18N || {}; + button.textContent = nextTheme === "light" ? "☀ " + (t.lightMode || "Light mode") : "☾ " + (t.darkMode || "Dark mode"); + button.setAttribute("aria-label", nextTheme === "light" ? (t.switchToLight || "Switch to light mode") : (t.switchToDark || "Switch to dark mode")); + button.setAttribute("aria-pressed", String(theme === "light")); +} + +function installThemeToggle() { + const button = document.querySelector(".theme-toggle") ?? document.createElement("button"); + if (!button.isConnected) { + button.className = "theme-toggle"; + button.type = "button"; + document.body.append(button); + } + applyTheme(savedTheme(), button); + button.addEventListener("click", () => { + const nextTheme = document.documentElement.dataset.theme === "dark" ? "light" : "dark"; + try { window.localStorage.setItem(storageKey, nextTheme); } catch {} + applyTheme(nextTheme, button); + }); +} + +function installMobileMenu() { + const button = document.querySelector(".fireworks-menu-toggle"); + if (!button) return; + const close = () => { + button.setAttribute("aria-expanded", "false"); + button.setAttribute("aria-label", button.dataset.openLabel); + }; + button.addEventListener("click", () => { + const expanded = button.getAttribute("aria-expanded") !== "true"; + button.setAttribute("aria-expanded", String(expanded)); + button.setAttribute("aria-label", expanded ? button.dataset.closeLabel : button.dataset.openLabel); + }); + document.addEventListener("keydown", (event) => { + if (event.key === "Escape" && button.getAttribute("aria-expanded") === "true") { + close(); + button.focus(); + } + }); + window.matchMedia("(min-width: 44.001rem)").addEventListener("change", close); +} + +applyTheme(savedTheme()); +if (document.readyState === "loading") { + document.addEventListener("DOMContentLoaded", () => { installThemeToggle(); installMobileMenu(); }, { once: true }); +} else { + installThemeToggle(); + installMobileMenu(); +} diff --git a/frontend/src/scripts/user-settings.js b/frontend/src/scripts/user-settings.js new file mode 100644 index 0000000..63259f9 --- /dev/null +++ b/frontend/src/scripts/user-settings.js @@ -0,0 +1,10 @@ +document.querySelector("#ntfy-url")?.addEventListener("input", () => { + document.querySelector("#ntfy-test-result")?.replaceChildren(); +}); + +document.addEventListener("click", async (event) => { + const button = event.target.closest("[data-copy-sensor-token]"); + if (!button) return; + const token = document.querySelector("#sensor-token")?.textContent; + if (token) await navigator.clipboard.writeText(token); +}); diff --git a/frontend/src/styles/components/burst-listener.css b/frontend/src/styles/components/burst-listener.css new file mode 100644 index 0000000..e3b8392 --- /dev/null +++ b/frontend/src/styles/components/burst-listener.css @@ -0,0 +1,9 @@ +.burst-listener { width:min(100%,36rem); margin-top:1rem; } +.burst-listener__button,.burst-listener__actions button { min-height:2.75rem; padding:.65rem 1rem; border:1px solid #ffd18c; border-radius:.7rem; color:#fff2df; font:inherit; font-weight:750; background:#39243a; cursor:pointer; } +.burst-listener__panel { margin-top:.8rem; padding:1rem; border:1px solid #aa7294; border-radius:.8rem; background:#1b1730; color:#fff2df; } +.burst-listener__panel canvas { display:block; width:100%; height:90px; margin:.8rem 0; background:#171225; border-radius:.4rem; } +.burst-listener__panel p { margin:.5rem 0 1rem; color:#efc9dc; } +.burst-listener__panel audio { width:100%; margin-bottom:1rem; } +.burst-listener__actions { display:flex; flex-wrap:wrap; gap:.5rem; } +.burst-listener [hidden] { display:none !important; } +.burst-listener [role="alert"] { color:#ffd18c; } diff --git a/frontend/src/styles/components/fireworks-navigation.css b/frontend/src/styles/components/fireworks-navigation.css new file mode 100644 index 0000000..736e11b --- /dev/null +++ b/frontend/src/styles/components/fireworks-navigation.css @@ -0,0 +1,104 @@ +.fireworks-header { + display: flex; + align-items: center; + justify-content: space-between; + gap: 1rem; + margin-bottom: 3.5rem; +} +.fireworks-brand { + display: flex; + align-items: center; + gap: .7rem; + color: var(--ink, var(--i, #eef3ff)); + font-size: .9rem; + font-weight: 800; + letter-spacing: .1em; + text-decoration: none; + text-transform: uppercase; +} +.fireworks-header .brand-mark { + display: grid; + width: 2.25rem; + aspect-ratio: 1; + place-items: center; + border-radius: .75rem; + color: #141022; + background: linear-gradient(135deg, #fcd34d, #fb7185); + box-shadow: 0 .5rem 1.5rem #fb718550; +} +.fireworks-header__controls { display: flex; align-items: center; gap: .65rem; } +.fireworks-menu-toggle { display: none; } +.fireworks-nav { + display: flex; + gap: .3rem; + padding: .25rem; + border: 1px solid var(--line, var(--l, #2b3d68)); + border-radius: .75rem; + background: #111a31d9; + box-shadow: 0 .5rem 1.5rem #03071440; +} +.fireworks-nav a, +.fireworks-nav button { + padding: .5rem .75rem; + border-radius: .5rem; + color: var(--muted, var(--m, #aab9d8)); + font-size: .86rem; + font-weight: 750; + text-decoration: none; +} +.fireworks-nav form { display: flex; margin: 0; } +.fireworks-nav button { border: 0; background: transparent; font: inherit; cursor: pointer; } +.fireworks-nav a:hover, +.fireworks-nav button:hover { color: var(--ink, var(--i, #eef3ff)); background: #20345f; } +.fireworks-nav a[aria-current="page"] { color: var(--ink, var(--i, #eef3ff)); background: #2a3b67; } +.theme-toggle--inline { + position: static; + flex: 0 0 auto; + min-height: 2.35rem; + padding: .45rem .7rem; + white-space: nowrap; +} +:root[data-theme="light"] .fireworks-nav { + border-color: #cbd9ed; + background: #edf4ff; + box-shadow: 0 .45rem 1.25rem rgba(34, 68, 117, .12); +} +:root[data-theme="light"] .fireworks-nav a, +:root[data-theme="light"] .fireworks-nav button { color: #47617f; } +:root[data-theme="light"] .fireworks-nav a:hover, +:root[data-theme="light"] .fireworks-nav button:hover { color: #234a7b; background: #dceaff; } +:root[data-theme="light"] .fireworks-nav a[aria-current="page"] { + color: #173d6a; + background: #cfe3ff; + box-shadow: inset 0 0 0 1px #9cc0ed; +} +@media (max-width: 44rem) { + .fireworks-header { flex-wrap: wrap; justify-content: flex-start; margin-bottom: 2.5rem; } + .fireworks-menu-toggle { + display: flex; + flex: 0 0 auto; + flex-direction: column; + align-items: center; + justify-content: center; + gap: .3rem; + width: 2.75rem; + height: 2.75rem; + padding: 0; + border: 1px solid var(--theme-line); + border-radius: .7rem; + color: var(--theme-ink); + background: var(--theme-surface-raised); + cursor: pointer; + } + .fireworks-menu-toggle span { width: 1.2rem; height: 2px; border-radius: 2px; background: currentColor; } + .fireworks-menu-toggle:focus-visible { outline: 3px solid #8abaff; outline-offset: 3px; } + .fireworks-header__controls { display: none; flex-basis: 100%; width: 100%; flex-direction: column; align-items: stretch; } + .fireworks-menu-toggle[aria-expanded="true"] ~ .fireworks-header__controls { display: flex; } + .fireworks-nav { flex-direction: column; } + .fireworks-nav a, + .fireworks-nav button { padding: .75rem; } + .fireworks-nav form, + .fireworks-nav button { width: 100%; } + .fireworks-nav button { text-align: left; } + .theme-toggle--inline { width: 100%; } +} diff --git a/frontend/src/styles/components/manual-compass.css b/frontend/src/styles/components/manual-compass.css new file mode 100644 index 0000000..5c270be --- /dev/null +++ b/frontend/src/styles/components/manual-compass.css @@ -0,0 +1,55 @@ +.manual-compass { + display: grid; + justify-items: center; + width: 7rem; + margin: .6rem 0 0 auto; + color: #fff3d7; + font-size: .78rem; + font-weight: 850; + font-variant-numeric: tabular-nums; +} +.manual-compass[hidden] { display: none; } +.manual-compass__dial { + position: relative; + width: 5.75rem; + aspect-ratio: 1; + border: 2px solid #f2d7a8; + border-radius: 50%; + background: radial-gradient(circle, #342441 0 28%, #211a32 75%); + box-shadow: 0 .35rem 1rem #09061566, inset 0 0 0 .25rem #ffffff12; +} +.manual-compass__rose { position: absolute; inset: 0; transition: transform 120ms ease-out; } +.manual-compass__rose span { position: absolute; line-height: 1; } +.manual-compass__north { top: .38rem; left: 50%; color: #ff9e78; transform: translateX(-50%); } +.manual-compass__east { right: .47rem; top: 50%; transform: translateY(-50%); } +.manual-compass__south { bottom: .38rem; left: 50%; transform: translateX(-50%); } +.manual-compass__west { left: .47rem; top: 50%; transform: translateY(-50%); } +.manual-compass__pointer { + position: absolute; + top: -.55rem; + left: 50%; + width: 0; + height: 0; + border-right: .37rem solid transparent; + border-bottom: .65rem solid #ffbd62; + border-left: .37rem solid transparent; + transform: translateX(-50%); + filter: drop-shadow(0 .1rem .15rem #160d1b); +} +.manual-compass__center { + position: absolute; + top: 50%; + left: 50%; + width: .5rem; + aspect-ratio: 1; + border-radius: 50%; + background: #ffbd62; + transform: translate(-50%, -50%); +} +.manual-compass__heading { margin-top: .5rem; white-space: nowrap; } +:root[data-theme="light"] .manual-compass { color: #43243d; } +:root[data-theme="light"] .manual-compass__dial { border-color: #996a9b; background: radial-gradient(circle, #f8ebf8 0 28%, #e8d7e9 75%); } +:root[data-theme="light"] .manual-compass__east, +:root[data-theme="light"] .manual-compass__south, +:root[data-theme="light"] .manual-compass__west { color: #43243d; } +@media (prefers-reduced-motion: reduce) { .manual-compass__rose { transition: none; } } diff --git a/frontend/src/styles/pages/admin-audio-preview.css b/frontend/src/styles/pages/admin-audio-preview.css new file mode 100644 index 0000000..df2db91 --- /dev/null +++ b/frontend/src/styles/pages/admin-audio-preview.css @@ -0,0 +1 @@ +.audio-preview{display:flex;align-items:center;gap:12px;margin:18px 0;padding:14px;border:1px solid #2b3d68;border-radius:10px;background:#14203a}.audio-play{display:inline-flex;align-items:center;gap:9px;border:0;border-radius:999px;padding:10px 15px!important;color:#121a34;font-weight:850;background:linear-gradient(135deg,#99c8ff,#c6adff);cursor:pointer}.audio-play__icon{display:grid;width:22px;height:22px;place-items:center;border-radius:50%;color:#fff;background:#172443}.audio-play.is-loading .audio-play__icon{color:transparent;border:2px solid #263a76;border-top-color:#fff;animation:audio-spin .7s linear infinite}.audio-status{color:#aab9d8;font-size:.85rem}@keyframes audio-spin{to{transform:rotate(360deg)}} \ No newline at end of file diff --git a/frontend/src/styles/pages/admin-login.css b/frontend/src/styles/pages/admin-login.css new file mode 100644 index 0000000..135472d --- /dev/null +++ b/frontend/src/styles/pages/admin-login.css @@ -0,0 +1 @@ +:root{--ink:#edf3ff;--muted:#aab9d8;--line:#2b3d68;--danger:#ff9ea8}*{box-sizing:border-box}body{min-width:320px;min-height:100vh;display:grid;place-items:center;margin:0;padding:1.5rem;color:var(--ink);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:radial-gradient(circle at 8% 0,#263a76,transparent 31rem),radial-gradient(circle at 96% 100%,#512363,transparent 29rem),#090e1d}.card{width:min(100%,27rem);position:relative;overflow:hidden;padding:clamp(2rem,7vw,3.5rem);border:1px solid var(--line);border-radius:1.4rem;background:linear-gradient(145deg,#172443e8,#10182ddd);box-shadow:0 1.75rem 5rem #01030c99;backdrop-filter:blur(16px)}.card:before{content:"";width:12rem;height:12rem;position:absolute;top:-7rem;right:-5rem;border-radius:50%;background:#78a8ef45}.brand{display:flex;align-items:center;gap:.65rem;margin-bottom:2.7rem;font-size:.78rem;font-weight:900;letter-spacing:.14em;text-transform:uppercase}.mark{display:grid;width:2.25rem;aspect-ratio:1;place-items:center;border-radius:.72rem;color:#17132b;font-size:1.1rem;background:linear-gradient(135deg,#fcd34d,#fb7185);box-shadow:0 .5rem 1.5rem #fb718550}.eyebrow{margin:0;color:#bcd4ff;font-size:.75rem;font-weight:800;letter-spacing:.14em;text-transform:uppercase}h1{margin:.55rem 0 .75rem;font-size:clamp(2rem,7vw,3.2rem);line-height:1;letter-spacing:-.06em}.intro{margin:0 0 1.8rem;color:var(--muted);line-height:1.55}.error{margin:0 0 1rem;padding:.75rem;border:1px solid #994957;border-radius:.7rem;color:#ffd6da;font-size:.88rem;background:#551d2b70}label{display:block;margin:1rem 0 .4rem;color:#c7d6f4;font-size:.82rem;font-weight:800}input{width:100%;min-height:2.85rem;padding:.7rem .8rem;border:1px solid #3d5487;border-radius:.7rem;color:var(--ink);font:inherit;background:#0a1123}input:focus{outline:2px solid #9bc8ff;outline-offset:2px}button{width:100%;min-height:2.9rem;margin-top:1.5rem;border:1px solid #b3c9ff;border-radius:.75rem;color:#121a34;font:inherit;font-weight:850;background:linear-gradient(135deg,#99c8ff,#c6adff);box-shadow:0 .65rem 1.75rem #7058dd50;cursor:pointer;transition:transform .2s}button:hover{transform:translateY(-2px)}.foot{margin:1.5rem 0 0;color:#8498c1;font-size:.78rem;text-align:center}@media(prefers-reduced-motion:reduce){button{transition:none}} \ No newline at end of file diff --git a/frontend/src/styles/pages/dashboard.css b/frontend/src/styles/pages/dashboard.css new file mode 100644 index 0000000..7e9a349 --- /dev/null +++ b/frontend/src/styles/pages/dashboard.css @@ -0,0 +1,52 @@ +:root { + --dashboard-ink: #edf3ff; + --dashboard-muted: #aab9d8; + --dashboard-line: #2b3d68; + --dashboard-surface: #111a31; + --dashboard-surface-raised: #172443; +} +body.dashboard-page { + display: block; + min-width: 320px; + min-height: 100vh; + margin: 0; + color: var(--dashboard-ink); + font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; + background: radial-gradient(circle at 8% 0%, #263a76 0, transparent 31rem), radial-gradient(circle at 96% 100%, #512363 0, transparent 29rem), #090e1d; +} +.dashboard-shell { width: min(100% - 2.5rem, 70rem); margin: 0 auto; padding: clamp(2rem, 6vw, 5rem) 0; } +.dashboard-intro { max-width: 44rem; margin-bottom: 2rem; } +.dashboard-kicker { margin: 0 0 .8rem; color: #bfdbfe; font-size: .76rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; } +.dashboard-intro h1 { max-width: 11ch; margin: 0; color: var(--dashboard-ink); font-size: clamp(2.8rem, 7vw, 5.5rem); line-height: .94; letter-spacing: -.065em; } +.dashboard-intro p:last-child { max-width: 42rem; margin: 1.25rem 0 0; color: var(--dashboard-muted); font-size: clamp(1rem, 2vw, 1.16rem); line-height: 1.65; } +.dashboard-section { margin-top: 2.25rem; } +.dashboard-section__header { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 0 0 1rem; } +.dashboard-section__header h2 { margin: .25rem 0 0; color: var(--dashboard-ink); font-size: clamp(1.65rem, 4vw, 2.3rem); letter-spacing: -.045em; } +.dashboard-section__header .dashboard-kicker { margin-bottom: .3rem; } +.dashboard-link { display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem; padding: .7rem 1rem; border: 1px solid #789ed7; border-radius: .7rem; color: #dceaff; font-size: .9rem; font-weight: 800; text-decoration: none; background: #1b2e52; transition: transform .2s ease, background .2s ease; } +.dashboard-link:hover { transform: translateY(-1px); background: #274574; } +.dashboard-report { position: relative; overflow: hidden; padding: clamp(1.35rem, 4vw, 2.4rem); border: 1px solid #b86c2a; border-radius: 1.35rem; background: linear-gradient(135deg, #4a2b16e8, #171225dd); box-shadow: 0 1.5rem 4rem #02061680; } +.dashboard-report::after { content: ""; position: absolute; width: 17rem; height: 17rem; right: -9rem; top: -10rem; border-radius: 50%; background: #ffb4541f; pointer-events: none; } +.dashboard-report > * { position: relative; } +.dashboard-report .eyebrow { margin: 0 0 .7rem; color: #ffd08a; font-size: .76rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; } +.dashboard-report .eyebrow::before { content: ""; display: inline-block; width: .5rem; height: .5rem; margin-right: .45rem; border-radius: 50%; background: #ffbd62; box-shadow: 0 0 0 .25rem #fbbf2430; } +.dashboard-report .manual-report__title { max-width: 14ch; margin: 0 0 .6rem; color: #fff6e7; font-size: clamp(2rem, 5vw, 3.4rem); line-height: .98; letter-spacing: -.06em; } +.dashboard-report .manual-report__intro { max-width: 42rem; margin: 0 0 1.35rem; color: #f3c8a3; line-height: 1.55; } +.dashboard-report .manual-report__label { display: block; margin-bottom: .5rem; color: #fff2df; font-weight: 800; } +.dashboard-report #manual-occurrences { width: min(100%, 36rem); min-height: 3.25rem; display: block; margin-bottom: 1rem; padding: .75rem .9rem; border: 1px solid #e2934a; border-radius: .75rem; color: #edf3ff; font: inherit; font-weight: 800; background: #151b31; } +.dashboard-report .manual-direction-panel { width: min(100%, 36rem); margin: 0 0 1rem; padding: 1rem; border: 1px solid #8d5bb5; border-radius: .75rem; background: #241b38; } +.dashboard-report .manual-direction-panel__heading { display: block; margin-bottom: .35rem; }.dashboard-report .manual-direction-panel__heading span { color: #c7b5eb; font-weight: 600; }.dashboard-report .manual-direction-panel__copy { margin: 0 0 .75rem; color: #d4c6ef; font-size: .88rem; line-height: 1.45; }.dashboard-report .manual-direction-panel__button { min-height: 2.75rem; padding: .65rem .9rem; border: 1px solid #c3a5eb; border-radius: .65rem; color: #211234; font: inherit; font-weight: 850; background: #d8c1fb; cursor: pointer; }.dashboard-report .manual-direction-panel__status { min-height: 1.4rem; margin-top: .7rem; color: #e5dcf7; font-size: .9rem; } +.dashboard-report .manual-report__submit { width: min(100%, 36rem); min-height: 4.5rem; border: 0; border-radius: 1rem; color: #281306; font: inherit; font-size: clamp(1.05rem, 2vw, 1.3rem); font-weight: 900; background: linear-gradient(135deg, #ffd18c, #ff8f5b); box-shadow: 0 .75rem 1.8rem #d664344d; cursor: pointer; }.dashboard-report .manual-report__submission { min-height: 1.5rem; margin-top: 1rem; color: #ffd18c; } +.dashboard-map .map { height: clamp(22rem, 48vh, 34rem); }.dashboard-map .map-header { background: #121d37; }.dashboard-map .legend { display: none; } +.dashboard-upload { padding: clamp(1rem, 3vw, 1.5rem); } +.dashboard-upload .drop-zone { min-height: 12rem; } +@media (max-width: 42rem) { .dashboard-shell { width: min(100% - 1.25rem, 70rem); }.dashboard-section__header { align-items: flex-start; flex-direction: column; }.dashboard-link { width: 100%; }.dashboard-map .map { height: 23rem; } } +:root[data-theme="light"] body.dashboard-page { --dashboard-ink: #172b50; --dashboard-muted: #596d88; --dashboard-line: #cbd9ed; --dashboard-surface: #fff; --dashboard-surface-raised: #f4f8ff; background: radial-gradient(circle at 8% 0%, #dbeaff 0, transparent 31rem), radial-gradient(circle at 96% 100%, #eee2ff 0, transparent 29rem), #f4f7fc; } +:root[data-theme="light"] .dashboard-intro h1, :root[data-theme="light"] .dashboard-section__header h2 { color: #172b50 !important; } +:root[data-theme="light"] .dashboard-kicker { color: #3f6fa9 !important; } +:root[data-theme="light"] .dashboard-link { border-color: #9fc0e9; color: #234a7b; background: #e6f0ff; }.dashboard-link:hover { background: #d8e8ff; } +:root[data-theme="light"] .dashboard-report { border-color: #eca851; background: linear-gradient(145deg, #fff8ef, #ffe0bb); box-shadow: 0 1.4rem 3.4rem rgba(116, 69, 25, .18); } +:root[data-theme="light"] .dashboard-report .eyebrow { color: #9f4d16 !important; }:root[data-theme="light"] .dashboard-report .manual-report__title { color: #4a2510 !important; }:root[data-theme="light"] .dashboard-report .manual-report__intro { color: #70411d !important; }:root[data-theme="light"] .dashboard-report .manual-report__label { color: #54311b; }:root[data-theme="light"] .dashboard-report #manual-occurrences { border-color: #dfaa68; color: #322014; background: #fffdfa; }:root[data-theme="light"] .dashboard-report .manual-direction-panel { border-color: #d9b4d8; background: #fff5fc; }:root[data-theme="light"] .dashboard-report .manual-direction-panel__heading { color: #492846; }:root[data-theme="light"] .dashboard-report .manual-direction-panel__heading span { color: #70466d; }:root[data-theme="light"] .dashboard-report .manual-direction-panel__copy { color: #694b68; }:root[data-theme="light"] .dashboard-report .manual-direction-panel__button { border-color: #b68bb5; color: #321a34; background: #ead2eb; }:root[data-theme="light"] .dashboard-report .manual-direction-panel__status { color: #6b4267; }:root[data-theme="light"] .dashboard-report .manual-report__submission { color: #87421b; } +:root[data-theme="light"] .dashboard-map .map-header { background: #f2f6fc !important; } + +.dashboard-page .profile-circle { display: grid; width: 3rem; height: 3rem; position: fixed; top: 1.25rem; right: 1.25rem; place-items: center; border: 1px solid #d0c0ff; border-radius: 50%; z-index: 1201; color: #17132b; font-weight: 900; text-decoration: none; background: linear-gradient(135deg, #fcd34d, #c4a5fd); box-shadow: 0 .5rem 1.5rem #01030c66; }.dashboard-page .profile-circle:focus-visible { outline: 3px solid #a5c9ff80; outline-offset: 3px; } diff --git a/frontend/src/styles/pages/events.css b/frontend/src/styles/pages/events.css new file mode 100644 index 0000000..2ea33ad --- /dev/null +++ b/frontend/src/styles/pages/events.css @@ -0,0 +1,48 @@ +:root{--i:#edf3ff;--m:#aab9d8;--l:#2b3d68}*{box-sizing:border-box}body{margin:0;min-height:100vh;padding:2rem;color:var(--i);font-family:system-ui;background:radial-gradient(circle at 8% 0,#263a76,transparent 31rem),#090e1d}.shell{width:min(100%,70rem);margin:auto}.top{display:flex;justify-content:space-between;gap:1rem;align-items:center;margin-bottom:3rem}.brand,a{color:inherit}.brand{text-decoration:none;font-weight:900;letter-spacing:.1em;text-transform:uppercase}.top a:not(.brand){padding:.6rem .8rem;border:1px solid var(--l);border-radius:.6rem;text-decoration:none}.eyebrow{color:#bcd4ff;font-size:.76rem;letter-spacing:.15em;text-transform:uppercase;font-weight:800}h1{font-size:clamp(2.5rem,6vw,4.5rem);letter-spacing:-.06em;margin:.4rem 0}.lede{color:var(--m);max-width:38rem;line-height:1.6}.grid{display:grid;grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr);gap:1rem;margin-top:2rem}.panel{border:1px solid var(--l);border-radius:1rem;padding:1rem;background:#111a31d9}.event{width:100%;display:flex;justify-content:space-between;gap:.6rem;text-align:left;margin:.6rem 0;padding:.85rem;border:1px solid #374e7e;border-radius:.7rem;color:var(--i);background:#15223f;cursor:pointer}.event:hover{background:#20345f}.event--manual{border-color:#e2934a;background:linear-gradient(90deg,#70401e,#15223f)}.event small,.empty{color:var(--m)}.badge{color:#ffd08a}.detail h2{margin-top:0}.prediction{display:flex;justify-content:space-between;gap:1rem;padding:.65rem;margin:.45rem 0;border-left:3px solid #78a4f0;background:#111c34}.prediction--firework{border-color:#f5aa44}.prediction--speech{border-color:#fb7185}.meta{color:var(--m);font-size:.9rem}@media(max-width:42rem){body{padding:1rem}.grid{grid-template-columns:1fr}} + +/* Event source styles keep manual reports and sensor classifications recognisable. */ +.event__content { display: grid; gap: .16rem; } +.event__source { color: #bcd4ff; font-size: .67rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; } +.event--sensor { border-color: #5478b7; background: linear-gradient(90deg, #1b355f, #15223f 72%); } +.event--sensor .badge { color: #a9ccff; } +.event--manual .event__source { color: #ffd08a; } +.event--sensor:hover { background: linear-gradient(90deg, #25497e, #20345f 72%); } +.event-nav { display: flex; gap: .3rem; padding: .25rem; border: 1px solid var(--l); border-radius: .75rem; background: #111a31d9; box-shadow: 0 .5rem 1.5rem #03071440; } +.top .event-nav a { padding: .5rem .75rem; border: 0; border-radius: .5rem; color: var(--m); font-size: .86rem; font-weight: 750; text-decoration: none; } +.top .event-nav a:hover { color: var(--i); background: #20345f; } +.top .event-nav a[aria-current="page"] { color: var(--i); background: #2a3b67; } + +:root[data-theme="light"] .event-nav { + border-color: #cbd9ed; + background: #edf4ff; + box-shadow: 0 .45rem 1.25rem rgba(34, 68, 117, .12); +} +:root[data-theme="light"] .top .event-nav a { color: #47617f; } +:root[data-theme="light"] .top .event-nav a:hover { color: #234a7b; background: #dceaff; } +:root[data-theme="light"] .top .event-nav a[aria-current="page"] { + color: #173d6a; + background: #cfe3ff; + box-shadow: inset 0 0 0 1px #9cc0ed; +} +:root[data-theme="light"] .event { + color: #1d2d46; + border-color: #cfdaea; + background: #f7faff; + box-shadow: 0 .35rem .9rem rgba(38, 62, 101, .06); +} +:root[data-theme="light"] .event:hover { background: #edf4ff; } +:root[data-theme="light"] .event small { color: #61718a; } +:root[data-theme="light"] .event__source { color: #426b9f; } +:root[data-theme="light"] .event--sensor { + border-color: #8eafd9; + background: linear-gradient(90deg, #edf6ff, #e1edff 76%); +} +:root[data-theme="light"] .event--sensor:hover { background: linear-gradient(90deg, #e2f0ff, #d4e6ff 76%); } +:root[data-theme="light"] .event--sensor .badge { color: #245b95; } +:root[data-theme="light"] .event--manual { + border-color: #e4a35c; + background: linear-gradient(90deg, #fff8ee, #ffe3bf 76%); +} +:root[data-theme="light"] .event--manual:hover { background: linear-gradient(90deg, #fff1df, #ffd7a3 76%); } +:root[data-theme="light"] .event--manual .event__source, +:root[data-theme="light"] .event--manual .badge { color: #9a4b13; } diff --git a/frontend/src/styles/pages/fireworks-home.css b/frontend/src/styles/pages/fireworks-home.css new file mode 100644 index 0000000..52a593c --- /dev/null +++ b/frontend/src/styles/pages/fireworks-home.css @@ -0,0 +1,522 @@ + + :root { + --ink: #eaf0ff; + --muted: #9caed1; + --surface: #111a31; + --surface-2: #17223e; + --line: #2a3a61; + --blue: #6aa8ff; + --violet: #a78bfa; + --fire: #ffb454; + --danger: #ff727c; + --success: #6ee7b7; + } + + * { + box-sizing: border-box; + } + + body { + min-width: 320px; + min-height: 100vh; + margin: 0; + color: var(--ink); + font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; + background: radial-gradient(circle at 10% 0%, #263a76 0, transparent 30rem), radial-gradient(circle at 90% 20%, #4d236c 0, transparent 28rem), #090e1d; + } + + .shell { + width: min(100% - 2.5rem, 70rem); + margin: 0 auto; + padding: clamp(2rem, 6vw, 5rem) 0; + } + + .brand { + display: flex; + align-items: center; + gap: .75rem; + /* margin-bottom: clamp(2.5rem, 6vw, 5rem); */ + font-size: .9rem; + font-weight: 800; + letter-spacing: .11em; + text-transform: uppercase; + } + + .brand-mark { + display: grid; + width: 2.25rem; + aspect-ratio: 1; + place-items: center; + border-radius: .75rem; + color: #141022; + background: linear-gradient(135deg, #fcd34d, #fb7185); + box-shadow: 0 .5rem 1.5rem #fb718550; + } + + .intro { + max-width: 45rem; + } + + .kicker { + margin: 0 0 .8rem; + color: #bfdbfe; + font-size: .78rem; + font-weight: 800; + letter-spacing: .15em; + text-transform: uppercase; + } + + h1 { + max-width: 12ch; + margin: 0; + font-size: clamp(2.6rem, 7vw, 5.75rem); + line-height: .96; + letter-spacing: -.065em; + } + + .lede { + max-width: 38rem; + margin: 1.5rem 0 2.5rem; + color: var(--muted); + font-size: clamp(1rem, 2vw, 1.18rem); + line-height: 1.65; + } + + .upload-card, + .results-card { + border: 1px solid var(--line); + border-radius: 1.5rem; + background: linear-gradient(145deg, #162240d9, #0e162bdd); + box-shadow: 0 1.5rem 4rem #02061680; + backdrop-filter: blur(16px); + } + + .upload-card { + padding: clamp(1rem, 3vw, 1.5rem); + } + + .drop-zone { + display: grid; + min-height: 16rem; + place-items: center; + padding: 2rem; + border: 1.5px dashed #5d75aa; + border-radius: 1rem; + cursor: pointer; + text-align: center; + background: linear-gradient(135deg, #1b2a4e80, #291c4b66); + transition: .2s ease; + } + + .drop-zone:hover, + .drop-zone.dragging { + border-color: var(--blue); + transform: translateY(-2px); + background: #203360a8; + } + + .drop-zone:focus-within { + outline: 3px solid #6aa8ff66; + outline-offset: 3px; + } + + .file-input { + width: .1px; + height: .1px; + position: absolute; + opacity: 0; + overflow: hidden; + } + + .drop-zone .upload-icon { + display: grid; + width: 4rem; + aspect-ratio: 1; + place-items: center; + margin: 0 auto 1rem; + border-radius: 50%; + color: #dbeafe; + font-size: 1.8rem; + background: #4777c94d; + } + + .drop-zone .upload-icon__content { position: relative; z-index: 1; margin: 0; color: inherit; font-size: inherit; font-weight: 850; } + .audio-upload--uploading .upload-icon, + .audio-upload--processing .upload-icon, + .audio-upload--success .upload-icon, + .audio-upload--error .upload-icon { position: relative; width: 5.5rem; margin-bottom: .25rem; color: #fff; font-size: 1.25rem; box-shadow: 0 0 0 .35rem #334e8d70, 0 .6rem 2rem #101a3fa6; } + .audio-upload--uploading .upload-icon { background: conic-gradient(#91baff var(--upload-progress, 0%), #334b82 0); } + .audio-upload--processing .upload-icon { background: #405caa; } + .audio-upload--processing .upload-icon::after { content: ""; position: absolute; inset: -.42rem; border: 3px solid #9fc5ff; border-right-color: transparent; border-radius: 50%; animation: spin 1.5s linear infinite; } + .audio-upload--success .upload-icon { background: #147d6c; } + .audio-upload--error .upload-icon { background: #9d385b; } + .audio-upload--uploading .drop-zone, + .audio-upload--processing .drop-zone { border-color: #7296d5; background: linear-gradient(135deg, #18284c, #242046); } + .audio-upload--uploading .drop-zone strong, + .audio-upload--processing .drop-zone strong, + .audio-upload--uploading .drop-zone > span > span:not(.upload-icon), + .audio-upload--processing .drop-zone > span > span:not(.upload-icon), + .audio-upload--uploading .file-name, + .audio-upload--processing .file-name { opacity: .35; } + .audio-upload--uploading .drop-zone, + .audio-upload--processing .drop-zone { cursor: default; } + .audio-upload--uploading .drop-zone:hover, + .audio-upload--processing .drop-zone:hover { transform: none; } + .upload-cancel[hidden] { display: none; } + #classification-results { scroll-margin-top: 1.5rem; } + @media (prefers-reduced-motion: reduce) { + .audio-upload--processing .upload-icon::after { animation: none; } + .audio-upload--uploading .drop-zone, + .audio-upload--processing .drop-zone, + .audio-upload--uploading .upload-icon, + .audio-upload--processing .upload-icon { transition: none; } + } + + .drop-zone strong { + display: block; + font-size: 1.15rem; + } + + .drop-zone span { + display: block; + margin-top: .4rem; + color: var(--muted); + font-size: .92rem; + } + + .file-name { + min-height: 1.3rem; + margin: 1rem 0 0; + color: #c7d2fe; + font-size: .9rem; + overflow-wrap: anywhere; + } + + .form-footer { + display: flex; + align-items: center; + justify-content: space-between; + gap: 1rem; + padding: .9rem .25rem 0; + } + + .file-note { + margin: 0; + color: var(--muted); + font-size: .8rem; + } + + button, + .button { + text-decoration: none; + display: inline-flex; + align-items: center; + justify-content: center; + gap: .6rem; + border: 0; + border-radius: .8rem; + padding: .85rem 1.15rem; + cursor: pointer; + color: #10172c; + font: inherit; + font-weight: 800; + background: linear-gradient(135deg, #93c5fd, #c4b5fd); + box-shadow: 0 .5rem 1.25rem #8b5cf640; + transition: transform .2s ease, filter .2s ease; + } + + button:hover, + .button:hover { + transform: translateY(-1px); + filter: brightness(1.08); + } + + button:disabled { + cursor: wait; + filter: saturate(.4); + transform: none; + } + + .spinner { + width: 1rem; + height: 1rem; + border: 2px solid #263253; + border-top-color: currentColor; + border-radius: 50%; + animation: spin .75s linear infinite; + } + + .htmx-indicator { + display: none; + } + + .htmx-request.htmx-indicator { + display: inline-block; + } + + .upload-form.htmx-request button { + pointer-events: none; + } + + #upload-status { + min-height: 1.4rem; + margin: 1rem .25rem 0; + color: #c7d2fe; + font-size: .9rem; + } + + .upload-form.htmx-request+#upload-status { + color: #fcd34d; + } + + #classification-results { + margin-top: 1.5rem; + } + + .results-card { + padding: clamp(1.25rem, 3vw, 2rem); + animation: reveal .35s ease-out; + } + + .result-heading { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 1rem; + } + + .result-heading h2 { + margin: 0; + font-size: clamp(1.4rem, 3vw, 2rem); + letter-spacing: -.04em; + } + + .result-heading p { + margin: .3rem 0 0; + color: var(--muted); + } + + .result-status { + padding: .4rem .65rem; + border-radius: 999px; + color: #a7f3d0; + font-size: .75rem; + font-weight: 800; + white-space: nowrap; + background: #065f464d; + } + + .meta { + display: flex; + flex-wrap: wrap; + gap: .6rem; + margin: 1.5rem 0; + } + + .meta span, + .legend span { + padding: .4rem .65rem; + border: 1px solid var(--line); + border-radius: 999px; + color: #bdc9e5; + font-size: .8rem; + background: #101a31; + } + + .legend { + display: flex; + flex-wrap: wrap; + gap: .5rem; + margin: 0 0 1.25rem; + } + + .legend .firework { + color: #ffd18c; + border-color: #c7721e80; + } + + .legend .speech { + color: #ffadb4; + border-color: #d5485880; + } + .topbar { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:3.5rem; }.brand { display:flex; align-items:center; gap:.7rem; color:var(--ink); font-size:.9rem; font-weight:800; letter-spacing:.1em; text-decoration:none; text-transform:uppercase; }.brand-mark { display:grid; width:2.25rem; aspect-ratio:1; place-items:center; border-radius:.75rem; color:#141022; background:linear-gradient(135deg,#fcd34d,#fb7185); box-shadow:0 .5rem 1.5rem #fb718550; }.nav { display:flex; gap:.35rem; padding:.25rem; border:1px solid var(--line); border-radius:.75rem; background:#111a31a6; }.nav a { padding:.5rem .75rem; border-radius:.5rem; color:var(--muted); font-size:.86rem; font-weight:700; text-decoration:none; }.nav a[aria-current="page"] { color:var(--ink); background:#2a3b67; } + + .result-grid { + display: grid; + grid-template-columns: minmax(0, 1.25fr) minmax(18rem, .75fr); + gap: 1.25rem; + } + + .result-group { + padding: 1.1rem; + border: 1px solid var(--line); + border-radius: 1rem; + background: #0b1225a8; + } + + .result-group h3 { + margin: 0 0 1rem; + font-size: 1rem; + } + + .prediction-list { + display: grid; + gap: .75rem; + margin: 0; + padding: 0; + list-style: none; + } + + .prediction { + --accent-color: #7799dd; + position: relative; + display: grid; + grid-template-columns: minmax(0, 1fr) auto; + gap: .45rem .75rem; + align-items: center; + padding: .7rem .75rem; + overflow: hidden; + border: 1px solid #26365b; + border-left: 3px solid var(--accent-color); + border-radius: .7rem; + background: #121c34; + } + + .prediction--firework { + --accent-color: var(--fire); + background: linear-gradient(90deg, #7a421d55, #121c34); + } + + .prediction--speech { + --accent-color: var(--danger); + background: linear-gradient(90deg, #6c213055, #121c34); + } + + .prediction-label { + min-width: 0; + font-weight: 700; + overflow-wrap: anywhere; + } + + .prediction-score { + color: #c4d1ed; + font-size: .85rem; + font-variant-numeric: tabular-nums; + } + + .score-bar { + grid-column: 1/-1; + height: .3rem; + overflow: hidden; + border-radius: 999px; + background: #263657; + } + + .score-bar i { + display: block; + width: calc(var(--score) * 1%); + height: 100%; + border-radius: inherit; + background: var(--accent-color); + } + + .peak-list { + display: grid; + gap: .7rem; + } + + .peak-item { + padding-bottom: .7rem; + border-bottom: 1px solid #253453; + } + + .peak-item:last-child { + padding-bottom: 0; + border-bottom: 0; + } + + .peak-time { + color: #a9bce0; + font-size: .78rem; + } + + .peak-item .prediction { + margin-top: .35rem; + } + + .empty { + margin: 0; + color: var(--muted); + } + + .error-card { + border-color: #a43d4d; + background: linear-gradient(135deg, #4b1724dd, #1a1427dd); + } + + .error-card h2 { + color: #fecdd3; + } + + .error-card p { + color: #fecdd3; + } + + @keyframes spin { + to { + transform: rotate(360deg); + } + } + + @keyframes reveal { + from { + opacity: 0; + transform: translateY(.75rem); + } + } + + @media (max-width:42rem) { + .shell { + width: min(100% - 1.25rem, 70rem); + } + + .form-footer, + .result-heading { + align-items: stretch; + flex-direction: column; + } + + .form-footer button { + width: 100%; + } + + .result-grid { + grid-template-columns: 1fr; + } + + .result-status { + align-self: flex-start; + } + } + + @media (prefers-reduced-motion:reduce) { + + *, + ::before, + ::after { + scroll-behavior: auto !important; + animation-duration: .01ms !important; + transition-duration: .01ms !important; + } + } + +.browser-gate { margin: 1rem 0; padding: 1rem; border: 1px solid #e5bb7a; border-radius: .75rem; background: #4d392950; } +.browser-gate[hidden] { display: none; } +.browser-gate p { margin: .45rem 0 1rem; } +.browser-gate-actions { display: flex; gap: .65rem; flex-wrap: wrap; } +.browser-gate-actions button { cursor: pointer; } + +.browser-mode { margin: 1rem 0; } +.browser-mode__label { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; cursor: pointer; } +.browser-mode__label input { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: #91baff; } +.browser-mode p { margin: .35rem 0 0 1.65rem; font-size: .9rem; opacity: .85; } diff --git a/frontend/src/styles/pages/home.css b/frontend/src/styles/pages/home.css new file mode 100644 index 0000000..da98e01 --- /dev/null +++ b/frontend/src/styles/pages/home.css @@ -0,0 +1,85 @@ + + :root { --ink:#eef3ff; --muted:#aab9d8; --line:#2b3d68; --blue:#8abaff; --violet:#b69cff; --amber:#ffbd62; } + * { box-sizing:border-box; } + body { min-width:320px; min-height:100vh; display:grid; place-items:center; margin:0; padding:1.5rem; color:var(--ink); font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; background:radial-gradient(circle at 8% 0%,#263a76 0,transparent 31rem),radial-gradient(circle at 96% 100%,#512363 0,transparent 29rem),#090e1d; } + .welcome-card { width:min(100%,44rem); position:relative; overflow:hidden; padding:clamp(2rem,7vw,4.75rem); border:1px solid var(--line); border-radius:1.5rem; background:linear-gradient(145deg,#172443e8,#10182ddd); box-shadow:0 1.75rem 5rem #01030c99; backdrop-filter:blur(16px); } + .welcome-card::before { content:""; width:15rem; height:15rem; position:absolute; top:-8rem; right:-6rem; border-radius:50%; background:linear-gradient(135deg,#609df177,#b27be266); filter:blur(1px); }.welcome-card::after { content:""; width:10rem; height:10rem; position:absolute; bottom:-6rem; left:-4rem; border-radius:50%; background:#f4a74225; } + .brand { display:flex; align-items:center; gap:.65rem; margin-bottom:clamp(2rem,5vw,4rem); color:#d9e5ff; font-size:.78rem; font-weight:900; letter-spacing:.14em; text-transform:uppercase; }.brand-mark { display:grid; width:2.2rem; aspect-ratio:1; place-items:center; border-radius:.7rem; color:#17132b; font-size:1.1rem; background:linear-gradient(135deg,#fcd34d,#fb7185); box-shadow:0 .5rem 1.5rem #fb718550; } + .eyebrow { margin:0 0 .8rem; color:#bad3ff; font-size:.76rem; font-weight:800; letter-spacing:.14em; text-transform:uppercase; }.eyebrow::before { content:""; display:inline-block; width:.55rem; height:.55rem; margin-right:.45rem; border-radius:50%; background:var(--amber); box-shadow:0 0 0 .25rem #fbbf2430; } + h1 { max-width:10ch; margin:0; font-size:clamp(2.8rem,8vw,5.75rem); line-height:.96; letter-spacing:-.065em; }.subject { max-width:33rem; margin:1.35rem 0 0; color:var(--muted); font-size:clamp(1rem,2vw,1.15rem); line-height:1.65; }.subject strong { color:#e8efff; }.sparkle { color:var(--violet); font-size:1.2em; } + .actions { display:flex; align-items:center; gap:1rem; flex-wrap:wrap; margin-top:2.25rem; } + .profile-circle { display:grid; width:3rem; height:3rem; position:fixed; top:1.25rem; right:1.25rem; place-items:center; border:1px solid #d0c0ff; border-radius:50%; z-index:2; color:#17132b; font-weight:900; text-decoration:none; background:linear-gradient(135deg,#fcd34d,#c4a5fd); box-shadow:0 .5rem 1.5rem #01030c66; } + .profile-circle:focus-visible { outline:3px solid #a5c9ff80; outline-offset:3px; } + .button { display:inline-flex; align-items:center; justify-content:center; gap:.6rem; min-height:2.9rem; padding:.75rem 1.05rem; border:1px solid #b3c9ff; border-radius:.8rem; color:#121a34; font:inherit; font-size:.93rem; font-weight:850; text-decoration:none; background:linear-gradient(135deg,#99c8ff,#c6adff); box-shadow:0 .65rem 1.75rem #7058dd50; transition:transform .2s ease,filter .2s ease; } + .button:hover { transform:translateY(-2px); filter:brightness(1.08); } + .button:focus-visible { outline:3px solid #a5c9ff80; outline-offset:3px; }.hint { color:#99add2; font-size:.82rem; } + @media (max-width:30rem) { .welcome-card { padding:2rem 1.5rem; }.actions { align-items:stretch; flex-direction:column; }.button { width:100%; }.hint { text-align:center; } } + @media (prefers-reduced-motion:reduce) { .button { transition:none; } } + + +.home-grid { width:min(100%,80rem); display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,20rem),1fr)); gap:1.25rem; align-items:stretch; } +.welcome-card { width:100%; } +.manual-report { position:relative; overflow:hidden; padding:clamp(2rem,6vw,4.75rem); border:2px solid #a85a1e; border-radius:1.5rem; background:linear-gradient(145deg,#4a2b16e8,#171225dd); box-shadow:0 1.75rem 5rem #01030c99; } +.manual-report__title { margin:.2rem 0 .75rem; font-size:clamp(2rem,4vw,3.1rem); line-height:1; letter-spacing:-.06em; } +.manual-report__intro { margin:0 0 1.5rem; color:#f3c8a3; line-height:1.55; } +.manual-report__label { display:block; margin-bottom:.5rem; font-weight:800; } +#manual-occurrences { width:100%; min-height:3.3rem; margin-bottom:1rem; padding:.75rem .9rem; border:1px solid #e2934a; border-radius:.75rem; color:#eef3ff; font:inherit; font-weight:800; background:#151b31; } +.manual-direction-panel { margin:0 0 1rem; padding:1rem; border:1px solid #8d5bb5; border-radius:.75rem; background:#241b38; } +.manual-direction-panel__heading { display:block; margin-bottom:.35rem; } +.manual-direction-panel__heading span { color:#c7b5eb; font-weight:600; } +.manual-direction-panel__copy { margin:0 0 .75rem; color:#d4c6ef; font-size:.88rem; line-height:1.45; } +.manual-direction-panel__button { min-height:2.75rem; padding:.65rem .9rem; border:1px solid #c3a5eb; border-radius:.65rem; color:#211234; font:inherit; font-weight:850; background:#d8c1fb; cursor:pointer; } +.manual-direction-panel__status { min-height:1.4rem; margin-top:.7rem; color:#e5dcf7; font-size:.9rem; } +.manual-report__submit { width:100%; min-height:6rem; border:0; border-radius:1rem; color:#281306; font:inherit; font-size:clamp(1.1rem,2vw,1.45rem); font-weight:900; background:linear-gradient(135deg,#ffd18c,#ff8f5b); box-shadow:0 .75rem 1.8rem #d664344d; cursor:pointer; } +.manual-report__submission { min-height:1.5rem; margin-top:1rem; color:#ffd18c; } + + +/* Homepage-specific light palette: the two cards intentionally retain distinct roles. */ +:root[data-theme="light"] .home-grid .welcome-card { + color: #17233b; + border-color: #d5e0f1 !important; + background: linear-gradient(145deg, #ffffff 0%, #f4f8ff 100%) !important; + box-shadow: 0 1.4rem 3.4rem rgba(38, 65, 111, .16) !important; +} +:root[data-theme="light"] .home-grid .welcome-card::before { + background: linear-gradient(135deg, #a9c9fb99, #d4b8f299); +} +:root[data-theme="light"] .home-grid .welcome-card::after { background: #ffd49a66; } +:root[data-theme="light"] .home-grid .welcome-card .brand { color: #365b97; } +:root[data-theme="light"] .home-grid .welcome-card .eyebrow { color: #4269a5; } +:root[data-theme="light"] .home-grid .welcome-card .subject strong { color: #182b50; } +:root[data-theme="light"] .home-grid .welcome-card .hint { color: #5d7191; } + +:root[data-theme="light"] .home-grid .manual-report { + color: #42210f; + border-color: #eca851 !important; + background: linear-gradient(145deg, #fff8ef 0%, #ffe0bb 100%) !important; + box-shadow: 0 1.4rem 3.4rem rgba(116, 69, 25, .18) !important; +} +:root[data-theme="light"] .home-grid .manual-report .eyebrow { color: #9f4d16; } +:root[data-theme="light"] .home-grid .manual-report__title { color: #4a2510; } +:root[data-theme="light"] .home-grid .manual-report__intro { color: #70411d; } +:root[data-theme="light"] .home-grid .manual-report__label { color: #54311b; } +:root[data-theme="light"] .home-grid #manual-occurrences { + border-color: #dfaa68; + color: #322014; + background: #fffdfa; +} +:root[data-theme="light"] .home-grid .manual-direction-panel { + border-color: #d9b4d8; + background: #fff5fc; +} +:root[data-theme="light"] .home-grid .manual-direction-panel__heading { color: #492846; } +:root[data-theme="light"] .home-grid .manual-direction-panel__heading span { color: #70466d; } +:root[data-theme="light"] .home-grid .manual-direction-panel__copy { color: #694b68; } +:root[data-theme="light"] .home-grid .manual-direction-panel__button { + border-color: #b68bb5; + color: #321a34; + background: #ead2eb; +} +:root[data-theme="light"] .home-grid .manual-direction-panel__status { color: #6b4267; } +:root[data-theme="light"] .home-grid .manual-report__submit { + color: #281306; + box-shadow: 0 .75rem 1.8rem rgba(190, 90, 34, .27); +} +:root[data-theme="light"] .home-grid .manual-report__submission { color: #87421b; } diff --git a/frontend/src/styles/pages/legacy-fireworks-home.css b/frontend/src/styles/pages/legacy-fireworks-home.css new file mode 100644 index 0000000..8e02f4e --- /dev/null +++ b/frontend/src/styles/pages/legacy-fireworks-home.css @@ -0,0 +1,38 @@ + + :root { --ink:#eaf0ff; --muted:#9caed1; --surface:#111a31; --surface-2:#17223e; --line:#2a3a61; --blue:#6aa8ff; --violet:#a78bfa; --fire:#ffb454; --danger:#ff727c; --success:#6ee7b7; } + * { box-sizing:border-box; } + body { min-width:320px; min-height:100vh; margin:0; color:var(--ink); font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; background:radial-gradient(circle at 10% 0%,#263a76 0,transparent 30rem),radial-gradient(circle at 90% 20%,#4d236c 0,transparent 28rem),#090e1d; } + .shell { width:min(100% - 2.5rem,70rem); margin:0 auto; padding:clamp(2rem,6vw,5rem) 0; } + .brand { display:flex; align-items:center; gap:.75rem; margin-bottom:clamp(2.5rem,6vw,5rem); font-size:.9rem; font-weight:800; letter-spacing:.11em; text-transform:uppercase; } + .brand-mark { display:grid; width:2.25rem; aspect-ratio:1; place-items:center; border-radius:.75rem; color:#141022; background:linear-gradient(135deg,#fcd34d,#fb7185); box-shadow:0 .5rem 1.5rem #fb718550; } + .intro { max-width:45rem; } + .kicker { margin:0 0 .8rem; color:#bfdbfe; font-size:.78rem; font-weight:800; letter-spacing:.15em; text-transform:uppercase; } + h1 { max-width:12ch; margin:0; font-size:clamp(2.6rem,7vw,5.75rem); line-height:.96; letter-spacing:-.065em; } + .lede { max-width:38rem; margin:1.5rem 0 2.5rem; color:var(--muted); font-size:clamp(1rem,2vw,1.18rem); line-height:1.65; } + .upload-card,.results-card { border:1px solid var(--line); border-radius:1.5rem; background:linear-gradient(145deg,#162240d9,#0e162bdd); box-shadow:0 1.5rem 4rem #02061680; backdrop-filter:blur(16px); } + .upload-card { padding:clamp(1rem,3vw,1.5rem); } + .drop-zone { display:grid; min-height:16rem; place-items:center; padding:2rem; border:1.5px dashed #5d75aa; border-radius:1rem; cursor:pointer; text-align:center; background:linear-gradient(135deg,#1b2a4e80,#291c4b66); transition:.2s ease; } + .drop-zone:hover,.drop-zone.dragging { border-color:var(--blue); transform:translateY(-2px); background:#203360a8; } + .drop-zone:focus-within { outline:3px solid #6aa8ff66; outline-offset:3px; } + .file-input { width:.1px; height:.1px; position:absolute; opacity:0; overflow:hidden; } + .upload-icon { display:grid; width:4rem; aspect-ratio:1; place-items:center; margin:0 auto 1rem; border-radius:50%; color:#dbeafe; font-size:1.8rem; background:#4777c94d; } + .drop-zone strong { display:block; font-size:1.15rem; } + .drop-zone span { display:block; margin-top:.4rem; color:var(--muted); font-size:.92rem; } + .file-name { min-height:1.3rem; margin:1rem 0 0; color:#c7d2fe; font-size:.9rem; overflow-wrap:anywhere; } + .form-footer { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.9rem .25rem 0; } + .file-note { margin:0; color:var(--muted); font-size:.8rem; } + button { display:inline-flex; align-items:center; justify-content:center; gap:.6rem; border:0; border-radius:.8rem; padding:.85rem 1.15rem; cursor:pointer; color:#10172c; font:inherit; font-weight:800; background:linear-gradient(135deg,#93c5fd,#c4b5fd); box-shadow:0 .5rem 1.25rem #8b5cf640; transition:transform .2s ease,filter .2s ease; } + button:hover { transform:translateY(-1px); filter:brightness(1.08); } button:disabled { cursor:wait; filter:saturate(.4); transform:none; } + .spinner { width:1rem; height:1rem; border:2px solid #263253; border-top-color:currentColor; border-radius:50%; animation:spin .75s linear infinite; } + .htmx-indicator { display:none; }.htmx-request.htmx-indicator { display:inline-block; }.upload-form.htmx-request button { pointer-events:none; } + #upload-status { min-height:1.4rem; margin:1rem .25rem 0; color:#c7d2fe; font-size:.9rem; } .upload-form.htmx-request + #upload-status { color:#fcd34d; } + #classification-results { margin-top:1.5rem; } + .results-card { padding:clamp(1.25rem,3vw,2rem); animation:reveal .35s ease-out; } + .result-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:1rem; } .result-heading h2 { margin:0; font-size:clamp(1.4rem,3vw,2rem); letter-spacing:-.04em; }.result-heading p { margin:.3rem 0 0; color:var(--muted); } + .result-status { padding:.4rem .65rem; border-radius:999px; color:#a7f3d0; font-size:.75rem; font-weight:800; white-space:nowrap; background:#065f464d; } + .meta { display:flex; flex-wrap:wrap; gap:.6rem; margin:1.5rem 0; }.meta span,.legend span { padding:.4rem .65rem; border:1px solid var(--line); border-radius:999px; color:#bdc9e5; font-size:.8rem; background:#101a31; }.legend { display:flex; flex-wrap:wrap; gap:.5rem; margin:0 0 1.25rem; }.legend .firework { color:#ffd18c; border-color:#c7721e80; }.legend .speech { color:#ffadb4; border-color:#d5485880; } + .result-grid { display:grid; grid-template-columns:minmax(0,1.25fr) minmax(18rem,.75fr); gap:1.25rem; }.result-group { padding:1.1rem; border:1px solid var(--line); border-radius:1rem; background:#0b1225a8; }.result-group h3 { margin:0 0 1rem; font-size:1rem; }.prediction-list { display:grid; gap:.75rem; margin:0; padding:0; list-style:none; }.prediction { --accent-color:#7799dd; position:relative; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:.45rem .75rem; align-items:center; padding:.7rem .75rem; overflow:hidden; border:1px solid #26365b; border-left:3px solid var(--accent-color); border-radius:.7rem; background:#121c34; }.prediction--firework { --accent-color:var(--fire); background:linear-gradient(90deg,#7a421d55,#121c34); }.prediction--speech { --accent-color:var(--danger); background:linear-gradient(90deg,#6c213055,#121c34); }.prediction-label { min-width:0; font-weight:700; overflow-wrap:anywhere; }.prediction-score { color:#c4d1ed; font-size:.85rem; font-variant-numeric:tabular-nums; }.score-bar { grid-column:1/-1; height:.3rem; overflow:hidden; border-radius:999px; background:#263657; }.score-bar i { display:block; width:calc(var(--score) * 1%); height:100%; border-radius:inherit; background:var(--accent-color); }.peak-list { display:grid; gap:.7rem; }.peak-item { padding-bottom:.7rem; border-bottom:1px solid #253453; }.peak-item:last-child { padding-bottom:0; border-bottom:0; }.peak-time { color:#a9bce0; font-size:.78rem; }.peak-item .prediction { margin-top:.35rem; }.empty { margin:0; color:var(--muted); }.error-card { border-color:#a43d4d; background:linear-gradient(135deg,#4b1724dd,#1a1427dd); }.error-card h2 { color:#fecdd3; }.error-card p { color:#fecdd3; } + @keyframes spin { to { transform:rotate(360deg); } } @keyframes reveal { from { opacity:0; transform:translateY(.75rem); } } + @media (max-width:42rem) { .shell { width:min(100% - 1.25rem,70rem); }.form-footer,.result-heading { align-items:stretch; flex-direction:column; }.form-footer button { width:100%; }.result-grid { grid-template-columns:1fr; }.result-status { align-self:flex-start; } } + @media (prefers-reduced-motion:reduce) { *,::before,::after { scroll-behavior:auto!important; animation-duration:.01ms!important; transition-duration:.01ms!important; } } + \ No newline at end of file diff --git a/frontend/src/styles/pages/login.css b/frontend/src/styles/pages/login.css new file mode 100644 index 0000000..3bff17c --- /dev/null +++ b/frontend/src/styles/pages/login.css @@ -0,0 +1 @@ +body{min-width:320px;min-height:100vh;display:grid;place-items:center;margin:0;padding:1.5rem;color:#eef3ff;font-family:Inter,system-ui,sans-serif;background:radial-gradient(circle at 8% 0,#263a76,transparent 31rem),#090e1d}.card{width:min(100%,27rem);padding:2rem;border:1px solid #2b3d68;border-radius:1.25rem;background:#172443;box-shadow:0 1.75rem 5rem #01030c99}h1{margin:.5rem 0}.intro{color:#aab9d8;line-height:1.5}.error{margin:1rem 0;padding:.75rem;border-radius:.6rem;color:#fee2e2;background:#7f1d1d}label{display:block;margin:1rem 0 .35rem;font-weight:700}input{width:100%;min-height:2.8rem;padding:.65rem;border:1px solid #526b9f;border-radius:.55rem;color:#eef3ff;font:inherit;background:#0a1123}button{width:100%;min-height:2.9rem;margin-top:1.5rem;border:0;border-radius:.65rem;color:#17132b;font:inherit;font-weight:850;background:linear-gradient(135deg,#99c8ff,#c6adff);cursor:pointer} \ No newline at end of file diff --git a/frontend/src/styles/pages/map.css b/frontend/src/styles/pages/map.css new file mode 100644 index 0000000..5dfe6b0 --- /dev/null +++ b/frontend/src/styles/pages/map.css @@ -0,0 +1,17 @@ + + :root { --ink:#eef3ff; --muted:#a9b9d8; --surface:#111a31; --line:#2a3a61; --blue:#83b7ff; --violet:#b69cff; --amber:#ffbc61; --green:#6ee7b7; } + * { box-sizing:border-box; } + body { min-width:320px; min-height:100vh; margin:0; color:var(--ink); font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; background:radial-gradient(circle at 8% 0%,#263a76 0,transparent 32rem),radial-gradient(circle at 95% 0%,#492064 0,transparent 27rem),#090e1d; } + .shell { + width: min(100% - 2.5rem, 70rem); + margin: 0 auto; + padding: clamp(2rem, 6vw, 5rem) 0; + } + .topbar { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:3.5rem; }.brand { display:flex; align-items:center; gap:.7rem; color:var(--ink); font-size:.9rem; font-weight:800; letter-spacing:.1em; text-decoration:none; text-transform:uppercase; }.brand-mark { display:grid; width:2.25rem; aspect-ratio:1; place-items:center; border-radius:.75rem; color:#141022; background:linear-gradient(135deg,#fcd34d,#fb7185); box-shadow:0 .5rem 1.5rem #fb718550; }.nav { display:flex; gap:.35rem; padding:.25rem; border:1px solid var(--line); border-radius:.75rem; background:#111a31a6; }.nav a { padding:.5rem .75rem; border-radius:.5rem; color:var(--muted); font-size:.86rem; font-weight:700; text-decoration:none; }.nav a[aria-current="page"] { color:var(--ink); background:#2a3b67; } + .kicker { margin:0 0 .65rem; color:#bfdbfe; font-size:.76rem; font-weight:800; letter-spacing:.14em; text-transform:uppercase; }.headline { display:flex; align-items:end; justify-content:space-between; gap:2rem; margin-bottom:2rem; }.headline h1 { margin:0; font-size:clamp(2.3rem,5vw,4.5rem); line-height:.98; letter-spacing:-.06em; }.headline p { max-width:30rem; margin:0; color:var(--muted); line-height:1.6; } + .filters { display:grid; grid-template-columns:repeat(5,minmax(8rem,1fr)) auto auto; gap:.75rem; align-items:end; margin-bottom:1rem; padding:1rem; border:1px solid var(--line); border-radius:1.1rem; background:#121d37d9; box-shadow:0 1rem 3rem #03071466; }.filter { display:grid; gap:.35rem; }.filter label { color:#9fb1d5; font-size:.7rem; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }.filter select,.filter input { width:100%; min-height:2.65rem; border:1px solid #354a77; border-radius:.65rem; padding:0 .75rem; color:var(--ink); font:inherit; background:#0c1428; }.filter select:focus,.filter input:focus { outline:2px solid #82b5ff; outline-offset:2px; }.filter-submit { min-height:2.65rem; border:1px solid #8ab7ff; border-radius:.65rem; padding:0 1rem; color:#101a31; font:inherit; font-weight:800; background:#b9d6ff; cursor:pointer; }.map-tag { align-self:center; padding:.46rem .65rem; border:1px solid #4a5f8e; border-radius:999px; color:#c9d8f6; font-size:.75rem; font-weight:700; white-space:nowrap; background:#1d2b4e; } + .map-panel { overflow:hidden; border:1px solid var(--line); border-radius:1.25rem; background:var(--surface); box-shadow:0 1.5rem 4rem #0206168a; }.map-header { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:1rem 1.2rem; border-bottom:1px solid var(--line); }.map-header strong { font-size:.95rem; }.live { display:flex; align-items:center; gap:.45rem; color:#a7f3d0; font-size:.8rem; }.live i { width:.5rem; height:.5rem; border-radius:50%; background:var(--green); box-shadow:0 0 0 .25rem #34d3992e; }.map-wrap { position:relative; }.map { height:clamp(30rem,65vh,45rem); background:#dce4cf; }.legend { position:absolute; z-index:600; right:1rem; bottom:1rem; width:min(15rem,calc(100% - 2rem)); padding:.85rem; border:1px solid #344973; border-radius:.8rem; color:#dce7fe; font-size:.78rem; background:#101a31e8; box-shadow:0 .75rem 2rem #05091480; backdrop-filter:blur(10px); }.legend h2 { margin:0 0 .6rem; font-size:.82rem; }.legend div { display:flex; align-items:center; gap:.5rem; margin-top:.4rem; }.legend-dot { width:.7rem; height:.7rem; border:2px solid #f2c56b; border-radius:50%; background:#ed8e2e88; }.legend-ring { width:.85rem; height:.85rem; border:2px solid #a98af7; border-radius:50%; background:#8b5cf633; }.legend-line { width:1.1rem; border-top:2px dashed #644b9c; }.report-icon { display:grid; width:2.3rem; height:2.3rem; place-items:center; border:2px solid #fff3d5; border-radius:50%; color:#452000; font-size:1rem; font-weight:900; background:#f7a52f; box-shadow:0 .3rem 1rem #a84f2670; }.source-icon { display:grid; width:2.45rem; height:2.45rem; place-items:center; border:2px solid #fff3d5; border-radius:50% 50% 50% 0; color:#452000; font-size:1.15rem; background:#f7a52f; box-shadow:0 .3rem 1rem #a84f2670; transform:rotate(-45deg); }.source-icon span { transform:rotate(45deg); }.direction-marker { display:grid; width:3.5rem; height:3.5rem; place-items:center; border:3px solid #fff7e6; border-radius:50%; color:#fff; background:#6d45a0; box-shadow:0 .3rem 1rem #281642b3; }.direction-marker span { display:block; font-size:2.45rem; font-weight:950; line-height:1; text-shadow:0 .1rem .25rem #1e1136; transform-origin:center; } + .map-compass { position:relative; width:5rem; height:5rem; border:2px solid #eaf1ff; border-radius:50%; color:#f7fbff; font-size:.72rem; font-weight:900; background:#111a31e8; box-shadow:0 .5rem 1.5rem #05091480; backdrop-filter:blur(8px); }.map-compass span { position:absolute; display:grid; place-items:center; }.map-compass .compass-n { top:.35rem; left:50%; transform:translateX(-50%); color:#ffd18c; }.map-compass .compass-e { top:50%; right:.45rem; transform:translateY(-50%); }.map-compass .compass-s { bottom:.35rem; left:50%; transform:translateX(-50%); }.map-compass .compass-w { top:50%; left:.45rem; transform:translateY(-50%); }.map-compass .compass-needle { top:1.3rem; left:50%; color:#ffd18c; font-size:2rem; line-height:1; transform:translateX(-50%); text-shadow:0 .1rem .35rem #3b1b48; }.leaflet-control-zoom a { color:#243456!important; }.leaflet-popup-content-wrapper,.leaflet-popup-tip { color:#e9f1ff; background:#14203a; }.leaflet-popup-content { margin:.75rem .9rem; font-family:inherit; }.popup-title { display:block; margin-bottom:.2rem; font-weight:800; }.popup-meta { color:#a9b9d8; font-size:.78rem; } + @media (max-width:52rem) { .shell { width:min(100% - 1.25rem,80rem); }.topbar { margin-bottom:2.5rem; }.headline { align-items:start; flex-direction:column; gap:1rem; }.filters { grid-template-columns:1fr 1fr; }.filters .filter:first-child { grid-column:1/-1; }.map { height:32rem; } } + @media (max-width:30rem) { .nav a { padding:.5rem; }.filters { grid-template-columns:1fr; }.filters .filter:first-child { grid-column:auto; } } + \ No newline at end of file diff --git a/frontend/src/styles/pages/member-form.css b/frontend/src/styles/pages/member-form.css new file mode 100644 index 0000000..52da288 --- /dev/null +++ b/frontend/src/styles/pages/member-form.css @@ -0,0 +1,129 @@ + + :root { + --ink: #172033; + --muted: #667085; + --card: rgba(255, 255, 255, .92); + --line: #d7ddea; + --primary: #6255e7; + --success-bg: #eafaf1; + --success-ink: #176b42; + } + + * { box-sizing: border-box; } + + body { + min-width: 320px; + min-height: 100vh; + display: grid; + place-items: center; + margin: 0; + padding: 1.5rem; + color: var(--ink); + font-family: Inter, ui-sans-serif, system-ui, -apple-system, + BlinkMacSystemFont, "Segoe UI", sans-serif; + background: + radial-gradient(circle at 12% 15%, #cfe1ff 0, transparent 28rem), + radial-gradient(circle at 88% 88%, #e6d8ff 0, transparent 26rem), + #f6f7fb; + } + + .card { + width: min(100%, 31rem); + padding: clamp(1.75rem, 7vw, 3rem); + border: 1px solid rgba(255, 255, 255, .85); + border-radius: 1.5rem; + background: var(--card); + box-shadow: 0 1.5rem 4rem rgba(53, 56, 105, .16); + } + + .eyebrow { + display: inline-flex; + align-items: center; + gap: .5rem; + margin: 0 0 1rem; + color: var(--primary); + font-size: .78rem; + font-weight: 800; + letter-spacing: .11em; + text-transform: uppercase; + } + + .sparkle { + display: grid; + width: 1.65rem; + aspect-ratio: 1; + place-items: center; + border-radius: .55rem; + color: white; + font-size: .95rem; + background: linear-gradient(135deg, #7668ff, #a75ff4); + } + + h1 { + margin: 0; + font-size: clamp(2rem, 7vw, 3rem); + letter-spacing: -.055em; + line-height: 1.05; + } + + .intro { + margin: 1rem 0 2rem; + color: var(--muted); + line-height: 1.6; + } + + label { + display: block; + margin-bottom: .55rem; + font-size: .92rem; + font-weight: 700; + } + + input { + width: 100%; + min-height: 3.15rem; + padding: .75rem 1rem; + border: 1px solid var(--line); + border-radius: .75rem; + outline: none; + color: var(--ink); + font: inherit; + background: white; + } + + input:focus { + border-color: var(--primary); + box-shadow: 0 0 0 .25rem rgba(98, 85, 231, .15); + } + + button { + width: 100%; + min-height: 3.15rem; + margin-top: 1rem; + border: 0; + border-radius: .75rem; + cursor: pointer; + color: white; + font: inherit; + font-weight: 750; + background: linear-gradient(135deg, var(--primary), #8a5ce5); + box-shadow: 0 .65rem 1.3rem rgba(98, 85, 231, .24); + } + + button:hover { + transform: translateY(-1px); + } + + .result { + margin: 1.5rem 0 0; + padding: .9rem 1rem; + border-radius: .75rem; + color: var(--success-ink); + line-height: 1.45; + background: var(--success-bg); + } + .button { width: 100%;display:inline-flex; align-items:center; justify-content:center; gap:.6rem; min-height:2.9rem; padding:.75rem 1.05rem; border:1px solid #b3c9ff; border-radius:.8rem; color:#121a34; font:inherit; font-size:.93rem; font-weight:850; text-decoration:none; background:linear-gradient(135deg,#99c8ff,#c6adff); box-shadow:0 .65rem 1.75rem #7058dd50; transition:transform .2s ease,filter .2s ease; } + .button:hover { transform:translateY(-2px); filter:brightness(1.08); } + .button:focus-visible { outline:3px solid #a5c9ff80; outline-offset:3px; } + + \ No newline at end of file diff --git a/frontend/src/styles/pages/member-list.css b/frontend/src/styles/pages/member-list.css new file mode 100644 index 0000000..7b8482e --- /dev/null +++ b/frontend/src/styles/pages/member-list.css @@ -0,0 +1,209 @@ + + :root { + --ink: #172033; + --muted: #667085; + --card: rgba(255, 255, 255, .94); + --line: #e1e6ef; + --primary: #6255e7; + --primary-soft: #f0eeff; + --empty-bg: #f7f8fc; + } + + * { + box-sizing: border-box; + } + + body { + min-width: 320px; + min-height: 100vh; + margin: 0; + padding: clamp(1.25rem, 5vw, 4rem); + color: var(--ink); + font-family: Inter, ui-sans-serif, system-ui, -apple-system, + BlinkMacSystemFont, "Segoe UI", sans-serif; + background: + radial-gradient(circle at 8% 8%, #d9e7ff 0, transparent 30rem), + radial-gradient(circle at 92% 90%, #eadcff 0, transparent 30rem), + #f6f7fb; + } + + .page { + width: min(100%, 70rem); + margin: 0 auto; + } + + .card { + overflow: hidden; + border: 1px solid rgba(255, 255, 255, .9); + border-radius: 1.5rem; + background: var(--card); + box-shadow: 0 1.5rem 4rem rgba(53, 56, 105, .14); + } + + .header { + display: flex; + align-items: end; + justify-content: space-between; + gap: 1.5rem; + padding: clamp(1.5rem, 5vw, 3rem); + border-bottom: 1px solid var(--line); + } + + .eyebrow { + display: inline-flex; + align-items: center; + gap: .5rem; + margin: 0 0 .85rem; + color: var(--primary); + font-size: .78rem; + font-weight: 800; + letter-spacing: .11em; + text-transform: uppercase; + } + + .sparkle { + display: grid; + width: 1.65rem; + aspect-ratio: 1; + place-items: center; + border-radius: .55rem; + color: white; + font-size: .95rem; + background: linear-gradient(135deg, #7668ff, #a75ff4); + } + + h1 { + margin: 0; + font-size: clamp(2rem, 5vw, 3.25rem); + letter-spacing: -.06em; + line-height: 1.05; + } + + .intro { + max-width: 38rem; + margin: .85rem 0 0; + color: var(--muted); + line-height: 1.6; + } + + .count { + flex: 0 0 auto; + margin: 0; + padding: .6rem .85rem; + border-radius: 999px; + color: var(--primary); + font-size: .88rem; + font-weight: 750; + white-space: nowrap; + background: var(--primary-soft); + } + + .table-wrap { + overflow-x: auto; + } + + table { + width: 100%; + min-width: 38rem; + border-collapse: collapse; + text-align: left; + } + + th { + padding: 1rem clamp(1.25rem, 3vw, 2rem); + color: var(--muted); + font-size: .75rem; + font-weight: 800; + letter-spacing: .08em; + text-transform: uppercase; + background: #fafbfe; + } + + td { + padding: 1.15rem clamp(1.25rem, 3vw, 2rem); + border-top: 1px solid var(--line); + vertical-align: middle; + } + + tbody tr { + transition: background .18s ease; + } + + tbody tr:hover { + background: #faf9ff; + } + + .member { + display: flex; + align-items: center; + gap: .85rem; + font-weight: 750; + } + + .avatar { + display: grid; + width: 2.45rem; + aspect-ratio: 1; + flex: 0 0 auto; + place-items: center; + border-radius: 50%; + color: var(--primary); + font-size: .82rem; + font-weight: 850; + background: var(--primary-soft); + } + + .phone { + color: var(--muted); + font-variant-numeric: tabular-nums; + } + + .date { + color: var(--muted); + white-space: nowrap; + } + + .empty { + padding: clamp(3rem, 10vw, 6rem) 1.5rem; + text-align: center; + background: var(--empty-bg); + } + + .empty-icon { + display: grid; + width: 3.5rem; + aspect-ratio: 1; + place-items: center; + margin: 0 auto 1rem; + border-radius: 1rem; + color: var(--primary); + font-size: 1.4rem; + background: var(--primary-soft); + } + + .empty h2 { + margin: 0; + font-size: 1.2rem; + letter-spacing: -.03em; + } + + .empty p { + margin: .5rem 0 0; + color: var(--muted); + } + + @media (max-width: 40rem) { + .header { + align-items: start; + flex-direction: column; + } + + .count { + align-self: start; + } + } + .button { display:inline-flex; align-items:center; justify-content:center; gap:.6rem; min-height:2.9rem; padding:.75rem 1.05rem; border:1px solid #b3c9ff; border-radius:.8rem; color:#121a34; font:inherit; font-size:.93rem; font-weight:850; text-decoration:none; background:linear-gradient(135deg,#99c8ff,#c6adff); box-shadow:0 .65rem 1.75rem #7058dd50; transition:transform .2s ease,filter .2s ease; } + .button:hover { transform:translateY(-2px); filter:brightness(1.08); } + .button:focus-visible { outline:3px solid #a5c9ff80; outline-offset:3px; } + + \ No newline at end of file diff --git a/frontend/src/styles/pages/member-success.css b/frontend/src/styles/pages/member-success.css new file mode 100644 index 0000000..4188c49 --- /dev/null +++ b/frontend/src/styles/pages/member-success.css @@ -0,0 +1,127 @@ + + :root { + --ink: #172033; + --muted: #667085; + --card: rgba(255, 255, 255, .92); + --line: #d7ddea; + --primary: #6255e7; + --success-bg: #eafaf1; + --success-ink: #176b42; + } + + * { box-sizing: border-box; } + + body { + min-width: 320px; + min-height: 100vh; + display: grid; + place-items: center; + margin: 0; + padding: 1.5rem; + color: var(--ink); + font-family: Inter, ui-sans-serif, system-ui, -apple-system, + BlinkMacSystemFont, "Segoe UI", sans-serif; + background: + radial-gradient(circle at 12% 15%, #cfe1ff 0, transparent 28rem), + radial-gradient(circle at 88% 88%, #e6d8ff 0, transparent 26rem), + #f6f7fb; + } + + .card { + width: min(100%, 31rem); + padding: clamp(1.75rem, 7vw, 3rem); + border: 1px solid rgba(255, 255, 255, .85); + border-radius: 1.5rem; + background: var(--card); + box-shadow: 0 1.5rem 4rem rgba(53, 56, 105, .16); + } + + .eyebrow { + display: inline-flex; + align-items: center; + gap: .5rem; + margin: 0 0 1rem; + color: var(--primary); + font-size: .78rem; + font-weight: 800; + letter-spacing: .11em; + text-transform: uppercase; + } + + .sparkle { + display: grid; + width: 1.65rem; + aspect-ratio: 1; + place-items: center; + border-radius: .55rem; + color: white; + font-size: .95rem; + background: linear-gradient(135deg, #7668ff, #a75ff4); + } + .button { display:inline-flex; align-items:center; justify-content:center; gap:.6rem; min-height:2.9rem; padding:.75rem 1.05rem; border:1px solid #b3c9ff; border-radius:.8rem; color:#121a34; font:inherit; font-size:.93rem; font-weight:850; text-decoration:none; background:linear-gradient(135deg,#99c8ff,#c6adff); box-shadow:0 .65rem 1.75rem #7058dd50; transition:transform .2s ease,filter .2s ease; } + .button:hover { transform:translateY(-2px); filter:brightness(1.08); } + .button:focus-visible { outline:3px solid #a5c9ff80; outline-offset:3px; } + h1 { + margin: 0; + font-size: clamp(2rem, 7vw, 3rem); + letter-spacing: -.055em; + line-height: 1.05; + } + + .intro { + margin: 1rem 0 2rem; + color: var(--muted); + line-height: 1.6; + } + + label { + display: block; + margin-bottom: .55rem; + font-size: .92rem; + font-weight: 700; + } + + input { + width: 100%; + min-height: 3.15rem; + padding: .75rem 1rem; + border: 1px solid var(--line); + border-radius: .75rem; + outline: none; + color: var(--ink); + font: inherit; + background: white; + } + + input:focus { + border-color: var(--primary); + box-shadow: 0 0 0 .25rem rgba(98, 85, 231, .15); + } + + button { + width: 100%; + min-height: 3.15rem; + margin-top: 1rem; + border: 0; + border-radius: .75rem; + cursor: pointer; + color: white; + font: inherit; + font-weight: 750; + background: linear-gradient(135deg, var(--primary), #8a5ce5); + box-shadow: 0 .65rem 1.3rem rgba(98, 85, 231, .24); + } + + button:hover { + transform: translateY(-1px); + } + + .result { + margin: 1.5rem 0 0; + padding: .9rem 1rem; + border-radius: .75rem; + color: var(--success-ink); + line-height: 1.45; + background: var(--success-bg); + } + \ No newline at end of file diff --git a/frontend/src/styles/pages/not-found.css b/frontend/src/styles/pages/not-found.css new file mode 100644 index 0000000..0c678e6 --- /dev/null +++ b/frontend/src/styles/pages/not-found.css @@ -0,0 +1,8 @@ + + :root { --ink:#eef3ff; --muted:#aab9d8; --line:#2b3d68; --violet:#b69cff; --blue:#8abaff; } + * { box-sizing:border-box; } + body { min-width:320px; min-height:100vh; display:grid; place-items:center; margin:0; padding:1.5rem; color:var(--ink); font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; background:radial-gradient(circle at 8% 0%,#263a76 0,transparent 31rem),radial-gradient(circle at 96% 100%,#512363 0,transparent 29rem),#090e1d; } + .card { width:min(100%,42rem); position:relative; overflow:hidden; padding:clamp(2rem,7vw,4.75rem); border:1px solid var(--line); border-radius:1.5rem; text-align:center; background:linear-gradient(145deg,#172443e8,#10182ddd); box-shadow:0 1.75rem 5rem #01030c99; backdrop-filter:blur(16px); }.card::before,.card::after { content:""; position:absolute; border-radius:50%; filter:blur(1px); pointer-events:none; }.card::before { width:14rem; height:14rem; top:-8rem; left:-5rem; background:#5888e536; }.card::after { width:11rem; height:11rem; right:-5rem; bottom:-5rem; background:#b069e73d; } + .mark { display:grid; width:4.25rem; aspect-ratio:1; place-items:center; margin:0 auto 1.75rem; border:1px solid #a7c7ff66; border-radius:1.1rem; color:#141c39; font-size:1.7rem; background:linear-gradient(135deg,#a8ceff,#c5b3ff); box-shadow:0 .65rem 1.75rem #735ee150; transform:rotate(8deg); }.mark span { transform:rotate(-8deg); }.code { margin:0; color:#bfcfff; font-size:.78rem; font-weight:900; letter-spacing:.2em; text-transform:uppercase; }.code strong { color:#f2d07f; }.title { max-width:10ch; margin:.75rem auto 1rem; font-size:clamp(2.5rem,8vw,5rem); line-height:.96; letter-spacing:-.065em; }.message { max-width:31rem; margin:0 auto; color:var(--muted); line-height:1.65; }.path { display:inline-block; max-width:100%; margin-top:1.1rem; padding:.45rem .7rem; overflow-wrap:anywhere; border:1px solid #354b7a; border-radius:.55rem; color:#c6d5f3; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:.78rem; background:#0a1123; }.actions { display:flex; justify-content:center; gap:.75rem; flex-wrap:wrap; margin-top:2rem; }.button { display:inline-flex; align-items:center; justify-content:center; min-height:2.8rem; padding:.7rem 1rem; border:1px solid #455d92; border-radius:.75rem; color:#dce7ff; font-size:.92rem; font-weight:800; text-decoration:none; background:#1b2949; transition:transform .2s ease,background .2s ease; }.button:hover { transform:translateY(-2px); background:#263b69; }.button-primary { border-color:#b2c8ff; color:#121a34; background:linear-gradient(135deg,#97c5ff,#c2adff); }.button-primary:hover { background:linear-gradient(135deg,#b0d4ff,#d1c2ff); } + @media (prefers-reduced-motion:reduce) { .button { transition:none; } } + \ No newline at end of file diff --git a/frontend/src/styles/pages/settings.css b/frontend/src/styles/pages/settings.css new file mode 100644 index 0000000..c24a633 --- /dev/null +++ b/frontend/src/styles/pages/settings.css @@ -0,0 +1,51 @@ +/* Settings cards follow the shared blue and violet theme. */ +*{box-sizing:border-box} +body{min-height:100vh;padding:0;color:var(--theme-ink);background:var(--theme-bg)} +.settings-shell{width:min(100% - 3.5rem,73.75rem);margin:auto;padding:4rem 0 5rem} +.settings-content{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2.25rem 2rem;width:100%} +.settings-heading,.messages{grid-column:1/-1} +.settings-heading{margin-bottom:0} +.eyebrow{margin:0 0 .7rem;color:#9fc5ff;font-size:.74rem;font-weight:800;letter-spacing:.1em;text-transform:uppercase} +h1,h2{font-family:Georgia,ui-serif,serif;font-weight:700} +h1{margin:0;font-size:clamp(2.3rem,4vw,3.5rem);letter-spacing:-.045em;line-height:1.12} +h2{margin:0 0 .45rem;font-size:1.5rem;letter-spacing:-.02em} +.intro,.help{margin:.45rem 0 0;color:var(--theme-muted);line-height:1.55} +.card{min-width:0;width:100%;margin:0;padding:1.75rem;border:1px solid var(--theme-line);border-radius:1.125rem;background:var(--theme-surface);box-shadow:0 1.125rem 2.8rem #02071429} +.settings-form{display:flex;flex-direction:column;gap:1rem}.settings-form h2+.field{margin-top:.4rem} +.settings-form>.button[type=submit]{margin-top:auto} +.field label{display:block;margin:0 0 .375rem;font-size:.85rem;font-weight:700} +.field input,.field select{display:block;width:100%;min-height:2.625rem;padding:.55rem .625rem;border:1px solid var(--theme-line);border-radius:.56rem;color:var(--theme-ink);background:var(--theme-input);font:inherit} +.field input:focus-visible,.field select:focus-visible,.button:focus-visible,.switch-control input:focus-visible+.switch-track{outline:3px solid #80b6ff;outline-offset:3px} +.errorlist{margin:.5rem 0 0;padding:.7rem .9rem;border-radius:.55rem;color:#fee2e2;background:#7f1d1d} +.button{display:inline-flex;align-items:center;justify-content:center;width:100%;min-height:2.875rem;margin:0;padding:.65rem 1.2rem;border:1px solid transparent;border-radius:999px;color:#111c30;background:#a6ccff;font:inherit;font-size:.9rem;font-weight:800;text-align:center;text-decoration:none;cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease} +.button:hover{transform:translateY(-1px);background:#c0ddff;box-shadow:0 .45rem 1rem #5899f733} +.button--secondary{border-color:#6386bd;color:#d7e8ff;background:#223755}.button--secondary:hover{color:#111c30;background:#a6ccff} +.switch-row{display:flex;align-items:center;justify-content:space-between;gap:1.125rem;min-height:4.375rem;padding:.8rem 1rem;border:1px solid #3d5879;border-radius:.94rem;background:#1a2a43;cursor:pointer} +.switch-row:hover{border-color:#739ad0;background:#203554}.switch-copy{display:grid;gap:.2rem;min-width:0}.switch-copy strong{font-size:.92rem}.switch-copy small{color:var(--theme-muted);font-size:.77rem;line-height:1.35} +.switch-control{position:relative;display:block;flex:0 0 3.1875rem;width:3.1875rem;height:1.9375rem}.switch-control input{position:absolute;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}.switch-track{display:block;width:100%;height:100%;border-radius:999px;background:#62758b;pointer-events:none;transition:background .16s ease} +.switch-track::after{content:"";position:absolute;top:2px;left:2px;width:27px;height:27px;border-radius:50%;background:#fff;box-shadow:0 1px 4px #0004;transition:transform .16s ease}.switch-control input:checked+.switch-track{background:#34c76a}.switch-control input:checked+.switch-track::after{transform:translateX(20px)} +.messages{margin:0;padding:0;list-style:none}.alert{margin:.5rem 0 0;padding:.75rem 1rem;border-radius:.65rem;line-height:1.45}#ntfy-test-result:empty{display:none} +.sensor-list__intro{padding-bottom:1.25rem;border-bottom:1px solid var(--theme-line)}.sensor-list__intro .eyebrow{margin-bottom:.35rem} +.sensor-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem;margin:1.5rem 0}.sensor-card{display:flex;flex-direction:column;min-width:0;margin:0;padding:1.3rem;border:1px solid var(--theme-line);border-radius:1rem;background:var(--theme-surface-raised)} +.sensor-card__heading{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:.5rem 1rem}.sensor-card__heading h3{margin:0;font-family:Georgia,ui-serif,serif;font-size:1.25rem;overflow-wrap:anywhere}.sensor-card .sensor-status{display:inline-flex;padding:.32rem .65rem;border-radius:999px;background:var(--theme-input);font-size:.78rem;white-space:nowrap} +.sensor-status{color:var(--theme-muted);font-weight:700}.sensor-status--online{color:#64dca0}.sensor-status--delayed{color:#f5c46b}.sensor-status--offline{color:#f49aa7} +.sensor-access{align-self:flex-start;margin-top:.7rem;padding:.25rem .55rem;border:1px solid #3d806b;border-radius:999px;color:#8be0b9;font-size:.72rem;font-weight:800}.sensor-access--off{border-color:#806b75;color:#d4b9c5} +.sensor-card__facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.8rem 1rem;margin:1.3rem 0}.sensor-card__facts div{min-width:0}.sensor-card__facts dt{margin-bottom:.25rem;color:var(--theme-muted);font-size:.75rem;font-weight:700}.sensor-card__facts dd{margin:0;font-size:.88rem;font-weight:600;overflow-wrap:anywhere}.sensor-card__facts code{font:inherit}.sensor-card__facts div:last-child{grid-column:1/-1} +.sensor-card .button{margin-top:auto}.sensor-empty{grid-column:1/-1;margin:0;padding:1.5rem;border:1px dashed var(--theme-line);border-radius:1rem;color:var(--theme-muted);text-align:center;line-height:1.5} +.sensor-form{margin-top:1.5rem;padding:1.3rem;border:1px dashed #6386bd;border-radius:1rem;background:var(--theme-surface-raised)}.sensor-form h3{margin:0;font-family:Georgia,ui-serif,serif;font-size:1.2rem}.sensor-form .help{margin-top:.3rem}.sensor-form__controls{display:grid;grid-template-columns:minmax(0,1fr) 11rem;align-items:end;gap:1rem} +.settings-content>#sensor-card{grid-column:1/-1} +.sensor-detail__header{display:flex;align-items:start;justify-content:space-between;gap:1rem;padding-bottom:1.2rem;border-bottom:1px solid var(--theme-line)}.sensor-detail__header .eyebrow{margin-bottom:.35rem}.sensor-detail__header h2{margin:0;font-size:clamp(1.6rem,3vw,2rem);overflow-wrap:anywhere}.sensor-close{display:inline-flex;align-items:center;gap:.35rem;flex:none;padding:.45rem .85rem;border:1px solid var(--theme-line);border-radius:999px;color:var(--theme-ink);background:var(--theme-surface-raised);font-size:.85rem;font-weight:700;text-decoration:none}.sensor-close:hover{border-color:#86ade0;background:#2b4266}.sensor-close:focus-visible{outline:3px solid #80b6ff;outline-offset:3px} +.sensor-detail__overview{margin:1.25rem 0 1.5rem;padding:1.2rem;border:1px solid var(--theme-line);border-radius:1rem;background:var(--theme-surface-raised)}.sensor-detail__overview>.sensor-status{display:inline-flex;margin:0 0 1rem;padding:.35rem .7rem;border-radius:999px;background:var(--theme-input);font-size:.85rem} +.sensor-detail__facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem 1.5rem;margin:0}.sensor-detail__facts div{min-width:0}.sensor-detail__facts dt{margin:0 0 .3rem;color:var(--theme-muted);font-size:.78rem;font-weight:700}.sensor-detail__facts dd{margin:0;overflow-wrap:anywhere;font-size:.92rem;font-weight:600}.sensor-detail__facts code{font:inherit} +.sensor-detail__actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}.sensor-detail__section{display:flex;flex-direction:column;min-width:0;padding:1.2rem;border:1px solid var(--theme-line);border-radius:1rem;background:var(--theme-surface-raised)}.sensor-detail__section h3{margin:0 0 .35rem;font-family:Georgia,ui-serif,serif;font-size:1.15rem}.sensor-detail__section>.help{margin:0}.sensor-detail__section form{display:flex;flex:1;flex-direction:column;gap:.8rem;margin-top:1rem}.sensor-detail__section form .button{margin-top:auto}.sensor-detail__section .field{width:100%}.sensor-detail__section:last-child{border-color:#945f68;background:#392432}.sensor-detail__section:last-child .button--danger{border-color:#dc7b89;color:#fff;background:#a43c50}.sensor-detail__section:last-child .button--danger:hover{background:#bd4a60} +.sensor-confirm{display:flex;align-items:start;gap:.6rem;line-height:1.4;font-size:.82rem;cursor:pointer}.sensor-confirm input{flex:none;width:1.1rem;height:1.1rem;margin:.15rem 0 0;accent-color:#84baff}.sensor-confirm input:focus-visible{outline:3px solid #80b6ff;outline-offset:3px} +.sensor-messages{margin-top:1rem}.token-once{margin:1.25rem 0;padding:1rem;border:1px solid #e4ad55;border-radius:.8rem;background:var(--theme-surface-raised)}.token-once code{display:block;margin:.75rem 0;padding:.7rem;border-radius:.5rem;background:var(--theme-input);overflow-wrap:anywhere;user-select:all} +.button--danger{color:#fff;background:#991b1b}.button--danger:hover{color:#fff;background:#b91c1c} +:root[data-theme=light] .eyebrow{color:#23578d}:root[data-theme=light] .card{box-shadow:0 1.125rem 2.8rem #20365c1a}:root[data-theme=light] .button:not(.button--secondary):not(.button--danger){color:#fff;background:#245b96}:root[data-theme=light] .button:not(.button--secondary):not(.button--danger):hover{background:#174877}:root[data-theme=light] .button--secondary{border-color:#9cc0ed;color:#245b96;background:#edf4ff}:root[data-theme=light] .button--secondary:hover{color:#fff;background:#245b96}:root[data-theme=light] .switch-row{border-color:#d4e0ef;background:#f2f7fe}:root[data-theme=light] .switch-row:hover{border-color:#9cc0ed;background:#eaf3ff}:root[data-theme=light] .switch-track{background:#c1cbd8}:root[data-theme=light] .switch-control input:checked+.switch-track{background:#34c76a} +:root[data-theme=light] .sensor-close:hover{background:#e4efff}:root[data-theme=light] .sensor-detail__section:last-child{border-color:#ecc6cb;background:#fff5f6}:root[data-theme=light] .sensor-detail__section:last-child .button--danger{color:#fff;background:#a43c50} +:root[data-theme=light] .sensor-access{border-color:#b8dfca;color:#256147;background:#ecf8f0}:root[data-theme=light] .sensor-access--off{border-color:#dbcbd3;color:#80556a;background:#fbf4f7}:root[data-theme=light] .sensor-form{border-color:#9cc0ed} +@media(max-width:48rem){.settings-content{grid-template-columns:minmax(0,1fr)}.settings-shell{width:min(100% - 2.25rem,73.75rem);padding:2.5rem 0 3rem}} +@media(max-width:48rem){.sensor-detail__actions,.sensor-list{grid-template-columns:minmax(0,1fr)}} +@media(max-width:30rem){.sensor-detail__facts{grid-template-columns:minmax(0,1fr)}.sensor-detail__header{align-items:start}.sensor-close span{display:none}} +@media(max-width:35rem){.card{padding:1.25rem}.sensor-form__controls{grid-template-columns:minmax(0,1fr)}} +@media(prefers-reduced-motion:reduce){.button,.switch-track,.switch-track::after{transition:none}.button:hover{transform:none}} diff --git a/frontend/src/styles/theme.css b/frontend/src/styles/theme.css new file mode 100644 index 0000000..3b2c4f8 --- /dev/null +++ b/frontend/src/styles/theme.css @@ -0,0 +1,117 @@ +:root { + color-scheme: dark; + --theme-bg: #090e1d; + --theme-ink: #eef3ff; + --theme-muted: #aab9d8; + --theme-surface: #172443; + --theme-surface-raised: #111a31; + --theme-line: #2b3d68; + --theme-input: #0a1123; +} + +:root[data-theme="light"] { + color-scheme: light; + --ink: #172033; + --i: #172033; + --muted: #536174; + --m: #536174; + --line: #c4cede; + --l: #c4cede; + --surface: #ffffff; + --surface-2: #f2f6fc; + --card: rgba(255, 255, 255, .94); + --theme-bg: #f4f7fc; + --theme-ink: #172033; + --theme-muted: #536174; + --theme-surface: #ffffff; + --theme-surface-raised: #f2f6fc; + --theme-line: #c4cede; + --theme-input: #ffffff; +} + +:root[data-theme="light"] body { + color: var(--theme-ink) !important; + background: radial-gradient(circle at 8% 0%, #dbeaff 0, transparent 31rem), radial-gradient(circle at 96% 100%, #eee2ff 0, transparent 29rem), var(--theme-bg) !important; +} + +:root[data-theme="light"] .card, +:root[data-theme="light"] .welcome-card, +:root[data-theme="light"] .upload-card, +:root[data-theme="light"] .results-card, +:root[data-theme="light"] .panel, +:root[data-theme="light"] .map-panel { + border-color: var(--theme-line) !important; + background: var(--theme-surface) !important; + box-shadow: 0 1rem 3rem rgba(32, 54, 92, .14) !important; +} + +:root[data-theme="light"] .topbar, +:root[data-theme="light"] .map-header, +:root[data-theme="light"] .nav, +:root[data-theme="light"] .filters, +:root[data-theme="light"] .result-group, +:root[data-theme="light"] .prediction, +:root[data-theme="light"] .event, +:root[data-theme="light"] .drop-zone { + border-color: var(--theme-line) !important; + color: var(--theme-ink); + background: var(--theme-surface-raised) !important; +} + +:root[data-theme="light"] .audio-upload--uploading .drop-zone, +:root[data-theme="light"] .audio-upload--processing .drop-zone { + border-color: #7296d5 !important; + background: #e4ebff !important; +} + +:root[data-theme="light"] input, +:root[data-theme="light"] select, +:root[data-theme="light"] textarea, +:root[data-theme="light"] .path { + border-color: var(--theme-line) !important; + color: var(--theme-ink) !important; + background: var(--theme-input) !important; +} + +:root[data-theme="light"] .intro, +:root[data-theme="light"] .lede, +:root[data-theme="light"] .subject, +:root[data-theme="light"] .message, +:root[data-theme="light"] .help, +:root[data-theme="light"] .empty, +:root[data-theme="light"] .meta, +:root[data-theme="light"] .popup-meta { + color: var(--theme-muted) !important; +} + +.theme-toggle { + position: fixed; + top: 1rem; + left: 1rem; + z-index: 1200; + min-height: 2.5rem; + padding: .5rem .75rem; + border: 1px solid var(--theme-line); + border-radius: 999px; + color: var(--theme-ink); + font: 700 .82rem/1 Inter, ui-sans-serif, system-ui, sans-serif; + background: var(--theme-surface); + box-shadow: 0 .35rem 1.25rem rgba(1, 3, 12, .24); + cursor: pointer; +} + +.theme-toggle:hover { filter: brightness(1.08); } +.theme-toggle:focus-visible { outline: 3px solid #8abaff; outline-offset: 3px; } + +@media (prefers-reduced-motion: reduce) { + *, *::before, *::after { transition-duration: .01ms !important; } +} + + +/* Shared light-mode typography for the Fireworks pages. */ +:root[data-theme="light"] .shell h1 { color: #172b50 !important; } +:root[data-theme="light"] .shell h2 { color: #203b63 !important; } +:root[data-theme="light"] .shell h3 { color: #31527f !important; } +:root[data-theme="light"] .shell .kicker, +:root[data-theme="light"] .shell .eyebrow { color: #3f6fa9 !important; } +:root[data-theme="light"] .shell .map-header strong { color: #243e65 !important; } diff --git a/frontend/tests/audio-upload-mode.test.mjs b/frontend/tests/audio-upload-mode.test.mjs new file mode 100644 index 0000000..d68a075 --- /dev/null +++ b/frontend/tests/audio-upload-mode.test.mjs @@ -0,0 +1,84 @@ +import assert from "node:assert/strict"; +import test from "node:test"; +import { JSDOM } from "jsdom"; + +function fixture() { + const dom = new JSDOM(` + +
+ + + + +
+

`, { url: "https://example.test/" }); + const { window } = dom; + window.matchMedia = () => ({ matches: false }); + window.BOOMCAST_I18N = {}; + const requests = []; + class MockXHR { + upload = { addEventListener() {} }; + addEventListener() {} + open() {} + send(data) { requests.push(data); } + } + const originals = Object.fromEntries(["window", "document", "FormData", "XMLHttpRequest", "DOMParser", "fetch"].map((name) => [name, globalThis[name]])); + Object.assign(globalThis, { window, document: window.document, FormData: window.FormData, XMLHttpRequest: MockXHR, DOMParser: window.DOMParser }); + const form = window.document.querySelector("form"); + form.reportValidity = () => true; + const input = window.document.querySelector("#audio-file"); + const audio = new window.File(["audio"], "clip.wav", { type: "audio/wav" }); + Object.defineProperty(input, "files", { configurable: true, value: [audio] }); + const toggle = window.document.querySelector("#browser-processing-toggle"); + return { window, form, input, audio, toggle, requests, restore: () => { + for (const [name, value] of Object.entries(originals)) { + if (value === undefined) delete globalThis[name]; + else globalThis[name] = value; + } + dom.window.close(); + } }; +} + +test("admin ON with user toggle OFF uploads the original audio without policy fetch", async () => { + const ui = fixture(); + let fetches = 0; + globalThis.fetch = () => { fetches += 1; throw new Error("browser policy must not load"); }; + try { + await import("../src/scripts/audio-upload.js?mode=server"); + assert.equal(ui.toggle.checked, false); + ui.input.dispatchEvent(new ui.window.Event("change", { bubbles: true })); + assert.equal(ui.form.querySelector('button[type="submit"]').disabled, false); + ui.form.dispatchEvent(new ui.window.Event("submit", { bubbles: true, cancelable: true })); + assert.equal(fetches, 0); + assert.equal(ui.requests.length, 1); + assert.equal(ui.requests[0].get("audio").name, "clip.wav"); + assert.equal(ui.requests[0].has("browser_processing_metadata"), false); + } finally { ui.restore(); } +}); + +test("switching browser mode off invalidates a policy job and restores server submission", async () => { + const ui = fixture(); + let resolveFetch; + let fetches = 0; + globalThis.fetch = () => { fetches += 1; return new Promise((resolve) => { resolveFetch = resolve; }); }; + try { + await import("../src/scripts/audio-upload.js?mode=switch"); + ui.input.dispatchEvent(new ui.window.Event("change", { bubbles: true })); + ui.toggle.checked = true; + ui.toggle.dispatchEvent(new ui.window.Event("change", { bubbles: true })); + for (let i = 0; i < 30 && !resolveFetch; i += 1) await new Promise((resolve) => setTimeout(resolve, 5)); + assert.equal(fetches, 1); + assert.equal(ui.form.querySelector('button[type="submit"]').disabled, true); + ui.toggle.checked = false; + ui.toggle.dispatchEvent(new ui.window.Event("change", { bubbles: true })); + resolveFetch({ ok: true, json: async () => ({ browser_processing_beta_enabled: true, version: 1 }) }); + await new Promise((resolve) => setTimeout(resolve, 0)); + assert.equal(ui.input.accept, "audio/*,.wav"); + assert.equal(ui.form.querySelector('button[type="submit"]').disabled, false); + assert.equal(ui.window.document.querySelector("#browser-gate").hidden, true); + ui.form.dispatchEvent(new ui.window.Event("submit", { bubbles: true, cancelable: true })); + assert.equal(ui.requests.length, 1); + assert.equal(ui.requests[0].get("audio").name, "clip.wav"); + assert.equal(ui.requests[0].has("browser_processing_metadata"), false); + } finally { ui.restore(); } +}); diff --git a/frontend/tests/browser-submission-gate.test.mjs b/frontend/tests/browser-submission-gate.test.mjs new file mode 100644 index 0000000..dd2c587 --- /dev/null +++ b/frontend/tests/browser-submission-gate.test.mjs @@ -0,0 +1,99 @@ +import assert from "node:assert/strict"; +import test from "node:test"; +import { BrowserSubmissionGate } from "../src/scripts/browser-submission-gate.js"; +import { BrowserSubmissionProcessor } from "../src/scripts/browser-submission-processor.js"; + +const policy = { whitelist: ["Fireworks"], privacy_sensitive_speech: ["Speech"], thresholds: { relevance: .5, speech: .5 } }; + +test("whitelist match allows normal submission even when speech is present", () => { + const decision = BrowserSubmissionGate.evaluate([{ class: "Fireworks", score: .8 }, { class: "Speech", score: .9 }], policy); + assert.equal(decision.result, "whitelist_match"); + assert.equal(decision.speechDetected, true); +}); + +test("speech without relevance and irrelevant audio require explicit override", () => { + assert.equal(BrowserSubmissionGate.evaluate([{ class: "Speech", score: .9 }], policy).result, "speech_only"); + assert.equal(BrowserSubmissionGate.evaluate([{ class: "Music", score: .9 }], policy).result, "no_match"); +}); + +test("audio and video-derived WAV use the same gate; audio never calls FFmpeg", async () => { + const originalFetch = globalThis.fetch; + globalThis.fetch = async () => ({ ok: true, json: async () => ({ ...policy, browser_processing_beta_enabled: true, version: 1 }) }); + let extractionCalls = 0; + let classificationCalls = 0; + const processor = new BrowserSubmissionProcessor( + { browserProcessingBeta: true, policyUrl: "/policy", policyVersion: 1 }, + async () => { extractionCalls += 1; return new File(["wav"], "clip.wav", { type: "audio/wav" }); }, + { prepareAudio: async () => new Float32Array(16000), classify: async () => { classificationCalls += 1; return [{ class: "Speech", score: .9 }]; } }, + ); + processor.setEnabled(true); + try { + assert.equal((await processor.prepare(new File(["audio"], "audio.wav", { type: "audio/wav" }))).gate, "speech_only"); + assert.equal(extractionCalls, 0); + assert.equal((await processor.prepare(new File(["video"], "clip.mp4", { type: "video/mp4" }))).gate, "speech_only"); + assert.equal(extractionCalls, 1); + assert.equal(classificationCalls, 2); + } finally { globalThis.fetch = originalFetch; } +}); + +test("local classifier failure restores ordinary server upload", async () => { + const originalFetch = globalThis.fetch; + globalThis.fetch = async () => ({ ok: true, json: async () => ({ ...policy, browser_processing_beta_enabled: true, version: 1 }) }); + const processor = new BrowserSubmissionProcessor( + { browserProcessingBeta: true, policyUrl: "/policy", policyVersion: 1 }, null, + { prepareAudio: async () => new Float32Array(16000), classify: async () => { throw new Error("offline"); } }, + ); + const audio = new File(["audio"], "audio.wav", { type: "audio/wav" }); + processor.setEnabled(true); + try { + const result = await processor.prepare(audio); + assert.equal(result.file, audio); + assert.equal(result.gate, "unavailable"); + } finally { globalThis.fetch = originalFetch; } +}); + +test("aborted classification never yields a gate decision", async () => { + const originalFetch = globalThis.fetch; + globalThis.fetch = async () => ({ ok: true, json: async () => ({ ...policy, browser_processing_beta_enabled: true, version: 1 }) }); + const controller = new AbortController(); + const processor = new BrowserSubmissionProcessor( + { browserProcessingBeta: true, policyUrl: "/policy", policyVersion: 1 }, null, + { prepareAudio: async () => new Float32Array(16000), classify: async () => { controller.abort(); return [{ class: "Fireworks", score: .9 }]; } }, + ); + processor.setEnabled(true); + try { + await assert.rejects(processor.prepare(new File(["audio"], "audio.wav", { type: "audio/wav" }), { signal: controller.signal })); + } finally { globalThis.fetch = originalFetch; } +}); + +test("replacing a classification cancels the old result and keeps the new file", async () => { + const originalFetch = globalThis.fetch; + globalThis.fetch = async () => ({ ok: true, json: async () => ({ ...policy, browser_processing_beta_enabled: true, version: 1 }) }); + let firstStarted; + const started = new Promise((resolve) => { firstStarted = resolve; }); + let finishFirst; + let calls = 0; + const processor = new BrowserSubmissionProcessor( + { browserProcessingBeta: true, policyUrl: "/policy", policyVersion: 1 }, null, + { prepareAudio: async () => new Float32Array(16000), classify: async () => { + calls += 1; + if (calls === 1) { + firstStarted(); + return new Promise((resolve) => { finishFirst = resolve; }); + } + return [{ class: "Fireworks", score: .9 }]; + } }, + ); + processor.setEnabled(true); + const firstFile = new File(["a"], "first.wav", { type: "audio/wav" }); + const secondFile = new File(["b"], "second.wav", { type: "audio/wav" }); + try { + const first = processor.process(firstFile); + await started; + const second = await processor.process(secondFile); + assert.equal(second.file, secondFile); + assert.equal(second.gate, "whitelist_match"); + finishFirst([{ class: "Speech", score: .9 }]); + await assert.rejects(first); + } finally { globalThis.fetch = originalFetch; } +}); diff --git a/frontend/tests/browser-submission-processor.test.mjs b/frontend/tests/browser-submission-processor.test.mjs new file mode 100644 index 0000000..d14bfea --- /dev/null +++ b/frontend/tests/browser-submission-processor.test.mjs @@ -0,0 +1,112 @@ +import assert from "node:assert/strict"; +import test from "node:test"; + +import { BrowserSubmissionProcessor } from "../src/scripts/browser-submission-processor.js"; + +const file = { type: "audio/wav", size: 64 }; + +test("disabled beta returns the original file without loading policy", async () => { + const originalFetch = globalThis.fetch; + globalThis.fetch = () => { throw new Error("fetch must not run"); }; + try { + const processor = new BrowserSubmissionProcessor({ browserProcessingBeta: false }); + processor.setEnabled(true); + assert.equal(processor.isEnabled(), false); + assert.equal(processor.canProcess(file), false); + assert.deepEqual(await processor.prepare(file), { file, metadata: null, gate: "unavailable" }); + } finally { + globalThis.fetch = originalFetch; + } +}); + +test("enabled shell checks current server policy and never claims processing occurred", async () => { + const originalFetch = globalThis.fetch; + globalThis.fetch = async () => ({ ok: true, json: async () => ({ browser_processing_beta_enabled: true, version: 1 }) }); + try { + const processor = new BrowserSubmissionProcessor({ browserProcessingBeta: true, policyUrl: "/browser-policy/", policyVersion: 1 }); + processor.setEnabled(true); + const result = await processor.prepare(file); + assert.equal(result.file, file); + assert.equal(result.metadata.browser_processing_used, false); + assert.equal(result.metadata.browser_gate_result, "unavailable"); + } finally { + globalThis.fetch = originalFetch; + } +}); + +test("admin-disabled policy and fetch failure both fall back to the original file", async () => { + const originalFetch = globalThis.fetch; + const processor = new BrowserSubmissionProcessor({ browserProcessingBeta: true, policyUrl: "/browser-policy/", policyVersion: 1 }); + processor.setEnabled(true); + try { + globalThis.fetch = async () => ({ ok: true, json: async () => ({ browser_processing_beta_enabled: false, version: 1 }) }); + assert.deepEqual(await processor.prepare(file), { file, metadata: null, gate: "unavailable" }); + globalThis.fetch = async () => { throw new Error("offline"); }; + assert.deepEqual(await processor.prepare(file), { file, metadata: null, gate: "unavailable" }); + } finally { + globalThis.fetch = originalFetch; + } +}); + +test("video routing is gated and audio never invokes FFmpeg", async () => { + const originalFetch = globalThis.fetch; + let calls = 0; + globalThis.fetch = async () => ({ ok: true, json: async () => ({ browser_processing_beta_enabled: true, version: 1 }) }); + try { + const processor = new BrowserSubmissionProcessor( + { browserProcessingBeta: true, policyUrl: "/browser-policy/", policyVersion: 1 }, + async () => { calls += 1; return new File(["wav"], "clip.wav", { type: "audio/wav" }); }, + { prepareAudio: async () => new Float32Array(16000), classify: async () => [{ class: "Fireworks", score: .9 }] }, + ); + processor.setEnabled(true); + await processor.prepare(file); + assert.equal(calls, 0); + const video = { type: "video/mp4", size: 123, name: "clip.mp4" }; + const result = await processor.prepare(video); + assert.equal(calls, 1); + assert.equal(result.file.type, "audio/wav"); + assert.equal(result.metadata.browser_processing_used, true); + const disabled = new BrowserSubmissionProcessor({ browserProcessingBeta: false }, async () => { throw new Error("must not run"); }); + assert.deepEqual(await disabled.prepare(video), { file: video, metadata: null, gate: "unavailable" }); + } finally { + globalThis.fetch = originalFetch; + } +}); + +test("video conversion failure rejects instead of falling back to original video", async () => { + const originalFetch = globalThis.fetch; + globalThis.fetch = async () => ({ ok: true, json: async () => ({ browser_processing_beta_enabled: true, version: 1 }) }); + try { + const processor = new BrowserSubmissionProcessor( + { browserProcessingBeta: true, policyUrl: "/browser-policy/", policyVersion: 1 }, + async () => { throw new Error("decode failed"); }, + ); + processor.setEnabled(true); + await assert.rejects(processor.prepare({ type: "video/mp4", name: "bad.mp4" }), /decode failed/); + } finally { + globalThis.fetch = originalFetch; + } +}); + + +test("admin ON and user toggle OFF bypasses policy, FFmpeg and TensorFlow", async () => { + const originalFetch = globalThis.fetch; + globalThis.fetch = () => { throw new Error("policy must not load"); }; + const audio = new File(["audio"], "clip.wav", { type: "audio/wav" }); + const processor = new BrowserSubmissionProcessor( + { browserProcessingBeta: true, policyUrl: "/policy", policyVersion: 1 }, + async () => { throw new Error("FFmpeg must not load"); }, + { prepareAudio: async () => { throw new Error("audio preparation must not run"); }, + classify: async () => { throw new Error("TensorFlow must not load"); } }, + ); + try { + assert.equal(processor.isAvailable(), true); + assert.equal(processor.isEnabled(), false); + assert.deepEqual(await processor.process(audio), { file: audio, metadata: null, gate: "unavailable" }); + processor.setEnabled(true); + assert.equal(processor.isEnabled(), true); + processor.setEnabled(false); + assert.equal(processor.isEnabled(), false); + assert.deepEqual(await processor.process(audio), { file: audio, metadata: null, gate: "unavailable" }); + } finally { globalThis.fetch = originalFetch; } +}); diff --git a/frontend/tests/browser-yamnet-classifier.test.mjs b/frontend/tests/browser-yamnet-classifier.test.mjs new file mode 100644 index 0000000..fd340d8 --- /dev/null +++ b/frontend/tests/browser-yamnet-classifier.test.mjs @@ -0,0 +1,45 @@ +import assert from "node:assert/strict"; +import test from "node:test"; +import { BrowserYamnetClassifier } from "../src/scripts/browser-yamnet-classifier.js"; + +test("YAMNet peak scores are mapped and all owned resources are disposed", async () => { + const originalFetch = globalThis.fetch; + const disposed = []; + const values = new Float32Array(2 * 521); + values[0] = .4; + values[521] = .9; + const output = { shape: [2, 521], data: async () => values, dispose: () => disposed.push("output") }; + const model = { executeAsync: async () => [output], dispose: () => disposed.push("model") }; + const tf = { + ready: async () => {}, getBackend: () => "cpu", memory: () => ({ numTensors: 0 }), + loadGraphModel: async () => model, + tensor1d: () => ({ dispose: () => disposed.push("input") }), + }; + globalThis.fetch = async () => ({ ok: true, json: async () => ["Fireworks", ...Array(520).fill("Other")] }); + try { + const predictions = await BrowserYamnetClassifier.classify(new Float32Array(16000), { + modelUrl: "/static/browser-yamnet/model.json", classMapUrl: "/static/browser-yamnet/yamnet_class_map.json", + loadTensorFlow: async () => tf, + }); + assert.equal(predictions[0].class, "Fireworks"); + assert.equal(predictions[0].score, values[521]); + assert.equal(predictions[0].timeSeconds, .48); + assert.deepEqual(disposed, ["input", "output", "model"]); + } finally { globalThis.fetch = originalFetch; } +}); + +test("model failure still disposes the loaded model", async () => { + const originalFetch = globalThis.fetch; + let disposed = false; + const tf = { + ready: async () => {}, getBackend: () => "cpu", memory: () => ({ numTensors: 0 }), + loadGraphModel: async () => ({ dispose: () => { disposed = true; } }), + }; + globalThis.fetch = async () => ({ ok: false }); + try { + await assert.rejects(BrowserYamnetClassifier.classify(new Float32Array(16000), { + modelUrl: "/model.json", classMapUrl: "/map.json", loadTensorFlow: async () => tf, + })); + assert.equal(disposed, true); + } finally { globalThis.fetch = originalFetch; } +}); diff --git a/frontend/tests/ffmpeg-video-extractor.test.mjs b/frontend/tests/ffmpeg-video-extractor.test.mjs new file mode 100644 index 0000000..d9667ab --- /dev/null +++ b/frontend/tests/ffmpeg-video-extractor.test.mjs @@ -0,0 +1,38 @@ +import assert from "node:assert/strict"; +import test from "node:test"; +import { extractVideoAudio } from "../src/scripts/ffmpeg-video-extractor.js"; + +function mockRuntime(exitCode = 0) { + const calls = []; + const ffmpeg = { + loaded: false, + on: () => {}, + load: async () => { calls.push("load"); ffmpeg.loaded = true; }, + writeFile: async () => { calls.push("write"); }, + exec: async (args) => { calls.push(args); return exitCode; }, + readFile: async () => { calls.push("read"); return new Uint8Array([82, 73, 70, 70]); }, + deleteFile: async (path) => { calls.push(`delete:${path}`); }, + terminate: () => { calls.push("terminate"); ffmpeg.loaded = false; }, + }; + return { ffmpeg, calls }; +} + +const video = new File(["video"], "clip.mp4", { type: "video/mp4" }); + +test("successful extraction emits WAV and cleans up virtual files and worker", async () => { + const runtime = mockRuntime(); + const wav = await extractVideoAudio(video, { createFFmpeg: async () => runtime }); + assert.equal(wav.type, "audio/wav"); + assert.equal(wav.name, "clip.wav"); + assert.deepEqual(runtime.calls.find(Array.isArray), ["-i", "input", "-vn", "-ac", "1", "-ar", "16000", "-c:a", "pcm_s16le", "audio.wav"]); + assert.ok(runtime.calls.includes("delete:input")); + assert.ok(runtime.calls.includes("delete:audio.wav")); + assert.equal(runtime.calls.at(-1), "terminate"); +}); + +test("failed extraction removes input and terminates worker", async () => { + const runtime = mockRuntime(1); + await assert.rejects(extractVideoAudio(video, { createFFmpeg: async () => runtime }), { code: "invalid_media" }); + assert.ok(runtime.calls.includes("delete:input")); + assert.equal(runtime.calls.at(-1), "terminate"); +}); diff --git a/frontend/tests/manual-compass.test.mjs b/frontend/tests/manual-compass.test.mjs new file mode 100644 index 0000000..f2620b4 --- /dev/null +++ b/frontend/tests/manual-compass.test.mjs @@ -0,0 +1,60 @@ +import assert from "node:assert/strict"; +import test from "node:test"; +import { JSDOM } from "jsdom"; + +test("compass stays hidden until permission and a heading, then rotates and hides when stopped", async () => { + const dom = new JSDOM(` +
+ + + + +
+
+ +

+
+
+ + `, { url: "https://example.test/" }); + const { window } = dom; + Object.defineProperty(window, "isSecureContext", { value: true }); + let resolvePermission; + class MockOrientation {} + MockOrientation.requestPermission = () => new Promise((resolve) => { resolvePermission = resolve; }); + window.DeviceOrientationEvent = MockOrientation; + const previous = Object.fromEntries(["window", "document", "navigator", "DeviceOrientationEvent"].map((key) => [key, Object.getOwnPropertyDescriptor(globalThis, key)])); + for (const [key, value] of Object.entries({ window, document: window.document, navigator: window.navigator, DeviceOrientationEvent: MockOrientation })) { + Object.defineProperty(globalThis, key, { configurable: true, writable: true, value }); + } + try { + await import("../src/scripts/manual-report.js?compass=visual"); + const compass = window.document.querySelector("#manual-compass"); + const rose = window.document.querySelector("#manual-compass-rose"); + const button = window.document.querySelector("#manual-capture-direction"); + assert.equal(compass.hidden, true); + button.click(); + assert.equal(compass.hidden, true); + resolvePermission("granted"); + await new Promise((resolve) => setTimeout(resolve, 0)); + const reading = (heading) => { + const event = new window.Event("deviceorientation"); + Object.defineProperty(event, "webkitCompassHeading", { value: heading }); + window.dispatchEvent(event); + }; + reading(359); + assert.equal(compass.hidden, false); + assert.equal(rose.style.transform, "rotate(-359deg)"); + reading(1); + assert.equal(rose.style.transform, "rotate(-361deg)"); + assert.equal(window.document.querySelector("#manual-direction-degrees").value, "1"); + button.click(); + assert.equal(compass.hidden, true); + } finally { + for (const [key, descriptor] of Object.entries(previous)) { + if (descriptor === undefined) delete globalThis[key]; + else Object.defineProperty(globalThis, key, descriptor); + } + dom.window.close(); + } +}); diff --git a/locale/nl/LC_MESSAGES/django.mo b/locale/nl/LC_MESSAGES/django.mo new file mode 100644 index 0000000..ded5fd2 Binary files /dev/null and b/locale/nl/LC_MESSAGES/django.mo differ diff --git a/locale/nl/LC_MESSAGES/django.po b/locale/nl/LC_MESSAGES/django.po new file mode 100644 index 0000000..8211a28 --- /dev/null +++ b/locale/nl/LC_MESSAGES/django.po @@ -0,0 +1,44 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Language: nl\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgid "Skip to content" +msgstr "Naar inhoud" +msgid "Overview" +msgstr "Overzicht" +msgid "Report" +msgstr "Melden" +msgid "Activity" +msgstr "Activiteit" +msgid "Map" +msgstr "Kaart" +msgid "Analyse" +msgstr "Analyseren" +msgid "More" +msgstr "Meer" +msgid "Settings" +msgstr "Instellingen" +msgid "Sensors" +msgstr "Sensoren" +msgid "Sign in" +msgstr "Inloggen" +msgid "Report fireworks" +msgstr "Vuurwerk melden" +msgid "Hear it. Report it. See the pattern." +msgstr "Hoor het. Meld het. Zie het patroon." +msgid "A clearer picture of local fireworks activity, with privacy built in." +msgstr "Een duidelijker beeld van vuurwerk in de buurt, met privacy als uitgangspunt." +msgid "Recent activity" +msgstr "Recente activiteit" +msgid "Explore" +msgstr "Verkennen" +msgid "Analyse a recording" +msgstr "Een opname analyseren" +msgid "Contribute" +msgstr "Bijdragen" +msgid "Tell us what you heard. Details are optional." +msgstr "Vertel wat je hoorde. Details zijn optioneel." +msgid "Archive" +msgstr "Archief" diff --git a/manage.py b/manage.py new file mode 100644 index 0000000..5765eaf --- /dev/null +++ b/manage.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python +import os,sys +if __name__ == '__main__': + os.environ.setdefault('DJANGO_SETTINGS_MODULE','config.settings') + from django.core.management import execute_from_command_line + execute_from_command_line(sys.argv) diff --git a/notifications/__init__.py b/notifications/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/notifications/admin.py b/notifications/admin.py new file mode 100644 index 0000000..8b17c45 --- /dev/null +++ b/notifications/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin +from .models import NotificationPreference +admin.site.register(NotificationPreference) diff --git a/notifications/migrations/0001_initial.py b/notifications/migrations/0001_initial.py new file mode 100644 index 0000000..fe23aa1 --- /dev/null +++ b/notifications/migrations/0001_initial.py @@ -0,0 +1,28 @@ +# Generated by Django 6.1.1 on 2026-10-04 14:20 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='NotificationPreference', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('ntfy_enabled', models.BooleanField(default=False)), + ('ntfy_url', models.URLField(blank=True)), + ('notify_on_sensor_submission', models.BooleanField(default=True)), + ('notify_on_manual_submission', models.BooleanField(default=False)), + ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/notifications/migrations/__init__.py b/notifications/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/notifications/models.py b/notifications/models.py new file mode 100644 index 0000000..c41645f --- /dev/null +++ b/notifications/models.py @@ -0,0 +1,8 @@ +from django.conf import settings +from django.db import models +class NotificationPreference(models.Model): + user=models.OneToOneField(settings.AUTH_USER_MODEL,on_delete=models.CASCADE) + ntfy_enabled=models.BooleanField(default=False) + ntfy_url=models.URLField(blank=True) + notify_on_sensor_submission=models.BooleanField(default=True) + notify_on_manual_submission=models.BooleanField(default=False) diff --git a/notifications/services.py b/notifications/services.py new file mode 100644 index 0000000..42b188d --- /dev/null +++ b/notifications/services.py @@ -0,0 +1,13 @@ +import requests +from .models import NotificationPreference +def send_ntfy(url,message): + try: + response=requests.post(url,data=message.encode(),timeout=5);response.raise_for_status();return True + except requests.RequestException: return False +def notify_event(event): + if event.source=='sensor' and event.sensor: users=[event.sensor.owner_id] + elif event.source=='manual': users=list(NotificationPreference.objects.filter(ntfy_enabled=True,notify_on_manual_submission=True).values_list('user_id',flat=True)) + else: users=[] + for pref in NotificationPreference.objects.filter(user_id__in=users,ntfy_enabled=True).exclude(ntfy_url=''): + if event.source=='sensor' and not pref.notify_on_sensor_submission: continue + send_ntfy(pref.ntfy_url,f'BoomCast: {event.get_source_display()} #{event.pk} awaits review') diff --git a/notifications/templates/notifications/settings.html b/notifications/templates/notifications/settings.html new file mode 100644 index 0000000..44c887a --- /dev/null +++ b/notifications/templates/notifications/settings.html @@ -0,0 +1 @@ +{% extends 'base.html' %}{% block content %}

Notifications

{% if error %}

{{ error }}

{% endif %}
{% csrf_token %}
{% csrf_token %}
{% endblock %} \ No newline at end of file diff --git a/notifications/views.py b/notifications/views.py new file mode 100644 index 0000000..4e168c1 --- /dev/null +++ b/notifications/views.py @@ -0,0 +1,22 @@ +from django.contrib.auth.decorators import login_required +from django.shortcuts import render,redirect +from django.http import HttpResponse +from django.core.exceptions import ValidationError +from .models import NotificationPreference +from .services import send_ntfy +@login_required +def settings_view(request): + pref,_=NotificationPreference.objects.get_or_create(user=request.user) + if request.method=='POST': + pref.ntfy_enabled='ntfy_enabled' in request.POST;pref.ntfy_url=request.POST.get('ntfy_url','').strip();pref.notify_on_sensor_submission='notify_on_sensor_submission' in request.POST;pref.notify_on_manual_submission='notify_on_manual_submission' in request.POST + try: pref.full_clean() + except ValidationError as exc: return render(request,'notifications/settings.html',{'preference':pref,'error':'; '.join(exc.messages)},status=400 if not request.headers.get('HX-Request') else 200) + pref.save() + if not request.headers.get('HX-Request'): return redirect('notification_settings') + return render(request,'notifications/settings.html',{'preference':pref}) +@login_required +def test_notification(request): + if request.method!='POST': return HttpResponse(status=405) + pref,_=NotificationPreference.objects.get_or_create(user=request.user) + ok=bool(pref.ntfy_url) and send_ntfy(pref.ntfy_url,'BoomCast test notification') + return HttpResponse('Test sent.' if ok else 'Could not send test.') diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..ed021c8 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,2566 @@ +{ + "name": "django-vite-integration", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "django-vite-integration", + "dependencies": { + "@ffmpeg/core": "^0.12.10", + "@ffmpeg/ffmpeg": "^0.12.15", + "@ffmpeg/util": "^0.12.2", + "@tensorflow/tfjs": "^4.22.0" + }, + "devDependencies": { + "concurrently": "^9.1.2", + "jsdom": "^30.1.1", + "vite": "^6.2.0" + } + }, + "node_modules/@asamuzakjp/css-color": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-7.1.3.tgz", + "integrity": "sha512-1t1U8Cm3RBl9vh3RAZhjkPaduzLSvQJRToRrxpGR/eDRW99mOREleuu+mWfiFa795bUzjwht7NgphCKTs2ianQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@csstools/css-calc": "^3.4.2", + "@csstools/css-color-parser": "^4.2.5", + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2", + "lru-cache": "^11.5.3" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, + "node_modules/@asamuzakjp/dom-selector": { + "version": "9.2.3", + "resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-9.2.3.tgz", + "integrity": "sha512-MDKmPBa6CfNN1zAJroTl7Uc+nBbcNtfE/F24iROfZAtcLffEeY3IbHR8XeHH5dJBspMYTpAsjEYmnp3tAmoVxw==", + "dev": true, + "license": "MIT", + "dependencies": { + "bidi-js": "^1.1.0", + "css-tree": "^3.2.1", + "is-potential-custom-element-name": "^1.0.1", + "lru-cache": "^11.5.3" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, + "node_modules/@bramus/specificity": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@bramus/specificity/-/specificity-2.4.2.tgz", + "integrity": "sha512-ctxtJ/eA+t+6q2++vj5j7FYX3nRu311q1wfYH3xjlLOsczhlhxAg2FWNUXhpGvAw3BWo1xBcvOV6/YLc2r5FJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "css-tree": "^3.0.0" + }, + "bin": { + "specificity": "bin/cli.js" + } + }, + "node_modules/@csstools/color-helpers": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-6.1.2.tgz", + "integrity": "sha512-grhRy3OKmniaAEKXMjua5z/EODX0MSqBGjunw8+j/3HQjOnahs2AGhvEOIYVUWcU6ScApbhLhVrQTX8XqrMrow==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@csstools/css-calc": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-3.4.3.tgz", + "integrity": "sha512-iex20d8CHVkyvg6B7UKV7uHnI2Bqo9g+EFfT9E0y+GvTvhZ/DwONJ+9aKb1dlqm0ZiGsL5RXjp0fCoJYnkeDjA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-color-parser": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-4.2.6.tgz", + "integrity": "sha512-iiPQ3iRWwnJkeEn6RIu6SJPr7hYrLz6XZ9s/QZl+2/LI5KQVjpl2fdmDSZKuD4xP6GMmMPgHFFXg6k1Wkz0Trg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "dependencies": { + "@csstools/color-helpers": "^6.1.2", + "@csstools/css-calc": "^3.4.3" + }, + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-parser-algorithms": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-4.0.2.tgz", + "integrity": "sha512-40cSKyMvK+tq4qz6Awrlye2WGuOKt3FwPgtGg6KTfbHOWNw+Rk1rzbAtZnZ6IBhsY491HLRnDXwoyBAijmmILA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-syntax-patches-for-csstree": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/@csstools/css-syntax-patches-for-csstree/-/css-syntax-patches-for-csstree-1.1.15.tgz", + "integrity": "sha512-J0u7HkVl2nzSlhsiTOp4AmwcUQ3D+mGEEKfBy/7To5/y7F2OHwyLrXfrhR0SMgr4p5Lo+eaMVSeai24zUcBIxA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "peerDependencies": { + "css-tree": "^3.2.1" + }, + "peerDependenciesMeta": { + "css-tree": { + "optional": true + } + } + }, + "node_modules/@csstools/css-tokenizer": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-4.0.2.tgz", + "integrity": "sha512-OoKoR0f76dCY666JlcbhmVTs2drYj1GUXZTYTcbUgJjh9Nv41aFfZ21bPQTERm5+L5cBDo466NltB2lplS5GBw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", + "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", + "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", + "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", + "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", + "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", + "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", + "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", + "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", + "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", + "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", + "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", + "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", + "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", + "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", + "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", + "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", + "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", + "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", + "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", + "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", + "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", + "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", + "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", + "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", + "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", + "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@exodus/bytes": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.16.0.tgz", + "integrity": "sha512-IcpW84uEn3N7ETtNZMlxKhfl6Pec8rUNGOTBtWbK1FKhJxIFAptZyVrvVRVBimAJxJCgc3PxepxkdWWG4DVzfA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + }, + "peerDependencies": { + "@noble/hashes": "^1.8.0 || ^2.0.0" + }, + "peerDependenciesMeta": { + "@noble/hashes": { + "optional": true + } + } + }, + "node_modules/@ffmpeg/core": { + "version": "0.12.10", + "resolved": "https://registry.npmjs.org/@ffmpeg/core/-/core-0.12.10.tgz", + "integrity": "sha512-dzNplnn2Nxle2c2i2rrDhqcB19q9cglCkWnoMTDN9Q9l3PvdjZWd1HfSPjCNWc/p8Q3CT+Es9fWOR0UhAeYQZA==", + "license": "GPL-2.0-or-later", + "engines": { + "node": ">=16.x" + } + }, + "node_modules/@ffmpeg/ffmpeg": { + "version": "0.12.15", + "resolved": "https://registry.npmjs.org/@ffmpeg/ffmpeg/-/ffmpeg-0.12.15.tgz", + "integrity": "sha512-1C8Obr4GsN3xw+/1Ww6PFM84wSQAGsdoTuTWPOj2OizsRDLT4CXTaVjPhkw6ARyDus1B9X/L2LiXHqYYsGnRFw==", + "license": "MIT", + "dependencies": { + "@ffmpeg/types": "^0.12.4" + }, + "engines": { + "node": ">=18.x" + } + }, + "node_modules/@ffmpeg/types": { + "version": "0.12.4", + "resolved": "https://registry.npmjs.org/@ffmpeg/types/-/types-0.12.4.tgz", + "integrity": "sha512-k9vJQNBGTxE5AhYDtOYR5rO5fKsspbg51gbcwtbkw2lCdoIILzklulcjJfIDwrtn7XhDeF2M+THwJ2FGrLeV6A==", + "license": "MIT", + "engines": { + "node": ">=16.x" + } + }, + "node_modules/@ffmpeg/util": { + "version": "0.12.2", + "resolved": "https://registry.npmjs.org/@ffmpeg/util/-/util-0.12.2.tgz", + "integrity": "sha512-ouyoW+4JB7WxjeZ2y6KpRvB+dLp7Cp4ro8z0HIVpZVCM7AwFlHa0c4R8Y/a4M3wMqATpYKhC7lSFHQ0T11MEDw==", + "license": "MIT", + "engines": { + "node": ">=18.x" + } + }, + "node_modules/@napi-rs/lzma-linux-x64-gnu": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", + "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.63.5.tgz", + "integrity": "sha512-J25QJU+B78T4FhhBsNpLJyVWOi31mwtpcMwywHmOKH65Q9IWGA81gPj+dnwlhU8wktVriYE+tFAaQgrnJRzAZg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.63.5.tgz", + "integrity": "sha512-LDopB3zuZM5Ux9TT2luNEBJW/tYbGU2g1d+VpKk6I+gSKDb+/7sYE6M225gRQt4RbMX6MSwMsVR/phdjVUgRLg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.63.5.tgz", + "integrity": "sha512-wlJEERGfeuHeBavCL2qVnNacOK43NDoZM4sjkeRPymd04OAE9T1zBqDJgmZ+CIsPTYKwdzpUC8vmOw84dwY4Tg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.63.5.tgz", + "integrity": "sha512-4nJJGg5jbo2wwPP4JP+LfEBA3bvP8rU9CLuhp7jWvq9sxEyhjQFTFdrqi+/dHEin/pd8jpT0vcehIpnZtmEdcQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.63.5.tgz", + "integrity": "sha512-DrZbyCDF1hneuO6jRbvZ2D7+PIBM6yIwYnJpg2vIk58T+wuFpiaGZrfUr59lDWw45bg+IrpTGLPiNi/Fk4w3Cg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.63.5.tgz", + "integrity": "sha512-gqfUVMJMB3mehqywxp6hTBFfgtMQykZY19+cfiaYP0toIJLb/1DZRJHVkQQGP13W4TAwfZDWeg1qBcheTRioXQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.63.5.tgz", + "integrity": "sha512-CFmhpvAwzSaWMlN3VN7UtmoTihlZNzoP0juQib5TQRnYUyDV8dXeWOp29sobWAT6gXl/hQgAClLlEiYozQG3OQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.63.5.tgz", + "integrity": "sha512-Uc9H8eXCOayV6JLTH5bXKMId6qbhNHa818/BgYjm4jrlq3vZquC9cqyvHBw17xy5Mnj5f+I3gFK5JcEf3hSqrw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.63.5.tgz", + "integrity": "sha512-VcPr/szv/1BFw112Kt//fxulXt/JPqzzidU84iW68L2DdjnOO8QFUv2zTSYBEPHD6movBD4z+bbr5y60GYM7Jw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.63.5.tgz", + "integrity": "sha512-BnxtJ5/91BrIHYIkGrmjz/lbMhqEHt1dPFqIxIFR+jPn0xVc/oUSCtIT089zfp5ufwGDlYz2UC+Fe1SRBpYFbQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.63.5.tgz", + "integrity": "sha512-LrYcHZwF+fAMNKHYTOQ5osWM4AZF7YF6D+XtsjDyEvljtt11twc+zHVXBLNEjxVSUnKYsOhvVz4Z213eW02COQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.63.5.tgz", + "integrity": "sha512-nj7QKQePAAUpCpJHtg0pR0W/b92A9NO17JS3BAQmHDn/yhmkir2p8llrKY9TOhleKIaSzy1JhxS3T9FVld6coA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.63.5.tgz", + "integrity": "sha512-5ylkX6dWMeBKge9nTU+Rxfb+ZfaCIJ9lRqIFaK0eAMcWp7OJbYnLveLgXmm0VrvuLKb8qIK+mHyH0qu88RM+iA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.63.5.tgz", + "integrity": "sha512-oHK4ZHYFDKjZviK34I+NwgfbGxgI7ztrNxj2hPTSSNFgeq1a/lEd7dHV2fdGAuTH4Iym3RHJg+vAbWaWG4B7Zg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.63.5.tgz", + "integrity": "sha512-UcetmHZ6XOXuUByiKZyQmb55ZPr0LABr3Ec/HB9wKZn6CEAFWZkE+hsJErJ9hbPBC7nI0dKuELx7CoV6IM7TMg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.63.5.tgz", + "integrity": "sha512-C5CmDPQBtvjVo8cgQsBs+w6WB0JLkiixhgi6hVLV11hERWdn/p0XcPU2OUcZzac9BPOFq7SbaHFa8r3SWEysCQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.63.5.tgz", + "integrity": "sha512-lHVQHJFKsuuxLMi3MQO9XVL8Tje3JR82CzB+QDKC5NWBcsIWuwsn9uIM5e3lBhI+fF1/s63qnyYqsg65+8rV/w==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.63.5.tgz", + "integrity": "sha512-3W9bTFcQNJn71cSJVM9RKIiZOy8DO/XLDii8Uv/Pm6WKqDRj7JV3ZfuXIEfyuy5LXpIzAbB/1M4Ukp9GKNa7nA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.63.5.tgz", + "integrity": "sha512-VDC7rRJlee/scpki96GZ27Omf6yU87s1YXwVTpjE5841faVlDYYT565rgfmoR1U0sqL7z5ivQSDjcsF6VRXyBA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.63.5.tgz", + "integrity": "sha512-z86Ok2p4pTdv5xqCKZsTooO7yBEiaJR/HzU3Wx8RmWsPoLppnMKROhJusQob8B3IE1ghC343kUW9rC2r+Wf3ig==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.63.5.tgz", + "integrity": "sha512-IzQmj+xXwQFGhMAMKMQVXkMwMZN3TqkJgAE0nSsqvVwWWciP4AIPMmWRqOQ2GfX7TUDZr+xqGFcBS36CRPGw0g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.63.5.tgz", + "integrity": "sha512-F6qpTaPc9bwBH85kjy0/BLmLSW1uv7AoOXCoRIkg2arlgCYlWYcAbiMkvZuAcaWk9TpCRG//okznLAqLGshkMw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.63.5.tgz", + "integrity": "sha512-igoDsTFhhwECBeGbUuLeIk7t8Y1apa+cs6mDWpx2EZ0ch7oEQgzHbFUXN9euoHekCAQzXdXApAGkV6jznS7tWw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.63.5.tgz", + "integrity": "sha512-U3teMeMbXFmaM5D+OTJpsOXd+wV/qftIeYF9kBKL4v73641qyJmoXFtA28DQLsnmlyayEsTe72xpLHrArq6vHw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.63.5.tgz", + "integrity": "sha512-ypfC34F3RKXvCXBglGqGMsUSMKlgwd1HX9AOAlx9RoZZ6GaI42YHVeKpzg3JG+wpBUJYTG+NNZhqbDWL8tBZkw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@tensorflow/tfjs": { + "version": "4.22.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-4.22.0.tgz", + "integrity": "sha512-0TrIrXs6/b7FLhLVNmfh8Sah6JgjBPH4mZ8JGb7NU6WW+cx00qK5BcAZxw7NCzxj6N8MRAIfHq+oNbPUNG5VAg==", + "license": "Apache-2.0", + "dependencies": { + "@tensorflow/tfjs-backend-cpu": "4.22.0", + "@tensorflow/tfjs-backend-webgl": "4.22.0", + "@tensorflow/tfjs-converter": "4.22.0", + "@tensorflow/tfjs-core": "4.22.0", + "@tensorflow/tfjs-data": "4.22.0", + "@tensorflow/tfjs-layers": "4.22.0", + "argparse": "^1.0.10", + "chalk": "^4.1.0", + "core-js": "3.29.1", + "regenerator-runtime": "^0.13.5", + "yargs": "^16.0.3" + }, + "bin": { + "tfjs-custom-module": "dist/tools/custom_module/cli.js" + } + }, + "node_modules/@tensorflow/tfjs-backend-cpu": { + "version": "4.22.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-4.22.0.tgz", + "integrity": "sha512-1u0FmuLGuRAi8D2c3cocHTASGXOmHc/4OvoVDENJayjYkS119fcTcQf4iHrtLthWyDIPy3JiPhRrZQC9EwnhLw==", + "license": "Apache-2.0", + "dependencies": { + "@types/seedrandom": "^2.4.28", + "seedrandom": "^3.0.5" + }, + "engines": { + "yarn": ">= 1.3.2" + }, + "peerDependencies": { + "@tensorflow/tfjs-core": "4.22.0" + } + }, + "node_modules/@tensorflow/tfjs-backend-webgl": { + "version": "4.22.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-4.22.0.tgz", + "integrity": "sha512-H535XtZWnWgNwSzv538czjVlbJebDl5QTMOth4RXr2p/kJ1qSIXE0vZvEtO+5EC9b00SvhplECny2yDewQb/Yg==", + "license": "Apache-2.0", + "dependencies": { + "@tensorflow/tfjs-backend-cpu": "4.22.0", + "@types/offscreencanvas": "~2019.3.0", + "@types/seedrandom": "^2.4.28", + "seedrandom": "^3.0.5" + }, + "engines": { + "yarn": ">= 1.3.2" + }, + "peerDependencies": { + "@tensorflow/tfjs-core": "4.22.0" + } + }, + "node_modules/@tensorflow/tfjs-converter": { + "version": "4.22.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-4.22.0.tgz", + "integrity": "sha512-PT43MGlnzIo+YfbsjM79Lxk9lOq6uUwZuCc8rrp0hfpLjF6Jv8jS84u2jFb+WpUeuF4K33ZDNx8CjiYrGQ2trQ==", + "license": "Apache-2.0", + "peerDependencies": { + "@tensorflow/tfjs-core": "4.22.0" + } + }, + "node_modules/@tensorflow/tfjs-core": { + "version": "4.22.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-core/-/tfjs-core-4.22.0.tgz", + "integrity": "sha512-LEkOyzbknKFoWUwfkr59vSB68DMJ4cjwwHgicXN0DUi3a0Vh1Er3JQqCI1Hl86GGZQvY8ezVrtDIvqR1ZFW55A==", + "license": "Apache-2.0", + "dependencies": { + "@types/long": "^4.0.1", + "@types/offscreencanvas": "~2019.7.0", + "@types/seedrandom": "^2.4.28", + "@webgpu/types": "0.1.38", + "long": "4.0.0", + "node-fetch": "~2.6.1", + "seedrandom": "^3.0.5" + }, + "engines": { + "yarn": ">= 1.3.2" + } + }, + "node_modules/@tensorflow/tfjs-core/node_modules/@types/offscreencanvas": { + "version": "2019.7.3", + "resolved": "https://registry.npmjs.org/@types/offscreencanvas/-/offscreencanvas-2019.7.3.tgz", + "integrity": "sha512-ieXiYmgSRXUDeOntE1InxjWyvEelZGP63M+cGuquuRLuIKKT1osnkXjxev9B7d1nXSug5vpunx+gNlbVxMlC9A==", + "license": "MIT" + }, + "node_modules/@tensorflow/tfjs-data": { + "version": "4.22.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-data/-/tfjs-data-4.22.0.tgz", + "integrity": "sha512-dYmF3LihQIGvtgJrt382hSRH4S0QuAp2w1hXJI2+kOaEqo5HnUPG0k5KA6va+S1yUhx7UBToUKCBHeLHFQRV4w==", + "license": "Apache-2.0", + "dependencies": { + "@types/node-fetch": "^2.1.2", + "node-fetch": "~2.6.1", + "string_decoder": "^1.3.0" + }, + "peerDependencies": { + "@tensorflow/tfjs-core": "4.22.0", + "seedrandom": "^3.0.5" + } + }, + "node_modules/@tensorflow/tfjs-layers": { + "version": "4.22.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-layers/-/tfjs-layers-4.22.0.tgz", + "integrity": "sha512-lybPj4ZNj9iIAPUj7a8ZW1hg8KQGfqWLlCZDi9eM/oNKCCAgchiyzx8OrYoWmRrB+AM6VNEeIT+2gZKg5ReihA==", + "license": "Apache-2.0 AND MIT", + "peerDependencies": { + "@tensorflow/tfjs-core": "4.22.0" + } + }, + "node_modules/@tensorflow/tfjs/node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/@tensorflow/tfjs/node_modules/yargs": { + "version": "16.2.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.2.tgz", + "integrity": "sha512-Nt9ZJjXTv5R8MHbqby/wXQ6Gi0Bb3TcYZkR1bzuL4yB2OxWPkXknz513gEF0GoA6tn00UpbPvERW8rzCuWCA6w==", + "license": "MIT", + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@tensorflow/tfjs/node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/long": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz", + "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "26.6.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.4.tgz", + "integrity": "sha512-ldVPDCzj7fsaGZrLB0NuHuTvJcsNasysBAqMolr/cgxrLd1xbqxIr3XJiPnHHJUCxj5sNF1vnRj9aWnrVh5Jcg==", + "license": "MIT", + "dependencies": { + "undici-types": "~8.9.0" + } + }, + "node_modules/@types/node-fetch": { + "version": "2.6.13", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.13.tgz", + "integrity": "sha512-QGpRVpzSaUs30JBSGPjOg4Uveu384erbHBoT1zeONvyCfwQxIkUshLAOqN/k9EjGviPRmWTTe6aH2qySWKTVSw==", + "license": "MIT", + "dependencies": { + "@types/node": "*", + "form-data": "^4.0.4" + } + }, + "node_modules/@types/offscreencanvas": { + "version": "2019.3.0", + "resolved": "https://registry.npmjs.org/@types/offscreencanvas/-/offscreencanvas-2019.3.0.tgz", + "integrity": "sha512-esIJx9bQg+QYF0ra8GnvfianIY8qWB0GBx54PK5Eps6m+xTj86KLavHv6qDhzKcu5UUOgNfJ2pWaIIV7TRUd9Q==", + "license": "MIT" + }, + "node_modules/@types/seedrandom": { + "version": "2.4.34", + "resolved": "https://registry.npmjs.org/@types/seedrandom/-/seedrandom-2.4.34.tgz", + "integrity": "sha512-ytDiArvrn/3Xk6/vtylys5tlY6eo7Ane0hvcx++TKo6RxQXuVfW0AF/oeWqAj9dN29SyhtawuXstgmPlwNcv/A==", + "license": "MIT" + }, + "node_modules/@webgpu/types": { + "version": "0.1.38", + "resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.38.tgz", + "integrity": "sha512-7LrhVKz2PRh+DD7+S+PVaFd5HxaWQvoMqBbsV9fNJO1pjUs1P8bM2vQVNfk+3URTqbuTI7gkXi0rfsN0IadoBA==", + "license": "BSD-3-Clause" + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, + "node_modules/bidi-js": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.1.0.tgz", + "integrity": "sha512-fX1Onk0tdVPC7obPWB5EbJ1z7NVhLq4m2xZLq2YXBkxzMXIGRpNMU88n0EPgWseKl12J7zXs7qrDxPK4sRs2fg==", + "dev": true, + "license": "MIT", + "dependencies": { + "require-from-string": "^2.0.2" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/concurrently": { + "version": "9.2.4", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-9.2.4.tgz", + "integrity": "sha512-TZ0CEhyzvFjgtAvHTusDMgj7wNdihCh7LLLrzdUOXIhdlnL2JBBGA9eJxR24rtqgmdjh3OA3hrN1rCHj6HM8qA==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "4.1.2", + "rxjs": "7.8.2", + "shell-quote": "1.9.0", + "supports-color": "8.1.1", + "tree-kill": "1.2.2", + "yargs": "17.7.2" + }, + "bin": { + "conc": "dist/bin/concurrently.js", + "concurrently": "dist/bin/concurrently.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/open-cli-tools/concurrently?sponsor=1" + } + }, + "node_modules/core-js": { + "version": "3.29.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.29.1.tgz", + "integrity": "sha512-+jwgnhg6cQxKYIIjGtAHq2nwUOolo9eoFZ4sHfUH09BLXBgxnH4gA0zEd+t+BO2cNB8idaBtZFcFTRjQJRJmAw==", + "hasInstallScript": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/css-tree": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", + "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "mdn-data": "2.27.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" + } + }, + "node_modules/data-urls": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-7.0.0.tgz", + "integrity": "sha512-23XHcCF+coGYevirZceTVD7NdJOqVn+49IHyxgszm+JIiHLoB2TkmPtsYkNWT1pvRSGkc35L6NHs0yHkN2SumA==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^16.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/data-urls/node_modules/tr46": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-6.0.0.tgz", + "integrity": "sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/data-urls/node_modules/webidl-conversions": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", + "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20" + } + }, + "node_modules/data-urls/node_modules/whatwg-url": { + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-16.0.1.tgz", + "integrity": "sha512-1to4zXBxmXHV3IiSSEInrreIlu02vUOvrhxJJH5vcxYTBDAx51cqZiKdyTxlecdKNSjj8EcxGBxNf6Vg+945gw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.11.0", + "tr46": "^6.0.0", + "webidl-conversions": "^8.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/decimal.js": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", + "dev": true, + "license": "MIT" + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/entities": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-8.1.0.tgz", + "integrity": "sha512-kxL7msIffSuh9aaFAMD7rxAIuTRMAHMeBtgHW2yUdWw732ZNh4MehkF2gdjvtdmikkaIP9bFDDJOPlsvm7avrA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20.19.0" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/esbuild": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", + "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.12", + "@esbuild/android-arm": "0.25.12", + "@esbuild/android-arm64": "0.25.12", + "@esbuild/android-x64": "0.25.12", + "@esbuild/darwin-arm64": "0.25.12", + "@esbuild/darwin-x64": "0.25.12", + "@esbuild/freebsd-arm64": "0.25.12", + "@esbuild/freebsd-x64": "0.25.12", + "@esbuild/linux-arm": "0.25.12", + "@esbuild/linux-arm64": "0.25.12", + "@esbuild/linux-ia32": "0.25.12", + "@esbuild/linux-loong64": "0.25.12", + "@esbuild/linux-mips64el": "0.25.12", + "@esbuild/linux-ppc64": "0.25.12", + "@esbuild/linux-riscv64": "0.25.12", + "@esbuild/linux-s390x": "0.25.12", + "@esbuild/linux-x64": "0.25.12", + "@esbuild/netbsd-arm64": "0.25.12", + "@esbuild/netbsd-x64": "0.25.12", + "@esbuild/openbsd-arm64": "0.25.12", + "@esbuild/openbsd-x64": "0.25.12", + "@esbuild/openharmony-arm64": "0.25.12", + "@esbuild/sunos-x64": "0.25.12", + "@esbuild/win32-arm64": "0.25.12", + "@esbuild/win32-ia32": "0.25.12", + "@esbuild/win32-x64": "0.25.12" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.6.tgz", + "integrity": "sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.4", + "mime-types": "^2.1.35" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/html-encoding-sniffer": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-7.0.0.tgz", + "integrity": "sha512-UikN5yr7xsCDAq87Or5or0PAlD3HJJOKVzM05az588WnpDJ4Ux7a2A53Qi6gofGg2/EtvF/H4hCi/TXfCW4Y6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.15.1" + }, + "engines": { + "node": "^22.13.0 || >=24.0.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/jsdom": { + "version": "30.1.1", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-30.1.1.tgz", + "integrity": "sha512-FahmoPK5vbPc+jxV1iErMHmAZypCZ942NHF4+qqaWAuvaKKTBZxawnmAtrbGWLU7MtlxfqIP0qw6aSI+aWGtLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/css-color": "^7.0.0", + "@asamuzakjp/dom-selector": "^9.2.1", + "@bramus/specificity": "^2.4.2", + "@csstools/css-syntax-patches-for-csstree": "^1.1.13", + "@exodus/bytes": "^1.15.1", + "css-tree": "^3.2.1", + "data-urls": "^7.0.0", + "decimal.js": "^10.6.0", + "html-encoding-sniffer": "^7.0.0", + "is-potential-custom-element-name": "^1.0.1", + "lru-cache": "^11.5.2", + "parse5": "^8.0.1", + "saxes": "^6.0.0", + "tough-cookie": "^6.0.2", + "undici": "^8.10.2", + "w3c-xmlserializer": "^6.0.0", + "webidl-conversions": "^8.0.1", + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^17.1.1", + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + }, + "peerDependencies": { + "canvas": "^3.2.3" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jsdom/node_modules/tr46": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-6.0.0.tgz", + "integrity": "sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/jsdom/node_modules/webidl-conversions": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", + "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20" + } + }, + "node_modules/jsdom/node_modules/whatwg-url": { + "version": "17.1.2", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-17.1.2.tgz", + "integrity": "sha512-TEZA+Zqxin7Jjsm2cjRohCmen5awh+hT6Zi3VZdqZlNRk7zvOI/9WpBFg/DWlA56bWnzwm6DuB8NS0EsxQH9uQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.15.1", + "tr46": "^6.0.0", + "webidl-conversions": "^8.0.1" + }, + "engines": { + "node": "^22.14.0 || >=24.0.0" + } + }, + "node_modules/long": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==", + "license": "Apache-2.0" + }, + "node_modules/lru-cache": { + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/mdn-data": { + "version": "2.27.1", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz", + "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==", + "dev": true, + "license": "CC0-1.0" + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/nanoid": { + "version": "3.3.19", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.19.tgz", + "integrity": "sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/node-fetch": { + "version": "2.6.13", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.13.tgz", + "integrity": "sha512-StxNAxh15zr77QvvkmveSQ8uCQ4+v5FkvNTj0OESmiHu+VRi/gXArXtkWMElOsOUNLtUEvI4yS+rdtOHZTwlQA==", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/parse5": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.0.1.tgz", + "integrity": "sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^8.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.28", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz", + "integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.18", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==", + "license": "MIT" + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rollup": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.63.5.tgz", + "integrity": "sha512-KRWwmNLlPw5M7HcdYfm15oBv9n9LPtjzpzCIxS/phwqvPyxHSoKX6Y2YU3pxSPfy0CLquVgsx/j/hBi6OvH1Nw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.9" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@napi-rs/lzma-linux-x64-gnu": "1.5.1", + "@rollup/rollup-android-arm-eabi": "4.63.5", + "@rollup/rollup-android-arm64": "4.63.5", + "@rollup/rollup-darwin-arm64": "4.63.5", + "@rollup/rollup-darwin-x64": "4.63.5", + "@rollup/rollup-freebsd-arm64": "4.63.5", + "@rollup/rollup-freebsd-x64": "4.63.5", + "@rollup/rollup-linux-arm-gnueabihf": "4.63.5", + "@rollup/rollup-linux-arm-musleabihf": "4.63.5", + "@rollup/rollup-linux-arm64-gnu": "4.63.5", + "@rollup/rollup-linux-arm64-musl": "4.63.5", + "@rollup/rollup-linux-loong64-gnu": "4.63.5", + "@rollup/rollup-linux-loong64-musl": "4.63.5", + "@rollup/rollup-linux-ppc64-gnu": "4.63.5", + "@rollup/rollup-linux-ppc64-musl": "4.63.5", + "@rollup/rollup-linux-riscv64-gnu": "4.63.5", + "@rollup/rollup-linux-riscv64-musl": "4.63.5", + "@rollup/rollup-linux-s390x-gnu": "4.63.5", + "@rollup/rollup-linux-x64-gnu": "4.63.5", + "@rollup/rollup-linux-x64-musl": "4.63.5", + "@rollup/rollup-openbsd-x64": "4.63.5", + "@rollup/rollup-openharmony-arm64": "4.63.5", + "@rollup/rollup-win32-arm64-msvc": "4.63.5", + "@rollup/rollup-win32-ia32-msvc": "4.63.5", + "@rollup/rollup-win32-x64-gnu": "4.63.5", + "@rollup/rollup-win32-x64-msvc": "4.63.5", + "fsevents": "~2.3.2" + } + }, + "node_modules/rxjs": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "license": "ISC", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, + "node_modules/seedrandom": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz", + "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==", + "license": "MIT" + }, + "node_modules/shell-quote": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.9.0.tgz", + "integrity": "sha512-Iov+JwFv/2HcTpcwNMKd8+IWNb8tboQJNQTkAY/LLVK7gGH9jy+LGkVqPxfekHl+yMmiqXszdGWXgkfml7hjqA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "license": "BSD-3-Clause" + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tldts": { + "version": "7.4.16", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.4.16.tgz", + "integrity": "sha512-QwBER5KMR86IIjpIiO7H/Z3IMJPsZ1A6RKPAqzTTgOyUQUSt9FdnKcqhTaJmkY6HVrgouZHZR0ncK5QxvmnQeg==", + "dev": true, + "license": "MIT", + "dependencies": { + "tldts-core": "^7.4.16" + }, + "bin": { + "tldts": "bin/cli.js" + } + }, + "node_modules/tldts-core": { + "version": "7.4.16", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.4.16.tgz", + "integrity": "sha512-MDolfaSJtlSK5Y0A1xl3277ekubZwobpBjugknDizI9O5Rm60a1m8k4ICK+MRsCDzPygT81mp3BBf5RKDlFRfA==", + "dev": true, + "license": "MIT" + }, + "node_modules/tough-cookie": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.0.2.tgz", + "integrity": "sha512-exgYmnmL/sJpR3upZfXG5PoatXQii55xAiXGXzY+sROLZ/Y+SLcp9PgJNI9Vz37HpQ74WvDcLT8eqm+kV3FzrA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tldts": "^7.0.5" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "license": "MIT", + "bin": { + "tree-kill": "cli.js" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD" + }, + "node_modules/undici": { + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/undici/-/undici-8.11.2.tgz", + "integrity": "sha512-u4UB2/IrKdU6lFxumHmmo1a3fCQO5tzQllRorfoRS63txhrB7xTpSn1PftwC4qEHkOaqP95fCWW4lJzwErwzhQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=22.19.0" + } + }, + "node_modules/undici-types": { + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz", + "integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==", + "license": "MIT" + }, + "node_modules/vite": { + "version": "6.4.3", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.3.tgz", + "integrity": "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.25.0", + "fdir": "^6.4.4", + "picomatch": "^4.0.2", + "postcss": "^8.5.3", + "rollup": "^4.34.9", + "tinyglobby": "^0.2.13" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "jiti": ">=1.21.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/w3c-xmlserializer": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-6.0.0.tgz", + "integrity": "sha512-4Nsy8K5Tr6SPDH9jhKJOHf7ChDrc1zufZTVSF7x72hwuEXBqxqk9G6cK+K2NRUtB3iELRJqjXb4JPDMBjMTl2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-mimetype": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz", + "integrity": "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + } + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true, + "license": "MIT" + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..29324f1 --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "django-vite-integration", + "private": true, + "type": "module", + "scripts": { + "test": "node --test frontend/tests/*.test.mjs", + "dev": "concurrently --kill-others-on-fail --names django,vite --prefix-colors blue,magenta \"npm:django\" \"npm:vite\"", + "django": "node scripts/dev-django.mjs", + "vite": "vite", + "build": "vite build" + }, + "devDependencies": { + "concurrently": "^9.1.2", + "jsdom": "^30.1.1", + "vite": "^6.2.0" + }, + "dependencies": { + "@ffmpeg/core": "^0.12.10", + "@ffmpeg/ffmpeg": "^0.12.15", + "@ffmpeg/util": "^0.12.2", + "@tensorflow/tfjs": "^4.22.0" + } +} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..979744a --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +Django==6.1.1 +h3>=4.1,<5 + +requests>=2.31,<3 +python-dotenv>=1.0,<2 diff --git a/scripts/BROWSER_YAMNET.md b/scripts/BROWSER_YAMNET.md new file mode 100644 index 0000000..919c9b4 --- /dev/null +++ b/scripts/BROWSER_YAMNET.md @@ -0,0 +1,18 @@ +# Browser YAMNet model + +The browser GraphModel uses the [official TensorFlow YAMNet implementation](https://github.com/tensorflow/models/tree/master/research/audioset/yamnet) and [published weights](https://storage.googleapis.com/audioset/yamnet.h5). The official 521-class AudioSet map is included beside it. Runtime assets live in `fireworks_detect/static/browser-yamnet/`; browsers fetch them only from BoomCast. `VERSION` records the pinned source revision and TensorFlow version. + +To regenerate, use a dedicated conversion environment. The conversion script downloads the pinned source and weights, exports a SavedModel, converts it to a TensorFlow.js GraphModel, and writes the class map and version file. It supplies scoped empty modules for the converter's unused TF Decision Forests, TF Hub, and JAX imports; YAMNet does not use those features. The following package set was used for this artifact on Python 3.13: + +```sh +mkdir -p .yamnet-build-tmp +python3 -m venv .yamnet-convert +TMPDIR="$PWD/.yamnet-build-tmp" .yamnet-convert/bin/pip install --no-cache-dir tensorflow-cpu tensorflowjs tensorflow-hub tf-keras +TMPDIR="$PWD/.yamnet-build-tmp" .yamnet-convert/bin/pip install --no-cache-dir --no-deps tensorflowjs==4.22.0 +TF_USE_LEGACY_KERAS=1 TMPDIR="$PWD/.yamnet-build-tmp" .yamnet-convert/bin/python scripts/build_browser_yamnet.py +node scripts/verify_browser_yamnet.mjs +npm run build +python manage.py collectstatic --noinput +``` + +The verifier runs an actual TensorFlow.js inference and checks the 521-class score output. Keep the class map aligned with the model weights. The browser's relevance and speech thresholds are triage settings in `browser_policy.py`; the server classifier remains authoritative. Compare changed model outputs with representative clips before enabling the beta after an upgrade. diff --git a/scripts/build_browser_yamnet.py b/scripts/build_browser_yamnet.py new file mode 100644 index 0000000..9e2c2fd --- /dev/null +++ b/scripts/build_browser_yamnet.py @@ -0,0 +1,80 @@ +"""Regenerate the self-hosted YAMNet TensorFlow.js GraphModel. + +Run in a dedicated Python environment with tensorflow-cpu, tensorflowjs, +TensorFlow Hub, and tf-keras installed. Uses the official TensorFlow YAMNet +implementation and published weights; normal site traffic never contacts them. +""" +import csv +import json +import os +import subprocess +import sys +import tempfile +import urllib.request +from pathlib import Path + +SOURCE_REVISION = "c651073789719ff39dcf51406733bbcaaafb43f2" +SOURCE_BASE = f"https://raw.githubusercontent.com/tensorflow/models/{SOURCE_REVISION}/research/audioset/yamnet" +WEIGHTS_URL = "https://storage.googleapis.com/audioset/yamnet.h5" +OUTPUT = Path(__file__).resolve().parents[1] / "fireworks_detect/static/browser-yamnet" + + +def download(url, target): + urllib.request.urlretrieve(url, target) + + +def main(): + os.environ.setdefault("TF_USE_LEGACY_KERAS", "1") + with tempfile.TemporaryDirectory() as directory: + directory = Path(directory) + for name in ("yamnet.py", "features.py", "params.py", "yamnet_class_map.csv"): + download(f"{SOURCE_BASE}/{name}", directory / name) + download(WEIGHTS_URL, directory / "yamnet.h5") + sys.path.insert(0, str(directory)) + import tensorflow as tf + import params + import yamnet + + class Export(tf.Module): + def __init__(self): + super().__init__() + self.model = yamnet.yamnet_frames_model(params.Params(tflite_compatible=True)) + self.model.load_weights(str(directory / "yamnet.h5")) + + @tf.function(input_signature=[tf.TensorSpec([None], tf.float32, name="waveform")]) + def classify(self, waveform): + scores, embeddings, spectrogram = self.model(waveform) + return {"predictions": scores, "embeddings": embeddings, "log_mel_spectrogram": spectrogram} + + export = Export() + with tempfile.TemporaryDirectory() as saved_dir: + tf.saved_model.save(export, saved_dir, signatures={"serving_default": export.classify}) + OUTPUT.mkdir(parents=True, exist_ok=True) + # The converter imports TF Decision Forests unconditionally even + # though YAMNet contains no decision forest ops. Keep this stub + # scoped to the conversion subprocess rather than installing TFDF. + (directory / "tensorflow_decision_forests.py").write_text("") + (directory / "tensorflow_hub.py").write_text("") + (directory / "jax/experimental").mkdir(parents=True) + (directory / "jax/__init__.py").write_text("") + (directory / "jax/experimental/__init__.py").write_text("") + (directory / "jax/experimental/jax2tf.py").write_text("") + converter_env = {**os.environ, "PYTHONPATH": str(directory)} + subprocess.run([ + sys.executable, "-m", "tensorflowjs.converters.converter", + "--input_format=tf_saved_model", "--output_format=tfjs_graph_model", + "--signature_name=serving_default", saved_dir, str(OUTPUT), + ], check=True, env=converter_env) + with (directory / "yamnet_class_map.csv").open(newline="") as source: + rows = list(csv.DictReader(source)) + assert len(rows) == 521 + (OUTPUT / "yamnet_class_map.csv").write_bytes((directory / "yamnet_class_map.csv").read_bytes()) + (OUTPUT / "yamnet_class_map.json").write_text(json.dumps([row["display_name"] for row in rows])) + (OUTPUT / "VERSION").write_text( + f"google-yamnet-1\nsource_revision={SOURCE_REVISION}\ntensorflow={tf.__version__}\n" + ) + print(f"Browser YAMNet GraphModel written to {OUTPUT}") + + +if __name__ == "__main__": + main() diff --git a/scripts/dev-django.mjs b/scripts/dev-django.mjs new file mode 100644 index 0000000..1c90c1d --- /dev/null +++ b/scripts/dev-django.mjs @@ -0,0 +1,13 @@ +import { spawn } from "node:child_process"; + +const host = process.env.DJANGO_HOST ?? "0.0.0.0"; +const port = process.env.DJANGO_PORT ?? "8000"; +const command = process.env.DJANGO_DEV_COMMAND ?? `.venv/bin/python manage.py runserver ${host}:${port}`; +const child = spawn(command, { shell: true, stdio: "inherit", env: { ...process.env, VITE_USE_DEV_SERVER: "1", DJANGO_DEBUG: "1" } }); + +child.on("exit", (code, signal) => { + if (signal) { + process.kill(process.pid, signal); + } + process.exit(code ?? 0); +}); diff --git a/scripts/verify_browser_yamnet.mjs b/scripts/verify_browser_yamnet.mjs new file mode 100644 index 0000000..b045cb3 --- /dev/null +++ b/scripts/verify_browser_yamnet.mjs @@ -0,0 +1,29 @@ +import { readFileSync } from "node:fs"; +import { join, dirname } from "node:path"; +import * as tf from "@tensorflow/tfjs"; + +const directory = new URL("../fireworks_detect/static/browser-yamnet/", import.meta.url).pathname; +const manifest = JSON.parse(readFileSync(join(directory, "model.json"), "utf8")); +const mapping = JSON.parse(readFileSync(join(directory, "yamnet_class_map.json"), "utf8")); +if (manifest.format !== "graph-model" || mapping.length !== 521) throw new Error("Invalid browser YAMNet assets"); +const specs = manifest.weightsManifest.flatMap((group) => group.weights); +const chunks = manifest.weightsManifest.flatMap((group) => group.paths.map((path) => readFileSync(join(directory, path)))); +const combined = Buffer.concat(chunks); +const model = await tf.loadGraphModel({ load: async () => ({ + modelTopology: manifest.modelTopology, + weightSpecs: specs, + weightData: combined.buffer.slice(combined.byteOffset, combined.byteOffset + combined.byteLength), +}) }); +const input = tf.zeros([16000]); +let outputs; +try { + outputs = await model.executeAsync(input); + const tensors = Array.isArray(outputs) ? outputs : [outputs]; + const scores = tensors.find((tensor) => tensor.shape.length === 2 && tensor.shape[1] === 521); + if (!scores || scores.shape[0] < 1) throw new Error("YAMNet did not produce scores"); + console.log("Verified browser YAMNet score tensor:", scores.shape); +} finally { + input.dispose(); + (Array.isArray(outputs) ? outputs : [outputs]).forEach((tensor) => tensor?.dispose()); + model.dispose(); +} diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..a7fc0b8 --- /dev/null +++ b/templates/base.html @@ -0,0 +1 @@ +{% load static vite i18n %}{% block title %}{{ app_name }}{% endblock %}{% vite_asset 'frontend/src/entries/app.js' %}
{% block content %}{% endblock %}
\ No newline at end of file diff --git a/templates/registration/login.html b/templates/registration/login.html new file mode 100644 index 0000000..608bedf --- /dev/null +++ b/templates/registration/login.html @@ -0,0 +1 @@ +{% extends 'base.html' %}{% block content %}

Sign in

{% csrf_token %}{{ form.as_p }}
{% endblock %} \ No newline at end of file diff --git a/vite.config.mjs b/vite.config.mjs new file mode 100644 index 0000000..fe30491 --- /dev/null +++ b/vite.config.mjs @@ -0,0 +1,48 @@ +import { existsSync, readdirSync, statSync } from "node:fs"; +import { resolve } from "node:path"; +import { defineConfig } from "vite"; + +const root = process.cwd(); +const environment = process.env; +const entryDirectory = environment.VITE_ENTRY_DIR ?? "frontend/src/entries"; +const fallbackEntrypoint = environment.VITE_ENTRY ?? "frontend/src/main.js"; +const outputDirectory = environment.VITE_OUT_DIR ?? "vite_integration/static/vite"; + +function filesBelow(directory) { + if (!existsSync(directory)) return []; + return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => { + const path = `${directory}/${entry.name}`; + if (entry.isDirectory()) return filesBelow(path); + return statSync(path).isFile() && entry.name.endsWith(".js") ? [path] : []; + }); +} + +function configuredEntrypoints() { + const explicitlyConfigured = environment.VITE_ENTRY; + if (explicitlyConfigured) { + return explicitlyConfigured.split(",").map((entry) => entry.trim()).filter(Boolean); + } + const discovered = filesBelow(entryDirectory); + return discovered.length ? discovered : [fallbackEntrypoint]; +} + +const entrypoints = configuredEntrypoints(); +const input = Object.fromEntries(entrypoints.map((entry) => [entry, resolve(root, entry)])); + +export default defineConfig(({ command }) => ({ + base: command === "serve" + ? (environment.VITE_DEV_BASE_URL ?? "/") + : (environment.VITE_BASE_URL ?? "/static/vite/"), + server: { + host: environment.VITE_HOST ?? "127.0.0.1", + port: Number(environment.VITE_PORT ?? 5173), + strictPort: true, + cors: true, + }, + build: { + outDir: resolve(root, outputDirectory), + emptyOutDir: true, + manifest: ".vite/manifest.json", + rollupOptions: { input }, + }, +})); diff --git a/vite_integration/__init__.py b/vite_integration/__init__.py new file mode 100644 index 0000000..ac07cbe --- /dev/null +++ b/vite_integration/__init__.py @@ -0,0 +1 @@ +"""Portable Django template tags for Vite assets.""" diff --git a/vite_integration/apps.py b/vite_integration/apps.py new file mode 100644 index 0000000..50ab195 --- /dev/null +++ b/vite_integration/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class ViteIntegrationConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "vite_integration" diff --git a/vite_integration/templates/vite_integration/example_assets.html b/vite_integration/templates/vite_integration/example_assets.html new file mode 100644 index 0000000..9e2809a --- /dev/null +++ b/vite_integration/templates/vite_integration/example_assets.html @@ -0,0 +1,3 @@ +{% load vite %} +{# Add this once inside a base template's or just before . #} +{% vite_asset "frontend/src/entries/site.js" %} diff --git a/vite_integration/templatetags/__init__.py b/vite_integration/templatetags/__init__.py new file mode 100644 index 0000000..020fad5 --- /dev/null +++ b/vite_integration/templatetags/__init__.py @@ -0,0 +1 @@ +"""Template-tag package for the portable Vite integration.""" diff --git a/vite_integration/templatetags/vite.py b/vite_integration/templatetags/vite.py new file mode 100644 index 0000000..2e0010d --- /dev/null +++ b/vite_integration/templatetags/vite.py @@ -0,0 +1,106 @@ +"""Django template tags that select Vite HMR or manifest-backed assets.""" + +import json +import os +from functools import lru_cache +from pathlib import Path +from urllib.parse import urljoin + +from django import template +from django.conf import settings +from django.contrib.staticfiles import finders +from django.template import TemplateSyntaxError +from django.templatetags.static import static +from django.utils.safestring import mark_safe +from django.utils.html import format_html + +register = template.Library() + + +def _setting(name, default=None): + value = getattr(settings, name, None) + return value if value is not None else os.environ.get(name, default) + + +def _as_bool(value): + return str(value).lower() in {"1", "true", "yes", "on"} + + +def _use_dev_server(): + return _as_bool(_setting("VITE_USE_DEV_SERVER", False)) + + +def _static_prefix(): + return str(_setting("VITE_STATIC_PREFIX", "vite")).strip("/") + + +def _manifest_path(): + configured_path = _setting("VITE_MANIFEST_PATH") + if configured_path: + return Path(configured_path) + found_path = finders.find(f"{_static_prefix()}/.vite/manifest.json") + if found_path: + return Path(found_path) + raise TemplateSyntaxError( + "Vite manifest not found. Run `npm run build`, then `python manage.py collectstatic`." + ) + + +@lru_cache(maxsize=8) +def _read_manifest(path, modified_time): + with Path(path).open(encoding="utf-8") as manifest_file: + manifest = json.load(manifest_file) + if not isinstance(manifest, dict): + raise TemplateSyntaxError("Vite manifest must contain a JSON object.") + return manifest + + +def _manifest(): + path = _manifest_path() + try: + modified_time = path.stat().st_mtime_ns + except OSError as error: + raise TemplateSyntaxError("Vite manifest could not be read.") from error + return _read_manifest(str(path), modified_time) + + +def _production_tags(entrypoint): + manifest = _manifest() + try: + entry = manifest[entrypoint] + except KeyError as error: + raise TemplateSyntaxError(f"Vite entry point `{entrypoint}` is missing from the manifest.") from error + + css_files = [] + visited = set() + + def visit(chunk_name): + if chunk_name in visited: + return + visited.add(chunk_name) + chunk = manifest.get(chunk_name, {}) + for imported_chunk in chunk.get("imports", []): + visit(imported_chunk) + for css_file in chunk.get("css", []): + if css_file not in css_files: + css_files.append(css_file) + + visit(entrypoint) + tags = [format_html('', static(f"{_static_prefix()}/{css_file}")) for css_file in css_files] + tags.append(format_html('', static(f"{_static_prefix()}/{entry['file']}"))) + return mark_safe("\n".join(tags)) + + +@register.simple_tag +def vite_asset(entrypoint): + """Render one entry point from Vite's dev server or production manifest.""" + if _use_dev_server(): + dev_server_url = _setting("VITE_DEV_SERVER_URL", "http://127.0.0.1:5173/").rstrip("/") + "/" + hmr_client_url = urljoin(dev_server_url, "@vite/client") + entry_url = urljoin(dev_server_url, entrypoint.lstrip("/")) + return format_html( + '\n', + hmr_client_url, + entry_url, + ) + return _production_tags(entrypoint) diff --git a/vite_integration/tests.py b/vite_integration/tests.py new file mode 100644 index 0000000..74aae0d --- /dev/null +++ b/vite_integration/tests.py @@ -0,0 +1,31 @@ +import json +from pathlib import Path +from tempfile import TemporaryDirectory + +from django.template import Context, Template +from django.test import SimpleTestCase, override_settings + +from .templatetags.vite import _read_manifest + + +class ViteAssetTemplateTagTests(SimpleTestCase): + def setUp(self): + _read_manifest.cache_clear() + + def render_asset(self): + return Template('{% load vite %}{% vite_asset "frontend/src/main.js" %}').render(Context()) + + @override_settings(VITE_USE_DEV_SERVER=True, VITE_DEV_SERVER_URL="http://vite.test:4173/") + def test_development_renders_hmr_client_and_entrypoint(self): + rendered = self.render_asset() + + self.assertIn("http://vite.test:4173/@vite/client", rendered) + self.assertIn("http://vite.test:4173/frontend/src/main.js", rendered) + + def test_production_resolves_css_and_script_from_manifest(self): + with TemporaryDirectory() as temporary_directory: + manifest_path = Path(temporary_directory) / "manifest.json" + manifest_path.write_text(json.dumps({"frontend/src/main.js": {"file": "assets/main-hash.js", "css": ["assets/main-hash.css"]}}), encoding="utf-8") + with override_settings(VITE_USE_DEV_SERVER=False, VITE_MANIFEST_PATH=manifest_path, VITE_STATIC_PREFIX="vite", STATIC_URL="/static/"): + rendered = self.render_asset() +