@aglyn/aglyn 1.14.0 → 1.15.1

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 (94) hide show
  1. package/package.json +11 -11
  2. package/src/lib/app-utils/buy-now-pay-later.d.ts +45 -0
  3. package/src/lib/app-utils/buy-now-pay-later.js +68 -0
  4. package/src/lib/app-utils/buy-now-pay-later.js.map +1 -0
  5. package/src/lib/app-utils/contexts.d.ts +1 -0
  6. package/src/lib/app-utils/contexts.js +1 -0
  7. package/src/lib/app-utils/contexts.js.map +1 -1
  8. package/src/lib/app-utils/docs-help-sections.generated.js +6 -3
  9. package/src/lib/app-utils/docs-help-sections.generated.js.map +1 -1
  10. package/src/lib/app-utils/docs-help.generated.d.ts +6 -6
  11. package/src/lib/app-utils/docs-help.generated.js +14 -1
  12. package/src/lib/app-utils/docs-help.generated.js.map +1 -1
  13. package/src/lib/app-utils/docs-index.generated.js +20 -20
  14. package/src/lib/app-utils/docs-index.generated.js.map +1 -1
  15. package/src/lib/app-utils/entity-picker-context.d.ts +6 -0
  16. package/src/lib/app-utils/entity-picker-context.js.map +1 -1
  17. package/src/lib/app-utils/host-status.js +1 -1
  18. package/src/lib/app-utils/host-status.js.map +1 -1
  19. package/src/lib/app-utils/org-role-grants.js +1 -1
  20. package/src/lib/app-utils/org-role-grants.js.map +1 -1
  21. package/src/lib/app-utils/page-header-record-context.d.ts +15 -0
  22. package/src/lib/app-utils/page-header-record-context.js +13 -4
  23. package/src/lib/app-utils/page-header-record-context.js.map +1 -1
  24. package/src/lib/app-utils/plan-entitlements.d.ts +125 -46
  25. package/src/lib/app-utils/plan-entitlements.js +118 -49
  26. package/src/lib/app-utils/plan-entitlements.js.map +1 -1
  27. package/src/lib/app-utils/plugin-bundle-checks.d.ts +14 -2
  28. package/src/lib/app-utils/plugin-bundle-checks.js +82 -7
  29. package/src/lib/app-utils/plugin-bundle-checks.js.map +1 -1
  30. package/src/lib/app-utils/plugin-connection-editor.d.ts +48 -0
  31. package/src/lib/app-utils/plugin-connection-editor.js +46 -0
  32. package/src/lib/app-utils/plugin-connection-editor.js.map +1 -0
  33. package/src/lib/app-utils/plugin-connection-record.d.ts +42 -0
  34. package/src/lib/app-utils/plugin-connection-record.js +48 -0
  35. package/src/lib/app-utils/plugin-connection-record.js.map +1 -0
  36. package/src/lib/app-utils/plugin-connection-records-context.d.ts +23 -0
  37. package/src/lib/app-utils/plugin-connection-records-context.js +29 -0
  38. package/src/lib/app-utils/plugin-connection-records-context.js.map +1 -0
  39. package/src/lib/app-utils/plugin-connection-records.d.ts +42 -0
  40. package/src/lib/app-utils/plugin-connection-records.js +56 -0
  41. package/src/lib/app-utils/plugin-connection-records.js.map +1 -0
  42. package/src/lib/app-utils/plugin-connections.d.ts +320 -0
  43. package/src/lib/app-utils/plugin-connections.js +895 -0
  44. package/src/lib/app-utils/plugin-connections.js.map +1 -0
  45. package/src/lib/app-utils/plugin-elements.d.ts +104 -0
  46. package/src/lib/app-utils/plugin-elements.js +128 -0
  47. package/src/lib/app-utils/plugin-elements.js.map +1 -0
  48. package/src/lib/app-utils/plugin-manifest.d.ts +20 -75
  49. package/src/lib/app-utils/plugin-manifest.js +65 -100
  50. package/src/lib/app-utils/plugin-manifest.js.map +1 -1
  51. package/src/lib/app-utils/realm-elements-context.d.ts +16 -0
  52. package/src/lib/app-utils/realm-elements-context.js +16 -0
  53. package/src/lib/app-utils/realm-elements-context.js.map +1 -1
  54. package/src/lib/app-utils/realm-host-surface.generated.js +1 -0
  55. package/src/lib/app-utils/realm-host-surface.generated.js.map +1 -1
  56. package/src/lib/app-utils/release-flags.d.ts +1 -1
  57. package/src/lib/app-utils/release-flags.js +35 -0
  58. package/src/lib/app-utils/release-flags.js.map +1 -1
  59. package/src/lib/app-utils/server.d.ts +1 -0
  60. package/src/lib/app-utils/server.js +2 -0
  61. package/src/lib/app-utils/server.js.map +1 -1
  62. package/src/lib/app-utils/site-context.d.ts +9 -0
  63. package/src/lib/app-utils/site-context.js.map +1 -1
  64. package/src/lib/app-utils/site-starter.d.ts +6 -0
  65. package/src/lib/app-utils/site-starter.js +15 -0
  66. package/src/lib/app-utils/site-starter.js.map +1 -1
  67. package/src/lib/plugin-manager/feature-plugins.d.ts +25 -0
  68. package/src/lib/plugin-manager/feature-plugins.js +10 -0
  69. package/src/lib/plugin-manager/feature-plugins.js.map +1 -1
  70. package/src/lib/plugin-manager/first-party-plugins.generated.js +12 -0
  71. package/src/lib/plugin-manager/first-party-plugins.generated.js.map +1 -1
  72. package/src/lib/plugin-manager/index.d.ts +1 -0
  73. package/src/lib/plugin-manager/index.js +1 -0
  74. package/src/lib/plugin-manager/index.js.map +1 -1
  75. package/src/lib/plugin-manager/plugin-artifact-inventory.d.ts +5 -0
  76. package/src/lib/plugin-manager/plugin-artifact-inventory.js.map +1 -1
  77. package/src/lib/plugin-manager/plugin-record-lists.d.ts +18 -0
  78. package/src/lib/plugin-manager/plugin-record-lists.js +13 -0
  79. package/src/lib/plugin-manager/plugin-record-lists.js.map +1 -1
  80. package/src/lib/plugin-manager/plugin-site-csp.d.ts +36 -0
  81. package/src/lib/plugin-manager/plugin-site-csp.js +50 -1
  82. package/src/lib/plugin-manager/plugin-site-csp.js.map +1 -1
  83. package/src/lib/plugin-manager/realm-host-aglyn.generated.js +61 -59
  84. package/src/lib/plugin-manager/realm-host-aglyn.generated.js.map +1 -1
  85. package/src/lib/plugin-manager/site-page-enricher-services.d.ts +35 -0
  86. package/src/lib/plugin-manager/site-page-enricher-services.js +35 -0
  87. package/src/lib/plugin-manager/site-page-enricher-services.js.map +1 -0
  88. package/src/lib/plugin-manager/site-page-hooks.js +16 -3
  89. package/src/lib/plugin-manager/site-page-hooks.js.map +1 -1
  90. package/src/lib/plugin-manager/video-embed-provider.d.ts +28 -0
  91. package/src/lib/plugin-manager/video-embed-provider.js +21 -0
  92. package/src/lib/plugin-manager/video-embed-provider.js.map +1 -1
  93. package/src/lib/plugin-manager/video-embed-providers.generated.js +3 -1
  94. package/src/lib/plugin-manager/video-embed-providers.generated.js.map +1 -1
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import type { SitePageEnricher } from './site-page-hooks';
18
+ /**
19
+ * Enrichers registered from a plugin's BOOT declarations (AGL-4195), which
20
+ * `instrumentation.ts` runs in a compilation of its own: a module-scope list
21
+ * filled there is empty where the page route reads it (AGL-3947). These live
22
+ * in the plugin-service registry, on `globalThis`, so the route sees them. A
23
+ * plugin registering again replaces its own (by `key`), and the owner is
24
+ * named at registration, so the page's "who contributed" narrowing holds.
25
+ *
26
+ * Plugins registering from a surface the route itself loads (`tenantApi`)
27
+ * keep using `registerSitePageEnricher` (`site-page-hooks.ts`), which runs
28
+ * these after its own.
29
+ */
30
+ export declare const SITE_PAGE_ENRICHER_SERVICES: import("./plugin-services").PluginServiceContract<SitePageEnricher>;
31
+ /** Registers a boot-time enricher; see {@link SITE_PAGE_ENRICHER_SERVICES}. */
32
+ export declare function registerSitePageEnricherService(fn: SitePageEnricher, options?: {
33
+ pluginId?: string;
34
+ key?: string;
35
+ }): void;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { definePluginServiceContract, registerPluginService } from "./plugin-services.js";
17
+ /**
18
+ * Enrichers registered from a plugin's BOOT declarations (AGL-4195), which
19
+ * `instrumentation.ts` runs in a compilation of its own: a module-scope list
20
+ * filled there is empty where the page route reads it (AGL-3947). These live
21
+ * in the plugin-service registry, on `globalThis`, so the route sees them. A
22
+ * plugin registering again replaces its own (by `key`), and the owner is
23
+ * named at registration, so the page's "who contributed" narrowing holds.
24
+ *
25
+ * Plugins registering from a surface the route itself loads (`tenantApi`)
26
+ * keep using `registerSitePageEnricher` (`site-page-hooks.ts`), which runs
27
+ * these after its own.
28
+ */ export const SITE_PAGE_ENRICHER_SERVICES = definePluginServiceContract('core.site-page-enricher', {
29
+ multiple: true
30
+ });
31
+ /** Registers a boot-time enricher; see {@link SITE_PAGE_ENRICHER_SERVICES}. */ export function registerSitePageEnricherService(fn, options) {
32
+ registerPluginService(SITE_PAGE_ENRICHER_SERVICES, fn, options);
33
+ }
34
+
35
+ //# sourceMappingURL=site-page-enricher-services.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/site-page-enricher-services.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { definePluginServiceContract, registerPluginService } from './plugin-services'\nimport type { SitePageEnricher } from './site-page-hooks'\n\n/**\n * Enrichers registered from a plugin's BOOT declarations (AGL-4195), which\n * `instrumentation.ts` runs in a compilation of its own: a module-scope list\n * filled there is empty where the page route reads it (AGL-3947). These live\n * in the plugin-service registry, on `globalThis`, so the route sees them. A\n * plugin registering again replaces its own (by `key`), and the owner is\n * named at registration, so the page's \"who contributed\" narrowing holds.\n *\n * Plugins registering from a surface the route itself loads (`tenantApi`)\n * keep using `registerSitePageEnricher` (`site-page-hooks.ts`), which runs\n * these after its own.\n */\nexport const SITE_PAGE_ENRICHER_SERVICES = definePluginServiceContract<SitePageEnricher>(\n 'core.site-page-enricher',\n { multiple: true },\n)\n\n/** Registers a boot-time enricher; see {@link SITE_PAGE_ENRICHER_SERVICES}. */\nexport function registerSitePageEnricherService(\n fn: SitePageEnricher,\n options?: { pluginId?: string; key?: string },\n): void {\n registerPluginService(SITE_PAGE_ENRICHER_SERVICES, fn, options)\n}\n\n"],"names":["definePluginServiceContract","registerPluginService","SITE_PAGE_ENRICHER_SERVICES","multiple","registerSitePageEnricherService","fn","options"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,2BAA2B,EAAEC,qBAAqB,QAAQ,uBAAmB;AAGtF;;;;;;;;;;;CAWC,GACD,OAAO,MAAMC,8BAA8BF,4BACzC,2BACA;IAAEG,UAAU;AAAK,GAClB;AAED,6EAA6E,GAC7E,OAAO,SAASC,gCACdC,EAAoB,EACpBC,OAA6C;IAE7CL,sBAAsBC,6BAA6BG,IAAIC;AACzD"}
@@ -17,6 +17,8 @@
17
17
  // `/server` entry, and importing it from this shared barrel formed a cycle
