@livepeer-frameworks/streamcrafter-wc 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/cjs/components/fw-sc-advanced.js +198 -0
  2. package/dist/cjs/components/fw-sc-advanced.js.map +1 -0
  3. package/dist/cjs/components/fw-sc-compositor.js +116 -0
  4. package/dist/cjs/components/fw-sc-compositor.js.map +1 -0
  5. package/dist/cjs/components/fw-sc-layer-list.js +253 -0
  6. package/dist/cjs/components/fw-sc-layer-list.js.map +1 -0
  7. package/dist/cjs/components/fw-sc-scene-switcher.js +164 -0
  8. package/dist/cjs/components/fw-sc-scene-switcher.js.map +1 -0
  9. package/dist/cjs/components/fw-sc-volume.js +183 -0
  10. package/dist/cjs/components/fw-sc-volume.js.map +1 -0
  11. package/dist/cjs/components/fw-streamcrafter.js +508 -0
  12. package/dist/cjs/components/fw-streamcrafter.js.map +1 -0
  13. package/dist/cjs/controllers/ingest-controller-host.js +236 -0
  14. package/dist/cjs/controllers/ingest-controller-host.js.map +1 -0
  15. package/dist/cjs/define.js +25 -0
  16. package/dist/cjs/define.js.map +1 -0
  17. package/dist/cjs/icons/index.js +283 -0
  18. package/dist/cjs/icons/index.js.map +1 -0
  19. package/dist/cjs/index.js +38 -0
  20. package/dist/cjs/index.js.map +1 -0
  21. package/dist/cjs/node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.57.1_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js +33 -0
  22. package/dist/cjs/node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.57.1_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js.map +1 -0
  23. package/dist/cjs/styles/shared-styles.js +2019 -0
  24. package/dist/cjs/styles/shared-styles.js.map +1 -0
  25. package/dist/cjs/styles/utility-styles.js +182 -0
  26. package/dist/cjs/styles/utility-styles.js.map +1 -0
  27. package/dist/esm/components/fw-sc-advanced.js +198 -0
  28. package/dist/esm/components/fw-sc-advanced.js.map +1 -0
  29. package/dist/esm/components/fw-sc-compositor.js +116 -0
  30. package/dist/esm/components/fw-sc-compositor.js.map +1 -0
  31. package/dist/esm/components/fw-sc-layer-list.js +253 -0
  32. package/dist/esm/components/fw-sc-layer-list.js.map +1 -0
  33. package/dist/esm/components/fw-sc-scene-switcher.js +164 -0
  34. package/dist/esm/components/fw-sc-scene-switcher.js.map +1 -0
  35. package/dist/esm/components/fw-sc-volume.js +183 -0
  36. package/dist/esm/components/fw-sc-volume.js.map +1 -0
  37. package/dist/esm/components/fw-streamcrafter.js +508 -0
  38. package/dist/esm/components/fw-streamcrafter.js.map +1 -0
  39. package/dist/esm/controllers/ingest-controller-host.js +234 -0
  40. package/dist/esm/controllers/ingest-controller-host.js.map +1 -0
  41. package/dist/esm/define.js +23 -0
  42. package/dist/esm/define.js.map +1 -0
  43. package/dist/esm/icons/index.js +253 -0
  44. package/dist/esm/icons/index.js.map +1 -0
  45. package/dist/esm/index.js +8 -0
  46. package/dist/esm/index.js.map +1 -0
  47. package/dist/esm/node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.57.1_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js +31 -0
  48. package/dist/esm/node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.57.1_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js.map +1 -0
  49. package/dist/esm/styles/shared-styles.js +2017 -0
  50. package/dist/esm/styles/shared-styles.js.map +1 -0
  51. package/dist/esm/styles/utility-styles.js +180 -0
  52. package/dist/esm/styles/utility-styles.js.map +1 -0
  53. package/dist/fw-streamcrafter.iife.js +3121 -0
  54. package/dist/fw-streamcrafter.iife.js.map +1 -0
  55. package/dist/types/components/fw-sc-advanced.d.ts +20 -0
  56. package/dist/types/components/fw-sc-compositor.d.ts +19 -0
  57. package/dist/types/components/fw-sc-layer-list.d.ts +30 -0
  58. package/dist/types/components/fw-sc-scene-switcher.d.ts +23 -0
  59. package/dist/types/components/fw-sc-volume.d.ts +30 -0
  60. package/dist/types/components/fw-streamcrafter.d.ts +49 -0
  61. package/dist/types/controllers/ingest-controller-host.d.ts +77 -0
  62. package/dist/types/define.d.ts +1 -0
  63. package/dist/types/icons/index.d.ts +29 -0
  64. package/dist/types/iife-entry.d.ts +11 -0
  65. package/dist/types/index.d.ts +12 -0
  66. package/dist/types/styles/shared-styles.d.ts +1 -0
  67. package/dist/types/styles/utility-styles.d.ts +1 -0
  68. package/package.json +55 -0
  69. package/src/components/fw-sc-advanced.ts +221 -0
  70. package/src/components/fw-sc-compositor.ts +162 -0
  71. package/src/components/fw-sc-layer-list.ts +251 -0
  72. package/src/components/fw-sc-scene-switcher.ts +163 -0
  73. package/src/components/fw-sc-volume.ts +171 -0
  74. package/src/components/fw-streamcrafter.ts +515 -0
  75. package/src/controllers/ingest-controller-host.ts +358 -0
  76. package/src/define.ts +23 -0
  77. package/src/icons/index.ts +291 -0
  78. package/src/iife-entry.ts +11 -0
  79. package/src/index.ts +15 -0
  80. package/src/styles/shared-styles.ts +2014 -0
  81. package/src/styles/utility-styles.ts +177 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fw-streamcrafter.iife.js","sources":["../../../../node_modules/.pnpm/@rollup+plugin-typescript@12.3.0_rollup@4.57.1_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js","../../../../node_modules/.pnpm/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/css-tag.js","../../../../node_modules/.pnpm/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/reactive-element.js","../../../../node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/lit-html.js","../../../../node_modules/.pnpm/lit-element@4.2.2/node_modules/lit-element/lit-element.js","../../../../node_modules/.pnpm/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/custom-element.js","../../../../node_modules/.pnpm/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.js","../../../../node_modules/.pnpm/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.js","../../../../node_modules/.pnpm/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/query.js","../../../../node_modules/.pnpm/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/base.js","../../../../node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive.js","../../../../node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directives/class-map.js","../src/styles/shared-styles.ts","../src/styles/utility-styles.ts","../src/icons/index.ts","../../core/dist/esm/types.js","../../core/dist/esm/core/EventEmitter.js","../../core/dist/esm/core/MediaConstraints.js","../../core/dist/esm/core/DeviceManager.js","../../core/dist/esm/core/ScreenCapture.js","../../core/dist/esm/core/WhipClient.js","../../core/dist/esm/core/AudioMixer.js","../../core/dist/esm/core/ReconnectionManager.js","../../core/dist/esm/core/layouts/index.js","../../core/dist/esm/core/SceneManager.js","../../core/dist/esm/core/TransitionEngine.js","../../core/dist/esm/core/EncoderManager.js","../../core/dist/esm/core/FeatureDetection.js","../../core/dist/esm/core/IngestControllerV2.js","../src/controllers/ingest-controller-host.ts","../src/components/fw-streamcrafter.ts","../src/components/fw-sc-compositor.ts","../src/components/fw-sc-scene-switcher.ts","../src/components/fw-sc-layer-list.ts","../src/components/fw-sc-volume.ts","../src/components/fw-sc-advanced.ts","../src/define.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&\"adoptedStyleSheets\"in Document.prototype&&\"replace\"in CSSStyleSheet.prototype,s=Symbol(),o=new WeakMap;class n{constructor(t,e,o){if(this._$cssResult$=!0,o!==s)throw Error(\"CSSResult is not constructable. Use `unsafeCSS` or `css` instead.\");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const s=this.t;if(e&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o.set(s,t))}return t}toString(){return this.cssText}}const r=t=>new n(\"string\"==typeof t?t:t+\"\",void 0,s),i=(t,...e)=>{const o=1===t.length?t[0]:e.reduce((e,s,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if(\"number\"==typeof t)return t;throw Error(\"Value passed to 'css' function must be a 'css' function result: \"+t+\". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.\")})(s)+t[o+1],t[0]);return new n(o,t,s)},S=(s,o)=>{if(e)s.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of o){const o=document.createElement(\"style\"),n=t.litNonce;void 0!==n&&o.setAttribute(\"nonce\",n),o.textContent=e.cssText,s.appendChild(o)}},c=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e=\"\";for(const s of t.cssRules)e+=s.cssText;return r(e)})(t):t;export{n as CSSResult,S as adoptStyles,i as css,c as getCompatibleStyle,e as supportsAdoptingStyleSheets,r as unsafeCSS};\n//# sourceMappingURL=css-tag.js.map\n","import{getCompatibleStyle as t,adoptStyles as s}from\"./css-tag.js\";export{CSSResult,css,supportsAdoptingStyleSheets,unsafeCSS}from\"./css-tag.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const{is:i,defineProperty:e,getOwnPropertyDescriptor:h,getOwnPropertyNames:r,getOwnPropertySymbols:o,getPrototypeOf:n}=Object,a=globalThis,c=a.trustedTypes,l=c?c.emptyScript:\"\",p=a.reactiveElementPolyfillSupport,d=(t,s)=>t,u={toAttribute(t,s){switch(s){case Boolean:t=t?l:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},f=(t,s)=>!i(t,s),b={attribute:!0,type:String,converter:u,reflect:!1,useDefault:!1,hasChanged:f};Symbol.metadata??=Symbol(\"metadata\"),a.litPropertyMetadata??=new WeakMap;class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e(this.prototype,t,h)}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t}};return{get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(d(\"elementProperties\")))return;const t=n(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(d(\"finalized\")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d(\"properties\"))){const t=this.properties,s=[...r(t),...o(t)];for(const i of s)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(t(s))}else void 0!==s&&i.push(t(s));return i}static _$Eu(t,s){const i=s.attribute;return!1===i?void 0:\"string\"==typeof i?i:\"string\"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return s(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,s,i){this._$AK(t,i)}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h=\"function\"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null}}requestUpdate(t,s,i,e=!1,h){if(void 0!==t){const r=this.constructor;if(!1===e&&(h=this[t]),i??=r.getPropertyOptions(t),!((i.hasChanged??f)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,s,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),!0!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),!0===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];!0!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e)}}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(s)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(s)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}}y.elementStyles=[],y.shadowRootOptions={mode:\"open\"},y[d(\"elementProperties\")]=new Map,y[d(\"finalized\")]=new Map,p?.({ReactiveElement:y}),(a.reactiveElementVersions??=[]).push(\"2.1.2\");export{y as ReactiveElement,s as adoptStyles,u as defaultConverter,t as getCompatibleStyle,f as notEqual};\n//# sourceMappingURL=reactive-element.js.map\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t=globalThis,i=t=>t,s=t.trustedTypes,e=s?s.createPolicy(\"lit-html\",{createHTML:t=>t}):void 0,h=\"$lit$\",o=`lit$${Math.random().toFixed(9).slice(2)}$`,n=\"?\"+o,r=`<${n}>`,l=document,c=()=>l.createComment(\"\"),a=t=>null===t||\"object\"!=typeof t&&\"function\"!=typeof t,u=Array.isArray,d=t=>u(t)||\"function\"==typeof t?.[Symbol.iterator],f=\"[ \\t\\n\\f\\r]\",v=/<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g,_=/-->/g,m=/>/g,p=RegExp(`>|${f}(?:([^\\\\s\"'>=/]+)(${f}*=${f}*(?:[^ \\t\\n\\f\\r\"'\\`<>=]|(\"|')|))|$)`,\"g\"),g=/'/g,$=/\"/g,y=/^(?:script|style|textarea|title)$/i,x=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),b=x(1),w=x(2),T=x(3),E=Symbol.for(\"lit-noChange\"),A=Symbol.for(\"lit-nothing\"),C=new WeakMap,P=l.createTreeWalker(l,129);function V(t,i){if(!u(t)||!t.hasOwnProperty(\"raw\"))throw Error(\"invalid template strings array\");return void 0!==e?e.createHTML(i):i}const N=(t,i)=>{const s=t.length-1,e=[];let n,l=2===i?\"<svg>\":3===i?\"<math>\":\"\",c=v;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,f=0;for(;f<s.length&&(c.lastIndex=f,u=c.exec(s),null!==u);)f=c.lastIndex,c===v?\"!--\"===u[1]?c=_:void 0!==u[1]?c=m:void 0!==u[2]?(y.test(u[2])&&(n=RegExp(\"</\"+u[2],\"g\")),c=p):void 0!==u[3]&&(c=p):c===p?\">\"===u[0]?(c=n??v,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?p:'\"'===u[3]?$:g):c===$||c===g?c=p:c===_||c===m?c=v:(c=p,n=void 0);const x=c===p&&t[i+1].startsWith(\"/>\")?\" \":\"\";l+=c===v?s+r:d>=0?(e.push(a),s.slice(0,d)+h+s.slice(d)+o+x):s+o+(-2===d?i:x)}return[V(t,l+(t[s]||\"<?>\")+(2===i?\"</svg>\":3===i?\"</math>\":\"\")),e]};class S{constructor({strings:t,_$litType$:i},e){let r;this.parts=[];let l=0,a=0;const u=t.length-1,d=this.parts,[f,v]=N(t,i);if(this.el=S.createElement(f,e),P.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=P.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(h)){const i=v[a++],s=r.getAttribute(t).split(o),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:l,name:e[2],strings:s,ctor:\".\"===e[1]?I:\"?\"===e[1]?L:\"@\"===e[1]?z:H}),r.removeAttribute(t)}else t.startsWith(o)&&(d.push({type:6,index:l}),r.removeAttribute(t));if(y.test(r.tagName)){const t=r.textContent.split(o),i=t.length-1;if(i>0){r.textContent=s?s.emptyScript:\"\";for(let s=0;s<i;s++)r.append(t[s],c()),P.nextNode(),d.push({type:2,index:++l});r.append(t[i],c())}}}else if(8===r.nodeType)if(r.data===n)d.push({type:2,index:l});else{let t=-1;for(;-1!==(t=r.data.indexOf(o,t+1));)d.push({type:7,index:l}),t+=o.length-1}l++}}static createElement(t,i){const s=l.createElement(\"template\");return s.innerHTML=t,s}}function M(t,i,s=t,e){if(i===E)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=a(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(!1),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=M(t,h._$AS(t,i.values),h,e)),i}class R{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??l).importNode(i,!0);P.currentNode=e;let h=P.nextNode(),o=0,n=0,r=s[0];for(;void 0!==r;){if(o===r.index){let i;2===r.type?i=new k(h,h.nextSibling,this,t):1===r.type?i=new r.ctor(h,r.name,r.strings,this,t):6===r.type&&(i=new Z(h,this,t)),this._$AV.push(i),r=s[++n]}o!==r?.index&&(h=P.nextNode(),o++)}return P.currentNode=l,e}p(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class k{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=A,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=M(this,t,i),a(t)?t===A||null==t||\"\"===t?(this._$AH!==A&&this._$AR(),this._$AH=A):t!==this._$AH&&t!==E&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):d(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==A&&a(this._$AH)?this._$AA.nextSibling.data=t:this.T(l.createTextNode(t)),this._$AH=t}$(t){const{values:i,_$litType$:s}=t,e=\"number\"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=S.createElement(V(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else{const t=new R(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t}}_$AC(t){let i=C.get(t.strings);return void 0===i&&C.set(t.strings,i=new S(t)),i}k(t){u(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new k(this.O(c()),this.O(c()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(!1,!0,s);t!==this._$AB;){const s=i(t).nextSibling;i(t).remove(),t=s}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class H{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=A,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||\"\"!==s[0]||\"\"!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=A}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=M(this,t,i,0),o=!a(t)||t!==this._$AH&&t!==E,o&&(this._$AH=t);else{const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=M(this,e[s+n],i,n),r===E&&(r=this._$AH[n]),o||=!a(r)||r!==this._$AH[n],r===A?t=A:t!==A&&(t+=(r??\"\")+h[n+1]),this._$AH[n]=r}o&&!e&&this.j(t)}j(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??\"\")}}class I extends H{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===A?void 0:t}}class L extends H{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==A)}}class z extends H{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5}_$AI(t,i=this){if((t=M(this,t,i,0)??A)===E)return;const s=this._$AH,e=t===A&&s!==A||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==A&&(s===A||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){\"function\"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class Z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){M(this,t)}}const j={M:h,P:o,A:n,C:1,L:N,R,D:d,V:M,I:k,H,N:L,U:z,B:I,F:Z},B=t.litHtmlPolyfillSupport;B?.(S,k),(t.litHtmlVersions??=[]).push(\"3.3.2\");const D=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new k(i.insertBefore(c(),t),t,void 0,s??{})}return h._$AI(t),h};export{j as _$LH,b as html,T as mathml,E as noChange,A as nothing,D as render,w as svg};\n//# sourceMappingURL=lit-html.js.map\n","import{ReactiveElement as t}from\"@lit/reactive-element\";export*from\"@lit/reactive-element\";import{render as e,noChange as r}from\"lit-html\";export*from\"lit-html\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const s=globalThis;class i extends t{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=e(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return r}}i._$litElement$=!0,i[\"finalized\"]=!0,s.litElementHydrateSupport?.({LitElement:i});const o=s.litElementPolyfillSupport;o?.({LitElement:i});const n={_$AK:(t,e,r)=>{t._$AK(e,r)},_$AL:t=>t._$AL};(s.litElementVersions??=[]).push(\"4.2.2\");export{i as LitElement,n as _$LE};\n//# sourceMappingURL=lit-element.js.map\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t=t=>(e,o)=>{void 0!==o?o.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)};export{t as customElement};\n//# sourceMappingURL=custom-element.js.map\n","import{notEqual as t,defaultConverter as e}from\"../reactive-element.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const o={attribute:!0,type:String,converter:e,reflect:!1,hasChanged:t},r=(t=o,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),\"setter\"===n&&((t=Object.create(t)).wrapped=!0),s.set(r.name,t),\"accessor\"===n){const{name:o}=r;return{set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t,!0,r)},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if(\"setter\"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t,!0,r)}}throw Error(\"Unsupported decorator location: \"+n)};function n(t){return(e,o)=>\"object\"==typeof o?r(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}export{n as property,r as standardProperty};\n//# sourceMappingURL=property.js.map\n","import{property as t}from\"./property.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function r(r){return t({...r,state:!0,attribute:!1})}export{r as state};\n//# sourceMappingURL=state.js.map\n","import{desc as t}from\"./base.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function e(e,r){return(n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(r){const{get:e,set:r}=\"object\"==typeof s?n:i??(()=>{const t=Symbol();return{get(){return this[t]},set(e){this[t]=e}}})();return t(n,s,{get(){let t=e.call(this);return void 0===t&&(t=o(this),(null!==t||this.hasUpdated)&&r.call(this,t)),t}})}return t(n,s,{get(){return o(this)}})}}export{e as query};\n//# sourceMappingURL=query.js.map\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst e=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&\"object\"!=typeof t&&Object.defineProperty(e,t,c),c);export{e as desc};\n//# sourceMappingURL=base.js.map\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}export{i as Directive,t as PartType,e as directive};\n//# sourceMappingURL=directive.js.map\n","import{noChange as t}from\"../lit-html.js\";import{directive as s,Directive as i,PartType as r}from\"../directive.js\";\n/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const e=s(class extends i{constructor(t){if(super(t),t.type!==r.ATTRIBUTE||\"class\"!==t.name||t.strings?.length>2)throw Error(\"`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.\")}render(t){return\" \"+Object.keys(t).filter(s=>t[s]).join(\" \")+\" \"}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(\" \").split(/\\s/).filter(t=>\"\"!==t)));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)))}return t}});export{e as classMap};\n//# sourceMappingURL=class-map.js.map\n",null,null,null,"/**\n * StreamCrafter Core Types\n * Type definitions for browser-based streaming with WebCodecs\n */\n// Default compositor configuration\nconst DEFAULT_COMPOSITOR_CONFIG = {\n enabled: false,\n width: 1920,\n height: 1080,\n frameRate: 30,\n renderer: \"auto\",\n defaultTransition: {\n type: \"fade\",\n durationMs: 500,\n easing: \"ease-in-out\",\n },\n};\n// Default layer transform\nconst DEFAULT_LAYER_TRANSFORM = {\n x: 0,\n y: 0,\n width: 1,\n height: 1,\n opacity: 1,\n rotation: 0,\n borderRadius: 0,\n crop: { top: 0, right: 0, bottom: 0, left: 0 },\n};\n\nexport { DEFAULT_COMPOSITOR_CONFIG, DEFAULT_LAYER_TRANSFORM };\n//# sourceMappingURL=types.js.map\n","/**\n * Typed Event Emitter\n * A type-safe event emitter for StreamCrafter\n */\nclass TypedEventEmitter {\n constructor() {\n this.listeners = new Map();\n }\n /**\n * Subscribe to an event\n */\n on(event, handler) {\n if (!this.listeners.has(event)) {\n this.listeners.set(event, new Set());\n }\n this.listeners.get(event).add(handler);\n // Return unsubscribe function\n return () => this.off(event, handler);\n }\n /**\n * Subscribe to an event (once)\n */\n once(event, handler) {\n const wrappedHandler = (data) => {\n this.off(event, wrappedHandler);\n handler(data);\n };\n return this.on(event, wrappedHandler);\n }\n /**\n * Unsubscribe from an event\n */\n off(event, handler) {\n const handlers = this.listeners.get(event);\n if (handlers) {\n handlers.delete(handler);\n if (handlers.size === 0) {\n this.listeners.delete(event);\n }\n }\n }\n /**\n * Emit an event\n */\n emit(event, data) {\n const handlers = this.listeners.get(event);\n if (handlers) {\n handlers.forEach((handler) => {\n try {\n handler(data);\n }\n catch (error) {\n console.error(`Error in event handler for \"${String(event)}\":`, error);\n }\n });\n }\n }\n /**\n * Remove all listeners for an event (or all events if no event specified)\n */\n removeAllListeners(event) {\n if (event) {\n this.listeners.delete(event);\n }\n else {\n this.listeners.clear();\n }\n }\n /**\n * Get the number of listeners for an event\n */\n listenerCount(event) {\n return this.listeners.get(event)?.size ?? 0;\n }\n}\n\nexport { TypedEventEmitter };\n//# sourceMappingURL=EventEmitter.js.map\n","/**\n * Media Quality Profiles\n * Configurable audio/video processing controls for different use cases\n * Ported from StreamCrafter MediaQualityProfiles.jsx\n */\n/**\n * Get audio constraints for a quality profile\n */\nfunction getAudioConstraints(profile = \"professional\") {\n const profiles = {\n professional: {\n // Raw audio for professional streaming/recording\n echoCancellation: false,\n noiseSuppression: false,\n autoGainControl: false,\n sampleRate: 48000,\n channelCount: 2,\n latency: 0.01,\n },\n broadcast: {\n // Minimal processing for live streaming\n echoCancellation: false,\n noiseSuppression: true, // Light noise suppression only\n autoGainControl: false,\n sampleRate: 48000,\n channelCount: 2,\n latency: 0.02,\n },\n conference: {\n // Optimized for video calls/meetings\n echoCancellation: true,\n noiseSuppression: true,\n autoGainControl: true,\n sampleRate: 44100,\n channelCount: 1, // Mono for bandwidth\n latency: 0.05,\n },\n auto: {\n // Let browser decide (default browser behavior)\n echoCancellation: false,\n noiseSuppression: false,\n autoGainControl: false,\n sampleRate: 48000,\n channelCount: 2,\n },\n };\n return profiles[profile] || profiles.professional;\n}\n/**\n * Get video constraints for a quality profile\n */\nfunction getVideoConstraints(profile = \"professional\") {\n const profiles = {\n professional: {\n // Raw video for professional streaming\n width: { ideal: 1920 },\n height: { ideal: 1080 },\n frameRate: { ideal: 30 },\n },\n broadcast: {\n // Optimized for streaming\n width: { ideal: 1920 },\n height: { ideal: 1080 },\n frameRate: { ideal: 30 },\n },\n conference: {\n // Optimized for video calls\n width: { ideal: 1280 },\n height: { ideal: 720 },\n frameRate: { ideal: 24 },\n },\n auto: {\n // Standard constraints, let browser optimize\n width: { ideal: 1920 },\n height: { ideal: 1080 },\n frameRate: { ideal: 30 },\n },\n };\n return profiles[profile] || profiles.professional;\n}\n/**\n * Get available quality profiles with descriptions\n */\nfunction getAvailableProfiles() {\n return [\n {\n id: \"professional\",\n name: \"Professional\",\n description: \"Raw quality for content creators - disables all browser processing\",\n },\n {\n id: \"broadcast\",\n name: \"Broadcast\",\n description: \"Minimal processing optimized for live streaming\",\n },\n {\n id: \"conference\",\n name: \"Conference\",\n description: \"Full processing for video calls and meetings\",\n },\n {\n id: \"auto\",\n name: \"Auto\",\n description: \"Let browser decide optimal settings\",\n },\n ];\n}\n/**\n * Build full MediaStreamConstraints from a quality profile\n */\nfunction buildMediaConstraints(profile, options) {\n const audioProfile = getAudioConstraints(profile);\n const videoProfile = getVideoConstraints(profile);\n const constraints = {\n audio: {\n echoCancellation: audioProfile.echoCancellation,\n noiseSuppression: audioProfile.noiseSuppression,\n autoGainControl: audioProfile.autoGainControl,\n sampleRate: audioProfile.sampleRate,\n channelCount: audioProfile.channelCount,\n ...(options?.audioDeviceId && { deviceId: { exact: options.audioDeviceId } }),\n },\n video: {\n width: videoProfile.width,\n height: videoProfile.height,\n frameRate: videoProfile.frameRate,\n ...(options?.videoDeviceId && { deviceId: { exact: options.videoDeviceId } }),\n ...(options?.facingMode && { facingMode: options.facingMode }),\n },\n };\n return constraints;\n}\n/**\n * Merge quality profile with custom constraints\n */\nfunction mergeWithCustomConstraints(profile, customConstraints = {}) {\n const baseConstraints = buildMediaConstraints(profile);\n return {\n audio: typeof baseConstraints.audio === \"object\" && typeof customConstraints.audio === \"object\"\n ? { ...baseConstraints.audio, ...customConstraints.audio }\n : (customConstraints.audio ?? baseConstraints.audio),\n video: typeof baseConstraints.video === \"object\" && typeof customConstraints.video === \"object\"\n ? { ...baseConstraints.video, ...customConstraints.video }\n : (customConstraints.video ?? baseConstraints.video),\n };\n}\n/**\n * Get encoder settings for a quality profile\n */\nfunction getEncoderSettings(profile = \"professional\") {\n const settings = {\n professional: {\n video: {\n codec: \"avc1.42E01E\", // H.264 Baseline\n width: 1920,\n height: 1080,\n bitrate: 4000000, // 4 Mbps\n framerate: 30,\n },\n audio: {\n codec: \"opus\",\n sampleRate: 48000,\n numberOfChannels: 2,\n bitrate: 128000, // 128 kbps\n },\n },\n broadcast: {\n video: {\n codec: \"avc1.42E01E\",\n width: 1920,\n height: 1080,\n bitrate: 2500000, // 2.5 Mbps\n framerate: 30,\n },\n audio: {\n codec: \"opus\",\n sampleRate: 48000,\n numberOfChannels: 2,\n bitrate: 128000,\n },\n },\n conference: {\n video: {\n codec: \"avc1.42E01E\",\n width: 1280,\n height: 720,\n bitrate: 1500000, // 1.5 Mbps\n framerate: 24,\n },\n audio: {\n codec: \"opus\",\n sampleRate: 48000,\n numberOfChannels: 2,\n bitrate: 128000, // 128 kbps - same as other profiles\n },\n },\n auto: {\n video: {\n codec: \"avc1.42E01E\",\n width: 1920,\n height: 1080,\n bitrate: 2000000, // 2 Mbps\n framerate: 30,\n },\n audio: {\n codec: \"opus\",\n sampleRate: 48000,\n numberOfChannels: 2,\n bitrate: 128000,\n },\n },\n };\n return settings[profile] || settings.professional;\n}\n\nexport { buildMediaConstraints, getAudioConstraints, getAvailableProfiles, getEncoderSettings, getVideoConstraints, mergeWithCustomConstraints };\n//# sourceMappingURL=MediaConstraints.js.map\n","import { TypedEventEmitter } from './EventEmitter.js';\nimport { buildMediaConstraints } from './MediaConstraints.js';\n\n/**\n * Device Manager\n * Handles camera/microphone enumeration and capture\n */\nclass DeviceManager extends TypedEventEmitter {\n constructor() {\n super();\n this.devices = [];\n this.currentStream = null;\n this.permissionStatus = {\n video: false,\n audio: false,\n };\n this.setupDeviceChangeListener();\n }\n /**\n * Set up listener for device changes\n */\n setupDeviceChangeListener() {\n if (typeof navigator !== \"undefined\" && navigator.mediaDevices) {\n navigator.mediaDevices.addEventListener(\"devicechange\", async () => {\n await this.enumerateDevices();\n this.emit(\"devicesChanged\", { devices: this.devices });\n });\n }\n }\n /**\n * Enumerate all media devices\n */\n async enumerateDevices() {\n if (!navigator.mediaDevices?.enumerateDevices) {\n throw new Error(\"enumerateDevices not supported\");\n }\n const devices = await navigator.mediaDevices.enumerateDevices();\n this.devices = devices\n .filter((d) => d.kind === \"audioinput\" || d.kind === \"videoinput\" || d.kind === \"audiooutput\")\n .map((d) => ({\n deviceId: d.deviceId,\n kind: d.kind,\n label: d.label || `${d.kind} (${d.deviceId.slice(0, 8)}...)`,\n groupId: d.groupId,\n }));\n return this.devices;\n }\n /**\n * Get video input devices (cameras)\n */\n async getVideoInputs() {\n await this.enumerateDevices();\n return this.devices.filter((d) => d.kind === \"videoinput\");\n }\n /**\n * Get audio input devices (microphones)\n */\n async getAudioInputs() {\n await this.enumerateDevices();\n return this.devices.filter((d) => d.kind === \"audioinput\");\n }\n /**\n * Get audio output devices (speakers)\n */\n async getAudioOutputs() {\n await this.enumerateDevices();\n return this.devices.filter((d) => d.kind === \"audiooutput\");\n }\n /**\n * Request permissions for camera and/or microphone\n */\n async requestPermissions(options = { video: true, audio: true }) {\n try {\n // Request a temporary stream to trigger permission prompts\n const stream = await navigator.mediaDevices.getUserMedia({\n video: options.video,\n audio: options.audio,\n });\n // Stop all tracks immediately\n stream.getTracks().forEach((track) => track.stop());\n // Update permission status\n if (options.video)\n this.permissionStatus.video = true;\n if (options.audio)\n this.permissionStatus.audio = true;\n // Re-enumerate devices to get labels\n await this.enumerateDevices();\n this.emit(\"permissionChanged\", {\n granted: true,\n denied: false,\n });\n return this.permissionStatus;\n }\n catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n if (err.name === \"NotAllowedError\" || err.name === \"PermissionDeniedError\") {\n this.emit(\"permissionChanged\", {\n granted: false,\n denied: true,\n });\n }\n this.emit(\"error\", {\n message: `Permission request failed: ${err.message}`,\n error: err,\n });\n throw error;\n }\n }\n /**\n * Check if permissions are granted\n */\n hasPermission(kind) {\n return this.permissionStatus[kind];\n }\n /**\n * Get user media with quality profile\n */\n async getUserMedia(options = {}) {\n const profile = options.profile || \"professional\";\n let constraints;\n if (options.customConstraints) {\n constraints = options.customConstraints;\n }\n else {\n constraints = buildMediaConstraints(profile, {\n videoDeviceId: options.videoDeviceId,\n audioDeviceId: options.audioDeviceId,\n facingMode: options.facingMode,\n });\n }\n try {\n // Try with all constraints first\n const stream = await navigator.mediaDevices.getUserMedia(constraints);\n this.currentStream = stream;\n // Update permission status\n if (stream.getVideoTracks().length > 0)\n this.permissionStatus.video = true;\n if (stream.getAudioTracks().length > 0)\n this.permissionStatus.audio = true;\n return stream;\n }\n catch (error) {\n // Fallback: try without specific device constraints\n const err = error instanceof Error ? error : new Error(String(error));\n if (err.name === \"OverconstrainedError\") {\n // Try with relaxed constraints\n const relaxedConstraints = {\n video: constraints.video ? true : false,\n audio: constraints.audio ? true : false,\n };\n const stream = await navigator.mediaDevices.getUserMedia(relaxedConstraints);\n this.currentStream = stream;\n return stream;\n }\n this.emit(\"error\", {\n message: `getUserMedia failed: ${err.message}`,\n error: err,\n });\n throw error;\n }\n }\n /**\n * Get current stream\n */\n getStream() {\n return this.currentStream;\n }\n /**\n * Stop all tracks on current stream\n */\n stopAllTracks() {\n if (this.currentStream) {\n this.currentStream.getTracks().forEach((track) => {\n track.stop();\n });\n this.currentStream = null;\n }\n }\n /**\n * Replace video track in current stream\n */\n async replaceVideoTrack(deviceId, profile = \"professional\") {\n if (!this.currentStream) {\n throw new Error(\"No active stream to replace track in\");\n }\n // Stop current video track\n const currentVideoTrack = this.currentStream.getVideoTracks()[0];\n if (currentVideoTrack) {\n currentVideoTrack.stop();\n this.currentStream.removeTrack(currentVideoTrack);\n }\n // Get new video track\n const constraints = buildMediaConstraints(profile, { videoDeviceId: deviceId });\n const newStream = await navigator.mediaDevices.getUserMedia({\n video: constraints.video,\n audio: false,\n });\n const newTrack = newStream.getVideoTracks()[0];\n if (newTrack) {\n this.currentStream.addTrack(newTrack);\n }\n return newTrack || null;\n }\n /**\n * Replace audio track in current stream\n */\n async replaceAudioTrack(deviceId, profile = \"professional\") {\n if (!this.currentStream) {\n throw new Error(\"No active stream to replace track in\");\n }\n // Stop current audio track\n const currentAudioTrack = this.currentStream.getAudioTracks()[0];\n if (currentAudioTrack) {\n currentAudioTrack.stop();\n this.currentStream.removeTrack(currentAudioTrack);\n }\n // Get new audio track\n const constraints = buildMediaConstraints(profile, { audioDeviceId: deviceId });\n const newStream = await navigator.mediaDevices.getUserMedia({\n video: false,\n audio: constraints.audio,\n });\n const newTrack = newStream.getAudioTracks()[0];\n if (newTrack) {\n this.currentStream.addTrack(newTrack);\n }\n return newTrack || null;\n }\n /**\n * Get all cached devices\n */\n getAllDevices() {\n return [...this.devices];\n }\n /**\n * Clean up resources\n */\n destroy() {\n this.stopAllTracks();\n this.removeAllListeners();\n }\n}\n\nexport { DeviceManager };\n//# sourceMappingURL=DeviceManager.js.map\n","import { TypedEventEmitter } from './EventEmitter.js';\n\n/**\n * Screen Capture\n * Wrapper for getDisplayMedia with proper error handling\n * Supports multiple simultaneous screen captures\n */\nclass ScreenCapture extends TypedEventEmitter {\n constructor() {\n super(...arguments);\n this.captures = new Map();\n this.captureCounter = 0;\n }\n /**\n * Start a new screen capture\n * Each call creates a new capture - supports multiple simultaneous captures\n */\n async start(options = {}) {\n try {\n // Build video constraints with higher framerate for smooth screen share\n let videoConstraints;\n if (options.video === false) {\n videoConstraints = false;\n }\n else if (typeof options.video === \"object\") {\n // Use custom video constraints if provided as object, merged with defaults\n const customVideo = options.video;\n videoConstraints = {\n // Default values\n frameRate: { ideal: 30, max: 60 },\n width: { ideal: 1920 },\n height: { ideal: 1080 },\n // Merge custom constraints (overrides defaults)\n ...customVideo,\n // Always add cursor if specified\n ...(options.cursor !== undefined ? { cursor: options.cursor } : {}),\n };\n }\n else {\n // Default constraints\n videoConstraints = {\n // Request high framerate for smooth screen capture\n frameRate: { ideal: 30, max: 60 },\n // Request good resolution - let browser pick best for display\n width: { ideal: 1920 },\n height: { ideal: 1080 },\n // Prefer motion over sharpness when encoding is under pressure\n ...(options.cursor !== undefined ? { cursor: options.cursor } : {}),\n };\n }\n const constraints = {\n video: videoConstraints,\n audio: options.audio ?? false,\n };\n // Add preferCurrentTab if supported and requested\n if (options.preferCurrentTab && \"preferCurrentTab\" in constraints) {\n constraints.preferCurrentTab = true;\n }\n // Add surfaceSwitching if requested (Chrome 107+)\n if (options.surfaceSwitching) {\n constraints.surfaceSwitching = \"include\";\n }\n // Add selfBrowserSurface if requested (Chrome 107+)\n if (options.selfBrowserSurface !== undefined) {\n constraints.selfBrowserSurface = options.selfBrowserSurface;\n }\n // Add monitorTypeSurfaces if requested (Chrome 119+)\n if (options.monitorTypeSurfaces) {\n constraints.monitorTypeSurfaces = options.monitorTypeSurfaces;\n }\n // Add system audio preference if supported\n if (options.systemAudio && constraints.audio) {\n if (typeof constraints.audio === \"object\") {\n constraints.audio.systemAudio = options.systemAudio;\n }\n }\n const stream = await navigator.mediaDevices.getDisplayMedia(constraints);\n // Generate a unique ID for this capture\n const captureId = `screen-${++this.captureCounter}-${Date.now()}`;\n // Get a label for this capture from the video track\n const videoTrack = stream.getVideoTracks()[0];\n const label = videoTrack?.label || `Screen ${this.captureCounter}`;\n // Store the capture\n this.captures.set(captureId, { stream, label });\n // Listen for track ended events (user stopped sharing)\n stream.getTracks().forEach((track) => {\n track.addEventListener(\"ended\", () => {\n this.handleTrackEnded(captureId, stream);\n });\n });\n this.emit(\"started\", { stream, captureId });\n return stream;\n }\n catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n // User cancelled is not an error\n if (err.name === \"AbortError\" || err.name === \"NotAllowedError\") {\n this.emit(\"ended\", { captureId: \"\", stream: null, reason: \"cancelled\" });\n return null;\n }\n this.emit(\"error\", {\n message: `Screen capture failed: ${err.message}`,\n error: err,\n });\n throw error;\n }\n }\n /**\n * Handle track ended event\n */\n handleTrackEnded(captureId, stream) {\n // Check if all tracks have ended\n const activeTracks = stream.getTracks().filter((t) => t.readyState === \"live\");\n if (activeTracks.length === 0) {\n this.captures.delete(captureId);\n this.emit(\"ended\", { captureId, stream, reason: \"user_stopped\" });\n }\n }\n /**\n * Stop a specific screen capture by its stream\n */\n stopByStream(stream) {\n for (const [captureId, info] of this.captures) {\n if (info.stream === stream) {\n info.stream.getTracks().forEach((track) => track.stop());\n this.captures.delete(captureId);\n this.emit(\"ended\", { captureId, stream, reason: \"stopped\" });\n return;\n }\n }\n }\n /**\n * Stop all screen captures\n */\n stop() {\n for (const [captureId, info] of this.captures) {\n info.stream.getTracks().forEach((track) => track.stop());\n this.emit(\"ended\", { captureId, stream: info.stream, reason: \"stopped\" });\n }\n this.captures.clear();\n }\n /**\n * Get all active captures\n */\n getCaptures() {\n return Array.from(this.captures.entries()).map(([captureId, info]) => ({\n captureId,\n stream: info.stream,\n label: info.label,\n }));\n }\n /**\n * Check if any screen capture is active\n */\n isActive() {\n return this.captures.size > 0;\n }\n /**\n * Get the count of active captures\n */\n getCaptureCount() {\n return this.captures.size;\n }\n // Legacy methods for backwards compatibility (use first capture)\n /**\n * Get current stream (first capture for backwards compatibility)\n * @deprecated Use getCaptures() instead\n */\n getStream() {\n const first = this.captures.values().next().value;\n return first?.stream ?? null;\n }\n /**\n * Get video track (first capture for backwards compatibility)\n * @deprecated Use getCaptures() instead\n */\n getVideoTrack() {\n const stream = this.getStream();\n return stream?.getVideoTracks()[0] ?? null;\n }\n /**\n * Get audio track (first capture for backwards compatibility)\n * @deprecated Use getCaptures() instead\n */\n getAudioTrack() {\n const stream = this.getStream();\n return stream?.getAudioTracks()[0] ?? null;\n }\n /**\n * Check if system audio is being captured\n */\n hasAudio() {\n for (const [, info] of this.captures) {\n if (info.stream.getAudioTracks().length > 0) {\n return true;\n }\n }\n return false;\n }\n /**\n * Clean up resources\n */\n destroy() {\n this.stop();\n this.removeAllListeners();\n }\n}\n\nexport { ScreenCapture };\n//# sourceMappingURL=ScreenCapture.js.map\n","import { TypedEventEmitter } from './EventEmitter.js';\n\n/**\n * WHIP Client\n * WebRTC-HTTP Ingestion Protocol client for streaming\n * Ported from StreamCrafter useWhipStreaming.js\n */\nclass WhipClient extends TypedEventEmitter {\n constructor(config) {\n super();\n this.peerConnection = null;\n this.videoTrackGenerator = null;\n this.audioTrackGenerator = null;\n this.state = \"disconnected\";\n // Writer management to prevent locking issues\n this.videoWriter = null;\n this.audioWriter = null;\n this.videoWriteQueue = [];\n this.audioWriteQueue = [];\n this.isProcessingVideoQueue = false;\n this.isProcessingAudioQueue = false;\n // RTCRtpScriptTransform workers for WebCodecs integration\n this.videoTransformWorker = null;\n this.audioTransformWorker = null;\n this.encoderListenerCleanup = null;\n // Negotiated codecs (populated after connection)\n this.negotiatedVideoCodec = null;\n this.negotiatedAudioCodec = null;\n // WHIP resource URL returned in Location header (for DELETE on disconnect)\n this.resourceUrl = null;\n this.config = config;\n }\n /**\n * Debug logging helper\n */\n log(message, data) {\n if (this.config.debug) {\n console.log(`[WHIP] ${message}`, data ?? \"\");\n }\n }\n /**\n * Error logging helper\n */\n logError(message, error) {\n console.error(`[WHIP ERROR] ${message}`, error ?? \"\");\n this.emit(\"error\", { message, error });\n }\n /**\n * Update connection state\n */\n setState(newState) {\n const previousState = this.state;\n this.state = newState;\n this.emit(\"stateChange\", { state: newState, previousState });\n }\n // ==========================================================================\n // Codec alignment for WebCodecs path\n // ==========================================================================\n /**\n * Set codec preferences on transceivers before creating offer.\n * Prefers VP9 (royalty-free, better compression) then H264 for video.\n * Prefers Opus for audio.\n */\n preferCodecs(pc) {\n const transceivers = pc.getTransceivers();\n for (const transceiver of transceivers) {\n if (!transceiver.setCodecPreferences) {\n continue;\n }\n const trackKind = transceiver.sender.track?.kind;\n if (trackKind === \"video\") {\n const capabilities = RTCRtpSender.getCapabilities(\"video\");\n if (!capabilities?.codecs)\n continue;\n // Filter to VP9 and H264, preferring VP9\n const preferred = capabilities.codecs\n .filter((c) => c.mimeType === \"video/VP9\" || c.mimeType === \"video/H264\")\n .sort((a, b) => {\n // VP9 first, then H264\n if (a.mimeType === \"video/VP9\" && b.mimeType !== \"video/VP9\")\n return -1;\n if (a.mimeType !== \"video/VP9\" && b.mimeType === \"video/VP9\")\n return 1;\n return 0;\n });\n if (preferred.length > 0) {\n try {\n transceiver.setCodecPreferences(preferred);\n this.log(\"Set video codec preferences\", preferred.map((c) => c.mimeType));\n }\n catch (err) {\n this.log(\"Failed to set video codec preferences\", err);\n }\n }\n }\n if (trackKind === \"audio\") {\n const capabilities = RTCRtpSender.getCapabilities(\"audio\");\n if (!capabilities?.codecs)\n continue;\n // Filter to Opus only\n const preferred = capabilities.codecs.filter((c) => c.mimeType === \"audio/opus\");\n if (preferred.length > 0) {\n try {\n transceiver.setCodecPreferences(preferred);\n this.log(\"Set audio codec preferences\", preferred.map((c) => c.mimeType));\n }\n catch (err) {\n this.log(\"Failed to set audio codec preferences\", err);\n }\n }\n }\n }\n }\n /**\n * Verify negotiated codecs after connection.\n * Populates negotiatedVideoCodec and negotiatedAudioCodec.\n */\n verifyCodecAlignment() {\n if (!this.peerConnection)\n return;\n const senders = this.peerConnection.getSenders();\n for (const sender of senders) {\n const params = sender.getParameters();\n const codec = params.codecs?.[0];\n if (sender.track?.kind === \"video\" && codec?.mimeType) {\n this.negotiatedVideoCodec = codec.mimeType;\n this.log(\"Negotiated video codec\", codec.mimeType);\n }\n if (sender.track?.kind === \"audio\" && codec?.mimeType) {\n this.negotiatedAudioCodec = codec.mimeType;\n this.log(\"Negotiated audio codec\", codec.mimeType);\n }\n }\n }\n /**\n * Check if encoded frame insertion is safe.\n * Returns true if negotiated codecs are compatible with WebCodecs output.\n *\n * For WebCodecs insertion to work correctly:\n * - Video must be VP9 or H264 (what WebCodecs can produce)\n * - Audio must be Opus (what WebCodecs can produce)\n */\n canUseEncodedInsertion() {\n // Must have a connection\n if (!this.peerConnection || this.state !== \"connected\") {\n this.log(\"canUseEncodedInsertion: no connection\", {\n hasPC: !!this.peerConnection,\n state: this.state,\n });\n return false;\n }\n // Must have RTCRtpScriptTransform support\n if (typeof RTCRtpScriptTransform === \"undefined\") {\n this.log(\"canUseEncodedInsertion: RTCRtpScriptTransform not supported\");\n return false;\n }\n // Must have senders with transform support\n const senders = this.peerConnection.getSenders();\n const hasTransformSupport = senders.some((s) => \"transform\" in s);\n if (!hasTransformSupport) {\n this.log(\"Sender transform not supported\");\n return false;\n }\n // Check video codec alignment\n if (this.negotiatedVideoCodec) {\n const videoOk = this.negotiatedVideoCodec === \"video/VP9\" || this.negotiatedVideoCodec === \"video/H264\";\n if (!videoOk) {\n this.log(\"Video codec not compatible with WebCodecs\", this.negotiatedVideoCodec);\n return false;\n }\n }\n // Check audio codec alignment\n if (this.negotiatedAudioCodec) {\n const audioOk = this.negotiatedAudioCodec === \"audio/opus\";\n if (!audioOk) {\n this.log(\"Audio codec not compatible with WebCodecs\", this.negotiatedAudioCodec);\n return false;\n }\n }\n return true;\n }\n /**\n * Get the negotiated video codec MIME type.\n */\n getNegotiatedVideoCodec() {\n return this.negotiatedVideoCodec;\n }\n /**\n * Get the negotiated audio codec MIME type.\n */\n getNegotiatedAudioCodec() {\n return this.negotiatedAudioCodec;\n }\n /**\n * Check if connected.\n */\n get isConnected() {\n return this.state === \"connected\";\n }\n /**\n * Connect to WHIP endpoint with a MediaStream\n */\n async connect(stream) {\n try {\n this.log(\"Starting WHIP connection\");\n this.setState(\"connecting\");\n if (!this.config.whipUrl) {\n throw new Error(\"WHIP URL is required\");\n }\n // Create RTCPeerConnection\n const pcConfig = {\n iceServers: this.config.iceServers || [],\n };\n this.log(\"Creating RTCPeerConnection\", pcConfig);\n const pc = new RTCPeerConnection(pcConfig);\n // Set up connection state monitoring\n pc.onconnectionstatechange = () => {\n const state = pc.connectionState;\n this.log(`Connection state changed: ${state}`);\n switch (state) {\n case \"connected\":\n this.log(\"WHIP streaming connected successfully\");\n this.setState(\"connected\");\n break;\n case \"disconnected\":\n this.setState(\"disconnected\");\n break;\n case \"failed\":\n this.setState(\"failed\");\n break;\n case \"closed\":\n this.setState(\"closed\");\n break;\n }\n };\n pc.oniceconnectionstatechange = () => {\n this.log(`ICE connection state: ${pc.iceConnectionState}`);\n };\n pc.onicegatheringstatechange = () => {\n this.log(`ICE gathering state: ${pc.iceGatheringState}`);\n };\n pc.onicecandidate = (event) => {\n this.emit(\"iceCandidate\", { candidate: event.candidate });\n if (event.candidate) {\n this.log(\"ICE candidate generated\", event.candidate.candidate);\n }\n else {\n this.log(\"ICE candidate gathering complete\");\n }\n };\n // Add tracks from the stream\n this.log(\"Adding tracks to peer connection\");\n stream.getTracks().forEach((track, index) => {\n this.log(`Adding ${track.kind} track ${index}`, {\n id: track.id,\n kind: track.kind,\n enabled: track.enabled,\n readyState: track.readyState,\n });\n pc.addTrack(track, stream);\n });\n this.peerConnection = pc;\n // Set codec preferences before creating offer (for WebCodecs alignment)\n this.preferCodecs(pc);\n // Create and set local description\n this.log(\"Creating offer\");\n const offer = await pc.createOffer({\n offerToReceiveAudio: false,\n offerToReceiveVideo: false,\n });\n this.log(\"Setting local description\");\n await pc.setLocalDescription(offer);\n this.log(\"Local SDP offer created\", {\n type: offer.type,\n sdpLength: offer.sdp?.length,\n });\n // Send offer to WHIP endpoint\n this.log(`Sending offer to WHIP endpoint: ${this.config.whipUrl}`);\n const response = await fetch(this.config.whipUrl, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/sdp\",\n Accept: \"application/sdp\",\n },\n body: offer.sdp,\n });\n this.log(`WHIP response status: ${response.status} ${response.statusText}`);\n if (!response.ok) {\n const errorText = await response.text().catch(() => \"Unknown error\");\n throw new Error(`WHIP request failed: ${response.status} ${response.statusText} - ${errorText}`);\n }\n // Store WHIP resource URL from Location header (per RFC 9725)\n // This URL is used for DELETE on disconnect\n this.resourceUrl = response.headers.get(\"Location\");\n if (this.resourceUrl) {\n this.log(\"WHIP resource URL:\", this.resourceUrl);\n }\n // Get and set remote description\n const answerSdp = await response.text();\n this.log(\"Received SDP answer\", {\n length: answerSdp.length,\n });\n await pc.setRemoteDescription({\n type: \"answer\",\n sdp: answerSdp,\n });\n this.log(\"Remote description set successfully\");\n // Verify negotiated codecs for WebCodecs alignment\n this.verifyCodecAlignment();\n this.log(\"WHIP connection established, waiting for ICE connection...\");\n }\n catch (error) {\n this.logError(\"Failed to connect\", error instanceof Error ? error : new Error(String(error)));\n this.setState(\"failed\");\n this.cleanup();\n throw error;\n }\n }\n /**\n * Connect using MediaStreamTrackGenerators (for WebCodecs path)\n */\n async connectWithGenerators() {\n try {\n this.log(\"Starting WHIP connection with track generators\");\n this.setState(\"connecting\");\n if (!this.config.whipUrl) {\n throw new Error(\"WHIP URL is required\");\n }\n // Create track generators\n this.log(\"Creating MediaStreamTrackGenerators\");\n const videoGenerator = new MediaStreamTrackGenerator({ kind: \"video\" });\n const audioGenerator = new MediaStreamTrackGenerator({ kind: \"audio\" });\n this.videoTrackGenerator = videoGenerator;\n this.audioTrackGenerator = audioGenerator;\n this.log(\"Track generators created successfully\");\n // Create RTCPeerConnection\n const pcConfig = {\n iceServers: this.config.iceServers || [],\n };\n this.log(\"Creating RTCPeerConnection\", pcConfig);\n const pc = new RTCPeerConnection(pcConfig);\n // Set up connection state monitoring\n pc.onconnectionstatechange = () => {\n const state = pc.connectionState;\n this.log(`Connection state changed: ${state}`);\n switch (state) {\n case \"connected\":\n this.log(\"WHIP streaming connected successfully\");\n this.setState(\"connected\");\n break;\n case \"disconnected\":\n this.setState(\"disconnected\");\n break;\n case \"failed\":\n this.setState(\"failed\");\n break;\n case \"closed\":\n this.setState(\"closed\");\n break;\n }\n };\n pc.oniceconnectionstatechange = () => {\n this.log(`ICE connection state: ${pc.iceConnectionState}`);\n };\n pc.onicegatheringstatechange = () => {\n this.log(`ICE gathering state: ${pc.iceGatheringState}`);\n };\n pc.onicecandidate = (event) => {\n this.emit(\"iceCandidate\", { candidate: event.candidate });\n if (event.candidate) {\n this.log(\"ICE candidate generated\", event.candidate.candidate);\n }\n else {\n this.log(\"ICE candidate gathering complete\");\n }\n };\n // Add tracks to peer connection\n const mediaStream = new MediaStream([videoGenerator, audioGenerator]);\n this.log(\"Adding tracks to peer connection\");\n mediaStream.getTracks().forEach((track, index) => {\n this.log(`Adding ${track.kind} track ${index}`, {\n id: track.id,\n kind: track.kind,\n enabled: track.enabled,\n readyState: track.readyState,\n });\n pc.addTrack(track, mediaStream);\n });\n this.peerConnection = pc;\n // Set codec preferences before creating offer\n this.preferCodecs(pc);\n // Create and set local description\n this.log(\"Creating offer\");\n const offer = await pc.createOffer({\n offerToReceiveAudio: false,\n offerToReceiveVideo: false,\n });\n this.log(\"Setting local description\");\n await pc.setLocalDescription(offer);\n // Send offer to WHIP endpoint\n this.log(`Sending offer to WHIP endpoint: ${this.config.whipUrl}`);\n const response = await fetch(this.config.whipUrl, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/sdp\",\n Accept: \"application/sdp\",\n },\n body: offer.sdp,\n });\n this.log(`WHIP response status: ${response.status} ${response.statusText}`);\n if (!response.ok) {\n const errorText = await response.text().catch(() => \"Unknown error\");\n throw new Error(`WHIP request failed: ${response.status} ${response.statusText} - ${errorText}`);\n }\n // Store WHIP resource URL from Location header (per RFC 9725)\n // This URL is used for DELETE on disconnect\n this.resourceUrl = response.headers.get(\"Location\");\n if (this.resourceUrl) {\n this.log(\"WHIP resource URL:\", this.resourceUrl);\n }\n // Get and set remote description\n const answerSdp = await response.text();\n this.log(\"Received SDP answer\", { length: answerSdp.length });\n await pc.setRemoteDescription({\n type: \"answer\",\n sdp: answerSdp,\n });\n this.log(\"Remote description set successfully\");\n // Verify negotiated codecs\n this.verifyCodecAlignment();\n this.log(\"WHIP connection established with generators\");\n return { videoGenerator, audioGenerator };\n }\n catch (error) {\n this.logError(\"Failed to connect with generators\", error instanceof Error ? error : new Error(String(error)));\n this.setState(\"failed\");\n this.cleanup();\n throw error;\n }\n }\n /**\n * Process video write queue\n */\n async processVideoQueue() {\n if (this.isProcessingVideoQueue || this.videoWriteQueue.length === 0) {\n return;\n }\n this.isProcessingVideoQueue = true;\n try {\n while (this.videoWriteQueue.length > 0) {\n const item = this.videoWriteQueue.shift();\n if (!item)\n continue;\n const { frame, resolve, reject } = item;\n if (!this.videoTrackGenerator) {\n reject(new Error(\"Video track generator not available\"));\n continue;\n }\n try {\n if (!this.videoWriter) {\n this.videoWriter = this.videoTrackGenerator.writable.getWriter();\n }\n await this.videoWriter.write(frame);\n resolve(true);\n }\n catch (error) {\n // Release writer on error and try to recreate\n if (this.videoWriter) {\n try {\n this.videoWriter.releaseLock();\n }\n catch {\n // Ignore release errors\n }\n this.videoWriter = null;\n }\n reject(error instanceof Error ? error : new Error(String(error)));\n }\n }\n }\n finally {\n this.isProcessingVideoQueue = false;\n }\n }\n /**\n * Process audio write queue\n */\n async processAudioQueue() {\n if (this.isProcessingAudioQueue || this.audioWriteQueue.length === 0) {\n return;\n }\n this.isProcessingAudioQueue = true;\n try {\n while (this.audioWriteQueue.length > 0) {\n const item = this.audioWriteQueue.shift();\n if (!item)\n continue;\n const { audioData, resolve, reject } = item;\n if (!this.audioTrackGenerator) {\n reject(new Error(\"Audio track generator not available\"));\n continue;\n }\n try {\n if (!this.audioWriter) {\n this.audioWriter = this.audioTrackGenerator.writable.getWriter();\n }\n await this.audioWriter.write(audioData);\n resolve(true);\n }\n catch (error) {\n // Release writer on error and try to recreate\n if (this.audioWriter) {\n try {\n this.audioWriter.releaseLock();\n }\n catch {\n // Ignore release errors\n }\n this.audioWriter = null;\n }\n reject(error instanceof Error ? error : new Error(String(error)));\n }\n }\n }\n finally {\n this.isProcessingAudioQueue = false;\n }\n }\n /**\n * Send video frame to WHIP stream (queued)\n */\n async sendVideoFrame(frame) {\n if (!this.videoTrackGenerator) {\n if (frame) {\n try {\n frame.close();\n }\n catch {\n /* ignore */\n }\n }\n return false;\n }\n return new Promise((resolve, reject) => {\n this.videoWriteQueue.push({ frame, resolve, reject });\n this.processVideoQueue();\n });\n }\n /**\n * Send audio data to WHIP stream (queued)\n */\n async sendAudioData(audioData) {\n if (!this.audioTrackGenerator) {\n if (audioData) {\n try {\n audioData.close();\n }\n catch {\n /* ignore */\n }\n }\n return false;\n }\n return new Promise((resolve, reject) => {\n this.audioWriteQueue.push({ audioData, resolve, reject });\n this.processAudioQueue();\n });\n }\n /**\n * Replace a track in the peer connection\n */\n async replaceTrack(oldTrack, newTrack) {\n if (!this.peerConnection) {\n throw new Error(\"No peer connection\");\n }\n const sender = this.peerConnection.getSenders().find((s) => s.track?.kind === oldTrack.kind);\n if (!sender) {\n throw new Error(`No sender found for ${oldTrack.kind} track`);\n }\n await sender.replaceTrack(newTrack);\n this.log(`Replaced ${oldTrack.kind} track`);\n }\n /**\n * Add a track to the peer connection\n */\n async addTrack(track, stream) {\n if (!this.peerConnection) {\n throw new Error(\"No peer connection\");\n }\n this.peerConnection.addTrack(track, stream || new MediaStream([track]));\n this.log(`Added ${track.kind} track`);\n }\n /**\n * Get connection statistics\n */\n async getStats() {\n if (!this.peerConnection) {\n return null;\n }\n try {\n return await this.peerConnection.getStats();\n }\n catch (error) {\n this.logError(\"Failed to get connection stats\", error instanceof Error ? error : new Error(String(error)));\n return null;\n }\n }\n /**\n * Get current connection state\n */\n getState() {\n return this.state;\n }\n /**\n * Get peer connection\n */\n getPeerConnection() {\n return this.peerConnection;\n }\n /**\n * Attach RTCRtpScriptTransform to inject WebCodecs-encoded chunks\n *\n * This method creates transform workers and attaches them to the RTP senders,\n * allowing us to replace browser-encoded frames with our WebCodecs-encoded chunks.\n *\n * @param encoderManager - The EncoderManager that produces encoded chunks\n * @param workerUrl - Optional URL to the rtcTransform worker (for bundled usage)\n */\n attachEncoderTransform(encoderManager, workerUrl) {\n if (!this.peerConnection) {\n throw new Error(\"No peer connection - call connect() first\");\n }\n // Check for RTCRtpScriptTransform support\n if (typeof RTCRtpScriptTransform === \"undefined\") {\n this.log(\"RTCRtpScriptTransform not supported, skipping encoder transform\");\n return;\n }\n this.log(\"Attaching encoder transform\");\n // Create transform workers using inlined worker bundle\n const createWorker = () => {\n // Custom worker URL takes precedence (for consumers who bundle separately)\n if (workerUrl) {\n return new Worker(workerUrl, { type: \"module\" });\n }\n // Preferred: load packaged worker relative to the built module URL.\n try {\n const packagedUrl = new URL(\"../workers/rtcTransform.worker.js\", import.meta.url);\n return new Worker(packagedUrl, { type: \"module\" });\n }\n catch (err) {\n this.log(\"Packaged worker URL failed, trying fallback paths\", err);\n }\n const fallbackPaths = [\n \"/workers/rtcTransform.worker.js\",\n \"./workers/rtcTransform.worker.js\",\n \"/node_modules/@livepeer-frameworks/streamcrafter-core/dist/workers/rtcTransform.worker.js\",\n ];\n for (const path of fallbackPaths) {\n try {\n return new Worker(path, { type: \"module\" });\n }\n catch {\n try {\n return new Worker(path);\n }\n catch {\n // Continue\n }\n }\n }\n return null;\n };\n // Get senders\n const senders = this.peerConnection.getSenders();\n const videoSender = senders.find((s) => s.track?.kind === \"video\");\n const audioSender = senders.find((s) => s.track?.kind === \"audio\");\n // Attach video transform\n if (videoSender && \"transform\" in videoSender) {\n this.log(\"Creating video transform worker\");\n this.videoTransformWorker = createWorker();\n if (this.videoTransformWorker) {\n // Configure worker\n this.videoTransformWorker.postMessage({\n type: \"configure\",\n config: {\n debug: this.config.debug,\n maxQueueSize: 30, // ~1 second at 30fps\n },\n });\n // Attach transform to sender\n // RTCRtpScriptTransform options are passed to worker via rtctransform event\n videoSender.transform =\n new RTCRtpScriptTransform(this.videoTransformWorker, { kind: \"video\" });\n this.log(\"Video transform attached\");\n }\n else {\n this.logError(\"Failed to create video transform worker\");\n }\n }\n // Attach audio transform\n if (audioSender && \"transform\" in audioSender) {\n this.log(\"Creating audio transform worker\");\n this.audioTransformWorker = createWorker();\n if (this.audioTransformWorker) {\n // Configure worker\n this.audioTransformWorker.postMessage({\n type: \"configure\",\n config: {\n debug: this.config.debug,\n maxQueueSize: 50, // Audio packets are smaller/more frequent\n },\n });\n // Attach transform to sender\n audioSender.transform =\n new RTCRtpScriptTransform(this.audioTransformWorker, { kind: \"audio\" });\n this.log(\"Audio transform attached\");\n }\n else {\n this.logError(\"Failed to create audio transform worker\");\n }\n }\n // Forward encoded chunks from encoder to transform workers\n const handleVideoChunk = (chunk) => {\n if (this.videoTransformWorker) {\n this.videoTransformWorker.postMessage({ type: \"videoChunk\", data: chunk }, [chunk.data] // Transfer ArrayBuffer ownership\n );\n }\n };\n const handleAudioChunk = (chunk) => {\n if (this.audioTransformWorker) {\n this.audioTransformWorker.postMessage({ type: \"audioChunk\", data: chunk }, [chunk.data] // Transfer ArrayBuffer ownership\n );\n }\n };\n // Subscribe to encoder events\n encoderManager.on(\"videoChunk\", handleVideoChunk);\n encoderManager.on(\"audioChunk\", handleAudioChunk);\n // Store cleanup function\n this.encoderListenerCleanup = () => {\n encoderManager.off(\"videoChunk\", handleVideoChunk);\n encoderManager.off(\"audioChunk\", handleAudioChunk);\n };\n this.log(\"Encoder transform attached successfully\");\n }\n /**\n * Check if encoder transform is attached\n */\n hasEncoderTransform() {\n return this.videoTransformWorker !== null || this.audioTransformWorker !== null;\n }\n /**\n * Detach encoder transform and stop workers\n */\n detachEncoderTransform() {\n // Clean up encoder event listeners\n if (this.encoderListenerCleanup) {\n this.encoderListenerCleanup();\n this.encoderListenerCleanup = null;\n }\n // Stop video transform worker\n if (this.videoTransformWorker) {\n this.videoTransformWorker.postMessage({ type: \"stop\" });\n this.videoTransformWorker.terminate();\n this.videoTransformWorker = null;\n }\n // Stop audio transform worker\n if (this.audioTransformWorker) {\n this.audioTransformWorker.postMessage({ type: \"stop\" });\n this.audioTransformWorker.terminate();\n this.audioTransformWorker = null;\n }\n this.log(\"Encoder transform detached\");\n }\n /**\n * Clean up writers\n */\n cleanupWriters() {\n if (this.videoWriter) {\n try {\n this.videoWriter.releaseLock();\n }\n catch {\n // Ignore\n }\n this.videoWriter = null;\n }\n if (this.audioWriter) {\n try {\n this.audioWriter.releaseLock();\n }\n catch {\n // Ignore\n }\n this.audioWriter = null;\n }\n this.videoWriteQueue = [];\n this.audioWriteQueue = [];\n this.isProcessingVideoQueue = false;\n this.isProcessingAudioQueue = false;\n }\n /**\n * Clean up resources\n */\n cleanup() {\n this.cleanupWriters();\n this.detachEncoderTransform();\n if (this.videoTrackGenerator) {\n this.videoTrackGenerator.stop();\n this.videoTrackGenerator = null;\n }\n if (this.audioTrackGenerator) {\n this.audioTrackGenerator.stop();\n this.audioTrackGenerator = null;\n }\n if (this.peerConnection) {\n this.peerConnection.close();\n this.peerConnection = null;\n }\n // Clear resource URL (note: DELETE should be sent before cleanup if needed)\n this.resourceUrl = null;\n }\n /**\n * Disconnect from WHIP endpoint\n */\n async disconnect() {\n this.log(\"Disconnecting WHIP\");\n // Send DELETE to WHIP resource URL per RFC 9725\n if (this.resourceUrl) {\n try {\n this.log(\"Sending DELETE to WHIP resource:\", this.resourceUrl);\n await fetch(this.resourceUrl, { method: \"DELETE\" });\n }\n catch (error) {\n // Don't block disconnect on DELETE failure\n this.log(\"Failed to delete WHIP resource (non-fatal)\", error);\n }\n this.resourceUrl = null;\n }\n this.cleanup();\n this.setState(\"disconnected\");\n }\n /**\n * Destroy the client\n */\n destroy() {\n this.cleanup();\n this.removeAllListeners();\n }\n}\n\nexport { WhipClient };\n//# sourceMappingURL=WhipClient.js.map\n","import { TypedEventEmitter } from './EventEmitter.js';\n\n/**\n * Audio Mixer\n * Combines multiple audio tracks using Web Audio API\n * Supports per-source volume control, muting, and panning\n */\nclass AudioMixer extends TypedEventEmitter {\n constructor(config = {}) {\n super();\n this.audioContext = null;\n this.destination = null;\n this.masterGain = null;\n this.compressor = null;\n this.limiter = null;\n this.analyzer = null;\n this.sources = new Map();\n this.outputStream = null;\n this.levelMonitoringActive = false;\n this.peakLevel = 0;\n this.peakDecayRate = 0.95; // Peak meter decay\n this.config = {\n sampleRate: config.sampleRate ?? 48000,\n channelCount: config.channelCount ?? 2,\n };\n }\n /**\n * Initialize the audio mixer\n */\n async initialize() {\n if (this.audioContext) {\n return; // Already initialized\n }\n try {\n this.audioContext = new AudioContext({\n sampleRate: this.config.sampleRate,\n });\n // Create destination node (outputs to MediaStream)\n this.destination = this.audioContext.createMediaStreamDestination();\n this.destination.channelCount = this.config.channelCount;\n // Create master gain node\n this.masterGain = this.audioContext.createGain();\n // Create compressor for consistent levels (voice/streaming optimized)\n this.compressor = this.audioContext.createDynamicsCompressor();\n this.compressor.threshold.value = -24; // Start compressing at -24dB\n this.compressor.knee.value = 30; // Soft knee for natural sound\n this.compressor.ratio.value = 4; // 4:1 compression\n this.compressor.attack.value = 0.003; // 3ms attack (fast for peaks)\n this.compressor.release.value = 0.25; // 250ms release\n // Create limiter (prevent clipping, brick-wall at -1dB)\n this.limiter = this.audioContext.createDynamicsCompressor();\n this.limiter.threshold.value = -1; // Brick-wall at -1dB\n this.limiter.knee.value = 0; // Hard knee\n this.limiter.ratio.value = 20; // Heavy limiting\n this.limiter.attack.value = 0.001; // 1ms attack\n this.limiter.release.value = 0.1; // 100ms release\n // Create analyzer for VU meter (non-destructive tap)\n this.analyzer = this.audioContext.createAnalyser();\n this.analyzer.fftSize = 256;\n this.analyzer.smoothingTimeConstant = 0.3;\n // Connect the chain: masterGain -> compressor -> analyzer -> limiter -> destination\n // Analyzer is after compressor so we see post-compression levels\n this.masterGain.connect(this.compressor);\n this.compressor.connect(this.analyzer);\n this.analyzer.connect(this.limiter);\n this.limiter.connect(this.destination);\n // Get the output stream\n this.outputStream = this.destination.stream;\n console.log(\"[AudioMixer] Initialized with compressor/limiter chain\", {\n sampleRate: this.audioContext.sampleRate,\n channelCount: this.config.channelCount,\n });\n }\n catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n console.error(\"[AudioMixer] Failed to initialize:\", err);\n this.emit(\"error\", { message: err.message, error: err });\n throw err;\n }\n }\n /**\n * Add an audio source to the mixer\n */\n addSource(id, track, options = {}) {\n if (!this.audioContext || !this.masterGain) {\n throw new Error(\"AudioMixer not initialized. Call initialize() first.\");\n }\n if (track.kind !== \"audio\") {\n throw new Error(\"Track must be an audio track\");\n }\n // Remove existing source with same ID if present\n if (this.sources.has(id)) {\n this.removeSource(id);\n }\n try {\n // Create a MediaStream from the track\n const stream = new MediaStream([track]);\n // Create source node from the stream\n const sourceNode = this.audioContext.createMediaStreamSource(stream);\n // Create gain node for volume control\n const gainNode = this.audioContext.createGain();\n gainNode.gain.value = options.muted ? 0 : (options.volume ?? 1.0);\n // Create panner node for stereo positioning\n const panNode = this.audioContext.createStereoPanner();\n panNode.pan.value = options.pan ?? 0;\n // Connect the chain: source -> gain -> pan -> master\n sourceNode.connect(gainNode);\n gainNode.connect(panNode);\n panNode.connect(this.masterGain);\n // Store the source\n const audioSource = {\n id,\n sourceNode,\n gainNode,\n panNode,\n track,\n options: {\n volume: options.volume ?? 1.0,\n muted: options.muted ?? false,\n pan: options.pan ?? 0,\n },\n };\n this.sources.set(id, audioSource);\n console.log(\"[AudioMixer] Added source:\", id);\n this.emit(\"sourceAdded\", { sourceId: id });\n }\n catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n console.error(\"[AudioMixer] Failed to add source:\", err);\n this.emit(\"error\", { message: `Failed to add source: ${err.message}`, error: err });\n throw err;\n }\n }\n /**\n * Remove an audio source from the mixer\n */\n removeSource(id) {\n const source = this.sources.get(id);\n if (!source) {\n return;\n }\n try {\n // Disconnect all nodes\n source.sourceNode.disconnect();\n source.gainNode.disconnect();\n source.panNode.disconnect();\n this.sources.delete(id);\n console.log(\"[AudioMixer] Removed source:\", id);\n this.emit(\"sourceRemoved\", { sourceId: id });\n }\n catch (error) {\n console.error(\"[AudioMixer] Error removing source:\", error);\n }\n }\n /**\n * Update source options\n */\n updateSource(id, options) {\n const source = this.sources.get(id);\n if (!source) {\n console.warn(\"[AudioMixer] Source not found:\", id);\n return;\n }\n // Update volume\n if (options.volume !== undefined) {\n source.options.volume = options.volume;\n if (!source.options.muted) {\n source.gainNode.gain.setTargetAtTime(options.volume, this.audioContext?.currentTime ?? 0, 0.01 // Smooth transition\n );\n }\n }\n // Update mute state\n if (options.muted !== undefined) {\n source.options.muted = options.muted;\n source.gainNode.gain.setTargetAtTime(options.muted ? 0 : source.options.volume, this.audioContext?.currentTime ?? 0, 0.01);\n }\n // Update pan\n if (options.pan !== undefined) {\n source.options.pan = options.pan;\n source.panNode.pan.setTargetAtTime(options.pan, this.audioContext?.currentTime ?? 0, 0.01);\n }\n }\n /**\n * Set volume for a source (supports boost up to 2x)\n */\n setVolume(id, volume) {\n // Allow gain boost up to 2.0 (double) for quiet sources\n this.updateSource(id, { volume: Math.max(0, Math.min(2.0, volume)) });\n }\n /**\n * Mute a source\n */\n mute(id) {\n this.updateSource(id, { muted: true });\n }\n /**\n * Unmute a source\n */\n unmute(id) {\n this.updateSource(id, { muted: false });\n }\n /**\n * Toggle mute for a source\n */\n toggleMute(id) {\n const source = this.sources.get(id);\n if (!source) {\n return false;\n }\n const newMuted = !source.options.muted;\n this.updateSource(id, { muted: newMuted });\n return newMuted;\n }\n /**\n * Set pan for a source (-1.0 = left, 0 = center, 1.0 = right)\n */\n setPan(id, pan) {\n this.updateSource(id, { pan: Math.max(-1, Math.min(1, pan)) });\n }\n /**\n * Set master volume (supports boost up to 2x / +6dB)\n */\n setMasterVolume(volume) {\n if (!this.masterGain)\n return;\n this.masterGain.gain.setTargetAtTime(Math.max(0, Math.min(2, volume)), this.audioContext?.currentTime ?? 0, 0.01);\n }\n /**\n * Get current master volume\n */\n getMasterVolume() {\n return this.masterGain?.gain.value ?? 1;\n }\n /**\n * Get the mixed output stream\n */\n getOutputStream() {\n return this.outputStream;\n }\n /**\n * Get the output audio track\n */\n getOutputTrack() {\n return this.outputStream?.getAudioTracks()[0] ?? null;\n }\n /**\n * Get all source IDs\n */\n getSourceIds() {\n return Array.from(this.sources.keys());\n }\n /**\n * Get source options\n */\n getSourceOptions(id) {\n const source = this.sources.get(id);\n return source ? { ...source.options } : null;\n }\n /**\n * Check if a source exists\n */\n hasSource(id) {\n return this.sources.has(id);\n }\n /**\n * Get the number of sources\n */\n getSourceCount() {\n return this.sources.size;\n }\n /**\n * Resume audio context (required after user interaction)\n */\n async resume() {\n if (this.audioContext && this.audioContext.state === \"suspended\") {\n await this.audioContext.resume();\n }\n }\n /**\n * Suspend audio context\n */\n async suspend() {\n if (this.audioContext && this.audioContext.state === \"running\") {\n await this.audioContext.suspend();\n }\n }\n /**\n * Get audio context state\n */\n getState() {\n return this.audioContext?.state ?? null;\n }\n /**\n * Get current audio level (0-1) for VU meter\n * Uses dB scaling for perceptually accurate display\n */\n getLevel() {\n if (!this.analyzer)\n return 0;\n const data = new Uint8Array(this.analyzer.frequencyBinCount);\n this.analyzer.getByteTimeDomainData(data);\n // Calculate peak amplitude (linear 0-1)\n let max = 0;\n for (let i = 0; i < data.length; i++) {\n const v = Math.abs(data[i] - 128) / 128;\n if (v > max)\n max = v;\n }\n // Avoid log(0)\n if (max < 0.0001)\n return 0;\n // Convert to dB scale\n // 0 dB = full scale (max=1), -60 dB = very quiet\n const dB = 20 * Math.log10(max);\n // Map dB range to 0-1\n // -60 dB -> 0, 0 dB -> 1\n const minDb = -60;\n const maxDb = 0;\n const normalized = (dB - minDb) / (maxDb - minDb);\n return Math.max(0, Math.min(1, normalized));\n }\n /**\n * Get current and peak audio levels for VU meter with decay\n */\n getLevels() {\n const level = this.getLevel();\n // Update peak with decay\n if (level > this.peakLevel) {\n this.peakLevel = level;\n }\n else {\n this.peakLevel *= this.peakDecayRate;\n }\n return { level, peakLevel: this.peakLevel };\n }\n /**\n * Start emitting level updates (for VU meter)\n * Call this when you want to start monitoring audio levels\n */\n startLevelMonitoring() {\n if (this.levelMonitoringActive)\n return;\n this.levelMonitoringActive = true;\n const update = () => {\n if (!this.levelMonitoringActive || this.audioContext?.state !== \"running\") {\n return;\n }\n const { level, peakLevel } = this.getLevels();\n this.emit(\"levelUpdate\", { level, peakLevel });\n requestAnimationFrame(update);\n };\n requestAnimationFrame(update);\n console.log(\"[AudioMixer] Level monitoring started\");\n }\n /**\n * Stop emitting level updates\n */\n stopLevelMonitoring() {\n this.levelMonitoringActive = false;\n this.peakLevel = 0;\n console.log(\"[AudioMixer] Level monitoring stopped\");\n }\n /**\n * Check if level monitoring is active\n */\n isMonitoringLevels() {\n return this.levelMonitoringActive;\n }\n /**\n * Destroy the mixer and clean up resources\n */\n destroy() {\n // Stop level monitoring\n this.stopLevelMonitoring();\n // Remove all sources\n for (const id of this.sources.keys()) {\n this.removeSource(id);\n }\n // Disconnect processing nodes\n if (this.compressor) {\n this.compressor.disconnect();\n this.compressor = null;\n }\n if (this.limiter) {\n this.limiter.disconnect();\n this.limiter = null;\n }\n if (this.analyzer) {\n this.analyzer.disconnect();\n this.analyzer = null;\n }\n // Close audio context\n if (this.audioContext) {\n this.audioContext.close().catch(() => {\n // Ignore close errors\n });\n this.audioContext = null;\n }\n this.destination = null;\n this.masterGain = null;\n this.outputStream = null;\n this.removeAllListeners();\n }\n}\n\nexport { AudioMixer };\n//# sourceMappingURL=AudioMixer.js.map\n","import { TypedEventEmitter } from './EventEmitter.js';\n\n/**\n * Reconnection Manager\n * Handles automatic reconnection with exponential backoff\n */\nconst DEFAULT_RECONNECTION_CONFIG = {\n enabled: true,\n maxAttempts: 5,\n baseDelay: 1000, // 1 second\n maxDelay: 30000, // 30 seconds\n backoffMultiplier: 2,\n};\nclass ReconnectionManager extends TypedEventEmitter {\n constructor(config = {}) {\n super();\n this.reconnectTimeout = null;\n this.countdownInterval = null;\n this.reconnectCallback = null;\n this.config = { ...DEFAULT_RECONNECTION_CONFIG, ...config };\n this.state = {\n isReconnecting: false,\n attemptNumber: 0,\n nextAttemptIn: null,\n lastError: null,\n };\n }\n /**\n * Calculate delay for next attempt using exponential backoff\n */\n calculateDelay(attempt) {\n const delay = this.config.baseDelay * Math.pow(this.config.backoffMultiplier, attempt - 1);\n // Add some jitter (±10%) to prevent thundering herd\n const jitter = delay * 0.1 * (Math.random() * 2 - 1);\n return Math.min(delay + jitter, this.config.maxDelay);\n }\n /**\n * Start reconnection process\n */\n start(reconnectCallback) {\n if (!this.config.enabled) {\n console.log(\"[ReconnectionManager] Reconnection disabled\");\n return;\n }\n if (this.state.isReconnecting) {\n console.log(\"[ReconnectionManager] Already reconnecting\");\n return;\n }\n this.reconnectCallback = reconnectCallback;\n this.state = {\n isReconnecting: true,\n attemptNumber: 0,\n nextAttemptIn: null,\n lastError: null,\n };\n this.scheduleNextAttempt();\n }\n /**\n * Schedule the next reconnection attempt\n */\n scheduleNextAttempt() {\n if (!this.state.isReconnecting)\n return;\n this.state.attemptNumber++;\n if (this.state.attemptNumber > this.config.maxAttempts) {\n this.handleExhausted();\n return;\n }\n const delay = this.calculateDelay(this.state.attemptNumber);\n this.state.nextAttemptIn = delay;\n console.log(`[ReconnectionManager] Scheduling attempt ${this.state.attemptNumber}/${this.config.maxAttempts} in ${delay}ms`);\n this.emit(\"attemptStart\", {\n attempt: this.state.attemptNumber,\n delay,\n });\n // Start countdown\n this.startCountdown(delay);\n // Schedule the attempt\n this.reconnectTimeout = setTimeout(() => {\n this.executeAttempt();\n }, delay);\n }\n /**\n * Start countdown interval\n */\n startCountdown(delay) {\n this.stopCountdown();\n const startTime = Date.now();\n this.countdownInterval = setInterval(() => {\n const elapsed = Date.now() - startTime;\n this.state.nextAttemptIn = Math.max(0, delay - elapsed);\n }, 100);\n }\n /**\n * Stop countdown interval\n */\n stopCountdown() {\n if (this.countdownInterval) {\n clearInterval(this.countdownInterval);\n this.countdownInterval = null;\n }\n }\n /**\n * Execute a reconnection attempt\n */\n async executeAttempt() {\n this.stopCountdown();\n this.state.nextAttemptIn = null;\n if (!this.reconnectCallback) {\n console.error(\"[ReconnectionManager] No reconnect callback set\");\n return;\n }\n console.log(`[ReconnectionManager] Executing attempt ${this.state.attemptNumber}`);\n try {\n await this.reconnectCallback();\n // Success!\n this.handleSuccess();\n }\n catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n this.handleFailure(errorMessage);\n }\n }\n /**\n * Handle successful reconnection\n */\n handleSuccess() {\n console.log(\"[ReconnectionManager] Reconnection successful\");\n this.state = {\n isReconnecting: false,\n attemptNumber: 0,\n nextAttemptIn: null,\n lastError: null,\n };\n this.cleanup();\n this.emit(\"attemptSuccess\", undefined);\n }\n /**\n * Handle failed reconnection attempt\n */\n handleFailure(error) {\n console.log(`[ReconnectionManager] Attempt ${this.state.attemptNumber} failed:`, error);\n this.state.lastError = error;\n this.emit(\"attemptFailed\", {\n attempt: this.state.attemptNumber,\n error,\n });\n // Schedule next attempt\n this.scheduleNextAttempt();\n }\n /**\n * Handle exhausted attempts\n */\n handleExhausted() {\n console.log(\"[ReconnectionManager] All reconnection attempts exhausted\");\n this.emit(\"exhausted\", {\n totalAttempts: this.config.maxAttempts,\n });\n this.stop();\n }\n /**\n * Stop reconnection process\n */\n stop() {\n console.log(\"[ReconnectionManager] Stopping reconnection\");\n this.cleanup();\n this.state = {\n isReconnecting: false,\n attemptNumber: 0,\n nextAttemptIn: null,\n lastError: this.state.lastError,\n };\n }\n /**\n * Clean up timers\n */\n cleanup() {\n if (this.reconnectTimeout) {\n clearTimeout(this.reconnectTimeout);\n this.reconnectTimeout = null;\n }\n this.stopCountdown();\n this.reconnectCallback = null;\n }\n /**\n * Reset the manager (e.g., after manual reconnect)\n */\n reset() {\n this.stop();\n this.state.lastError = null;\n }\n /**\n * Get current state\n */\n getState() {\n return { ...this.state };\n }\n /**\n * Check if currently reconnecting\n */\n isReconnecting() {\n return this.state.isReconnecting;\n }\n /**\n * Get current attempt number\n */\n getAttemptNumber() {\n return this.state.attemptNumber;\n }\n /**\n * Get max attempts\n */\n getMaxAttempts() {\n return this.config.maxAttempts;\n }\n /**\n * Update configuration\n */\n updateConfig(config) {\n this.config = { ...this.config, ...config };\n }\n /**\n * Destroy the manager\n */\n destroy() {\n this.cleanup();\n this.removeAllListeners();\n }\n}\n\nexport { DEFAULT_RECONNECTION_CONFIG, ReconnectionManager };\n//# sourceMappingURL=ReconnectionManager.js.map\n","import { DEFAULT_LAYER_TRANSFORM } from '../../types.js';\n\n/**\n * Layout Strategies\n *\n * Preset layout configurations for common streaming scenarios.\n * Layouts calculate layer transforms automatically based on source arrangement.\n *\n * Available layouts:\n * - Solo: Single source fullscreen\n * - PiP (4 corners): Main source with smaller overlay in corner\n * - Split H/V: Two sources side by side (50/50)\n * - Focus L/R: Two sources with emphasis (70/30)\n * - Grid: 2x2 grid for 3-4 sources\n * - Stack: Vertical stack of sources\n */\n/**\n * All available layout presets with metadata\n */\nconst LAYOUT_PRESETS = [\n { mode: \"solo\", label: \"Solo\", icon: \"⬜\", minSources: 1, maxSources: 1 },\n // 2-source layouts\n { mode: \"pip-br\", label: \"PiP ↘\", icon: \"◳\", minSources: 2, maxSources: 2 },\n { mode: \"pip-bl\", label: \"PiP ↙\", icon: \"◲\", minSources: 2, maxSources: 2 },\n { mode: \"pip-tr\", label: \"PiP ↗\", icon: \"◱\", minSources: 2, maxSources: 2 },\n { mode: \"pip-tl\", label: \"PiP ↖\", icon: \"◰\", minSources: 2, maxSources: 2 },\n { mode: \"split-h\", label: \"Split ⬌\", icon: \"▥\", minSources: 2, maxSources: 2 },\n { mode: \"split-v\", label: \"Split ⬍\", icon: \"▤\", minSources: 2, maxSources: 2 },\n { mode: \"focus-l\", label: \"Focus ◀\", icon: \"◧\", minSources: 2, maxSources: 2 },\n { mode: \"focus-r\", label: \"Focus ▶\", icon: \"◨\", minSources: 2, maxSources: 2 },\n // 3-source layouts\n { mode: \"pip-dual-br\", label: \"Main+2 PiP\", icon: \"⊞\", minSources: 3, maxSources: 3 },\n { mode: \"pip-dual-bl\", label: \"Main+2 PiP ↙\", icon: \"⊟\", minSources: 3, maxSources: 3 },\n { mode: \"split-pip-l\", label: \"Split+PiP\", icon: \"⊠\", minSources: 3, maxSources: 3 },\n { mode: \"split-pip-r\", label: \"Split+PiP ▶\", icon: \"⊡\", minSources: 3, maxSources: 3 },\n // Featured layout (1 main + strip of others)\n { mode: \"featured\", label: \"Featured\", icon: \"⬒\", minSources: 3, maxSources: 99 },\n { mode: \"featured-r\", label: \"Featured ▶\", icon: \"⬓\", minSources: 3, maxSources: 99 },\n // Auto-grid (works with any count 2+)\n { mode: \"grid\", label: \"Grid\", icon: \"▦\", minSources: 2, maxSources: 99 },\n { mode: \"stack\", label: \"Stack\", icon: \"☰\", minSources: 2, maxSources: 99 },\n];\n// ============================================================================\n// Layer Creation Helpers\n// ============================================================================\n// Default scaling mode used when not specified\nlet currentScalingMode = \"letterbox\";\nfunction createLayer(sourceId, zIndex, transform, scalingMode = currentScalingMode) {\n return {\n id: `layer-${zIndex}-${sourceId}`,\n sourceId,\n visible: true,\n locked: false,\n zIndex,\n transform: { ...DEFAULT_LAYER_TRANSFORM, ...transform },\n scalingMode,\n };\n}\n// ============================================================================\n// Layout Implementations\n// ============================================================================\nconst PIP_SCALE = 0.25;\nconst PIP_PADDING = 0.02;\nconst PIP_BORDER_RADIUS = 8;\nconst SPLIT_GAP = 0.005;\n/**\n * Solo layout - single source fullscreen\n */\nfunction applySoloLayout(sourceIds) {\n return [createLayer(sourceIds[0], 0, { x: 0, y: 0, width: 1, height: 1 })];\n}\n/**\n * PiP layout - main source with overlay in specified corner\n */\nfunction applyPipLayout(sourceIds, corner, pipScale = PIP_SCALE) {\n if (sourceIds.length < 2)\n return applySoloLayout(sourceIds);\n const positions = {\n tl: { x: PIP_PADDING, y: PIP_PADDING },\n tr: { x: 1 - pipScale - PIP_PADDING, y: PIP_PADDING },\n bl: { x: PIP_PADDING, y: 1 - pipScale - PIP_PADDING },\n br: { x: 1 - pipScale - PIP_PADDING, y: 1 - pipScale - PIP_PADDING },\n };\n const pos = positions[corner];\n return [\n // Main (background)\n createLayer(sourceIds[0], 0, { x: 0, y: 0, width: 1, height: 1 }),\n // PiP (overlay)\n createLayer(sourceIds[1], 1, {\n x: pos.x,\n y: pos.y,\n width: pipScale,\n height: pipScale,\n borderRadius: PIP_BORDER_RADIUS,\n }),\n ];\n}\n/**\n * Split layout - two sources side by side\n */\nfunction applySplitLayout(sourceIds, direction, ratio = 0.5) {\n if (sourceIds.length < 2)\n return applySoloLayout(sourceIds);\n const gap = SPLIT_GAP;\n const halfGap = gap / 2;\n if (direction === \"h\") {\n // Horizontal split (left-right)\n return [\n createLayer(sourceIds[0], 0, {\n x: 0,\n y: 0,\n width: ratio - halfGap,\n height: 1,\n }),\n createLayer(sourceIds[1], 0, {\n x: ratio + halfGap,\n y: 0,\n width: 1 - ratio - halfGap,\n height: 1,\n }),\n ];\n }\n else {\n // Vertical split (top-bottom)\n return [\n createLayer(sourceIds[0], 0, {\n x: 0,\n y: 0,\n width: 1,\n height: ratio - halfGap,\n }),\n createLayer(sourceIds[1], 0, {\n x: 0,\n y: ratio + halfGap,\n width: 1,\n height: 1 - ratio - halfGap,\n }),\n ];\n }\n}\n/**\n * Grid layout - auto-scaling grid for any number of sources\n * Calculates optimal grid dimensions based on source count\n */\nfunction applyGridLayout(sourceIds) {\n const count = sourceIds.length;\n if (count === 0)\n return [];\n if (count === 1)\n return applySoloLayout(sourceIds);\n if (count === 2)\n return applySplitLayout(sourceIds, \"h\");\n const gap = SPLIT_GAP;\n // Calculate optimal grid dimensions\n // For count <= 4: 2x2, for 5-6: 3x2, for 7-9: 3x3, etc.\n const cols = Math.ceil(Math.sqrt(count));\n const rows = Math.ceil(count / cols);\n const cellW = (1 - gap * (cols - 1)) / cols;\n const cellH = (1 - gap * (rows - 1)) / rows;\n const layers = [];\n for (let i = 0; i < count; i++) {\n const col = i % cols;\n const row = Math.floor(i / cols);\n // Center the last row if it's not full\n const isLastRow = row === rows - 1;\n const itemsInRow = isLastRow ? ((count - 1) % cols) + 1 : cols;\n let offsetX = 0;\n if (isLastRow && itemsInRow < cols) {\n // Center the incomplete row\n const rowWidth = itemsInRow * cellW + (itemsInRow - 1) * gap;\n offsetX = (1 - rowWidth) / 2;\n }\n const x = offsetX + col * (cellW + gap);\n const y = row * (cellH + gap);\n layers.push(createLayer(sourceIds[i], i, { x, y, width: cellW, height: cellH }));\n }\n return layers;\n}\n/**\n * Dual PiP layout - main source with 2 PiP overlays in corner\n */\nfunction applyDualPipLayout(sourceIds, corner) {\n if (sourceIds.length < 3)\n return applyPipLayout(sourceIds, corner === \"br\" ? \"br\" : \"bl\");\n const pipScale = PIP_SCALE;\n const pipGap = 0.01;\n // Main source fullscreen\n const layers = [createLayer(sourceIds[0], 0, { x: 0, y: 0, width: 1, height: 1 })];\n if (corner === \"br\") {\n // Two PiPs stacked vertically in bottom-right\n layers.push(createLayer(sourceIds[1], 1, {\n x: 1 - pipScale - PIP_PADDING,\n y: 1 - 2 * pipScale - pipGap - PIP_PADDING,\n width: pipScale,\n height: pipScale,\n borderRadius: PIP_BORDER_RADIUS,\n }), createLayer(sourceIds[2], 2, {\n x: 1 - pipScale - PIP_PADDING,\n y: 1 - pipScale - PIP_PADDING,\n width: pipScale,\n height: pipScale,\n borderRadius: PIP_BORDER_RADIUS,\n }));\n }\n else {\n // Two PiPs stacked vertically in bottom-left\n layers.push(createLayer(sourceIds[1], 1, {\n x: PIP_PADDING,\n y: 1 - 2 * pipScale - pipGap - PIP_PADDING,\n width: pipScale,\n height: pipScale,\n borderRadius: PIP_BORDER_RADIUS,\n }), createLayer(sourceIds[2], 2, {\n x: PIP_PADDING,\n y: 1 - pipScale - PIP_PADDING,\n width: pipScale,\n height: pipScale,\n borderRadius: PIP_BORDER_RADIUS,\n }));\n }\n return layers;\n}\n/**\n * Split + PiP layout - two sources side by side, third as PiP overlay\n */\nfunction applySplitPipLayout(sourceIds, pipSide) {\n if (sourceIds.length < 3)\n return applySplitLayout(sourceIds, \"h\");\n const gap = SPLIT_GAP;\n const halfGap = gap / 2;\n const pipScale = PIP_SCALE;\n const layers = [\n // Left half\n createLayer(sourceIds[0], 0, { x: 0, y: 0, width: 0.5 - halfGap, height: 1 }),\n // Right half\n createLayer(sourceIds[1], 0, { x: 0.5 + halfGap, y: 0, width: 0.5 - halfGap, height: 1 }),\n ];\n // PiP overlay\n if (pipSide === \"l\") {\n // PiP on left half, bottom-right of that section\n layers.push(createLayer(sourceIds[2], 1, {\n x: 0.5 - halfGap - pipScale - PIP_PADDING,\n y: 1 - pipScale - PIP_PADDING,\n width: pipScale,\n height: pipScale,\n borderRadius: PIP_BORDER_RADIUS,\n }));\n }\n else {\n // PiP on right half, bottom-right of that section\n layers.push(createLayer(sourceIds[2], 1, {\n x: 1 - pipScale - PIP_PADDING,\n y: 1 - pipScale - PIP_PADDING,\n width: pipScale,\n height: pipScale,\n borderRadius: PIP_BORDER_RADIUS,\n }));\n }\n return layers;\n}\n/**\n * Featured layout - one main source large, others in a strip\n * @param direction - 'bottom' for strip below, 'right' for strip on right\n */\nfunction applyFeaturedLayout(sourceIds, direction) {\n const count = sourceIds.length;\n if (count <= 2)\n return applySplitLayout(sourceIds, direction === \"bottom\" ? \"v\" : \"h\", 0.75);\n const gap = SPLIT_GAP;\n const stripRatio = 0.2; // Strip takes 20% of the space\n const mainRatio = 1 - stripRatio - gap;\n const layers = [];\n if (direction === \"bottom\") {\n // Main source on top (80%)\n layers.push(createLayer(sourceIds[0], 0, {\n x: 0,\n y: 0,\n width: 1,\n height: mainRatio,\n }));\n // Strip of thumbnails at bottom\n const thumbCount = count - 1;\n const thumbW = (1 - gap * (thumbCount - 1)) / thumbCount;\n for (let i = 1; i < count; i++) {\n layers.push(createLayer(sourceIds[i], 0, {\n x: (i - 1) * (thumbW + gap),\n y: mainRatio + gap,\n width: thumbW,\n height: stripRatio,\n }));\n }\n }\n else {\n // Main source on left (80%)\n layers.push(createLayer(sourceIds[0], 0, {\n x: 0,\n y: 0,\n width: mainRatio,\n height: 1,\n }));\n // Strip of thumbnails on right\n const thumbCount = count - 1;\n const thumbH = (1 - gap * (thumbCount - 1)) / thumbCount;\n for (let i = 1; i < count; i++) {\n layers.push(createLayer(sourceIds[i], 0, {\n x: mainRatio + gap,\n y: (i - 1) * (thumbH + gap),\n width: stripRatio,\n height: thumbH,\n }));\n }\n }\n return layers;\n}\n/**\n * Stack layout - vertical stack of sources (no limit)\n */\nfunction applyStackLayout(sourceIds) {\n const count = sourceIds.length;\n if (count === 0)\n return [];\n if (count === 1)\n return applySoloLayout(sourceIds);\n const gap = SPLIT_GAP;\n const cellH = (1 - gap * (count - 1)) / count;\n return sourceIds.map((id, i) => createLayer(id, 0, {\n x: 0,\n y: i * (cellH + gap),\n width: 1,\n height: cellH,\n }));\n}\n// ============================================================================\n// Main Layout Factory\n// ============================================================================\n/**\n * Apply a layout configuration to a list of sources\n *\n * @param layout - Layout configuration\n * @param sourceIds - Array of source IDs to arrange\n * @returns Array of Layer configurations\n */\nfunction applyLayout(layout, sourceIds) {\n if (sourceIds.length === 0) {\n return [];\n }\n // Set the scaling mode for all layers created by this layout\n currentScalingMode = layout.scalingMode ?? \"letterbox\";\n const pipScale = layout.pipScale ?? PIP_SCALE;\n const splitRatio = layout.splitRatio ?? 0.5;\n const clampedSplitRatio = Math.min(Math.max(splitRatio, SPLIT_GAP / 2), 1 - SPLIT_GAP / 2);\n switch (layout.mode) {\n // Solo / Fullscreen\n case \"solo\":\n case \"fullscreen\":\n return applySoloLayout(sourceIds);\n // 2-source PiP variants\n case \"pip-br\":\n case \"pip\":\n return applyPipLayout(sourceIds, \"br\", pipScale);\n case \"pip-bl\":\n return applyPipLayout(sourceIds, \"bl\", pipScale);\n case \"pip-tr\":\n return applyPipLayout(sourceIds, \"tr\", pipScale);\n case \"pip-tl\":\n return applyPipLayout(sourceIds, \"tl\", pipScale);\n // Split variants\n case \"split-h\":\n case \"side-by-side\":\n return applySplitLayout(sourceIds, \"h\", clampedSplitRatio);\n case \"split-v\":\n return applySplitLayout(sourceIds, \"v\", clampedSplitRatio);\n // Focus variants (70/30 split)\n case \"focus-l\":\n return applySplitLayout(sourceIds, \"h\", 0.7);\n case \"focus-r\":\n return applySplitLayout(sourceIds, \"h\", 0.3);\n // 3-source layouts\n case \"pip-dual-br\":\n return applyDualPipLayout(sourceIds, \"br\");\n case \"pip-dual-bl\":\n return applyDualPipLayout(sourceIds, \"bl\");\n case \"split-pip-l\":\n return applySplitPipLayout(sourceIds, \"l\");\n case \"split-pip-r\":\n return applySplitPipLayout(sourceIds, \"r\");\n // Featured layouts (any source count 3+)\n case \"featured\":\n return applyFeaturedLayout(sourceIds, \"bottom\");\n case \"featured-r\":\n return applyFeaturedLayout(sourceIds, \"right\");\n // Multi-source layouts (auto-grid for any count)\n case \"grid\":\n return applyGridLayout(sourceIds);\n case \"stack\":\n return applyStackLayout(sourceIds);\n default:\n return applySoloLayout(sourceIds);\n }\n}\n// ============================================================================\n// Utility Functions\n// ============================================================================\n/**\n * Create a default LayoutConfig\n */\nfunction createDefaultLayoutConfig() {\n return {\n mode: \"solo\",\n scalingMode: \"letterbox\",\n };\n}\n/**\n * Get all available layout presets\n */\nfunction getLayoutPresets() {\n return LAYOUT_PRESETS;\n}\n/**\n * Get presets that work with the given source count\n */\nfunction getAvailablePresets(sourceCount) {\n return LAYOUT_PRESETS.filter((p) => sourceCount >= p.minSources && sourceCount <= p.maxSources);\n}\n/**\n * Get minimum source count required for a layout mode\n */\nfunction getMinSourcesForLayout(mode) {\n const preset = LAYOUT_PRESETS.find((p) => p.mode === mode);\n return preset?.minSources ?? 1;\n}\n/**\n * Check if a layout mode is available for a given source count\n */\nfunction isLayoutAvailable(mode, sourceCount) {\n const preset = LAYOUT_PRESETS.find((p) => p.mode === mode);\n if (!preset)\n return false;\n return sourceCount >= preset.minSources && sourceCount <= preset.maxSources;\n}\nfunction createPipLayoutConfig(pipPosition = \"bottom-right\", pipScale = 0.25) {\n const positionMap = {\n \"top-left\": \"pip-tl\",\n \"top-right\": \"pip-tr\",\n \"bottom-left\": \"pip-bl\",\n \"bottom-right\": \"pip-br\",\n };\n return {\n mode: positionMap[pipPosition],\n pipScale,\n };\n}\nfunction createSideBySideLayoutConfig(splitRatio = 0.5, splitDirection = \"horizontal\") {\n return {\n mode: splitDirection === \"horizontal\" ? \"split-h\" : \"split-v\",\n splitRatio,\n };\n}\nfunction getAvailableLayoutModes() {\n return LAYOUT_PRESETS.map((p) => p.mode);\n}\n\nexport { LAYOUT_PRESETS, applySoloLayout as applyFullscreenLayout, applyLayout, applyPipLayout, applySplitLayout as applySideBySideLayout, createDefaultLayoutConfig, createPipLayoutConfig, createSideBySideLayoutConfig, getAvailableLayoutModes, getAvailablePresets, getLayoutPresets, getMinSourcesForLayout, isLayoutAvailable };\n//# sourceMappingURL=index.js.map\n","import { TypedEventEmitter } from './EventEmitter.js';\nimport { DEFAULT_COMPOSITOR_CONFIG, DEFAULT_LAYER_TRANSFORM } from '../types.js';\nimport { createDefaultLayoutConfig, applyLayout } from './layouts/index.js';\nimport { createDefaultTransitionConfig } from './TransitionEngine.js';\n\n/**\n * SceneManager\n *\n * Main thread coordinator for the compositor system.\n * Manages scenes, layers, and coordinates with the compositor worker.\n *\n * Responsibilities:\n * - Scene CRUD (create, read, update, delete)\n * - Layer management within scenes\n * - Source → Layer binding\n * - Transition triggering\n * - Frame extraction and forwarding to worker\n * - Output track management\n */\n// ============================================================================\n// SceneManager Class\n// ============================================================================\n/**\n * Default layout transition configuration\n */\nconst DEFAULT_LAYOUT_TRANSITION = {\n durationMs: 300,\n easing: \"ease-out\",\n};\nclass SceneManager extends TypedEventEmitter {\n constructor(config) {\n super();\n this.scenes = new Map();\n this.activeSceneId = null;\n this.defaultLayoutTransition = DEFAULT_LAYOUT_TRANSITION;\n this.isAnimating = false;\n // Worker communication\n this.worker = null;\n this.workerReady = false;\n this.pendingMessages = [];\n // Frame extraction\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.frameProcessors = new Map();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.frameReaders = new Map();\n // Output\n this.outputCanvas = null;\n this.outputStream = null;\n // Stats\n this.lastStats = { fps: 0, frameTimeMs: 0 };\n this.config = { ...DEFAULT_COMPOSITOR_CONFIG, ...config };\n this.defaultTransition = this.config.defaultTransition || createDefaultTransitionConfig();\n this.currentLayout = createDefaultLayoutConfig();\n }\n // ============================================================================\n // Worker Loading\n // ============================================================================\n /**\n * Initialize the worker with fallback loading strategies\n */\n async initializeWorker() {\n // Fallback: try loading from paths (for development or custom deployments)\n let lastError = null;\n const workerPaths = [\n // Preferred: packaged worker relative to built module URL\n new URL(\"../workers/compositor.worker.js\", import.meta.url).href,\n // Vite dev server with pnpm workspace symlinks\n \"/node_modules/@livepeer-frameworks/streamcrafter-core/dist/workers/compositor.worker.js\",\n // Public folder paths\n \"/workers/compositor.worker.js\",\n \"./workers/compositor.worker.js\",\n ];\n console.log(\"[SceneManager] Trying fallback worker paths:\", workerPaths);\n for (const path of workerPaths) {\n if (this.worker)\n break;\n try {\n console.log(`[SceneManager] Trying worker path: ${path}`);\n // Worker constructor doesn't throw on 404, need to use a test approach\n const testWorker = (() => {\n try {\n return new Worker(path, { type: \"module\" });\n }\n catch {\n return new Worker(path);\n }\n })();\n // Wait for either successful message or error\n const success = await new Promise((resolve) => {\n const timeout = setTimeout(() => {\n testWorker.terminate();\n resolve(false);\n }, 2000);\n testWorker.onerror = () => {\n clearTimeout(timeout);\n testWorker.terminate();\n resolve(false);\n };\n // If worker starts sending messages, it loaded successfully\n testWorker.onmessage = () => {\n clearTimeout(timeout);\n resolve(true);\n };\n // Also check if we get a ready response quickly\n // Some workers might not send immediate messages, give a short grace period\n setTimeout(() => {\n // If we haven't errored by now, assume it loaded\n clearTimeout(timeout);\n resolve(true);\n }, 500);\n });\n if (success) {\n // Terminate test worker and create the real one\n testWorker.terminate();\n try {\n this.worker = new Worker(path, { type: \"module\" });\n }\n catch {\n this.worker = new Worker(path);\n }\n console.log(`[SceneManager] Worker loaded from: ${path}`);\n break;\n }\n else {\n console.warn(`[SceneManager] Worker failed to load from: ${path}`);\n }\n }\n catch (e) {\n lastError = e instanceof Error ? e : new Error(String(e));\n console.warn(`[SceneManager] Failed to load worker from ${path}:`, lastError.message);\n this.worker = null;\n }\n }\n if (!this.worker) {\n throw new Error(`Failed to initialize compositor worker. ` +\n `Make sure the worker is bundled correctly. ` +\n `Last error: ${lastError?.message ?? \"unknown\"}`);\n }\n }\n // ============================================================================\n // Initialization\n // ============================================================================\n /**\n * Initialize the compositor system\n * Creates the worker and sets up the output canvas\n * Returns when the worker is ready\n */\n async initialize() {\n console.log(\"[SceneManager] initialize() called\");\n if (this.worker) {\n throw new Error(\"SceneManager already initialized\");\n }\n // Create output canvas\n console.log(\"[SceneManager] Creating output canvas\", {\n width: this.config.width,\n height: this.config.height,\n });\n this.outputCanvas = document.createElement(\"canvas\");\n this.outputCanvas.width = this.config.width;\n this.outputCanvas.height = this.config.height;\n // Get OffscreenCanvas for worker\n const offscreen = this.outputCanvas.transferControlToOffscreen();\n console.log(\"[SceneManager] Created OffscreenCanvas\");\n // Create the worker using the same strategy as the player\n console.log(\"[SceneManager] Initializing worker...\");\n await this.initializeWorker();\n console.log(\"[SceneManager] Worker initialized, waiting for ready...\");\n // Create a promise that resolves when worker sends 'ready'\n const readyPromise = new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n console.error(\"[SceneManager] Worker initialization timeout\");\n reject(new Error(\"Compositor worker initialization timeout\"));\n }, 10000); // 10 second timeout\n // Set up message handler (worker is guaranteed non-null after initializeWorker)\n this.worker.onmessage = (e) => {\n console.log(\"[SceneManager] Worker message:\", e.data.type);\n if (e.data.type === \"ready\") {\n clearTimeout(timeout);\n resolve();\n }\n this.handleWorkerMessage(e.data);\n };\n this.worker.onerror = (e) => {\n console.error(\"[SceneManager] Worker error:\", e.message);\n clearTimeout(timeout);\n reject(new Error(e.message));\n };\n });\n // Initialize the worker with the offscreen canvas\n // Note: Send directly (not via sendToWorker) because workerReady is still false\n console.log(\"[SceneManager] Sending init message to worker\");\n this.worker.postMessage({ type: \"init\", config: this.config, canvas: offscreen }, [offscreen]);\n // Wait for worker to be ready\n await readyPromise;\n console.log(\"[SceneManager] Worker is ready\");\n // Create default scene\n console.log(\"[SceneManager] Creating default scene\");\n const defaultScene = this.createScene(\"Default\");\n console.log(\"[SceneManager] Setting active scene:\", defaultScene.id);\n this.setActiveScene(defaultScene.id);\n console.log(\"[SceneManager] Initialize complete\");\n }\n /**\n * Handle messages from the compositor worker\n */\n handleWorkerMessage(message) {\n switch (message.type) {\n case \"ready\":\n this.workerReady = true;\n // Send any pending messages\n for (const msg of this.pendingMessages) {\n this.worker?.postMessage(msg);\n }\n this.pendingMessages = [];\n break;\n case \"stats\":\n this.lastStats = message.stats;\n this.emit(\"statsUpdate\", { stats: message.stats });\n break;\n case \"transitionComplete\":\n this.emit(\"transitionCompleted\", { sceneId: message.sceneId });\n break;\n case \"layoutAnimationComplete\": {\n this.isAnimating = false;\n // Update local scene with the final layout\n const activeScene = this.getActiveScene();\n if (activeScene) {\n const sourceIds = activeScene.layers.filter((l) => l.visible).map((l) => l.sourceId);\n activeScene.layers = applyLayout(this.currentLayout, sourceIds);\n }\n this.emit(\"layoutAnimationCompleted\", { layout: this.currentLayout });\n break;\n }\n case \"rendererChanged\":\n // Update the config with the actual renderer type (important for 'auto' mode)\n this.config.renderer = message.renderer;\n this.emit(\"rendererChanged\", { renderer: message.renderer });\n break;\n case \"error\":\n this.emit(\"error\", { message: message.message });\n break;\n }\n }\n /**\n * Send a message to the worker\n */\n sendToWorker(message, transfer) {\n if (this.workerReady && this.worker) {\n this.worker.postMessage(message, transfer || []);\n }\n else {\n // Queue the message until worker is ready\n this.pendingMessages.push(message);\n }\n }\n // ============================================================================\n // Scene Management\n // ============================================================================\n /**\n * Create a new scene\n */\n createScene(name, backgroundColor = \"#000000\") {\n const id = `scene-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;\n const scene = {\n id,\n name,\n layers: [],\n backgroundColor,\n };\n this.scenes.set(id, scene);\n this.emit(\"sceneCreated\", { scene });\n return scene;\n }\n /**\n * Delete a scene\n */\n deleteScene(sceneId) {\n if (!this.scenes.has(sceneId)) {\n throw new Error(`Scene not found: ${sceneId}`);\n }\n if (this.activeSceneId === sceneId) {\n throw new Error(\"Cannot delete the active scene\");\n }\n this.scenes.delete(sceneId);\n this.emit(\"sceneDeleted\", { sceneId });\n }\n /**\n * Get a scene by ID\n */\n getScene(sceneId) {\n return this.scenes.get(sceneId);\n }\n /**\n * Get all scenes\n */\n getAllScenes() {\n return Array.from(this.scenes.values());\n }\n /**\n * Get the active scene\n */\n getActiveScene() {\n return this.activeSceneId ? this.scenes.get(this.activeSceneId) : undefined;\n }\n /**\n * Set the active scene (instant switch, no transition)\n */\n setActiveScene(sceneId) {\n const scene = this.scenes.get(sceneId);\n if (!scene) {\n throw new Error(`Scene not found: ${sceneId}`);\n }\n const previousSceneId = this.activeSceneId;\n this.activeSceneId = sceneId;\n // Update the worker\n this.sendToWorker({ type: \"updateScene\", scene });\n this.emit(\"sceneActivated\", { scene, previousSceneId });\n }\n /**\n * Transition to a new scene\n */\n async transitionTo(sceneId, transition) {\n const scene = this.scenes.get(sceneId);\n if (!scene) {\n throw new Error(`Scene not found: ${sceneId}`);\n }\n const transitionConfig = transition || this.defaultTransition;\n // First, send the target scene to the worker\n this.sendToWorker({ type: \"updateScene\", scene });\n // Then start the transition\n this.sendToWorker({\n type: \"startTransition\",\n transition: transitionConfig,\n toSceneId: sceneId,\n });\n const previousSceneId = this.activeSceneId;\n this.emit(\"transitionStarted\", {\n fromSceneId: previousSceneId || \"\",\n toSceneId: sceneId,\n transition: transitionConfig,\n });\n // Update active scene ID\n this.activeSceneId = sceneId;\n }\n // ============================================================================\n // Layer Management\n // ============================================================================\n /**\n * Add a layer to a scene\n */\n addLayer(sceneId, sourceId, transform) {\n const scene = this.scenes.get(sceneId);\n if (!scene) {\n throw new Error(`Scene not found: ${sceneId}`);\n }\n const layerId = `layer-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;\n const maxZIndex = scene.layers.reduce((max, l) => Math.max(max, l.zIndex), -1);\n const layer = {\n id: layerId,\n sourceId,\n visible: true,\n locked: false,\n zIndex: maxZIndex + 1,\n transform: { ...DEFAULT_LAYER_TRANSFORM, ...transform },\n scalingMode: this.currentLayout.scalingMode ?? \"letterbox\",\n };\n scene.layers.push(layer);\n this.updateSceneInWorker(scene);\n this.emit(\"layerAdded\", { sceneId, layer });\n return layer;\n }\n /**\n * Remove a layer from a scene\n */\n removeLayer(sceneId, layerId) {\n const scene = this.scenes.get(sceneId);\n if (!scene) {\n throw new Error(`Scene not found: ${sceneId}`);\n }\n const index = scene.layers.findIndex((l) => l.id === layerId);\n if (index === -1) {\n throw new Error(`Layer not found: ${layerId}`);\n }\n scene.layers.splice(index, 1);\n this.updateSceneInWorker(scene);\n this.emit(\"layerRemoved\", { sceneId, layerId });\n }\n /**\n * Update a layer's transform\n */\n updateLayerTransform(sceneId, layerId, transform) {\n const scene = this.scenes.get(sceneId);\n if (!scene) {\n throw new Error(`Scene not found: ${sceneId}`);\n }\n const layer = scene.layers.find((l) => l.id === layerId);\n if (!layer) {\n throw new Error(`Layer not found: ${layerId}`);\n }\n layer.transform = { ...layer.transform, ...transform };\n this.updateSceneInWorker(scene);\n this.emit(\"layerUpdated\", { sceneId, layer });\n }\n /**\n * Toggle layer visibility\n */\n setLayerVisibility(sceneId, layerId, visible) {\n const scene = this.scenes.get(sceneId);\n if (!scene) {\n throw new Error(`Scene not found: ${sceneId}`);\n }\n const layer = scene.layers.find((l) => l.id === layerId);\n if (!layer) {\n throw new Error(`Layer not found: ${layerId}`);\n }\n layer.visible = visible;\n this.updateSceneInWorker(scene);\n this.emit(\"layerUpdated\", { sceneId, layer });\n }\n /**\n * Reorder layers in a scene\n */\n reorderLayers(sceneId, layerIds) {\n const scene = this.scenes.get(sceneId);\n if (!scene) {\n throw new Error(`Scene not found: ${sceneId}`);\n }\n // Reorder based on the provided IDs\n layerIds.forEach((id, index) => {\n const layer = scene.layers.find((l) => l.id === id);\n if (layer) {\n layer.zIndex = index;\n }\n });\n this.updateSceneInWorker(scene);\n }\n /**\n * Cycle the source order in the active scene (rotate layers)\n * @param direction - 'forward' moves first to last, 'backward' moves last to first\n */\n cycleSourceOrder(direction = \"forward\") {\n const scene = this.getActiveScene();\n if (!scene || scene.layers.length < 2) {\n console.warn(\"[SceneManager] cycleSourceOrder: Need at least 2 layers\");\n return;\n }\n // Debug: log state BEFORE cycle\n console.log(\"[SceneManager] cycleSourceOrder BEFORE:\", {\n direction,\n layers: scene.layers.map((l) => ({ id: l.id, sourceId: l.sourceId, zIndex: l.zIndex })),\n });\n // Get layer IDs sorted by current zIndex\n const sortedLayers = [...scene.layers].sort((a, b) => a.zIndex - b.zIndex);\n const layerIds = sortedLayers.map((l) => l.id);\n console.log(\"[SceneManager] sorted layerIds before rotate:\", [...layerIds]);\n // Rotate the array\n if (direction === \"forward\") {\n const first = layerIds.shift();\n if (first)\n layerIds.push(first);\n }\n else {\n const last = layerIds.pop();\n if (last)\n layerIds.unshift(last);\n }\n console.log(\"[SceneManager] layerIds after rotate:\", [...layerIds]);\n // Apply the new Z-order\n this.reorderLayers(scene.id, layerIds);\n // Debug: log state AFTER reorder, BEFORE applyLayout\n console.log(\"[SceneManager] after reorderLayers:\", {\n layers: scene.layers.map((l) => ({ id: l.id, sourceId: l.sourceId, zIndex: l.zIndex })),\n });\n // Re-apply layout to update visual positions based on new Z-order\n if (this.currentLayout) {\n this.applyLayout(this.currentLayout, true, { durationMs: 200, easing: \"ease-out\" });\n }\n // Debug: log state AFTER applyLayout\n console.log(\"[SceneManager] cycleSourceOrder AFTER applyLayout:\", {\n layers: scene.layers.map((l) => ({ id: l.id, sourceId: l.sourceId, zIndex: l.zIndex })),\n });\n this.emit(\"layerUpdated\", { sceneId: scene.id, layer: scene.layers[0] });\n }\n /**\n * Update scene in the worker\n */\n updateSceneInWorker(scene) {\n if (this.activeSceneId === scene.id) {\n this.sendToWorker({ type: \"updateScene\", scene });\n }\n }\n // ============================================================================\n // Layout Presets\n // ============================================================================\n /**\n * Apply a layout preset to the active scene\n * @param layout - Layout configuration to apply\n * @param animate - Whether to animate the transition (default: true)\n * @param transition - Custom transition config (uses default if not provided)\n */\n applyLayout(layout, animate = true, transition) {\n const scene = this.getActiveScene();\n if (!scene) {\n console.warn(\"[SceneManager] applyLayout: No active scene\");\n return;\n }\n this.currentLayout = layout;\n // Get source IDs from current layers sorted by zIndex (preserves cycle order)\n const sourceIds = [...scene.layers]\n .filter((l) => l.visible)\n .sort((a, b) => a.zIndex - b.zIndex)\n .map((l) => l.sourceId);\n console.log(\"[SceneManager] applyLayout\", {\n mode: layout.mode,\n sourceIds,\n currentLayerCount: scene.layers.length,\n animate,\n });\n // Generate new layers from layout\n const newLayers = applyLayout(layout, sourceIds);\n // Create target scene with new layers\n const targetScene = {\n ...scene,\n layers: newLayers,\n };\n // Always update scene.layers to keep state in sync\n scene.layers = newLayers;\n if (animate && newLayers.length > 0) {\n // Animate to the new layout\n const transitionConfig = {\n ...this.defaultLayoutTransition,\n ...transition,\n };\n this.isAnimating = true;\n this.emit(\"layoutAnimationStarted\", { layout });\n this.sendToWorker({\n type: \"animateLayout\",\n targetScene,\n transition: transitionConfig,\n });\n }\n else {\n // Instant update (no animation)\n this.updateSceneInWorker(scene);\n }\n // Also send layout update to worker (for metadata tracking)\n this.sendToWorker({ type: \"updateLayout\", layout });\n }\n /**\n * Set the default layout transition configuration\n */\n setDefaultLayoutTransition(transition) {\n this.defaultLayoutTransition = {\n ...this.defaultLayoutTransition,\n ...transition,\n };\n }\n /**\n * Check if a layout animation is currently in progress\n */\n isLayoutAnimating() {\n return this.isAnimating;\n }\n /**\n * Get the current layout\n */\n getCurrentLayout() {\n return this.currentLayout;\n }\n // ============================================================================\n // Source Binding\n // ============================================================================\n /**\n * Bind a MediaStream source to the compositor\n * This extracts frames and sends them to the worker\n */\n bindSource(sourceId, stream) {\n // Get the video track\n const videoTrack = stream.getVideoTracks()[0];\n if (!videoTrack) {\n throw new Error(\"No video track in stream\");\n }\n // Create a MediaStreamTrackProcessor to extract frames\n // MediaStreamTrackProcessor is experimental and not in all TypeScript defs\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const MediaStreamTrackProcessorCtor = globalThis.MediaStreamTrackProcessor;\n if (!MediaStreamTrackProcessorCtor) {\n console.warn(\"[SceneManager] MediaStreamTrackProcessor not available, compositor will not work\");\n return;\n }\n const processor = new MediaStreamTrackProcessorCtor({ track: videoTrack });\n this.frameProcessors.set(sourceId, processor);\n // Read frames and send to worker\n const reader = processor.readable.getReader();\n this.frameReaders.set(sourceId, reader);\n const readFrame = async () => {\n try {\n const { done, value } = await reader.read();\n if (done || !value)\n return;\n // Cast to VideoFrame since we know it's a video track processor\n const frame = value;\n // Send frame to worker (transfer ownership)\n this.sendToWorker({ type: \"sourceFrame\", sourceId, frame }, [frame]);\n // Continue reading\n readFrame();\n }\n catch (error) {\n // Ignore errors from cancelled readers (expected during unbind)\n if (error?.name !== \"AbortError\") {\n console.error(\"[SceneManager] Frame read error:\", error);\n }\n }\n };\n readFrame();\n }\n /**\n * Unbind a source from the compositor\n */\n unbindSource(sourceId) {\n // Cancel the reader first to stop the read loop\n const reader = this.frameReaders.get(sourceId);\n if (reader) {\n reader.cancel().catch(() => { });\n this.frameReaders.delete(sourceId);\n }\n const processor = this.frameProcessors.get(sourceId);\n if (processor) {\n this.frameProcessors.delete(sourceId);\n }\n }\n /**\n * Bind an image source to the compositor\n */\n async bindImageSource(sourceId, imageUrl) {\n const response = await fetch(imageUrl);\n const blob = await response.blob();\n const bitmap = await createImageBitmap(blob);\n this.sendToWorker({ type: \"sourceImage\", sourceId, bitmap }, [bitmap]);\n }\n // ============================================================================\n // Filters\n // ============================================================================\n /**\n * Apply a filter to a layer\n * Note: Only supported with WebGL or WebGPU renderer\n */\n applyFilter(layerId, filter) {\n this.sendToWorker({ type: \"applyFilter\", layerId, filter });\n }\n // ============================================================================\n // Output\n // ============================================================================\n /**\n * Get the output MediaStreamTrack for the composited video\n */\n getOutputTrack() {\n if (!this.outputCanvas)\n return null;\n // Capture from the canvas at the configured frame rate\n if (!this.outputStream) {\n this.outputStream = this.outputCanvas.captureStream(this.config.frameRate);\n }\n return this.outputStream.getVideoTracks()[0] || null;\n }\n /**\n * Get the output MediaStream\n */\n getOutputStream() {\n if (!this.outputCanvas)\n return null;\n if (!this.outputStream) {\n this.outputStream = this.outputCanvas.captureStream(this.config.frameRate);\n }\n return this.outputStream;\n }\n // ============================================================================\n // Stats & State\n // ============================================================================\n /**\n * Get the current renderer type\n */\n getRendererType() {\n return this.config.renderer;\n }\n /**\n * Switch to a different renderer at runtime\n * The worker will destroy the old renderer and create a new one\n */\n setRenderer(rendererType) {\n this.config.renderer = rendererType;\n this.sendToWorker({ type: \"setRenderer\", renderer: rendererType });\n }\n /**\n * Get the latest stats from the compositor\n */\n getStats() {\n return this.lastStats;\n }\n /**\n * Get the compositor configuration\n */\n getConfig() {\n return { ...this.config };\n }\n /**\n * Update output configuration (resolution / frame rate).\n * Resizes the output canvas and reinitializes the renderer.\n */\n updateOutputConfig(config) {\n const nextWidth = config.width ?? this.config.width;\n const nextHeight = config.height ?? this.config.height;\n const nextFrameRate = config.frameRate ?? this.config.frameRate;\n const changed = nextWidth !== this.config.width ||\n nextHeight !== this.config.height ||\n nextFrameRate !== this.config.frameRate;\n if (!changed)\n return false;\n this.config.width = nextWidth;\n this.config.height = nextHeight;\n this.config.frameRate = nextFrameRate;\n // Canvas size must be updated in the worker (OffscreenCanvas after transfer).\n // Updating the HTMLCanvasElement here throws once control is transferred.\n this.sendToWorker({\n type: \"resize\",\n width: nextWidth,\n height: nextHeight,\n frameRate: nextFrameRate,\n });\n return true;\n }\n /**\n * Check if the compositor is initialized\n */\n isInitialized() {\n return this.workerReady;\n }\n // ============================================================================\n // Cleanup\n // ============================================================================\n /**\n * Destroy the SceneManager and release all resources\n */\n destroy() {\n // Stop all frame processors and cancel readers\n for (const [sourceId] of this.frameProcessors) {\n this.unbindSource(sourceId);\n }\n this.frameProcessors.clear();\n this.frameReaders.clear();\n // Terminate the worker\n if (this.worker) {\n this.sendToWorker({ type: \"destroy\" });\n this.worker.terminate();\n this.worker = null;\n }\n // Clear scenes\n this.scenes.clear();\n this.activeSceneId = null;\n // Clear output\n this.outputStream = null;\n this.outputCanvas = null;\n this.workerReady = false;\n this.removeAllListeners();\n }\n}\n\nexport { SceneManager };\n//# sourceMappingURL=SceneManager.js.map\n","/**\n * Transition Engine\n *\n * Manages smooth transitions between scenes with configurable easing.\n *\n * Supported transition types:\n * - cut: Instant switch (no animation)\n * - fade: Cross-dissolve between scenes\n * - slide-left/right/up/down: Sliding panel transition\n *\n * Easing functions:\n * - linear: Constant speed\n * - ease-in: Start slow, end fast\n * - ease-out: Start fast, end slow\n * - ease-in-out: Start slow, accelerate, end slow\n */\n/**\n * Standard easing functions based on Robert Penner's easing equations\n */\nconst EASING_FUNCTIONS = {\n linear: (t) => t,\n \"ease-in\": (t) => t * t,\n \"ease-out\": (t) => t * (2 - t),\n \"ease-in-out\": (t) => (t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t),\n};\n// ============================================================================\n// TransitionEngine Class\n// ============================================================================\n/**\n * Engine for managing scene transitions with timing and easing\n */\nclass TransitionEngine {\n constructor() {\n this.state = null;\n this.easing = EASING_FUNCTIONS.linear;\n }\n /**\n * Start a new transition between scenes\n *\n * @param fromSceneId - ID of the scene being transitioned from\n * @param toSceneId - ID of the scene being transitioned to\n * @param config - Transition configuration (type, duration, easing)\n */\n start(fromSceneId, toSceneId, config) {\n this.state = {\n active: true,\n type: config.type,\n progress: 0,\n fromSceneId,\n toSceneId,\n startTime: performance.now(),\n durationMs: config.durationMs,\n };\n this.easing = EASING_FUNCTIONS[config.easing] || EASING_FUNCTIONS.linear;\n // For 'cut' transitions, immediately complete\n if (config.type === \"cut\") {\n this.state.progress = 1;\n this.state.active = false;\n }\n }\n /**\n * Update transition progress based on elapsed time\n * Call this every frame during a transition\n *\n * @returns Current transition state, or null if no transition is active\n */\n update() {\n if (!this.state?.active) {\n return null;\n }\n const elapsed = performance.now() - this.state.startTime;\n const rawProgress = Math.min(1, elapsed / this.state.durationMs);\n // Apply easing to get smooth progress\n this.state.progress = this.easing(rawProgress);\n // Check if transition is complete\n if (rawProgress >= 1) {\n this.state.active = false;\n this.state.progress = 1; // Ensure we end at exactly 1\n }\n return this.state;\n }\n /**\n * Check if a transition is currently active\n */\n isActive() {\n return this.state?.active ?? false;\n }\n /**\n * Get the current transition progress (0-1, with easing applied)\n */\n getProgress() {\n return this.state?.progress ?? 0;\n }\n /**\n * Get the raw linear progress (0-1, without easing)\n */\n getRawProgress() {\n if (!this.state?.active) {\n return this.state?.progress ?? 0;\n }\n const elapsed = performance.now() - this.state.startTime;\n return Math.min(1, elapsed / this.state.durationMs);\n }\n /**\n * Get the current transition type\n */\n getType() {\n return this.state?.type ?? \"cut\";\n }\n /**\n * Get the source scene ID (scene being transitioned from)\n */\n getFromSceneId() {\n return this.state?.fromSceneId ?? null;\n }\n /**\n * Get the target scene ID (scene being transitioned to)\n */\n getToSceneId() {\n return this.state?.toSceneId ?? null;\n }\n /**\n * Get remaining time in milliseconds\n */\n getRemainingTime() {\n if (!this.state?.active) {\n return 0;\n }\n const elapsed = performance.now() - this.state.startTime;\n return Math.max(0, this.state.durationMs - elapsed);\n }\n /**\n * Get the full transition state (for serialization/debugging)\n */\n getState() {\n return this.state ? { ...this.state } : null;\n }\n /**\n * Cancel the current transition\n * The transition will stop at its current progress\n */\n cancel() {\n if (this.state) {\n this.state.active = false;\n }\n }\n /**\n * Force-complete the current transition\n * Jumps to the end state immediately\n */\n complete() {\n if (this.state) {\n this.state.active = false;\n this.state.progress = 1;\n }\n }\n /**\n * Reset the engine, clearing any transition state\n */\n reset() {\n this.state = null;\n this.easing = EASING_FUNCTIONS.linear;\n }\n}\n// ============================================================================\n// Factory Functions\n// ============================================================================\n/**\n * Create a default transition configuration\n */\nfunction createDefaultTransitionConfig() {\n return {\n type: \"fade\",\n durationMs: 500,\n easing: \"ease-in-out\",\n };\n}\n/**\n * Create a cut (instant) transition configuration\n */\nfunction createCutTransition() {\n return {\n type: \"cut\",\n durationMs: 0,\n easing: \"linear\",\n };\n}\n/**\n * Create a fade transition configuration\n */\nfunction createFadeTransition(durationMs = 500, easing = \"ease-in-out\") {\n return {\n type: \"fade\",\n durationMs,\n easing,\n };\n}\n/**\n * Create a slide transition configuration\n */\nfunction createSlideTransition(direction = \"left\", durationMs = 500, easing = \"ease-in-out\") {\n return {\n type: `slide-${direction}`,\n durationMs,\n easing,\n };\n}\n// ============================================================================\n// Utility Functions\n// ============================================================================\n/**\n * Get all available transition types\n */\nfunction getAvailableTransitionTypes() {\n return [\"cut\", \"fade\", \"slide-left\", \"slide-right\", \"slide-up\", \"slide-down\"];\n}\n/**\n * Get all available easing types\n */\nfunction getAvailableEasingTypes() {\n return [\"linear\", \"ease-in\", \"ease-out\", \"ease-in-out\"];\n}\n/**\n * Validate a transition configuration\n */\nfunction validateTransitionConfig(config) {\n return {\n type: config.type || \"fade\",\n durationMs: Math.max(0, config.durationMs ?? 500),\n easing: config.easing || \"ease-in-out\",\n };\n}\n\nexport { TransitionEngine, createCutTransition, createDefaultTransitionConfig, createFadeTransition, createSlideTransition, getAvailableEasingTypes, getAvailableTransitionTypes, validateTransitionConfig };\n//# sourceMappingURL=TransitionEngine.js.map\n","import { TypedEventEmitter } from './EventEmitter.js';\n\n/**\n * Encoder Manager\n * Manages WebCodecs encoder worker from main thread\n * Handles frame transfer via MediaStreamTrackProcessor\n *\n * Output: Encoded chunks emitted via 'videoChunk' and 'audioChunk' events\n * (for RTCRtpScriptTransform injection)\n */\n// ============================================================================\n// Default encoder settings\n// ============================================================================\nconst DEFAULT_VIDEO_SETTINGS = {\n professional: {\n codec: \"avc1.4d0032\", // H.264 High Profile Level 5.0\n width: 1920,\n height: 1080,\n bitrate: 8000000,\n framerate: 30,\n },\n broadcast: {\n codec: \"avc1.4d0028\", // H.264 High Profile Level 4.0\n width: 1920,\n height: 1080,\n bitrate: 4500000,\n framerate: 30,\n },\n conference: {\n codec: \"avc1.4d001f\", // H.264 High Profile Level 3.1\n width: 1280,\n height: 720,\n bitrate: 2500000,\n framerate: 30,\n },\n low: {\n codec: \"avc1.42001e\", // H.264 Baseline Profile Level 3.0\n width: 640,\n height: 480,\n bitrate: 1000000,\n framerate: 24,\n },\n};\nconst DEFAULT_AUDIO_SETTINGS = {\n codec: \"opus\",\n sampleRate: 48000,\n numberOfChannels: 2,\n bitrate: 128000,\n};\n// ============================================================================\n// EncoderManager\n// ============================================================================\nclass EncoderManager extends TypedEventEmitter {\n constructor(options = {}) {\n super();\n this.worker = null;\n this.videoProcessor = null;\n this.audioProcessor = null;\n this.videoReader = null;\n this.audioReader = null;\n this.isRunning = false;\n this.isInitialized = false;\n this.stats = null;\n this.config = null;\n // Pending request tracking for async handshake\n this.pendingRequests = new Map();\n this.requestCounter = 0;\n this.providedWorker = null;\n this.options = {\n workerUrl: options.workerUrl ?? \"\",\n debug: options.debug ?? false,\n timeout: options.timeout ?? 10000,\n };\n // Store pre-constructed worker if provided\n this.providedWorker = options.worker ?? null;\n }\n // ==========================================================================\n // Debug logging\n // ==========================================================================\n log(message, data) {\n if (this.options.debug) {\n console.log(`[EncoderManager] ${message}`, data ?? \"\");\n }\n }\n // ==========================================================================\n // Request/response helpers\n // ==========================================================================\n generateRequestId() {\n return `req_${++this.requestCounter}_${Date.now()}`;\n }\n sendRequest(message) {\n return new Promise((resolve, reject) => {\n if (!this.worker) {\n reject(new Error(\"Worker not created\"));\n return;\n }\n const requestId = message.requestId;\n if (!requestId) {\n // Fire-and-forget message (videoFrame, audioData)\n this.worker.postMessage(message);\n resolve(undefined);\n return;\n }\n const timer = setTimeout(() => {\n this.pendingRequests.delete(requestId);\n reject(new Error(`Request ${requestId} timed out`));\n }, this.options.timeout);\n this.pendingRequests.set(requestId, {\n resolve: resolve,\n reject,\n timer,\n });\n this.worker.postMessage(message);\n });\n }\n handleResponse(requestId, success, error) {\n const pending = this.pendingRequests.get(requestId);\n if (!pending)\n return;\n clearTimeout(pending.timer);\n this.pendingRequests.delete(requestId);\n if (success) {\n pending.resolve();\n }\n else {\n pending.reject(new Error(error ?? \"Unknown error\"));\n }\n }\n // ==========================================================================\n // Worker creation\n // ==========================================================================\n /**\n * Try to create a worker from a URL and wait for it to be ready\n * Returns the worker if successful, null if it fails to load\n */\n tryCreateWorker(url, useModule = true) {\n return new Promise((resolve) => {\n try {\n const worker = new Worker(url, useModule ? { type: \"module\" } : undefined);\n let resolved = false;\n const cleanup = () => {\n worker.removeEventListener(\"message\", onMessage);\n worker.removeEventListener(\"error\", onError);\n };\n const onMessage = (_e) => {\n // Worker loaded and sent a message - it's working\n if (!resolved) {\n resolved = true;\n cleanup();\n // Put the message back by re-dispatching after we return\n // Actually, we need to handle this message in initialize()\n // For now, just resolve - the worker is loaded\n resolve(worker);\n }\n };\n const onError = (e) => {\n if (!resolved) {\n resolved = true;\n cleanup();\n this.log(\"Worker failed to load from: \" + url.toString(), e.message);\n worker.terminate();\n resolve(null);\n }\n };\n worker.addEventListener(\"message\", onMessage);\n worker.addEventListener(\"error\", onError);\n // Timeout - if no message or error within 2 seconds, assume it's loading but slow\n // We'll resolve with the worker and let initialize() handle the timeout\n setTimeout(() => {\n if (!resolved) {\n resolved = true;\n cleanup();\n resolve(worker);\n }\n }, 2000);\n }\n catch (e) {\n this.log(\"Failed to create worker: \" + url.toString(), e);\n resolve(null);\n }\n });\n }\n async createWorkerAsync() {\n // Priority 1: Use pre-constructed worker if provided\n if (this.providedWorker) {\n this.log(\"Using provided worker instance\");\n return this.providedWorker;\n }\n // Priority 2: Use explicit worker URL if provided\n if (this.options.workerUrl) {\n this.log(\"Creating worker from URL:\", this.options.workerUrl);\n const worker = await this.tryCreateWorker(this.options.workerUrl);\n if (worker)\n return worker;\n }\n // Build list of URLs to try\n const urlsToTry = [];\n // Priority 3: Try loading relative to built module\n try {\n const workerUrl = new URL(\"../workers/encoder.worker.js\", import.meta.url);\n urlsToTry.push({ url: workerUrl, description: \"import.meta.url relative\" });\n }\n catch {\n // URL construction failed, skip\n }\n // Priority 4: Fallback paths for various environments\n urlsToTry.push({ url: \"/workers/encoder.worker.js\", description: \"Vite dev server\" }, {\n url: \"/node_modules/@livepeer-frameworks/streamcrafter-core/dist/workers/encoder.worker.js\",\n description: \"node_modules\",\n }, { url: \"./workers/encoder.worker.js\", description: \"relative path\" });\n // Try each URL in sequence\n for (const { url, description } of urlsToTry) {\n this.log(`Trying worker path: ${url.toString()} (${description})`);\n const worker = await this.tryCreateWorker(url);\n if (worker) {\n this.log(\"Worker loaded from:\", url.toString());\n return worker;\n }\n }\n throw new Error(\"Failed to create encoder worker. \" +\n \"Provide a worker URL via options.workerUrl or ensure workers are served correctly.\");\n }\n // Synchronous wrapper for backwards compatibility - creates worker optimistically\n createWorker() {\n // For sync creation, just try the most likely path\n // The async initialization will handle failures\n if (this.providedWorker) {\n return this.providedWorker;\n }\n if (this.options.workerUrl) {\n return new Worker(this.options.workerUrl, { type: \"module\" });\n }\n // Try import.meta.url first (works in production builds)\n try {\n const workerUrl = new URL(\"../workers/encoder.worker.js\", import.meta.url);\n return new Worker(workerUrl, { type: \"module\" });\n }\n catch {\n // Fall through\n }\n // Try common fallback paths\n return new Worker(\"/workers/encoder.worker.js\", { type: \"module\" });\n }\n // ==========================================================================\n // Worker message handling\n // ==========================================================================\n handleWorkerMessage(message) {\n switch (message.type) {\n case \"ready\":\n this.log(\"Worker ready\");\n if (message.requestId) {\n this.handleResponse(message.requestId, true);\n }\n this.emit(\"ready\", undefined);\n break;\n case \"started\":\n this.log(\"Encoding started\");\n if (message.requestId) {\n this.handleResponse(message.requestId, true);\n }\n this.emit(\"started\", undefined);\n break;\n case \"stopped\":\n this.log(\"Encoding stopped\");\n if (message.requestId) {\n this.handleResponse(message.requestId, true);\n }\n this.emit(\"stopped\", undefined);\n break;\n case \"flushed\":\n this.log(\"Encoder flushed\");\n if (message.requestId) {\n this.handleResponse(message.requestId, true);\n }\n break;\n case \"stats\":\n this.stats = message.data;\n this.emit(\"stats\", this.stats);\n break;\n case \"error\": {\n const error = message.data;\n console.error(\"[EncoderManager] Worker error:\", error);\n if (message.requestId) {\n this.handleResponse(message.requestId, false, error.message);\n }\n this.emit(\"error\", error);\n break;\n }\n case \"encodedVideoChunk\":\n this.emit(\"videoChunk\", message.data);\n break;\n case \"encodedAudioChunk\":\n this.emit(\"audioChunk\", message.data);\n break;\n default:\n this.log(\"Unknown message from worker\", message);\n }\n }\n // ==========================================================================\n // Public API\n // ==========================================================================\n /**\n * Initialize the encoder with a media stream and config.\n * Creates the worker, sends initialize message, and waits for ready ack.\n */\n async initialize(stream, config) {\n this.log(\"Initializing encoder\", config);\n this.config = config;\n // Check for WebCodecs support\n if (typeof VideoEncoder === \"undefined\" || typeof AudioEncoder === \"undefined\") {\n throw new Error(\"WebCodecs not supported in this browser\");\n }\n // Check for MediaStreamTrackProcessor support\n if (typeof MediaStreamTrackProcessor === \"undefined\") {\n throw new Error(\"MediaStreamTrackProcessor not supported in this browser\");\n }\n // Get input tracks\n const videoTrack = stream.getVideoTracks()[0];\n const audioTrack = stream.getAudioTracks()[0];\n // Create track processors for input\n if (videoTrack) {\n this.videoProcessor = new MediaStreamTrackProcessor({ track: videoTrack });\n }\n if (audioTrack) {\n this.audioProcessor = new MediaStreamTrackProcessor({ track: audioTrack });\n }\n // Create worker using async method that tries multiple paths\n this.worker = await this.createWorkerAsync();\n this.worker.onmessage = (event) => {\n this.handleWorkerMessage(event.data);\n };\n this.worker.onerror = (error) => {\n console.error(\"[EncoderManager] Worker error:\", error);\n this.emit(\"error\", { message: error.message, fatal: true });\n };\n // Send initialize message and wait for ready\n const requestId = this.generateRequestId();\n this.log(\"Sending initialize to worker\", { requestId });\n await this.sendRequest({\n type: \"initialize\",\n requestId,\n data: { config },\n });\n this.isInitialized = true;\n this.log(\"Worker initialized and ready\");\n }\n /**\n * Start encoding.\n * Sends start message, waits for started ack, then begins frame processing.\n */\n async start() {\n if (!this.isInitialized) {\n throw new Error(\"EncoderManager not initialized\");\n }\n if (this.isRunning) {\n return;\n }\n this.log(\"Starting encoder\");\n // Send start message and wait for started ack\n const requestId = this.generateRequestId();\n await this.sendRequest({\n type: \"start\",\n requestId,\n });\n this.isRunning = true;\n // Now start frame processing (only after worker is ready)\n if (this.videoProcessor) {\n this.startVideoProcessing();\n }\n if (this.audioProcessor) {\n this.startAudioProcessing();\n }\n this.log(\"Encoder started, frame processing active\");\n }\n /**\n * Start video frame processing loop.\n * Reads frames from MediaStreamTrackProcessor and sends to worker.\n */\n async startVideoProcessing() {\n if (!this.videoProcessor || !this.worker)\n return;\n try {\n this.videoReader = this.videoProcessor.readable.getReader();\n const reader = this.videoReader;\n while (this.isRunning) {\n const { value: frame, done } = await reader.read();\n if (done || !frame) {\n break;\n }\n try {\n // Transfer frame to worker (zero-copy)\n this.worker.postMessage({ type: \"videoFrame\", data: frame }, [frame]);\n }\n catch (error) {\n console.error(\"[EncoderManager] Error sending video frame:\", error);\n try {\n frame.close();\n }\n catch {\n // Ignore\n }\n }\n }\n }\n catch (error) {\n if (this.isRunning) {\n console.error(\"[EncoderManager] Video processing error:\", error);\n }\n }\n }\n /**\n * Start audio data processing loop.\n */\n async startAudioProcessing() {\n if (!this.audioProcessor || !this.worker)\n return;\n try {\n this.audioReader = this.audioProcessor.readable.getReader();\n const reader = this.audioReader;\n while (this.isRunning) {\n const { value: audioData, done } = await reader.read();\n if (done || !audioData) {\n break;\n }\n try {\n this.worker.postMessage({ type: \"audioData\", data: audioData }, [audioData]);\n }\n catch (error) {\n console.error(\"[EncoderManager] Error sending audio data:\", error);\n try {\n audioData.close();\n }\n catch {\n // Ignore\n }\n }\n }\n }\n catch (error) {\n if (this.isRunning) {\n console.error(\"[EncoderManager] Audio processing error:\", error);\n }\n }\n }\n /**\n * Stop encoding.\n */\n async stop() {\n if (!this.isRunning) {\n return;\n }\n this.isRunning = false;\n this.log(\"Stopping encoder\");\n // Cancel readers\n if (this.videoReader) {\n try {\n await this.videoReader.cancel();\n this.videoReader.releaseLock();\n }\n catch {\n // Ignore\n }\n this.videoReader = null;\n }\n if (this.audioReader) {\n try {\n await this.audioReader.cancel();\n this.audioReader.releaseLock();\n }\n catch {\n // Ignore\n }\n this.audioReader = null;\n }\n // Tell worker to stop\n if (this.worker && this.isInitialized) {\n const requestId = this.generateRequestId();\n try {\n await this.sendRequest({\n type: \"stop\",\n requestId,\n });\n }\n catch (error) {\n this.log(\"Stop request failed (may be expected)\", error);\n }\n }\n this.emit(\"stopped\", undefined);\n }\n /**\n * Update encoder configuration (e.g., bitrate).\n */\n async updateConfig(config) {\n if (!this.worker || !this.isInitialized) {\n throw new Error(\"EncoderManager not initialized\");\n }\n const requestId = this.generateRequestId();\n await this.sendRequest({\n type: \"updateConfig\",\n requestId,\n data: config,\n });\n // Update local config\n if (this.config) {\n if (config.video) {\n this.config.video = { ...this.config.video, ...config.video };\n }\n if (config.audio) {\n this.config.audio = { ...this.config.audio, ...config.audio };\n }\n }\n }\n /**\n * Update the input stream (hot-swap tracks).\n * Swaps to new tracks without reinitializing the encoder.\n * Used when sources change while streaming.\n */\n async updateInputStream(stream) {\n if (!this.isInitialized || !this.worker) {\n throw new Error(\"EncoderManager not initialized\");\n }\n const wasRunning = this.isRunning;\n this.log(\"Updating input stream (hot-swap)\", { wasRunning });\n // Cancel existing readers to stop read loops\n if (this.videoReader) {\n try {\n await this.videoReader.cancel();\n this.videoReader.releaseLock();\n }\n catch {\n // Ignore - reader may already be closed\n }\n this.videoReader = null;\n }\n if (this.audioReader) {\n try {\n await this.audioReader.cancel();\n this.audioReader.releaseLock();\n }\n catch {\n // Ignore - reader may already be closed\n }\n this.audioReader = null;\n }\n // Create new processors from new tracks\n const videoTrack = stream.getVideoTracks()[0];\n const audioTrack = stream.getAudioTracks()[0];\n if (videoTrack) {\n this.videoProcessor = new MediaStreamTrackProcessor({ track: videoTrack });\n }\n else {\n this.videoProcessor = null;\n }\n if (audioTrack) {\n this.audioProcessor = new MediaStreamTrackProcessor({ track: audioTrack });\n }\n else {\n this.audioProcessor = null;\n }\n // Restart processing if we were running\n if (wasRunning) {\n if (this.videoProcessor) {\n this.startVideoProcessing();\n }\n if (this.audioProcessor) {\n this.startAudioProcessing();\n }\n this.log(\"Input stream updated, processing restarted\");\n }\n }\n /**\n * Flush encoder buffers.\n */\n async flush() {\n if (!this.worker || !this.isInitialized) {\n return;\n }\n const requestId = this.generateRequestId();\n await this.sendRequest({\n type: \"flush\",\n requestId,\n });\n }\n /**\n * Get current stats.\n */\n getStats() {\n return this.stats;\n }\n /**\n * Get current config.\n */\n getConfig() {\n return this.config;\n }\n /**\n * Check if encoder is initialized.\n */\n getIsInitialized() {\n return this.isInitialized;\n }\n /**\n * Check if encoder is running.\n */\n getIsRunning() {\n return this.isRunning;\n }\n /**\n * Destroy the encoder manager.\n */\n destroy() {\n this.stop();\n this.isInitialized = false;\n // Clear processors\n this.videoProcessor = null;\n this.audioProcessor = null;\n // Clear pending requests\n for (const [, pending] of this.pendingRequests) {\n clearTimeout(pending.timer);\n pending.reject(new Error(\"EncoderManager destroyed\"));\n }\n this.pendingRequests.clear();\n // Terminate worker\n if (this.worker) {\n this.worker.terminate();\n this.worker = null;\n }\n this.removeAllListeners();\n }\n}\n/**\n * Select appropriate H.264 codec profile/level based on resolution and framerate.\n * Uses High Profile with the minimum level that supports the given parameters.\n *\n * H.264 Level capabilities (High Profile):\n * - Level 3.1 (4d001f): 1280x720 @ 30fps, 14 Mbps\n * - Level 4.0 (4d0028): 1920x1080 @ 30fps or 1280x720 @ 60fps, 20 Mbps\n * - Level 5.0 (4d0032): 1920x1080 @ 60fps or 2560x1440 @ 30fps, 25 Mbps\n * - Level 5.1 (4d0033): 2560x1440 @ 60fps or 3840x2160 @ 30fps, 40 Mbps\n * - Level 5.2 (4d0034): 3840x2160 @ 60fps, 60 Mbps\n */\nfunction selectH264Codec(width, height, framerate) {\n const pixels = width * height;\n // 4K (3840x2160)\n if (pixels >= 3840 * 2160) {\n return framerate > 30 ? \"avc1.640034\" : \"avc1.640033\"; // Level 5.2 or 5.1\n }\n // 1440p (2560x1440)\n if (pixels >= 2560 * 1440) {\n return framerate > 30 ? \"avc1.640033\" : \"avc1.640032\"; // Level 5.1 or 5.0\n }\n // 1080p (1920x1080)\n if (pixels >= 1920 * 1080) {\n return framerate > 30 ? \"avc1.640032\" : \"avc1.64002a\"; // Level 5.0 or 4.2\n }\n // 720p (1280x720)\n if (pixels >= 1280 * 720) {\n return framerate > 30 ? \"avc1.64002a\" : \"avc1.640028\"; // Level 4.2 or 4.0\n }\n // Lower resolutions\n return \"avc1.64001f\"; // Level 3.1 (High Profile)\n}\n/**\n * Create default encoder config for a quality profile.\n * Optionally merge with encoder overrides from UI.\n * Automatically selects an appropriate H.264 codec based on final resolution/framerate.\n */\nfunction createEncoderConfig(profile = \"broadcast\", overrides) {\n const baseVideo = DEFAULT_VIDEO_SETTINGS[profile];\n const baseAudio = DEFAULT_AUDIO_SETTINGS;\n // Calculate final video settings\n const finalWidth = overrides?.video?.width ?? baseVideo.width;\n const finalHeight = overrides?.video?.height ?? baseVideo.height;\n const finalFramerate = overrides?.video?.framerate ?? baseVideo.framerate;\n // Select appropriate codec for final resolution/framerate\n const codec = selectH264Codec(finalWidth, finalHeight, finalFramerate);\n return {\n video: {\n ...baseVideo,\n codec, // Use dynamically selected codec\n width: finalWidth,\n height: finalHeight,\n framerate: finalFramerate,\n ...(overrides?.video?.bitrate !== undefined && { bitrate: overrides.video.bitrate }),\n },\n audio: {\n ...baseAudio,\n ...(overrides?.audio?.bitrate !== undefined && { bitrate: overrides.audio.bitrate }),\n ...(overrides?.audio?.sampleRate !== undefined && { sampleRate: overrides.audio.sampleRate }),\n ...(overrides?.audio?.numberOfChannels !== undefined && {\n numberOfChannels: overrides.audio.numberOfChannels,\n }),\n },\n };\n}\n\nexport { DEFAULT_AUDIO_SETTINGS, DEFAULT_VIDEO_SETTINGS, EncoderManager, createEncoderConfig };\n//# sourceMappingURL=EncoderManager.js.map\n","/**\n * Browser Feature Detection\n * Detects WebCodecs, WebRTC, and MediaDevices capabilities\n */\n/**\n * Detect all browser capabilities for streaming\n */\nfunction detectCapabilities() {\n const webcodecs = {\n videoEncoder: typeof VideoEncoder !== \"undefined\",\n audioEncoder: typeof AudioEncoder !== \"undefined\",\n mediaStreamTrackProcessor: typeof MediaStreamTrackProcessor !== \"undefined\",\n mediaStreamTrackGenerator: typeof MediaStreamTrackGenerator !== \"undefined\",\n };\n const webrtc = {\n peerConnection: typeof RTCPeerConnection !== \"undefined\",\n replaceTrack: typeof RTCRtpSender !== \"undefined\" && \"replaceTrack\" in RTCRtpSender.prototype,\n insertableStreams: typeof RTCRtpSender !== \"undefined\" && \"createEncodedStreams\" in RTCRtpSender.prototype,\n scriptTransform: typeof RTCRtpScriptTransform !== \"undefined\",\n };\n const mediaDevices = {\n getUserMedia: typeof navigator !== \"undefined\" &&\n typeof navigator.mediaDevices !== \"undefined\" &&\n typeof navigator.mediaDevices.getUserMedia === \"function\",\n getDisplayMedia: typeof navigator !== \"undefined\" &&\n typeof navigator.mediaDevices !== \"undefined\" &&\n typeof navigator.mediaDevices.getDisplayMedia === \"function\",\n enumerateDevices: typeof navigator !== \"undefined\" &&\n typeof navigator.mediaDevices !== \"undefined\" &&\n typeof navigator.mediaDevices.enumerateDevices === \"function\",\n };\n // Determine recommended path\n const webCodecsFullSupport = webcodecs.videoEncoder &&\n webcodecs.audioEncoder &&\n webcodecs.mediaStreamTrackProcessor &&\n webcodecs.mediaStreamTrackGenerator;\n const recommended = webCodecsFullSupport\n ? \"webcodecs\"\n : \"mediastream\";\n return {\n webcodecs,\n webrtc,\n mediaDevices,\n recommended,\n };\n}\n/**\n * Check if WebCodecs is fully supported\n */\nfunction isWebCodecsSupported() {\n return (typeof VideoEncoder !== \"undefined\" &&\n typeof AudioEncoder !== \"undefined\" &&\n typeof MediaStreamTrackProcessor !== \"undefined\" &&\n typeof MediaStreamTrackGenerator !== \"undefined\");\n}\n/**\n * Check if basic WebRTC is supported\n */\nfunction isWebRTCSupported() {\n return typeof RTCPeerConnection !== \"undefined\";\n}\n/**\n * Check if media devices API is available\n */\nfunction isMediaDevicesSupported() {\n return (typeof navigator !== \"undefined\" &&\n typeof navigator.mediaDevices !== \"undefined\" &&\n typeof navigator.mediaDevices.getUserMedia === \"function\");\n}\n/**\n * Check if screen capture is supported\n */\nfunction isScreenCaptureSupported() {\n return (typeof navigator !== \"undefined\" &&\n typeof navigator.mediaDevices !== \"undefined\" &&\n typeof navigator.mediaDevices.getDisplayMedia === \"function\");\n}\n/**\n * Check if RTCRtpScriptTransform is supported\n * This is required for Path C WebCodecs integration (replacing browser-encoded frames)\n */\nfunction isRTCRtpScriptTransformSupported() {\n return typeof RTCRtpScriptTransform !== \"undefined\";\n}\n/**\n * Check if full WebCodecs encoding path is available\n * Requires both WebCodecs support AND RTCRtpScriptTransform for Path C\n */\nfunction isWebCodecsEncodingPathSupported() {\n return isWebCodecsSupported() && isRTCRtpScriptTransformSupported();\n}\n/**\n * Get the recommended streaming path based on browser capabilities\n */\nfunction getRecommendedPath() {\n return isWebCodecsSupported() ? \"webcodecs\" : \"mediastream\";\n}\n/**\n * Check if a specific video codec is supported for encoding\n */\nasync function isVideoCodecSupported(codec) {\n if (!isWebCodecsSupported()) {\n return false;\n }\n try {\n const support = await VideoEncoder.isConfigSupported({\n codec,\n width: 1920,\n height: 1080,\n bitrate: 2000000,\n framerate: 30,\n });\n return support.supported === true;\n }\n catch {\n return false;\n }\n}\n/**\n * Check if a specific audio codec is supported for encoding\n */\nasync function isAudioCodecSupported(codec) {\n if (!isWebCodecsSupported()) {\n return false;\n }\n try {\n const support = await AudioEncoder.isConfigSupported({\n codec,\n sampleRate: 48000,\n numberOfChannels: 2,\n bitrate: 128000,\n });\n return support.supported === true;\n }\n catch {\n return false;\n }\n}\n/**\n * Get list of likely supported video codecs\n */\nasync function getSupportedVideoCodecs() {\n const codecs = [\n \"avc1.42E01E\", // H.264 Baseline\n \"avc1.4D401E\", // H.264 Main\n \"avc1.64001E\", // H.264 High\n \"vp8\",\n \"vp09.00.10.08\", // VP9 Profile 0\n ];\n const supported = [];\n for (const codec of codecs) {\n if (await isVideoCodecSupported(codec)) {\n supported.push(codec);\n }\n }\n return supported;\n}\n/**\n * Get list of likely supported audio codecs\n */\nasync function getSupportedAudioCodecs() {\n const codecs = [\"opus\", \"mp4a.40.2\"]; // Opus, AAC-LC\n const supported = [];\n for (const codec of codecs) {\n if (await isAudioCodecSupported(codec)) {\n supported.push(codec);\n }\n }\n return supported;\n}\n\nexport { detectCapabilities, getRecommendedPath, getSupportedAudioCodecs, getSupportedVideoCodecs, isAudioCodecSupported, isMediaDevicesSupported, isRTCRtpScriptTransformSupported, isScreenCaptureSupported, isVideoCodecSupported, isWebCodecsEncodingPathSupported, isWebCodecsSupported, isWebRTCSupported };\n//# sourceMappingURL=FeatureDetection.js.map\n","import { TypedEventEmitter } from './EventEmitter.js';\nimport { DeviceManager } from './DeviceManager.js';\nimport { ScreenCapture } from './ScreenCapture.js';\nimport { WhipClient } from './WhipClient.js';\nimport { AudioMixer } from './AudioMixer.js';\nimport { ReconnectionManager } from './ReconnectionManager.js';\nimport { SceneManager } from './SceneManager.js';\nimport { EncoderManager, createEncoderConfig } from './EncoderManager.js';\nimport { detectCapabilities, isRTCRtpScriptTransformSupported } from './FeatureDetection.js';\nimport { getVideoConstraints } from './MediaConstraints.js';\nimport { DEFAULT_COMPOSITOR_CONFIG } from '../types.js';\n\n/**\n * Ingest Controller V2\n * Enhanced orchestrator with Phase 2 features:\n * - Multi-source support (camera + screen simultaneously)\n * - Audio mixing\n * - Quality profile switching\n * - Automatic reconnection with exponential backoff\n */\nlet sourceIdCounter = 0;\nfunction generateSourceId(type) {\n return `${type}-${++sourceIdCounter}-${Date.now()}`;\n}\nclass IngestControllerV2 extends TypedEventEmitter {\n constructor(config) {\n super();\n this.whipClient = null;\n this.whipEndpoints = [];\n this.currentEndpointIndex = 0;\n this.isStoppingIntentionally = false;\n this.state = \"idle\";\n this.stateContext = {};\n this.sources = new Map();\n this.outputStream = null;\n this.statsInterval = null;\n this.lastStats = null;\n this.statsInFlight = false;\n // Phase 3: Compositor\n this.sceneManager = null;\n this.compositorBaseConfig = null;\n // Phase 2.5: WebCodecs Encoder (Path C)\n this.encoderManager = null;\n this.encoderOverrides = {};\n this.config = config;\n this.currentProfile = config.profile || \"broadcast\";\n this.whipEndpoints = this.buildWhipEndpoints(config);\n this.deviceManager = new DeviceManager();\n this.screenCapture = new ScreenCapture();\n this.audioMixer = new AudioMixer();\n this.reconnectionManager = new ReconnectionManager(config.reconnection);\n // Determine if we should use WebCodecs\n const capabilities = detectCapabilities();\n this.useWebCodecs = config.useWebCodecs ?? capabilities.recommended === \"webcodecs\";\n // Set up event forwarding\n this.setupEventForwarding();\n this.log(\"IngestControllerV2 initialized\", {\n useWebCodecs: this.useWebCodecs,\n profile: this.currentProfile,\n audioMixing: config.audioMixing ?? false,\n });\n }\n /**\n * Build WHIP endpoint list with primary first.\n */\n buildWhipEndpoints(config) {\n if (config.whipUrls && config.whipUrls.length > 0) {\n const deduped = [config.whipUrl, ...config.whipUrls].filter((value, index, self) => self.indexOf(value) === index);\n return deduped;\n }\n return [config.whipUrl];\n }\n /**\n * Get current WHIP endpoint without rotating.\n */\n getCurrentWhipUrl() {\n return this.whipEndpoints[this.currentEndpointIndex] ?? this.config.whipUrl;\n }\n /**\n * Rotate to next WHIP endpoint if available.\n */\n getNextWhipUrl() {\n if (this.whipEndpoints.length > 1) {\n this.currentEndpointIndex = (this.currentEndpointIndex + 1) % this.whipEndpoints.length;\n }\n return this.getCurrentWhipUrl();\n }\n /**\n * Debug logging\n */\n log(message, data) {\n if (this.config.debug) {\n console.log(`[IngestControllerV2] ${message}`, data ?? \"\");\n }\n }\n /**\n * Set up event forwarding from child components\n */\n setupEventForwarding() {\n this.deviceManager.on(\"devicesChanged\", (event) => {\n this.emit(\"deviceChange\", event);\n });\n this.deviceManager.on(\"error\", (event) => {\n this.emit(\"error\", { error: event.message, recoverable: true });\n });\n this.screenCapture.on(\"ended\", (event) => {\n this.log(\"Screen capture ended\", event);\n // Find and remove the specific screen source by matching the stream\n if (event.stream) {\n for (const [id, source] of this.sources) {\n if (source.type === \"screen\" && source.stream === event.stream) {\n this.removeSource(id);\n break;\n }\n }\n }\n });\n this.screenCapture.on(\"error\", (event) => {\n this.emit(\"error\", { error: event.message, recoverable: true });\n });\n // Reconnection events\n this.reconnectionManager.on(\"attemptStart\", (event) => {\n this.emit(\"reconnectionAttempt\", {\n attempt: event.attempt,\n maxAttempts: this.reconnectionManager.getMaxAttempts(),\n });\n });\n this.reconnectionManager.on(\"attemptSuccess\", () => {\n this.emit(\"reconnectionSuccess\", undefined);\n this.setState(\"streaming\");\n });\n this.reconnectionManager.on(\"attemptFailed\", (event) => {\n this.log(\"Reconnection attempt failed\", event);\n });\n this.reconnectionManager.on(\"exhausted\", () => {\n this.emit(\"reconnectionFailed\", { error: \"All reconnection attempts exhausted\" });\n this.setState(\"error\", { error: \"Connection lost - reconnection failed\" });\n });\n }\n /**\n * Update state\n */\n setState(newState, context) {\n this.state = newState;\n if (context) {\n this.stateContext = { ...this.stateContext, ...context };\n }\n this.stateContext.sources = Array.from(this.sources.values());\n this.stateContext.activeProfile = this.currentProfile;\n this.stateContext.reconnection = this.reconnectionManager.getState();\n this.emit(\"stateChange\", { state: this.state, context: this.stateContext });\n }\n /**\n * Initialize audio mixer if needed\n */\n async ensureAudioMixer() {\n if (this.config.audioMixing && this.audioMixer.getState() === null) {\n await this.audioMixer.initialize();\n }\n }\n /**\n * Add a media source\n */\n addMediaSource(type, stream, label) {\n const id = generateSourceId(type);\n // Check if this is the first video source (will be primary by default)\n const hasVideoTrack = stream.getVideoTracks().length > 0;\n const existingVideoSources = Array.from(this.sources.values()).filter((s) => s.stream.getVideoTracks().length > 0);\n const isPrimaryVideo = hasVideoTrack && existingVideoSources.length === 0;\n const source = {\n id,\n type,\n stream,\n label,\n active: true,\n muted: false,\n volume: 1.0,\n primaryVideo: isPrimaryVideo,\n };\n this.sources.set(id, source);\n this.log(`Added source: ${id} (${type})`, {\n label,\n tracks: stream.getTracks().length,\n primaryVideo: isPrimaryVideo,\n });\n // Add audio track to mixer if enabled\n if (this.config.audioMixing) {\n const audioTrack = stream.getAudioTracks()[0];\n if (audioTrack) {\n this.audioMixer.addSource(id, audioTrack, { volume: 1.0 });\n }\n }\n // Bind to compositor if enabled\n if (this.sceneManager && this.sceneManager.isInitialized()) {\n this.log(\"Binding source to compositor\", { sourceId: id });\n this.sceneManager.bindSource(id, stream);\n // Add layer to active scene\n const activeScene = this.sceneManager.getActiveScene();\n this.log(\"Adding layer to scene\", {\n sourceId: id,\n activeSceneId: activeScene?.id,\n sceneLayers: activeScene?.layers.length,\n });\n if (activeScene) {\n this.sceneManager.addLayer(activeScene.id, id);\n this.log(\"Layer added\", { sourceId: id, layerCount: activeScene.layers.length });\n }\n }\n else {\n this.log(\"Compositor not ready when adding source\", {\n sourceId: id,\n hasSceneManager: !!this.sceneManager,\n isInitialized: this.sceneManager?.isInitialized() ?? false,\n });\n }\n this.emit(\"sourceAdded\", { source });\n this.updateOutputStreamFromSources();\n return source;\n }\n /**\n * Remove a source by ID\n */\n removeSource(id) {\n const source = this.sources.get(id);\n if (!source)\n return;\n const wasPrimaryVideo = source.primaryVideo;\n // Stop all tracks\n source.stream.getTracks().forEach((track) => track.stop());\n // Remove from audio mixer\n if (this.config.audioMixing) {\n this.audioMixer.removeSource(id);\n }\n // Unbind from compositor\n if (this.sceneManager) {\n this.sceneManager.unbindSource(id);\n // Remove layer from active scene\n const activeScene = this.sceneManager.getActiveScene();\n if (activeScene) {\n const layer = activeScene.layers.find((l) => l.sourceId === id);\n if (layer) {\n this.sceneManager.removeLayer(activeScene.id, layer.id);\n }\n }\n }\n this.sources.delete(id);\n this.log(`Removed source: ${id}`);\n // If this was the primary video, reassign to first available video source\n if (wasPrimaryVideo) {\n const videoSources = Array.from(this.sources.values()).filter((s) => s.stream.getVideoTracks().length > 0);\n if (videoSources.length > 0) {\n videoSources[0].primaryVideo = true;\n this.sources.set(videoSources[0].id, videoSources[0]);\n this.log(`Reassigned primary video to: ${videoSources[0].id}`);\n }\n }\n this.emit(\"sourceRemoved\", { sourceId: id });\n this.updateOutputStreamFromSources();\n }\n /**\n * Set a source as the primary video source\n */\n setPrimaryVideoSource(sourceId) {\n const source = this.sources.get(sourceId);\n if (!source)\n return;\n // Check if this source has video\n if (source.stream.getVideoTracks().length === 0) {\n this.log(`Cannot set source ${sourceId} as primary - no video track`);\n return;\n }\n // Clear primary from all sources\n for (const [id, s] of this.sources) {\n if (s.primaryVideo) {\n s.primaryVideo = false;\n this.sources.set(id, s);\n }\n }\n // Set new primary\n source.primaryVideo = true;\n this.sources.set(sourceId, source);\n this.log(`Set primary video source: ${sourceId}`);\n this.emit(\"sourceUpdated\", { source, changes: { primaryVideo: true } });\n this.updateOutputStreamFromSources();\n }\n /**\n * Get the current primary video source\n */\n getPrimaryVideoSource() {\n for (const source of this.sources.values()) {\n if (source.primaryVideo)\n return source;\n }\n return null;\n }\n /**\n * Update output stream from all sources\n * Phase 2: Primary video + mixed audio\n * Phase 3: Compositor for multi-source composition\n */\n updateOutputStreamFromSources() {\n const sourcesArray = Array.from(this.sources.values()).filter((s) => s.active);\n if (sourcesArray.length === 0) {\n this.outputStream = null;\n return;\n }\n // Create new output stream\n const tracks = [];\n // Phase 3: Use compositor when enabled\n if (this.sceneManager && this.sceneManager.isInitialized()) {\n const compositedTrack = this.sceneManager.getOutputTrack();\n if (compositedTrack) {\n tracks.push(compositedTrack);\n }\n }\n else {\n // Legacy path: Get video track from primary video source\n const videoSourcesWithVideo = sourcesArray.filter((s) => s.stream.getVideoTracks().length > 0);\n const primaryVideoSource = videoSourcesWithVideo.find((s) => s.primaryVideo) || videoSourcesWithVideo[0];\n if (primaryVideoSource) {\n const videoTrack = primaryVideoSource.stream.getVideoTracks()[0];\n if (videoTrack) {\n tracks.push(videoTrack);\n }\n }\n }\n // Get audio (mixed or primary)\n if (this.config.audioMixing && this.audioMixer.getState() === \"running\") {\n const mixedAudioTrack = this.audioMixer.getOutputTrack();\n if (mixedAudioTrack) {\n tracks.push(mixedAudioTrack);\n }\n }\n else {\n // Use first available audio track\n for (const source of sourcesArray) {\n const audioTrack = source.stream.getAudioTracks()[0];\n if (audioTrack && !source.muted) {\n tracks.push(audioTrack);\n break;\n }\n }\n }\n this.outputStream = tracks.length > 0 ? new MediaStream(tracks) : null;\n // Update WHIP client if streaming\n if (this.whipClient && this.state === \"streaming\") {\n this.updateWhipTracks();\n }\n // Update EncoderManager input stream if WebCodecs is active\n if (this.encoderManager && this.outputStream) {\n this.encoderManager.updateInputStream(this.outputStream).catch((err) => {\n this.log(\"Failed to update encoder input stream\", err);\n });\n }\n this.log(\"Output stream updated\", {\n videoTracks: this.outputStream?.getVideoTracks().length ?? 0,\n audioTracks: this.outputStream?.getAudioTracks().length ?? 0,\n usingCompositor: !!this.sceneManager,\n });\n }\n /**\n * Update WHIP client tracks when sources change\n */\n async updateWhipTracks() {\n if (!this.whipClient || !this.outputStream)\n return;\n try {\n const pc = this.whipClient.getPeerConnection();\n if (!pc)\n return;\n const senders = pc.getSenders();\n // Update video track (replaceTrack(null) properly stops sending)\n const newVideoTrack = this.outputStream.getVideoTracks()[0];\n const videoSender = senders.find((s) => s.track?.kind === \"video\");\n if (videoSender) {\n await videoSender.replaceTrack(newVideoTrack ?? null);\n }\n // Update audio track (replaceTrack(null) properly stops sending)\n const newAudioTrack = this.outputStream.getAudioTracks()[0];\n const audioSender = senders.find((s) => s.track?.kind === \"audio\");\n if (audioSender) {\n await audioSender.replaceTrack(newAudioTrack ?? null);\n }\n }\n catch (error) {\n this.log(\"Error updating WHIP tracks\", error);\n }\n }\n /**\n * Start camera capture\n */\n async startCamera(options = {}) {\n this.log(\"Starting camera capture\", options);\n this.setState(\"requesting_permissions\");\n try {\n await this.ensureAudioMixer();\n const profile = options.profile || this.currentProfile;\n // If encoder overrides are set, use them for capture constraints\n const captureOptions = { ...options, profile };\n if (this.encoderOverrides?.video) {\n const videoOverrides = this.encoderOverrides.video;\n const baseConstraints = getVideoConstraints(profile);\n // Merge encoder overrides into custom video constraints\n captureOptions.customConstraints = {\n video: {\n ...baseConstraints,\n ...(videoOverrides.width && { width: { ideal: videoOverrides.width } }),\n ...(videoOverrides.height && { height: { ideal: videoOverrides.height } }),\n ...(videoOverrides.framerate && { frameRate: { ideal: videoOverrides.framerate } }),\n },\n audio: true,\n };\n this.log(\"Using encoder overrides for capture constraints:\", captureOptions.customConstraints);\n }\n const stream = await this.deviceManager.getUserMedia(captureOptions);\n const label = await this.getCameraLabel(stream);\n const source = this.addMediaSource(\"camera\", stream, label);\n this.setState(\"capturing\", {\n hasVideo: stream.getVideoTracks().length > 0,\n hasAudio: stream.getAudioTracks().length > 0,\n });\n return source;\n }\n catch (error) {\n this.setState(\"error\", {\n error: error instanceof Error ? error.message : String(error),\n });\n throw error;\n }\n }\n /**\n * Get camera label from stream\n */\n async getCameraLabel(stream) {\n const videoTrack = stream.getVideoTracks()[0];\n if (videoTrack) {\n return videoTrack.label || \"Camera\";\n }\n return \"Camera\";\n }\n /**\n * Start screen share capture\n */\n async startScreenShare(options = {}) {\n this.log(\"Starting screen share\", options);\n this.setState(\"requesting_permissions\");\n try {\n await this.ensureAudioMixer();\n // If encoder overrides are set, use them for capture constraints\n const captureOptions = { ...options };\n if (this.encoderOverrides?.video) {\n const videoOverrides = this.encoderOverrides.video;\n // Build custom video constraints from encoder overrides\n captureOptions.video = {\n ...(videoOverrides.width && { width: { ideal: videoOverrides.width } }),\n ...(videoOverrides.height && { height: { ideal: videoOverrides.height } }),\n ...(videoOverrides.framerate && { frameRate: { ideal: videoOverrides.framerate } }),\n };\n this.log(\"Using encoder overrides for screen capture constraints:\", captureOptions.video);\n }\n const stream = await this.screenCapture.start(captureOptions);\n if (stream) {\n // Get actual label from video track (e.g., \"Screen 1\", \"window:App Name\")\n const videoTrack = stream.getVideoTracks()[0];\n const label = videoTrack?.label || `Screen ${this.screenCapture.getCaptureCount()}`;\n const source = this.addMediaSource(\"screen\", stream, label);\n this.setState(\"capturing\", {\n hasVideo: true,\n isScreenShare: true,\n });\n return source;\n }\n else {\n // User cancelled\n if (this.sources.size > 0) {\n this.setState(\"capturing\");\n }\n else {\n this.setState(\"idle\");\n }\n return null;\n }\n }\n catch (error) {\n this.setState(\"error\", {\n error: error instanceof Error ? error.message : String(error),\n });\n throw error;\n }\n }\n /**\n * Add a custom media source\n */\n addCustomSource(stream, label) {\n return this.addMediaSource(\"custom\", stream, label);\n }\n /**\n * Set source volume (for audio mixing)\n */\n setSourceVolume(sourceId, volume) {\n const source = this.sources.get(sourceId);\n if (!source)\n return;\n // Allow boost up to 200% (+6dB)\n source.volume = Math.max(0, Math.min(2, volume));\n this.sources.set(sourceId, source);\n if (this.config.audioMixing) {\n this.audioMixer.setVolume(sourceId, source.volume);\n }\n this.emit(\"sourceUpdated\", { source, changes: { volume: source.volume } });\n }\n /**\n * Mute/unmute a source\n */\n setSourceMuted(sourceId, muted) {\n const source = this.sources.get(sourceId);\n if (!source)\n return;\n source.muted = muted;\n this.sources.set(sourceId, source);\n if (this.config.audioMixing) {\n if (muted) {\n this.audioMixer.mute(sourceId);\n }\n else {\n this.audioMixer.unmute(sourceId);\n }\n }\n else {\n // Mute the track directly\n source.stream.getAudioTracks().forEach((track) => {\n track.enabled = !muted;\n });\n }\n this.emit(\"sourceUpdated\", { source, changes: { muted } });\n this.updateOutputStreamFromSources();\n }\n /**\n * Set source active state\n */\n setSourceActive(sourceId, active) {\n const source = this.sources.get(sourceId);\n if (!source)\n return;\n source.active = active;\n this.sources.set(sourceId, source);\n this.emit(\"sourceUpdated\", { source, changes: { active } });\n this.updateOutputStreamFromSources();\n }\n /**\n * Set master output volume (0-2 for up to +6dB boost)\n */\n setMasterVolume(volume) {\n if (!this.config.audioMixing)\n return;\n this.audioMixer.setMasterVolume(volume);\n }\n /**\n * Get current master output volume\n */\n getMasterVolume() {\n if (!this.config.audioMixing)\n return 1;\n return this.audioMixer.getMasterVolume();\n }\n /**\n * Stop all capture\n */\n async stopCapture() {\n this.log(\"Stopping all capture\");\n // Remove all sources\n for (const id of Array.from(this.sources.keys())) {\n this.removeSource(id);\n }\n this.deviceManager.stopAllTracks();\n this.screenCapture.stop();\n this.outputStream = null;\n if (this.state !== \"streaming\") {\n this.setState(\"idle\", {\n hasVideo: false,\n hasAudio: false,\n isScreenShare: false,\n });\n }\n }\n /**\n * Change quality profile\n */\n async setQualityProfile(profile) {\n if (profile === this.currentProfile)\n return;\n const previousProfile = this.currentProfile;\n this.currentProfile = profile;\n this.log(`Changing quality profile: ${previousProfile} -> ${profile}`);\n // Update existing camera sources with new constraints\n for (const [_id, source] of this.sources) {\n if (source.type === \"camera\") {\n const videoTrack = source.stream.getVideoTracks()[0];\n if (videoTrack) {\n try {\n const constraints = getVideoConstraints(profile);\n await videoTrack.applyConstraints(constraints);\n }\n catch (error) {\n this.log(\"Failed to apply new constraints\", error);\n }\n }\n }\n }\n this.emit(\"qualityChanged\", { profile, previousProfile });\n this.setState(this.state, { activeProfile: profile });\n }\n /**\n * Set up permanent event handlers on the WhipClient.\n * Called after initial connection and after reconnection.\n */\n setupWhipClientHandlers() {\n if (!this.whipClient)\n return;\n this.whipClient.on(\"stateChange\", (event) => {\n this.log(\"WHIP state changed\", event);\n this.stateContext = {\n ...this.stateContext,\n connectionState: event.state,\n };\n if (event.state === \"connected\") {\n this.setState(\"streaming\");\n this.startStatsPolling();\n this.reconnectionManager.reset();\n // Attach WebCodecs encoder transform if supported and codecs are aligned\n // This must happen AFTER connection is established (senders exist)\n if (this.useWebCodecs && this.encoderManager && this.whipClient) {\n this.log(\"Attempting to attach WebCodecs encoder transform\");\n // Check if codec alignment allows encoded frame insertion\n const canUseEncoded = this.whipClient.canUseEncodedInsertion();\n this.log(\"canUseEncodedInsertion result:\", canUseEncoded);\n if (canUseEncoded) {\n try {\n this.whipClient.attachEncoderTransform(this.encoderManager);\n this.encoderManager.start();\n this.log(\"WebCodecs encoder transform attached\", {\n videoCodec: this.whipClient.getNegotiatedVideoCodec(),\n audioCodec: this.whipClient.getNegotiatedAudioCodec(),\n });\n // Emit event so UI can update\n this.emit(\"webCodecsActive\", { active: true });\n }\n catch (err) {\n this.log(\"Failed to attach encoder transform, continuing with browser encoding\", err);\n // Clean up encoder on failure\n if (this.encoderManager) {\n this.encoderManager.destroy();\n this.encoderManager = null;\n }\n }\n }\n else {\n this.log(\"Codec alignment check failed, using browser encoding\", {\n videoCodec: this.whipClient.getNegotiatedVideoCodec(),\n audioCodec: this.whipClient.getNegotiatedAudioCodec(),\n });\n // Clean up encoder since we won't use it\n if (this.encoderManager) {\n this.encoderManager.destroy();\n this.encoderManager = null;\n }\n }\n }\n }\n else if (event.state === \"failed\" || event.state === \"disconnected\") {\n // Skip reconnection/error handling if user intentionally stopped streaming\n if (this.isStoppingIntentionally) {\n return;\n }\n if (this.state === \"streaming\" && this.config.reconnection?.enabled !== false) {\n this.handleConnectionLost();\n }\n else {\n this.setState(\"error\", {\n error: event.state === \"failed\" ? \"Connection failed\" : \"Connection lost\",\n });\n this.stopStatsPolling();\n }\n }\n });\n this.whipClient.on(\"error\", (event) => {\n if (this.isStoppingIntentionally) {\n return;\n }\n this.emit(\"error\", { error: event.message, recoverable: false });\n });\n }\n /**\n * Start streaming to WHIP endpoint\n */\n async startStreaming() {\n if (!this.outputStream) {\n throw new Error(\"No media source available. Add a camera or screen share first.\");\n }\n this.log(\"Starting streaming\");\n // New session should start from primary WHIP endpoint.\n this.currentEndpointIndex = 0;\n this.setState(\"connecting\");\n try {\n // Create WHIP client\n this.whipClient = new WhipClient({\n whipUrl: this.getCurrentWhipUrl(),\n iceServers: this.config.iceServers,\n debug: this.config.debug,\n });\n // Set up WHIP event handlers\n this.setupWhipClientHandlers();\n // Resume audio context if needed\n if (this.config.audioMixing) {\n await this.audioMixer.resume();\n }\n // Initialize WebCodecs encoder if enabled and RTCRtpScriptTransform is supported\n if (this.useWebCodecs && isRTCRtpScriptTransformSupported()) {\n this.log(\"Initializing WebCodecs encoder (Path C: RTCRtpScriptTransform)\");\n try {\n this.encoderManager = new EncoderManager({ debug: this.config.debug });\n // Set up encoder event forwarding\n this.encoderManager.on(\"error\", (event) => {\n this.emit(\"error\", { error: event.message, recoverable: !event.fatal });\n // On fatal encoder error during streaming, reconnect without WebCodecs\n if (event.fatal && this.state === \"streaming\") {\n this.log(\"Fatal encoder error, reconnecting without WebCodecs\");\n this.handleEncoderFailure();\n }\n });\n this.encoderManager.on(\"stats\", (stats) => {\n this.log(\"Encoder stats\", stats);\n });\n // Initialize encoder with output stream\n // Map quality profile to encoder profile (handle 'auto' by defaulting to 'broadcast')\n const encoderProfile = this.currentProfile === \"auto\" ? \"broadcast\" : this.currentProfile;\n const encoderConfig = createEncoderConfig(encoderProfile, this.encoderOverrides);\n this.log(\"Encoder config with overrides:\", encoderConfig);\n await this.encoderManager.initialize(this.outputStream, encoderConfig);\n this.log(\"WebCodecs encoder initialized\");\n }\n catch (err) {\n // If encoder initialization fails, continue without it\n this.log(\"WebCodecs encoder initialization failed, falling back to browser encoding\", err);\n if (this.encoderManager) {\n this.encoderManager.destroy();\n this.encoderManager = null;\n }\n }\n }\n else if (this.useWebCodecs) {\n this.log(\"WebCodecs requested but RTCRtpScriptTransform not supported, using browser encoding\");\n }\n // Connect via standard MediaStream path\n // The encoder transform will be attached after connection is established\n await this.whipClient.connect(this.outputStream);\n }\n catch (error) {\n // Clean up encoder if connection fails\n if (this.encoderManager) {\n this.encoderManager.destroy();\n this.encoderManager = null;\n }\n this.setState(\"error\", {\n error: error instanceof Error ? error.message : String(error),\n });\n throw error;\n }\n }\n /**\n * Handle encoder failure - reconnect without WebCodecs\n */\n async handleEncoderFailure() {\n this.log(\"Handling encoder failure - reconnecting without WebCodecs\");\n this.setState(\"reconnecting\");\n this.stopStatsPolling();\n // Clean up encoder\n if (this.encoderManager) {\n this.encoderManager.destroy();\n this.encoderManager = null;\n }\n // Disable WebCodecs for this session\n this.useWebCodecs = false;\n // Clean up old WHIP client\n if (this.whipClient) {\n try {\n await this.whipClient.disconnect();\n }\n finally {\n this.whipClient.destroy();\n this.whipClient = null;\n }\n }\n // Reconnect without WebCodecs\n if (!this.outputStream) {\n this.setState(\"error\", { error: \"No output stream available for reconnection\" });\n return;\n }\n try {\n this.whipClient = new WhipClient({\n whipUrl: this.getNextWhipUrl(),\n iceServers: this.config.iceServers,\n debug: this.config.debug,\n });\n // Set up event handlers (will use browser encoding since useWebCodecs is now false)\n this.setupWhipClientHandlers();\n await this.whipClient.connect(this.outputStream);\n }\n catch (error) {\n this.setState(\"error\", {\n error: `Reconnection failed: ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n }\n /**\n * Handle connection lost - trigger reconnection\n */\n handleConnectionLost() {\n this.log(\"Connection lost, starting reconnection\");\n this.setState(\"reconnecting\");\n this.stopStatsPolling();\n this.reconnectionManager.start(async () => {\n // Clean up old client\n if (this.whipClient) {\n try {\n await this.whipClient.disconnect();\n }\n finally {\n this.whipClient.destroy();\n this.whipClient = null;\n }\n }\n // Create new client and reconnect\n if (!this.outputStream) {\n throw new Error(\"No output stream available\");\n }\n this.whipClient = new WhipClient({\n whipUrl: this.getNextWhipUrl(),\n iceServers: this.config.iceServers,\n debug: this.config.debug,\n });\n // Set up permanent event handlers (includes WebCodecs re-attachment)\n this.setupWhipClientHandlers();\n // Wait for connection to complete\n await new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n reject(new Error(\"Connection timeout\"));\n }, 30000);\n // One-time listener just to signal reconnection success/failure\n const onStateChange = (event) => {\n if (event.state === \"connected\") {\n clearTimeout(timeout);\n this.whipClient?.off(\"stateChange\", onStateChange);\n resolve();\n }\n else if (event.state === \"failed\") {\n clearTimeout(timeout);\n this.whipClient?.off(\"stateChange\", onStateChange);\n reject(new Error(\"Connection failed\"));\n }\n };\n this.whipClient.on(\"stateChange\", onStateChange);\n this.whipClient.connect(this.outputStream).catch(reject);\n });\n });\n }\n /**\n * Stop streaming\n */\n async stopStreaming() {\n this.log(\"Stopping streaming\");\n this.isStoppingIntentionally = true;\n try {\n this.stopStatsPolling();\n this.reconnectionManager.stop();\n // Stop encoder\n if (this.encoderManager) {\n await this.encoderManager.stop();\n this.encoderManager.destroy();\n this.encoderManager = null;\n }\n if (this.whipClient) {\n await this.whipClient.disconnect();\n this.whipClient.destroy();\n this.whipClient = null;\n }\n if (this.sources.size > 0) {\n this.setState(\"capturing\");\n }\n else {\n this.setState(\"idle\");\n }\n this.stateContext = {\n ...this.stateContext,\n connectionState: \"disconnected\",\n };\n }\n finally {\n this.isStoppingIntentionally = false;\n }\n }\n /**\n * Switch video device\n */\n async switchVideoDevice(deviceId) {\n const newTrack = await this.deviceManager.replaceVideoTrack(deviceId, this.currentProfile);\n if (newTrack && this.whipClient) {\n const pc = this.whipClient.getPeerConnection();\n if (pc) {\n const sender = pc.getSenders().find((s) => s.track?.kind === \"video\");\n if (sender) {\n await sender.replaceTrack(newTrack);\n }\n }\n }\n }\n /**\n * Switch audio device\n */\n async switchAudioDevice(deviceId) {\n const newTrack = await this.deviceManager.replaceAudioTrack(deviceId, this.currentProfile);\n if (newTrack && this.whipClient) {\n const pc = this.whipClient.getPeerConnection();\n if (pc) {\n const sender = pc.getSenders().find((s) => s.track?.kind === \"audio\");\n if (sender) {\n await sender.replaceTrack(newTrack);\n }\n }\n }\n }\n /**\n * Start stats polling\n */\n startStatsPolling() {\n if (this.statsInterval)\n return;\n this.statsInterval = setInterval(async () => {\n // Guard against overlapping async calls\n if (this.statsInFlight)\n return;\n this.statsInFlight = true;\n try {\n const stats = await this.getStats();\n if (stats) {\n this.lastStats = stats;\n this.emit(\"statsUpdate\", stats);\n }\n }\n finally {\n this.statsInFlight = false;\n }\n }, 1000);\n }\n /**\n * Stop stats polling\n */\n stopStatsPolling() {\n if (this.statsInterval) {\n clearInterval(this.statsInterval);\n this.statsInterval = null;\n }\n }\n /**\n * Get current stats\n */\n async getStats() {\n if (!this.whipClient)\n return null;\n const report = await this.whipClient.getStats();\n if (!report)\n return null;\n const stats = {\n video: {\n bytesSent: 0,\n packetsSent: 0,\n packetsLost: 0,\n framesEncoded: 0,\n framesPerSecond: 0,\n bitrate: 0,\n },\n audio: {\n bytesSent: 0,\n packetsSent: 0,\n packetsLost: 0,\n bitrate: 0,\n },\n connection: {\n rtt: 0,\n state: this.whipClient.getPeerConnection()?.connectionState ?? \"new\",\n iceState: this.whipClient.getPeerConnection()?.iceConnectionState ?? \"new\",\n },\n timestamp: Date.now(),\n };\n // Calculate bitrate from previous stats\n const prevStats = this.lastStats;\n report.forEach((stat) => {\n if (stat.type === \"outbound-rtp\") {\n const rtpStat = stat;\n if (rtpStat.kind === \"video\") {\n stats.video.bytesSent = rtpStat.bytesSent ?? 0;\n stats.video.packetsSent = rtpStat.packetsSent ?? 0;\n stats.video.framesEncoded = rtpStat.framesEncoded ?? 0;\n stats.video.framesPerSecond = rtpStat.framesPerSecond ?? 0;\n // Calculate bitrate\n if (prevStats) {\n const timeDiff = (stats.timestamp - prevStats.timestamp) / 1000;\n const bytesDiff = stats.video.bytesSent - prevStats.video.bytesSent;\n stats.video.bitrate = Math.round((bytesDiff * 8) / timeDiff);\n }\n }\n else if (rtpStat.kind === \"audio\") {\n stats.audio.bytesSent = rtpStat.bytesSent ?? 0;\n stats.audio.packetsSent = rtpStat.packetsSent ?? 0;\n if (prevStats) {\n const timeDiff = (stats.timestamp - prevStats.timestamp) / 1000;\n const bytesDiff = stats.audio.bytesSent - prevStats.audio.bytesSent;\n stats.audio.bitrate = Math.round((bytesDiff * 8) / timeDiff);\n }\n }\n }\n else if (stat.type === \"candidate-pair\" &&\n stat.state === \"succeeded\") {\n stats.connection.rtt = stat.currentRoundTripTime ?? 0;\n }\n });\n return stats;\n }\n // ============================================================================\n // Phase 3: Compositor\n // ============================================================================\n /**\n * Enable the compositor for multi-source composition\n * Call this before adding sources if you want compositor-based output\n */\n async enableCompositor(config) {\n this.log(\"enableCompositor called\", { alreadyEnabled: !!this.sceneManager });\n if (this.sceneManager) {\n this.log(\"Compositor already enabled\");\n return;\n }\n const compositorConfig = { ...DEFAULT_COMPOSITOR_CONFIG, ...this.config.compositor, ...config };\n this.log(\"Creating SceneManager with config\", compositorConfig);\n this.sceneManager = new SceneManager(compositorConfig);\n this.compositorBaseConfig = compositorConfig;\n // Initialize the compositor\n try {\n this.log(\"Initializing SceneManager...\");\n await this.sceneManager.initialize();\n this.log(\"SceneManager initialized successfully\");\n }\n catch (e) {\n // If initialization fails, clean up and re-throw\n this.sceneManager = null;\n const message = e instanceof Error ? e.message : String(e);\n this.log(\"Compositor initialization failed:\", message);\n throw new Error(`Compositor initialization failed: ${message}`);\n }\n // Verify sceneManager is still set after async initialize\n if (!this.sceneManager) {\n this.log(\"ERROR: SceneManager was unexpectedly null after initialization\");\n throw new Error(\"SceneManager was unexpectedly null after initialization\");\n }\n this.log(\"SceneManager is valid, getting active scene...\");\n // Bind existing sources to the compositor and add as layers\n const activeScene = this.sceneManager.getActiveScene();\n this.log(\"Compositor active scene:\", activeScene?.id ?? \"none\");\n for (const [id, source] of this.sources) {\n if (!this.sceneManager)\n break; // Guard against concurrent disable\n // Bind source for frame extraction\n this.sceneManager.bindSource(id, source.stream);\n // Add layer to active scene\n if (activeScene) {\n this.sceneManager.addLayer(activeScene.id, id);\n }\n }\n // Forward compositor events\n if (this.sceneManager) {\n this.sceneManager.on(\"error\", (event) => {\n this.emit(\"error\", { error: event.message, recoverable: true });\n });\n }\n this.log(\"Compositor enabled\", compositorConfig);\n // Update output to use compositor\n this.updateOutputStreamFromSources();\n }\n /**\n * Disable the compositor\n */\n disableCompositor() {\n if (this.sceneManager) {\n this.sceneManager.destroy();\n this.sceneManager = null;\n this.log(\"Compositor disabled\");\n this.updateOutputStreamFromSources();\n }\n }\n /**\n * Get the scene manager for compositor control\n */\n getSceneManager() {\n return this.sceneManager;\n }\n /**\n * Check if compositor is enabled\n */\n isCompositorEnabled() {\n return this.sceneManager !== null && this.sceneManager.isInitialized();\n }\n // ============================================================================\n // Getters\n // ============================================================================\n getState() {\n return this.state;\n }\n getStateContext() {\n return { ...this.stateContext };\n }\n getMediaStream() {\n return this.outputStream;\n }\n getSources() {\n return Array.from(this.sources.values());\n }\n getSource(id) {\n return this.sources.get(id);\n }\n getQualityProfile() {\n return this.currentProfile;\n }\n getDeviceManager() {\n return this.deviceManager;\n }\n getScreenCapture() {\n return this.screenCapture;\n }\n getAudioMixer() {\n return this.audioMixer;\n }\n getReconnectionManager() {\n return this.reconnectionManager;\n }\n async getDevices() {\n return this.deviceManager.enumerateDevices();\n }\n isStreaming() {\n return this.state === \"streaming\";\n }\n isCapturing() {\n return this.state === \"capturing\" || this.state === \"streaming\";\n }\n isReconnecting() {\n return this.state === \"reconnecting\";\n }\n /**\n * Set whether to use WebCodecs encoding\n * Only takes effect before streaming starts (cannot change mid-stream)\n */\n setUseWebCodecs(enabled) {\n if (this.state === \"streaming\") {\n this.log(\"Cannot change useWebCodecs while streaming\");\n return;\n }\n this.useWebCodecs = enabled;\n this.log(\"useWebCodecs set to\", enabled);\n }\n /**\n * Set encoder overrides (resolution, bitrate, framerate, etc.)\n * Only takes effect before streaming starts (cannot change mid-stream)\n */\n setEncoderOverrides(overrides) {\n if (this.state === \"streaming\") {\n this.log(\"Cannot change encoder overrides while streaming\");\n return;\n }\n this.encoderOverrides = overrides;\n this.log(\"Encoder overrides set:\", overrides);\n if (this.sceneManager) {\n const baseConfig = this.compositorBaseConfig ?? this.sceneManager.getConfig();\n const targetWidth = overrides.video?.width ?? baseConfig.width;\n const targetHeight = overrides.video?.height ?? baseConfig.height;\n const targetFrameRate = overrides.video?.framerate ?? baseConfig.frameRate;\n const updated = this.sceneManager.updateOutputConfig({\n width: targetWidth,\n height: targetHeight,\n frameRate: targetFrameRate,\n });\n if (updated) {\n this.updateOutputStreamFromSources();\n }\n }\n }\n /**\n * Get current encoder overrides\n */\n getEncoderOverrides() {\n return this.encoderOverrides;\n }\n /**\n * Get current useWebCodecs setting\n */\n getUseWebCodecs() {\n return this.useWebCodecs;\n }\n /**\n * Get the encoder manager (for advanced use cases)\n */\n getEncoderManager() {\n return this.encoderManager;\n }\n /**\n * Check if WebCodecs encoding is active\n */\n isWebCodecsActive() {\n return this.encoderManager !== null && this.whipClient?.hasEncoderTransform() === true;\n }\n /**\n * Destroy the controller\n */\n destroy() {\n this.log(\"Destroying IngestControllerV2\");\n this.stopStatsPolling();\n this.reconnectionManager.destroy();\n // Destroy encoder\n if (this.encoderManager) {\n this.encoderManager.destroy();\n this.encoderManager = null;\n }\n if (this.whipClient) {\n this.whipClient.destroy();\n this.whipClient = null;\n }\n // Destroy compositor\n if (this.sceneManager) {\n this.sceneManager.destroy();\n this.sceneManager = null;\n }\n // Remove all sources\n for (const id of Array.from(this.sources.keys())) {\n this.removeSource(id);\n }\n this.deviceManager.destroy();\n this.screenCapture.destroy();\n this.audioMixer.destroy();\n this.removeAllListeners();\n this.setState(\"destroyed\");\n }\n}\n\nexport { IngestControllerV2 };\n//# sourceMappingURL=IngestControllerV2.js.map\n",null,null,null,null,null,null,null,null],"names":["__decorate","decorators","target","key","desc","d","c","arguments","length","r","Object","getOwnPropertyDescriptor","Reflect","decorate","i","defineProperty","SuppressedError","t","globalThis","e","ShadowRoot","ShadyCSS","nativeShadow","Document","prototype","CSSStyleSheet","s","Symbol","o","WeakMap","n$3","constructor","this","_$cssResult$","Error","cssText","styleSheet","get","replaceSync","set","toString","reduce","n","cssRules","is","h","getOwnPropertyNames","getOwnPropertySymbols","getPrototypeOf","a","trustedTypes","l","emptyScript","p","reactiveElementPolyfillSupport","u","toAttribute","Boolean","Array","JSON","stringify","fromAttribute","Number","parse","f","b","attribute","type","String","converter","reflect","useDefault","hasChanged","metadata","litPropertyMetadata","y$1","HTMLElement","addInitializer","_$Ei","push","observedAttributes","finalize","_$Eh","keys","createProperty","state","hasOwnProperty","create","wrapped","elementProperties","noAccessor","getPropertyDescriptor","call","requestUpdate","configurable","enumerable","getPropertyOptions","Map","finalized","properties","_$Eu","elementStyles","finalizeStyles","styles","isArray","Set","flat","reverse","unshift","toLowerCase","super","_$Ep","isUpdatePending","hasUpdated","_$Em","_$Ev","_$ES","Promise","enableUpdating","_$AL","_$E_","forEach","addController","_$EO","add","renderRoot","isConnected","hostConnected","removeController","delete","size","createRenderRoot","shadowRoot","attachShadow","shadowRootOptions","adoptedStyleSheets","map","document","createElement","litNonce","setAttribute","textContent","appendChild","connectedCallback","disconnectedCallback","hostDisconnected","attributeChangedCallback","_$AK","_$ET","removeAttribute","_$Ej","hasAttribute","C","_$EP","has","_$Eq","reject","scheduleUpdate","performUpdate","shouldUpdate","willUpdate","hostUpdate","update","_$EM","_$AE","hostUpdated","firstUpdated","updated","updateComplete","getUpdateComplete","y","mode","ReactiveElement","reactiveElementVersions","createPolicy","createHTML","Math","random","toFixed","slice","createComment","v","_","m","RegExp","g","$","_$litType$","strings","values","x","E","for","A","P","createTreeWalker","V","N","lastIndex","exec","test","startsWith","S","parts","el","currentNode","content","firstChild","replaceWith","childNodes","nextNode","nodeType","hasAttributes","getAttributeNames","endsWith","getAttribute","split","index","name","ctor","I","L","z","H","tagName","append","data","indexOf","innerHTML","M","_$Co","_$Cl","_$litDirective$","_$AO","_$AT","_$AS","R","_$AV","_$AN","_$AD","_$AM","parentNode","_$AU","creationScope","importNode","k","nextSibling","Z","_$AI","_$Cv","_$AH","_$AA","_$AB","options","startNode","endNode","_$AR","T","iterator","O","insertBefore","createTextNode","_$AC","_$AP","remove","setConnected","element","fill","j","toggleAttribute","capture","once","passive","removeEventListener","addEventListener","handleEvent","host","B","litHtmlPolyfillSupport","litHtmlVersions","renderOptions","_$Do","renderBefore","render","_$litPart$","_$litElement$","litElementHydrateSupport","LitElement","litElementPolyfillSupport","litElementVersions","customElements","define","kind","init","querySelector","_$Ct","_$Ci","filter","join","st","nt","classList","sharedStyles","css","utilityStyles","cameraIcon","html","monitorIcon","xIcon","videoIcon","DEFAULT_COMPOSITOR_CONFIG","enabled","width","height","frameRate","renderer","defaultTransition","durationMs","easing","DEFAULT_LAYER_TRANSFORM","opacity","rotation","borderRadius","crop","top","right","bottom","left","TypedEventEmitter","listeners","on","event","handler","off","wrappedHandler","handlers","emit","error","console","removeAllListeners","clear","listenerCount","getVideoConstraints","profile","profiles","professional","ideal","broadcast","conference","auto","buildMediaConstraints","audioProfile","echoCancellation","noiseSuppression","autoGainControl","sampleRate","channelCount","latency","getAudioConstraints","videoProfile","audio","audioDeviceId","deviceId","exact","video","videoDeviceId","facingMode","DeviceManager","devices","currentStream","permissionStatus","setupDeviceChangeListener","navigator","mediaDevices","async","enumerateDevices","label","groupId","getVideoInputs","getAudioInputs","getAudioOutputs","requestPermissions","getUserMedia","getTracks","track","stop","granted","denied","err","message","hasPermission","constraints","customConstraints","stream","getVideoTracks","getAudioTracks","relaxedConstraints","getStream","stopAllTracks","replaceVideoTrack","currentVideoTrack","removeTrack","newTrack","addTrack","replaceAudioTrack","currentAudioTrack","getAllDevices","destroy","ScreenCapture","captures","captureCounter","start","videoConstraints","max","undefined","cursor","preferCurrentTab","surfaceSwitching","selfBrowserSurface","monitorTypeSurfaces","systemAudio","getDisplayMedia","captureId","Date","now","videoTrack","handleTrackEnded","reason","activeTracks","readyState","stopByStream","info","getCaptures","from","entries","isActive","getCaptureCount","first","next","value","getVideoTrack","getAudioTrack","hasAudio","WhipClient","config","peerConnection","videoTrackGenerator","audioTrackGenerator","videoWriter","audioWriter","videoWriteQueue","audioWriteQueue","isProcessingVideoQueue","isProcessingAudioQueue","videoTransformWorker","audioTransformWorker","encoderListenerCleanup","negotiatedVideoCodec","negotiatedAudioCodec","resourceUrl","log","debug","logError","setState","newState","previousState","preferCodecs","pc","transceivers","getTransceivers","transceiver","setCodecPreferences","trackKind","sender","capabilities","RTCRtpSender","getCapabilities","codecs","preferred","mimeType","sort","verifyCodecAlignment","senders","getSenders","params","getParameters","codec","canUseEncodedInsertion","hasPC","RTCRtpScriptTransform","hasTransformSupport","some","getNegotiatedVideoCodec","getNegotiatedAudioCodec","connect","whipUrl","pcConfig","iceServers","RTCPeerConnection","onconnectionstatechange","connectionState","oniceconnectionstatechange","iceConnectionState","onicegatheringstatechange","iceGatheringState","onicecandidate","candidate","id","offer","createOffer","offerToReceiveAudio","offerToReceiveVideo","setLocalDescription","sdpLength","sdp","response","fetch","method","headers","Accept","body","status","statusText","ok","errorText","text","catch","answerSdp","setRemoteDescription","cleanup","connectWithGenerators","videoGenerator","MediaStreamTrackGenerator","audioGenerator","mediaStream","MediaStream","processVideoQueue","item","shift","frame","resolve","writable","getWriter","write","releaseLock","processAudioQueue","audioData","sendVideoFrame","close","sendAudioData","replaceTrack","oldTrack","find","getStats","getState","getPeerConnection","attachEncoderTransform","encoderManager","workerUrl","createWorker","Worker","packagedUrl","URL","_documentCurrentScript","toUpperCase","src","baseURI","href","fallbackPaths","path","videoSender","audioSender","postMessage","maxQueueSize","transform","handleVideoChunk","chunk","handleAudioChunk","hasEncoderTransform","detachEncoderTransform","terminate","cleanupWriters","disconnect","AudioMixer","audioContext","destination","masterGain","compressor","limiter","analyzer","sources","outputStream","levelMonitoringActive","peakLevel","peakDecayRate","initialize","AudioContext","createMediaStreamDestination","createGain","createDynamicsCompressor","threshold","knee","ratio","attack","release","createAnalyser","fftSize","smoothingTimeConstant","addSource","removeSource","sourceNode","createMediaStreamSource","gainNode","gain","muted","volume","panNode","createStereoPanner","pan","audioSource","sourceId","source","updateSource","setTargetAtTime","currentTime","warn","setVolume","min","mute","unmute","toggleMute","newMuted","setPan","setMasterVolume","getMasterVolume","getOutputStream","getOutputTrack","getSourceIds","getSourceOptions","hasSource","getSourceCount","resume","suspend","getLevel","Uint8Array","frequencyBinCount","getByteTimeDomainData","abs","normalized","log10","getLevels","level","startLevelMonitoring","requestAnimationFrame","stopLevelMonitoring","isMonitoringLevels","DEFAULT_RECONNECTION_CONFIG","maxAttempts","baseDelay","maxDelay","backoffMultiplier","ReconnectionManager","reconnectTimeout","countdownInterval","reconnectCallback","isReconnecting","attemptNumber","nextAttemptIn","lastError","calculateDelay","attempt","delay","pow","jitter","scheduleNextAttempt","handleExhausted","startCountdown","setTimeout","executeAttempt","stopCountdown","startTime","setInterval","elapsed","clearInterval","handleSuccess","errorMessage","handleFailure","totalAttempts","clearTimeout","reset","getAttemptNumber","getMaxAttempts","updateConfig","LAYOUT_PRESETS","icon","minSources","maxSources","currentScalingMode","createLayer","zIndex","scalingMode","visible","locked","PIP_SCALE","PIP_PADDING","SPLIT_GAP","applySoloLayout","sourceIds","applyPipLayout","corner","pipScale","pos","tl","tr","bl","br","applySplitLayout","direction","halfGap","gap","applyDualPipLayout","layers","applySplitPipLayout","pipSide","applyFeaturedLayout","count","mainRatio","thumbCount","thumbW","thumbH","applyLayout","layout","splitRatio","clampedSplitRatio","cols","ceil","sqrt","rows","cellW","cellH","col","row","floor","isLastRow","itemsInRow","offsetX","applyGridLayout","applyStackLayout","DEFAULT_LAYOUT_TRANSITION","SceneManager","scenes","activeSceneId","defaultLayoutTransition","isAnimating","worker","workerReady","pendingMessages","frameProcessors","frameReaders","outputCanvas","lastStats","fps","frameTimeMs","currentLayout","initializeWorker","workerPaths","testWorker","timeout","onerror","onmessage","offscreen","transferControlToOffscreen","readyPromise","handleWorkerMessage","canvas","defaultScene","createScene","setActiveScene","msg","stats","sceneId","activeScene","getActiveScene","sendToWorker","transfer","backgroundColor","scene","deleteScene","getScene","getAllScenes","previousSceneId","transitionTo","transition","transitionConfig","toSceneId","fromSceneId","addLayer","layerId","maxZIndex","layer","updateSceneInWorker","removeLayer","findIndex","splice","updateLayerTransform","setLayerVisibility","reorderLayers","layerIds","cycleSourceOrder","sortedLayers","last","pop","animate","currentLayerCount","newLayers","targetScene","setDefaultLayoutTransition","isLayoutAnimating","getCurrentLayout","bindSource","MediaStreamTrackProcessorCtor","MediaStreamTrackProcessor","processor","reader","readable","getReader","readFrame","done","read","unbindSource","cancel","bindImageSource","imageUrl","blob","bitmap","createImageBitmap","applyFilter","captureStream","getRendererType","setRenderer","rendererType","getConfig","updateOutputConfig","nextWidth","nextHeight","nextFrameRate","isInitialized","DEFAULT_VIDEO_SETTINGS","bitrate","framerate","low","DEFAULT_AUDIO_SETTINGS","numberOfChannels","EncoderManager","videoProcessor","audioProcessor","videoReader","audioReader","isRunning","pendingRequests","requestCounter","providedWorker","generateRequestId","sendRequest","requestId","timer","handleResponse","success","pending","tryCreateWorker","url","useModule","resolved","onMessage","onError","_e","createWorkerAsync","urlsToTry","description","VideoEncoder","AudioEncoder","audioTrack","fatal","startVideoProcessing","startAudioProcessing","updateInputStream","wasRunning","flush","getIsInitialized","getIsRunning","detectCapabilities","webcodecs","videoEncoder","audioEncoder","mediaStreamTrackProcessor","mediaStreamTrackGenerator","webrtc","insertableStreams","scriptTransform","recommended","isRTCRtpScriptTransformSupported","isWebCodecsEncodingPathSupported","sourceIdCounter","IngestControllerV2","whipClient","whipEndpoints","currentEndpointIndex","isStoppingIntentionally","stateContext","statsInterval","statsInFlight","sceneManager","compositorBaseConfig","encoderOverrides","currentProfile","buildWhipEndpoints","deviceManager","screenCapture","audioMixer","reconnectionManager","reconnection","useWebCodecs","setupEventForwarding","audioMixing","whipUrls","self","getCurrentWhipUrl","getNextWhipUrl","recoverable","context","activeProfile","ensureAudioMixer","addMediaSource","generateSourceId","hasVideoTrack","existingVideoSources","isPrimaryVideo","active","primaryVideo","tracks","sceneLayers","layerCount","hasSceneManager","updateOutputStreamFromSources","wasPrimaryVideo","videoSources","setPrimaryVideoSource","changes","getPrimaryVideoSource","sourcesArray","compositedTrack","videoSourcesWithVideo","primaryVideoSource","mixedAudioTrack","updateWhipTracks","videoTracks","audioTracks","usingCompositor","newVideoTrack","newAudioTrack","startCamera","captureOptions","videoOverrides","baseConstraints","getCameraLabel","hasVideo","startScreenShare","isScreenShare","addCustomSource","setSourceVolume","setSourceMuted","setSourceActive","stopCapture","setQualityProfile","previousProfile","_id","applyConstraints","setupWhipClientHandlers","startStatsPolling","canUseEncoded","videoCodec","audioCodec","handleConnectionLost","stopStatsPolling","startStreaming","handleEncoderFailure","encoderConfig","overrides","baseVideo","baseAudio","finalWidth","finalHeight","finalFramerate","pixels","selectH264Codec","createEncoderConfig","onStateChange","stopStreaming","switchVideoDevice","switchAudioDevice","report","bytesSent","packetsSent","packetsLost","framesEncoded","framesPerSecond","connection","rtt","iceState","timestamp","prevStats","stat","rtpStat","timeDiff","bytesDiff","round","currentRoundTripTime","enableCompositor","alreadyEnabled","compositorConfig","compositor","disableCompositor","getSceneManager","isCompositorEnabled","getStateContext","getMediaStream","getSources","getSource","getQualityProfile","getDeviceManager","getScreenCapture","getAudioMixer","getReconnectionManager","getDevices","isStreaming","isCapturing","setUseWebCodecs","setEncoderOverrides","baseConfig","targetWidth","targetHeight","targetFrameRate","getEncoderOverrides","getUseWebCodecs","getEncoderManager","isWebCodecsActive","IngestControllerHost","initialProfile","controller","unsubs","encoderStatsCleanup","qualityProfile","reconnectionState","isWebCodecsAvailable","encoderStats","teardown","subscribeToEvents","fn","partial","assign","ctx","dispatchEvent","newStats","setupEncoderStatsListener","encoder","detail","CustomEvent","bubbles","composed","getController","QUALITY_PROFILES","FwStreamCrafter","gatewayUrl","streamKey","autoStartCamera","devMode","_showSettings","_showSources","_isAdvancedPanelOpen","_initController","changed","_syncVideoPreview","_videoEl","srcObject","play","vol","getStatusText","statusBadgeClass","canAddSource","canStream","hasCamera","classMap","root","nothing","chevronsRightIcon","chevronsLeftIcon","_renderSourceRow","settingsIcon","_renderSettingsPopup","micMutedIcon","micIcon","property","query","customElement","LAYOUT_PRESETS_UI","SCALING_MODES","FwScCompositor","_tooltipText","_tooltipTarget","visibleSourceCount","ic","availableLayouts","preset","sourceCount","isLayoutAvailable","stopPropagation","_handleLayoutSelect","sm","FwScSceneSwitcher","showTransitionControls","_selectedTransition","_transitionDuration","_isTransitioning","_handleSceneClick","_handleDelete","FwScLayerList","selectedLayerId","_draggedId","_dragOverId","_editingLayerId","_sortedLayers","_getSourceLabel","_getSourceIcon","sorted","_handleDragStart","_handleDragOver","_handleDrop","_dispatch","eyeIcon","eyeOffIcon","_moveUp","_moveDown","dataTransfer","effectAllowed","setData","preventDefault","dropEffect","targetLayerId","currentIds","fromIndex","toIndex","newOrder","ids","idx","FwScVolume","snapThreshold","compact","_isDragging","_popupPosition","_displayValue","_isBoost","_isDefault","_accentColor","_handleChange","newValue","parseInt","_updatePopupPosition","_handleMouseDown","_handleMouseUp","_slider","rect","getBoundingClientRect","percent","markerLeft","markerBg","FwScAdvanced","_activeTab","tab","_renderStats","_renderInfo","_row","framesPending","samplesEncoded","safeDefine"],"mappings":"4GAsDO,SAASA,EAAWC,EAAYC,EAAQC,EAAKC,GAChD,IAA2HC,EAAvHC,EAAIC,UAAUC,OAAQC,EAAIH,EAAI,EAAIJ,EAAkB,OAATE,EAAgBA,EAAOM,OAAOC,yBAAyBT,EAAQC,GAAOC,EACrH,GAAuB,iBAAZQ,SAAoD,mBAArBA,QAAQC,SAAyBJ,EAAIG,QAAQC,SAASZ,EAAYC,EAAQC,EAAKC,QACpH,IAAK,IAAIU,EAAIb,EAAWO,OAAS,EAAGM,GAAK,EAAGA,KAAST,EAAIJ,EAAWa,MAAIL,GAAKH,EAAI,EAAID,EAAEI,GAAKH,EAAI,EAAID,EAAEH,EAAQC,EAAKM,GAAKJ,E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