@wix/web5-core 1.56.1 → 1.57.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.
- package/dist/cjs/client/wixAuthFetch.js +2 -2
- package/dist/cjs/client/wixAuthFetch.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/HeroEntitySectionDefinition.js +20 -15
- package/dist/cjs/component/componentDefinitions/HeroEntitySectionDefinition.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/HeroSectionDefinition.js +12 -4
- package/dist/cjs/component/componentDefinitions/HeroSectionDefinition.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/listItemsSectionDefinition.js +24 -29
- package/dist/cjs/component/componentDefinitions/listItemsSectionDefinition.js.map +1 -1
- package/dist/cjs/component/componentParser.js +8 -1
- package/dist/cjs/component/componentParser.js.map +1 -1
- package/dist/cjs/component/types.js.map +1 -1
- package/dist/cjs/components/placement/PlacementResponseRenderer.css +0 -4
- package/dist/cjs/components/placement/PlacementResponseRenderer.js +11 -33
- package/dist/cjs/components/placement/PlacementResponseRenderer.js.map +1 -1
- package/dist/cjs/components/placement/buildPlacementDependencies.js.map +1 -1
- package/dist/cjs/components/ui/OptimizedImage.js +59 -14
- package/dist/cjs/components/ui/OptimizedImage.js.map +1 -1
- package/dist/cjs/components/ui/SectionSkeleton.css +19 -0
- package/dist/cjs/components/ui/SectionSkeleton.js +8 -4
- package/dist/cjs/components/ui/SectionSkeleton.js.map +1 -1
- package/dist/cjs/components/ui/UserQuery.css +72 -0
- package/dist/cjs/components/ui/UserQuery.js +131 -37
- package/dist/cjs/components/ui/UserQuery.js.map +1 -1
- package/dist/cjs/context/UserQueryContext.js +34 -0
- package/dist/cjs/context/UserQueryContext.js.map +1 -0
- package/dist/cjs/entity/defaultExtractor.js +9 -2
- package/dist/cjs/entity/defaultExtractor.js.map +1 -1
- package/dist/cjs/entity/fetchEntityListData.js +13 -26
- package/dist/cjs/entity/fetchEntityListData.js.map +1 -1
- package/dist/cjs/entity/index.js +5 -1
- package/dist/cjs/entity/index.js.map +1 -1
- package/dist/cjs/entity/listEntityItems.js +90 -0
- package/dist/cjs/entity/listEntityItems.js.map +1 -0
- package/dist/cjs/hostScope.js +63 -0
- package/dist/cjs/hostScope.js.map +1 -0
- package/dist/cjs/index.js +38 -13
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/patternValidator/validator.test.js +61 -61
- package/dist/cjs/patternValidator/validator.test.js.map +1 -1
- package/dist/cjs/registry/ComponentRegistry.js +22 -2
- package/dist/cjs/registry/ComponentRegistry.js.map +1 -1
- package/dist/cjs/registry/index.js +1 -3
- package/dist/cjs/registry/index.js.map +1 -1
- package/dist/cjs/registry/types.js.map +1 -1
- package/dist/cjs/styles/base-utilities.css +35 -0
- package/dist/cjs/styles/components.css +1 -0
- package/dist/cjs/styles/host-reset.css +100 -0
- package/dist/cjs/styles/tailwind-theme.css +6 -6
- package/dist/cjs/utils/backendEnvironment.js +78 -0
- package/dist/cjs/utils/backendEnvironment.js.map +1 -0
- package/dist/cjs/utils/entityLinkParser.js +3 -1
- package/dist/cjs/utils/entityLinkParser.js.map +1 -1
- package/dist/cjs/utils/imageBackdrop.js +269 -0
- package/dist/cjs/utils/imageBackdrop.js.map +1 -0
- package/dist/cjs/utils/intentExtractor.js +20 -9
- package/dist/cjs/utils/intentExtractor.js.map +1 -1
- package/dist/cjs/utils/productBackHandoff.js +106 -0
- package/dist/cjs/utils/productBackHandoff.js.map +1 -0
- package/dist/cjs/utils/refreshPrompts.js +72 -0
- package/dist/cjs/utils/refreshPrompts.js.map +1 -0
- package/dist/esm/client/wixAuthFetch.js +2 -2
- package/dist/esm/client/wixAuthFetch.js.map +1 -1
- package/dist/esm/component/componentDefinitions/HeroEntitySectionDefinition.js +20 -15
- package/dist/esm/component/componentDefinitions/HeroEntitySectionDefinition.js.map +1 -1
- package/dist/esm/component/componentDefinitions/HeroSectionDefinition.js +12 -4
- package/dist/esm/component/componentDefinitions/HeroSectionDefinition.js.map +1 -1
- package/dist/esm/component/componentDefinitions/listItemsSectionDefinition.js +25 -30
- package/dist/esm/component/componentDefinitions/listItemsSectionDefinition.js.map +1 -1
- package/dist/esm/component/componentParser.js +8 -1
- package/dist/esm/component/componentParser.js.map +1 -1
- package/dist/esm/component/types.js.map +1 -1
- package/dist/esm/components/placement/PlacementResponseRenderer.css +0 -4
- package/dist/esm/components/placement/PlacementResponseRenderer.js +1 -16
- package/dist/esm/components/placement/PlacementResponseRenderer.js.map +1 -1
- package/dist/esm/components/placement/buildPlacementDependencies.js.map +1 -1
- package/dist/esm/components/ui/OptimizedImage.js +50 -5
- package/dist/esm/components/ui/OptimizedImage.js.map +1 -1
- package/dist/esm/components/ui/SectionSkeleton.css +19 -0
- package/dist/esm/components/ui/SectionSkeleton.js +5 -1
- package/dist/esm/components/ui/SectionSkeleton.js.map +1 -1
- package/dist/esm/components/ui/UserQuery.css +72 -0
- package/dist/esm/components/ui/UserQuery.js +52 -6
- package/dist/esm/components/ui/UserQuery.js.map +1 -1
- package/dist/esm/context/UserQueryContext.js +21 -0
- package/dist/esm/context/UserQueryContext.js.map +1 -0
- package/dist/esm/entity/defaultExtractor.js +9 -2
- package/dist/esm/entity/defaultExtractor.js.map +1 -1
- package/dist/esm/entity/fetchEntityListData.js +14 -26
- package/dist/esm/entity/fetchEntityListData.js.map +1 -1
- package/dist/esm/entity/index.js +1 -0
- package/dist/esm/entity/index.js.map +1 -1
- package/dist/esm/entity/listEntityItems.js +85 -0
- package/dist/esm/entity/listEntityItems.js.map +1 -0
- package/dist/esm/hostScope.js +59 -0
- package/dist/esm/hostScope.js.map +1 -0
- package/dist/esm/index.js +13 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/patternValidator/validator.test.js +61 -61
- package/dist/esm/patternValidator/validator.test.js.map +1 -1
- package/dist/esm/registry/ComponentRegistry.js +22 -2
- package/dist/esm/registry/ComponentRegistry.js.map +1 -1
- package/dist/esm/registry/index.js +0 -1
- package/dist/esm/registry/index.js.map +1 -1
- package/dist/esm/registry/types.js.map +1 -1
- package/dist/esm/styles/base-utilities.css +35 -0
- package/dist/esm/styles/components.css +1 -0
- package/dist/esm/styles/host-reset.css +100 -0
- package/dist/esm/styles/tailwind-theme.css +6 -6
- package/dist/esm/utils/backendEnvironment.js +71 -0
- package/dist/esm/utils/backendEnvironment.js.map +1 -0
- package/dist/esm/utils/entityLinkParser.js +3 -1
- package/dist/esm/utils/entityLinkParser.js.map +1 -1
- package/dist/esm/utils/imageBackdrop.js +262 -0
- package/dist/esm/utils/imageBackdrop.js.map +1 -0
- package/dist/esm/utils/intentExtractor.js +21 -12
- package/dist/esm/utils/intentExtractor.js.map +1 -1
- package/dist/esm/utils/productBackHandoff.js +100 -0
- package/dist/esm/utils/productBackHandoff.js.map +1 -0
- package/dist/esm/utils/refreshPrompts.js +67 -0
- package/dist/esm/utils/refreshPrompts.js.map +1 -0
- package/dist/types/component/componentDefinitions/HeroEntitySectionDefinition.d.ts.map +1 -1
- package/dist/types/component/componentDefinitions/HeroSectionDefinition.d.ts.map +1 -1
- package/dist/types/component/componentDefinitions/listItemsSectionDefinition.d.ts +2 -2
- package/dist/types/component/componentDefinitions/listItemsSectionDefinition.d.ts.map +1 -1
- package/dist/types/component/componentParser.d.ts.map +1 -1
- package/dist/types/component/types.d.ts +1 -5
- package/dist/types/component/types.d.ts.map +1 -1
- package/dist/types/components/placement/PlacementResponseRenderer.d.ts +1 -1
- package/dist/types/components/placement/PlacementResponseRenderer.d.ts.map +1 -1
- package/dist/types/components/placement/buildPlacementDependencies.d.ts +1 -2
- package/dist/types/components/placement/buildPlacementDependencies.d.ts.map +1 -1
- package/dist/types/components/ui/OptimizedImage.d.ts +9 -0
- package/dist/types/components/ui/OptimizedImage.d.ts.map +1 -1
- package/dist/types/components/ui/SectionSkeleton.d.ts.map +1 -1
- package/dist/types/components/ui/UserQuery.d.ts +21 -0
- package/dist/types/components/ui/UserQuery.d.ts.map +1 -1
- package/dist/types/context/UserQueryContext.d.ts +12 -0
- package/dist/types/context/UserQueryContext.d.ts.map +1 -0
- package/dist/types/entity/defaultExtractor.d.ts.map +1 -1
- package/dist/types/entity/fetchEntityListData.d.ts +0 -2
- package/dist/types/entity/fetchEntityListData.d.ts.map +1 -1
- package/dist/types/entity/index.d.ts +1 -0
- package/dist/types/entity/index.d.ts.map +1 -1
- package/dist/types/entity/listEntityItems.d.ts +40 -0
- package/dist/types/entity/listEntityItems.d.ts.map +1 -0
- package/dist/types/hostScope.d.ts +83 -0
- package/dist/types/hostScope.d.ts.map +1 -0
- package/dist/types/index.d.ts +11 -7
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/registry/ComponentRegistry.d.ts +8 -0
- package/dist/types/registry/ComponentRegistry.d.ts.map +1 -1
- package/dist/types/registry/index.d.ts +0 -1
- package/dist/types/registry/index.d.ts.map +1 -1
- package/dist/types/registry/types.d.ts +5 -6
- package/dist/types/registry/types.d.ts.map +1 -1
- package/dist/types/utils/backendEnvironment.d.ts +30 -0
- package/dist/types/utils/backendEnvironment.d.ts.map +1 -0
- package/dist/types/utils/entityLinkParser.d.ts.map +1 -1
- package/dist/types/utils/imageBackdrop.d.ts +102 -0
- package/dist/types/utils/imageBackdrop.d.ts.map +1 -0
- package/dist/types/utils/intentExtractor.d.ts +21 -4
- package/dist/types/utils/intentExtractor.d.ts.map +1 -1
- package/dist/types/utils/productBackHandoff.d.ts +43 -0
- package/dist/types/utils/productBackHandoff.d.ts.map +1 -0
- package/dist/types/utils/refreshPrompts.d.ts +32 -0
- package/dist/types/utils/refreshPrompts.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/components/placement/PlacementResponseRenderer.css +0 -4
- package/src/components/ui/SectionSkeleton.css +19 -0
- package/src/components/ui/UserQuery.css +72 -0
- package/src/styles/base-utilities.css +35 -0
- package/src/styles/components.css +1 -0
- package/src/styles/host-reset.css +100 -0
- package/src/styles/tailwind-theme.css +6 -6
- package/dist/cjs/registry/Intent.js +0 -19
- package/dist/cjs/registry/Intent.js.map +0 -1
- package/dist/cjs/utils/conversationApi.js +0 -52
- package/dist/cjs/utils/conversationApi.js.map +0 -1
- package/dist/cjs/utils/conversationMode.js +0 -23
- package/dist/cjs/utils/conversationMode.js.map +0 -1
- package/dist/esm/registry/Intent.js +0 -15
- package/dist/esm/registry/Intent.js.map +0 -1
- package/dist/esm/utils/conversationApi.js +0 -45
- package/dist/esm/utils/conversationApi.js.map +0 -1
- package/dist/esm/utils/conversationMode.js +0 -18
- package/dist/esm/utils/conversationMode.js.map +0 -1
- package/dist/types/registry/Intent.d.ts +0 -12
- package/dist/types/registry/Intent.d.ts.map +0 -1
- package/dist/types/utils/conversationApi.d.ts +0 -26
- package/dist/types/utils/conversationApi.d.ts.map +0 -1
- package/dist/types/utils/conversationMode.d.ts +0 -16
- package/dist/types/utils/conversationMode.d.ts.map +0 -1
|
@@ -261,6 +261,26 @@ class ComponentRegistry {
|
|
|
261
261
|
getAllSections() {
|
|
262
262
|
return Array.from(this.sections.keys());
|
|
263
263
|
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Every intent that has at least one registered slot or section variant —
|
|
267
|
+
* i.e. the client's own intent list, derived from what it actually
|
|
268
|
+
* registered. Assembly uses this to validate an incoming intent before it
|
|
269
|
+
* becomes a resolution key, falling back to core's `DEFAULT_INTENTS` only
|
|
270
|
+
* when a client registers no intent variants at all.
|
|
271
|
+
*/
|
|
272
|
+
getKnownIntents() {
|
|
273
|
+
const intents = new Set();
|
|
274
|
+
for (const node of this.slots.values()) {
|
|
275
|
+
var _node$byIntent5;
|
|
276
|
+
(_node$byIntent5 = node.byIntent) == null || _node$byIntent5.forEach((_variant, key) => intents.add(key));
|
|
277
|
+
}
|
|
278
|
+
for (const node of this.sections.values()) {
|
|
279
|
+
var _node$byIntent6;
|
|
280
|
+
(_node$byIntent6 = node.byIntent) == null || _node$byIntent6.forEach((_variant, key) => intents.add(key));
|
|
281
|
+
}
|
|
282
|
+
return Array.from(intents);
|
|
283
|
+
}
|
|
264
284
|
getAllDefinitions() {
|
|
265
285
|
return Array.from(this.definitions.entries()).map(([sectionType, definition]) => ({
|
|
266
286
|
sectionType,
|
|
@@ -284,13 +304,13 @@ class ComponentRegistry {
|
|
|
284
304
|
* everywhere.
|
|
285
305
|
*/
|
|
286
306
|
isPlacementOnly(sectionType) {
|
|
287
|
-
var _node$forPlacementByI2, _node$
|
|
307
|
+
var _node$forPlacementByI2, _node$byIntent7, _node$bySemantic3;
|
|
288
308
|
const node = this.sections.get(sectionType);
|
|
289
309
|
if (!node) {
|
|
290
310
|
return false;
|
|
291
311
|
}
|
|
292
312
|
const hasPlacement = node.forPlacement != null || (((_node$forPlacementByI2 = node.forPlacementById) == null ? void 0 : _node$forPlacementByI2.size) ?? 0) > 0;
|
|
293
|
-
const hasNonPlacement = node.default != null || (((_node$
|
|
313
|
+
const hasNonPlacement = node.default != null || (((_node$byIntent7 = node.byIntent) == null ? void 0 : _node$byIntent7.size) ?? 0) > 0 || (((_node$bySemantic3 = node.bySemantic) == null ? void 0 : _node$bySemantic3.size) ?? 0) > 0;
|
|
294
314
|
return hasPlacement && !hasNonPlacement;
|
|
295
315
|
}
|
|
296
316
|
getSlotVariants(name) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["normalizeResolveOptions","intentOrOptions","semantic","intent","ComponentRegistry","constructor","fallback","_defineProperty2","default","Map","registerSlot","name","component","options","node","slots","get","set","intentNode","ensureSlotIntent","bySemantic","register","definition","variants","console","warn","definitions","sectionType","registration","sections","placement","placementId","forPlacementById","forPlacement","ensureSectionIntent","registerAction","handler","actions","resolveSlot","_node$byIntent","found","byIntent","_node$byIntent2","_node$bySemantic","resolveSection","resolveSectionRegistration","resolveSectionOptions","_this$resolveSectionR","undefined","_node$forPlacementByI","byId","_node$byIntent3","_node$byIntent4","_node$bySemantic2","getAllSlots","Array","from","keys","getAllSections","getAllDefinitions","entries","map","getDefinition","isPlacementOnly","_node$forPlacementByI2","_node$byIntent5","_node$bySemantic3","hasPlacement","size","hasNonPlacement","getSlotVariants","push","getSectionVariants","hasAction","has","executeAction","params","success","message","getRegisteredActions","getCatalog","exports"],"sources":["../../../src/registry/ComponentRegistry.ts"],"sourcesContent":["import type { SectionDefinition } from '../component/componentDefinitions';\nimport type {\n SlotOptions,\n SectionOptions,\n SectionRegistration,\n SlotNode,\n SlotIntentNode,\n SectionNode,\n SectionIntentNode,\n SlotVariant,\n SectionVariant,\n RegistryCatalog,\n ResolveSectionOptions,\n ActionHandler,\n ActionResult,\n} from './types';\n\n/**\n * Accept the legacy positional form `(intent, semantic)` and the new\n * options-object form `({ intent, semantic, placement })`. Returns a\n * normalized `ResolveSectionOptions`.\n */\nfunction normalizeResolveOptions(\n intentOrOptions?: string | ResolveSectionOptions,\n semantic?: string,\n): ResolveSectionOptions {\n if (intentOrOptions == null) {\n return semantic ? { semantic } : {};\n }\n if (typeof intentOrOptions === 'string') {\n return semantic ? { intent: intentOrOptions, semantic } : { intent: intentOrOptions };\n }\n return intentOrOptions;\n}\n\nexport class ComponentRegistry<C> {\n private slots = new Map<string, SlotNode<C>>();\n private sections = new Map<string, SectionNode<C>>();\n private definitions = new Map<string, SectionDefinition>();\n private actions = new Map<string, ActionHandler>();\n\n constructor(private fallback: C) {}\n\n // ---------------------------------------------------------------------------\n // Registration\n // ---------------------------------------------------------------------------\n\n registerSlot(name: string, component: C, options?: SlotOptions): this {\n let node = this.slots.get(name);\n if (!node) {\n node = {};\n this.slots.set(name, node);\n }\n\n const { intent, semantic } = options ?? {};\n\n if (intent && semantic) {\n const intentNode = this.ensureSlotIntent(node, intent);\n if (!intentNode.bySemantic) {\n intentNode.bySemantic = new Map();\n }\n intentNode.bySemantic.set(semantic, component);\n } else if (intent) {\n const intentNode = this.ensureSlotIntent(node, intent);\n intentNode.default = component;\n } else if (semantic) {\n if (!node.bySemantic) {\n node.bySemantic = new Map();\n }\n node.bySemantic.set(semantic, component);\n } else {\n node.default = component;\n }\n\n return this;\n }\n\n register(\n definition: SectionDefinition,\n variants?: SectionRegistration<C>[],\n ): this {\n // Tolerate missing definitions instead of crashing app init. This\n // happens when a client UMD references a `SectionDefinition` symbol\n // that doesn't exist on the consuming bundle's `Web5Core` global\n // (e.g. UMD built against newer `web5-core` than the app bundle).\n // Without this guard a single missing export breaks every other\n // section the client tries to register.\n if (definition == null) {\n // eslint-disable-next-line no-console\n console.warn(\n '[ComponentRegistry] register() called with a null/undefined SectionDefinition — ' +\n 'likely a version skew between the client UMD and web5-core ' +\n '(an exported definition the UMD imports does not exist on this Web5Core). Skipping.',\n );\n return this;\n }\n this.definitions.set(definition.sectionType, definition);\n\n if (variants) {\n const sectionType = definition.sectionType;\n for (const registration of variants) {\n let node = this.sections.get(sectionType);\n if (!node) {\n node = {};\n this.sections.set(sectionType, node);\n }\n const { intent, semantic, placement, placementId } =\n registration.options ?? {};\n\n // Placement variants are stored on their own slot — no further\n // intent/semantic sub-variants (DL #088 D3.1). If a developer also\n // supplies intent/semantic alongside placement, those are ignored for\n // the placement registration. To register both a placement variant AND\n // an intent variant, register them as separate entries.\n if (placement) {\n // Scoped to a specific placement slot id — keyed so one section type\n // can render differently per placement. An id-less placement variant\n // remains the generic fallback.\n if (placementId) {\n if (!node.forPlacementById) {\n node.forPlacementById = new Map();\n }\n node.forPlacementById.set(placementId, registration);\n } else {\n node.forPlacement = registration;\n }\n continue;\n }\n\n if (intent && semantic) {\n const intentNode = this.ensureSectionIntent(node, intent);\n if (!intentNode.bySemantic) {\n intentNode.bySemantic = new Map();\n }\n intentNode.bySemantic.set(semantic, registration);\n } else if (intent) {\n const intentNode = this.ensureSectionIntent(node, intent);\n intentNode.default = registration;\n } else if (semantic) {\n if (!node.bySemantic) {\n node.bySemantic = new Map();\n }\n node.bySemantic.set(semantic, registration);\n } else {\n node.default = registration;\n }\n }\n }\n\n return this;\n }\n\n registerAction(name: string, handler: ActionHandler): this {\n this.actions.set(name, handler);\n return this;\n }\n\n // ---------------------------------------------------------------------------\n // Resolution\n // ---------------------------------------------------------------------------\n\n resolveSlot(name: string, intent?: string, semantic?: string): C {\n const node = this.slots.get(name);\n if (!node) {\n return this.fallback;\n }\n\n if (intent && semantic) {\n const found = node.byIntent?.get(intent)?.bySemantic?.get(semantic);\n if (found) {\n return found;\n }\n }\n if (intent) {\n const found = node.byIntent?.get(intent)?.default;\n if (found) {\n return found;\n }\n }\n if (semantic) {\n const found = node.bySemantic?.get(semantic);\n if (found) {\n return found;\n }\n }\n\n return node.default ?? this.fallback;\n }\n\n /**\n * Resolve a section component by type, optionally narrowed by intent /\n * semantic / placement.\n *\n * Accepts both call forms for backward compatibility:\n * resolveSection('hero') — default\n * resolveSection('hero', 'DISCOVERY') — intent (legacy positional)\n * resolveSection('hero', 'DISCOVERY', 'compact') — intent + semantic (legacy)\n * resolveSection('hero', { intent: 'DISCOVERY' }) — options object\n * resolveSection('hero', { placement: true }) — placement variant (DL #088 D3.1)\n * resolveSection('hero', { intent: 'X', placement: true }) — placement wins\n */\n resolveSection(sectionType: string, intent?: string, semantic?: string): C;\n resolveSection(sectionType: string, options: ResolveSectionOptions): C;\n resolveSection(\n sectionType: string,\n intentOrOptions?: string | ResolveSectionOptions,\n semantic?: string,\n ): C {\n const registration = this.resolveSectionRegistration(\n sectionType,\n normalizeResolveOptions(intentOrOptions, semantic),\n );\n return registration?.component ?? this.fallback;\n }\n\n /**\n * Resolve the options bundle associated with the matched registration.\n * Same overload semantics as `resolveSection`.\n */\n resolveSectionOptions(\n sectionType: string,\n intent?: string,\n semantic?: string,\n ): SectionOptions | undefined;\n resolveSectionOptions(\n sectionType: string,\n options: ResolveSectionOptions,\n ): SectionOptions | undefined;\n resolveSectionOptions(\n sectionType: string,\n intentOrOptions?: string | ResolveSectionOptions,\n semantic?: string,\n ): SectionOptions | undefined {\n return this.resolveSectionRegistration(\n sectionType,\n normalizeResolveOptions(intentOrOptions, semantic),\n )?.options;\n }\n\n private resolveSectionRegistration(\n sectionType: string,\n options: ResolveSectionOptions,\n ): SectionRegistration<C> | undefined {\n const node = this.sections.get(sectionType);\n if (!node) {\n return undefined;\n }\n\n const { intent, semantic, placement, placementId } = options;\n\n // Placement wins over intent / semantic when requested AND a placement\n // variant is registered for this section (DL #088 D3.1). Cascade:\n // id-scoped variant → generic placement variant → regular chain.\n if (placement) {\n if (placementId) {\n const byId = node.forPlacementById?.get(placementId);\n if (byId) {\n return byId;\n }\n }\n if (node.forPlacement) {\n return node.forPlacement;\n }\n }\n\n if (intent && semantic) {\n const found = node.byIntent?.get(intent as string)?.bySemantic?.get(semantic);\n if (found) {\n return found;\n }\n }\n if (intent) {\n const found = node.byIntent?.get(intent as string)?.default;\n if (found) {\n return found;\n }\n }\n if (semantic) {\n const found = node.bySemantic?.get(semantic);\n if (found) {\n return found;\n }\n }\n\n return node.default;\n }\n\n // ---------------------------------------------------------------------------\n // Introspection\n // ---------------------------------------------------------------------------\n\n getAllSlots(): string[] {\n return Array.from(this.slots.keys());\n }\n\n getAllSections(): string[] {\n return Array.from(this.sections.keys());\n }\n\n getAllDefinitions(): {\n sectionType: string;\n definition: SectionDefinition;\n }[] {\n return Array.from(this.definitions.entries()).map(\n ([sectionType, definition]) => ({\n sectionType,\n definition,\n }),\n );\n }\n\n getDefinition(sectionType: string): SectionDefinition | undefined {\n return this.definitions.get(sectionType);\n }\n\n /**\n * True when a section type was registered with placement variant(s) only —\n * a `{ placement: true }` (or `placementId`) registration and NO\n * non-placement variant (default / intent / semantic). Such a section is\n * meaningful only inside a placement render; the parser skips its definition\n * when matching in a non-placement context (the main app), so its markdown\n * falls through to the generic sections there.\n *\n * A definition registered with no variants at all (structural defs like\n * `skipNodes` / `htmlComment`) is NOT placement-only — it still matches\n * everywhere.\n */\n isPlacementOnly(sectionType: string): boolean {\n const node = this.sections.get(sectionType);\n if (!node) {\n return false;\n }\n const hasPlacement =\n node.forPlacement != null || (node.forPlacementById?.size ?? 0) > 0;\n const hasNonPlacement =\n node.default != null ||\n (node.byIntent?.size ?? 0) > 0 ||\n (node.bySemantic?.size ?? 0) > 0;\n return hasPlacement && !hasNonPlacement;\n }\n\n getSlotVariants(name: string): SlotVariant[] {\n const node = this.slots.get(name);\n if (!node) {\n return [];\n }\n\n const variants: SlotVariant[] = [];\n if (node.default) {\n variants.push({});\n }\n\n if (node.bySemantic) {\n for (const semantic of node.bySemantic.keys()) {\n variants.push({ semantic });\n }\n }\n\n if (node.byIntent) {\n for (const [intent, intentNode] of node.byIntent) {\n if (intentNode.default) {\n variants.push({ intent });\n }\n if (intentNode.bySemantic) {\n for (const semantic of intentNode.bySemantic.keys()) {\n variants.push({ intent, semantic });\n }\n }\n }\n }\n\n return variants;\n }\n\n getSectionVariants(sectionType: string): SectionVariant[] {\n const node = this.sections.get(sectionType);\n if (!node) {\n return [];\n }\n\n const variants: SectionVariant[] = [];\n if (node.default) {\n variants.push({});\n }\n\n if (node.bySemantic) {\n for (const semantic of node.bySemantic.keys()) {\n variants.push({ semantic });\n }\n }\n\n if (node.byIntent) {\n for (const [intent, intentNode] of node.byIntent) {\n if (intentNode.default) {\n variants.push({ intent });\n }\n if (intentNode.bySemantic) {\n for (const semantic of intentNode.bySemantic.keys()) {\n variants.push({ intent, semantic });\n }\n }\n }\n }\n\n if (node.forPlacement) {\n variants.push({ placement: true });\n }\n\n if (node.forPlacementById) {\n for (const placementId of node.forPlacementById.keys()) {\n variants.push({ placement: true, placementId });\n }\n }\n\n return variants;\n }\n\n hasAction(name: string): boolean {\n return this.actions.has(name);\n }\n\n async executeAction(\n name: string,\n params: Record<string, string>,\n ): Promise<ActionResult> {\n const handler = this.actions.get(name);\n if (!handler) {\n console.warn(`[Action] No handler for: \"${name}\"`);\n return { success: false, message: `Unknown action: ${name}` };\n }\n return handler(params);\n }\n\n getRegisteredActions(): string[] {\n return Array.from(this.actions.keys());\n }\n\n getCatalog(): RegistryCatalog {\n return {\n slots: this.getAllSlots().map((name) => ({\n name,\n variants: this.getSlotVariants(name),\n })),\n sections: this.getAllSections().map((sectionType) => ({\n name: sectionType,\n variants: this.getSectionVariants(sectionType),\n })),\n definitions: this.getAllDefinitions(),\n };\n }\n\n // ---------------------------------------------------------------------------\n // Private helpers\n // ---------------------------------------------------------------------------\n\n private ensureSectionIntent(\n node: SectionNode<C>,\n intent: string,\n ): SectionIntentNode<C> {\n if (!node.byIntent) {\n node.byIntent = new Map();\n }\n let intentNode = node.byIntent.get(intent);\n if (!intentNode) {\n intentNode = {};\n node.byIntent.set(intent, intentNode);\n }\n return intentNode;\n }\n\n private ensureSlotIntent(\n node: SlotNode<C>,\n intent: string,\n ): SlotIntentNode<C> {\n if (!node.byIntent) {\n node.byIntent = new Map();\n }\n let intentNode = node.byIntent.get(intent);\n if (!intentNode) {\n intentNode = {};\n node.byIntent.set(intent, intentNode);\n }\n return intentNode;\n }\n}\n"],"mappings":";;;;;;AAiBA;AACA;AACA;AACA;AACA;AACA,SAASA,uBAAuBA,CAC9BC,eAAgD,EAChDC,QAAiB,EACM;EACvB,IAAID,eAAe,IAAI,IAAI,EAAE;IAC3B,OAAOC,QAAQ,GAAG;MAAEA;IAAS,CAAC,GAAG,CAAC,CAAC;EACrC;EACA,IAAI,OAAOD,eAAe,KAAK,QAAQ,EAAE;IACvC,OAAOC,QAAQ,GAAG;MAAEC,MAAM,EAAEF,eAAe;MAAEC;IAAS,CAAC,GAAG;MAAEC,MAAM,EAAEF;IAAgB,CAAC;EACvF;EACA,OAAOA,eAAe;AACxB;AAEO,MAAMG,iBAAiB,CAAI;EAMhCC,WAAWA,CAASC,QAAW,EAAE;IAAA,KAAbA,QAAW,GAAXA,QAAW;IAAA,IAAAC,gBAAA,CAAAC,OAAA,iBALf,IAAIC,GAAG,CAAsB,CAAC;IAAA,IAAAF,gBAAA,CAAAC,OAAA,oBAC3B,IAAIC,GAAG,CAAyB,CAAC;IAAA,IAAAF,gBAAA,CAAAC,OAAA,uBAC9B,IAAIC,GAAG,CAA4B,CAAC;IAAA,IAAAF,gBAAA,CAAAC,OAAA,mBACxC,IAAIC,GAAG,CAAwB,CAAC;EAEhB;;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GAAG,CAAC,CAAC;IAC3B;IACA,IAAIS,UAAU,GAAGJ,IAAI,CAAC2B,QAAQ,CAACzB,GAAG,CAACb,MAAM,CAAC;IAC1C,IAAI,CAACe,UAAU,EAAE;MACfA,UAAU,GAAG,CAAC,CAAC;MACfJ,IAAI,CAAC2B,QAAQ,CAACxB,GAAG,CAACd,MAAM,EAAEe,UAAU,CAAC;IACvC;IACA,OAAOA,UAAU;EACnB;EAEQC,gBAAgBA,CACtBL,IAAiB,EACjBX,MAAc,EACK;IACnB,IAAI,CAACW,IAAI,CAAC2B,QAAQ,EAAE;MAClB3B,IAAI,CAAC2B,QAAQ,GAAG,IAAIhC,GAAG,CAAC,CAAC;IAC3B;IACA,IAAIS,UAAU,GAAGJ,IAAI,CAAC2B,QAAQ,CAACzB,GAAG,CAACb,MAAM,CAAC;IAC1C,IAAI,CAACe,UAAU,EAAE;MACfA,UAAU,GAAG,CAAC,CAAC;MACfJ,IAAI,CAAC2B,QAAQ,CAACxB,GAAG,CAACd,MAAM,EAAEe,UAAU,CAAC;IACvC;IACA,OAAOA,UAAU;EACnB;AACF;AAAC+D,OAAA,CAAA7E,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["normalizeResolveOptions","intentOrOptions","semantic","intent","ComponentRegistry","constructor","fallback","_defineProperty2","default","Map","registerSlot","name","component","options","node","slots","get","set","intentNode","ensureSlotIntent","bySemantic","register","definition","variants","console","warn","definitions","sectionType","registration","sections","placement","placementId","forPlacementById","forPlacement","ensureSectionIntent","registerAction","handler","actions","resolveSlot","_node$byIntent","found","byIntent","_node$byIntent2","_node$bySemantic","resolveSection","resolveSectionRegistration","resolveSectionOptions","_this$resolveSectionR","undefined","_node$forPlacementByI","byId","_node$byIntent3","_node$byIntent4","_node$bySemantic2","getAllSlots","Array","from","keys","getAllSections","getKnownIntents","intents","Set","values","_node$byIntent5","forEach","_variant","key","add","_node$byIntent6","getAllDefinitions","entries","map","getDefinition","isPlacementOnly","_node$forPlacementByI2","_node$byIntent7","_node$bySemantic3","hasPlacement","size","hasNonPlacement","getSlotVariants","push","getSectionVariants","hasAction","has","executeAction","params","success","message","getRegisteredActions","getCatalog","exports"],"sources":["../../../src/registry/ComponentRegistry.ts"],"sourcesContent":["import type { SectionDefinition } from '../component/componentDefinitions';\nimport type {\n SlotOptions,\n SectionOptions,\n SectionRegistration,\n SlotNode,\n SlotIntentNode,\n SectionNode,\n SectionIntentNode,\n SlotVariant,\n SectionVariant,\n RegistryCatalog,\n ResolveSectionOptions,\n ActionHandler,\n ActionResult,\n} from './types';\n\n/**\n * Accept the legacy positional form `(intent, semantic)` and the new\n * options-object form `({ intent, semantic, placement })`. Returns a\n * normalized `ResolveSectionOptions`.\n */\nfunction normalizeResolveOptions(\n intentOrOptions?: string | ResolveSectionOptions,\n semantic?: string,\n): ResolveSectionOptions {\n if (intentOrOptions == null) {\n return semantic ? { semantic } : {};\n }\n if (typeof intentOrOptions === 'string') {\n return semantic ? { intent: intentOrOptions, semantic } : { intent: intentOrOptions };\n }\n return intentOrOptions;\n}\n\nexport class ComponentRegistry<C> {\n private slots = new Map<string, SlotNode<C>>();\n private sections = new Map<string, SectionNode<C>>();\n private definitions = new Map<string, SectionDefinition>();\n private actions = new Map<string, ActionHandler>();\n\n constructor(private fallback: C) {}\n\n // ---------------------------------------------------------------------------\n // Registration\n // ---------------------------------------------------------------------------\n\n registerSlot(name: string, component: C, options?: SlotOptions): this {\n let node = this.slots.get(name);\n if (!node) {\n node = {};\n this.slots.set(name, node);\n }\n\n const { intent, semantic } = options ?? {};\n\n if (intent && semantic) {\n const intentNode = this.ensureSlotIntent(node, intent);\n if (!intentNode.bySemantic) {\n intentNode.bySemantic = new Map();\n }\n intentNode.bySemantic.set(semantic, component);\n } else if (intent) {\n const intentNode = this.ensureSlotIntent(node, intent);\n intentNode.default = component;\n } else if (semantic) {\n if (!node.bySemantic) {\n node.bySemantic = new Map();\n }\n node.bySemantic.set(semantic, component);\n } else {\n node.default = component;\n }\n\n return this;\n }\n\n register(\n definition: SectionDefinition,\n variants?: SectionRegistration<C>[],\n ): this {\n // Tolerate missing definitions instead of crashing app init. This\n // happens when a client UMD references a `SectionDefinition` symbol\n // that doesn't exist on the consuming bundle's `Web5Core` global\n // (e.g. UMD built against newer `web5-core` than the app bundle).\n // Without this guard a single missing export breaks every other\n // section the client tries to register.\n if (definition == null) {\n // eslint-disable-next-line no-console\n console.warn(\n '[ComponentRegistry] register() called with a null/undefined SectionDefinition — ' +\n 'likely a version skew between the client UMD and web5-core ' +\n '(an exported definition the UMD imports does not exist on this Web5Core). Skipping.',\n );\n return this;\n }\n this.definitions.set(definition.sectionType, definition);\n\n if (variants) {\n const sectionType = definition.sectionType;\n for (const registration of variants) {\n let node = this.sections.get(sectionType);\n if (!node) {\n node = {};\n this.sections.set(sectionType, node);\n }\n const { intent, semantic, placement, placementId } =\n registration.options ?? {};\n\n // Placement variants are stored on their own slot — no further\n // intent/semantic sub-variants (DL #088 D3.1). If a developer also\n // supplies intent/semantic alongside placement, those are ignored for\n // the placement registration. To register both a placement variant AND\n // an intent variant, register them as separate entries.\n if (placement) {\n // Scoped to a specific placement slot id — keyed so one section type\n // can render differently per placement. An id-less placement variant\n // remains the generic fallback.\n if (placementId) {\n if (!node.forPlacementById) {\n node.forPlacementById = new Map();\n }\n node.forPlacementById.set(placementId, registration);\n } else {\n node.forPlacement = registration;\n }\n continue;\n }\n\n if (intent && semantic) {\n const intentNode = this.ensureSectionIntent(node, intent);\n if (!intentNode.bySemantic) {\n intentNode.bySemantic = new Map();\n }\n intentNode.bySemantic.set(semantic, registration);\n } else if (intent) {\n const intentNode = this.ensureSectionIntent(node, intent);\n intentNode.default = registration;\n } else if (semantic) {\n if (!node.bySemantic) {\n node.bySemantic = new Map();\n }\n node.bySemantic.set(semantic, registration);\n } else {\n node.default = registration;\n }\n }\n }\n\n return this;\n }\n\n registerAction(name: string, handler: ActionHandler): this {\n this.actions.set(name, handler);\n return this;\n }\n\n // ---------------------------------------------------------------------------\n // Resolution\n // ---------------------------------------------------------------------------\n\n resolveSlot(name: string, intent?: string, semantic?: string): C {\n const node = this.slots.get(name);\n if (!node) {\n return this.fallback;\n }\n\n if (intent && semantic) {\n const found = node.byIntent?.get(intent)?.bySemantic?.get(semantic);\n if (found) {\n return found;\n }\n }\n if (intent) {\n const found = node.byIntent?.get(intent)?.default;\n if (found) {\n return found;\n }\n }\n if (semantic) {\n const found = node.bySemantic?.get(semantic);\n if (found) {\n return found;\n }\n }\n\n return node.default ?? this.fallback;\n }\n\n /**\n * Resolve a section component by type, optionally narrowed by intent /\n * semantic / placement.\n *\n * Accepts both call forms for backward compatibility:\n * resolveSection('hero') — default\n * resolveSection('hero', 'DISCOVERY') — intent (legacy positional)\n * resolveSection('hero', 'DISCOVERY', 'compact') — intent + semantic (legacy)\n * resolveSection('hero', { intent: 'DISCOVERY' }) — options object\n * resolveSection('hero', { placement: true }) — placement variant (DL #088 D3.1)\n * resolveSection('hero', { intent: 'X', placement: true }) — placement wins\n */\n resolveSection(sectionType: string, intent?: string, semantic?: string): C;\n resolveSection(sectionType: string, options: ResolveSectionOptions): C;\n resolveSection(\n sectionType: string,\n intentOrOptions?: string | ResolveSectionOptions,\n semantic?: string,\n ): C {\n const registration = this.resolveSectionRegistration(\n sectionType,\n normalizeResolveOptions(intentOrOptions, semantic),\n );\n return registration?.component ?? this.fallback;\n }\n\n /**\n * Resolve the options bundle associated with the matched registration.\n * Same overload semantics as `resolveSection`.\n */\n resolveSectionOptions(\n sectionType: string,\n intent?: string,\n semantic?: string,\n ): SectionOptions | undefined;\n resolveSectionOptions(\n sectionType: string,\n options: ResolveSectionOptions,\n ): SectionOptions | undefined;\n resolveSectionOptions(\n sectionType: string,\n intentOrOptions?: string | ResolveSectionOptions,\n semantic?: string,\n ): SectionOptions | undefined {\n return this.resolveSectionRegistration(\n sectionType,\n normalizeResolveOptions(intentOrOptions, semantic),\n )?.options;\n }\n\n private resolveSectionRegistration(\n sectionType: string,\n options: ResolveSectionOptions,\n ): SectionRegistration<C> | undefined {\n const node = this.sections.get(sectionType);\n if (!node) {\n return undefined;\n }\n\n const { intent, semantic, placement, placementId } = options;\n\n // Placement wins over intent / semantic when requested AND a placement\n // variant is registered for this section (DL #088 D3.1). Cascade:\n // id-scoped variant → generic placement variant → regular chain.\n if (placement) {\n if (placementId) {\n const byId = node.forPlacementById?.get(placementId);\n if (byId) {\n return byId;\n }\n }\n if (node.forPlacement) {\n return node.forPlacement;\n }\n }\n\n if (intent && semantic) {\n const found = node.byIntent?.get(intent as string)?.bySemantic?.get(semantic);\n if (found) {\n return found;\n }\n }\n if (intent) {\n const found = node.byIntent?.get(intent as string)?.default;\n if (found) {\n return found;\n }\n }\n if (semantic) {\n const found = node.bySemantic?.get(semantic);\n if (found) {\n return found;\n }\n }\n\n return node.default;\n }\n\n // ---------------------------------------------------------------------------\n // Introspection\n // ---------------------------------------------------------------------------\n\n getAllSlots(): string[] {\n return Array.from(this.slots.keys());\n }\n\n getAllSections(): string[] {\n return Array.from(this.sections.keys());\n }\n\n /**\n * Every intent that has at least one registered slot or section variant —\n * i.e. the client's own intent list, derived from what it actually\n * registered. Assembly uses this to validate an incoming intent before it\n * becomes a resolution key, falling back to core's `DEFAULT_INTENTS` only\n * when a client registers no intent variants at all.\n */\n getKnownIntents(): string[] {\n const intents = new Set<string>();\n for (const node of this.slots.values()) {\n node.byIntent?.forEach((_variant, key) => intents.add(key));\n }\n for (const node of this.sections.values()) {\n node.byIntent?.forEach((_variant, key) => intents.add(key));\n }\n return Array.from(intents);\n }\n\n getAllDefinitions(): {\n sectionType: string;\n definition: SectionDefinition;\n }[] {\n return Array.from(this.definitions.entries()).map(\n ([sectionType, definition]) => ({\n sectionType,\n definition,\n }),\n );\n }\n\n getDefinition(sectionType: string): SectionDefinition | undefined {\n return this.definitions.get(sectionType);\n }\n\n /**\n * True when a section type was registered with placement variant(s) only —\n * a `{ placement: true }` (or `placementId`) registration and NO\n * non-placement variant (default / intent / semantic). Such a section is\n * meaningful only inside a placement render; the parser skips its definition\n * when matching in a non-placement context (the main app), so its markdown\n * falls through to the generic sections there.\n *\n * A definition registered with no variants at all (structural defs like\n * `skipNodes` / `htmlComment`) is NOT placement-only — it still matches\n * everywhere.\n */\n isPlacementOnly(sectionType: string): boolean {\n const node = this.sections.get(sectionType);\n if (!node) {\n return false;\n }\n const hasPlacement =\n node.forPlacement != null || (node.forPlacementById?.size ?? 0) > 0;\n const hasNonPlacement =\n node.default != null ||\n (node.byIntent?.size ?? 0) > 0 ||\n (node.bySemantic?.size ?? 0) > 0;\n return hasPlacement && !hasNonPlacement;\n }\n\n getSlotVariants(name: string): SlotVariant[] {\n const node = this.slots.get(name);\n if (!node) {\n return [];\n }\n\n const variants: SlotVariant[] = [];\n if (node.default) {\n variants.push({});\n }\n\n if (node.bySemantic) {\n for (const semantic of node.bySemantic.keys()) {\n variants.push({ semantic });\n }\n }\n\n if (node.byIntent) {\n for (const [intent, intentNode] of node.byIntent) {\n if (intentNode.default) {\n variants.push({ intent });\n }\n if (intentNode.bySemantic) {\n for (const semantic of intentNode.bySemantic.keys()) {\n variants.push({ intent, semantic });\n }\n }\n }\n }\n\n return variants;\n }\n\n getSectionVariants(sectionType: string): SectionVariant[] {\n const node = this.sections.get(sectionType);\n if (!node) {\n return [];\n }\n\n const variants: SectionVariant[] = [];\n if (node.default) {\n variants.push({});\n }\n\n if (node.bySemantic) {\n for (const semantic of node.bySemantic.keys()) {\n variants.push({ semantic });\n }\n }\n\n if (node.byIntent) {\n for (const [intent, intentNode] of node.byIntent) {\n if (intentNode.default) {\n variants.push({ intent });\n }\n if (intentNode.bySemantic) {\n for (const semantic of intentNode.bySemantic.keys()) {\n variants.push({ intent, semantic });\n }\n }\n }\n }\n\n if (node.forPlacement) {\n variants.push({ placement: true });\n }\n\n if (node.forPlacementById) {\n for (const placementId of node.forPlacementById.keys()) {\n variants.push({ placement: true, placementId });\n }\n }\n\n return variants;\n }\n\n hasAction(name: string): boolean {\n return this.actions.has(name);\n }\n\n async executeAction(\n name: string,\n params: Record<string, string>,\n ): Promise<ActionResult> {\n const handler = this.actions.get(name);\n if (!handler) {\n console.warn(`[Action] No handler for: \"${name}\"`);\n return { success: false, message: `Unknown action: ${name}` };\n }\n return handler(params);\n }\n\n getRegisteredActions(): string[] {\n return Array.from(this.actions.keys());\n }\n\n getCatalog(): RegistryCatalog {\n return {\n slots: this.getAllSlots().map((name) => ({\n name,\n variants: this.getSlotVariants(name),\n })),\n sections: this.getAllSections().map((sectionType) => ({\n name: sectionType,\n variants: this.getSectionVariants(sectionType),\n })),\n definitions: this.getAllDefinitions(),\n };\n }\n\n // ---------------------------------------------------------------------------\n // Private helpers\n // ---------------------------------------------------------------------------\n\n private ensureSectionIntent(\n node: SectionNode<C>,\n intent: string,\n ): SectionIntentNode<C> {\n if (!node.byIntent) {\n node.byIntent = new Map();\n }\n let intentNode = node.byIntent.get(intent);\n if (!intentNode) {\n intentNode = {};\n node.byIntent.set(intent, intentNode);\n }\n return intentNode;\n }\n\n private ensureSlotIntent(\n node: SlotNode<C>,\n intent: string,\n ): SlotIntentNode<C> {\n if (!node.byIntent) {\n node.byIntent = new Map();\n }\n let intentNode = node.byIntent.get(intent);\n if (!intentNode) {\n intentNode = {};\n node.byIntent.set(intent, intentNode);\n }\n return intentNode;\n }\n}\n"],"mappings":";;;;;;AAiBA;AACA;AACA;AACA;AACA;AACA,SAASA,uBAAuBA,CAC9BC,eAAgD,EAChDC,QAAiB,EACM;EACvB,IAAID,eAAe,IAAI,IAAI,EAAE;IAC3B,OAAOC,QAAQ,GAAG;MAAEA;IAAS,CAAC,GAAG,CAAC,CAAC;EACrC;EACA,IAAI,OAAOD,eAAe,KAAK,QAAQ,EAAE;IACvC,OAAOC,QAAQ,GAAG;MAAEC,MAAM,EAAEF,eAAe;MAAEC;IAAS,CAAC,GAAG;MAAEC,MAAM,EAAEF;IAAgB,CAAC;EACvF;EACA,OAAOA,eAAe;AACxB;AAEO,MAAMG,iBAAiB,CAAI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C;MACfJ,IAAI,CAAC2B,QAAQ,CAACxB,GAAG,CAACd,MAAM,EAAEe,UAAU,CAAC;IACvC;IACA,OAAOA,UAAU;EACnB;EAEQC,gBAAgBA,CACtBL,IAAiB,EACjBX,MAAc,EACK;IACnB,IAAI,CAACW,IAAI,CAAC2B,QAAQ,EAAE;MAClB3B,IAAI,CAAC2B,QAAQ,GAAG,IAAIhC,GAAG,CAAC,CAAC;IAC3B;IACA,IAAIS,UAAU,GAAGJ,IAAI,CAAC2B,QAAQ,CAACzB,GAAG,CAACb,MAAM,CAAC;IAC1C,IAAI,CAACe,UAAU,EAAE;MACfA,UAAU,GAAG,CAAC,CAAC;MACfJ,IAAI,CAAC2B,QAAQ,CAACxB,GAAG,CAACd,MAAM,EAAEe,UAAU,CAAC;IACvC;IACA,OAAOA,UAAU;EACnB;AACF;AAACyE,OAAA,CAAAvF,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.
|
|
4
|
+
exports.ComponentRegistry = void 0;
|
|
5
5
|
var _ComponentRegistry = require("./ComponentRegistry");
|
|
6
6
|
exports.ComponentRegistry = _ComponentRegistry.ComponentRegistry;
|
|
7
|
-
var _Intent = require("./Intent");
|
|
8
|
-
exports.Intent = _Intent.Intent;
|
|
9
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_ComponentRegistry","require","exports","ComponentRegistry"
|
|
1
|
+
{"version":3,"names":["_ComponentRegistry","require","exports","ComponentRegistry"],"sources":["../../../src/registry/index.ts"],"sourcesContent":["export { ComponentRegistry } from './ComponentRegistry';\nexport type {\n SlotOptions,\n SectionOptions,\n SectionRegistration,\n SlotNode,\n SlotIntentNode,\n SectionIntentNode,\n SectionNode,\n SlotVariant,\n SectionVariant,\n RegistryCatalog,\n ActionResult,\n ActionHandler,\n} from './types';\n"],"mappings":";;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAAwDC,OAAA,CAAAC,iBAAA,GAAAH,kBAAA,CAAAG,iBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/registry/types.ts"],"sourcesContent":["import type { SectionDefinition } from '../component/section-definition';\
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/registry/types.ts"],"sourcesContent":["import type { SectionDefinition } from '../component/section-definition';\n\nexport interface SlotOptions {\n intent?: string;\n semantic?: string;\n}\n\nexport interface SectionOptions {\n intent?: string;\n semantic?: string;\n /**\n * Marks this registration as a placement variant — used when the section is\n * rendered inside a placement slot (DL #088 D3.1). Placement variants win\n * over intent / semantic variants at resolve time when `{ placement: true }`\n * is passed to `resolveSection`.\n */\n placement?: boolean;\n /**\n * Narrows a placement variant to a specific placement slot — the value of\n * `data-web5-placement=\"X\"` on the host slot (e.g. `pdpFraming`). Only\n * meaningful together with `placement: true`. At resolve time, a registration\n * with a matching `placementId` wins over the generic (id-less) placement\n * variant. Lets one section type render differently per placement slot.\n */\n placementId?: string;\n componentOptions?: Record<string, any>;\n}\n\n/**\n * Options accepted by `resolveSection` / `resolveSectionOptions` in the\n * options-object form. Mirrors `SectionOptions` minus `componentOptions`.\n */\nexport interface ResolveSectionOptions {\n intent?: string;\n semantic?: string;\n placement?: boolean;\n /** Placement slot id to match against `placementId` registrations. */\n placementId?: string;\n}\n\nexport interface SectionRegistration<C> {\n component: C;\n options?: SectionOptions;\n}\n\nexport interface SlotIntentNode<C> {\n default?: C;\n bySemantic?: Map<string, C>;\n}\n\nexport interface SlotNode<C> {\n default?: C;\n byIntent?: Map<string, SlotIntentNode<C>>;\n bySemantic?: Map<string, C>;\n}\n\nexport interface SectionIntentNode<C> {\n default?: SectionRegistration<C>;\n bySemantic?: Map<string, SectionRegistration<C>>;\n}\n\nexport interface SectionNode<C> {\n default?: SectionRegistration<C>;\n byIntent?: Map<string, SectionIntentNode<C>>;\n bySemantic?: Map<string, SectionRegistration<C>>;\n /** Generic placement-specific variant (DL #088 D3.1). One per section type. */\n forPlacement?: SectionRegistration<C>;\n /**\n * Placement variants keyed by placement slot id (the `data-web5-placement`\n * value). Resolved before `forPlacement` when a matching id is requested.\n */\n forPlacementById?: Map<string, SectionRegistration<C>>;\n}\n\nexport interface SlotVariant {\n intent?: string;\n semantic?: string;\n}\n\nexport interface SectionVariant {\n intent?: string;\n semantic?: string;\n /** True when this variant is the placement-specific one (DL #088 D3.1). */\n placement?: boolean;\n /** Set when this variant is scoped to a specific placement slot id. */\n placementId?: string;\n}\n\nexport interface RegistryCatalog {\n slots: { name: string; variants: SlotVariant[] }[];\n sections: { name: string; variants: SectionVariant[] }[];\n definitions: { sectionType: string; definition: SectionDefinition }[];\n}\n\nexport interface ActionResult {\n success: boolean;\n data?: unknown;\n message?: string;\n}\n\nexport type ActionHandler = (\n params: Record<string, string>,\n) => Promise<ActionResult> | ActionResult;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -378,6 +378,41 @@
|
|
|
378
378
|
100% { background-position: 200% 0; }
|
|
379
379
|
}
|
|
380
380
|
|
|
381
|
+
/* Section content reveal (DL #114 C) — a one-shot fade/slide-in applied the first
|
|
382
|
+
time a streamed section swaps from its skeleton to real content, so it appears
|
|
383
|
+
smoothly instead of popping in. Motion is suppressed under reduced-motion. */
|
|
384
|
+
@keyframes w5-section-in {
|
|
385
|
+
from { opacity: 0; transform: translateY(16px); }
|
|
386
|
+
to { opacity: 1; transform: none; }
|
|
387
|
+
}
|
|
388
|
+
.w5-section-enter {
|
|
389
|
+
animation: w5-section-in 360ms ease-out both;
|
|
390
|
+
}
|
|
391
|
+
@media (prefers-reduced-motion: reduce) {
|
|
392
|
+
.w5-section-enter {
|
|
393
|
+
animation: none;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/* Section skeleton entrance (DL #114 C) — when a section's skeleton first shows
|
|
398
|
+
up it unfolds from the top (scaleY) so it grows into place instead of popping
|
|
399
|
+
in at full height. Transform-based, so it doesn't shift the sections below
|
|
400
|
+
(their space is already reserved). Shared by every client skeleton (core
|
|
401
|
+
default + per-client overrides) via `w5-skeleton-expand`. Reduced-motion off. */
|
|
402
|
+
@keyframes w5-skeleton-expand {
|
|
403
|
+
from { opacity: 0; transform: scaleY(0); }
|
|
404
|
+
to { opacity: 1; transform: scaleY(1); }
|
|
405
|
+
}
|
|
406
|
+
.w5-skeleton-expand {
|
|
407
|
+
transform-origin: top center;
|
|
408
|
+
animation: w5-skeleton-expand 320ms ease-out both;
|
|
409
|
+
}
|
|
410
|
+
@media (prefers-reduced-motion: reduce) {
|
|
411
|
+
.w5-skeleton-expand {
|
|
412
|
+
animation: none;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
381
416
|
/* Global accessible focus indicator — only visible on keyboard navigation */
|
|
382
417
|
:focus-visible {
|
|
383
418
|
outline: 2px solid rgba(128, 0, 177, 0.5);
|
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
@import '../components/ui/PromptEntryEmptyState.css';
|
|
3
3
|
@import '../components/ui/FeedbackBar.css';
|
|
4
4
|
@import '../components/ui/Disclaimer.css';
|
|
5
|
+
@import '../components/ui/UserQuery.css';
|
|
5
6
|
@import '../components/ui/PlacementLoader.css';
|
|
6
7
|
@import '../components/placement/PlacementResponseRenderer.css';
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* host-reset.css — re-establishes the Web5 typographic baseline inside the
|
|
3
|
+
* mount root.
|
|
4
|
+
*
|
|
5
|
+
* Tailwind's preflight already neutralises most of what a host theme imposes
|
|
6
|
+
* (margins, list markers, heading font-size/weight, link decoration), and the
|
|
7
|
+
* build scopes it to the root, so inside Web5 it outranks the theme. What
|
|
8
|
+
* preflight does NOT cover is everything it expects to inherit from `html`:
|
|
9
|
+
* font-family, line-height, letter-spacing, text-transform and colour. A theme
|
|
10
|
+
* that sets those on its rich-text wrapper — `.rte p { line-height: 1.4 }`,
|
|
11
|
+
* `.rte h1 { font-family: … }` — still wins there, because inheritance loses to
|
|
12
|
+
* any matching rule.
|
|
13
|
+
*
|
|
14
|
+
* So each of those properties is re-asserted here at element specificity. After
|
|
15
|
+
* scoping these become `(1,0,1)`: above a theme's `(0,1,1)` descendant rules,
|
|
16
|
+
* below our own `(1,1,0)` utilities. That ordering is the whole point — the
|
|
17
|
+
* theme is overridden, atoms still win.
|
|
18
|
+
*
|
|
19
|
+
* Wrapped in `@layer base` so Storybook (which compiles this file without the
|
|
20
|
+
* scoping pass) keeps the same relationship to utilities as the shipped bundle.
|
|
21
|
+
*
|
|
22
|
+
* `#root` is rewritten to the scope selector by `config/scope-css.ts`.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
@layer base {
|
|
26
|
+
/*
|
|
27
|
+
* The baseline every descendant inherits. Without it the root inherits the
|
|
28
|
+
* theme's body type — 14px/1.4 on the reference store — and every element we
|
|
29
|
+
* do not explicitly size comes out wrong.
|
|
30
|
+
*
|
|
31
|
+
* `--w5-root-font-size` is the escape hatch for themes that rescale the root
|
|
32
|
+
* (`html { font-size: 62.5% }` is a common pattern): a client sets it in
|
|
33
|
+
* `users/<msid>/theme.css` to bring our rem-based scale back to intent.
|
|
34
|
+
*/
|
|
35
|
+
#root {
|
|
36
|
+
font-family: var(--font-sans);
|
|
37
|
+
font-size: var(--w5-root-font-size, 1rem);
|
|
38
|
+
font-style: normal;
|
|
39
|
+
font-weight: 400;
|
|
40
|
+
line-height: 1.5;
|
|
41
|
+
letter-spacing: normal;
|
|
42
|
+
text-align: start;
|
|
43
|
+
text-transform: none;
|
|
44
|
+
color: hsl(var(--foreground));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Headings take the display face regardless of what the theme sets on its
|
|
48
|
+
* rich-text headings. Sizes and weights come from the Heading atom. */
|
|
49
|
+
:is(h1, h2, h3, h4, h5, h6) {
|
|
50
|
+
font-family: var(--font-display);
|
|
51
|
+
letter-spacing: inherit;
|
|
52
|
+
text-transform: none;
|
|
53
|
+
color: inherit;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* Everything that carries body copy inherits our baseline rather than the
|
|
57
|
+
* theme's rich-text rules. */
|
|
58
|
+
:is(p, li, dd, dt, blockquote, figcaption, label, td, th, address, small) {
|
|
59
|
+
font-family: inherit;
|
|
60
|
+
font-size: inherit;
|
|
61
|
+
line-height: inherit;
|
|
62
|
+
letter-spacing: inherit;
|
|
63
|
+
text-transform: none;
|
|
64
|
+
color: inherit;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* Links: preflight already inherits colour and decoration; themes also set
|
|
68
|
+
* the face and casing on them. */
|
|
69
|
+
a {
|
|
70
|
+
font-family: inherit;
|
|
71
|
+
letter-spacing: inherit;
|
|
72
|
+
text-transform: none;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* Form controls inherit the face from preflight but not the rest, and the
|
|
76
|
+
* conversation input is a form control. */
|
|
77
|
+
:is(button, input, optgroup, select, textarea) {
|
|
78
|
+
letter-spacing: inherit;
|
|
79
|
+
text-transform: none;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/*
|
|
83
|
+
* Layout properties a host theme sets that our utilities never do.
|
|
84
|
+
*
|
|
85
|
+
* Scoping wins the properties we declare; it cannot touch the ones we don't.
|
|
86
|
+
* Tailwind's `grid-cols-*` sets `grid-template-columns` and nothing else, so
|
|
87
|
+
* a theme that also styles a class called `.grid` — Shopify's Horizon
|
|
88
|
+
* declares `grid-template-areas: "column-0 column-1 … column-13"` on it —
|
|
89
|
+
* leaks 14 named areas into our grid. The areas extend the explicit track
|
|
90
|
+
* list, our four `1fr` columns collapse to 0px, and every card in the row
|
|
91
|
+
* renders one character wide. Measured on a stock Horizon store.
|
|
92
|
+
*
|
|
93
|
+
* `grid-template-areas` is the only such leak found so far. Add to this list
|
|
94
|
+
* only with a reproduction: an unproven reset is a layout bug waiting to
|
|
95
|
+
* happen. Our own utilities are (1,1,0) and still win over these.
|
|
96
|
+
*/
|
|
97
|
+
* {
|
|
98
|
+
grid-template-areas: none;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -117,12 +117,12 @@
|
|
|
117
117
|
--leading-body-sm: var(--body-small-text-line-height);
|
|
118
118
|
--leading-callout: 36px;
|
|
119
119
|
|
|
120
|
-
/* Placement card body copy — short framing / conversation answers
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
--text-placement-body:
|
|
125
|
-
--leading-placement-body:
|
|
120
|
+
/* Placement card body copy — short framing / conversation answers and the
|
|
121
|
+
search-overview lead block. Medium weight body with bold leading-phrase
|
|
122
|
+
emphasis. Used by `PlacementGeneralTextSection` (the placement variant of
|
|
123
|
+
the fallback section) and `SearchOverviewSection`. */
|
|
124
|
+
--text-placement-body: 16px;
|
|
125
|
+
--leading-placement-body: 24px;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/* Font tokens use @theme inline so utilities emit `font-family: var(--font-*)`
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.usesStagingBackend = exports.setBackendEnvironment = exports.getBackendEnvironment = exports.DEFAULT_BACKEND_ENVIRONMENT = exports.BACKEND_ENVIRONMENT_QUERY_PARAM = exports.BACKEND_ENVIRONMENT_KEY = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Backend environment selection (debug-only).
|
|
7
|
+
*
|
|
8
|
+
* Selects which backend environment a conversation runs against: `production`
|
|
9
|
+
* (default) or `staging`. Resolved at request time from, in order of
|
|
10
|
+
* precedence: the `?backendEnv=staging|production` query param (one-shot
|
|
11
|
+
* override, e.g. for simulations), then
|
|
12
|
+
* `localStorage["web5_backend_environment"]` (the debug toggle), then the
|
|
13
|
+
* default `production`.
|
|
14
|
+
*
|
|
15
|
+
* When `staging` is selected the Turn RPC carries the environment to the BE via
|
|
16
|
+
* `additionalData.mode` (DL #110). Lives in web5-core so any surface can honor
|
|
17
|
+
* the same toggle.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const BACKEND_ENVIRONMENT_KEY = exports.BACKEND_ENVIRONMENT_KEY = 'web5_backend_environment';
|
|
21
|
+
|
|
22
|
+
/** Query param that forces a backend environment, overriding localStorage. */
|
|
23
|
+
const BACKEND_ENVIRONMENT_QUERY_PARAM = exports.BACKEND_ENVIRONMENT_QUERY_PARAM = 'backendEnv';
|
|
24
|
+
const DEFAULT_BACKEND_ENVIRONMENT = exports.DEFAULT_BACKEND_ENVIRONMENT = 'production';
|
|
25
|
+
const isBackendEnvironment = value => value === 'staging' || value === 'production';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Read a backend environment override from the `?backendEnv=` query param.
|
|
29
|
+
* Returns `null` when the param is absent, invalid, or `window` is unavailable.
|
|
30
|
+
*/
|
|
31
|
+
const getBackendEnvironmentFromQuery = () => {
|
|
32
|
+
try {
|
|
33
|
+
const value = new URLSearchParams(window.location.search).get(BACKEND_ENVIRONMENT_QUERY_PARAM);
|
|
34
|
+
if (isBackendEnvironment(value)) {
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
} catch {
|
|
38
|
+
// window / URLSearchParams unavailable (SSR, non-DOM environments).
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Resolve the selected backend environment. The `?backendEnv=` query param wins
|
|
45
|
+
* over localStorage; both fall back to the default (`production`) when unset,
|
|
46
|
+
* invalid, or storage is unavailable.
|
|
47
|
+
*/
|
|
48
|
+
const getBackendEnvironment = () => {
|
|
49
|
+
const fromQuery = getBackendEnvironmentFromQuery();
|
|
50
|
+
if (fromQuery) {
|
|
51
|
+
return fromQuery;
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
const value = localStorage.getItem(BACKEND_ENVIRONMENT_KEY);
|
|
55
|
+
if (isBackendEnvironment(value)) {
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
} catch {
|
|
59
|
+
// localStorage can throw in privacy mode / non-DOM environments.
|
|
60
|
+
}
|
|
61
|
+
return DEFAULT_BACKEND_ENVIRONMENT;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/** Persist the selected backend environment to localStorage. */
|
|
65
|
+
exports.getBackendEnvironment = getBackendEnvironment;
|
|
66
|
+
const setBackendEnvironment = env => {
|
|
67
|
+
try {
|
|
68
|
+
localStorage.setItem(BACKEND_ENVIRONMENT_KEY, env);
|
|
69
|
+
} catch {
|
|
70
|
+
// Ignore — selection simply won't persist across reloads.
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/** Whether the conversation should target the staging backend (default is production). */
|
|
75
|
+
exports.setBackendEnvironment = setBackendEnvironment;
|
|
76
|
+
const usesStagingBackend = () => getBackendEnvironment() === 'staging';
|
|
77
|
+
exports.usesStagingBackend = usesStagingBackend;
|
|
78
|
+
//# sourceMappingURL=backendEnvironment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BACKEND_ENVIRONMENT_KEY","exports","BACKEND_ENVIRONMENT_QUERY_PARAM","DEFAULT_BACKEND_ENVIRONMENT","isBackendEnvironment","value","getBackendEnvironmentFromQuery","URLSearchParams","window","location","search","get","getBackendEnvironment","fromQuery","localStorage","getItem","setBackendEnvironment","env","setItem","usesStagingBackend"],"sources":["../../../src/utils/backendEnvironment.ts"],"sourcesContent":["/**\n * Backend environment selection (debug-only).\n *\n * Selects which backend environment a conversation runs against: `production`\n * (default) or `staging`. Resolved at request time from, in order of\n * precedence: the `?backendEnv=staging|production` query param (one-shot\n * override, e.g. for simulations), then\n * `localStorage[\"web5_backend_environment\"]` (the debug toggle), then the\n * default `production`.\n *\n * When `staging` is selected the Turn RPC carries the environment to the BE via\n * `additionalData.mode` (DL #110). Lives in web5-core so any surface can honor\n * the same toggle.\n */\n\nexport type BackendEnvironment = 'staging' | 'production';\n\nexport const BACKEND_ENVIRONMENT_KEY = 'web5_backend_environment';\n\n/** Query param that forces a backend environment, overriding localStorage. */\nexport const BACKEND_ENVIRONMENT_QUERY_PARAM = 'backendEnv';\n\nexport const DEFAULT_BACKEND_ENVIRONMENT: BackendEnvironment = 'production';\n\nconst isBackendEnvironment = (value: unknown): value is BackendEnvironment =>\n value === 'staging' || value === 'production';\n\n/**\n * Read a backend environment override from the `?backendEnv=` query param.\n * Returns `null` when the param is absent, invalid, or `window` is unavailable.\n */\nconst getBackendEnvironmentFromQuery = (): BackendEnvironment | null => {\n try {\n const value = new URLSearchParams(window.location.search).get(\n BACKEND_ENVIRONMENT_QUERY_PARAM,\n );\n if (isBackendEnvironment(value)) {\n return value;\n }\n } catch {\n // window / URLSearchParams unavailable (SSR, non-DOM environments).\n }\n return null;\n};\n\n/**\n * Resolve the selected backend environment. The `?backendEnv=` query param wins\n * over localStorage; both fall back to the default (`production`) when unset,\n * invalid, or storage is unavailable.\n */\nexport const getBackendEnvironment = (): BackendEnvironment => {\n const fromQuery = getBackendEnvironmentFromQuery();\n if (fromQuery) {\n return fromQuery;\n }\n try {\n const value = localStorage.getItem(BACKEND_ENVIRONMENT_KEY);\n if (isBackendEnvironment(value)) {\n return value;\n }\n } catch {\n // localStorage can throw in privacy mode / non-DOM environments.\n }\n return DEFAULT_BACKEND_ENVIRONMENT;\n};\n\n/** Persist the selected backend environment to localStorage. */\nexport const setBackendEnvironment = (env: BackendEnvironment): void => {\n try {\n localStorage.setItem(BACKEND_ENVIRONMENT_KEY, env);\n } catch {\n // Ignore — selection simply won't persist across reloads.\n }\n};\n\n/** Whether the conversation should target the staging backend (default is production). */\nexport const usesStagingBackend = (): boolean =>\n getBackendEnvironment() === 'staging';\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIO,MAAMA,uBAAuB,GAAAC,OAAA,CA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A,KAChCP,qBAAqB,CAAC,CAAC,KAAK,SAAS;AAACX,OAAA,CAAAkB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -41,6 +41,8 @@ function parseWeb5Url(url) {
|
|
|
41
41
|
{
|
|
42
42
|
const slashIndex = path.indexOf('/');
|
|
43
43
|
if (slashIndex === -1) {
|
|
44
|
+
// The type segment is used verbatim (the `<type>` in
|
|
45
|
+
// `web5://entity/<type>/<id>`); the backend sends the semantic type.
|
|
44
46
|
return {
|
|
45
47
|
type: _linkTypes.Web5UrlType.ENTITY,
|
|
46
48
|
path,
|
|
@@ -177,7 +179,7 @@ function parseEntityLink(url) {
|
|
|
177
179
|
}
|
|
178
180
|
const path = url.slice('web5://entity/'.length);
|
|
179
181
|
|
|
180
|
-
// Split by '/' to get entityType and entityId
|
|
182
|
+
// Split by '/' to get entityType and entityId. The type is used verbatim.
|
|
181
183
|
const slashIndex = path.indexOf('/');
|
|
182
184
|
if (slashIndex === -1) {
|
|
183
185
|
// No slash found - only entityType, no entityId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_linkTypes","require","WEB5_TYPE_PREFIXES","Object","values","Web5UrlType","parseWeb5Url","url","startsWith","fullPath","slice","length","prefix","path","ENTITY","slashIndex","indexOf","type","entityType","entityId","ACTION","qIndex","actionName","actionParams","params","searchParams","URLSearchParams","forEach","value","key","SEARCH","searchQuery","decodeURIComponent","replace","ASK","IMAGE","ICON","isValidWeb5Url","LEGACY_PROTOCOLS","validateLinkUrl","undefined","console","log","some","p","isEntityLink","isWeb5EntityUrl","parseEntityLink","trim","extractProtocol","match","toLowerCase","extractLinkMetadata","node","metadata","protocol","parsed","web5Type"],"sources":["../../../src/utils/entityLinkParser.ts"],"sourcesContent":["import type { LinkMetadata } from '../patternValidator/types';\nimport {\n Web5UrlType,\n isWeb5EntityUrl,\n type ValidLinkUrl,\n} from '../types/link-types';\n\nexport interface Web5AskParsed {\n type: Web5UrlType.ASK;\n path: string;\n}\n\nexport interface Web5EntityParsed {\n type: Web5UrlType.ENTITY;\n path: string;\n entityType: string;\n entityId: string;\n}\n\nexport interface Web5ImageParsed {\n type: Web5UrlType.IMAGE;\n path: string;\n}\n\nexport interface Web5IconParsed {\n type: Web5UrlType.ICON;\n path: string;\n}\n\nexport interface Web5ActionParsed {\n type: Web5UrlType.ACTION;\n path: string;\n actionName: string;\n actionParams: Record<string, string>;\n}\n\nexport interface Web5SearchParsed {\n type: Web5UrlType.SEARCH;\n path: string;\n searchQuery: string;\n}\n\nexport type Web5UrlParsed =\n | Web5AskParsed\n | Web5EntityParsed\n | Web5ImageParsed\n | Web5IconParsed\n | Web5ActionParsed\n | Web5SearchParsed;\n\nconst WEB5_TYPE_PREFIXES = Object.values(Web5UrlType);\n\n/**\n * Central parser for unified web5:// URLs.\n *\n * Supported formats:\n * - `web5://ask/msg` → `{ type: Web5UrlType.ASK, path: 'msg' }`\n * - `web5://entity/solution/123` → `{ type: Web5UrlType.ENTITY, path: 'solution/123', entityType: 'solution', entityId: '123' }`\n * - `web5://image/kw` → `{ type: Web5UrlType.IMAGE, path: 'kw' }`\n * - `web5://icon/name` → `{ type: Web5UrlType.ICON, path: 'name' }`\n * - `web5://action/name?param=val` → `{ type: Web5UrlType.ACTION, path: 'name?param=val', actionName: 'name', actionParams: { param: 'val' } }`\n * - `web5://search/query` → `{ type: Web5UrlType.SEARCH, path: 'query', searchQuery: 'query' }`\n */\nexport function parseWeb5Url(url: string): Web5UrlParsed | null {\n if (!url || typeof url !== 'string') {\n return null;\n }\n\n if (!url.startsWith('web5://')) {\n return null;\n }\n\n const fullPath = url.slice('web5://'.length);\n if (!fullPath) {\n return null;\n }\n\n for (const prefix of WEB5_TYPE_PREFIXES) {\n if (fullPath === prefix || fullPath.startsWith(prefix + '/')) {\n const path = fullPath.slice(prefix.length + 1);\n\n switch (prefix) {\n case Web5UrlType.ENTITY: {\n const slashIndex = path.indexOf('/');\n if (slashIndex === -1) {\n return {\n type: Web5UrlType.ENTITY,\n path,\n entityType: path,\n entityId: '',\n };\n }\n return {\n type: Web5UrlType.ENTITY,\n path,\n entityType: path.slice(0, slashIndex),\n entityId: path.slice(slashIndex + 1),\n };\n }\n case Web5UrlType.ACTION: {\n const qIndex = path.indexOf('?');\n if (qIndex === -1) {\n return {\n type: Web5UrlType.ACTION,\n path,\n actionName: path,\n actionParams: {},\n };\n }\n const params: Record<string, string> = {};\n const searchParams = new URLSearchParams(path.slice(qIndex + 1));\n searchParams.forEach((value, key) => {\n params[key] = value;\n });\n return {\n type: Web5UrlType.ACTION,\n path,\n actionName: path.slice(0, qIndex),\n actionParams: params,\n };\n }\n case Web5UrlType.SEARCH:\n return {\n type: Web5UrlType.SEARCH,\n path,\n searchQuery: path\n ? decodeURIComponent(path.replace(/\\+/g, ' '))\n : '',\n };\n case Web5UrlType.ASK:\n return { type: Web5UrlType.ASK, path };\n case Web5UrlType.IMAGE:\n return { type: Web5UrlType.IMAGE, path };\n case Web5UrlType.ICON:\n return { type: Web5UrlType.ICON, path };\n }\n }\n }\n\n return null;\n}\n\n/**\n * Check if a URL is a valid web5:// URL with a recognized type prefix.\n */\nexport function isValidWeb5Url(url: string): boolean {\n return parseWeb5Url(url) !== null;\n}\n\n/** Known legacy protocols that are no longer supported */\nconst LEGACY_PROTOCOLS = ['entity://', 'image://', 'action://', 'ask://'];\n\n/**\n * Validate whether a URL is safe to render as a clickable link.\n *\n * - Standard protocols (http, https, mailto, relative paths) → allowed\n * - Valid `web5://` URLs (recognized type prefix) → allowed\n * - Invalid `web5://` URLs (unrecognized prefix) → rejected\n * - Legacy protocols (`entity://`, `image://`, `action://`, `ask://`) → rejected\n * - Other custom protocols → rejected\n *\n * @returns the URL as `ValidLinkUrl` if valid, or `undefined` if it should not be rendered.\n * When invalid, logs a warning for observability.\n */\nexport function validateLinkUrl(\n url: string | undefined,\n): ValidLinkUrl | undefined {\n if (!url) {\n return undefined;\n }\n\n if (\n url.startsWith('http://') ||\n url.startsWith('https://') ||\n url.startsWith('mailto:') ||\n url.startsWith('/')\n ) {\n return url as ValidLinkUrl;\n }\n\n if (url.startsWith('web5://')) {\n if (parseWeb5Url(url)) {\n return url as ValidLinkUrl;\n }\n console.log(`[web5-link] Invalid web5:// URL rejected: \"${url}\"`);\n return undefined;\n }\n\n if (LEGACY_PROTOCOLS.some((p) => url.startsWith(p))) {\n console.log(\n `[web5-link] Legacy protocol URL rejected: \"${url}\". Use web5:// format instead.`,\n );\n return undefined;\n }\n\n return undefined;\n}\n\n/**\n * Check if a URL is a web5://entity/ link\n * @param url - The URL to check\n * @returns true if the URL is an entity link\n */\nexport function isEntityLink(url: string): boolean {\n if (!url || typeof url !== 'string') {\n return false;\n }\n return isWeb5EntityUrl(url);\n}\n\n/**\n * Parse a web5://entity/ URL and extract entityType and entityId\n * Format: web5://entity/{entityType}/{entityId}\n *\n * @param url - The web5://entity/ URL to parse\n * @returns Object with entityType and entityId, or null if not a valid entity link\n *\n * @example\n * parseEntityLink('web5://entity/blog_post/abc123')\n * // Returns: { entityType: 'blog_post', entityId: 'abc123' }\n */\nexport function parseEntityLink(\n url: string,\n): { entityType: string; entityId: string } | null {\n if (!isEntityLink(url)) {\n return null;\n }\n\n const path = url.slice('web5://entity/'.length);\n\n // Split by '/' to get entityType and entityId\n const slashIndex = path.indexOf('/');\n if (slashIndex === -1) {\n // No slash found - only entityType, no entityId\n const entityType = path.trim();\n if (entityType) {\n return { entityType, entityId: '' };\n }\n return null;\n }\n\n const entityType = path.slice(0, slashIndex).trim();\n const entityId = path.slice(slashIndex + 1).trim();\n\n if (!entityType) {\n return null;\n }\n\n return { entityType, entityId };\n}\n\n/**\n * Extract protocol from a URL\n * @param url - The URL to extract protocol from\n * @returns The protocol (e.g., 'entity', 'http', 'https') or undefined\n */\nexport function extractProtocol(url: string): string | undefined {\n if (!url || typeof url !== 'string') {\n return undefined;\n }\n\n const match = url.match(/^([a-zA-Z][a-zA-Z0-9+.-]*):\\/\\//);\n if (match) {\n return match[1].toLowerCase();\n }\n\n return undefined;\n}\n\n/**\n * Extract LinkMetadata from a link AST node\n * @param node - AST node of type 'link'\n * @returns LinkMetadata object with url, protocol, and entity fields, or null\n * when the URL is missing or whitespace-only (empty-href links are dropped\n * by the upstream pipeline; see `markdownBlocks.ts`).\n */\nexport function extractLinkMetadata(node: any): LinkMetadata | null {\n if (!node || node.type !== 'link') {\n return null;\n }\n\n const url = node.url;\n if (typeof url !== 'string' || url.trim() === '') {\n return null;\n }\n\n const metadata: LinkMetadata = {\n url,\n };\n\n // Extract protocol\n const protocol = extractProtocol(url);\n if (protocol) {\n metadata.protocol = protocol;\n }\n\n if (protocol === 'web5') {\n const parsed = parseWeb5Url(url);\n if (parsed) {\n metadata.web5Type = parsed.type;\n if (parsed.type === Web5UrlType.ENTITY) {\n metadata.entityType = parsed.entityType;\n metadata.entityId = parsed.entityId;\n }\n }\n }\n\n return metadata;\n}\n"],"mappings":";;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAiDA,MAAMC,kBAAkB,GAAGC,MAAM,CAACC,MAAM,CAACC,sBAAW,CAAC;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,YAAYA,CAACC,GAAW,EAAwB;EAC9D,IAAI,CAACA,GAAG,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;IACnC,OAAO,IAAI;EACb;EAEA,IAAI,CAACA,GAAG,CAACC,UAAU,CAAC,SAAS,CAAC,EAAE;IAC9B,OAAO,IAAI;EACb;EAEA,MAAMC,QAAQ,GAAGF,GAAG,CAACG,KAAK,CAAC,SAAS,CAACC,MAAM,CAAC;EAC5C,IAAI,CAACF,QAAQ,EAAE;IACb,OAAO,IAAI;EACb;EAEA,KAAK,MAAMG,MAAM,IAAIV,kBAAkB,EAAE;IACvC,IAAIO,QAAQ,KAAKG,MAAM,IAAIH,QAAQ,CAACD,UAAU,CAACI,MAAM,GAAG,GAAG,CAAC,EAAE;MAC5D,MAAMC,IAAI,GAAGJ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AAGD,MAAM,CAACvC,IAAI;MAC/B,IAAIuC,MAAM,CAACvC,IAAI,KAAKZ,sBAAW,CAACS,MAAM,EAAE;QACtCwC,QAAQ,CAACpC,UAAU,GAAGsC,MAAM,CAACtC,UAAU;QACvCoC,QAAQ,CAACnC,QAAQ,GAAGqC,MAAM,CAACrC,QAAQ;MACrC;IACF;EACF;EAEA,OAAOmC,QAAQ;AACjB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_linkTypes","require","WEB5_TYPE_PREFIXES","Object","values","Web5UrlType","parseWeb5Url","url","startsWith","fullPath","slice","length","prefix","path","ENTITY","slashIndex","indexOf","type","entityType","entityId","ACTION","qIndex","actionName","actionParams","params","searchParams","URLSearchParams","forEach","value","key","SEARCH","searchQuery","decodeURIComponent","replace","ASK","IMAGE","ICON","isValidWeb5Url","LEGACY_PROTOCOLS","validateLinkUrl","undefined","console","log","some","p","isEntityLink","isWeb5EntityUrl","parseEntityLink","trim","extractProtocol","match","toLowerCase","extractLinkMetadata","node","metadata","protocol","parsed","web5Type"],"sources":["../../../src/utils/entityLinkParser.ts"],"sourcesContent":["import type { LinkMetadata } from '../patternValidator/types';\nimport {\n Web5UrlType,\n isWeb5EntityUrl,\n type ValidLinkUrl,\n} from '../types/link-types';\n\nexport interface Web5AskParsed {\n type: Web5UrlType.ASK;\n path: string;\n}\n\nexport interface Web5EntityParsed {\n type: Web5UrlType.ENTITY;\n path: string;\n entityType: string;\n entityId: string;\n}\n\nexport interface Web5ImageParsed {\n type: Web5UrlType.IMAGE;\n path: string;\n}\n\nexport interface Web5IconParsed {\n type: Web5UrlType.ICON;\n path: string;\n}\n\nexport interface Web5ActionParsed {\n type: Web5UrlType.ACTION;\n path: string;\n actionName: string;\n actionParams: Record<string, string>;\n}\n\nexport interface Web5SearchParsed {\n type: Web5UrlType.SEARCH;\n path: string;\n searchQuery: string;\n}\n\nexport type Web5UrlParsed =\n | Web5AskParsed\n | Web5EntityParsed\n | Web5ImageParsed\n | Web5IconParsed\n | Web5ActionParsed\n | Web5SearchParsed;\n\nconst WEB5_TYPE_PREFIXES = Object.values(Web5UrlType);\n\n/**\n * Central parser for unified web5:// URLs.\n *\n * Supported formats:\n * - `web5://ask/msg` → `{ type: Web5UrlType.ASK, path: 'msg' }`\n * - `web5://entity/solution/123` → `{ type: Web5UrlType.ENTITY, path: 'solution/123', entityType: 'solution', entityId: '123' }`\n * - `web5://image/kw` → `{ type: Web5UrlType.IMAGE, path: 'kw' }`\n * - `web5://icon/name` → `{ type: Web5UrlType.ICON, path: 'name' }`\n * - `web5://action/name?param=val` → `{ type: Web5UrlType.ACTION, path: 'name?param=val', actionName: 'name', actionParams: { param: 'val' } }`\n * - `web5://search/query` → `{ type: Web5UrlType.SEARCH, path: 'query', searchQuery: 'query' }`\n */\nexport function parseWeb5Url(url: string): Web5UrlParsed | null {\n if (!url || typeof url !== 'string') {\n return null;\n }\n\n if (!url.startsWith('web5://')) {\n return null;\n }\n\n const fullPath = url.slice('web5://'.length);\n if (!fullPath) {\n return null;\n }\n\n for (const prefix of WEB5_TYPE_PREFIXES) {\n if (fullPath === prefix || fullPath.startsWith(prefix + '/')) {\n const path = fullPath.slice(prefix.length + 1);\n\n switch (prefix) {\n case Web5UrlType.ENTITY: {\n const slashIndex = path.indexOf('/');\n if (slashIndex === -1) {\n // The type segment is used verbatim (the `<type>` in\n // `web5://entity/<type>/<id>`); the backend sends the semantic type.\n return {\n type: Web5UrlType.ENTITY,\n path,\n entityType: path,\n entityId: '',\n };\n }\n return {\n type: Web5UrlType.ENTITY,\n path,\n entityType: path.slice(0, slashIndex),\n entityId: path.slice(slashIndex + 1),\n };\n }\n case Web5UrlType.ACTION: {\n const qIndex = path.indexOf('?');\n if (qIndex === -1) {\n return {\n type: Web5UrlType.ACTION,\n path,\n actionName: path,\n actionParams: {},\n };\n }\n const params: Record<string, string> = {};\n const searchParams = new URLSearchParams(path.slice(qIndex + 1));\n searchParams.forEach((value, key) => {\n params[key] = value;\n });\n return {\n type: Web5UrlType.ACTION,\n path,\n actionName: path.slice(0, qIndex),\n actionParams: params,\n };\n }\n case Web5UrlType.SEARCH:\n return {\n type: Web5UrlType.SEARCH,\n path,\n searchQuery: path\n ? decodeURIComponent(path.replace(/\\+/g, ' '))\n : '',\n };\n case Web5UrlType.ASK:\n return { type: Web5UrlType.ASK, path };\n case Web5UrlType.IMAGE:\n return { type: Web5UrlType.IMAGE, path };\n case Web5UrlType.ICON:\n return { type: Web5UrlType.ICON, path };\n }\n }\n }\n\n return null;\n}\n\n/**\n * Check if a URL is a valid web5:// URL with a recognized type prefix.\n */\nexport function isValidWeb5Url(url: string): boolean {\n return parseWeb5Url(url) !== null;\n}\n\n/** Known legacy protocols that are no longer supported */\nconst LEGACY_PROTOCOLS = ['entity://', 'image://', 'action://', 'ask://'];\n\n/**\n * Validate whether a URL is safe to render as a clickable link.\n *\n * - Standard protocols (http, https, mailto, relative paths) → allowed\n * - Valid `web5://` URLs (recognized type prefix) → allowed\n * - Invalid `web5://` URLs (unrecognized prefix) → rejected\n * - Legacy protocols (`entity://`, `image://`, `action://`, `ask://`) → rejected\n * - Other custom protocols → rejected\n *\n * @returns the URL as `ValidLinkUrl` if valid, or `undefined` if it should not be rendered.\n * When invalid, logs a warning for observability.\n */\nexport function validateLinkUrl(\n url: string | undefined,\n): ValidLinkUrl | undefined {\n if (!url) {\n return undefined;\n }\n\n if (\n url.startsWith('http://') ||\n url.startsWith('https://') ||\n url.startsWith('mailto:') ||\n url.startsWith('/')\n ) {\n return url as ValidLinkUrl;\n }\n\n if (url.startsWith('web5://')) {\n if (parseWeb5Url(url)) {\n return url as ValidLinkUrl;\n }\n console.log(`[web5-link] Invalid web5:// URL rejected: \"${url}\"`);\n return undefined;\n }\n\n if (LEGACY_PROTOCOLS.some((p) => url.startsWith(p))) {\n console.log(\n `[web5-link] Legacy protocol URL rejected: \"${url}\". Use web5:// format instead.`,\n );\n return undefined;\n }\n\n return undefined;\n}\n\n/**\n * Check if a URL is a web5://entity/ link\n * @param url - The URL to check\n * @returns true if the URL is an entity link\n */\nexport function isEntityLink(url: string): boolean {\n if (!url || typeof url !== 'string') {\n return false;\n }\n return isWeb5EntityUrl(url);\n}\n\n/**\n * Parse a web5://entity/ URL and extract entityType and entityId\n * Format: web5://entity/{entityType}/{entityId}\n *\n * @param url - The web5://entity/ URL to parse\n * @returns Object with entityType and entityId, or null if not a valid entity link\n *\n * @example\n * parseEntityLink('web5://entity/blog_post/abc123')\n * // Returns: { entityType: 'blog_post', entityId: 'abc123' }\n */\nexport function parseEntityLink(\n url: string,\n): { entityType: string; entityId: string } | null {\n if (!isEntityLink(url)) {\n return null;\n }\n\n const path = url.slice('web5://entity/'.length);\n\n // Split by '/' to get entityType and entityId. The type is used verbatim.\n const slashIndex = path.indexOf('/');\n if (slashIndex === -1) {\n // No slash found - only entityType, no entityId\n const entityType = path.trim();\n if (entityType) {\n return { entityType, entityId: '' };\n }\n return null;\n }\n\n const entityType = path.slice(0, slashIndex).trim();\n const entityId = path.slice(slashIndex + 1).trim();\n\n if (!entityType) {\n return null;\n }\n\n return { entityType, entityId };\n}\n\n/**\n * Extract protocol from a URL\n * @param url - The URL to extract protocol from\n * @returns The protocol (e.g., 'entity', 'http', 'https') or undefined\n */\nexport function extractProtocol(url: string): string | undefined {\n if (!url || typeof url !== 'string') {\n return undefined;\n }\n\n const match = url.match(/^([a-zA-Z][a-zA-Z0-9+.-]*):\\/\\//);\n if (match) {\n return match[1].toLowerCase();\n }\n\n return undefined;\n}\n\n/**\n * Extract LinkMetadata from a link AST node\n * @param node - AST node of type 'link'\n * @returns LinkMetadata object with url, protocol, and entity fields, or null\n * when the URL is missing or whitespace-only (empty-href links are dropped\n * by the upstream pipeline; see `markdownBlocks.ts`).\n */\nexport function extractLinkMetadata(node: any): LinkMetadata | null {\n if (!node || node.type !== 'link') {\n return null;\n }\n\n const url = node.url;\n if (typeof url !== 'string' || url.trim() === '') {\n return null;\n }\n\n const metadata: LinkMetadata = {\n url,\n };\n\n // Extract protocol\n const protocol = extractProtocol(url);\n if (protocol) {\n metadata.protocol = protocol;\n }\n\n if (protocol === 'web5') {\n const parsed = parseWeb5Url(url);\n if (parsed) {\n metadata.web5Type = parsed.type;\n if (parsed.type === Web5UrlType.ENTITY) {\n metadata.entityType = parsed.entityType;\n metadata.entityId = parsed.entityId;\n }\n }\n }\n\n return metadata;\n}\n"],"mappings":";;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAiDA,MAAMC,kBAAkB,GAAGC,MAAM,CAACC,MAAM,CAACC,sBAAW,CAAC;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,YAAYA,CAACC,GAAW,EAAwB;EAC9D,IAAI,CAACA,GAAG,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;IACnC,OAAO,IAAI;EACb;EAEA,IAAI,CAACA,GAAG,CAACC,UAAU,CAAC,SAAS,CAAC,EAAE;IAC9B,OAAO,IAAI;EACb;EAEA,MAAMC,QAAQ,GAAGF,GAAG,CAACG,KAAK,CAAC,SAAS,CAACC,MAAM,CAAC;EAC5C,IAAI,CAACF,QAAQ,EAAE;IACb,OAAO,IAAI;EACb;EAEA,KAAK,MAAMG,MAAM,IAAIV,kBAAkB,EAAE;IACvC,IAAIO,QAAQ,KAAKG,MAAM,IAAIH,QAAQ,CAACD,UAAU,CAACI,MAAM,GAAG,GAAG,CAAC,EAAE;MAC5D,MAAMC,IAAI,GAAGJ,QAAQ,CAACC,KAAK,CAACE,MAAM,CAACD,MAAM,GAAG,CAAC,CAAC;MAE9C,QAAQC,MAAM;QACZ,KAAKP,sBAAW,CAACS,MAAM;UAAE;YACvB,MAAMC,UAAU,GAAGF,IAAI,CAACG,OAAO,CAAC,GAAG,CAAC;YACpC,IAAID,UAAU,KAAK,CAAC,CAAC,EAAE;cACrB;cACA;cACA,OAAO;gBACLE,IAAI,EAAEZ,sBAAW,CAACS,MAAM;gBACxBD,IAAI;gBACJK,UAAU,EAAEL,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