18
18
  // that left the binding missing at runtime (AGL-1289).
19
19
  import { getRegisteringPluginId } from "../app-utils/registering-plugin.js";
20
+ import { resolvePluginServices } from "./plugin-services.js";
21
+ import { SITE_PAGE_ENRICHER_SERVICES } from "./site-page-enricher-services.js";
20
22
  const redirectResolvers = [];
21
23
  const pageResolvers = [];
22
24
  const enrichers = [];
@@ -97,12 +99,24 @@ export async function runSitePageEnrichers(context) {
97
99
  // preserves — so two enrichers contributing the same key resolve exactly as
98
100
  // they did when the loop was sequential, and `contributors` keeps its
99
101
  // insertion order.
100
- const settled = await Promise.allSettled(enrichers.map(async (enricher)=>{
102
+ //
103
+ // The route's own list first, then the boot's (AGL-4195), each with its owner.
104
+ const all = [
105
+ ...enrichers.map((enricher)=>({
106
+ enricher,
107
+ owner: enricherOwners.get(enricher)
108
+ })),
109
+ ...resolvePluginServices(SITE_PAGE_ENRICHER_SERVICES).map(({ impl, pluginId })=>({
110
+ enricher: impl,
111
+ owner: pluginId
112
+ }))
113
+ ];
114
+ const settled = await Promise.allSettled(all.map(async ({ enricher })=>{
101
115
  var _ref;
102
116
  return (_ref = await enricher(context)) != null ? _ref : {};
103
117
  }));
104
118
  for (const [index, outcome] of settled.entries()){
105
- const enricher = enrichers[index];
119
+ const { owner } = all[index];
106
120
  try {
107
121
  if (outcome.status === 'rejected') throw outcome.reason;
108
122
  const result = outcome.value;
@@ -123,7 +137,6 @@ export async function runSitePageEnrichers(context) {
123
137
  // off presence would mark it a contributor everywhere and the
124
138
  // attribution would be worth nothing.
125
139
  if (Object.values(result).some((value)=>!isEmptyContribution(value))) {
126
- const owner = enricherOwners.get(enricher);
127
140
  if (owner) contributors.add(owner);
128
141
  else unattributed = true;
129
142
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/site-page-hooks.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// The leaf module, NOT `api-plugins` — that one is reachable only through the\n// `/server` entry, and importing it from this shared barrel formed a cycle\n// that left the binding missing at runtime (AGL-1289).\nimport { getRegisteringPluginId } from '../app-utils/registering-plugin'\n\n/**\n * Tenant page-composition extension points (AGL-418): plugins hook the\n * site loader (`load-page-data`) from their `/server` entries instead of\n * the app importing plugin domain code. Three kinds, run in this order:\n *\n * 1. REDIRECT RESOLVERS — may answer a request with a redirect before any\n * route resolution (plugins-redirects' rule engine, AGL-155).\n * 2. PAGE RESOLVERS — may fully resolve a path into page props\n * (plugins-commerce's PDP/PLP template composition for /products/* and\n * /collections/*, AGL-299). First non-undefined answer wins.\n * 3. ENRICHERS — contribute extra props onto an already-resolved screen\n * page (plugins-marketing's overlays/experiments/client-automations).\n * Outputs are shallow-merged into the page props in registration order.\n *\n * Handlers run server-side (node runtime) and may use firebase-admin.\n * Errors in enrichers are isolated (a broken plugin never 500s the site);\n * resolver errors propagate because their output IS the page.\n */\n\nexport interface SitePageContext {\n hostId: string\n /** The resolved host doc. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n host: any\n /** The org billing doc (entitlement source); undefined pre-billing. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n org?: any\n /** Request path, '/a/b' form ('/' for the site root). */\n path: string\n slugSegments: string[]\n /**\n * This surface has NO single request path, so `path` above is a\n * placeholder and nothing may be targeted by it (AGL-2511).\n *\n * One surface sets it: the host's designed 404 body. The `not-found`\n * boundary fetches it by host and the response is cached per HOST — one\n * compose a minute however many missing URLs are hit, which is the whole\n * reason a scan of ten thousand dead URLs is cheap. Enriching it per path\n * would key that cache per URL and make the same scan ten thousand\n * composes.\n *\n * An enricher that reads `path` must, when this is set, contribute only\n * what is path-INDEPENDENT and drop the rest — never substitute a plausible\n * path. A site-wide announcement bar is path-independent and shows; an\n * overlay pinned to `/pricing` cannot be evaluated and does not.\n */\n pathUnknown?: boolean\n screenId?: string\n /** The resolved screen doc (enrichers only). */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n screen?: any\n /**\n * The composed node tree for the page — layout applied, versions and\n * references denormalized (enrichers only, AGL-659).\n *\n * An enricher that wants to seed a block's data server-side has to know\n * which blocks are actually on the page and how each one is configured;\n * the screen doc alone does not say, because composition pulls in layout\n * and referenced nodes.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n nodes?: any\n}\n\nexport interface SiteRedirectAnswer {\n destination: string\n statusCode: number\n}\nexport type SiteRedirectResolver = (\n context: SitePageContext,\n) => Promise<SiteRedirectAnswer | undefined> | SiteRedirectAnswer | undefined\n\n/** A fully-composed page (the loader returns it verbatim as `props`). */\nexport type SitePageAnswer = Record<string, unknown>\nexport type SitePageResolver = (\n context: SitePageContext,\n) => Promise<SitePageAnswer | undefined>\n\nexport type SitePageEnricher = (\n context: SitePageContext,\n) => Promise<Record<string, unknown> | undefined>\n\nconst redirectResolvers: SiteRedirectResolver[] = []\nconst pageResolvers: SitePageResolver[] = []\nconst enrichers: SitePageEnricher[] = []\n/**\n * Which plugin registered which enricher (AGL-1289). Recorded from the loader's\n * existing \"currently registering\" marker — the same mechanism that gives\n * `registerPluginApiRoute` its path→plugin ownership — so plugins need no new\n * API and nothing has to be kept in sync by hand.\n */\nconst enricherOwners = new WeakMap<SitePageEnricher, string>()\n\nexport function registerSiteRedirectResolver(fn: SiteRedirectResolver): void {\n redirectResolvers.push(fn)\n}\nexport function registerSitePageResolver(fn: SitePageResolver): void {\n pageResolvers.push(fn)\n}\nexport function registerSitePageEnricher(fn: SitePageEnricher): void {\n enrichers.push(fn)\n const owner = getRegisteringPluginId()\n if (owner) enricherOwners.set(fn, owner)\n}\n\nexport async function resolveSiteRedirect(\n context: SitePageContext,\n): Promise<SiteRedirectAnswer | undefined> {\n for (const resolver of redirectResolvers) {\n const answer = await resolver(context)\n if (answer) return answer\n }\n return undefined\n}\n\nexport async function resolveSitePage(\n context: SitePageContext,\n): Promise<SitePageAnswer | undefined> {\n for (const resolver of pageResolvers) {\n const answer = await resolver(context)\n if (answer) return answer\n }\n return undefined\n}\n\n/** Null/undefined, an empty array or an empty object — nothing to render. */\nfunction isEmptyContribution(value: unknown): boolean {\n if (value == null) return true\n if (Array.isArray(value)) return value.length === 0\n if (typeof value === 'object') return Object.keys(value).length === 0\n return false\n}\n\n/**\n * The page prop an enricher names the vendors it loads on the ANALYTICS\n * grant with (AGL-3698): a feature that loads a third party with the page\n * only for a visitor whose recorded consent grants analytics — a live chat\n * set to load with the page — names it here, so the consent banner the\n * visitor answers names it too. A list of display names, `['Tidio chat']`.\n *\n * The one key enrichers SHARE rather than own: every contribution is joined,\n * not overwritten, so two plugins each naming a vendor both reach the banner.\n */\nexport const CONSENT_ANALYTICS_VENDORS_PROP = 'consentAnalyticsVendors'\n\n/** The vendor names a page's props carry under {@link CONSENT_ANALYTICS_VENDORS_PROP}. */\nexport function consentAnalyticsVendorsOf(props: unknown): string[] {\n const value = (props as Record<string, unknown> | null | undefined)?.[\n CONSENT_ANALYTICS_VENDORS_PROP\n ]\n if (!Array.isArray(value)) return []\n const out: string[] = []\n for (const entry of value) {\n if (typeof entry !== 'string') continue\n const name = entry.trim().slice(0, 60)\n if (name && !out.includes(name)) out.push(name)\n }\n return out\n}\n\nexport interface SitePageEnrichment {\n /** The merged contributions, spread into the page props as before. */\n props: Record<string, unknown>\n /** Plugins that returned something non-empty for THIS page. */\n contributors: string[]\n /**\n * True when an enricher produced work but could not be attributed to a\n * plugin — registered outside a plugin's register fn, so the loader's\n * marker was unset. Callers narrowing on `contributors` must treat this as\n * \"cannot narrow\": an unattributed contribution belongs to somebody.\n */\n unattributed: boolean\n}\n\nexport async function runSitePageEnrichers(\n context: SitePageContext,\n): Promise<SitePageEnrichment> {\n const merged: Record<string, unknown> = {}\n const contributors = new Set<string>()\n let unattributed = false\n\n // CONCURRENT, MERGED IN REGISTRATION ORDER (2026-08-26).\n //\n // This was a sequential `for … await`, so every enricher waited on the one\n // before it for no reason: each takes the same immutable `context`, returns\n // its own prop slice, and shares nothing. Production timing put the phase at\n // a flat ~85–120 ms on EVERY render — including pages whose entire loader\n // was 137 ms — because it is a fixed number of round trips, not work that\n // scales with the page.\n //\n // `allSettled` rather than `all`: a broken plugin must drop its slice, never\n // the page, which is the isolation the per-enricher try/catch gave and the\n // plugin docs promise. Results are merged in ARRAY order, which `allSettled`\n // preserves — so two enrichers contributing the same key resolve exactly as\n // they did when the loop was sequential, and `contributors` keeps its\n // insertion order.\n const settled = await Promise.allSettled(\n enrichers.map(async (enricher) => (await enricher(context)) ?? {}),\n )\n\n for (const [index, outcome] of settled.entries()) {\n const enricher = enrichers[index]\n try {\n if (outcome.status === 'rejected') throw outcome.reason\n const result = outcome.value\n const vendors = [\n ...consentAnalyticsVendorsOf(merged),\n ...consentAnalyticsVendorsOf(result),\n ]\n Object.assign(merged, result)\n // Joined, not overwritten — see CONSENT_ANALYTICS_VENDORS_PROP.\n if (vendors.length) {\n merged[CONSENT_ANALYTICS_VENDORS_PROP] = consentAnalyticsVendorsOf({\n [CONSENT_ANALYTICS_VENDORS_PROP]: vendors,\n })\n }\n // \"Contributed\" means produced something with content, not merely\n // returned a key. Every marketing enricher returns its full key set on\n // every page — `announcementBar: null`, `experiments: []` — so keying\n // off presence would mark it a contributor everywhere and the\n // attribution would be worth nothing.\n if (Object.values(result).some((value) => !isEmptyContribution(value))) {\n const owner = enricherOwners.get(enricher)\n if (owner) contributors.add(owner)\n else unattributed = true\n }\n } catch (error) {\n // A broken plugin must not take the site down — the page renders\n // without that plugin's contribution.\n console.error('site page enricher failed', error)\n }\n }\n return { props: merged, contributors: [...contributors], unattributed }\n}\n"],"names":["getRegisteringPluginId","redirectResolvers","pageResolvers","enrichers","enricherOwners","WeakMap","registerSiteRedirectResolver","fn","push","registerSitePageResolver","registerSitePageEnricher","owner","set","resolveSiteRedirect","context","resolver","answer","undefined","resolveSitePage","isEmptyContribution","value","Array","isArray","length","Object","keys","CONSENT_ANALYTICS_VENDORS_PROP","consentAnalyticsVendorsOf","props","out","entry","name","trim","slice","includes","runSitePageEnrichers","merged","contributors","Set","unattributed","settled","Promise","allSettled","map","enricher","index","outcome","entries","status","reason","result","vendors","assign","values","some","get","add","error","console"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,8EAA8E;AAC9E,2EAA2E;AAC3E,uDAAuD;AACvD,SAASA,sBAAsB,QAAQ,qCAAiC;AAoFxE,MAAMC,oBAA4C,EAAE;AACpD,MAAMC,gBAAoC,EAAE;AAC5C,MAAMC,YAAgC,EAAE;AACxC;;;;;CAKC,GACD,MAAMC,iBAAiB,IAAIC;AAE3B,OAAO,SAASC,6BAA6BC,EAAwB;IACnEN,kBAAkBO,IAAI,CAACD;AACzB;AACA,OAAO,SAASE,yBAAyBF,EAAoB;IAC3DL,cAAcM,IAAI,CAACD;AACrB;AACA,OAAO,SAASG,yBAAyBH,EAAoB;IAC3DJ,UAAUK,IAAI,CAACD;IACf,MAAMI,QAAQX;IACd,IAAIW,OAAOP,eAAeQ,GAAG,CAACL,IAAII;AACpC;AAEA,OAAO,eAAeE,oBACpBC,OAAwB;IAExB,KAAK,MAAMC,YAAYd,kBAAmB;QACxC,MAAMe,SAAS,MAAMD,SAASD;QAC9B,IAAIE,QAAQ,OAAOA;IACrB;IACA,OAAOC;AACT;AAEA,OAAO,eAAeC,gBACpBJ,OAAwB;IAExB,KAAK,MAAMC,YAAYb,cAAe;QACpC,MAAMc,SAAS,MAAMD,SAASD;QAC9B,IAAIE,QAAQ,OAAOA;IACrB;IACA,OAAOC;AACT;AAEA,2EAA2E,GAC3E,SAASE,oBAAoBC,KAAc;IACzC,IAAIA,SAAS,MAAM,OAAO;IAC1B,IAAIC,MAAMC,OAAO,CAACF,QAAQ,OAAOA,MAAMG,MAAM,KAAK;IAClD,IAAI,OAAOH,UAAU,UAAU,OAAOI,OAAOC,IAAI,CAACL,OAAOG,MAAM,KAAK;IACpE,OAAO;AACT;AAEA;;;;;;;;;CASC,GACD,OAAO,MAAMG,iCAAiC,0BAAyB;AAEvE,wFAAwF,GACxF,OAAO,SAASC,0BAA0BC,KAAc;IACtD,MAAMR,QAASQ,yBAAD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AAEyB;gBACpC;YACF;YACA,kEAAkE;YAClE,uEAAuE;YACvE,sEAAsE;YACtE,8DAA8D;YAC9D,sCAAsC;YACtC,IAAI3B,OAAO6B,MAAM,CAACH,QAAQI,IAAI,CAAC,CAAClC,QAAU,CAACD,oBAAoBC,SAAS;gBACtE,MAAMT,QAAQP,eAAemD,GAAG,CAACX;gBACjC,IAAIjC,OAAO0B,aAAamB,GAAG,CAAC7C;qBACvB4B,eAAe;YACtB;QACF,EAAE,OAAOkB,OAAO;YACd,iEAAiE;YACjE,sCAAsC;YACtCC,QAAQD,KAAK,CAAC,6BAA6BA;QAC7C;IACF;IACA,OAAO;QAAE7B,OAAOQ;QAAQC,cAAc;eAAIA;SAAa;QAAEE;IAAa;AACxE"}
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/site-page-hooks.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// The leaf module, NOT `api-plugins` — that one is reachable only through the\n// `/server` entry, and importing it from this shared barrel formed a cycle\n// that left the binding missing at runtime (AGL-1289).\nimport { getRegisteringPluginId } from '../app-utils/registering-plugin'\nimport { resolvePluginServices } from './plugin-services'\nimport { SITE_PAGE_ENRICHER_SERVICES } from './site-page-enricher-services'\n\n/**\n * Tenant page-composition extension points (AGL-418): plugins hook the\n * site loader (`load-page-data`) from their `/server` entries instead of\n * the app importing plugin domain code. Three kinds, run in this order:\n *\n * 1. REDIRECT RESOLVERS — may answer a request with a redirect before any\n * route resolution (plugins-redirects' rule engine, AGL-155).\n * 2. PAGE RESOLVERS — may fully resolve a path into page props\n * (plugins-commerce's PDP/PLP template composition for /products/* and\n * /collections/*, AGL-299). First non-undefined answer wins.\n * 3. ENRICHERS — contribute extra props onto an already-resolved screen\n * page (plugins-marketing's overlays/experiments/client-automations).\n * Outputs are shallow-merged into the page props in registration order.\n *\n * Handlers run server-side (node runtime) and may use firebase-admin.\n * Errors in enrichers are isolated (a broken plugin never 500s the site);\n * resolver errors propagate because their output IS the page.\n */\n\nexport interface SitePageContext {\n hostId: string\n /** The resolved host doc. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n host: any\n /** The org billing doc (entitlement source); undefined pre-billing. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n org?: any\n /** Request path, '/a/b' form ('/' for the site root). */\n path: string\n slugSegments: string[]\n /**\n * This surface has NO single request path, so `path` above is a\n * placeholder and nothing may be targeted by it (AGL-2511).\n *\n * One surface sets it: the host's designed 404 body. The `not-found`\n * boundary fetches it by host and the response is cached per HOST — one\n * compose a minute however many missing URLs are hit, which is the whole\n * reason a scan of ten thousand dead URLs is cheap. Enriching it per path\n * would key that cache per URL and make the same scan ten thousand\n * composes.\n *\n * An enricher that reads `path` must, when this is set, contribute only\n * what is path-INDEPENDENT and drop the rest — never substitute a plausible\n * path. A site-wide announcement bar is path-independent and shows; an\n * overlay pinned to `/pricing` cannot be evaluated and does not.\n */\n pathUnknown?: boolean\n screenId?: string\n /** The resolved screen doc (enrichers only). */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n screen?: any\n /**\n * The composed node tree for the page — layout applied, versions and\n * references denormalized (enrichers only, AGL-659).\n *\n * An enricher that wants to seed a block's data server-side has to know\n * which blocks are actually on the page and how each one is configured;\n * the screen doc alone does not say, because composition pulls in layout\n * and referenced nodes.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n nodes?: any\n}\n\nexport interface SiteRedirectAnswer {\n destination: string\n statusCode: number\n}\nexport type SiteRedirectResolver = (\n context: SitePageContext,\n) => Promise<SiteRedirectAnswer | undefined> | SiteRedirectAnswer | undefined\n\n/** A fully-composed page (the loader returns it verbatim as `props`). */\nexport type SitePageAnswer = Record<string, unknown>\nexport type SitePageResolver = (\n context: SitePageContext,\n) => Promise<SitePageAnswer | undefined>\n\nexport type SitePageEnricher = (\n context: SitePageContext,\n) => Promise<Record<string, unknown> | undefined>\n\nconst redirectResolvers: SiteRedirectResolver[] = []\nconst pageResolvers: SitePageResolver[] = []\nconst enrichers: SitePageEnricher[] = []\n/**\n * Which plugin registered which enricher (AGL-1289). Recorded from the loader's\n * existing \"currently registering\" marker — the same mechanism that gives\n * `registerPluginApiRoute` its path→plugin ownership — so plugins need no new\n * API and nothing has to be kept in sync by hand.\n */\nconst enricherOwners = new WeakMap<SitePageEnricher, string>()\n\nexport function registerSiteRedirectResolver(fn: SiteRedirectResolver): void {\n redirectResolvers.push(fn)\n}\nexport function registerSitePageResolver(fn: SitePageResolver): void {\n pageResolvers.push(fn)\n}\nexport function registerSitePageEnricher(fn: SitePageEnricher): void {\n enrichers.push(fn)\n const owner = getRegisteringPluginId()\n if (owner) enricherOwners.set(fn, owner)\n}\n\nexport async function resolveSiteRedirect(\n context: SitePageContext,\n): Promise<SiteRedirectAnswer | undefined> {\n for (const resolver of redirectResolvers) {\n const answer = await resolver(context)\n if (answer) return answer\n }\n return undefined\n}\n\nexport async function resolveSitePage(\n context: SitePageContext,\n): Promise<SitePageAnswer | undefined> {\n for (const resolver of pageResolvers) {\n const answer = await resolver(context)\n if (answer) return answer\n }\n return undefined\n}\n\n/** Null/undefined, an empty array or an empty object — nothing to render. */\nfunction isEmptyContribution(value: unknown): boolean {\n if (value == null) return true\n if (Array.isArray(value)) return value.length === 0\n if (typeof value === 'object') return Object.keys(value).length === 0\n return false\n}\n\n/**\n * The page prop an enricher names the vendors it loads on the ANALYTICS\n * grant with (AGL-3698): a feature that loads a third party with the page\n * only for a visitor whose recorded consent grants analytics — a live chat\n * set to load with the page — names it here, so the consent banner the\n * visitor answers names it too. A list of display names, `['Tidio chat']`.\n *\n * The one key enrichers SHARE rather than own: every contribution is joined,\n * not overwritten, so two plugins each naming a vendor both reach the banner.\n */\nexport const CONSENT_ANALYTICS_VENDORS_PROP = 'consentAnalyticsVendors'\n\n/** The vendor names a page's props carry under {@link CONSENT_ANALYTICS_VENDORS_PROP}. */\nexport function consentAnalyticsVendorsOf(props: unknown): string[] {\n const value = (props as Record<string, unknown> | null | undefined)?.[\n CONSENT_ANALYTICS_VENDORS_PROP\n ]\n if (!Array.isArray(value)) return []\n const out: string[] = []\n for (const entry of value) {\n if (typeof entry !== 'string') continue\n const name = entry.trim().slice(0, 60)\n if (name && !out.includes(name)) out.push(name)\n }\n return out\n}\n\nexport interface SitePageEnrichment {\n /** The merged contributions, spread into the page props as before. */\n props: Record<string, unknown>\n /** Plugins that returned something non-empty for THIS page. */\n contributors: string[]\n /**\n * True when an enricher produced work but could not be attributed to a\n * plugin — registered outside a plugin's register fn, so the loader's\n * marker was unset. Callers narrowing on `contributors` must treat this as\n * \"cannot narrow\": an unattributed contribution belongs to somebody.\n */\n unattributed: boolean\n}\n\nexport async function runSitePageEnrichers(\n context: SitePageContext,\n): Promise<SitePageEnrichment> {\n const merged: Record<string, unknown> = {}\n const contributors = new Set<string>()\n let unattributed = false\n\n // CONCURRENT, MERGED IN REGISTRATION ORDER (2026-08-26).\n //\n // This was a sequential `for … await`, so every enricher waited on the one\n // before it for no reason: each takes the same immutable `context`, returns\n // its own prop slice, and shares nothing. Production timing put the phase at\n // a flat ~85–120 ms on EVERY render — including pages whose entire loader\n // was 137 ms — because it is a fixed number of round trips, not work that\n // scales with the page.\n //\n // `allSettled` rather than `all`: a broken plugin must drop its slice, never\n // the page, which is the isolation the per-enricher try/catch gave and the\n // plugin docs promise. Results are merged in ARRAY order, which `allSettled`\n // preserves — so two enrichers contributing the same key resolve exactly as\n // they did when the loop was sequential, and `contributors` keeps its\n // insertion order.\n //\n // The route's own list first, then the boot's (AGL-4195), each with its owner.\n const all: Array<{ enricher: SitePageEnricher; owner: string | undefined }> = [\n ...enrichers.map((enricher) => ({ enricher, owner: enricherOwners.get(enricher) })),\n ...resolvePluginServices(SITE_PAGE_ENRICHER_SERVICES).map(({ impl, pluginId }) => ({\n enricher: impl,\n owner: pluginId,\n })),\n ]\n const settled = await Promise.allSettled(\n all.map(async ({ enricher }) => (await enricher(context)) ?? {}),\n )\n\n for (const [index, outcome] of settled.entries()) {\n const { owner } = all[index]\n try {\n if (outcome.status === 'rejected') throw outcome.reason\n const result = outcome.value\n const vendors = [\n ...consentAnalyticsVendorsOf(merged),\n ...consentAnalyticsVendorsOf(result),\n ]\n Object.assign(merged, result)\n // Joined, not overwritten — see CONSENT_ANALYTICS_VENDORS_PROP.\n if (vendors.length) {\n merged[CONSENT_ANALYTICS_VENDORS_PROP] = consentAnalyticsVendorsOf({\n [CONSENT_ANALYTICS_VENDORS_PROP]: vendors,\n })\n }\n // \"Contributed\" means produced something with content, not merely\n // returned a key. Every marketing enricher returns its full key set on\n // every page — `announcementBar: null`, `experiments: []` — so keying\n // off presence would mark it a contributor everywhere and the\n // attribution would be worth nothing.\n if (Object.values(result).some((value) => !isEmptyContribution(value))) {\n if (owner) contributors.add(owner)\n else unattributed = true\n }\n } catch (error) {\n // A broken plugin must not take the site down — the page renders\n // without that plugin's contribution.\n console.error('site page enricher failed', error)\n }\n }\n return { props: merged, contributors: [...contributors], unattributed }\n}\n"],"names":["getRegisteringPluginId","resolvePluginServices","SITE_PAGE_ENRICHER_SERVICES","redirectResolvers","pageResolvers","enrichers","enricherOwners","WeakMap","registerSiteRedirectResolver","fn","push","registerSitePageResolver","registerSitePageEnricher","owner","set","resolveSiteRedirect","context","resolver","answer","undefined","resolveSitePage","isEmptyContribution","value","Array","isArray","length","Object","keys","CONSENT_ANALYTICS_VENDORS_PROP","consentAnalyticsVendorsOf","props","out","entry","name","trim","slice","includes","runSitePageEnrichers","merged","contributors","Set","unattributed","all","map","enricher","get","impl","pluginId","settled","Promise","allSettled","index","outcome","entries","status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;QAChD,MAAM,EAAExC,KAAK,EAAE,GAAG6B,GAAG,CAACS,MAAM;QAC5B,IAAI;YACF,IAAIC,QAAQE,MAAM,KAAK,YAAY,MAAMF,QAAQG,MAAM;YACvD,MAAMC,SAASJ,QAAQ9B,KAAK;YAC5B,MAAMmC,UAAU;mBACX5B,0BAA0BS;mBAC1BT,0BAA0B2B;aAC9B;YACD9B,OAAOgC,MAAM,CAACpB,QAAQkB;YACtB,gEAAgE;YAChE,IAAIC,QAAQhC,MAAM,EAAE;gBAClBa,MAAM,CAACV,+BAA+B,GAAGC,0BAA0B;oBACjE,CAACD,+BAA+B,EAAE6B;gBACpC;YACF;YACA,kEAAkE;YAClE,uEAAuE;YACvE,sEAAsE;YACtE,8DAA8D;YAC9D,sCAAsC;YACtC,IAAI/B,OAAOiC,MAAM,CAACH,QAAQI,IAAI,CAAC,CAACtC,QAAU,CAACD,oBAAoBC,SAAS;gBACtE,IAAIT,OAAO0B,aAAasB,GAAG,CAAChD;qBACvB4B,eAAe;YACtB;QACF,EAAE,OAAOqB,OAAO;YACd,iEAAiE;YACjE,sCAAsC;YACtCC,QAAQD,KAAK,CAAC,6BAA6BA;QAC7C;IACF;IACA,OAAO;QAAEhC,OAAOQ;QAAQC,cAAc;eAAIA;SAAa;QAAEE;IAAa;AACxE"}
@@ -96,6 +96,23 @@ export interface VideoEmbedProviderDeclaration {
96
96
  playerPath: string;
97
97
  /** The query every player address carries, in this order. */
98
98
  playerQuery?: readonly VideoEmbedPlayerParam[];
99
+ /**
100
+ * The one origin the host serves its own still of each film from
101
+ * (AGL-4140), for a host that publishes one at an address built from the
102
+ * media id alone. With {@link posterPath}, or neither: a host with no
103
+ * public still keeps asking the author for a poster.
104
+ *
105
+ * A visitor's browser loads the still from here on page load, before any
106
+ * press, so a page that shows one sends the host the visitor's IP address
107
+ * and user-agent. That is a recipient the platform chooses, not the author:
108
+ * the Video element shows it only where `release_video_embed_posters` is on
109
+ * for the site's workspace (`SiteContextValue.videoEmbedPosters`), and the
110
+ * published page's `img-src` admits {@link videoEmbedPosterOrigins} only
111
+ * there.
112
+ */
113
+ posterOrigin?: string;
114
+ /** The still's path on {@link posterOrigin}; `{id}` is the media id. */
115
+ posterPath?: string;
99
116
  }
100
117
  /** A declaration, with the plugin that made it. */
101
118
  export interface ResolvedVideoEmbedProvider extends VideoEmbedProviderDeclaration {
@@ -133,5 +150,16 @@ export declare function videoEmbedPlayerSrc(value: unknown, options?: VideoEmbed
133
150
  * `frame-src` admits for the Video element.
134
151
  */
135
152
  export declare function videoEmbedPlayerOrigins(providers?: readonly ResolvedVideoEmbedProvider[]): string[];
153
+ /**
154
+ * The host's own still of the film a declared host's link names
155
+ * (AGL-4140), rebuilt from the media id and the declaration alone, or
156
+ * `undefined` for a host that publishes none and for any other value.
157
+ */
158
+ export declare function videoEmbedPosterSrc(value: unknown, providers?: readonly ResolvedVideoEmbedProvider[]): string | undefined;
159
+ /**
160
+ * Every origin a declared host serves its stills from: what a published
161
+ * page's `img-src` admits, where the site's workspace shows them.
162
+ */
163
+ export declare function videoEmbedPosterOrigins(providers?: readonly ResolvedVideoEmbedProvider[]): string[];
136
164
  /** The declared hosts' names, as an author knows them. */
137
165
  export declare function videoEmbedProviderLabels(providers?: readonly ResolvedVideoEmbedProvider[]): string[];
@@ -177,6 +177,27 @@ function onDomain(hostname, domains) {
177
177
  ...new Set(providers.map((provider)=>provider.playerOrigin))
178
178
  ];
179
179
  }
180
+ /**
181
+ * The host's own still of the film a declared host's link names
182
+ * (AGL-4140), rebuilt from the media id and the declaration alone, or
183
+ * `undefined` for a host that publishes none and for any other value.
184
+ */ export function videoEmbedPosterSrc(value, providers) {
185
+ var _ref;
186
+ const embed = videoEmbedOf(value, providers);
187
+ const { posterOrigin, posterPath } = (_ref = embed == null ? void 0 : embed.provider) != null ? _ref : {};
188
+ if (!embed || !posterOrigin || !posterPath) return undefined;
189
+ return `${posterOrigin}${posterPath.replace(ID_PLACEHOLDER, embed.mediaId)}`;
190
+ }
191
+ /**
192
+ * Every origin a declared host serves its stills from: what a published
193
+ * page's `img-src` admits, where the site's workspace shows them.
194
+ */ export function videoEmbedPosterOrigins(providers = videoEmbedProviders()) {
195
+ return [
196
+ ...new Set(providers.flatMap((provider)=>provider.posterOrigin && provider.posterPath ? [
197
+ provider.posterOrigin
198
+ ] : []))
199
+ ];
200
+ }
180
201
  /** The declared hosts' names, as an author knows them. */ export function videoEmbedProviderLabels(providers = videoEmbedProviders()) {
181
202
  return providers.map((provider)=>provider.label);
182
203
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/video-embed-provider.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A VIDEO HOST WHOSE OWN PLAYER A VIDEO PLAYS IN (AGL-3080).\n *\n * Some video hosts hand an author a link to a page, not to a file: the film\n * plays only inside the host's player, framed from the host's origin. The\n * Video element recognizes such a link, keeps only the media id it names,\n * and frames the host's player for it. Core never names a host. A plugin\n * DECLARES one — the domains its links live on, where in the path the media\n * id sits, the one origin its player is framed from, and the query that\n * player reads — and core's resolvers answer from the declarations alone.\n *\n * This sits beside `media-delivery-provider.ts` and is not that seam. A\n * delivery provider is where the platform serves ITS OWN copy of a file\n * from; an embed provider is a host whose player the author chose, which the\n * platform never serves a byte of.\n *\n * ## Only the media id survives\n *\n * The string an author pasted never reaches a frame. {@link videoEmbedOf}\n * reads the media id out of it, and every address below is rebuilt from the\n * declaration and that id alone, so a declared player is framed from its\n * declared origin and nowhere else. That closed set is what lets a published\n * page's `frame-src` name the origin for every site\n * ({@link videoEmbedPlayerOrigins}). The id must match the declaration's own\n * pattern AND {@link SAFE_MEDIA_ID}, so no declaration can widen the path it\n * is put into.\n *\n * ## Compiled, and deliberately without a runtime registrar\n *\n * The readers are the published page and its policy: the Video element that\n * plays the link, the `VideoObject` a crawler reads, the built-in entry page\n * that decides whether a featured film can play, and the tenant middleware\n * whose `frame-src` must admit the player. None of them loads a plugin's\n * console code, and the middleware loads no plugin at all. A registry one of\n * them had not filled would render a customer's link as a `<video>` pointed\n * at an HTML page, or refuse the frame, and nothing would go red — the\n * AGL-3025 shape, on the customer's own film. So a first-party plugin\n * declares its hosts under `videoEmbedProviders` in `plugins.config.json`,\n * `tools/scripts/generate-plugin-manifests.mjs` validates and compiles them,\n * and this module reads the compiled list.\n *\n * A marketplace plugin cannot add a host this way, and that is the point\n * rather than a gap: a declaration widens every published page's\n * `frame-src`, which is a platform decision, not one a plugin's own code\n * makes at runtime.\n *\n * ## What \"absent\" means\n *\n * A link no declaration recognizes is an ordinary URL, rendered exactly as\n * any other link is. Removing a declaration therefore turns its links back\n * into plain URLs, which play nothing — so the declaring plugin's spec holds\n * the declaration to the links it must keep reading.\n */\n\nimport { FIRST_PARTY_VIDEO_EMBED_PROVIDERS } from './video-embed-providers.generated'\n\n/**\n * A choice the Video element makes for each player it frames. A declaration\n * says how its player spells each one it supports; one it does not name is\n * never sent.\n *\n * - `autoPlay` — start as soon as the player is ready. ON unless the caller\n * passes exactly `false`: the usual frame is the one a visitor's press\n * loads, and a second play button inside it would ask them twice.\n * - `doNotTrack` — ask the host not to record the viewing session.\n * - `muted` — start without sound.\n * - `loop` — restart at the end.\n */\nexport type VideoEmbedPlayerOption = 'autoPlay' | 'doNotTrack' | 'muted' | 'loop'\n\nexport const VIDEO_EMBED_PLAYER_OPTIONS: readonly VideoEmbedPlayerOption[] = [\n 'autoPlay',\n 'doNotTrack',\n 'muted',\n 'loop',\n]\n\nexport type VideoEmbedPlayerOptions = Partial<\n Record<VideoEmbedPlayerOption, boolean>\n>\n\n/**\n * One query parameter of a player address, in the order the declaration\n * lists them. Either `value`, sent on every address, or an `option` whose\n * state picks `on` or `off`; a state with no value leaves the parameter out.\n *\n * A value may name the media id as `{id}` (AGL-4140), for a player that\n * repeats it in its query, such as one that loops a single film only as a\n * playlist of itself. The id has passed both patterns by then, so it\n * carries nothing a query could be widened with.\n */\nexport type VideoEmbedPlayerParam =\n | { param: string; value: string }\n | {\n param: string\n option: VideoEmbedPlayerOption\n on?: string\n off?: string\n }\n\n/**\n * A link shape {@link VideoEmbedProviderDeclaration.mediaIdPaths} cannot\n * describe (AGL-4140): one that names its media id in the QUERY rather than\n * the path (`/watch?v={id}`), or one only some of the host's domains use (a\n * short-link domain whose whole path is the id, a shape that would misread a\n * page on the host's main domain).\n */\nexport interface VideoEmbedMediaIdLink {\n /**\n * A regular expression over the link's PATH, anchored at both ends. Without\n * {@link param}, its first capture group is the media id.\n */\n path: string\n /** The query parameter that holds the media id, for a path that names none. */\n param?: string\n /**\n * The declared domains this shape is read on, each matched as\n * {@link VideoEmbedProviderDeclaration.domains} are; every declared domain\n * when absent.\n */\n domains?: readonly string[]\n}\n\nexport interface VideoEmbedProviderDeclaration {\n /** Stable id, unique across plugins. */\n id: string\n /** The host's name as an author knows it, for labels and help text. */\n label: string\n /**\n * The domains a link's host must equal or end in (after a dot). Exact or\n * dot-anchored only, so a domain that merely contains one is refused.\n */\n domains: readonly string[]\n /**\n * Regular expressions over a link's PATH, anchored at both ends, whose\n * first capture group is the media id. The host is checked separately,\n * against {@link domains}.\n */\n mediaIdPaths: readonly string[]\n /** The link shapes the paths cannot describe, tried after them. */\n mediaIdLinks?: readonly VideoEmbedMediaIdLink[]\n /** A regular expression, anchored at both ends, a media id must match. */\n mediaIdPattern: string\n /** The one origin the host's player is framed from. */\n playerOrigin: string\n /** The player page's path on {@link playerOrigin}; `{id}` is the media id. */\n playerPath: string\n /** The query every player address carries, in this order. */\n playerQuery?: readonly VideoEmbedPlayerParam[]\n}\n\n/** A declaration, with the plugin that made it. */\nexport interface ResolvedVideoEmbedProvider\n extends VideoEmbedProviderDeclaration {\n pluginId: string\n}\n\n/** A link a declared host recognized. */\nexport interface VideoEmbed {\n provider: ResolvedVideoEmbedProvider\n /** The media id the link named, and nothing else of it. */\n mediaId: string\n /**\n * The player page with no per-visit options — what a `VideoObject`\n * publishes as `embedUrl`.\n */\n embedUrl: string\n}\n\n/**\n * The floor every media id stands on, whatever a declaration's own pattern\n * admits: no separator, dot, query or fragment can reach the player path.\n */\nconst SAFE_MEDIA_ID = /^[A-Za-z0-9_-]{1,64}$/\n\n/** The placeholder a `playerPath` names the media id with. */\nconst ID_PLACEHOLDER = '{id}'\n\n/** Every host a first-party plugin declares. */\nexport function videoEmbedProviders(): readonly ResolvedVideoEmbedProvider[] {\n return FIRST_PARTY_VIDEO_EMBED_PROVIDERS\n}\n\ninterface CompiledLink {\n path: RegExp\n param?: string\n domains?: readonly string[]\n}\n\ninterface CompiledProvider {\n paths: RegExp[]\n links: CompiledLink[]\n mediaId: RegExp\n}\n\nconst compiled = new WeakMap<VideoEmbedProviderDeclaration, CompiledProvider>()\n\nfunction compile(provider: VideoEmbedProviderDeclaration): CompiledProvider {\n let answer = compiled.get(provider)\n if (!answer) {\n answer = {\n paths: provider.mediaIdPaths.map((source) => new RegExp(source)),\n links: (provider.mediaIdLinks ?? []).map((link) => ({\n path: new RegExp(link.path),\n param: link.param,\n domains: link.domains,\n })),\n mediaId: new RegExp(provider.mediaIdPattern),\n }\n compiled.set(provider, answer)\n }\n return answer\n}\n\n/** The media id a link shape reads from this URL, unchecked. */\nfunction linkMediaId(link: CompiledLink, url: URL): string | undefined {\n if (link.domains && !onDomain(url.hostname, link.domains)) return undefined\n const match = link.path.exec(url.pathname)\n if (!match) return undefined\n return link.param ? (url.searchParams.get(link.param) ?? undefined) : match[1]\n}\n\nfunction onDomain(hostname: string, domains: readonly string[]): boolean {\n return domains.some(\n (domain) => hostname === domain || hostname.endsWith(`.${domain}`),\n )\n}\n\n/**\n * The declared host a link belongs to, with the media id it names, or\n * `undefined` for anything else: a value that is not an http(s) URL, a host\n * nothing declares, or a path that names no id the host's pattern accepts.\n */\nexport function videoEmbedOf(\n value: unknown,\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): VideoEmbed | undefined {\n if (typeof value !== 'string' || !providers.length) return undefined\n let url: URL\n try {\n url = new URL(value.trim())\n } catch {\n return undefined\n }\n if (url.protocol !== 'https:' && url.protocol !== 'http:') return undefined\n for (const provider of providers) {\n if (!onDomain(url.hostname, provider.domains)) continue\n const { paths, links, mediaId } = compile(provider)\n const candidates = [\n ...paths.map((pattern) => pattern.exec(url.pathname)?.[1]),\n ...links.map((link) => linkMediaId(link, url)),\n ]\n for (const id of candidates) {\n if (id && mediaId.test(id) && SAFE_MEDIA_ID.test(id)) {\n return {\n provider,\n mediaId: id,\n embedUrl: `${provider.playerOrigin}${provider.playerPath.replace(ID_PLACEHOLDER, id)}`,\n }\n }\n }\n }\n return undefined\n}\n\n/** The player page for a declared host's link, with no per-visit options. */\nexport function videoEmbedUrl(\n value: unknown,\n providers?: readonly ResolvedVideoEmbedProvider[],\n): string | undefined {\n return videoEmbedOf(value, providers)?.embedUrl\n}\n\n/**\n * The address of a declared host's player frame for this visit, carrying the\n * declaration's query in its own order. See {@link VideoEmbedPlayerOption}\n * for what each option means and which way it defaults.\n */\nexport function videoEmbedPlayerSrc(\n value: unknown,\n options: VideoEmbedPlayerOptions = {},\n providers?: readonly ResolvedVideoEmbedProvider[],\n): string | undefined {\n const embed = videoEmbedOf(value, providers)\n if (!embed) return undefined\n const params = new URLSearchParams()\n const withId = (value: string) =>\n value.split(ID_PLACEHOLDER).join(embed.mediaId)\n for (const entry of embed.provider.playerQuery ?? []) {\n if ('value' in entry) {\n params.set(entry.param, withId(entry.value))\n continue\n }\n const on =\n entry.option === 'autoPlay'\n ? options.autoPlay !== false\n : Boolean(options[entry.option])\n const sent = on ? entry.on : entry.off\n if (sent !== undefined) params.set(entry.param, withId(sent))\n }\n const query = params.toString()\n return query ? `${embed.embedUrl}?${query}` : embed.embedUrl\n}\n\n/**\n * Every origin a declared player is framed from: what a published page's\n * `frame-src` admits for the Video element.\n */\nexport function videoEmbedPlayerOrigins(\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): string[] {\n return [...new Set(providers.map((provider) => provider.playerOrigin))]\n}\n\n/** The declared hosts' names, as an author knows them. */\nexport function videoEmbedProviderLabels(\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): string[] {\n return providers.map((provider) => provider.label)\n}\n"],"names":["FIRST_PARTY_VIDEO_EMBED_PROVIDERS","VIDEO_EMBED_PLAYER_OPTIONS","SAFE_MEDIA_ID","ID_PLACEHOLDER","videoEmbedProviders","compiled","WeakMap","compile","provider","answer","get","paths","mediaIdPaths","map","source","RegExp","links","mediaIdLinks","link","path","param","domains","mediaId","mediaIdPattern","set","linkMediaId","url","onDomain","hostname","undefined","match","exec","pathname","searchParams","some","domain","endsWith","videoEmbedOf","value","providers","length","URL","trim","protocol","candidates","pattern","id","test","embedUrl","playerOrigin","playerPath","replace","videoEmbedUrl","videoEmbedPlayerSrc","options","embed","params","URLSearchParams","withId","split","join","entry","playerQuery","on","option","autoPlay","Boolean","sent","off","query","toString","videoEmbedPlayerOrigins","Set","videoEmbedProviderLabels","label"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDC,GAED,SAASA,iCAAiC,QAAQ,uCAAmC;AAgBrF,OAAO,MAAMC,6BAAgE;IAC3E;IACA;IACA;IACA;CACD,CAAA;AA8FD;;;CAGC,GACD,MAAMC,gBAAgB;AAEtB,4DAA4D,GAC5D,MAAMC,iBAAiB;AAEvB,8CAA8C,GAC9C,OAAO,SAASC;IACd,OAAOJ;AACT;AAcA,MAAMK,WAAW,IAAIC;AAErB,SAASC,QAAQ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M/C,QAAQ,CAACsD,WAAW,YAA1BP,8BAA8B,EAAE,CAAE;QACpD,IAAI,WAAWM,OAAO;YACpBL,OAAOhC,GAAG,CAACqC,MAAMzC,KAAK,EAAEsC,OAAOG,MAAMvB,KAAK;YAC1C;QACF;QACA,MAAMyB,KACJF,MAAMG,MAAM,KAAK,aACbV,QAAQW,QAAQ,KAAK,QACrBC,QAAQZ,OAAO,CAACO,MAAMG,MAAM,CAAC;QACnC,MAAMG,OAAOJ,KAAKF,MAAME,EAAE,GAAGF,MAAMO,GAAG;QACtC,IAAID,SAAStC,WAAW2B,OAAOhC,GAAG,CAACqC,MAAMzC,KAAK,EAAEsC,OAAOS;IACzD;IACA,MAAME,QAAQb,OAAOc,QAAQ;IAC7B,OAAOD,QAAQ,GAAGd,MAAMP,QAAQ,CAAC,CAAC,EAAEqB,OAAO,GAAGd,MAAMP,QAAQ;AAC9D;AAEA;;;CAGC,GACD,OAAO,SAASuB,wBACdhC,YAAmDnC,qBAAqB;IAExE,OAAO;WAAI,IAAIoE,IAAIjC,UAAU1B,GAAG,CAAC,CAACL,WAAaA,SAASyC,YAAY;KAAG;AACzE;AAEA,wDAAwD,GACxD,OAAO,SAASwB,yBACdlC,YAAmDnC,qBAAqB;IAExE,OAAOmC,UAAU1B,GAAG,CAAC,CAACL,WAAaA,SAASkE,KAAK;AACnD"}
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/video-embed-provider.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A VIDEO HOST WHOSE OWN PLAYER A VIDEO PLAYS IN (AGL-3080).\n *\n * Some video hosts hand an author a link to a page, not to a file: the film\n * plays only inside the host's player, framed from the host's origin. The\n * Video element recognizes such a link, keeps only the media id it names,\n * and frames the host's player for it. Core never names a host. A plugin\n * DECLARES one — the domains its links live on, where in the path the media\n * id sits, the one origin its player is framed from, and the query that\n * player reads — and core's resolvers answer from the declarations alone.\n *\n * This sits beside `media-delivery-provider.ts` and is not that seam. A\n * delivery provider is where the platform serves ITS OWN copy of a file\n * from; an embed provider is a host whose player the author chose, which the\n * platform never serves a byte of.\n *\n * ## Only the media id survives\n *\n * The string an author pasted never reaches a frame. {@link videoEmbedOf}\n * reads the media id out of it, and every address below is rebuilt from the\n * declaration and that id alone, so a declared player is framed from its\n * declared origin and nowhere else. That closed set is what lets a published\n * page's `frame-src` name the origin for every site\n * ({@link videoEmbedPlayerOrigins}). The id must match the declaration's own\n * pattern AND {@link SAFE_MEDIA_ID}, so no declaration can widen the path it\n * is put into.\n *\n * ## Compiled, and deliberately without a runtime registrar\n *\n * The readers are the published page and its policy: the Video element that\n * plays the link, the `VideoObject` a crawler reads, the built-in entry page\n * that decides whether a featured film can play, and the tenant middleware\n * whose `frame-src` must admit the player. None of them loads a plugin's\n * console code, and the middleware loads no plugin at all. A registry one of\n * them had not filled would render a customer's link as a `<video>` pointed\n * at an HTML page, or refuse the frame, and nothing would go red — the\n * AGL-3025 shape, on the customer's own film. So a first-party plugin\n * declares its hosts under `videoEmbedProviders` in `plugins.config.json`,\n * `tools/scripts/generate-plugin-manifests.mjs` validates and compiles them,\n * and this module reads the compiled list.\n *\n * A marketplace plugin cannot add a host this way, and that is the point\n * rather than a gap: a declaration widens every published page's\n * `frame-src`, which is a platform decision, not one a plugin's own code\n * makes at runtime.\n *\n * ## What \"absent\" means\n *\n * A link no declaration recognizes is an ordinary URL, rendered exactly as\n * any other link is. Removing a declaration therefore turns its links back\n * into plain URLs, which play nothing — so the declaring plugin's spec holds\n * the declaration to the links it must keep reading.\n */\n\nimport { FIRST_PARTY_VIDEO_EMBED_PROVIDERS } from './video-embed-providers.generated'\n\n/**\n * A choice the Video element makes for each player it frames. A declaration\n * says how its player spells each one it supports; one it does not name is\n * never sent.\n *\n * - `autoPlay` — start as soon as the player is ready. ON unless the caller\n * passes exactly `false`: the usual frame is the one a visitor's press\n * loads, and a second play button inside it would ask them twice.\n * - `doNotTrack` — ask the host not to record the viewing session.\n * - `muted` — start without sound.\n * - `loop` — restart at the end.\n */\nexport type VideoEmbedPlayerOption = 'autoPlay' | 'doNotTrack' | 'muted' | 'loop'\n\nexport const VIDEO_EMBED_PLAYER_OPTIONS: readonly VideoEmbedPlayerOption[] = [\n 'autoPlay',\n 'doNotTrack',\n 'muted',\n 'loop',\n]\n\nexport type VideoEmbedPlayerOptions = Partial<\n Record<VideoEmbedPlayerOption, boolean>\n>\n\n/**\n * One query parameter of a player address, in the order the declaration\n * lists them. Either `value`, sent on every address, or an `option` whose\n * state picks `on` or `off`; a state with no value leaves the parameter out.\n *\n * A value may name the media id as `{id}` (AGL-4140), for a player that\n * repeats it in its query, such as one that loops a single film only as a\n * playlist of itself. The id has passed both patterns by then, so it\n * carries nothing a query could be widened with.\n */\nexport type VideoEmbedPlayerParam =\n | { param: string; value: string }\n | {\n param: string\n option: VideoEmbedPlayerOption\n on?: string\n off?: string\n }\n\n/**\n * A link shape {@link VideoEmbedProviderDeclaration.mediaIdPaths} cannot\n * describe (AGL-4140): one that names its media id in the QUERY rather than\n * the path (`/watch?v={id}`), or one only some of the host's domains use (a\n * short-link domain whose whole path is the id, a shape that would misread a\n * page on the host's main domain).\n */\nexport interface VideoEmbedMediaIdLink {\n /**\n * A regular expression over the link's PATH, anchored at both ends. Without\n * {@link param}, its first capture group is the media id.\n */\n path: string\n /** The query parameter that holds the media id, for a path that names none. */\n param?: string\n /**\n * The declared domains this shape is read on, each matched as\n * {@link VideoEmbedProviderDeclaration.domains} are; every declared domain\n * when absent.\n */\n domains?: readonly string[]\n}\n\nexport interface VideoEmbedProviderDeclaration {\n /** Stable id, unique across plugins. */\n id: string\n /** The host's name as an author knows it, for labels and help text. */\n label: string\n /**\n * The domains a link's host must equal or end in (after a dot). Exact or\n * dot-anchored only, so a domain that merely contains one is refused.\n */\n domains: readonly string[]\n /**\n * Regular expressions over a link's PATH, anchored at both ends, whose\n * first capture group is the media id. The host is checked separately,\n * against {@link domains}.\n */\n mediaIdPaths: readonly string[]\n /** The link shapes the paths cannot describe, tried after them. */\n mediaIdLinks?: readonly VideoEmbedMediaIdLink[]\n /** A regular expression, anchored at both ends, a media id must match. */\n mediaIdPattern: string\n /** The one origin the host's player is framed from. */\n playerOrigin: string\n /** The player page's path on {@link playerOrigin}; `{id}` is the media id. */\n playerPath: string\n /** The query every player address carries, in this order. */\n playerQuery?: readonly VideoEmbedPlayerParam[]\n /**\n * The one origin the host serves its own still of each film from\n * (AGL-4140), for a host that publishes one at an address built from the\n * media id alone. With {@link posterPath}, or neither: a host with no\n * public still keeps asking the author for a poster.\n *\n * A visitor's browser loads the still from here on page load, before any\n * press, so a page that shows one sends the host the visitor's IP address\n * and user-agent. That is a recipient the platform chooses, not the author:\n * the Video element shows it only where `release_video_embed_posters` is on\n * for the site's workspace (`SiteContextValue.videoEmbedPosters`), and the\n * published page's `img-src` admits {@link videoEmbedPosterOrigins} only\n * there.\n */\n posterOrigin?: string\n /** The still's path on {@link posterOrigin}; `{id}` is the media id. */\n posterPath?: string\n}\n\n/** A declaration, with the plugin that made it. */\nexport interface ResolvedVideoEmbedProvider\n extends VideoEmbedProviderDeclaration {\n pluginId: string\n}\n\n/** A link a declared host recognized. */\nexport interface VideoEmbed {\n provider: ResolvedVideoEmbedProvider\n /** The media id the link named, and nothing else of it. */\n mediaId: string\n /**\n * The player page with no per-visit options — what a `VideoObject`\n * publishes as `embedUrl`.\n */\n embedUrl: string\n}\n\n/**\n * The floor every media id stands on, whatever a declaration's own pattern\n * admits: no separator, dot, query or fragment can reach the player path.\n */\nconst SAFE_MEDIA_ID = /^[A-Za-z0-9_-]{1,64}$/\n\n/** The placeholder a `playerPath` names the media id with. */\nconst ID_PLACEHOLDER = '{id}'\n\n/** Every host a first-party plugin declares. */\nexport function videoEmbedProviders(): readonly ResolvedVideoEmbedProvider[] {\n return FIRST_PARTY_VIDEO_EMBED_PROVIDERS\n}\n\ninterface CompiledLink {\n path: RegExp\n param?: string\n domains?: readonly string[]\n}\n\ninterface CompiledProvider {\n paths: RegExp[]\n links: CompiledLink[]\n mediaId: RegExp\n}\n\nconst compiled = new WeakMap<VideoEmbedProviderDeclaration, CompiledProvider>()\n\nfunction compile(provider: VideoEmbedProviderDeclaration): CompiledProvider {\n let answer = compiled.get(provider)\n if (!answer) {\n answer = {\n paths: provider.mediaIdPaths.map((source) => new RegExp(source)),\n links: (provider.mediaIdLinks ?? []).map((link) => ({\n path: new RegExp(link.path),\n param: link.param,\n domains: link.domains,\n })),\n mediaId: new RegExp(provider.mediaIdPattern),\n }\n compiled.set(provider, answer)\n }\n return answer\n}\n\n/** The media id a link shape reads from this URL, unchecked. */\nfunction linkMediaId(link: CompiledLink, url: URL): string | undefined {\n if (link.domains && !onDomain(url.hostname, link.domains)) return undefined\n const match = link.path.exec(url.pathname)\n if (!match) return undefined\n return link.param ? (url.searchParams.get(link.param) ?? undefined) : match[1]\n}\n\nfunction onDomain(hostname: string, domains: readonly string[]): boolean {\n return domains.some(\n (domain) => hostname === domain || hostname.endsWith(`.${domain}`),\n )\n}\n\n/**\n * The declared host a link belongs to, with the media id it names, or\n * `undefined` for anything else: a value that is not an http(s) URL, a host\n * nothing declares, or a path that names no id the host's pattern accepts.\n */\nexport function videoEmbedOf(\n value: unknown,\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): VideoEmbed | undefined {\n if (typeof value !== 'string' || !providers.length) return undefined\n let url: URL\n try {\n url = new URL(value.trim())\n } catch {\n return undefined\n }\n if (url.protocol !== 'https:' && url.protocol !== 'http:') return undefined\n for (const provider of providers) {\n if (!onDomain(url.hostname, provider.domains)) continue\n const { paths, links, mediaId } = compile(provider)\n const candidates = [\n ...paths.map((pattern) => pattern.exec(url.pathname)?.[1]),\n ...links.map((link) => linkMediaId(link, url)),\n ]\n for (const id of candidates) {\n if (id && mediaId.test(id) && SAFE_MEDIA_ID.test(id)) {\n return {\n provider,\n mediaId: id,\n embedUrl: `${provider.playerOrigin}${provider.playerPath.replace(ID_PLACEHOLDER, id)}`,\n }\n }\n }\n }\n return undefined\n}\n\n/** The player page for a declared host's link, with no per-visit options. */\nexport function videoEmbedUrl(\n value: unknown,\n providers?: readonly ResolvedVideoEmbedProvider[],\n): string | undefined {\n return videoEmbedOf(value, providers)?.embedUrl\n}\n\n/**\n * The address of a declared host's player frame for this visit, carrying the\n * declaration's query in its own order. See {@link VideoEmbedPlayerOption}\n * for what each option means and which way it defaults.\n */\nexport function videoEmbedPlayerSrc(\n value: unknown,\n options: VideoEmbedPlayerOptions = {},\n providers?: readonly ResolvedVideoEmbedProvider[],\n): string | undefined {\n const embed = videoEmbedOf(value, providers)\n if (!embed) return undefined\n const params = new URLSearchParams()\n const withId = (value: string) =>\n value.split(ID_PLACEHOLDER).join(embed.mediaId)\n for (const entry of embed.provider.playerQuery ?? []) {\n if ('value' in entry) {\n params.set(entry.param, withId(entry.value))\n continue\n }\n const on =\n entry.option === 'autoPlay'\n ? options.autoPlay !== false\n : Boolean(options[entry.option])\n const sent = on ? entry.on : entry.off\n if (sent !== undefined) params.set(entry.param, withId(sent))\n }\n const query = params.toString()\n return query ? `${embed.embedUrl}?${query}` : embed.embedUrl\n}\n\n/**\n * Every origin a declared player is framed from: what a published page's\n * `frame-src` admits for the Video element.\n */\nexport function videoEmbedPlayerOrigins(\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): string[] {\n return [...new Set(providers.map((provider) => provider.playerOrigin))]\n}\n\n/**\n * The host's own still of the film a declared host's link names\n * (AGL-4140), rebuilt from the media id and the declaration alone, or\n * `undefined` for a host that publishes none and for any other value.\n */\nexport function videoEmbedPosterSrc(\n value: unknown,\n providers?: readonly ResolvedVideoEmbedProvider[],\n): string | undefined {\n const embed = videoEmbedOf(value, providers)\n const { posterOrigin, posterPath } = embed?.provider ?? {}\n if (!embed || !posterOrigin || !posterPath) return undefined\n return `${posterOrigin}${posterPath.replace(ID_PLACEHOLDER, embed.mediaId)}`\n}\n\n/**\n * Every origin a declared host serves its stills from: what a published\n * page's `img-src` admits, where the site's workspace shows them.\n */\nexport function videoEmbedPosterOrigins(\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): string[] {\n return [\n ...new Set(\n providers.flatMap((provider) =>\n provider.posterOrigin && provider.posterPath ? [provider.posterOrigin] : [],\n ),\n ),\n ]\n}\n\n/** The declared hosts' names, as an author knows them. */\nexport function videoEmbedProviderLabels(\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): string[] {\n return providers.map((provider) => provider.label)\n}\n"],"names":["FIRST_PARTY_VIDEO_EMBED_PROVIDERS","VIDEO_EMBED_PLAYER_OPTIONS","SAFE_MEDIA_ID","ID_PLACEHOLDER","videoEmbedProviders","compiled","WeakMap","compile","provider","answer","get","paths","mediaIdPaths","map","source","RegExp","links","mediaIdLinks","link","path","param","domains","mediaId","mediaIdPattern","set","linkMediaId","url","onDomain","hostname","undefined","match","exec","pathname","searchParams","some","domain","endsWith","videoEmbedOf","value","providers","length","URL","trim","protocol","candidates","pattern","id","test","embedUrl","playerOrigin","playerPath","replace","videoEmbedUrl","videoEmbedPlayerSrc","options","embed","params","URLSearchParams","withId","split","join","entry","playerQuery","on","option","autoPlay","Boolean","sent","off","query","toString","videoEmbedPlayerOrigins","Set","videoEmbedPosterSrc","posterOrigin","posterPath","videoEmbedPosterOrigins","flatMap","videoEmbedProviderLabels","label"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDC,GAED,SAASA,iCAAiC,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eAAeC,WAAWxB,OAAO,CAAChD,gBAAgBoD,MAAMjC,OAAO,GAAG;AAC9E;AAEA;;;CAGC,GACD,OAAO,SAASsD,wBACdrC,YAAmDnC,qBAAqB;IAExE,OAAO;WACF,IAAIoE,IACLjC,UAAUsC,OAAO,CAAC,CAACrE,WACjBA,SAASkE,YAAY,IAAIlE,SAASmE,UAAU,GAAG;gBAACnE,SAASkE,YAAY;aAAC,GAAG,EAAE;KAGhF;AACH;AAEA,wDAAwD,GACxD,OAAO,SAASI,yBACdvC,YAAmDnC,qBAAqB;IAExE,OAAOmC,UAAU1B,GAAG,CAAC,CAACL,WAAaA,SAASuE,KAAK;AACnD"}
@@ -154,7 +154,9 @@
154
154
  "option": "loop",
155
155
  "on": "{id}"
156
156
  }
157
- ]
157
+ ],
158
+ "posterOrigin": "https://i.ytimg.com",
159
+ "posterPath": "/vi/{id}/hqdefault.jpg"
158
160
  }
159
161
  ];
160
162
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/video-embed-providers.generated.ts"],"sourcesContent":["/**\n * GENERATED FILE — do not edit. Regenerate with:\n * node tools/scripts/generate-plugin-manifests.mjs\n *\n * Every video host whose own player the Video element frames, declared by\n * the plugin that plays it (AGL-3080). Core names no host. Its own file,\n * not the catalog's, so a published page with no video downloads none of\n * it (AGL-4140).\n */\n\nimport type { ResolvedVideoEmbedProvider } from './video-embed-provider'\n\nexport const FIRST_PARTY_VIDEO_EMBED_PROVIDERS: readonly ResolvedVideoEmbedProvider[] = [\n {\n \"pluginId\": \"mui\",\n \"id\": \"vimeo\",\n \"label\": \"Vimeo\",\n \"domains\": [\n \"vimeo.com\"\n ],\n \"mediaIdPaths\": [\n \"^\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/video\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/channels\\\\/[^/]+\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/groups\\\\/[^/]+\\\\/videos\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/showcase\\\\/[^/]+\\\\/video\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/album\\\\/[^/]+\\\\/video\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/manage\\\\/videos\\\\/([0-9]+)\\\\/?$\"\n ],\n \"mediaIdPattern\": \"^[0-9]{6,12}$\",\n \"playerOrigin\": \"https://player.vimeo.com\",\n \"playerPath\": \"/video/{id}\",\n \"playerQuery\": [\n {\n \"param\": \"autoplay\",\n \"option\": \"autoPlay\",\n \"on\": \"1\",\n \"off\": \"0\"\n },\n {\n \"param\": \"dnt\",\n \"value\": \"1\"\n },\n {\n \"param\": \"muted\",\n \"option\": \"muted\",\n \"on\": \"1\"\n },\n {\n \"param\": \"loop\",\n \"option\": \"loop\",\n \"on\": \"1\"\n }\n ]\n },\n {\n \"pluginId\": \"mui\",\n \"id\": \"wistia\",\n \"label\": \"Wistia\",\n \"domains\": [\n \"wistia.com\",\n \"wistia.net\",\n \"wi.st\"\n ],\n \"mediaIdPaths\": [\n \"^\\\\/medias\\\\/([^/]+)(?:\\\\/manage)?\\\\/?$\",\n \"^\\\\/m\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/embed\\\\/iframe\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/embed\\\\/medias\\\\/([^/.]+)(?:\\\\.jsonp?)?\\\\/?$\"\n ],\n \"mediaIdPattern\": \"^[a-z0-9]{10}$\",\n \"playerOrigin\": \"https://fast.wistia.net\",\n \"playerPath\": \"/embed/iframe/{id}\",\n \"playerQuery\": [\n {\n \"param\": \"autoPlay\",\n \"option\": \"autoPlay\",\n \"on\": \"true\",\n \"off\": \"false\"\n },\n {\n \"param\": \"roundedPlayer\",\n \"value\": \"false\"\n },\n {\n \"param\": \"doNotTrack\",\n \"option\": \"doNotTrack\",\n \"on\": \"true\"\n },\n {\n \"param\": \"muted\",\n \"option\": \"muted\",\n \"on\": \"true\"\n },\n {\n \"param\": \"endVideoBehavior\",\n \"option\": \"loop\",\n \"on\": \"loop\"\n }\n ]\n },\n {\n \"pluginId\": \"mui\",\n \"id\": \"youtube\",\n \"label\": \"YouTube\",\n \"domains\": [\n \"youtube.com\",\n \"youtube-nocookie.com\",\n \"youtu.be\"\n ],\n \"mediaIdPaths\": [\n \"^\\\\/embed\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/shorts\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/live\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/v\\\\/([^/]+)\\\\/?$\"\n ],\n \"mediaIdLinks\": [\n {\n \"path\": \"^\\\\/watch\\\\/?$\",\n \"param\": \"v\",\n \"domains\": [\n \"youtube.com\"\n ]\n },\n {\n \"path\": \"^\\\\/([^/]+)\\\\/?$\",\n \"domains\": [\n \"youtu.be\"\n ]\n }\n ],\n \"mediaIdPattern\": \"^(?!videoseries$)[A-Za-z0-9_-]{11}$\",\n \"playerOrigin\": \"https://www.youtube-nocookie.com\",\n \"playerPath\": \"/embed/{id}\",\n \"playerQuery\": [\n {\n \"param\": \"autoplay\",\n \"option\": \"autoPlay\",\n \"on\": \"1\",\n \"off\": \"0\"\n },\n {\n \"param\": \"playsinline\",\n \"value\": \"1\"\n },\n {\n \"param\": \"mute\",\n \"option\": \"muted\",\n \"on\": \"1\"\n },\n {\n \"param\": \"loop\",\n \"option\": \"loop\",\n \"on\": \"1\"\n },\n {\n \"param\": \"playlist\",\n \"option\": \"loop\",\n \"on\": \"{id}\"\n }\n ]\n },\n]\n"],"names":["FIRST_PARTY_VIDEO_EMBED_PROVIDERS"],"mappings":"AAAA;;;;;;;;CAQC,GAID,OAAO,MAAMA,oCAA2E;IACtF;QACE,YAAY;QACZ,MAAM;QACN,SAAS;QACT,WAAW;YACT;SACD;QACD,gBAAgB;YACd;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACD,kBAAkB;QAClB,gBAAgB;QAChB,cAAc;QACd,eAAe;YACb;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;gBACN,OAAO;YACT;YACA;gBACE,SAAS;gBACT,SAAS;YACX;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;SACD;IACH;IACA;QACE,YAAY;QACZ,MAAM;QACN,SAAS;QACT,WAAW;YACT;YACA;YACA;SACD;QACD,gBAAgB;YACd;YACA;YACA;YACA;SACD;QACD,kBAAkB;QAClB,gBAAgB;QAChB,cAAc;QACd,eAAe;YACb;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;gBACN,OAAO;YACT;YACA;gBACE,SAAS;gBACT,SAAS;YACX;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;SACD;IACH;IACA;QACE,YAAY;QACZ,MAAM;QACN,SAAS;QACT,WAAW;YACT;YACA;YACA;SACD;QACD,gBAAgB;YACd;YACA;YACA;YACA;SACD;QACD,gBAAgB;YACd;gBACE,QAAQ;gBACR,SAAS;gBACT,WAAW;oBACT;iBACD;YACH;YACA;gBACE,QAAQ;gBACR,WAAW;oBACT;iBACD;YACH;SACD;QACD,kBAAkB;QAClB,gBAAgB;QAChB,cAAc;QACd,eAAe;YACb;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;gBACN,OAAO;YACT;YACA;gBACE,SAAS;gBACT,SAAS;YACX;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;SACD;IACH;CACD,CAAA"}
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/video-embed-providers.generated.ts"],"sourcesContent":["/**\n * GENERATED FILE — do not edit. Regenerate with:\n * node tools/scripts/generate-plugin-manifests.mjs\n *\n * Every video host whose own player the Video element frames, declared by\n * the plugin that plays it (AGL-3080). Core names no host. Its own file,\n * not the catalog's, so a published page with no video downloads none of\n * it (AGL-4140).\n */\n\nimport type { ResolvedVideoEmbedProvider } from './video-embed-provider'\n\nexport const FIRST_PARTY_VIDEO_EMBED_PROVIDERS: readonly ResolvedVideoEmbedProvider[] = [\n {\n \"pluginId\": \"mui\",\n \"id\": \"vimeo\",\n \"label\": \"Vimeo\",\n \"domains\": [\n \"vimeo.com\"\n ],\n \"mediaIdPaths\": [\n \"^\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/video\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/channels\\\\/[^/]+\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/groups\\\\/[^/]+\\\\/videos\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/showcase\\\\/[^/]+\\\\/video\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/album\\\\/[^/]+\\\\/video\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/manage\\\\/videos\\\\/([0-9]+)\\\\/?$\"\n ],\n \"mediaIdPattern\": \"^[0-9]{6,12}$\",\n \"playerOrigin\": \"https://player.vimeo.com\",\n \"playerPath\": \"/video/{id}\",\n \"playerQuery\": [\n {\n \"param\": \"autoplay\",\n \"option\": \"autoPlay\",\n \"on\": \"1\",\n \"off\": \"0\"\n },\n {\n \"param\": \"dnt\",\n \"value\": \"1\"\n },\n {\n \"param\": \"muted\",\n \"option\": \"muted\",\n \"on\": \"1\"\n },\n {\n \"param\": \"loop\",\n \"option\": \"loop\",\n \"on\": \"1\"\n }\n ]\n },\n {\n \"pluginId\": \"mui\",\n \"id\": \"wistia\",\n \"label\": \"Wistia\",\n \"domains\": [\n \"wistia.com\",\n \"wistia.net\",\n \"wi.st\"\n ],\n \"mediaIdPaths\": [\n \"^\\\\/medias\\\\/([^/]+)(?:\\\\/manage)?\\\\/?$\",\n \"^\\\\/m\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/embed\\\\/iframe\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/embed\\\\/medias\\\\/([^/.]+)(?:\\\\.jsonp?)?\\\\/?$\"\n ],\n \"mediaIdPattern\": \"^[a-z0-9]{10}$\",\n \"playerOrigin\": \"https://fast.wistia.net\",\n \"playerPath\": \"/embed/iframe/{id}\",\n \"playerQuery\": [\n {\n \"param\": \"autoPlay\",\n \"option\": \"autoPlay\",\n \"on\": \"true\",\n \"off\": \"false\"\n },\n {\n \"param\": \"roundedPlayer\",\n \"value\": \"false\"\n },\n {\n \"param\": \"doNotTrack\",\n \"option\": \"doNotTrack\",\n \"on\": \"true\"\n },\n {\n \"param\": \"muted\",\n \"option\": \"muted\",\n \"on\": \"true\"\n },\n {\n \"param\": \"endVideoBehavior\",\n \"option\": \"loop\",\n \"on\": \"loop\"\n }\n ]\n },\n {\n \"pluginId\": \"mui\",\n \"id\": \"youtube\",\n \"label\": \"YouTube\",\n \"domains\": [\n \"youtube.com\",\n \"youtube-nocookie.com\",\n \"youtu.be\"\n ],\n \"mediaIdPaths\": [\n \"^\\\\/embed\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/shorts\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/live\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/v\\\\/([^/]+)\\\\/?$\"\n ],\n \"mediaIdLinks\": [\n {\n \"path\": \"^\\\\/watch\\\\/?$\",\n \"param\": \"v\",\n \"domains\": [\n \"youtube.com\"\n ]\n },\n {\n \"path\": \"^\\\\/([^/]+)\\\\/?$\",\n \"domains\": [\n \"youtu.be\"\n ]\n }\n ],\n \"mediaIdPattern\": \"^(?!videoseries$)[A-Za-z0-9_-]{11}$\",\n \"playerOrigin\": \"https://www.youtube-nocookie.com\",\n \"playerPath\": \"/embed/{id}\",\n \"playerQuery\": [\n {\n \"param\": \"autoplay\",\n \"option\": \"autoPlay\",\n \"on\": \"1\",\n \"off\": \"0\"\n },\n {\n \"param\": \"playsinline\",\n \"value\": \"1\"\n },\n {\n \"param\": \"mute\",\n \"option\": \"muted\",\n \"on\": \"1\"\n },\n {\n \"param\": \"loop\",\n \"option\": \"loop\",\n \"on\": \"1\"\n },\n {\n \"param\": \"playlist\",\n \"option\": \"loop\",\n \"on\": \"{id}\"\n }\n ],\n \"posterOrigin\": \"https://i.ytimg.com\",\n \"posterPath\": \"/vi/{id}/hqdefault.jpg\"\n },\n]\n"],"names":["FIRST_PARTY_VIDEO_EMBED_PROVIDERS"],"mappings":"AAAA;;;;;;;;CAQC,GAID,OAAO,MAAMA,oCAA2E;IACtF;QACE,YAAY;QACZ,MAAM;QACN,SAAS;QACT,WAAW;YACT;SACD;QACD,gBAAgB;YACd;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACD,kBAAkB;QAClB,gBAAgB;QAChB,cAAc;QACd,eAAe;YACb;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;gBACN,OAAO;YACT;YACA;gBACE,SAAS;gBACT,SAAS;YACX;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;SACD;IACH;IACA;QACE,YAAY;QACZ,MAAM;QACN,SAAS;QACT,WAAW;YACT;YACA;YACA;SACD;QACD,gBAAgB;YACd;YACA;YACA;YACA;SACD;QACD,kBAAkB;QAClB,gBAAgB;QAChB,cAAc;QACd,eAAe;YACb;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;gBACN,OAAO;YACT;YACA;gBACE,SAAS;gBACT,SAAS;YACX;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;SACD;IACH;IACA;QACE,YAAY;QACZ,MAAM;QACN,SAAS;QACT,WAAW;YACT;YACA;YACA;SACD;QACD,gBAAgB;YACd;YACA;YACA;YACA;SACD;QACD,gBAAgB;YACd;gBACE,QAAQ;gBACR,SAAS;gBACT,WAAW;oBACT;iBACD;YACH;YACA;gBACE,QAAQ;gBACR,WAAW;oBACT;iBACD;YACH;SACD;QACD,kBAAkB;QAClB,gBAAgB;QAChB,cAAc;QACd,eAAe;YACb;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;gBACN,OAAO;YACT;YACA;gBACE,SAAS;gBACT,SAAS;YACX;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;SACD;QACD,gBAAgB;QAChB,cAAc;IAChB;CACD,CAAA"}